[xoops-cvslog 2086] CVS update: xoops2jp/html/class

Back to archive index

Minahito minah****@users*****
2006年 2月 2日 (木) 20:49:23 JST


Index: xoops2jp/html/class/XCube_ActionForm.class.php
diff -u xoops2jp/html/class/XCube_ActionForm.class.php:1.1.2.26 xoops2jp/html/class/XCube_ActionForm.class.php:1.1.2.27
--- xoops2jp/html/class/XCube_ActionForm.class.php:1.1.2.26	Sat Jan 28 23:50:29 2006
+++ xoops2jp/html/class/XCube_ActionForm.class.php	Thu Feb  2 20:49:23 2006
@@ -63,6 +63,16 @@
 		return $this->_mToken;
 	}
 	
+	/**
+	 * Return message when the validation of token is fail.
+	 * 
+	 * @return string
+	 */
+	function getTokenErrorMessage()
+	{
+		return _TOKEN_ERROR;
+	}
+	
 	function set()
 	{
 		if(isset($this->mFormProperties[func_get_arg(0)])) {
@@ -128,12 +138,24 @@
 		if ($this->getTokenName() != null) {
 			$token = xoops_getrequest(strtr($this->getTokenName(), '.', '_'));
 			
+			$flag = true;
+			
 			if (!isset($_SESSION['XCUBE_TOKEN'][$this->getTokenName()])) {
-				$this->addErrorMessage(_TOKEN_ERROR);
+				$flag = false;
 			}
 			elseif ($_SESSION['XCUBE_TOKEN'][$this->getTokenName()] != $token) {
 				unset($_SESSION['XCUBE_TOKEN'][$this->getTokenName()]);
-				$this->addErrorMessage(_TOKEN_ERROR);
+				$flag = false;
+			}
+			
+			if (!$flag) {
+				$message = $this->getTokenErrorMessage();
+				if ($message == null) {
+					$this->mErrorFlag = true;
+				}
+				else {
+					$this->addErrorMessage($message);
+				}
 			}
 			
 			//
@@ -167,9 +189,14 @@
 		}
 	}
 
+	/**
+	 * If the action form keeps error messages or the error flag, return true.
+	 * 
+	 * @return bool
+	 */
 	function hasError()
 	{
-		return count($this->mErrorMessages)>0;
+		return (count($this->mErrorMessages) > 0 || $this->mErrorFlag);
 	}
 	
 	function addErrorMessage($message)


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