[xoops-cvslog 2293] CVS update: xoops2jp/html/modules/user/forms

Back to archive index

NobuNobu nobun****@users*****
2006年 2月 5日 (日) 19:33:39 JST


Index: xoops2jp/html/modules/user/forms/AbstractUserEditForm.class.php
diff -u xoops2jp/html/modules/user/forms/AbstractUserEditForm.class.php:1.1.2.3 xoops2jp/html/modules/user/forms/AbstractUserEditForm.class.php:1.1.2.4
--- xoops2jp/html/modules/user/forms/AbstractUserEditForm.class.php:1.1.2.3	Sat Feb  4 16:52:47 2006
+++ xoops2jp/html/modules/user/forms/AbstractUserEditForm.class.php	Sun Feb  5 19:33:39 2006
@@ -9,16 +9,23 @@
 {
 	var $mConfig = array();
 	
+	function prepare($userConfig)
+	{
+		$this->mConfig = $userConfig;
+	}
+	
 	function validateUname()
 	{
-		if($this->getVar('uname')) {
-
+		if($this->get('uname')) {
 			//
 			// uname unique check
 			//
 			$userHandler=&xoops_gethandler('user');
-			$count=$userHandler->getCount(new Criteria('uname',$this->getVar('uname')));
-			if($count!=0) {
+			$criteria =& new CriteriaCompo(new Criteria('uname', $this->get('uname')));
+			if ($this->get('uid')) {
+				$criteria->add(new Criteria('uid', $this->get('uid'), '<>'));
+			}
+			if ($userHandler->getCount($criteria) > 0) {
 				$this->addErrorMessage(_US_NICKNAMETAKEN);
 			}
 
@@ -39,16 +46,15 @@
 					$regex="//[\000-\040]/";
 					break;
 			}
-			if(preg_match($regex,$this->getVar('uname'))) {
+			if(preg_match($regex,$this->get('uname'))) {
 				$this->addErrorMessage(_US_INVALIDNICKNAME);
 			}
 
-
 			//
 			// Check bad uname patterns.
 			//
 			foreach(explode("|",$this->mConfig['bad_unames']) as $pattern) {
-				if(!empty($pattern)&&preg_match("/".$pattern."/i",$this->getVar('uname'))) {
+				if(!empty($pattern)&&preg_match("/".$pattern."/i",$this->get('uname'))) {
 					$this->addErrorMessage(_US_NAMERESERVED);
 					break;
 				}
@@ -74,12 +80,13 @@
 	
 	function validatePass()
 	{
-		if(strlen($this->getVar('pass'))>0||strlen($this->getVar('vpass'))>0)
-			if($this->getVar('pass')!=$this->getVar('vpass')) {
+		if (strlen($this->get('pass'))>0||strlen($this->get('vpass'))>0) {
+			if($this->get('pass')!=$this->get('vpass')) {
 				$this->addErrorMessage(_MD_USER_ERROR_PASSWORD);
 				$this->set('pass',null);	// reset
 				$this->set('vpass',null);
 			}
+		}
 	}
 }
 
Index: xoops2jp/html/modules/user/forms/UserRegisterEditForm.class.php
diff -u xoops2jp/html/modules/user/forms/UserRegisterEditForm.class.php:1.1.2.4 xoops2jp/html/modules/user/forms/UserRegisterEditForm.class.php:1.1.2.5
--- xoops2jp/html/modules/user/forms/UserRegisterEditForm.class.php:1.1.2.4	Sat Feb  4 22:35:32 2006
+++ xoops2jp/html/modules/user/forms/UserRegisterEditForm.class.php	Sun Feb  5 19:33:39 2006
@@ -12,8 +12,9 @@
 		return "module.user.UserRegisterEditForm.TOKEN";
 	}
 
-	function prepare()
+	function prepare($userConfig)
 	{
+		parent::prepare($userConfig);
 		//
 		// Set form properties
 		//
@@ -33,14 +34,17 @@
 		// Set field properties
 		//
 		$this->mFieldProperties['uname'] =& new XCube_FieldProperty($this);
-		$this->mFieldProperties['uname']->setDependsByArray(array('required','maxlength'));
+		$this->mFieldProperties['uname']->setDependsByArray(array('required','maxlength','minlength'));
 		$this->mFieldProperties['uname']->addMessage('required', _MD_USER_ERROR_REQUIRED, _MD_USER_LANG_UNAME, '25');
-		$this->mFieldProperties['uname']->addMessage('maxlength', _MD_USER_ERROR_MAXLENGTH, _MD_USER_LANG_UNAME, '25');
-		$this->mFieldProperties['uname']->addVar('maxlength', 25);
+		$this->mFieldProperties['uname']->addMessage('maxlength', _MD_USER_ERROR_MAXLENGTH, _MD_USER_LANG_UNAME, min(25,$this->mConfig['maxuname']));
+		$this->mFieldProperties['uname']->addMessage('minlength', _MD_USER_ERROR_MINLENGTH, _MD_USER_LANG_UNAME, $this->mConfig['minuname']);
+		$this->mFieldProperties['uname']->addVar('maxlength', min(25,$this->mConfig['maxuname']));
+		$this->mFieldProperties['uname']->addVar('minlength', $this->mConfig['minuname']);
 
 		$this->mFieldProperties['email'] =& new XCube_FieldProperty($this);
-		$this->mFieldProperties['email']->setDependsByArray(array('maxlength'));
+		$this->mFieldProperties['email']->setDependsByArray(array('required','maxlength'));
 		$this->mFieldProperties['email']->addMessage('maxlength', _MD_USER_ERROR_MAXLENGTH, _MD_USER_LANG_EMAIL, '60');
+		$this->mFieldProperties['email']->addMessage('required', _MD_USER_ERROR_REQUIRED, _MD_USER_LANG_EMAIL, '60');
 		$this->mFieldProperties['email']->addVar('maxlength', 60);
 
 		$this->mFieldProperties['url'] =& new XCube_FieldProperty($this);
@@ -49,13 +53,17 @@
 		$this->mFieldProperties['url']->addVar('maxlength', 100);
 
 		$this->mFieldProperties['pass'] =& new XCube_FieldProperty($this);
-		$this->mFieldProperties['pass']->setDependsByArray(array('maxlength'));
+		$this->mFieldProperties['pass']->setDependsByArray(array('required','minlength','maxlength'));
+		$this->mFieldProperties['pass']->addMessage('required', _MD_USER_ERROR_REQUIRED, _MD_USER_LANG_PASS, '32');
+		$this->mFieldProperties['pass']->addMessage('minlength', _MD_USER_ERROR_MAXLENGTH, _MD_USER_LANG_PASS, $this->mConfig['minpass']);
 		$this->mFieldProperties['pass']->addMessage('maxlength', _MD_USER_ERROR_MAXLENGTH, _MD_USER_LANG_PASS, '32');
+		$this->mFieldProperties['pass']->addVar('minlength', $this->mConfig['minpass']);
 		$this->mFieldProperties['pass']->addVar('maxlength', 32);
 
 		$this->mFieldProperties['vpass'] =& new XCube_FieldProperty($this);
-		$this->mFieldProperties['vpass']->setDependsByArray(array('maxlength'));
-		$this->mFieldProperties['vpass']->addMessage('maxlength', _MD_USER_ERROR_MAXLENGTH, _MD_USER_LANG_PASS, '32');
+		$this->mFieldProperties['vpass']->setDependsByArray(array('required','maxlength'));
+		$this->mFieldProperties['vpass']->addMessage('required', _MD_USER_ERROR_REQUIRED, _US_VERIFYPASS, '32');
+		$this->mFieldProperties['vpass']->addMessage('maxlength', _MD_USER_ERROR_MAXLENGTH, _US_VERIFYPASS, '32');
 		$this->mFieldProperties['vpass']->addVar('maxlength', 32);
 
 		$this->mFieldProperties['timezone_offset'] =& new XCube_FieldProperty($this);


xoops-cvslog メーリングリストの案内
Back to archive index