[xoops-cvslog 4649] CVS update: xoops2jp/html/kernel

Back to archive index

Minahito minah****@users*****
2006年 9月 28日 (木) 14:00:41 JST


Index: xoops2jp/html/kernel/XCube_LanguageManager.class.php
diff -u xoops2jp/html/kernel/XCube_LanguageManager.class.php:1.1.2.3 xoops2jp/html/kernel/XCube_LanguageManager.class.php:1.1.2.3.2.1
--- xoops2jp/html/kernel/XCube_LanguageManager.class.php:1.1.2.3	Wed Aug 30 19:05:37 2006
+++ xoops2jp/html/kernel/XCube_LanguageManager.class.php	Thu Sep 28 14:00:41 2006
@@ -1,7 +1,7 @@
 <?php
 /**
  * @package XCube
- * @version $Id: XCube_LanguageManager.class.php,v 1.1.2.3 2006/08/30 10:05:37 minahito Exp $
+ * @version $Id: XCube_LanguageManager.class.php,v 1.1.2.3.2.1 2006/09/28 05:00:41 minahito Exp $
  */
 
 /**
Index: xoops2jp/html/kernel/XCube_PageNavigator.class.php
diff -u /dev/null xoops2jp/html/kernel/XCube_PageNavigator.class.php:1.1.2.1
--- /dev/null	Thu Sep 28 14:00:41 2006
+++ xoops2jp/html/kernel/XCube_PageNavigator.class.php	Thu Sep 28 14:00:41 2006
@@ -0,0 +1,181 @@
+<?php
+/**
+ * @package XCube
+ * @version $Id: XCube_PageNavigator.class.php,v 1.1.2.1 2006/09/28 05:00:41 minahito Exp $
+ */
+
+define("XCUBE_PAGENAVI_START",1);
+define("XCUBE_PAGENAVI_PERPAGE",2);
+
+/**
+ * This is a class in a semiautomatic that acquires page navigation information.  
+ */
+class XCube_PageNavigator
+{
+	var $mStart=0;
+	var $mTotal=0;
+
+	var $mPerpage = 20;
+	var $mPerpageFreeze = false;
+	
+	var $mUrl=null;
+	
+	var $mPrefix = null;
+
+	var $mExtra=array();
+	
+	var $mFlags=0;
+
+	function XCube_PageNavigator($url, $total=0, $flags=0)
+	{
+		$this->mUrl = $url;
+		$this->setTotal($total);
+		$this->mFlags = $flags;
+	}
+	
+	function fetch()
+	{
+		$startKey = $this->getStartKey();
+		$perpageKey = $this->getPerpageKey();
+
+		if ($this->mFlags & XCUBE_PAGENAVI_START && isset($_REQUEST[$startKey])) {
+			$this->mStart = intval($_REQUEST[$startKey]);
+		}
+
+		if ($this->mFlags & XCUBE_PAGENAVI_PERPAGE && isset($_REQUEST[$perpageKey]) && !$this->mPerpageFreeze) {
+			$this->mPerpage = intval($_REQUEST[$perpageKey]);
+		}
+	}
+
+	function addExtra($key,$value)
+	{
+		$this->mExtra[$key]=$value;
+	}
+	
+	function removeExtra($key)
+	{
+		if ($this->mExtra[$key]) {
+			unset($this->mExtra[$key]);
+		}
+	}
+	
+	function getRenderBaseUrl($mask = null)
+	{
+		if ($mask == null) {
+			$mask = array();
+		}
+		if (!is_array($mask)) {
+			$mask = array($mask);
+		}
+		
+		if(count($this->mExtra) > 0) {
+			$tarr=array();
+			
+			foreach($this->mExtra as $key=>$value) {
+				if (is_array($mask) && !in_array($key, $mask)) {
+					$tarr[]=$key."=".urlencode($value);
+				}
+			}
+			
+			if (count($tarr)==0) {
+				return $this->mUrl;
+			}
+			
+			if(strpos($this->mUrl,"?")!==false) {
+				return $this->mUrl."&amp;".implode("&amp;",$tarr);
+			}
+			else {
+				return $this->mUrl."?".implode("&amp;",$tarr);
+			}
+		}
+		
+		return $this->mUrl;
+	}
+	
+	/**
+	 * Return url string for navigation. The return value is lose start value.
+	 * The user need to add start value. For example, It is "$navi->getRenderUrl().'20'".
+	 * This method name is bad. I must rename this.
+	 * @return string
+	 */
+	function getRenderUrl($mask = null)
+	{
+		if ($mask != null && !is_array($mask)) {
+			$mask = array($mask);
+		}
+		
+		$demiliter = "?";
+		$url = $this->getRenderBaseUrl($mask);
+		
+		if(strpos($url,"?")!==false) {
+			$demiliter = "&amp;";
+		}
+		
+		return $url . $demiliter . $this->getStartKey() . "=";
+	}
+	
+	/**
+	 * Return url string for sort. The return value is complete style.
+	 */
+	function renderSortUrl($mask = null)
+	{
+		return $this->getRenderUrl($mask) . $this->mStart;
+	}
+
+	function setStart($start)
+	{
+		$this->mStart = intval($start);
+	}
+	
+	function getStart()
+	{
+		return $this->mStart;
+	}
+	
+	function setTotal($total)
+	{
+		$this->mTotal = intval($total);
+	}
+	
+	function getTotal()
+	{
+		return $this->mTotal;
+	}
+	
+	function setPerpage($perpage)
+	{
+		$this->mPerpage = intval($perpage);
+	}
+	
+	function freezePerpage()
+	{
+		$this->mPerpageFreeze = true;
+	}
+	
+	function getPerpage()
+	{
+		return $this->mPerpage;
+	}
+
+	function setPrefix($prefix)
+	{
+		$this->mPrefix = $prefix;
+	}
+	
+	function getPrefix()
+	{
+		return $this->mPrefix;
+	}
+
+	function getStartKey()
+	{
+		return $this->mPrefix . "start";
+	}
+
+	function getPerpageKey()
+	{
+		return $this->mPrefix . "perpage";
+	}
+}
+
+?>
\ No newline at end of file
Index: xoops2jp/html/kernel/XCube_Permission.class.php
diff -u /dev/null xoops2jp/html/kernel/XCube_Permission.class.php:1.1.2.1
--- /dev/null	Thu Sep 28 14:00:41 2006
+++ xoops2jp/html/kernel/XCube_Permission.class.php	Thu Sep 28 14:00:41 2006
@@ -0,0 +1,37 @@
+<?php
+/**
+ * @package XCube
+ * @version $Id: XCube_Permission.class.php,v 1.1.2.1 2006/09/28 05:00:41 minahito Exp $
+ */
+
+/**
+ * XCube_PermissionUtils
+ */
+class XCube_Permissions
+{
+	function getRolesOfAction()
+	{
+		$args = func_get_args();
+		$actionName = array_shift($args);
+		
+		$root =& XCube_Root::getSingleton();
+		return $root->mPermissionManager->getRolesOfAction($actionName, $args);
+	}
+}
+
+class XCube_AbstractPermissionProvider
+{
+	function XCube_AbstractPermissionProvider()
+	{
+	}
+	
+	function prepare()
+	{
+	}
+	
+	function getRolesOfAction($actionName, $args)
+	{
+	}
+}
+
+?>
\ No newline at end of file
Index: xoops2jp/html/kernel/XCube_HttpContext.class.php
diff -u /dev/null xoops2jp/html/kernel/XCube_HttpContext.class.php:1.1.2.1
--- /dev/null	Thu Sep 28 14:00:41 2006
+++ xoops2jp/html/kernel/XCube_HttpContext.class.php	Thu Sep 28 14:00:41 2006
@@ -0,0 +1,192 @@
+<?php
+/**
+ * @package XCube
+ * @version $Id: XCube_HttpContext.class.php,v 1.1.2.1 2006/09/28 05:00:41 minahito Exp $
+ */
+
+define("XCUBE_CONTEXT_TYPE_DEFAULT", "web_browser");
+define("XCUBE_CONTEXT_TYPE_WEB_SERVICE", "web_service");
+
+/**
+ * Encapsulates major HTTP specific information about a HTTP request.
+ */
+class XCube_HttpContext
+{
+	/**
+	 * Hashmap that can be used to organize and share data. Use setAttribute()
+	 * and get Attribute() to access this member property. But, direct access
+	 * is allowed, because PHP4 is unpossible to handle reference well.
+	 *
+	 * @var Array
+	 * @access protected
+	 */
+	var $mAttributes = array();
+	
+	/**
+	 * The object which enables to read the request values.
+	 *
+	 * @access XCube_AbstractRequest
+	 */
+	var $mRequest = null;
+	
+	/**
+	 * @var XCube_Principal
+	 */
+	var $mUser = null;
+	
+	/**
+	 * String which expresses the type of the current request.
+	 * @var string
+	 */
+	var $mType = XCUBE_CONTEXT_TYPE_DEFAULT;
+	
+	function XCube_HttpContext()
+	{
+	}
+	
+	/**
+	 * Sets $value with $key to attributes. Use direct access to $mAttributes
+	 * if references are must, because PHP4 can't handle reference in the
+	 * signature of this member function.
+	 * 
+	 * @param string $key
+	 * @param mixed $value
+	 */
+	function setAttribute($key, $value)
+	{
+		$this->mAttributes[$key] = $value;
+	}
+
+	/**
+	 * Gets a value indicating whether the value specified by $key exists.
+	 * 
+	 * @param string $key
+	 * @return mixed
+	 */	
+	function hasAttribute($key)
+	{
+		return isset($this->mAttributes[$key]);
+	}
+	
+	/**
+	 * Gets a value of attributes with $key. If the value specified by $key
+	 * doesn't exist in attributes, gets null.
+	 * 
+	 * @param string $key
+	 * @return mixed
+	 */	
+	function getAttribute($key)
+	{
+		return isset($this->mAttributes[$key]) ? $this->mAttributes[$key] : null;
+	}
+
+	/**
+	 * Sets the object which has a interface of XCube_AbstractRequest.
+	 *
+	 * @param XCube_AbstractRequest $request
+	 */	
+	function setRequest(&$request)
+	{
+		$this->mRequest =& $request;
+	}
+	
+	/**
+	 * Gets the object which has a interface of XCube_AbstractRequest.
+	 *
+	 * @return XCube_AbstractRequest
+	 */	
+	function &getRequest()
+	{
+		return $this->mRequest;
+	}
+
+	/**
+	 * Sets the object which has a interface of XCube_Principal.
+	 *
+	 * @param XCube_AbstractPrincipal $principal
+	 */
+	function setUser(&$principal)
+	{
+		$this->mUser =& $principal;
+	}
+	
+	/**
+	 * Gets the object which has a interface of XCube_Principal.
+	 *
+	 * @return XCube_AbstractPrincipal
+	 */
+	function &getUser()
+	{
+		return $this->mUser;
+	}
+}
+
+/**
+ * This is an interface for request classes.
+ */
+class XCube_AbstractRequest
+{
+	/**
+	 * Gets a value of the current request.
+	 *
+	 * @param $key
+	 * @return mixed
+	 */
+	function getRequest($key)
+	{
+		return null;
+	}
+}
+
+/**
+ * Enables a program to read the HTTP values through XCubeAbstractRequest
+ * interface.
+ */
+class XCube_HttpRequest extends XCube_AbstractRequest
+{
+	/**
+	 * Gets a value of the current HTTP request. The return value doesn't
+	 * include quotes which are appended by magic_quote_gpc, even if it's
+	 * active.
+	 * 
+	 * @param string $key
+	 * @return mixed
+	 */	
+	function getRequest($key)
+	{
+		if (!isset($_REQUEST[$key])) {
+			return null;
+		}
+		
+		if (!get_magic_quotes_gpc()) {
+			return isset($_REQUEST[$key]) ? $_REQUEST[$key] : null;
+		}
+		
+		if (is_array($_REQUEST[$key])) {
+			return $this->_getArrayRequest($_REQUEST[$key]);
+		}
+		
+		return stripslashes($_REQUEST[$key]);
+	}
+	
+	/**
+	 * Supports getRequest().
+	 *
+	 * @access private
+	 * @param Array $arr
+	 * @return Array
+	 */
+	function _getArrayRequest($arr)
+	{
+		foreach (array_keys($arr) as $t_key => $t_value) {
+			if (is_array($t_value)) {
+				$arr[$t_key] = $this->_getArrayRequest($t_value);
+			}
+			else {
+				$arr[$t_key] = stripslashes($t_value);
+			}
+		}
+	}
+}
+
+?>
\ No newline at end of file
Index: xoops2jp/html/kernel/XCube_FormFile.class.php
diff -u /dev/null xoops2jp/html/kernel/XCube_FormFile.class.php:1.1.2.1
--- /dev/null	Thu Sep 28 14:00:41 2006
+++ xoops2jp/html/kernel/XCube_FormFile.class.php	Thu Sep 28 14:00:41 2006
@@ -0,0 +1,325 @@
+<?php
+/**
+ * @package XCube
+ * @version $Id: XCube_FormFile.class.php,v 1.1.2.1 2006/09/28 05:00:41 minahito Exp $
+ */
+
+/**
+ * WARNING:
+ * This class is simple wrapper class for proccessing the file uploaded.
+ * However, we have to examine the position of this class. We aims to simple file tree.
+ * This class is only helper. We think that Cube system shouldn't offer misc helper.
+ *
+ * We put this class in root/class for the progress of this project. But, we will move
+ * this to other directory in the future.
+ */
+class XCube_FormFile
+{
+	var $mName=null;
+	
+	var $mKey = null;
+	
+	var $mContentType=null;
+	
+	var $mFileName=null;
+	var $mFileSize=0;
+	
+	var $_mTmpFileName=null;
+	
+	var $mUploadFileFlag=false;
+	
+	function XCube_FormFile($name = null, $key = null)
+	{
+		$this->mName = $name;
+		$this->mKey = $key;
+	}
+	
+	/**
+	 * Fetch necessary information from $_FILES by $mName
+	 */
+	function fetch()
+	{
+		if($this->mName && isset($_FILES[$this->mName])) {
+			if ($this->mKey != null) {
+				$this->setFileName($_FILES[$this->mName]['name'][$this->mKey]);
+				$this->setContentType($_FILES[$this->mName]['type'][$this->mKey]);
+				$this->setFileSize($_FILES[$this->mName]['size'][$this->mKey]);
+				$this->_mTmpFileName = $_FILES[$this->mName]['tmp_name'][$this->mKey];
+			}
+			else {
+				$this->setFileName($_FILES[$this->mName]['name']);
+				$this->setContentType($_FILES[$this->mName]['type']);
+				$this->setFileSize($_FILES[$this->mName]['size']);
+				$this->_mTmpFileName = $_FILES[$this->mName]['tmp_name'];
+			}
+			
+			if($this->getFileSize()>0)
+				$this->mUploadFileFlag=true;
+		}
+	}
+	
+	function hasUploadFile()
+	{
+		return $this->mUploadFileFlag;
+	}
+	
+	/**
+	 * Return content type
+	 * @return string
+	*/
+	function getContentType()
+	{
+		return $this->mContentType;
+	}
+	
+	function getFileData()
+	{
+		// Now, implemeting.
+	}
+	
+	/**
+	 * Return file name.
+	 * @return string
+	*/
+	function getFileName()
+	{
+		return $this->mFileName;
+	}
+	
+	/**
+	 * Return file size.
+	 * @return int
+	 */
+	function getFileSize()
+	{
+		return $this->mFileSize;
+	}
+	
+	/**
+	 * Return extension from file name.
+	 * @return string
+	 */
+	function getExtension()
+	{
+		$ret = null;
+		$filename=$this->getFileName();
+		if(preg_match("/\.(\w+)$/",$filename,$match))
+			$ret=$match[1];
+		
+		return $ret;
+	}
+	
+	/**
+	 * Set extension.
+	 * @return string
+	 */
+	function setExtension($ext)
+	{
+		$filename=$this->getFileName();
+		if(preg_match("/(.+)\.\w+$/",$filename,$match))
+			$this->setFileName($match[1].".${ext}");
+	}
+	
+	/**
+	 * Set content type
+	 * @param $contenttype string
+	*/
+	function setContentType($contenttype)
+	{
+		$this->mContentType=$contenttype;
+	}
+	
+	/**
+	 * Set file name
+	 * @param $filename string
+	 */
+	function setFileName($filename)
+	{
+		$this->mFileName = $filename;
+	}
+	
+	/**
+	 * Set file size
+	 * @param $filesize int
+	 */
+	function setFileSize($filesize)
+	{
+		$this->mFileSize = $filesize;
+	}
+	
+	/**
+	 * Set file body name. The extension is never changed.
+	 * @param $bodyname string
+	 */
+	function setBodyName($bodyname)
+	{
+		$this->setFileName($bodyname.".".$this->getExtension());
+	}
+	
+	/**
+	 * Get file body name.
+	 * @return string
+	 */
+	function getBodyName()
+	{
+		if(preg_match("/(.+)\.\w+$/",$this->getFileName(),$match)) {
+			return $match[1];
+		}
+		
+		return null;
+	}
+	
+	/**
+	 * Set random string to file body name. The extension is never changed.
+	 * @param $prefix string Prefix for random string.
+	 * @param $salt string Salt for generating token.
+	 */
+	function setRandomToBodyName($prefix,$salt=XOOPS_SALT)
+	{
+		$filename = $prefix . $this->_getRandomString() . "." . $this->getExtension();
+		$this->setFileName($filename);
+	}
+	
+	/**
+	 * Set random string to file body name. The extension is changed.
+	 * @param $prefix string Prefix for random string.
+	 * @param $salt string Salt for generating token.
+	 */
+	function setRandomToFilename($prefix,$salt=XOOPS_SALT)
+	{
+		$filename = $prefix . $this->_getRandomString();
+		$this->setFileName($filename);
+	}
+	
+	/**
+	@brief Generate random string.
+	@param $salt string Salt for generating token.
+	@return string
+	*/
+	function _getRandomString($salt=XOOPS_SALT)
+	{
+		srand( microtime() *1000000);
+		return md5($salt . rand());
+	}
+	
+	/**
+	 * Name this, and store it. If the name is specified as complete file name, store it as the same name.
+	 * If the name is specified as directory name, store it as the own name to the directory specified.
+	 *
+	 * @param $file Directory path or file path.
+	 * @return bool
+	 */
+	function saveAs($file)
+	{
+		if(preg_match("#\/$#",$file)) {
+			return move_uploaded_file($this->_mTmpFileName,$file.$this->getFileName());
+		}
+		elseif(is_dir($file)) {
+			return move_uploaded_file($this->_mTmpFileName,$file."/".$this->getFileName());
+		}
+		else {
+			return move_uploaded_file($this->_mTmpFileName,$file);
+		}
+	}
+	
+	/**
+	 * Set random string to file body name, and store it. The extension is never changed.
+	 * @see saveAs()
+	 * @see setRandomToBodyName()
+	 * @param $dir Directory for store.
+	 * @param $prefix string Prefix for random string.
+	 * @param $salt string Salt for generating token.
+	 * @return bool
+	 */
+	function saveAsRandBody($dir,$prefix='',$salt=XOOPS_SALT)
+	{
+		$this->setRandomToBodyName($prefix,$salt);
+		return $this->saveAs($dir);
+	}
+	
+	/**
+	 * Set random string to file name, and store it. The extension is never changed.
+	 * @see saveAs()
+	 * @see setRandomToFileName()
+	 * @param $dir Directory for store.
+	 * @param $prefix string Prefix for random string.
+	 * @param $salt string Salt for generating token.
+	 * @return bool
+	 */
+	function saveAsRand($dir,$prefix='',$salt=XOOPS_SALT)
+	{
+		$this->setRandomToFileName($prefix,$salt);
+		return $this->saveAs($dir);
+	}
+}
+
+/**
+ * The sub-class of XCube_FormFile to handle image upload file easily.
+ */
+class XCube_FormImageFile extends XCube_FormFile
+{
+	function fetch()
+	{
+		parent::fetch();
+		
+		if ($this->hasUploadFile()) {
+			if (!$this->_checkFormat()) {
+				$this->mUploadFileFlag = false;
+			}
+		}
+	}
+	
+	/**
+	 * Gets a width of the uploaded file.
+	 * @return int
+	 */
+	function getWidth()
+	{
+		list($width,$height,$type,$attr)=getimagesize($this->_mTmpFileName);
+		return $width;
+	}
+	
+	/**
+	 * Gets a height of the uploaded file.
+	 * @return int
+	 */
+	function getHeight()
+	{
+		list($width,$height,$type,$attr)=getimagesize($this->_mTmpFileName);
+		return $height;
+	}
+	
+	/**
+	 * Gets a value indicating whether a format of the uploaded file is allowed.
+	 * @access private
+	 * @return bool
+	 */
+	function _checkFormat()
+	{
+		if(!$this->hasUploadFile())
+			return false;
+		
+		list($width,$height,$type,$attr)=getimagesize($this->_mTmpFileName);
+		
+		switch($type) {
+			case IMAGETYPE_GIF:
+				$this->setExtension("gif");
+				break;
+			
+			case IMAGETYPE_JPEG:
+				$this->setExtension("jpg");
+				break;
+			
+			case IMAGETYPE_PNG:
+				$this->setExtension("png");
+				break;
+			
+			default:
+				return false;
+		}
+		
+		return true;
+	}
+}
+
+?>
\ No newline at end of file
Index: xoops2jp/html/kernel/XCube_Utils.class.php
diff -u /dev/null xoops2jp/html/kernel/XCube_Utils.class.php:1.1.2.1
--- /dev/null	Thu Sep 28 14:00:41 2006
+++ xoops2jp/html/kernel/XCube_Utils.class.php	Thu Sep 28 14:00:41 2006
@@ -0,0 +1,32 @@
+<?php
+/**
+ * @package XCube
+ * @version $Id: XCube_Utils.class.php,v 1.1.2.1 2006/09/28 05:00:41 minahito Exp $
+ */
+
+/**
+ * The utility class.
+ */
+class XCube_Utils
+{
+	/**
+	 * Formats string.
+	 */
+	function formatMessage()
+	{
+		$arr = func_get_args();
+		
+		if (count($arr) == 0) {
+			return null;
+		}
+		
+		$message = $arr[0];
+		for($i = 1; $i < count($arr); $i++) {
+			$message = str_replace("{" . ($i-1) . "}", $arr[$i], $message);
+		}
+		
+		return $message;
+	}
+}
+
+?>
\ No newline at end of file
Index: xoops2jp/html/kernel/XCube_Object.class.php
diff -u xoops2jp/html/kernel/XCube_Object.class.php:1.1.2.2 xoops2jp/html/kernel/XCube_Object.class.php:1.1.2.2.2.1
--- xoops2jp/html/kernel/XCube_Object.class.php:1.1.2.2	Fri Sep  1 12:11:34 2006
+++ xoops2jp/html/kernel/XCube_Object.class.php	Thu Sep 28 14:00:41 2006
@@ -1,4 +1,8 @@
 <?php
+/**
+ * @package XCube
+ * @version $Id: XCube_Object.class.php,v 1.1.2.2.2.1 2006/09/28 05:00:41 minahito Exp $
+ */
 
 function S_PUBLIC_VAR($definition)
 {
@@ -33,6 +37,44 @@
 	function getPropertyDefinition()
 	{
 	}
+	
+	function XCube_Object()
+	{
+		$fileds = $this->getPropertyDefinition();
+		foreach ($fileds as $t_field) {
+			$this->mProperty[$t_field['name']] = array(
+				'type' => $t_field['type'],
+				'value' => null
+			);
+		}
+	}
+	
+	/**
+	 * Initialize. If the exception raises, return false.
+	 */
+	function prepare()
+	{
+	}
+	
+	function toArray()
+	{
+		$retArray = array();
+		
+		foreach ($this->mProperty as $t_key => $t_value) {
+			$retArray[$t_key] = $t_value['value'];
+		}
+		
+		return $retArray;
+	}
+	
+	function loadByArray($vars)
+	{
+		foreach ($vars as $t_key => $t_value) {
+			if (isset($this->mProperty[$t_key])) {
+				$this->mProperty[$t_key]['value'] = $t_value;
+			}
+		}
+	}
 }
 
 class XCube_ObjectArray
Index: xoops2jp/html/kernel/XCube_Controller.class.php
diff -u xoops2jp/html/kernel/XCube_Controller.class.php:1.1.2.17 xoops2jp/html/kernel/XCube_Controller.class.php:1.1.2.17.2.1
--- xoops2jp/html/kernel/XCube_Controller.class.php:1.1.2.17	Fri Sep  1 12:09:07 2006
+++ xoops2jp/html/kernel/XCube_Controller.class.php	Thu Sep 28 14:00:41 2006
@@ -1,92 +1,151 @@
 <?php
 /**
  * @package XCube
- * @version $Id: XCube_Controller.class.php,v 1.1.2.17 2006/09/01 03:09:07 minahito Exp $
+ * @version $Id: XCube_Controller.class.php,v 1.1.2.17.2.1 2006/09/28 05:00:41 minahito Exp $
  */
 
 if (!defined('XOOPS_ROOT_PATH')) exit();
 
-require_once XOOPS_ROOT_PATH . "/class/XCube_ActionFilter.class.php";
-require_once XOOPS_ROOT_PATH . "/class/XCube_BlockProcedure.class.php";
-require_once XOOPS_ROOT_PATH . "/class/XCube_RenderSystem.class.php";
+require_once XOOPS_ROOT_PATH . "/kernel/XCube_ActionFilter.class.php";
+require_once XOOPS_ROOT_PATH . "/kernel/XCube_Procedure.class.php";
+require_once XOOPS_ROOT_PATH . "/kernel/XCube_RenderSystem.class.php";
 require_once XOOPS_ROOT_PATH . "/kernel/XCube_Delegate.class.php";
 
-require_once XOOPS_ROOT_PATH . "/kernel/XCube_UserAccount.class.php";
-
 require_once XOOPS_ROOT_PATH . "/kernel/XCube_Object.class.php";
 require_once XOOPS_ROOT_PATH . "/kernel/XCube_Service.class.php";
 
+require_once XOOPS_ROOT_PATH . "/kernel/XCube_Identity.class.php";
+require_once XOOPS_ROOT_PATH . "/kernel/XCube_RoleManager.class.php";
+require_once XOOPS_ROOT_PATH . "/kernel/XCube_Permission.class.php";
+
+require_once XOOPS_ROOT_PATH . "/kernel/XCube_LanguageManager.class.php";
+
+require_once XOOPS_ROOT_PATH . "/kernel/XCube_ActionForm.class.php";
 
 /**
- * Virtual front controller class
+ * Virtual or Actual front controller class.
+ *
+ * This is an abstract class. And, a sub-class of this class has many
+ * impositions which sets up root object finally and implements many actual
+ * logic.
+ *
+ * executeXXXXX() functions are a public member function called by an accessed
+ * file. These member functions call other protected member functions.
+ *
+ * _setupXXXXX() functions are a protected member function overridden by a
+ * sub-class controller. Most of these functions are empty. A sub-class
+ * controller overrides them to set up a controller object and others.
+ *
+ * _createXXXXX() functions are a protected member function overridden by a
+ * sub-class controller. These member functions are called in prepare() to set
+ * up the root object. And, they have been exported from prepare() for a
+ * sub-class controller to override easily. Most of sub-class controllers
+ * doesn't need to override them, because typical code is there.
  */
 class XCube_Controller
 {
+	/**
+	 * The reference for the root object.
+	 *
+	 * @var XCube_Root
+	 */
 	var $mRoot;
 
-	var $mBlockChain = array();
-	var $mFilterChain = array();
-	
 	/**
-	 * XoopsLogger Instance
-	 * @access protected
+	 * Array of a procedure class object.
+	 *
+	 * @var Array
 	 */
-	var $mLogger;
+	var $_mBlockChain = array();
+	
 	
 	/**
-	 * XoopsErrorHandler instance
-	 * @access protected
+	 * Array of XCube_ActionFilter class object.
+	 *
+	 * @var Array
 	 */
-	var $mErrorHandler;
-
-
+	var $_mFilterChain = array();
+	
 	/**
-	 * Database instance
-	 * @access protected
+	 * The database object which is abstract layer for the database.
+	 *
+	 * @var object
 	 */
 	var $mDB;
 	
 	/**
-	 * Array
-	 * @access protected
+	 * [READ ONLY] This is string collection which indicates site
+	 * configurations by a site owner. Those configuration informations are
+	 * loaded by the controller, and set. This configuration and the site
+	 * configuration of XCube_Root are different.
+	 *
+	 * @var array
 	 */
-	var $mConfig;
+	var $mConfig = array();
 	
-	var $mDebugger;
-	
-	var $mUser;
-
-
 	/**
+	 * A name of the current local.
+	 *
 	 * @access public
+	 * @var string
 	 */
-	var $mLanguage;
+	var $mLocal = null;
 
-	var $mRenderSystem;
-	
 	/**
-	 * Instance to implement the action process of this controller
-	 * @access private
+	 * A name of the current language.
+	 *
+	 * @access public
+	 * @var string
 	 */
-	var $mActionStrategy = null;
+	var $mLanguage = null;
 
 	/**
+	 * Something which expresses the current theme information.
+	 *
 	 * @var string or object
 	 */	
-	var $mMainTheme = null;
-
+	var $mTheme = null;
+	
+	/**
+	 * Rebuilds the principal object for the current HTTP-request.
+	 * void setupUser(XCube_AbstractPrincipal &, XCube_Controller &, XCube_HttpContext &);
+	 *
+	 * @var XCube_Delegate
+	 */
+	var $mSetupUser = null;
+	
+	/**
+	 * Executes the main logic of the controller.
+	 * void execute(XCube_Controller &);
+	 * 
+	 * @var XCube_Delegate
+	 */
+	var $mExecute = null;
+	
 	function XCube_Controller()
 	{
-		$this->mBlockChain=array();
-		$this->mFilterChain=array();
+		$this->_mBlockChain = array();
+		$this->_mFilterChain = array();
+		
+		$this->mSetupUser =& new XCube_Delegate();
+		$this->mExecute =& new XCube_Delegate();
 	}
 	
+	/**
+	 * This member function is overridden. The sub-class implements the
+	 * initialization process which sets up the root object finally.
+	 *
+	 * @param XCube_Root $root
+	 */
 	function prepare(&$root)
 	{
 		$this->mRoot=&$root;
 		
 		$this->mRoot->setDelegateManager($this->_createDelegateManager());
 		$this->mRoot->setServiceManager($this->_createServiceManager());
+		$this->mRoot->setPermissionManager($this->_createPermissionManager());
+		$this->mRoot->setRoleManager($this->_createRoleManager());
+		$this->mRoot->setContext($this->_createContext());
 	}
 
 	/**
@@ -103,195 +162,196 @@
 		$this->_setupFilterChain();
 		$this->_processFilter();
 
-		// ^^;
-		$this->_setupErrorHandler();
-
 		$this->_setupEnvironment();
 		
-		$this->_setupLogger();
-
 		$this->_setupDB();
 
         $this->_setupLanguage();
 
 		$this->_setupConfig();
 		
-		$this->_setupDebugger();
-
+		//
+		// Block section
+		//
 		$this->_processPreBlockFilter();	// What's !?
 
-		$this->_processHostAbstractLayer();
-
 		$this->_setupSession();
 
 		$this->_setupUser();
-
-		$this->_setupModuleController();
-
-		$this->_setupRenderSystem();
-
-		$this->_processModuleController();
 	}
 	
 	/**
-	 * Create filter chain.
-	 * @access protected
+	 * Usually this member function is called after executeCommon(). But, some
+	 * cases don't call this. Therefore, the page controller type base should
+	 * not write the indispensable code here. For example, this is good to call
+	 * blocks.
 	 */
-	function _setupFilterChain()
-	{
-	}
-
-	function addActionFilter(&$filter)
+	function executeHeader()
 	{
-		$this->mFilterChain[]=&$filter;
+		$this->_setupBlock();
+		$this->_processBlock();
 	}
 
 	/**
-	 * Create the instance of XoopsErrorHandler class, and set it to member property.
-	 * @access protected
+	 * Executes the main logic.
+	 *
+	 * @access public
 	 */
-	function _setupErrorHandler()
-	{
-	}
-
-	function _setupEnvironment()
+	function execute()
 	{
+		$this->mExecute->call(new XCube_Ref($this));
 	}
 	
 	/**
-	 * Create the instance of XoopsLogger class, and set it to member property.
-	 * @access private
-	 */
-	function _setupLogger()
+	 * Executes the view logic. This member function is overridden.
+	 *
+	 * @access public
+	 */	
+	function executeView()
 	{
 	}
 	
 	/**
-	 * Create the instance of DataBase class, and set it to member property.
-	 * @access protected
+	 * TODO We may change this name to forward()
+	 * 
+	 * @param string  $url      Can't use html tags.
+	 * @param int     $time
+	 * @param string  $message
 	 */
-	function _setupDB()
+	function executeForward($url, $time = 0, $message = null)
 	{
+		// check header output
+		header("location: " . $url);
+		exit();
 	}
 	
 	/**
-	 * @access public
+	 * Redirect to the specified URL with displaying message.
+	 * 
+	 * @param string  $url      Can't use html tags.
+	 * @param int     $time
+	 * @param string  $message
 	 */
-	function &getDB()
-	{
-		return $this->mDB;
-	}
-
-	function _setupLanguage()
+	function executeRedirect($url, $time = 1, $message = null)
 	{
+		$this->executeForward($url, $time, $message);
 	}
 	
-	function _setupConfig()
-	{
-	}
-
 	/**
-	 * Set debbuger object to member property.
-	 * @return void
+	 * Adds the ActionFilter instance.
+	 * @param $filter XCube_ActionFilter
 	 */
-	function _setupDebugger()
-	{
-	}
-
-	function &_createLanguageManager()
+	function addActionFilter(&$filter)
 	{
-		require_once XOOPS_ROOT_PATH."/class/XCube_LanguageManager.class.php";
-		$languageManager=new XCube_LanguageManager($this->mConfig['language']);
-		return $languageManager;
+		$this->_mFilterChain[] =& $filter;
 	}
 
 	/**
-	 * We need this method really??
+	 * Create filter chain.
+	 * @access protected
 	 */
-	function _processHostAbstractLayer()
+	function _setupFilterChain()
 	{
 	}
 
 	/**
-	 * Setup handler for session, then start session.
-	 * @return void
+	 * This member function is overridden. Sets up the controller and the
+	 * environment.
 	 */
-	function _setupSession()
+	function _setupEnvironment()
 	{
 	}
 	
-	function _setupUser()
+	/**
+	 * Creates the instance of DataBase class, and sets it to member property.
+	 *
+	 * @access protected
+	 */
+	function _setupDB()
 	{
 	}
 	
-	function _setupModuleController()
+	/**
+	 * Gets the DB instance.
+	 *
+	 * @access public
+	 */
+	function &getDB()
 	{
+		return $this->mDB;
 	}
-	
+
 	/**
-	 * Return module controller.
-	 * @return XCube_ModuleController
+	 * Creates the instance of Language Manager class, and sets it to member
+	 * property.
+	 *
+	 * @access protected
 	 */
-	function &getModuleController()
+	function _setupLanguage()
 	{
-		return $this->mModuleController;
+		$this->mRoot->mLanguageManager =& new XCube_LanguageManager();
 	}
 	
 	/**
-	 * @return bool We have to return boolean in this method really??
-	 * @todo move this method to Base_Controller
+	 * This member function is overridden. Loads site configuration informations,
+	 * and sets them to the member property.
 	 */
-	function _processModuleController()
+	function _setupConfig()
 	{
 	}
 
 	/**
-	 * Return logger instance.
-	 * @return Object
+	 * This member function is overrided. Sets up handler for session, then
+	 * starts session.
+	 * 
+	 * @return void
 	 */
-	function &getLogger()
+	function _setupSession()
 	{
-		return $this->mLogger;
 	}
 	
-
 	/**
-	 * Return logger instance.
-	 * @return XoopsErrorHandler
+	 * Sets up a principal object to the root object. In other words, restores
+	 * the principal object from session or other.
 	 */
-	function &getErrorHandler()
+	function _setupUser()
 	{
-		return $this->mErrorHandler;
+		$this->mSetupUser->call(new XCube_Ref($this->mRoot->mContext->mUser), new XCube_Ref($this), new XCube_Ref($this->mRoot->mContext));
 	}
-
-
+	
 	/**
-	 * Usually this member function is called after executeCommon(). But, some
-	 * cases don't call this. Therefore, the page controller type base should
-	 * not write the indispensable code here. For example, this is good to call
-	 * blocks.
-	 *
-	 * @return void
+	 * Sets the main theme.
+	 * 
+	 * [Notice]
+	 * Some of sub-classes of XCube_Controller may use object to specify theme.
+	 * So this class uses references.
+	 * 
+	 * @var string or object
 	 */
-	function executeHeader()
+	function setTheme(&$theme)
 	{
-		$this->_setupBlock();
-		$this->_processBlock();
+		$this->mTheme =& $theme;
 	}
-
+	
 	/**
-	 * This method only show you the concept process of this system.
-	 * @return void
+	 * Gets the main theme.
+	 * 
+	 * @return string or object
+	 * @see XCube_Controller::setTheme()
 	 */
-	function execute()
+	function &getTheme()
 	{
-		// $this->executeCommon();
-		// $this->executeHeader();
+		return $this->mTheme;
 	}
-	
-	function getConfig($id=null)
+
+	/**
+	 * Gets the configuration information.
+	 * @param string $id
+	 * @return mixed string or Array
+	 */
+	function getConfig($id = null)
 	{
-		if($id) {
+		if ($id) {
 			return $this->mConfig[$id];
 		}
 		else {
@@ -299,46 +359,103 @@
 		}
 	}
 	
-	
+	/**
+	 * Calls the preFilter() member function of action filters which have been
+	 * loaded to the list of the controller.
+	 *
+	 * @access protected
+	 */
 	function _processFilter()
 	{
-		for ($i = 0; $i < count($this->mFilterChain); $i++) {
-			$this->mFilterChain[$i]->preFilter();
+		foreach (array_keys($this->_mFilterChain) as $key) {
+			$this->_mFilterChain[$key]->preFilter();
 		}
 	}
 	
+	/**
+	 * FIXME.
+	 */
 	function _setupBlock()
 	{
 	}
 
+	/**
+	 * FIXME.
+	 */
 	function _processBlock()
 	{
-		$i=0;
-		foreach($this->mBlockChain as $blockProcedure) {
-			$blockProcedure->execute($this,$this->getUser());
-			if($blockProcedure->hasResult()) {
-				$this->mRenderSystem->renderBlock($blockProcedure);
+/*		foreach(array_keys($this->mBlockChain) as $key) {
+			if ($this->mBlockChain[$key]->hasPermission($this, $this->getUser())) {
+				$renderTarget =& new XCube_RenderTarget();
+				$renderTarget->setType(XCUBE_RENDER_TARGET_TYPE_MAIN);
+				
+				$this->mBlockChain[$key]->execute($this, $this->getUser(), $renderTarget);
+				
+				$this->mBlockChain[$key]->mRenderTarget =& $renderTarget;
+
+				unset($renderTarget);
 			}
-			unset($blockProcedure);
-		}
+		}*/
 	}
 
+	/**
+	 * Calls the preBlockFilter() member function of action filters which have been
+	 * loaded to the list of the controller.
+	 *
+	 * @access protected
+	 */
 	function _processPreBlockFilter()
 	{
-		for ($i = 0; $i < count($this->mFilterChain); $i++) {
-			$this->mFilterChain[$i]->preBlockFilter();
+		foreach (array_keys($this->_mFilterChain) as $key) {
+			$this->_mFilterChain[$key]->preBlockFilter();
 		}
 	}
 	
+	/**
+	 * Calls the postFilter() member function of action filters which have been
+	 * loaded to the list of the controller.
+	 *
+	 * @access protected
+	 */
 	function _processPostFilter()
 	{
-		foreach (reverse(array_keys($this->mFilterChain)) as $key) {
-			$this->mFilterChain[$key]->postFilter();
+		foreach (reverse(array_keys($this->_mFilterChain)) as $key) {
+			$this->_mFilterChain[$key]->postFilter();
+		}
+	}
+
+	/**
+	 * This is utility member function for the sub-class controller. Load files
+	 * with the rule from $path, and add the instance of the sub-class to the
+	 * chain.
+	 *
+	 * @access protected
+	 * @param $path string Absolute path.
+	 */
+	function _processPreload($path)
+	{
+		$path = $path . "/";
+		
+		if (is_dir($path)) {
+			if ($handler = opendir($path)) {
+				while (($file = readdir($handler)) !== false) {
+					if (preg_match("/(\w+)\.class\.php/", $file, $matches)) {
+						require_once $path . $file;
+						$className = $matches[1];
+						
+						if (class_exists($className)) {
+							$instance =& new $className($this);
+							$this->addActionFilter($instance);
+						}
+					}
+				}
+				closedir($handler);
+			}
 		}
 	}
 	
 	/**
-	 * Create an instance of delegate manager and return it.
+	 * Creates an instance of the delegate manager and returns it.
 	 * 
 	 * @return XCube_DelegateManager
 	 */
@@ -348,6 +465,11 @@
 		return $delegateManager;
 	}
 
+	/**
+	 * Creates an instance of the service manager and returns it.
+	 * 
+	 * @return XCube_ServiceManager
+	 */
 	function &_createServiceManager()
 	{
 		require_once XOOPS_ROOT_PATH . "/kernel/XCube_ServiceManager.class.php";
@@ -355,110 +477,52 @@
 		return $serviceManager;
 	}
 
-	function &getDebugger()
-	{
-		return $this->mDebugger;
-	}
-	
 	/**
-	 * Set the main theme.
+	 * Creates an instance of the permission manager and returns it.
 	 * 
-	 * [Notice]
-	 * Some of sub-classes of XCube_Controller may use object to specify theme.
-	 * So this class uses references.
-	 * 
-	 * @var string or object
+	 * @return XCube_PermissionManager
 	 */
-	function setMainTheme(&$theme)
+	function &_createPermissionManager()
 	{
-		$this->mMainTheme =& $theme;
+		$chunkName = $this->mRoot->getSiteConfig('Cube', 'PermissionManager');
+		
+		//
+		// FIXME: Access private method.
+		//
+		$manager =& $this->mRoot->_createInstance($this->mRoot->getSiteConfig($chunkName, 'class'), $this->mRoot->getSiteConfig($chunkName, 'path'));
+		
+		return $manager;
 	}
 	
 	/**
-	 * Return the main theme.
+	 * Creates an instance of the role manager and returns it.
 	 * 
-	 * @return string or object
-	 * @see XCube_Controller::setMainTheme()
+	 * @return XCube_RoleManager
 	 */
-	function &getMainTheme()
+	function &_createRoleManager()
 	{
-		return $this->mMainTheme;
-	}
-	
-	function executeView()
-	{
-	}
-	
-	function setActionStrategy(&$actionStrategy)
-	{
-		$this->mActionStrategy=&$actionStrategy;
-		$this->mActionStrategy->prepare($this);
-	}
-
-	/**
-	 * @access protected
-	 */
-	function _processAction()
-	{
-		if($this->mActionStrategy!==null)	// is_object
-			$this->mActionStrategy->execute($this);
-	}
-	
-	function executeAction()
-	{
-		$this->_processAction();
+		$chunkName = $this->mRoot->getSiteConfig('Cube', 'RoleManager');
+		
+		//
+		// FIXME: Access private method.
+		//
+		$manager =& $this->mRoot->_createInstance($this->mRoot->getSiteConfig($chunkName, 'class'), $this->mRoot->getSiteConfig($chunkName, 'path'));
+		
+		return $manager;
 	}
 	
 	/**
-	 * TODO We may change this name to forward()
-	 */
-	function executeForward($url, $time = 0, $message = null)
-	{
-		// check header output
-		header("location: " . $url);
-		exit();
-	}
-
-	/**
-	 * Redirect to the specified URL with displaying message.
-	 * 
-	 * @param string  $url      Can't use html tags.
-	 * @param int     $time
-	 * @param string  $message
-	 */
-	function executeRedirect($url, $time = 1, $message = null)
-	{
-		$this->executeForward($url, $time, $message);
-	}
-
-	/**
-	 * This is utility member function for the sub-class controller. Load files
-	 * with the rule from $path, and add the instance of the sub-class to the
-	 * chain.
+	 * Creates the context object to initial the root object, and returns it.
 	 *
-	 * @access protected
-	 * @param $path string Absolute path.
+	 * @return XCube_HttpContext
 	 */
-	function _executePreload($path)
+	function &_createContext()
 	{
-		$path = $path . "/";
+		$context =& new XCube_HttpContext();
+		$request =& new XCube_HttpRequest();
+		$context->setRequest($request);
 		
-		if (is_dir($path)) {
-			if ($handler = opendir($path)) {
-				while (($file = readdir($handler)) !== false) {
-					if (preg_match("/(\w+)\.class\.php/", $file, $matches)) {
-						require_once $path . $file;
-						$className = $matches[1];
-						
-						if (class_exists($className)) {
-							$instance =& new $className($this);
-							$this->addActionFilter($instance);
-						}
-					}
-				}
-				closedir($handler);
-			}
-		}
+		return $context;
 	}
 }
 
Index: xoops2jp/html/kernel/XCube_Root.class.php
diff -u xoops2jp/html/kernel/XCube_Root.class.php:1.1.2.19 xoops2jp/html/kernel/XCube_Root.class.php:1.1.2.19.2.1
--- xoops2jp/html/kernel/XCube_Root.class.php:1.1.2.19	Sun Sep 24 23:05:57 2006
+++ xoops2jp/html/kernel/XCube_Root.class.php	Thu Sep 28 14:00:41 2006
@@ -1,9 +1,11 @@
 <?php
 /**
  * @package XCube
- * @version $Id: XCube_Root.class.php,v 1.1.2.19 2006/09/24 14:05:57 minahito Exp $
+ * @version $Id: XCube_Root.class.php,v 1.1.2.19.2.1 2006/09/28 05:00:41 minahito Exp $
  */
 
+require_once XOOPS_ROOT_PATH . "/kernel/XCube_HttpContext.class.php";
+
 /**
  * This class offers the access course same as global variable for a logic in old mechanism.
  * This class does not let you depend on a main controller class name
@@ -27,16 +29,19 @@
 	
 	var $mServiceManager = null;
 
-	/**
-	 * @deprecated
-	 */
-	var $mRenderSystem = null;
-	
 	var $mRenderSystems = array();
 	
 	var $mSiteConfig = array();
 	
 	/**
+	 * @access public
+	 * @var XCube_AbstractPermissionProvider
+	 */
+	var $mPermissionManager = null;
+	
+	var $mRoleManager = null;
+	
+	/**
 	 * The theme is one in one time of request.
 	 * A decided theme is registered with this property
 	 *
@@ -44,6 +49,13 @@
 	 */
 	var $mThemeName = null;
 
+	var $mCacheSystem = null;
+	
+	/**
+	 * @var XCube_HttpContext
+	 */
+	var $mContext = null;
+
 	function XCube_Root()
 	{
 	}
@@ -271,6 +283,22 @@
 	}
 	
 	/**
+	 * Return the instance of the cache system. The instance of cache system
+	 * is singleton in XOOPS Cube. This member function is getInstance() at
+	 * singleton pattern.
+	 * 
+	 * @return XCube_CacheSystem
+	 */
+	function &getCacheSystem()
+	{
+		if (!is_object($this->mCacheSystem)) {
+			$this->mCacheSystem =& $this->_createInstance($this->mSiteConfig['Cube']['CacheSystem.class'], $this->mSiteConfig['Cube']['CacheSystem.path']);
+		}
+
+		return $this->mCacheSystem;
+	}
+	
+	/**
 	 * Return the instance of the render system by the name. If the render
 	 * system specified by $name doesn't exist, raise fatal error. This member
 	 * function does creating the instance and calling prepare().
@@ -298,6 +326,44 @@
 		
 		return $this->mRenderSystems[$name];
 	}
+	
+	function setPermissionManager(&$manager)
+	{
+		$this->mPermissionManager =& $manager;
+	}
+	
+	function &getPermissionManager()
+	{
+		return $this->mPermissionManager;
+	}
+	
+	/**
+	 * Sets the role manager object.
+	 */
+	function setRoleManager(&$manager)
+	{
+		$this->mRoleManager =& $manager;
+	}
+	
+	/**
+	 * Sets the HTTP-context object.
+	 *
+	 * @param XCube_Context $context
+	 */
+	function setContext(&$context)
+	{
+		$this->mContext =& $context;
+	}
+	
+	/**
+	 * Gets the HTTP-context object.
+	 *
+	 * @return XCube_Context
+	 */
+	function &getContext()
+	{
+		return $this->mContext;
+	}
 
 	/**
 	 * Create the instance dynamic with the rule and the string parameters.
Index: xoops2jp/html/kernel/XCube_RoleManager.class.php
diff -u /dev/null xoops2jp/html/kernel/XCube_RoleManager.class.php:1.1.2.1
--- /dev/null	Thu Sep 28 14:00:41 2006
+++ xoops2jp/html/kernel/XCube_RoleManager.class.php	Thu Sep 28 14:00:41 2006
@@ -0,0 +1,29 @@
+<?php
+/**
+ * @package XCube
+ * @version $Id: XCube_RoleManager.class.php,v 1.1.2.1 2006/09/28 05:00:41 minahito Exp $
+ */
+
+/**
+ * The provider class which handles role informations with the store.
+ */
+class XCube_RoleManager
+{
+	function getRolesForUser($username = null)
+	{
+	}
+}
+
+/**
+ * The utility class which handles role information without the root object.
+ */
+class XCube_Role
+{
+	function getRolesForUser($username = null)
+	{
+		$root =& XCube_Root::getSingleton();
+		return $root->mRoleManager->getRolesForUser($username);
+	}
+}
+
+?>
\ No newline at end of file
Index: xoops2jp/html/kernel/XCube_RenderCache.class.php
diff -u xoops2jp/html/kernel/XCube_RenderCache.class.php:1.1.2.2 xoops2jp/html/kernel/XCube_RenderCache.class.php:1.1.2.2.2.1
--- xoops2jp/html/kernel/XCube_RenderCache.class.php:1.1.2.2	Fri Jan  6 12:17:48 2006
+++ xoops2jp/html/kernel/XCube_RenderCache.class.php	Thu Sep 28 14:00:41 2006
@@ -1,5 +1,8 @@
 <?php
-// $Id: XCube_RenderCache.class.php,v 1.1.2.2 2006/01/06 03:17:48 minahito Exp $
+/**
+ * @package XCube
+ * @version $Id: XCube_RenderCache.class.php,v 1.1.2.2.2.1 2006/09/28 05:00:41 minahito Exp $
+ */
 
 class XCube_RenderCache
 {
Index: xoops2jp/html/kernel/XCube_Property.class.php
diff -u /dev/null xoops2jp/html/kernel/XCube_Property.class.php:1.1.2.1
--- /dev/null	Thu Sep 28 14:00:41 2006
+++ xoops2jp/html/kernel/XCube_Property.class.php	Thu Sep 28 14:00:41 2006
@@ -0,0 +1,487 @@
+<?php
+/**
+ * @package XCube
+ * @version $Id: XCube_Property.class.php,v 1.1.2.1 2006/09/28 05:00:41 minahito Exp $
+ */
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+/**
+ * Defines a interface for the property class group.
+ */
+class XCube_PropertyInterface
+{
+	/**
+	 * Constructor.
+	 *
+	 * @param string $name A name of this property.
+	 */
+	function XCube_PropertyInterface($name)
+	{
+	}
+
+	/**
+	 * Sets $value.
+	 * @param mixed $value
+	 */	
+	function set($value)
+	{
+	}
+	
+	/**
+	 * Gets the value of this object.
+	 * @return mixed
+	 */
+	function get()
+	{
+	}
+
+	/**
+	 * @deprecated
+	 * @see set
+	 */	
+	function setValue($arg0 = null, $arg1 = null)
+	{
+		$this->set($arg0, $arg1);
+	}
+	
+	/**
+	 * @deprecated
+	 * @see get
+	 */	
+	function getValue($arg0 = null)
+	{
+		return $this->get($arg0);
+	}
+	
+	/**
+	 * Gets a value indicating whether this object expresses Array.
+	 * @return bool
+	 */
+	function isArray()
+	{
+	}
+	
+	/**
+	 * Gets a value indicating whether this object is null.
+	 * @return bool
+	 */
+	function isNull()
+	{
+	}
+	
+	/**
+	 * Gets a value as integer.
+	 * @return int
+	 */
+	function toNumber()
+	{
+	}
+	
+	/**
+	 * Gets a value as string.
+	 * @return int
+	 */
+	function toString()
+	{
+	}
+
+	/**
+	 * Gets a value as encoded HTML code.
+	 */	
+	function toHTML()
+	{
+	}
+	
+	/**
+	 * Gets a value indicating whether this object has a fetch control.
+	 * @return bool
+	 */
+	function hasFetchControl()
+	{
+	}
+
+	/**
+	 * Fetches.
+	 * @param XCube_ActionForm $form
+	 */	
+	function fetch(&$form)
+	{
+	}
+}
+
+/**
+ * The base class which implements XCube_PropertyInterface, for all properties.
+ */
+class XCube_AbstractProperty extends XCube_PropertyInterface
+{
+	var $mName = null;
+	var $mValue = null;
+	
+	function XCube_AbstractProperty($name)
+	{
+		$this->mName = $name;
+	}
+	
+	function set($value)
+	{
+		$this->mValue = $value;
+	}
+	
+	function get($index = null)
+	{
+		return $this->mValue;
+	}
+	
+	function isArray()
+	{
+		return false;
+	}
+	
+	function isNull()
+	{
+		return (strlen(trim($this->mValue)) == 0);
+	}
+	
+	function toNumber()
+	{
+		return $this->mValue;
+	}
+	
+	function toString()
+	{
+		return $this->mValue;
+	}
+	
+	function toHTML()
+	{
+		return htmlspecialchars($this->toString(), ENT_QUOTES);
+	}
+	
+	function hasFetchControl()
+	{
+		return false;
+	}
+}
+
+/**
+ * Defines common array property class which implements XCube_PropertyInterface.
+ */
+class XCube_GenericArrayProperty extends XCube_PropertyInterface
+{
+	var $mName = null;
+	var $mProperties = array();
+	
+	var $mPropertyClassName = null;
+	
+	function XCube_GenericArrayProperty($classname, $name)
+	{
+		$this->mPropertyClassName = $classname;
+		$this->mName = $name;
+	}
+	
+	/**
+	 * Sets a value. This member function has two signatures. If $arg1 is array,
+	 * this fetches values from the array.
+	 */
+	function set($arg1, $arg2 = null)
+	{
+		if (is_array($arg1) && $arg2 == null) {
+			foreach ($arg1 as $t_key => $t_value) {
+				$this->_set($t_key, $t_value);
+			}
+		}
+		else {
+			$this->_set($arg1, $arg2);
+		}
+	}
+	
+	/**
+	 * This member function helps set().
+	 * @access private
+	 * @param string $index
+	 * @param mixed $value
+	 */
+	function _set($index, $value)
+	{
+		if (!isset($this->mProperties[$index])) {
+			$this->mProperties[$index] =& new $this->mPropertyClassName($this->mName);
+		}
+		$this->mProperties[$index]->set($value);
+	}
+	
+	function get($index = null)
+	{
+		if ($index == null) {
+			$ret = array();
+			
+			foreach ($this->mProperties as $t_key => $t_value) {
+				$ret[$t_key] = $t_value->get();
+			}
+			
+			return $ret;
+		}
+		
+		return isset($this->mProperties[$index]) ? $this->mProperties[$index]->get() : null;
+	}
+	
+	function isArray()
+	{
+		return true;
+	}
+	
+	function isNull()
+	{
+		return (count($this->mProperties) == 0);
+	}
+	
+	function toNumber()
+	{
+		return null;
+	}
+	
+	function toString()
+	{
+		return 'Array';
+	}
+	
+	function toHTML()
+	{
+		return htmlspecialchars($this->toString(), ENT_QUOTES);
+	}
+	
+	function hasFetchControl()
+	{
+		return false;
+	}
+}
+
+class XCube_AbstractArrayProperty extends XCube_GenericArrayProperty
+{
+	function XCube_AbstractArrayProperty($name)
+	{
+		parent::XCube_GenericArrayProperty($this->mPropertyClassName, $name);
+	}
+}
+
+class XCube_BoolProperty extends XCube_AbstractProperty
+{
+	function set($value)
+	{
+		if (strlen(trim($value)) > 0) {
+			$this->mValue = (intval($value) > 0) ? 1 : 0;
+		}
+		else {
+			$this->mValue = 0;
+		}
+	}
+}
+
+class XCube_BoolArrayProperty extends XCube_GenericArrayProperty
+{
+	function XCube_BoolArrayProperty($name)
+	{
+		parent::XCube_GenericArrayProperty("XCube_BoolProperty", $name);
+	}
+}
+
+class XCube_IntProperty extends XCube_AbstractProperty
+{
+	function set($value)
+	{
+		if (strlen(trim($value)) > 0) {
+			$this->mValue = intval($value);
+		}
+		else {
+			$this->mValue = null;
+		}
+	}
+}
+
+class XCube_IntArrayProperty extends XCube_GenericArrayProperty
+{
+	function XCube_IntArrayProperty($name)
+	{
+		parent::XCube_GenericArrayProperty("XCube_IntProperty", $name);
+	}
+}
+
+class XCube_FloatProperty extends XCube_AbstractProperty
+{
+	function set($value)
+	{
+		if (strlen(trim($value)) > 0) {
+			$this->mValue = floatval($value);
+		}
+		else {
+			$this->mValue = null;
+		}
+	}
+}
+
+class XCube_FloatArrayProperty extends XCube_GenericArrayProperty
+{
+	function XCube_FloatArrayProperty($name)
+	{
+		parent::XCube_GenericArrayProperty("XCube_FloatProperty", $name);
+	}
+}
+
+/**
+ *  This class shows the property of string. Check whether a request includes control
+ * code. If it does, stop own process.
+ */
+class XCube_StringProperty extends XCube_AbstractProperty
+{
+	function set($value)
+	{
+		if (preg_match_all("/[\\x00-\\x1f]/", $value, $matches, PREG_PATTERN_ORDER)) {
+			foreach ($matches[0] as $match) {
+				// FIXME
+				die("[". $this->mName . "]Get control code :" . ord($match));
+			}
+		}
+		
+		$this->mValue = $value;
+	}
+	
+	function toNumber()
+	{
+		return intval($this->mValue);
+	}
+}
+
+class XCube_StringArrayProperty extends XCube_GenericArrayProperty
+{
+	function XCube_StringArrayProperty($name)
+	{
+		parent::XCube_GenericArrayProperty("XCube_StringProperty", $name);
+	}
+}
+
+/**
+ *  This class shows the property of text. Check whether a request includes control
+ * code. If it does, stop own process.
+ */
+class XCube_TextProperty extends XCube_AbstractProperty
+{
+	function set($value)
+	{
+		parent::fetch($key);
+		$matches = array();
+		$allow_codes = array(9,10,13);
+		
+		if (preg_match_all("/[\\x00-\\x09]|[\\x0b-\\x0c]|[\\x0e-\\x1f]/", $value, $matches,PREG_PATTERN_ORDER)) {
+			foreach ($matches[0] as $match) {
+				if (!in_array(ord($match),$allow_codes) && ord($match)<32)
+					die("Get control code :" . ord($match));
+			}
+		}
+		
+		$this->mValue = $value;
+	}
+	
+	function toNumber()
+	{
+		return intval($this->mValue);
+	}
+}
+
+class XCube_TextArrayProperty extends XCube_GenericArrayProperty
+{
+	function XCube_TextArrayProperty($name)
+	{
+		parent::XCube_GenericArrayProperty("XCube_TextProperty", $name);
+	}
+}
+
+class XCube_FileProperty extends XCube_AbstractProperty
+{
+	function XCube_FileProperty($name)
+	{
+		parent::XCube_AbstractProperty($name);
+		$this->mValue =& new XCube_FormFile($name);
+	}
+	
+	function hasFetchControl()
+	{
+		return true;
+	}
+	
+	function fetch($key = null)
+	{
+		if (!is_object($this->mValue)) {
+			return false;
+		}
+		
+		$this->mValue->mKey = $key;
+		
+		$this->mValue->fetch();
+		if (!$this->mValue->hasUploadFile()) {
+			$this->mValue = null;
+		}
+	}
+	
+	function isNull()
+	{
+		if (!is_object($this->mValue)) {
+			return true;
+		}
+		
+		return !$this->mValue->hasUploadFile();
+	}
+	
+	function toString()
+	{
+		return null;
+	}
+	
+	function toNumber()
+	{
+		return null;
+	}
+}
+
+class XCube_FileArrayProperty extends XCube_GenericArrayProperty
+{
+	function XCube_FileArrayProperty($name)
+	{
+		parent::XCube_GenericArrayProperty("XCube_FileProperty", $name);
+	}
+	
+	function hasFetchControl()
+	{
+		return true;
+	}
+	
+	function fetch()
+	{
+		unset($this->mProperties);
+		$this->mProperties = array();
+		if (isset($_FILES[$this->mName]) && is_array($_FILES[$this->mName]['name'])) {
+			foreach ($_FILES[$this->mName]['name'] as $_key => $_val) {
+				$this->mProperties[$_key] =& new $this->mPropertyClassName($this->mName);
+				$this->mProperties[$_key]->fetch($_key);
+			}
+		}
+	}
+}
+
+class XCube_ImageFileProperty extends XCube_FileProperty
+{
+	function XCube_ImageFileProperty($name)
+	{
+		parent::XCube_AbstractProperty($name);
+		$this->mValue =& new XCube_FormImageFile($name);
+	}
+}
+
+class XCube_ImageFileArrayProperty extends XCube_FileArrayProperty
+{
+	function XCube_ImageFileArrayProperty($name)
+	{
+		parent::XCube_GenericArrayProperty("XCube_ImageFileProperty", $name);
+	}
+}
+
+?>
\ No newline at end of file
Index: xoops2jp/html/kernel/XCube_Theme.class.php
diff -u xoops2jp/html/kernel/XCube_Theme.class.php:1.1.2.3 xoops2jp/html/kernel/XCube_Theme.class.php:1.1.2.3.2.1
--- xoops2jp/html/kernel/XCube_Theme.class.php:1.1.2.3	Thu Sep 14 18:34:38 2006
+++ xoops2jp/html/kernel/XCube_Theme.class.php	Thu Sep 28 14:00:41 2006
@@ -1,4 +1,8 @@
 <?php
+/**
+ * @package XCube
+ * @version $Id: XCube_Theme.class.php,v 1.1.2.3.2.1 2006/09/28 05:00:41 minahito Exp $
+ */
 
 /**
  * The theme class.
@@ -68,13 +72,13 @@
 	{
 		if (file_exists($file)) {
 			$this->_mManifesto = parse_ini_file($file, true);
-			$this->mName = isset($this->_mManifesto['Manifesto']['Name']) ? $this->_mManifesto['Manifesto']['Name'] : "";
-			$this->mDepends = isset($this->_mManifesto['Manifesto']['Depends']) ? $this->_mManifesto['Manifesto']['Depends'] : "";
-			$this->mVersion = isset($this->_mManifesto['Manifesto']['Version']) ? $this->_mManifesto['Manifesto']['Version'] : "";
-			$this->mUrl = isset($this->_mManifesto['Manifesto']['Url']) ? $this->_mManifesto['Manifesto']['Url'] : "";
+			$this->mName = $this->_mManifesto['Manifesto']['Name'];
+			$this->mDepends = $this->_mManifesto['Manifesto']['Depends'];
+			$this->mVersion = $this->_mManifesto['Manifesto']['Version'];
+			$this->mUrl = $this->_mManifesto['Manifesto']['Url'];
 			
-			$this->mRenderSystemName = isset($this->_mManifesto['Theme']['RenderSystem']) ? $this->_mManifesto['Theme']['RenderSystem'] : "";
-			$this->mAuthor = isset($this->_mManifesto['Theme']['Author']) ? $this->_mManifesto['Theme']['Author'] : "";
+			$this->mRenderSystemName = $this->_mManifesto['Theme']['RenderSystem'];
+			$this->mAuthor = $this->_mManifesto['Theme']['Author'];
 			
 			if (isset($this->_mManifesto['Theme']['ScreenShot'])) {
 				$this->mScreenShot = $this->_mManifesto['Theme']['ScreenShot'];
@@ -84,7 +88,7 @@
 				$this->mDescription = $this->_mManifesto['Theme']['Description'];
 			}
 			
-			$this->mFormat = isset($this->_mManifesto['Theme']['Format']) ? $this->_mManifesto['Theme']['Format'] : "";
+			$this->mFormat = $this->_mManifesto['Theme']['Format'];
 			
 			return true;
 		}
Index: xoops2jp/html/kernel/XCube_ActionFilter.class.php
diff -u xoops2jp/html/kernel/XCube_ActionFilter.class.php:1.1.2.3 xoops2jp/html/kernel/XCube_ActionFilter.class.php:1.1.2.3.2.1
--- xoops2jp/html/kernel/XCube_ActionFilter.class.php:1.1.2.3	Mon Aug 21 18:51:54 2006
+++ xoops2jp/html/kernel/XCube_ActionFilter.class.php	Thu Sep 28 14:00:41 2006
@@ -1,7 +1,7 @@
 <?php
 /**
  * @package XCube
- * @version $Id: XCube_ActionFilter.class.php,v 1.1.2.3 2006/08/21 09:51:54 minahito Exp $
+ * @version $Id: XCube_ActionFilter.class.php,v 1.1.2.3.2.1 2006/09/28 05:00:41 minahito Exp $
  */
 
 /**
@@ -21,42 +21,48 @@
 class XCube_ActionFilter
 {
 	/**
-	 * XCube_Controller
+	 * [READ ONLY]
 	 *
+	 * @var XCube_Controller
 	 * @access protected
 	 */
 	var $mController;
 	
 	/**
+	 * [READ ONLY]
+	 *
+	 * @var XCube_Root
+	 * @access protected
+	 */
+	var $mRoot;
+	
+	/**
+	 * Constructor.
+	 *
 	 * @param $controller XCube_Controller
 	 */
 	function XCube_ActionFilter(&$controller)
 	{
 		$this->mController =& $controller;
+		$this->mRoot =& $this->mController->mRoot;
 	}
 
 	/**
-	 * Execute the logic when preFilter().
-	 * 
-	 * @return void
+	 * Executes the logic when preFilter().
 	 */	
 	function preFilter()
 	{
 	}
 	
 	/**
-	 * Execute the logic when preBlockFilter().
-	 * 
-	 * @return void
+	 * Executes the logic when preBlockFilter().
 	 */	
 	function preBlockFilter()
 	{
 	}
 	
 	/**
-	 * Execute the logic when postFilter().
-	 * 
-	 * @return void
+	 * Executes the logic when postFilter().
 	 */	
 	function postFilter()
 	{
Index: xoops2jp/html/kernel/XCube_Service.class.php
diff -u xoops2jp/html/kernel/XCube_Service.class.php:1.1.2.2 xoops2jp/html/kernel/XCube_Service.class.php:1.1.2.2.2.1
--- xoops2jp/html/kernel/XCube_Service.class.php:1.1.2.2	Fri Sep  1 12:12:02 2006
+++ xoops2jp/html/kernel/XCube_Service.class.php	Thu Sep 28 14:00:41 2006
@@ -1,7 +1,7 @@
 <?php
 /**
  * @package XCube
- * @version $Id: XCube_Service.class.php,v 1.1.2.2 2006/09/01 03:12:02 minahito Exp $
+ * @version $Id: XCube_Service.class.php,v 1.1.2.2.2.1 2006/09/28 05:00:41 minahito Exp $
  */
 
 /**
Index: xoops2jp/html/kernel/XCube_ActionForm.class.php
diff -u /dev/null xoops2jp/html/kernel/XCube_ActionForm.class.php:1.1.2.1
--- /dev/null	Thu Sep 28 14:00:41 2006
+++ xoops2jp/html/kernel/XCube_ActionForm.class.php	Thu Sep 28 14:00:41 2006
@@ -0,0 +1,506 @@
+<?php
+/**
+ * @package XCube
+ * @version $Id: XCube_ActionForm.class.php,v 1.1.2.1 2006/09/28 05:00:41 minahito Exp $
+ */
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+require_once XOOPS_ROOT_PATH . "/kernel/XCube_Property.class.php";
+require_once XOOPS_ROOT_PATH . "/kernel/XCube_Validator.class.php";
+require_once XOOPS_ROOT_PATH . "/kernel/XCube_FormFile.class.php";
+
+//
+// TODO The difference of array and no-array is too big.
+// TODO Form object should have getValue(), isNull(), toString().
+//
+
+/**
+ * This class fetches the input value from the request value through the
+ * current context object and validate those values. It separates fetching & 
+ * validating from your main logic. Such classes is important in web
+ * program.
+ * 
+ * Plus, this action form has features of one time token. It seems one kinds of
+ * validations. The token is registered in templates.
+ * 
+ * This is suggestion of a simple action form. We do not force a module
+ * developer to use this. You can learn more full-scale action forms from JAVA
+ * and .NET and other PHP. And, you must use auto-generating tool when you need
+ * to ActionForm that is sub-class of this class.
+ * 
+ * XCube_ActionForm contains the one-time token feature for CSRF. But, if the
+ * current HTTP request is from the web service, the token isn't needed.
+ * Therefore, this class decides whether to use the token with the information
+ * of the context.
+ *
+ * @package XCube
+ */
+class XCube_ActionForm
+{
+	/**
+	 * [READ ONLY] The context object. Enables to access the HTTP-request
+	 * information. Basically, this member property is read only. Initialized
+	 * in the constructor.
+	 * 
+	 * @access protected
+	 * @var XCube_HttpContext
+	 */
+	var $mContext = null;
+	
+	/**
+	 * [READ ONLY] The object which has a interface of XCube_Principal. Enables
+	 * to check permissions of the current HTTP-request through principal
+	 * object. Basically, this member property is read only. Initialized in
+	 * constructor.
+	 *
+	 * @access protected
+	 * @var XCube_Principal
+	 */
+	var $mUser = null;
+	
+	/**
+	 * @var array of XCube_FormProperty
+	 * @access protected
+	 */
+	var $mFormProperties = array();
+	
+	/**
+	 * @var array of XCube_FieldProperty
+	 * @access protected
+	 */
+	var $mFieldProperties = array();
+	
+	/**
+	 * NOTICE: This is temporary until we will decide the method of managing error.
+	 * @access protected
+	 * @var bool
+	 */
+	var $mErrorFlag = false;
+	
+	/**
+	 * @var array of string
+	 * @access protected
+	 */
+	var $mErrorMessages = array();
+	
+	/**
+	 * Token string as one time token.
+	 * [FIXME]
+	 *
+	 * @var string
+	 * @access private
+	 */
+	var $_mToken = null;
+	
+	function XCube_ActionForm()
+	{
+		$root =& XCube_Root::getSingleton();
+		$this->mContext =& $root->getContext();
+		$this->mUser =& $this->mContext->getUser();
+	}
+	
+	/**
+	 * Set up form properties and field properties.
+	 */	
+	function prepare()
+	{
+	}
+	
+	/**
+	 * Return token name. If the sub-class doesn't override this member
+	 * function, features about one time tokens aren't used.
+	 * 
+	 * @access public
+	 * @return string
+	 */
+	function getTokenName()
+	{
+		return null;
+	}
+	
+	/**
+	 * Generate token value, register it to sessions, return it. This member
+	 * function should be called in templates. The subclass can override this
+	 * to change the logic for generating token value.
+	 * 
+	 * @access public
+	 * @return string
+	 */
+	function getToken()
+	{
+		if ($this->_mToken == null) {
+			srand(microtime() * 100000);
+			$this->_mToken = md5(XOOPS_SALT . uniqid(rand(), true));
+			
+			$_SESSION['XCUBE_TOKEN'][$this->getTokenName()] = $this->_mToken;
+		}
+		
+		return $this->_mToken;
+	}
+	
+	/**
+	 * Return message when the validation of token is fail.
+	 * 
+	 * @return string
+	 */
+	function getTokenErrorMessage()
+	{
+		return _TOKEN_ERROR;	//< FIXME
+	}
+	
+	/**
+	 * Set raw value as the value of the form property.
+	 * 
+	 * Example (1):
+	 *  $this->set('name', 'Bob');  // Set 'Bob' to 'name'.
+	 * 
+	 * Example (2):
+	 *  $this->set('names', 0, 'Bob');  // Set 'Bob' to 'name[0]'.
+	 */
+	function set()
+	{
+		if (isset($this->mFormProperties[func_get_arg(0)])) {
+			if (func_num_args() == 2) {
+				$value = func_get_arg(1);
+				$this->mFormProperties[func_get_arg(0)]->setValue($value);
+			}
+			elseif (func_num_args() == 3) {
+				$index = func_get_arg(1);
+				$value = func_get_arg(2);
+				$this->mFormProperties[func_get_arg(0)]->setValue($index, $value);
+			}
+		}
+	}
+	
+	/**
+	 * @deprecated
+	 */	
+	function setVar()
+	{
+		if (isset($this->mFormProperties[func_get_arg(0)])) {
+			if (func_num_args() == 2) {
+				$this->mFormProperties[func_get_arg(0)]->setValue(func_get_arg(1));
+			}
+			elseif (func_num_args() == 3) {
+				$this->mFormProperties[func_get_arg(0)]->setValue(func_get_arg(1), func_get_arg(2));
+			}
+		}
+	}
+	
+	/**
+	 * Return raw value. If the return value is used in templates, escaping has
+	 * to be used together.
+	 * 
+	 * @param $key   string Name of form property.
+	 * @param $index string Subscript for array.
+	 * @return mixed
+	 */
+	function get($key, $index=null)
+	{
+		return isset($this->mFormProperties[$key]) ? $this->mFormProperties[$key]->getValue($index) : null;
+	}
+	
+	/**
+	 * @deprecated
+	 */
+	function getVar($key,$index=null)
+	{
+		return $this->get($key, $index);
+	}
+	
+	/**
+	 * Return form properties of this member property.
+	 * 
+	 * @return XCube_AbstractProperty[]
+	 */
+	function &getFormProperties()
+	{
+		return $this->mFormProperties;
+	}
+	
+	/**
+	 * Fetch the input value, set it and form properties. Those values can be
+	 * got, through get() method. the sub-class can define own member function
+	 * to fetch. Define member functions whose name is "fetch" + "form name".
+	 * For example, to fetch "message" define "fetchMessage()" function. Those
+	 * function of the sub-class set value to this action form.
+	 * 
+	 * Example:
+	 *  function fetchModifytime()
+	 *  {
+	 *    $this->set('modifytime', time());
+	 *  }
+	 * 
+	 * @return void
+	 * @see getFromRequest
+	 */
+	function fetch()
+	{
+		foreach (array_keys($this->mFormProperties) as $name) {
+			if ($this->mFormProperties[$name]->hasFetchControl()) {
+				$this->mFormProperties[$name]->fetch($this);
+			}
+			else {
+				$value = $this->mContext->mRequest->getRequest($name);
+				if (!$this->mFormProperties[$name]->isArray() && !is_array($value)) {
+					$this->mFormProperties[$name]->set($value);
+				}
+				elseif ($this->mFormProperties[$name]->isArray() && is_array($value)) {
+					$this->mFormProperties[$name]->set($value);
+				}
+			}
+			
+			$methodName = "fetch" . ucfirst($name);
+			if (method_exists($this, $methodName)) {
+				// call_user_func(array($this,$methodName));
+				$this->$methodName();
+			}
+		}
+	}
+	
+	/**
+	 * Execute validation, so if a input value is wrong, error messages are
+	 * added to error message buffer. The procedure of validation is the
+	 * following:
+	 * 
+	 * 1. If this object have token name, validate one time tokens.
+	 * 2. Call the validation member function of all field properties.
+	 * 3. Call the member function that is defined in the sub-class.
+	 * 
+	 * For a basis, validations are done by functions of each field properties.
+	 * But, the sub-class can define own validation logic. Define member
+	 * functions whose name is "validate" + "form name". For example, to
+	 * validate "message" define "validateMessage()" function.
+	 * 
+	 * @return void
+	 */
+	function validate()
+	{
+		//
+		// check onetime & transaction token
+		//
+		if ($this->getTokenName() != null) {
+			$key = strtr($this->getTokenName(), '.', '_');
+			$token = isset($_REQUEST[$key]) ? $_REQUEST[$key] : null;
+			
+			if (get_magic_quotes_gpc()) {
+				$token = stripslashes($token);
+			}
+			
+			$flag = true;
+			
+			if (!isset($_SESSION['XCUBE_TOKEN'][$this->getTokenName()])) {
+				$flag = false;
+			}
+			elseif ($_SESSION['XCUBE_TOKEN'][$this->getTokenName()] != $token) {
+				unset($_SESSION['XCUBE_TOKEN'][$this->getTokenName()]);
+				$flag = false;
+			}
+			
+			if (!$flag) {
+				$message = $this->getTokenErrorMessage();
+				if ($message == null) {
+					$this->mErrorFlag = true;
+				}
+				else {
+					$this->addErrorMessage($message);
+				}
+			}
+			
+			//
+			// clear token
+			//
+			unset($_SESSION['XCUBE_TOKEN'][$this->getTokenName()]);
+		}
+		
+		foreach (array_keys($this->mFormProperties) as $name) {
+			if (isset($this->mFieldProperties[$name])) {
+				if ($this->mFormProperties[$name]->isArray()) {
+					foreach (array_keys($this->mFormProperties[$name]->mProperties) as $_name) {
+						$this->mFieldProperties[$name]->validate($this->mFormProperties[$name]->mProperties[$_name]);
+					}
+				}
+				else {
+					$this->mFieldProperties[$name]->validate($this->mFormProperties[$name]);
+				}
+			}
+		}
+		
+		//
+		// If this class has original validation methods, call it.
+		//
+		foreach (array_keys($this->mFormProperties) as $name) {
+			$methodName = "validate" . ucfirst($name);
+			if (method_exists($this, $methodName)) {
+				// call_user_func(array($this,$methodName));
+				$this->$methodName();
+			}
+		}
+	}
+	
+	/**
+	 * If the action form keeps error messages or the error flag, return true.
+	 * 
+	 * @access public
+	 * @return bool
+	 */
+	function hasError()
+	{
+		return (count($this->mErrorMessages) > 0 || $this->mErrorFlag);
+	}
+	
+	/**
+	 * Add $message to error message buffer.
+	 * 
+	 * @access protected
+	 */	
+	function addErrorMessage($message)
+	{
+		$this->mErrorMessages[] = $message;
+	}
+	
+	/**
+	 * Return error messages.
+	 * 
+	 * @access public
+	 * @return array
+	 */
+	function getErrorMessages()
+	{
+		return $this->mErrorMessages;
+	}
+	
+	/**
+	 * Set initial values to this action form from a object. This member
+	 * function mediates between the logic and the validation. For example,
+	 * developers can use this method to load values from XoopsSimpleObject.
+	 * 
+	 * This member function is abstract. But, the sub-class of this class
+	 * doesn't have to implement this.
+	 * 
+	 * @param $obj mixed
+	 * @return void
+	 */
+	function load(&$obj)
+	{
+	}
+	
+	/**
+	 * Set input values to a object from this action form. This member function
+	 * mediates between the logic and the result of validations. For example,
+	 * developers can use this method to set values to XoopsSimpleObject.
+	 * 
+	 * This member function is abstract. But, the sub-class of this class
+	 * doesn't have to implement this.
+	 * 
+	 * @param $obj mixed
+	 * @return void
+	 */
+	function update(&$obj)
+	{
+	}
+}
+
+class XCube_FieldProperty
+{
+	var $mForm;
+	
+	var $mDepends;
+	var $mMessages;
+	var $mVariables;
+	
+	function XCube_FieldProperty(&$form)
+	{
+		$this->mForm=&$form;
+	}
+	
+	function setDependsByArray($dependsArr)
+	{
+		foreach($dependsArr as $dependName){
+			$instance =& XCube_DependClassFactory::factoryClass($dependName);
+			if($instance!==null)
+				$this->mDepends[$dependName]=&$instance;
+			
+			unset($instance);
+		}
+	}
+	
+	function addMessage($name,$message)
+	{
+		if(func_num_args()>=2) {
+			$args=func_get_args();
+			$this->mMessages[$args[0]]['message']=$args[1];
+			for($i=0;isset($args[$i+2]);$i++) {
+				$this->mMessages[$args[0]]['args'][$i]=$args[$i+2];
+			}
+		}
+	}
+	
+	function renderMessage($name)
+	{
+		if(!isset($this->mMessages[$name]))
+			return null;
+		
+		$message=$this->mMessages[$name]['message'];
+		
+		if(isset($this->mMessages[$name]['args'])) {
+			for($i=0;$i<count($this->mMessages[$name]['args']);$i++) {
+				$message=str_replace("{".$i."}",$this->mMessages[$name]['args'][$i],$message);
+			}
+		}
+		
+		return $message;
+	}
+	
+	function addVar($name,$value)
+	{
+		$this->mVariables[$name]=$value;
+	}
+	
+	/**
+	 * TODO This class already has form property instance.
+	 */
+	function validate(&$form)
+	{
+		if(is_array($this->mDepends) && count($this->mDepends)>0) {
+			foreach($this->mDepends as $name => $depend) {
+				if(!$depend->isValid($form, $this->mVariables)) {
+					// Error
+					// NOTICE: This is temporary until we will decide the method of managing error.
+					$this->mForm->mErrorFlag=true;
+					
+					// TEST!!
+					$this->mForm->addErrorMessage($this->renderMessage($name));
+				}
+				else {
+					// OK
+				}
+			}
+		}
+	}
+}
+
+class XCube_DependClassFactory
+{
+	function &factoryClass($dependName)
+	{
+		static $_cache;
+		
+		if (!is_array($_cache)) {
+			$_cache = array();
+		}
+		
+		if (!isset($_cache[$dependName])) {
+			// or switch?
+			$class_name = "XCube_" . ucfirst($dependName) . "Validator";
+			if(class_exists($class_name)) {
+				$_cache[$dependName] =& new $class_name();
+			}
+		}
+		
+		return $_cache[$dependName];
+	}
+}
+
+?>
\ No newline at end of file
Index: xoops2jp/html/kernel/XCube_Procedure.class.php
diff -u /dev/null xoops2jp/html/kernel/XCube_Procedure.class.php:1.1.2.1
--- /dev/null	Thu Sep 28 14:00:41 2006
+++ xoops2jp/html/kernel/XCube_Procedure.class.php	Thu Sep 28 14:00:41 2006
@@ -0,0 +1,52 @@
+<?php
+/**
+ * @package XCube
+ * @version $Id: XCube_Procedure.class.php,v 1.1.2.1 2006/09/28 05:00:41 minahito Exp $
+ */
+
+/**
+ * Defines the class which executes the business logic. This class asserts
+ * "executable" to the controller or others. And, this class has some
+ * interfaces for a render-buffer and rendering, whether it's used.
+ */
+class XCube_Procedure
+{
+	/**
+	 * @var XCube_Delegate
+	 */
+	var $mExecute = null;
+	
+	function XCube_Procedure()
+	{
+		$this->mExecute =& new XCube_Delegate();
+	}
+	
+	function prepare()
+	{
+	}
+
+	/**
+	 * Gets a value indicating whether the specific user can execute this logic.
+	 * @param XCube_Principal $principal
+	 * @return bool
+	 */	
+	function hasPermission(&$principal)
+	{
+		return true;
+	}
+	
+	function execute()
+	{
+		$this->mExecute->call(new XCube_Ref($this));
+	}
+	
+	/**
+	 * Gets a name of the render-system which this object requests to render.
+	 * @return string
+	 */
+	function getRenderSystemName()
+	{
+	}
+}
+
+?>
\ No newline at end of file
Index: xoops2jp/html/kernel/XCube_Validator.class.php
diff -u /dev/null xoops2jp/html/kernel/XCube_Validator.class.php:1.1.2.1
--- /dev/null	Thu Sep 28 14:00:41 2006
+++ xoops2jp/html/kernel/XCube_Validator.class.php	Thu Sep 28 14:00:41 2006
@@ -0,0 +1,170 @@
+<?php
+/**
+ * @package XCube
+ * @version $Id: XCube_Validator.class.php,v 1.1.2.1 2006/09/28 05:00:41 minahito Exp $
+ */
+
+/**
+ *  This class defines a interface which XCube_ActionForm calls the check functions.
+ *  But this class is designing now, you should not write a code which dependents
+ * on the design of this class. We designed this class as static method class group
+ * with a reason which a program can not generate many instance quickly. However,
+ * if we will find better method to solve a problem, we will change it.
+ *
+ *  Don't use these classes directly, you should use XCube_ActionForm only.
+ * This is 'protected' accesser in the namespace of XCube_ActionForm.
+ */
+class XCube_Validator
+{
+	/**
+	 * 
+	 * @param XCube_FormProperty $form
+	 * @param array              $vars   variables of this field property.
+	 * @return bool
+	 */
+	function isValid(&$form, $vars)
+	{
+	}
+}
+
+class XCube_RequiredValidator extends XCube_Validator
+{
+	function isValid(&$form, $vars)
+	{
+		return !$form->isNull();
+	}
+}
+
+class XCube_MinlengthValidator extends XCube_Validator
+{
+	function isValid(&$form, $vars)
+	{
+		if ($form->isNull()) {
+			return true;
+		}
+		else {
+			return strlen($form->toString()) >= $vars['minlength'];
+		}
+	}
+}
+
+class XCube_MaxlengthValidator extends XCube_Validator
+{
+	function isValid(&$form, $vars)
+	{
+		if ($form->isNull()) {
+			return true;
+		}
+		else {
+			return strlen($form->toString()) <= $vars['maxlength'];
+		}
+	}
+}
+
+class XCube_MinValidator extends XCube_Validator
+{
+	function isValid(&$form, $vars)
+	{
+		if ($form->isNull()) {
+			return true;
+		}
+		else {
+			return $form->toNumber() >= $vars['min'];
+		}
+	}
+}
+
+class XCube_MaxValidator extends XCube_Validator
+{
+	function isValid(&$form, $vars)
+	{
+		if ($form->isNull()) {
+			return true;
+		}
+		else {
+			return $form->toNumber() <= $vars['max'];
+		}
+	}
+}
+
+class XCube_IntRangeValidator extends XCube_Validator
+{
+	function isValid(&$form, $vars)
+	{
+		if ($form->isNull()) {
+			return true;
+		}
+		else {
+			return (intval($form->toNumber()) >= $vars['min'] && intval($form->toNumber()) <= $vars['max']);
+		}
+	}
+}
+
+class XCube_EmailValidator extends XCube_Validator
+{
+	function isValid(&$form, $vars)
+	{
+		if ($form->isNull()) {
+			return true;
+		}
+		else {
+			return preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i", $form->toString());
+		}
+	}
+}
+
+class XCube_MaskValidator extends XCube_Validator
+{
+	function isValid(&$form, $vars)
+	{
+		if ($form->isNull()) {
+			return true;
+		}
+		else {
+			return preg_match($vars['mask'], $form->toString());
+		}
+	}
+}
+
+class XCube_ExtensionValidator extends XCube_Validator
+{
+	function isValid(&$form, $vars)
+	{
+		if ($form->isNull()) {
+			return true;
+		}
+		else {
+			if (!is_a($form, "XCube_XCube_FileProperty")) {
+				return true;
+			}
+			
+			$extArr = explode(",", $vars['extension']);
+			foreach ($extArr as $ext) {
+				if (strtolower($from->mValue->getExtension()) == strtolower($ext)) {
+					return true;
+				}
+			}
+			
+			return false;
+		}
+	}
+}
+
+class XCube_MaxfilesizeValidator extends XCube_Validator
+{
+	function isValid(&$form, $vars)
+	{
+		if ($form->isNull()) {
+			return true;
+		}
+		else {
+			if (!is_a($form, "XCube_XCube_FileProperty")) {
+				return true;
+			}
+			
+			return ($form->mValue->getFileSize() <= $vars['maxfilesize']);
+		}
+	}
+}
+
+?>
\ No newline at end of file
Index: xoops2jp/html/kernel/XCube_ServiceManager.class.php
diff -u xoops2jp/html/kernel/XCube_ServiceManager.class.php:1.1.2.1 xoops2jp/html/kernel/XCube_ServiceManager.class.php:1.1.2.1.2.1
--- xoops2jp/html/kernel/XCube_ServiceManager.class.php:1.1.2.1	Wed Aug 30 19:05:51 2006
+++ xoops2jp/html/kernel/XCube_ServiceManager.class.php	Thu Sep 28 14:00:41 2006
@@ -1,7 +1,7 @@
 <?php
 /**
  * @package XCube
- * @version $Id: XCube_ServiceManager.class.php,v 1.1.2.1 2006/08/30 10:05:51 minahito Exp $
+ * @version $Id: XCube_ServiceManager.class.php,v 1.1.2.1.2.1 2006/09/28 05:00:41 minahito Exp $
  */
 
 if (!defined('XOOPS_ROOT_PATH')) exit();
@@ -81,7 +81,7 @@
 		
 		return true;
 	}
-
+	
 	/**
 	 * Add WSDL URL. $name must be unique in the list of service. If the
 	 * service which has the same name, is a member of the list, return false.
@@ -112,11 +112,11 @@
 	function &getService($name)
 	{
 		$ret = null;
-
+		
 		if (isset($this->mServices[$name])) {
 			return $this->mServices[$name];
 		}
-
+		
 		return $ret;
 	}
 	
@@ -130,7 +130,7 @@
 	{
 		return $this->getService($name);
 	}
-
+	
 	/**
 	 * Create client instance which to connect to a service, with following the
 	 * kind of the service. Then return that instance. For example, if the
Index: xoops2jp/html/kernel/XCube_RenderSystem.class.php
diff -u /dev/null xoops2jp/html/kernel/XCube_RenderSystem.class.php:1.1.2.1
--- /dev/null	Thu Sep 28 14:00:41 2006
+++ xoops2jp/html/kernel/XCube_RenderSystem.class.php	Thu Sep 28 14:00:41 2006
@@ -0,0 +1,205 @@
+<?php
+/**
+ * @package XCube
+ * @version $Id: XCube_RenderSystem.class.php,v 1.1.2.1 2006/09/28 05:00:41 minahito Exp $
+ */
+
+ if (!defined('XOOPS_ROOT_PATH')) exit();
+
+define("XCUBE_RENDER_MODE_NORMAL",1);
+define("XCUBE_RENDER_MODE_DIALOG",2);
+
+/**
+ * We had to define classes that are XCube_RenderTargetBuffer, XCube_RenderTargetTheme,
+ * XCube_RenderTargetBlock and XCube_RenderTargetMain. And, a render-system had
+ * to define render-sub-system that renders to these render-target. However, this
+ * style gives a heavy load to our XOOPS Cube system that is a PHP application.
+ *
+ * We prepare the following constants for the flag of a render-target instead of
+ * the group of many classes. 
+ */
+define("XCUBE_RENDER_TARGET_TYPE_BUFFER",0);
+define("XCUBE_RENDER_TARGET_TYPE_THEME",1);
+define("XCUBE_RENDER_TARGET_TYPE_BLOCK",2);
+define("XCUBE_RENDER_TARGET_TYPE_MAIN",3);
+
+/**
+ * This is a target whom a render-system renders. This has a buffer and receives
+ * a result of a render-system to the buffer. A developer can control rendering
+ * with using this class.
+ */
+class XCube_RenderTarget
+{
+	var $mName=null;
+
+	var $mRenderBuffer=null;
+	
+	var $mModuleName = null;
+	
+	var $mTemplateName=null;
+
+	var $mAttributes = array();
+	
+	var $mType = XCUBE_RENDER_TARGET_TYPE_BUFFER;
+	
+	var $mCacheTime = null;
+		
+	function XCube_RenderTarget()
+	{
+	}
+
+	function setName($name)
+	{
+		$this->mName = $name;
+	}
+
+	function getName()
+	{
+		return $this->mName;
+	}
+	
+	function setModuleName($name)
+	{
+		$this->mModuleName = $name;
+	}
+	
+	function getModuleName()
+	{
+		return $this->mModuleName;
+	}
+
+	function setTemplateName($name)
+	{
+		$this->mTemplateName = $name;
+	}
+
+	function getTemplateName()
+	{
+		return $this->mTemplateName;
+	}
+	
+	function setAttribute($key,$value)
+	{
+		$this->mAttributes[$key] = $value;
+	}
+	
+	function setAttributes($attr)
+	{
+		$this->mAttributes = $attr;
+	}
+	
+	function getAttribute($key)
+	{
+		return isset($this->mAttributes[$key]) ? $this->mAttributes[$key] : null;
+	}
+
+	function getAttributes()
+	{
+		return $this->mAttributes;
+	}
+	
+	function setRenderBuffer($buf)
+	{
+		$this->mRenderBuffer = $buf;
+	}
+	
+	function getRenderBuffer()
+	{
+		return $this->mRenderBuffer;
+	}
+	
+	function setResult(&$result)
+	{
+		$this->mRenderBuffer = $result;
+	}
+	
+	function getResult()
+	{
+		return $this->mRenderBuffer;
+	}
+	
+	/**
+	 * Set render-target type.
+	 * @param $type int Use constants that are defined by us.
+	 */
+	function setType($type)
+	{
+		$this->mType = $type;
+	}
+	
+	/**
+	 * Return render-target type.
+	 * @return int
+	 */
+	function getType()
+	{
+		return $this->mType;
+	}
+	
+	/**
+	 * Reset a template name and attributes in own properties.
+	 */
+	function reset()
+	{
+		$this->setTemplateName(null);
+		$this->setModuleName(null);
+		unset($this->mAttributes);
+		$this->mAttributes = array();
+		$this->mRenderBuffer = null;
+	}
+}
+
+/**
+ * This system is in charge of rendering and contents cache management.
+ * For cache management, this system must talk with a business logic before business logic executes.
+ * This class has a bad design so that the template engine is strongly tied to cache management.
+ * We must divide this class into renderer and cache management.
+ */
+class XCube_RenderSystem
+{
+	/**
+	 @access private
+	 */
+	var $mController;
+
+	var $mRenderMode = XCUBE_RENDER_MODE_NORMAL;
+	
+	function XCube_RenderSystem()
+	{
+	}
+	
+	/**
+	 * Prepare.
+	 *
+	 * @param XCube_Controller $controller
+	 */
+	function prepare(&$controller)
+	{
+		$this->mController =& $controller;
+	}
+	
+	/**
+	 * Create an object of the render-target, and return it.
+	 *
+	 * @param  int  $type  The number which shows the type of the render-target. Use constants.
+	 * @return XCube_RenderTarget
+	 */
+	function &createRenderTarget($type = XCUBE_RENDER_TARGET_TYPE_MAIN)
+	{
+		$renderTarget =& new XCube_RenderTarget();
+		$renderTarget->setType($type);
+
+		return $renderTarget;
+	}
+
+	/**
+	 * Render to $target.
+	 *
+	 * @param XCube_RenderTarget $target
+	 */
+	function render(&$target)
+	{
+	}
+}
+
+?>
\ No newline at end of file
Index: xoops2jp/html/kernel/XCube_Delegate.class.php
diff -u xoops2jp/html/kernel/XCube_Delegate.class.php:1.1.2.13 xoops2jp/html/kernel/XCube_Delegate.class.php:1.1.2.13.2.1
--- xoops2jp/html/kernel/XCube_Delegate.class.php:1.1.2.13	Wed Aug 23 12:24:56 2006
+++ xoops2jp/html/kernel/XCube_Delegate.class.php	Thu Sep 28 14:00:41 2006
@@ -1,6 +1,7 @@
 <?php
 /**
- * @version $Id: XCube_Delegate.class.php,v 1.1.2.13 2006/08/23 03:24:56 nobunobu Exp $
+ * @package XCube
+ * @version $Id: XCube_Delegate.class.php,v 1.1.2.13.2.1 2006/09/28 05:00:41 minahito Exp $
  */
  
 
@@ -71,8 +72,7 @@
 	 * This is register name for lazy registering.
 	 */
 	var $_mLazyRegisterName = null;
-
-    var $_mUniqueID;
+	
 	/**
 	 * Constructor. The parameter of the constructor is a variable argument
 	 * style to specify the sigunature of this delegate. If the argument is
@@ -89,7 +89,6 @@
 		if (func_num_args() > 0) {
 			$this->_setSignatures(func_get_args());
 		}
-		$this->_mUniqueID = md5(uniqid(rand(), true));
 	}
 	
 	/**
@@ -289,11 +288,6 @@
             }
 		}
 	}
-	
-	function getID()
-	{
-	    return $this->_mUniqueID;
-	}
 }
 
 /**
@@ -335,13 +329,15 @@
 	 */
 	function register($name, &$delegate)
 	{
-		if (!isset($this->_mDelegates[$name][$delegate->getID()])) {
-			$this->_mDelegates[$name][$delegate->getID()] =& $delegate;
+		if (!isset($this->_mDelegates[$name])) {
+			$this->_mDelegates[$name] =& $delegate;
 			
 			if (isset($this->_mCallbacks[$name]) && count($this->_mCallbacks[$name]) > 0) {
 				foreach (array_keys($this->_mCallbacks[$name]) as $key) {
 					$delegate->add($this->_mCallbacks[$name][$key], $this->_mCallbackParameters[$name][$key][0], $this->_mCallbackParameters[$name][$key][1]);
 				}
+				unset($this->_mCallbacks[$name]);
+				unset($this->_mCallbackParameters[$name]);
 			}
 			
 			return true;
@@ -366,12 +362,12 @@
 	function add($name, $callback, $param3 = null, $param4 = null)
 	{
 		if (isset($this->_mDelegates[$name])) {
-		    foreach(array_keys($this->_mDelegates[$name]) as $key) {
-			    $this->_mDelegates[$name][$key]->add($callback, $param3, $param4);
-			}
+			$this->_mDelegates[$name]->add($callback, $param3, $param4);
+		}
+		else {
+			$this->_mCallbacks[$name][] = $callback;
+			$this->_mCallbackParameters[$name][] = array('0' => $param3, '1' => $param4);
 		}
-		$this->_mCallbacks[$name][] = $callback;
-		$this->_mCallbackParameters[$name][] = array('0' => $param3, '1' => $param4);
 	}
 	
 	/**
@@ -385,19 +381,18 @@
 	function delete($name, $delcallback)
 	{
 		if (isset($this->_mDelegates[$name])) {
-		    foreach(array_keys($this->_mDelegates[$name]) as $key) {
-    			$this->_mDelegates[$name][$key]->delete($delcallback);
-    	    }
-    	}
-	    if (isset($this->_mCallbacks[$name])) {
-	        foreach(array_keys($this->_mCallbacks[$name]) as $key) {
-                $callback = $this->_mCallbacks[$name][$key];
-                if (XCube_DelegateUtils::_compareCallback($callback, $delcallback)) {
-                    unset($this->_mCallbacks[$name][$key]);
-                    unset($this->_mCallbackParameters[$name][$key]);
-                }
-	        }
-	    }
+			$this->_mDelegates[$name]->delete($delcallback);
+		} else {
+		    if (isset($this->_mCallbacks[$name])) {
+		        foreach(array_keys($this->_mCallbacks[$name]) as $key) {
+                    $callback = $this->_mCallbacks[$name][$key];
+                    if (XCube_DelegateUtils::_compareCallback($callback, $delcallback)) {
+                        unset($this->_mCallbacks[$name][$key]);
+                        unset($this->_mCallbackParameters[$name][$key]);
+                    }
+		        }
+		    }
+		}
 	}
 	
 	/**
@@ -410,14 +405,13 @@
 	function reset($name)
 	{
 		if (isset($this->_mDelegates[$name])) {
-		    foreach(array_keys($this->_mDelegates[$name]) as $key) {
-    			$this->_mDelegates[$name][$key]->reset();
-    		}
-		}
-	    if (isset($this->_mCallbacks[$name])) {
-	        unset($this->_mCallbacks[$name]);
-	        unset($this->_mCallbackParameters[$name]);
-	    }
+			$this->_mDelegates[$name]->reset();
+		} else {
+		    if (isset($this->_mCallbacks[$name])) {
+		        unset($this->_mCallbacks[$name]);
+		        unset($this->_mCallbackParameters[$name]);
+		    }
+		}
 	}
 	
 	
@@ -465,8 +459,7 @@
         if ($root->mDelegateManager != null) {
             $delegates = $root->mDelegateManager->getDelegates();
             if (isset($delegates[$delegateName])) {
-                $keys = array_keys($delegates[$delegateName]);
-                $delegate =& $delegates[$delegateName][$keys[0]];
+                $delegate =& $delegates[$delegateName];
             } else {
                 $delegate =& new XCube_Delegate;
                 $root->mDelegateManager->register($delegateName, $delegate);
Index: xoops2jp/html/kernel/XCube_Identity.class.php
diff -u /dev/null xoops2jp/html/kernel/XCube_Identity.class.php:1.1.2.1
--- /dev/null	Thu Sep 28 14:00:41 2006
+++ xoops2jp/html/kernel/XCube_Identity.class.php	Thu Sep 28 14:00:41 2006
@@ -0,0 +1,119 @@
+<?php
+/**
+ * @package XCube
+ * @version $Id: XCube_Identity.class.php,v 1.1.2.1 2006/09/28 05:00:41 minahito Exp $
+ */
+
+/**
+ * Defines the basic functionality of an identity object.
+ */
+class XCube_Identity
+{
+	/**
+	 * A name of the identity.
+	 * @var string
+	 */
+	var $mName = "";
+	
+	/**
+	 * The authentication type
+	 * @var string
+	 */
+	var $_mAuthenticationType = "";
+	
+	function XCube_Identity()
+	{
+	}
+	
+	/**
+	 * Sets the authentication type.
+	 * @param string $type
+	 */
+	function setAuthenticationType($type)
+	{
+		$this->_mAuthenticationType = $type;
+	}
+	
+	/**
+	 * Gets the authentication type.
+	 * @return string
+	 */
+	function getAuthenticationType()
+	{
+		return $this->_mAuthenticationType;
+	}
+	
+	/**
+	 * Sets a name of this object.
+	 */
+	function setName($name)
+	{
+		$this->mName = $name;
+	}
+	
+	/**
+	 * Gets a name of this object.
+	 *
+	 * @return string
+	 */
+	function getName()
+	{
+		return $this->mName;
+	}
+	
+	/**
+	 * Gets a value that indicates whether the user has been authenticated.
+	 *
+	 * @return bool
+	 */
+	function isAuthenticated()
+	{
+	}
+}
+
+/**
+ * Defines the basic functionality of a principal object.
+ */
+class XCube_Principal
+{
+	/**
+	 * The identity object which is tied to this object.
+	 */
+	var $mIdentity = null;
+	
+	/**
+	 * Roles in this object.
+	 * @var string[]
+	 */
+	var $_mRoles = array();
+	
+	function XCube_Principal($identity, $roles = array())
+	{
+		$this->mIdentity =& $identity;
+		$this->_mRoles = $roles;
+	}
+	
+	/**
+	 * Gets a identity object which is tied to this object.
+	 * @return XCube_Identity
+	 */
+	function getIdentity()
+	{
+		return $this->mIdentity;
+	}
+	
+	/**
+	 * Gets a value that indicates whether this principal has a role specified by $rolename.
+	 *
+	 * @var string $rolename
+	 * @return bool
+	 */	
+	function isInRole($rolename)
+	{
+	}
+}
+
+
+
+
+?>
\ No newline at end of file


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