onokazu
onoka****@users*****
2006年 2月 5日 (日) 14:19:53 JST
Index: xoops2jp/html/kernel/config.php diff -u xoops2jp/html/kernel/config.php:1.2 xoops2jp/html/kernel/config.php:1.2.16.1 --- xoops2jp/html/kernel/config.php:1.2 Fri Mar 18 21:52:14 2005 +++ xoops2jp/html/kernel/config.php Sun Feb 5 14:19:52 2006 @@ -1,5 +1,5 @@ <?php -// $Id: config.php,v 1.2 2005/03/18 12:52:14 onokazu Exp $ +// $Id: config.php,v 1.2.16.1 2006/02/05 05:19:52 onokazu Exp $ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // @@ -30,7 +30,7 @@ // ------------------------------------------------------------------------- // if (!defined('XOOPS_ROOT_PATH')) { - exit(); + exit(); } require_once XOOPS_ROOT_PATH.'/kernel/configoption.php'; @@ -39,8 +39,8 @@ /** * @package kernel * - * @author Kazumi Ono <onoka****@xoops*****> - * @copyright copyright (c) 2000-2003 XOOPS.org + * @author Kazumi Ono <onoka****@xoops*****> + * @copyright copyright (c) 2000-2003 XOOPS.org */ @@ -63,55 +63,56 @@ * holds reference to config item handler(DAO) class * * @var object - * @access private + * @access private */ var $_cHandler; /** * holds reference to config option handler(DAO) class * - * @var object - * @access private + * @var object + * @access private */ var $_oHandler; - /** - * holds an array of cached references to config value arrays, - * indexed on module id and category id - * - * @var array - * @access private - */ - var $_cachedConfigs = array(); + /** + * holds an array of cached references to config value arrays, + * indexed on module id and category id + * + * @var array + * @access private + */ + var $_cachedConfigs = array(); /** * Constructor * - * @param object &$db reference to database object + * @param object &$db reference to database object */ function XoopsConfigHandler(&$db) { - $this->_cHandler = new XoopsConfigItemHandler($db); - $this->_oHandler = new XoopsConfigOptionHandler($db); + $this->_cHandler =& new XoopsConfigItemHandler($db); + $this->_oHandler =& new XoopsConfigOptionHandler($db); } /** * Create a config * * @see XoopsConfigItem - * @return object reference to the new {@link XoopsConfigItem} + * @return object reference to the new {@link XoopsConfigItem} */ function &createConfig() { - return $this->_cHandler->create(); + $ret =& $this->_cHandler->create(); + return $ret; } /** * Get a config * - * @param int $id ID of the config - * @param bool $withoptions load the config's options now? - * @return object reference to the {@link XoopsConfig} + * @param int $id ID of the config + * @param bool $withoptions load the config's options now? + * @return object reference to the {@link XoopsConfig} */ function &getConfig($id, $withoptions = false) { @@ -125,7 +126,7 @@ /** * insert a new config in the database * - * @param object &$config reference to the {@link XoopsConfigItem} + * @param object &$config reference to the {@link XoopsConfigItem} */ function insertConfig(&$config) { @@ -134,23 +135,23 @@ } $options =& $config->getConfOptions(); $count = count($options); - $conf_id = $config->getVar('conf_id'); + $conf_id = $config->getVar('conf_id'); for ($i = 0; $i < $count; $i++) { $options[$i]->setVar('conf_id', $conf_id); if (!$this->_oHandler->insert($options[$i])) { - echo $options[$i]->getErrors(); - } + echo $options[$i]->getErrors(); + } + } + if (!empty($this->_cachedConfigs[$config->getVar('conf_modid')][$config->getVar('conf_catid')])) { + unset ($this->_cachedConfigs[$config->getVar('conf_modid')][$config->getVar('conf_catid')]); } - if (!empty($this->_cachedConfigs[$config->getVar('conf_modid')][$config->getVar('conf_catid')])) { - unset ($this->_cachedConfigs[$config->getVar('conf_modid')][$config->getVar('conf_catid')]); - } return true; } /** * Delete a config from the database * - * @param object &$config reference to a {@link XoopsConfigItem} + * @param object &$config reference to a {@link XoopsConfigItem} */ function deleteConfig(&$config) { @@ -168,30 +169,31 @@ $this->_oHandler->delete($options[$i]); } } - if (!empty($this->_cachedConfigs[$config->getVar('conf_modid')][$config->getVar('conf_catid')])) { - unset ($this->_cachedConfigs[$config->getVar('conf_modid')][$config->getVar('conf_catid')]); - } + if (!empty($this->_cachedConfigs[$config->getVar('conf_modid')][$config->getVar('conf_catid')])) { + unset ($this->_cachedConfigs[$config->getVar('conf_modid')][$config->getVar('conf_catid')]); + } return true; } /** * get one or more Configs * - * @param object $criteria {@link CriteriaElement} - * @param bool $id_as_key Use the configs' ID as keys? - * @param bool $with_options get the options now? + * @param object $criteria {@link CriteriaElement} + * @param bool $id_as_key Use the configs' ID as keys? + * @param bool $with_options get the options now? * - * @return array Array of {@link XoopsConfigItem} objects + * @return array Array of {@link XoopsConfigItem} objects */ function &getConfigs($criteria = null, $id_as_key = false, $with_options = false) { - return $this->_cHandler->getObjects($criteria, $id_as_key); + $ret =& $this->_cHandler->getObjects($criteria, $id_as_key); + return $ret; } /** * Count some configs * - * @param object $criteria {@link CriteriaElement} + * @param object $criteria {@link CriteriaElement} */ function getConfigCount($criteria = null) { @@ -201,73 +203,76 @@ /** * Get configs from a certain category * - * @param int $category ID of a category - * @param int $module ID of a module + * @param int $category ID of a category + * @param int $module ID of a module * - * @return array array of {@link XoopsConfig}s + * @return array array of {@link XoopsConfig}s */ function &getConfigsByCat($category, $module = 0) { static $_cachedConfigs; - if (!empty($_cachedConfigs[$module][$category])) { - return $_cachedConfigs[$module][$category]; - } else { - $ret = array(); - $criteria = new CriteriaCompo(new Criteria('conf_modid', intval($module))); - if (!empty($category)) { - $criteria->add(new Criteria('conf_catid', intval($category))); - } - $configs =& $this->getConfigs($criteria, true); - if (is_array($configs)) { - foreach (array_keys($configs) as $i) { - $ret[$configs[$i]->getVar('conf_name')] = $configs[$i]->getConfValueForOutput(); - } - } - $_cachedConfigs[$module][$category] =& $ret; - return $ret; - } + if (!empty($_cachedConfigs[$module][$category])) { + return $_cachedConfigs[$module][$category]; + } else { + $ret = array(); + $criteria = new CriteriaCompo(new Criteria('conf_modid', intval($module))); + if (!empty($category)) { + $criteria->add(new Criteria('conf_catid', intval($category))); + } + $configs =& $this->getConfigs($criteria, true); + if (is_array($configs)) { + foreach (array_keys($configs) as $i) { + $ret[$configs[$i]->getVar('conf_name')] = $configs[$i]->getConfValueForOutput(); + } + } + $_cachedConfigs[$module][$category] =& $ret; + return $ret; + } } /** * Make a new {@link XoopsConfigOption} * - * @return object {@link XoopsConfigOption} + * @return object {@link XoopsConfigOption} */ function &createConfigOption(){ - return $this->_oHandler->create(); + $ret =& $this->_oHandler->create(); + return $ret; } /** * Get a {@link XoopsConfigOption} * - * @param int $id ID of the config option + * @param int $id ID of the config option * - * @return object {@link XoopsConfigOption} + * @return object {@link XoopsConfigOption} */ function &getConfigOption($id) { - return $this->_oHandler->get($id); + $ret =& $this->_oHandler->get($id); + return $ret; } /** * Get one or more {@link XoopsConfigOption}s * - * @param object $criteria {@link CriteriaElement} - * @param bool $id_as_key Use IDs as keys in the array? + * @param object $criteria {@link CriteriaElement} + * @param bool $id_as_key Use IDs as keys in the array? * - * @return array Array of {@link XoopsConfigOption}s + * @return array Array of {@link XoopsConfigOption}s */ function &getConfigOptions($criteria = null, $id_as_key = false) { - return $this->_oHandler->getObjects($criteria, $id_as_key); + $ret =& $this->_oHandler->getObjects($criteria, $id_as_key); + return $ret; } /** * Count some {@link XoopsConfigOption}s * - * @param object $criteria {@link CriteriaElement} + * @param object $criteria {@link CriteriaElement} * - * @return int Count of {@link XoopsConfigOption}s matching $criteria + * @return int Count of {@link XoopsConfigOption}s matching $criteria */ function getConfigOptionsCount($criteria = null) { @@ -277,29 +282,29 @@ /** * Get a list of configs * - * @param int $conf_modid ID of the modules - * @param int $conf_catid ID of the category + * @param int $conf_modid ID of the modules + * @param int $conf_catid ID of the category * - * @return array Associative array of name=>value pairs. + * @return array Associative array of name=>value pairs. */ function &getConfigList($conf_modid, $conf_catid = 0) { - if (!empty($this->_cachedConfigs[$conf_modid][$conf_catid])) { - return $this->_cachedConfigs[$conf_modid][$conf_catid]; - } else { - $criteria = new CriteriaCompo(new Criteria('conf_modid', $conf_modid)); - if (empty($conf_catid)) { - $criteria->add(new Criteria('conf_catid', $conf_catid)); - } - $configs =& $this->_cHandler->getObjects($criteria); - $confcount = count($configs); - $ret = array(); - for ($i = 0; $i < $confcount; $i++) { - $ret[$configs[$i]->getVar('conf_name')] = $configs[$i]->getConfValueForOutput(); - } - $this->_cachedConfigs[$conf_modid][$conf_catid] =& $ret; - return $ret; - } + if (!empty($this->_cachedConfigs[$conf_modid][$conf_catid])) { + return $this->_cachedConfigs[$conf_modid][$conf_catid]; + } else { + $criteria = new CriteriaCompo(new Criteria('conf_modid', $conf_modid)); + if (empty($conf_catid)) { + $criteria->add(new Criteria('conf_catid', $conf_catid)); + } + $configs =& $this->_cHandler->getObjects($criteria); + $confcount = count($configs); + $ret = array(); + for ($i = 0; $i < $confcount; $i++) { + $ret[$configs[$i]->getVar('conf_name')] = $configs[$i]->getConfValueForOutput(); + } + $this->_cachedConfigs[$conf_modid][$conf_catid] =& $ret; + return $ret; + } } } ?> Index: xoops2jp/html/kernel/configitem.php diff -u xoops2jp/html/kernel/configitem.php:1.2 xoops2jp/html/kernel/configitem.php:1.2.16.1 --- xoops2jp/html/kernel/configitem.php:1.2 Fri Mar 18 21:52:14 2005 +++ xoops2jp/html/kernel/configitem.php Sun Feb 5 14:19:52 2006 @@ -1,5 +1,5 @@ <?php -// $Id: configitem.php,v 1.2 2005/03/18 12:52:14 onokazu Exp $ +// $Id: configitem.php,v 1.2.16.1 2006/02/05 05:19:52 onokazu Exp $ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // @@ -30,14 +30,14 @@ // ------------------------------------------------------------------------- // if (!defined('XOOPS_ROOT_PATH')) { - exit(); + exit(); } /** * @package kernel * - * @author Kazumi Ono <onoka****@xoops*****> - * @copyright copyright (c) 2000-2003 XOOPS.org + * @author Kazumi Ono <onoka****@xoops*****> + * @copyright copyright (c) 2000-2003 XOOPS.org */ /**#@+ @@ -54,8 +54,8 @@ /** * * - * @author Kazumi Ono <onoka****@xoops*****> - * @copyright copyright (c) 2000-2003 XOOPS.org + * @author Kazumi Ono <onoka****@xoops*****> + * @copyright copyright (c) 2000-2003 XOOPS.org */ class XoopsConfigItem extends XoopsObject { @@ -63,8 +63,8 @@ /** * Config options * - * @var array - * @access private + * @var array + * @access private */ var $_confOptions = array(); @@ -88,33 +88,36 @@ /** * Get a config value in a format ready for output * - * @return string + * @return string */ function &getConfValueForOutput() { switch ($this->getVar('conf_valuetype')) { case 'int': - return intval($this->getVar('conf_value', 'N')); + $ret = intval($this->getVar('conf_value', 'N')); break; case 'array': - return unserialize($this->getVar('conf_value', 'N')); + $ret = unserialize($this->getVar('conf_value', 'N')); + break; case 'float': $value = $this->getVar('conf_value', 'N'); - return (float)$value; + $ret = (float)$value; break; case 'textarea': - return $this->getVar('conf_value'); + $ret = $this->getVar('conf_value'); + break; default: - return $this->getVar('conf_value', 'N'); + $ret = $this->getVar('conf_value', 'N'); break; } + return $ret; } /** * Set a config value * - * @param mixed &$value Value - * @param bool $force_slash + * @param mixed &$value Value + * @param bool $force_slash */ function setConfValueForInput(&$value, $force_slash = false) { @@ -137,7 +140,7 @@ /** * Assign one or more {@link XoopsConfigItemOption}s * - * @param mixed $option either a {@link XoopsConfigItemOption} object or an array of them + * @param mixed $option either a {@link XoopsConfigItemOption} object or an array of them */ function setConfOptions($option) { @@ -156,7 +159,7 @@ /** * Get the {@link XoopsConfigItemOption}s of this Config * - * @return array array of {@link XoopsConfigItemOption} + * @return array array of {@link XoopsConfigItemOption} */ function &getConfOptions() { @@ -181,8 +184,8 @@ * Create a new {@link XoopsConfigItem} * * @see XoopsConfigItem - * @param bool $isNew Flag the config as "new"? - * @return object reference to the new config + * @param bool $isNew Flag the config as "new"? + * @return object reference to the new config */ function &create($isNew = true) { @@ -196,8 +199,8 @@ /** * Load a config from the database * - * @param int $id ID of the config - * @return object reference to the config, FALSE on fail + * @param int $id ID of the config + * @return object reference to the config, FALSE on fail */ function &get($id) { @@ -221,7 +224,7 @@ /** * Write a config to the database * - * @param object &$config {@link XoopsConfigItem} object + * @param object &$config {@link XoopsConfigItem} object * @return mixed FALSE on fail. */ function insert(&$config) @@ -257,8 +260,8 @@ /** * Delete a config from the database * - * @param object &$config Config to delete - * @return bool Successful? + * @param object &$config Config to delete + * @return bool Successful? */ function delete(&$config) { @@ -275,9 +278,9 @@ /** * Get configs from the database * - * @param object $criteria {@link CriteriaElement} - * @param bool $id_as_key return the config's id as key? - * @return array Array of {@link XoopsConfigItem} objects + * @param object $criteria {@link CriteriaElement} + * @param bool $id_as_key return the config's id as key? + * @return array Array of {@link XoopsConfigItem} objects */ function &getObjects($criteria = null, $id_as_key = false) { @@ -310,8 +313,8 @@ /** * Count configs * - * @param object $criteria {@link CriteriaElement} - * @return int Count of configs matching $criteria + * @param object $criteria {@link CriteriaElement} + * @return int Count of configs matching $criteria */ function &getCount($criteria = null) { Index: xoops2jp/html/kernel/group.php diff -u xoops2jp/html/kernel/group.php:1.2 xoops2jp/html/kernel/group.php:1.2.16.1 --- xoops2jp/html/kernel/group.php:1.2 Fri Mar 18 21:52:14 2005 +++ xoops2jp/html/kernel/group.php Sun Feb 5 14:19:52 2006 @@ -1,5 +1,5 @@ <?php -// $Id: group.php,v 1.2 2005/03/18 12:52:14 onokazu Exp $ +// $Id: group.php,v 1.2.16.1 2006/02/05 05:19:52 onokazu Exp $ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // @@ -30,7 +30,7 @@ // ------------------------------------------------------------------------- // if (!defined('XOOPS_ROOT_PATH')) { - exit(); + exit(); } /** @@ -186,11 +186,11 @@ while ($myrow = $this->db->fetchArray($result)) { $group = new XoopsGroup(); $group->assignVars($myrow); - if (!$id_as_key) { - $ret[] =& $group; - } else { - $ret[$myrow['groupid']] =& $group; - } + if (!$id_as_key) { + $ret[] =& $group; + } else { + $ret[$myrow['groupid']] =& $group; + } unset($group); } return $ret; @@ -347,11 +347,11 @@ while ($myrow = $this->db->fetchArray($result)) { $mship = new XoopsMembership(); $mship->assignVars($myrow); - if (!$id_as_key) { - $ret[] =& $mship; - } else { - $ret[$myrow['linkid']] =& $mship; - } + if (!$id_as_key) { + $ret[] =& $mship; + } else { + $ret[$myrow['linkid']] =& $mship; + } unset($mship); } return $ret; @@ -403,7 +403,7 @@ * objects? FALSE returns associative array. * @return array array of groups the user belongs to */ - function &getGroupsByUser($uid) + function getGroupsByUser($uid) { $ret = array(); $sql = 'SELECT groupid FROM '.$this->db->prefix('groups_users_link').' WHERE uid='.intval($uid); Index: xoops2jp/html/kernel/member.php diff -u xoops2jp/html/kernel/member.php:1.4 xoops2jp/html/kernel/member.php:1.4.6.1 --- xoops2jp/html/kernel/member.php:1.4 Wed Aug 3 21:39:12 2005 +++ xoops2jp/html/kernel/member.php Sun Feb 5 14:19:52 2006 @@ -1,5 +1,5 @@ <?php -// $Id: member.php,v 1.4 2005/08/03 12:39:12 onokazu Exp $ +// $Id: member.php,v 1.4.6.1 2006/02/05 05:19:52 onokazu Exp $ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // @@ -76,9 +76,9 @@ */ function XoopsMemberHandler(&$db) { - $this->_gHandler = new XoopsGroupHandler($db); - $this->_uHandler = new XoopsUserHandler($db); - $this->_mHandler = new XoopsMembershipHandler($db); + $this->_gHandler =& new XoopsGroupHandler($db); + $this->_uHandler =& new XoopsUserHandler($db); + $this->_mHandler =& new XoopsMembershipHandler($db); } /** @@ -88,7 +88,8 @@ */ function &createGroup() { - return $this->_gHandler->create(); + $ret =& $this->_gHandler->create(); + return $ret; } /** @@ -98,7 +99,8 @@ */ function &createUser() { - return $this->_uHandler->create(); + $ret =& $this->_uHandler->create(); + return $ret; } /** @@ -107,9 +109,10 @@ * @param int $id ID for the group * @return object XoopsGroup reference to the group */ - function getGroup($id) + function &getGroup($id) { - return $this->_gHandler->get($id); + $ret =& $this->_gHandler->get($id); + return $ret; } /** @@ -278,7 +281,7 @@ */ function getUsersByGroup($group_id, $asobject = false, $limit = 0, $start = 0) { - $user_ids =& $this->_mHandler->getUsersByGroup($group_id, $limit, $start); + $user_ids = $this->_mHandler->getUsersByGroup($group_id, $limit, $start); if (!$asobject) { return $user_ids; } else { @@ -303,7 +306,7 @@ */ function getGroupsByUser($user_id, $asobject = false) { - $group_ids =& $this->_mHandler->getGroupsByUser($user_id); + $group_ids = $this->_mHandler->getGroupsByUser($user_id); if (!$asobject) { return $group_ids; } else { @@ -327,7 +330,8 @@ $criteria->add(new Criteria('pass', md5($pwd))); $user =& $this->_uHandler->getObjects($criteria, false); if (!$user || count($user) != 1) { - return false; + $ret = false; + return $ret; } return $user[0]; } @@ -345,7 +349,8 @@ $criteria->add(new Criteria('pass', $md5pwd)); $user =& $this->_uHandler->getObjects($criteria, false); if (!$user || count($user) != 1) { - return false; + $ret = false; + return $ret; } return $user[0]; } Index: xoops2jp/html/kernel/object.php diff -u xoops2jp/html/kernel/object.php:1.4 xoops2jp/html/kernel/object.php:1.4.6.1 --- xoops2jp/html/kernel/object.php:1.4 Wed Aug 3 21:39:12 2005 +++ xoops2jp/html/kernel/object.php Sun Feb 5 14:19:52 2006 @@ -1,5 +1,5 @@ <?php -// $Id: object.php,v 1.4 2005/08/03 12:39:12 onokazu Exp $ +// $Id: object.php,v 1.4.6.1 2006/02/05 05:19:52 onokazu Exp $ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // @@ -286,14 +286,16 @@ case 'e': case 'edit': $ts =& MyTextSanitizer::getInstance(); - return $ts->htmlSpecialChars($ret); + $ret = $ts->htmlSpecialChars($ret); + return $ret; break 1; case 'p': case 'preview': case 'f': case 'formpreview': $ts =& MyTextSanitizer::getInstance(); - return $ts->htmlSpecialChars($ts->stripSlashesGPC($ret)); + $ret = $ts->htmlSpecialChars($ts->stripSlashesGPC($ret)); + return $ret; break 1; case 'n': case 'none': @@ -311,11 +313,13 @@ $smiley = (!isset($this->vars['dosmiley']['value']) || $this->vars['dosmiley']['value'] == 1) ? 1 : 0; $image = (!isset($this->vars['doimage']['value']) || $this->vars['doimage']['value'] == 1) ? 1 : 0; $br = (!isset($this->vars['dobr']['value']) || $this->vars['dobr']['value'] == 1) ? 1 : 0; - return $ts->displayTarea($ret, $html, $smiley, $xcode, $image, $br); + $ret = $ts->displayTarea($ret, $html, $smiley, $xcode, $image, $br); + return $ret; break 1; case 'e': case 'edit': - return htmlspecialchars($ret, ENT_QUOTES); + $ret = htmlspecialchars($ret, ENT_QUOTES); + return $ret; break 1; case 'p': case 'preview': @@ -325,12 +329,14 @@ $smiley = (!isset($this->vars['dosmiley']['value']) || $this->vars['dosmiley']['value'] == 1) ? 1 : 0; $image = (!isset($this->vars['doimage']['value']) || $this->vars['doimage']['value'] == 1) ? 1 : 0; $br = (!isset($this->vars['dobr']['value']) || $this->vars['dobr']['value'] == 1) ? 1 : 0; - return $ts->previewTarea($ret, $html, $smiley, $xcode, $image, $br); + $ret = $ts->previewTarea($ret, $html, $smiley, $xcode, $image, $br); + return $ret; break 1; case 'f': case 'formpreview': $ts =& MyTextSanitizer::getInstance(); - return htmlspecialchars($ts->stripSlashesGPC($ret), ENT_QUOTES); + $ret = htmlspecialchars($ts->stripSlashesGPC($ret), ENT_QUOTES); + return $ret; break 1; case 'n': case 'none': @@ -348,17 +354,20 @@ break 1; case 'e': case 'edit': - return htmlspecialchars($ret, ENT_QUOTES); + $ret = htmlspecialchars($ret, ENT_QUOTES); + return $ret; break 1; case 'p': case 'preview': $ts =& MyTextSanitizer::getInstance(); - return $ts->stripSlashesGPC($ret); + $ret = $ts->stripSlashesGPC($ret); + return $ret; break 1; case 'f': case 'formpreview': $ts =& MyTextSanitizer::getInstance(); - return htmlspecialchars($ts->stripSlashesGPC($ret), ENT_QUOTES); + $ret = htmlspecialchars($ts->stripSlashesGPC($ret), ENT_QUOTES); + return $ret; break 1; case 'n': case 'none': @@ -381,7 +390,8 @@ } $i++; } - return implode(', ', $ret); + $ret = implode(', ', $ret); + return $ret; case 'e': case 'edit': $ret = explode('|', $ret); Index: xoops2jp/html/kernel/tplfile.php diff -u xoops2jp/html/kernel/tplfile.php:1.3 xoops2jp/html/kernel/tplfile.php:1.3.4.1 --- xoops2jp/html/kernel/tplfile.php:1.3 Mon Sep 5 05:46:09 2005 +++ xoops2jp/html/kernel/tplfile.php Sun Feb 5 14:19:52 2006 @@ -1,5 +1,5 @@ <?php -// $Id: tplfile.php,v 1.3 2005/09/04 20:46:09 onokazu Exp $ +// $Id: tplfile.php,v 1.3.4.1 2006/02/05 05:19:52 onokazu Exp $ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // @@ -29,35 +29,36 @@ // Project: The XOOPS Project // // ------------------------------------------------------------------------- // if (!defined('XOOPS_ROOT_PATH')) { - exit(); + exit(); } class XoopsTplfile extends XoopsObject { - function XoopsTplfile() - { - $this->XoopsObject(); - $this->initVar('tpl_id', XOBJ_DTYPE_INT, null, false); - $this->initVar('tpl_refid', XOBJ_DTYPE_INT, 0, false); - $this->initVar('tpl_tplset', XOBJ_DTYPE_OTHER, null, false); - $this->initVar('tpl_file', XOBJ_DTYPE_TXTBOX, null, true, 100); - $this->initVar('tpl_desc', XOBJ_DTYPE_TXTBOX, null, false, 100); - $this->initVar('tpl_lastmodified', XOBJ_DTYPE_INT, 0, false); - $this->initVar('tpl_lastimported', XOBJ_DTYPE_INT, 0, false); - $this->initVar('tpl_module', XOBJ_DTYPE_OTHER, null, false); - $this->initVar('tpl_type', XOBJ_DTYPE_OTHER, null, false); - $this->initVar('tpl_source', XOBJ_DTYPE_SOURCE, null, false); - } - - function &getSource() - { - return $this->getVar('tpl_source'); - } - - function getLastModified() - { - return $this->getVar('tpl_lastmodified'); - } + function XoopsTplfile() + { + $this->XoopsObject(); + $this->initVar('tpl_id', XOBJ_DTYPE_INT, null, false); + $this->initVar('tpl_refid', XOBJ_DTYPE_INT, 0, false); + $this->initVar('tpl_tplset', XOBJ_DTYPE_OTHER, null, false); + $this->initVar('tpl_file', XOBJ_DTYPE_TXTBOX, null, true, 100); + $this->initVar('tpl_desc', XOBJ_DTYPE_TXTBOX, null, false, 100); + $this->initVar('tpl_lastmodified', XOBJ_DTYPE_INT, 0, false); + $this->initVar('tpl_lastimported', XOBJ_DTYPE_INT, 0, false); + $this->initVar('tpl_module', XOBJ_DTYPE_OTHER, null, false); + $this->initVar('tpl_type', XOBJ_DTYPE_OTHER, null, false); + $this->initVar('tpl_source', XOBJ_DTYPE_SOURCE, null, false); + } + + function &getSource() + { + $ret =& $this->getVar('tpl_source'); + return $ret; + } + + function getLastModified() + { + return $this->getVar('tpl_lastmodified'); + } } /** @@ -83,6 +84,7 @@ function &get($id, $getsource = false) { + $ret = false; $id = intval($id); if ($id > 0) { if (!$getsource) { @@ -90,17 +92,15 @@ } else { $sql = 'SELECT f.*, s.tpl_source FROM '.$this->db->prefix('tplfile').' f LEFT JOIN '.$this->db->prefix('tplsource').' s ON s.tpl_id=f.tpl_id WHERE f.tpl_id='.$id; } - if (!$result = $this->db->query($sql)) { - return false; - } - $numrows = $this->db->getRowsNum($result); - if ($numrows == 1) { - $tplfile = new XoopsTplfile(); - $tplfile->assignVars($this->db->fetchArray($result)); - return $tplfile; + if ($result = $this->db->query($sql)) { + $numrows = $this->db->getRowsNum($result); + if ($numrows == 1) { + $ret =& new XoopsTplfile(); + $ret->assignVars($this->db->fetchArray($result)); + } } } - return false; + return $ret; } function loadSource(&$tplfile) @@ -116,7 +116,7 @@ $myrow = $this->db->fetchArray($result); $tplfile->assignVar('tpl_source', $myrow['tpl_source']); } - return true; + return true; } function insert(&$tplfile) @@ -149,7 +149,7 @@ return false; } } - $tplfile->assignVar('tpl_id', $tpl_id); + $tplfile->assignVar('tpl_id', $tpl_id); } else { $sql = sprintf("UPDATE %s SET tpl_tplset = %s, tpl_file = %s, tpl_desc = %s, tpl_lastimported = %u, tpl_lastmodified = %u WHERE tpl_id = %u", $this->db->prefix('tplfile'), $this->db->quoteString($tpl_tplset), $this->db->quoteString($tpl_file), $this->db->quoteString($tpl_desc), $tpl_lastimported, $tpl_lastmodified, $tpl_id); if (!$result = $this->db->query($sql)) { @@ -190,10 +190,10 @@ return false; } } - return true; + return true; } else { - return false; - } + return false; + } } function delete(&$tplfile) @@ -297,7 +297,8 @@ $criteria->add(new Criteria('tpl_type', $type)); } } - return $this->getObjects($criteria, $getsource, false); + $ret =& $this->getObjects($criteria, $getsource, false); + return $ret; } function templateExists($tplname, $tplset_name) Index: xoops2jp/html/kernel/user.php diff -u xoops2jp/html/kernel/user.php:1.2 xoops2jp/html/kernel/user.php:1.2.16.1 --- xoops2jp/html/kernel/user.php:1.2 Fri Mar 18 21:52:14 2005 +++ xoops2jp/html/kernel/user.php Sun Feb 5 14:19:52 2006 @@ -1,5 +1,5 @@ <?php -// $Id: user.php,v 1.2 2005/03/18 12:52:14 onokazu Exp $ +// $Id: user.php,v 1.2.16.1 2006/02/05 05:19:52 onokazu Exp $ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // @@ -29,7 +29,7 @@ // Project: The XOOPS Project // // ------------------------------------------------------------------------- // if (!defined('XOOPS_ROOT_PATH')) { - exit(); + exit(); } /** * Class for users @@ -43,17 +43,17 @@ /** * Array of groups that user belongs to * @var array - * @access private + * @access private */ var $_groups = array(); /** * @var bool is the user admin? - * @access private + * @access private */ var $_isAdmin = null; /** * @var string user's rank - * @access private + * @access private */ var $_rank = null; /** @@ -116,40 +116,40 @@ } } - /** - * check if the user is a guest user + /** + * check if the user is a guest user * * @return bool returns false * */ - function isGuest() - { - return false; - } + function isGuest() + { + return false; + } /** * Updated by Catzwolf 11 Jan 2004 - * find the username for a given ID - * - * @param int $userid ID of the user to find - * @param int $usereal switch for usename or realname - * @return string name of the user. name for "anonymous" if not found. + * find the username for a given ID + * + * @param int $userid ID of the user to find + * @param int $usereal switch for usename or realname + * @return string name of the user. name for "anonymous" if not found. */ function getUnameFromId( $userid, $usereal = 0 ) { - $userid = intval($userid); - $usereal = intval($usereal); - if ($userid > 0) { + $userid = intval($userid); + $usereal = intval($usereal); + if ($userid > 0) { $member_handler =& xoops_gethandler('member'); $user =& $member_handler->getUser($userid); if (is_object($user)) { $ts =& MyTextSanitizer::getInstance(); if ( $usereal ) { - return $ts->htmlSpecialChars($user->getVar('name')); - } else { - return $ts->htmlSpecialChars($user->getVar('uname')); - } + return $ts->htmlSpecialChars($user->getVar('name')); + } else { + return $ts->htmlSpecialChars($user->getVar('uname')); + } } } return $GLOBALS['xoopsConfig']['anonymous']; @@ -157,43 +157,43 @@ /** * increase the number of posts for the user * - * @deprecated + * @deprecated */ function incrementPost(){ $member_handler =& xoops_gethandler('member'); return $member_handler->updateUserByField($this, 'posts', $this->getVar('posts') + 1); } - /** - * set the groups for the user - * - * @param array $groupsArr Array of groups that user belongs to - */ - function setGroups($groupsArr) - { - if (is_array($groupsArr)) { - $this->_groups =& $groupsArr; - } - } + /** + * set the groups for the user + * + * @param array $groupsArr Array of groups that user belongs to + */ + function setGroups($groupsArr) + { + if (is_array($groupsArr)) { + $this->_groups =& $groupsArr; + } + } /** * get the groups that the user belongs to - * - * @return array array of groups + * + * @return array array of groups */ - function &getGroups() + function getGroups() { if (empty($this->_groups)) { $member_handler =& xoops_gethandler('member'); - $this->_groups =& $member_handler->getGroupsByUser($this->getVar('uid')); + $this->_groups = $member_handler->getGroupsByUser($this->getVar('uid')); } return $this->_groups; } - /** - * alias for {@link getGroups()} - * @see getGroups() - * @return array array of groups - * @deprecated - */ - function &groups() + /** + * alias for {@link getGroups()} + * @see getGroups() + * @return array array of groups + * @deprecated + */ + function groups() { return $this->getGroups(); } @@ -205,20 +205,20 @@ * - If you set the module_id to -1, it will return true if the user has admin rights for at least one module * * @param int $module_id check if user is admin of this module - * @return bool is the user admin of that module? + * @return bool is the user admin of that module? */ function isAdmin( $module_id = null ) { - if ( is_null( $module_id ) ) { - $module_id = isset($GLOBALS['xoopsModule']) ? $GLOBALS['xoopsModule']->getVar( 'mid', 'n' ) : 1; - } elseif ( intval($module_id) < 1 ) { - $module_id = 0; - } + if ( is_null( $module_id ) ) { + $module_id = isset($GLOBALS['xoopsModule']) ? $GLOBALS['xoopsModule']->getVar( 'mid', 'n' ) : 1; + } elseif ( intval($module_id) < 1 ) { + $module_id = 0; + } $moduleperm_handler =& xoops_gethandler('groupperm'); return $moduleperm_handler->checkRight('module_admin', $module_id, $this->getGroups()); } /** * get the user's rank - * @return array array of rank ID and title + * @return array array of rank ID and title */ function rank() { @@ -250,14 +250,14 @@ } return $this->_isOnline; } - /**#@+ - * specialized wrapper for {@link XoopsObject::getVar()} + /**#@+ + * specialized wrapper for {@link XoopsObject::getVar()} * * kept for compatibility reasons. * - * @see XoopsObject::getVar() - * @deprecated - */ + * @see XoopsObject::getVar() + * @deprecated + */ /** * get the users UID * @return int @@ -269,8 +269,8 @@ /** * get the users name - * @param string $format format for the output, see {@link XoopsObject::getVar()} - * @return string + * @param string $format format for the output, see {@link XoopsObject::getVar()} + * @return string */ function name($format="S") { @@ -279,7 +279,7 @@ /** * get the user's uname - * @param string $format format for the output, see {@link XoopsObject::getVar()} + * @param string $format format for the output, see {@link XoopsObject::getVar()} * @return string */ function uname($format="S") @@ -289,9 +289,9 @@ /** * get the user's email - * - * @param string $format format for the output, see {@link XoopsObject::getVar()} - * @return string + * + * @param string $format format for the output, see {@link XoopsObject::getVar()} + * @return string */ function email($format="S") { @@ -422,8 +422,8 @@ { return $this->getVar("last_login"); } - /**#@-*/ - + /**#@-*/ + } /** @@ -434,16 +434,16 @@ */ class XoopsGuestUser extends XoopsUser { - /** - * check if the user is a guest user + /** + * check if the user is a guest user * * @return bool returns true * */ - function isGuest() - { - return true; - } + function isGuest() + { + return true; + } } @@ -640,7 +640,7 @@ return true; } - /** + /** * Change a value for users with a certain criteria * * @param string $fieldname Name of the field