Minahito
minah****@users*****
2006年 1月 12日 (木) 13:21:05 JST
Index: xoops2jp/html/modules/user/admin/forms/UserAdminEditForm.class.php diff -u xoops2jp/html/modules/user/admin/forms/UserAdminEditForm.class.php:1.1.2.1 xoops2jp/html/modules/user/admin/forms/UserAdminEditForm.class.php:1.1.2.2 --- xoops2jp/html/modules/user/admin/forms/UserAdminEditForm.class.php:1.1.2.1 Thu Jan 12 01:42:35 2006 +++ xoops2jp/html/modules/user/admin/forms/UserAdminEditForm.class.php Thu Jan 12 13:21:05 2006 @@ -31,7 +31,7 @@ $this->mFormProperties['rank'] =& new XCube_IntProperty('rank'); $this->mFormProperties['level'] =& new XCube_IntProperty('level'); $this->mFormProperties['timezone_offset'] =& new XCube_FloatProperty('timezone_offset'); - $this->mFormProperties['umode'] =& new XCube_IntProperty('umode'); + $this->mFormProperties['umode'] =& new XCube_StringProperty('umode'); $this->mFormProperties['uorder'] =& new XCube_IntProperty('uorder'); $this->mFormProperties['notify_method'] =& new XCube_IntProperty('notify_method'); $this->mFormProperties['notify_mode'] =& new XCube_IntProperty('notify_mode'); @@ -141,22 +141,22 @@ $this->mFieldProperties['uorder']->setDependsByArray(array('required','intRange')); $this->mFieldProperties['uorder']->addMessage('required', _AD_USER_ERROR_REQUIRED, _AD_USER_LANG_UORDER); $this->mFieldProperties['uorder']->addMessage('intRange', _AD_USER_ERROR_INJURY, _AD_USER_LANG_UORDER); - $this->mFieldProperties['uorder']->addVar('min', 1); - $this->mFieldProperties['uorder']->addVar('max', 2); + $this->mFieldProperties['uorder']->addVar('min', 0); + $this->mFieldProperties['uorder']->addVar('max', 1); $this->mFieldProperties['notify_method'] =& new XCube_FieldProperty($this); $this->mFieldProperties['notify_method']->setDependsByArray(array('required','intRange')); $this->mFieldProperties['notify_method']->addMessage('required', _AD_USER_ERROR_REQUIRED, _AD_USER_LANG_NOTIFY_METHOD); $this->mFieldProperties['notify_method']->addMessage('intRange', _AD_USER_ERROR_INJURY, _AD_USER_LANG_NOTIFY_METHOD); - $this->mFieldProperties['notify_method']->addVar('min', 1); - $this->mFieldProperties['notify_method']->addVar('max', 3); + $this->mFieldProperties['notify_method']->addVar('min', 0); + $this->mFieldProperties['notify_method']->addVar('max', 2); $this->mFieldProperties['notify_mode'] =& new XCube_FieldProperty($this); $this->mFieldProperties['notify_mode']->setDependsByArray(array('required','intRange')); $this->mFieldProperties['notify_mode']->addMessage('required', _AD_USER_ERROR_REQUIRED, _AD_USER_LANG_NOTIFY_MODE); $this->mFieldProperties['notify_mode']->addMessage('intRange', _AD_USER_ERROR_INJURY, _AD_USER_LANG_NOTIFY_MODE); - $this->mFieldProperties['notify_mode']->addVar('min', 1); - $this->mFieldProperties['notify_mode']->addVar('max', 3); + $this->mFieldProperties['notify_mode']->addVar('min', 0); + $this->mFieldProperties['notify_mode']->addVar('max', 2); $this->mFieldProperties['user_occ'] =& new XCube_FieldProperty($this); $this->mFieldProperties['user_occ']->setDependsByArray(array('maxlength')); @@ -175,6 +175,35 @@ $this->mFieldProperties['user_mailok']->setDependsByArray(array('')); } + function validateGroups() + { + $groupHandler =& xoops_gethandler('group'); + foreach ($this->get('groups') as $gid) { + $group =& $groupHandler->get($gid); + if (!is_object($group)) { + $this->addErrorMessage(_AD_USER_ERROR_GROUP_VALUE); + } + } + } + + function validatePass() + { + if (strlen($this->get('pass'))) { + if ($this->get('pass') != $this->get('vpass')) { + $this->addErrorMessage(_AD_USER_ERROR_PASSWORD); + $this->set('pass', ''); + $this->set('vpass', ''); + } + } + } + + function validateUmode() + { + if (in_array($this->get('umode'), array('nest', 'flat', 'thread'))) { + $this->addErrorMessage(_AD_USER_ERROR_UMODE); + } + } + function load(&$obj) { $this->setVar('uid', $obj->get('uid')); @@ -226,8 +255,9 @@ $obj->setVar('user_yim', $this->get('user_yim')); $obj->setVar('user_msnm', $this->get('user_msnm')); - // $obj->setVar('pass', $this->get('pass')); - // $obj->setVar('vpass', $this->get('vpass')); + if (strlen($this->get('pass'))) { + $obj->set('pass', md5($this->get('pass'))); + } $obj->setVar('posts', $this->get('posts')); $obj->setVar('attachsig', $this->get('attachsig'));