From: <ok...@us...> - 2003-01-06 08:49:24
|
Update of /cvsroot/xoops/xoops2/kernel/member/object In directory sc8-pr-cvs1:/tmp/cvs-serv32443/kernel/member/object Modified Files: user.php Log Message: code optimization Index: user.php =================================================================== RCS file: /cvsroot/xoops/xoops2/kernel/member/object/user.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** user.php 5 Jan 2003 20:45:47 -0000 1.4 --- user.php 6 Jan 2003 08:49:18 -0000 1.5 *************** *** 35,39 **** { ! var $groups = array(); function XoopsUser($id = null) --- 35,42 ---- { ! var $_groups = array(); ! var $_isAdmin = null; ! var $_rank = null; ! var $_isOnline = null; function XoopsUser($id = null) *************** *** 105,130 **** { if (is_array($groupsArr)) { ! $this->groups =& $groupsArr; } } function &getGroups() { ! if (empty($this->groups)) { $member_handler =& xoops_gethandler('member'); ! $this->groups =& $member_handler->getGroupsByUser($this->getVar('uid')); } ! return $this->groups; } function isAdmin($module_id = 0) { ! $moduleperm_handler =& xoops_gethandler('permission', 'moduleperm'); ! if (!$moduleperm_handler->checkRight($module_id, $this->getGroups(), 'A')) { ! return false; } ! return true; } function rank() { ! return xoops_getrank($this->getVar('rank'), $this->getVar('posts')); } function isActive() --- 108,136 ---- { if (is_array($groupsArr)) { ! $this->_groups =& $groupsArr; } } function &getGroups() { ! if (empty($this->_groups)) { $member_handler =& xoops_gethandler('member'); ! $this->_groups =& $member_handler->getGroupsByUser($this->getVar('uid')); } ! return $this->_groups; } function isAdmin($module_id = 0) { ! if (!isset($this->_isAdmin)) { ! $moduleperm_handler =& xoops_gethandler('permission', 'moduleperm'); ! $this->_isAdmin = (!$moduleperm_handler->checkRight($module_id, $this->getGroups(), 'A')) ? false : true; } ! return $this->_isAdmin; } function rank() { ! if (!isset($this->_rank)) { ! $this->_rank = xoops_getrank($this->getVar('rank'), $this->getVar('posts')); ! } ! return $this->_rank; } function isActive() *************** *** 137,146 **** function isOnline() { ! $onlinehandler =& xoops_gethandler('online'); ! if ($onlinehandler->getCount(new Criteria('online_uid', $this->getVar('uid'))) > 0) { ! return true; ! } else { ! return false; } } function uid() --- 143,151 ---- function isOnline() { ! if (!isset($this->_isOnline)) { ! $onlinehandler =& xoops_gethandler('online'); ! $this->_isOnline = ($onlinehandler->getCount(new Criteria('online_uid', $this->getVar('uid'))) > 0) ? true : false; } + return $this->_isOnline; } function uid() |