Minahito
minah****@users*****
2006年 9月 28日 (木) 14:03:33 JST
Index: xoops2jp/html/class/XCube_ServiceManager.class.php diff -u xoops2jp/html/class/XCube_ServiceManager.class.php:1.1.2.4 xoops2jp/html/class/XCube_ServiceManager.class.php:removed --- xoops2jp/html/class/XCube_ServiceManager.class.php:1.1.2.4 Mon Aug 7 20:26:44 2006 +++ xoops2jp/html/class/XCube_ServiceManager.class.php Thu Sep 28 14:03:33 2006 @@ -1,114 +0,0 @@ -<?php -/** - * @package XCube - * @version $Id: XCube_ServiceManager.class.php,v 1.1.2.4 2006/08/07 11:26:44 minahito Exp $ - */ - -if (!defined('XOOPS_ROOT_PATH')) exit(); - -require_once XOOPS_ROOT_PATH . "/kernel/XCube_Delegate.class.php"; - -/** - * This class manages XCube_Service instances, searches these, creates a much - * client instance. Now, the purpose of this class is for inside of own XOOPS - * site. In other words, this class doesn't work for publishing web services. - * About these separated working, the core team shall examine. - * - * XCube namespace can't contain the SOAP library directly. Delegate mechanism - * is good for this class. This class creates a client instance which to - * connect to a service, with following the kind of the service. For example, - * if the specified service is really web service, SOAP client has to be - * created. But, if the service is a virtual service of XCube, virtual client - * has to be created. - */ -class XCube_ServiceManager -{ - /** - * Array of XCube_Service instances. - * - * @var Array - */ - var $mServices = array(); - - /** - * @var XCube_Delegate - * @param &$client - * @param $service - */ - var $mCreateClient = null; - - function XCube_ServiceManager() - { - $this->mCreateClient =& new XCube_Delegate(); - $this->mCreateClient->register("XCube_ServiceManager.CreateClient"); - } - - /** - * Add service object. $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. - * - * @param $name string - * @param $service XCube_Service - * @return bool - */ - function addService($name, &$service) - { - if (isset($this->mServices[$name])) { - return false; - } - - $this->mServices[$name] =& $service; - - return true; - } - - /** - * This member function will be removed at beta version. - * - * @deprecated - * @see XCube_ServiceManager::addService() - */ - function addXCubeService($name, &$service) - { - return $this->addService($name, $service); - } - - function &getService($name) - { - $ret = null; - - if (isset($this->mServices[$name])) { - return $this->mServices[$name]; - } - - return $ret; - } - - /** - * This member function will be removed at beta version. - * - * @deprecated - * @see XCube_ServiceManager::getService() - */ - function &searchXCubeService($name) - { - 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 - * specified service is really web service, SOAP client has to be created. - * But, if the service is a virtual service of XCube, virtual client has to - * be created. - */ - function &createClient(&$service) - { - $client = null; - $this->mCreateClient->call(new XCube_Ref($client), $service); - - return $client; - } -} - -?> \ No newline at end of file Index: xoops2jp/html/class/XCube_ActionForm.class.php diff -u xoops2jp/html/class/XCube_ActionForm.class.php:1.1.2.36 xoops2jp/html/class/XCube_ActionForm.class.php:removed --- xoops2jp/html/class/XCube_ActionForm.class.php:1.1.2.36 Wed Jul 26 19:50:06 2006 +++ xoops2jp/html/class/XCube_ActionForm.class.php Thu Sep 28 14:03:33 2006 @@ -1,809 +0,0 @@ -<?php -/** - * @package XCube - * @version $Id: XCube_ActionForm.class.php,v 1.1.2.36 2006/07/26 10:50:06 minahito Exp $ - */ - -if (!defined('XOOPS_ROOT_PATH')) exit(); - -require_once XOOPS_ROOT_PATH . "/class/XCube_Validator.class.php"; -require_once XOOPS_ROOT_PATH . "/class/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 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. - * - * @package XCube - */ -class XCube_ActionForm -{ - /** - * @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. - * - * @var string - * @access private - */ - var $_mToken = null; - - function XCube_ActionForm() - { - } - - /** - * 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; - } - - /** - * 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) { - $this->mFormProperties[$name]->fetch(); - - $methodName = "fetch" . ucfirst($name); - if (method_exists($this, $methodName)) { - // call_user_func(array($this,$methodName)); - $this->$methodName(); - } - } - } - - /** - * Get the value from requests, strip slashes if magic_quotes_gps is on, - * return the value. This member function supports the sub-class that - * defines own member functions to fetch. - * - * @access protected - * @return mixed - */ - function getFromRequest($key) - { - $value = isset($_REQUEST[$key]) ? $_REQUEST[$key] : null; - - if (get_magic_quotes_gpc()) { - $token = stripslashes($value); - } - - return $value; - } - - /** - * 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_PropertyInterface -{ - function XCube_PropertyInterface($name) - { - } - - function fetch($key = null) - { - } - - function setValue($arg0 = null, $arg1 = null) - { - } - - function getValue($arg0 = null) - { - } - - /** - * @return bool - */ - function isArray() - { - } -} - -class XCube_AbstractProperty extends XCube_PropertyInterface -{ - var $mName=null; - var $mValue=null; - - function XCube_AbstractProperty($name) - { - $this->mName=$name; - } - - function setValue($value, $dmy = null) - { - $this->mValue = $value; - } - - function getValue($index = null) - { - return $this->mValue; - } - - function fetch($key = null) - { - $value = null; - - if ($key !== null && is_array($_REQUEST[$this->mName]) && isset($_REQUEST[$this->mName][$key])) { - $value = $_REQUEST[$this->mName][$key]; - } - elseif (isset($_REQUEST[$this->mName]) && !is_array($_REQUEST[$this->mName])) { - $value = $_REQUEST[$this->mName]; - } - - if (get_magic_quotes_gpc()) { - $this->mValue = stripslashes($value); - } - else { - $this->mValue = $value; - } - } - - function isArray() - { - return false; - } - - function isNull() - { - return (strlen(trim($this->mValue)) == 0); - } - - function toNumber() - { - return $this->mValue; - } - - function toString() - { - return $this->mValue; - } -} - -class XCube_AbstractArrayProperty extends XCube_PropertyInterface -{ - var $mName = null; - var $mProperties = array(); - - var $mPropertyClassName = null; - - function XCube_AbstractArrayProperty($name) - { - $this->mName = $name; - } - - function fetch($key = null) - { - unset($this->mProperties); - $this->mProperties = array(); - if (isset($_REQUEST[$this->mName]) && is_array($_REQUEST[$this->mName])) { - foreach ($_REQUEST[$this->mName] as $_key => $_val) { - $this->mProperties[$_key] =& new $this->mPropertyClassName($this->mName); - $this->mProperties[$_key]->fetch($_key); - } - } - } - - function setValue($index, $value) - { - if (!isset($this->mProperties[$index])) { - $this->mProperties[$index] = new $this->mPropertyClassName($this->mName); - } - $this->mProperties[$index]->setValue($value); - } - - function getValue($index=null) - { - if($index==null) { - $ret = array(); - - foreach ($this->mProperties as $name => $value) { - $ret[$name] = $value->getValue(); - } - - return $ret; - } - - return isset($this->mProperties[$index]) ? $this->mProperties[$index]->getValue() : null; - } - - function isArray() - { - return true; - } -} - -class XCube_BoolProperty extends XCube_AbstractProperty -{ - function fetch($key = null) - { - parent::fetch($key); - if (strlen(trim($this->mValue)) > 0) { - $this->mValue = (intval($this->mValue)>0) ? 1 : 0; - } - else { - $this->mValue = 0; - } - } -} - -class XCube_BoolArrayProperty extends XCube_AbstractArrayProperty -{ - var $mPropertyClassName = "XCube_BoolProperty"; -} - -class XCube_IntProperty extends XCube_AbstractProperty -{ - function fetch($key = null) - { - parent::fetch($key); - if (strlen(trim($this->mValue)) > 0) { - $this->mValue = intval($this->mValue); - } - else { - $this->mValue = null; - } - } -} - -class XCube_IntArrayProperty extends XCube_AbstractArrayProperty -{ - var $mPropertyClassName = "XCube_IntProperty"; -} - -class XCube_FloatProperty extends XCube_AbstractProperty -{ - function fetch($key = null) - { - parent::fetch($key); - if (strlen(trim($this->mValue)) > 0) { - $this->mValue = floatval($this->mValue); - } - else { - $this->mValue = null; - } - } -} - -class XCube_FloatArrayProperty extends XCube_AbstractArrayProperty -{ - var $mPropertyClassName = "XCube_FloatProperty"; -} - -/** - * 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 fetch($key = null) - { - parent::fetch($key); - if (preg_match_all("/[\\x00-\\x1f]/", $this->mValue, $matches, PREG_PATTERN_ORDER)) { - foreach ($matches[0] as $match) { - die("[". $this->mName . "]Get control code :" . ord($match)); - } - } - } - - function toNumber() - { - return intval($this->mValue); - } -} - -class XCube_StringArrayProperty extends XCube_AbstractArrayProperty -{ - var $mPropertyClassName = "XCube_StringProperty"; -} - -/** - * 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 fetch($key = null) - { - parent::fetch($key); - $matches = array(); - $allow_codes = array(9,10,13); - - if (preg_match_all("/[\\x00-\\x09]|[\\x0b-\\x0c]|[\\x0e-\\x1f]/", $this->mValue, $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)); - } - } - } - - function toNumber() - { - return intval($this->mValue); - } -} - -class XCube_TextArrayProperty extends XCube_AbstractArrayProperty -{ - var $mPropertyClassName = "XCube_TextProperty"; -} - -class XCube_FileProperty extends XCube_AbstractProperty -{ - function XCube_FileProperty($name) - { - parent::XCube_AbstractProperty($name); - $this->mValue =& new XCube_FormFile($name); - } - - 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_AbstractArrayProperty -{ - var $mPropertyClassName = "XCube_FileProperty"; - - function fetch($key = null) - { - 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 -{ - var $mPropertyClassName = "XCube_ImageFileProperty"; -} - -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/class/XCube_BlockProcedure.class.php diff -u xoops2jp/html/class/XCube_BlockProcedure.class.php:1.1.2.4 xoops2jp/html/class/XCube_BlockProcedure.class.php:removed --- xoops2jp/html/class/XCube_BlockProcedure.class.php:1.1.2.4 Thu Aug 3 18:30:34 2006 +++ xoops2jp/html/class/XCube_BlockProcedure.class.php Thu Sep 28 14:03:33 2006 @@ -1,72 +0,0 @@ -<?php -/** - * @package XCube - * @version $Id: XCube_BlockProcedure.class.php,v 1.1.2.4 2006/08/03 09:30:34 minahito Exp $ - */ - -/** - * @package XCube - */ -class XCube_BlockProcedure -{ - function XCube_BlockProcedure() - { - } - - function getName() - { - } - - function execute(&$controller, &$user, &$render) - { - } - - function getId() - { - } - - function enableCached() - { - return true; - } - - /** - * Return cache time - * @return int - */ - function getCacheTime() - { - return 0; - } - - function getTitle() - { - } - - function getEntryIndex() - { - } - - function getWeight() - { - } - - function hasResult() - { - } - - function &getResult() - { - } - - /** - * Return 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/class/XCube_PageNavigator.class.php diff -u xoops2jp/html/class/XCube_PageNavigator.class.php:1.1.2.9 xoops2jp/html/class/XCube_PageNavigator.class.php:removed --- xoops2jp/html/class/XCube_PageNavigator.class.php:1.1.2.9 Wed Sep 27 16:12:42 2006 +++ xoops2jp/html/class/XCube_PageNavigator.class.php Thu Sep 28 14:03:33 2006 @@ -1,181 +0,0 @@ -<?php -/** - * @package XCube - * @version $Id: XCube_PageNavigator.class.php,v 1.1.2.9 2006/09/27 07:12:42 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."&".implode("&",$tarr); - } - else { - return $this->mUrl."?".implode("&",$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 = "&"; - } - - 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/class/XCube_ActionStrategy.class.php diff -u xoops2jp/html/class/XCube_ActionStrategy.class.php:1.1.2.2 xoops2jp/html/class/XCube_ActionStrategy.class.php:removed --- xoops2jp/html/class/XCube_ActionStrategy.class.php:1.1.2.2 Wed Aug 9 18:29:47 2006 +++ xoops2jp/html/class/XCube_ActionStrategy.class.php Thu Sep 28 14:03:33 2006 @@ -1,25 +0,0 @@ -<?php -/** - * @package XCube - * @version $Id: XCube_ActionStrategy.class.php,v 1.1.2.2 2006/08/09 09:29:47 minahito Exp $ - */ - -/** - * This class defines the logic to decide the model action of XCube_Controller. - * XCube_Controller does not implement the rule of framework. - * The reason is he hates compulsion to a module. It is policy of XOOPS Cube. - * - * @package XCube - */ -class XCube_ActionStrategy -{ - function prepare(&$controller) - { - } - - function execute(&$controller) - { - } -} - -?> \ No newline at end of file Index: xoops2jp/html/class/XCube_RenderSystem.class.php diff -u xoops2jp/html/class/XCube_RenderSystem.class.php:1.1.2.18 xoops2jp/html/class/XCube_RenderSystem.class.php:removed --- xoops2jp/html/class/XCube_RenderSystem.class.php:1.1.2.18 Thu Aug 10 18:41:34 2006 +++ xoops2jp/html/class/XCube_RenderSystem.class.php Thu Sep 28 14:03:33 2006 @@ -1,213 +0,0 @@ -<?php -/** - * @package XCube - * @version $Id: XCube_RenderSystem.class.php,v 1.1.2.18 2006/08/10 09:41:34 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() - { - $this->mRenderBuffer = $buf; - } - - function getRenderBuffer($buf) - { - 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) - { - $this->renderWithTarget($target); - } - - /** - * @deprecated see render() - */ - function renderWithTarget(&$renderTarget) - { - } -} - -?> \ No newline at end of file Index: xoops2jp/html/class/XCube_ActionFilter.class.php diff -u xoops2jp/html/class/XCube_ActionFilter.class.php:1.1.2.2 xoops2jp/html/class/XCube_ActionFilter.class.php:removed --- xoops2jp/html/class/XCube_ActionFilter.class.php:1.1.2.2 Tue Jun 6 12:51:59 2006 +++ xoops2jp/html/class/XCube_ActionFilter.class.php Thu Sep 28 14:03:33 2006 @@ -1,13 +0,0 @@ -<?php -/** - * The class defined by this file is the member of the kernel group. This file - * has been moved into kernel directory already. We'll remove this file before - * XOOPS Cube Legacy 2.1 Alpha4 release. - * - * @package XCube - * @version $Id: XCube_ActionFilter.class.php,v 1.1.2.2 2006/06/06 03:51:59 minahito Exp $ - */ - -require_once XOOPS_ROOT_PATH . "/kernel/XCube_ActionFilter.class.php"; - -?> \ No newline at end of file Index: xoops2jp/html/class/XCube_Validator.class.php diff -u xoops2jp/html/class/XCube_Validator.class.php:1.1.2.1 xoops2jp/html/class/XCube_Validator.class.php:removed --- xoops2jp/html/class/XCube_Validator.class.php:1.1.2.1 Fri Jan 27 17:01:51 2006 +++ xoops2jp/html/class/XCube_Validator.class.php Thu Sep 28 14:03:33 2006 @@ -1,163 +0,0 @@ -<?php - -/** - * 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 -{ - /** - * @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/class/XCube_ModuleController.class.php diff -u xoops2jp/html/class/XCube_ModuleController.class.php:1.1.2.8 xoops2jp/html/class/XCube_ModuleController.class.php:removed --- xoops2jp/html/class/XCube_ModuleController.class.php:1.1.2.8 Thu Aug 10 18:41:23 2006 +++ xoops2jp/html/class/XCube_ModuleController.class.php Thu Sep 28 14:03:33 2006 @@ -1,89 +0,0 @@ -<?php -/** - * @package XCube - * @version $Id: XCube_ModuleController.class.php,v 1.1.2.8 2006/08/10 09:41:23 minahito Exp $ - */ - -/** - * @deprecated - */ -class XCube_ModuleController -{ - var $mController; - var $mConfig; - - function XCube_ModuleController(&$controller) - { - $this->mController=&$controller; - } - - /** - * Set up this class. - */ - function prepare() - { - } - - /** - * If this request is calling module, return true. - * @return boolean - */ - function isModuleProcess() - { - return false; - } - - /** - * If module requested is available, return true. - * @return boolean - */ - function isActive() - { - return false; - } - - /** - * If the current user can access to this module, return true. - * @todo This method re-writes $GLOBAL['xoopsUserIsAdmin']! Wmm... - * @return bool - */ - function hasPermission() - { - return false; - } - - /** - * @return void - */ - function setupLanguage() - { - } - - - function getConfig($key=null) - { - if($key!=null) - return isset($this->mConfig[$key]) ? $this->mConfig[$key] : null; - else - return $this->mConfig; - } - - - /** - * Return abs path. - * @return string - */ - function getModuleDir() - { - } - - /** - * Return a name that this depends on render system. - * @return string - */ - function getDependRenderSystem() - { - } -} - -?> \ No newline at end of file Index: xoops2jp/html/class/XCube_FormFile.class.php diff -u xoops2jp/html/class/XCube_FormFile.class.php:1.1.2.7 xoops2jp/html/class/XCube_FormFile.class.php:removed --- xoops2jp/html/class/XCube_FormFile.class.php:1.1.2.7 Wed Aug 9 18:30:10 2006 +++ xoops2jp/html/class/XCube_FormFile.class.php Thu Sep 28 14:03:33 2006 @@ -1,312 +0,0 @@ -<?php -/** - * @package XCube - * @version $Id: XCube_FormFile.class.php,v 1.1.2.7 2006/08/09 09:30:10 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); - } -} - -class XCube_FormImageFile extends XCube_FormFile -{ - function fetch() - { - parent::fetch(); - - if ($this->hasUploadFile()) { - if (!$this->_checkFormat()) { - $this->mUploadFileFlag = false; - } - } - } - - function getWidth() - { - list($width,$height,$type,$attr)=getimagesize($this->_mTmpFileName); - return $width; - } - - function getHeight() - { - list($width,$height,$type,$attr)=getimagesize($this->_mTmpFileName); - return $height; - } - - /** - * @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/class/XCube_Utils.class.php diff -u xoops2jp/html/class/XCube_Utils.class.php:1.1.2.5 xoops2jp/html/class/XCube_Utils.class.php:removed --- xoops2jp/html/class/XCube_Utils.class.php:1.1.2.5 Mon Jul 31 18:57:26 2006 +++ xoops2jp/html/class/XCube_Utils.class.php Thu Sep 28 14:03:33 2006 @@ -1,77 +0,0 @@ -<?php -/** - * @package XCube - * @version $Id: XCube_Utils.class.php,v 1.1.2.5 2006/07/31 09:57:26 minahito Exp $ - */ - -class XCube_Utils -{ - /** - Display redirect message and execute redirect. - You can not continue your routine, because this method call exit(). - - @todo I must solve direct HTML code. - @param $url string - @param $time intval - @param $message If you want to multiline message, you must set message as array. - - @deprecated Don't use static function of XCube layer for redirect. - */ - function redirectHeader($url, $time, $messages = null) - { - $root =& XCube_Root::getSingleton(); - $root->mController->executeRedirect($url, $time, $messages); - } - - 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; - } - - function formatMessageByMap($subject,$arr) - { - $searches=array(); - $replaces=array(); - foreach($arr as $key=>$value) { - $searches[]="{".$key."}"; - $replaces[]=$value; - } - - return str_replace($searches,$replaces,$subject); - } - - function checkSystemModules() { - $root=&XCube_Root::getSingleton(); - $systemModules = array_map('trim', explode(',',$root->getSiteConfig('Cube','SystemModules'))); - $recommendedModules = array_map('trim', explode(',',$root->getSiteConfig('Cube','RecommendedModules'))); - $moduleHandler =& xoops_gethandler('module'); - $uninstalledModules = array(); - $disabledModules = array(); - foreach($systemModules as $systemModule) { - if(!empty($systemModule)) { - if(!($moduleObject =& $moduleHandler->getByDirname($systemModule))) { - $uninstalledModules[] = $systemModule; - } else if(!$moduleObject->getVar('isactive')) { - $disabledModules[] = $systemModule; - } - } - } - if ((count($uninstalledModules)==0)&&(count($disabledModules)==0)) { - return true; - } else { - return array('uninstalled' =>$uninstalledModules, 'disabled'=>$disabledModules, 'recommended'=>$recommendedModules); - } - } -} - -?> \ No newline at end of file Index: xoops2jp/html/class/XCube_Service.class.php diff -u xoops2jp/html/class/XCube_Service.class.php:1.1.2.5 xoops2jp/html/class/XCube_Service.class.php:removed --- xoops2jp/html/class/XCube_Service.class.php:1.1.2.5 Thu Jul 13 22:12:42 2006 +++ xoops2jp/html/class/XCube_Service.class.php Thu Sep 28 14:03:33 2006 @@ -1,128 +0,0 @@ -<?php -/** - * @package XCube - * @version $Id: XCube_Service.class.php,v 1.1.2.5 2006/07/13 13:12:42 nobunobu Exp $ - */ - -/** - * *An experiment class* - * This class defines function communication between modules. - * This class conceals real processes. - */ -class XCube_Service -{ - var $mOperations = array(); - var $mErrorStr = null; - - function XCube_Service() - { - } - - function prepare() - { - } - - function register($name, $in=false, $out=false) - { - $this->mOperations[$name] = array( - "name" => $name, - "in" => $in, - "out" => $out - ); - } - - function setError($message) - { - $this->mErrorStr = $message; - } - - /** - * Return public URL of WSDL. If the public service doesn't exist, return - * null. - * - * @return string - */ - function getWSDLUrl() - { - return null; - } - - /** - * If this instance is outer web service, return true. - * - * @return bool - */ - function isOuterService() - { - return false; - } -} - -/** - * *An experiment class* - * This class is the adapter of a service class. - * I give a caller the interface that resembled NUSOAP. - */ -class XCube_AbstractServiceClient -{ - var $mService; - var $mClientErrorStr; - - function XCube_AbstractServiceClient(&$service) - { - $this->mService =& $service; - } - - function call() - { - } - - function getOperationData($operation) - { - } - - function setError($message) - { - $this->mClientErrorStr=$message; - } - - function getError() - { - return !empty($this->mClientErrorStr) ? $this->mClientErrorStr : $this->mService->mErrorStr; - } -} - -class XCube_ServiceClient extends XCube_AbstractServiceClient -{ - function call() - { - $this->mClientErrorStr = null; - - if(!is_object($this->mService)) { - $this->mClientErrorStr = "This instance is not connected to service"; - return null; - } - - $args = func_get_args(); - $operation = array_shift($args); - - if (isset($this->mService->mOperations[$operation])) { - $callback = null; - if (strstr($operation, ".") !== false) { - $tmp = explode(".", $operation); - $callback = array($tmp[0], $tmp[1]); - } - else { - $callback = array($this->mService, $operation); - } - - return call_user_func_array($callback, $args); - } - else { - $this->mClientErrorStr = "operation $operation not present."; - return null; - } - } -} - -?> \ No newline at end of file