Minahito
minah****@users*****
2006年 9月 28日 (木) 19:24:49 JST
Index: xoops2jp/html/modules/base/service/LegacySearchService.class.php diff -u xoops2jp/html/modules/base/service/LegacySearchService.class.php:1.1.2.8 xoops2jp/html/modules/base/service/LegacySearchService.class.php:1.1.2.8.2.1 --- xoops2jp/html/modules/base/service/LegacySearchService.class.php:1.1.2.8 Fri Sep 1 12:17:16 2006 +++ xoops2jp/html/modules/base/service/LegacySearchService.class.php Thu Sep 28 19:24:49 2006 @@ -113,7 +113,7 @@ $this->addFunction(S_PUBLIC_FUNC('Legacy_SearchModuleArray getActiveModules()')); } - function getActiveModules(&$user, $params) + function getActiveModules() { // // At first, get active module IDs. @@ -127,7 +127,7 @@ $handler =& xoops_gethandler('groupperm'); - $groupArr = Legacy_SearchUtils::getUserGroups($user); + $groupArr = Legacy_SearchUtils::getUserGroups(); $ret = array(); foreach ($moduleArr as $module) { @@ -142,24 +142,39 @@ return $ret; } - function searchItems(&$user, $params) + function searchItems() { // // TODO Need validation // + $root =& XCube_Root::getSingleton(); + $request =& $root->mContext->mRequest; + + $mid = intval($request->getRequest('mid')); + $queries = $request->getRequest('queries'); + $andor = $request->getRequest('andor'); + $maxhit = intval($request->getRequest('maxhit')); + $start = intval($request->getRequest('start')); - $ret = $this->_searchItems($user, intval($params['mid']), $params['queries'], $params['andor'], $params['maxhit'], $params['start'], 0); + $ret = $this->_searchItems($mid, $queries, $andor, $maxhit, $start, 0); return $ret; } - function searchItemsOfUser(&$user, $params) + function searchItemsOfUser() { // // TODO Need validation // + $root =& XCube_Root::getSingleton(); + $request =& $root->mContext->mRequest; + + $mid = intval($request->getRequest('mid')); + $maxhit = intval($request->getRequest('maxhit')); + $start = intval($request->getRequest('start')); + $uid = intval($request->getRequest('uid')); - $ret = $this->_searchItems($user, intval($params['mid']), null, 'and', intval($params['maxhit']), intval($params['start']), intval($params['uid'])); + $ret = $this->_searchItems($mid, null, 'and', $maxhit, $start, $uid); return $ret; } @@ -167,11 +182,11 @@ /** * @access private */ - function _searchItems(&$user, $mid, $queries, $andor, $max_hit, $start, $uid) + function _searchItems($mid, $queries, $andor, $max_hit, $start, $uid) { $ret = array(); - $modleArr = $this->getActiveModules($user, array()); + $modleArr = $this->getActiveModules(); $flag = false; foreach ($modleArr as $module) { @@ -230,21 +245,17 @@ class Legacy_SearchUtils { - function getUserGroups(&$user) + function getUserGroups() { + $root =& XCube_Root::getSingleton(); + $user =& $root->mController->mXoopsUser; $groups = array(); - - if ($user->isService() || $user->isGuest()) { + if (!is_object($user)) { $groups = XOOPS_GROUP_ANONYMOUS; } else { - $userHandler =& xoops_gethandler('user'); - $currentUser =& $userHandler->get($user->_mId); //< FIXME - - $groups = is_object($currentUser) ? $currentUser->getGroups() : XOOPS_GROUP_ANONYMOUS; - - return $groups; + $groups = $user->getGroups(); } return $groups;