PageRenderTime 47ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/inc/bx/dbforms2/fields/password/md5.php

https://github.com/chregu/fluxcms
PHP | 75 lines | 24 code | 7 blank | 44 comment | 11 complexity | 159a649952283d878390816b2f89170e MD5 | raw file
Possible License(s): GPL-2.0, BSD-3-Clause, Apache-2.0, LGPL-2.1
  1. <?php
  2. // +----------------------------------------------------------------------+
  3. // | Flux CMS |
  4. // +----------------------------------------------------------------------+
  5. // | Copyright (c) 2001-2007 Liip AG |
  6. // +----------------------------------------------------------------------+
  7. // | This program is free software; you can redistribute it and/or |
  8. // | modify it under the terms of the GNU General Public License (GPL) |
  9. // | as published by the Free Software Foundation; either version 2 |
  10. // | of the License, or (at your option) any later version. |
  11. // | The GPL can be found at http://www.gnu.org/licenses/gpl.html |
  12. // +----------------------------------------------------------------------+
  13. // | Author: Liip AG <contact@liip.ch> |
  14. // +----------------------------------------------------------------------+
  15. //
  16. // $Id: field.php 4831 2005-06-30 14:41:20Z philipp $
  17. /**
  18. * DOCUMENT_ME
  19. *
  20. * @package bx_dbforms2
  21. * @category
  22. * @author Liip AG <contact@liip.ch>
  23. */
  24. class bx_dbforms2_fields_password_md5 extends bx_dbforms2_fields_password {
  25. /**
  26. * DOCUMENT_ME
  27. *
  28. * @param type $var descr
  29. * @access public
  30. * @return type descr
  31. */
  32. public function __construct($name) {
  33. parent::__construct($name);
  34. }
  35. /**
  36. * DOCUMENT_ME
  37. *
  38. * @param type $var descr
  39. * @access public
  40. * @return type descr
  41. */
  42. public function getSQLName($type = null) {
  43. //bx_helpers_debug::webdump($this->parentForm->queryMode);
  44. $type = $this->parentForm->queryMode;
  45. if ($type == bx_dbforms2::QUERYMODE_SELECT) {
  46. return "'' as " . $this->name;
  47. } else if ($type == bx_dbforms2::QUERYMODE_UPDATE && trim($this->value) == '' ) {
  48. return false;
  49. } else {
  50. return $this->name;
  51. }
  52. }
  53. /**
  54. * DOCUMENT_ME
  55. *
  56. * @param type $var descr
  57. * @access public
  58. * @return type descr
  59. */
  60. public function getSQLValue() {
  61. if (strlen($this->value) != 32) {
  62. return md5($this->value);
  63. } else {
  64. return $this->value;
  65. }
  66. }
  67. }
  68. ?>