NobuNobu
nobun****@users*****
2006年 4月 17日 (月) 14:00:16 JST
Index: xoops2jp/html/kernel/module.php diff -u xoops2jp/html/kernel/module.php:1.2.8.7 xoops2jp/html/kernel/module.php:1.2.8.8 --- xoops2jp/html/kernel/module.php:1.2.8.7 Tue Apr 11 17:41:12 2006 +++ xoops2jp/html/kernel/module.php Mon Apr 17 14:00:16 2006 @@ -1,5 +1,5 @@ <?php -// $Id: module.php,v 1.2.8.7 2006/04/11 08:41:12 nobunobu Exp $ +// $Id: module.php,v 1.2.8.8 2006/04/17 05:00:16 nobunobu Exp $ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // @@ -226,53 +226,24 @@ **/ function &search($term = '', $andor = 'AND', $limit = 0, $offset = 0, $userid = 0) { + $ret = false; if ($this->getVar('hassearch') != 1) { - return false; + return $ret; } $search =& $this->getInfo('search'); if ($this->getVar('hassearch') != 1 || !isset($search['file']) || !isset($search['func']) || $search['func'] == '' || $search['file'] == '') { - return false; + return $ret; } if (file_exists(XOOPS_ROOT_PATH."/modules/".$this->getVar('dirname').'/'.$search['file'])) { include_once XOOPS_ROOT_PATH.'/modules/'.$this->getVar('dirname').'/'.$search['file']; } else { - return false; + return $ret; } if (function_exists($search['func'])) { $func = $search['func']; - return $func($term, $andor, $limit, $offset, $userid); - } - return false; - } - - function getRenderedVersion() - { - return $this->getVar('version') / 100; - } - - /** - * @return bool - */ - function hasHelp() - { - $info =& $this->getInfo(); - if (isset($info['help']) && strlen($info['help']) > 0) { - return true; + $ret = $func($term, $andor, $limit, $offset, $userid); } - - return false; - } - - /** - * @return string - */ - function getHelp() - { - if ($this->hasHelp()) { - return $this->modinfo['help']; - } - - return null; + return $ret; } /**#@+ @@ -294,7 +265,8 @@ function &getByDirName($dirname) { $modhandler =& xoops_gethandler('module'); - return $modhandler->getByDirname($dirname); + $ret =& $modhandler->getByDirname($dirname); + return $ret; } /**#@-*/ } @@ -337,7 +309,7 @@ **/ function &create($isNew = true) { - $module = new XoopsModule(); + $module =& new XoopsModule(); if ($isNew) { $module->setNew(); } @@ -355,27 +327,27 @@ { static $_cachedModule_dirname; static $_cachedModule_mid; + $ret = false; $id = intval($id); if ($id > 0) { if (!empty($_cachedModule_mid[$id])) { return $_cachedModule_mid[$id]; } else { $sql = 'SELECT * FROM '.$this->db->prefix('modules').' WHERE mid = '.$id; - if (!$result = $this->db->query($sql)) { - return false; - } - $numrows = $this->db->getRowsNum($result); - if ($numrows == 1) { - $module = new XoopsModule(); - $myrow = $this->db->fetchArray($result); - $module->assignVars($myrow); - $_cachedModule_mid[$id] =& $module; - $_cachedModule_dirname[$module->getVar('dirname')] =& $module; - return $module; + if ($result = $this->db->query($sql)) { + $numrows = $this->db->getRowsNum($result); + if ($numrows == 1) { + $module =& new XoopsModule(); + $myrow = $this->db->fetchArray($result); + $module->assignVars($myrow); + $_cachedModule_mid[$id] =& $module; + $_cachedModule_dirname[$module->getVar('dirname')] =& $module; + $ret =& $module; + } } } } - return false; + return $ret; } /** @@ -389,27 +361,26 @@ { static $_cachedModule_mid; static $_cachedModule_dirname; - + $ret = false; $dirname = trim($dirname); if (!empty($_cachedModule_dirname[$dirname])) { - return $_cachedModule_dirname[$dirname]; + $ret = $_cachedModule_dirname[$dirname]; } else { $sql = "SELECT * FROM ".$this->db->prefix('modules')." WHERE dirname = ".$this->db->quoteString($dirname); - if (!$result = $this->db->query($sql)) { - return false; - } - $numrows = $this->db->getRowsNum($result); - if ($numrows == 1) { - $module = new XoopsModule(); - $myrow = $this->db->fetchArray($result); - $module->assignVars($myrow); - $_cachedModule_dirname[$dirname] =& $module; - $_cachedModule_mid[$module->getVar('mid')] =& $module; - return $module; + if ($result = $this->db->query($sql)) { + $numrows = $this->db->getRowsNum($result); + if ($numrows == 1) { + $module =& new XoopsModule(); + $myrow = $this->db->fetchArray($result); + $module->assignVars($myrow); + $_cachedModule_dirname[$dirname] =& $module; + $_cachedModule_mid[$module->getVar('mid')] =& $module; + $ret =& $module; + } } - return false; } + return $ret; } /** @@ -543,7 +514,7 @@ return $ret; } while ($myrow = $this->db->fetchArray($result)) { - $module = new XoopsModule(); + $module =& new XoopsModule(); $module->assignVars($myrow); if (!$id_as_key) { $ret[] =& $module;