Minahito
minah****@users*****
2006年 7月 19日 (水) 19:23:22 JST
Index: xoops2jp/html/modules/user/preload/Primary/Primary.class.php diff -u xoops2jp/html/modules/user/preload/Primary/Primary.class.php:1.1.2.3 xoops2jp/html/modules/user/preload/Primary/Primary.class.php:1.1.2.4 --- xoops2jp/html/modules/user/preload/Primary/Primary.class.php:1.1.2.3 Tue Jun 27 18:16:50 2006 +++ xoops2jp/html/modules/user/preload/Primary/Primary.class.php Wed Jul 19 19:23:22 2006 @@ -1,4 +1,8 @@ <?php +/** + * @package user + * @version $Id + */ if (!defined('XOOPS_ROOT_PATH')) die(); @@ -6,12 +10,49 @@ { function preFilter() { - require_once XOOPS_ROOT_PATH . "/modules/user/kernel/UserEventProxyRegister.class.php"; - $root =& XCube_Root::getSingleton(); - $root->mDelegateManager->add("Site.Login", array ("UserCommonEventFunction", "NewLogin")); + $root->mDelegateManager->add("Site.Login", "User_Login::login"); + + $file = XOOPS_ROOT_PATH . "/modules/user/kernel/LegacypageFunctions.class.php"; + + $root->mDelegateManager->add("Legacypage.Userinfo.Access", "User_LegacypageFunctions::userinfo", $file); + $root->mDelegateManager->add("Legacypage.Edituser.Access", "User_LegacypageFunctions::edituser", $file); + $root->mDelegateManager->add("Legacypage.Register.Access", "User_LegacypageFunctions::register", $file); + $root->mDelegateManager->add("Legacypage.User.Access", "User_LegacypageFunctions::user", $file); + $root->mDelegateManager->add("Legacypage.Lostpass.Access", "User_LegacypageFunctions::lostpass", $file); + $root->mDelegateManager->add("Site.CheckLogin", "User_LegacypageFunctions::checkLogin", $file); + $root->mDelegateManager->add("Site.Logout", "User_LegacypageFunctions::logout", $file); + } +} - $this->mController->mRoot->mEventManager->addProxyRegister(new UserEventProxyRegister()); +/** + * This static class has a static member function for login process. Because + * this process is always called, this class is always loaded. We may move this + * class to other file. This file is a preload and no good for normal class + * definition. + * + * @todo We may move this class to other file. + */ +class User_Login +{ + function login(&$xoopsUser) + { + if (is_object($xoopsUser)) { + return; + } + + if (!empty($_SESSION['xoopsUserId'])) { + $memberHandler=xoops_gethandler('member'); + $user =& $memberHandler->getUser($_SESSION['xoopsUserId']); + $xoopsUser = $user; + if(!is_object($xoopsUser)) { + $xoopsUser = null; + $_SESSION = array(); + } + else { + $xoopsUser->setGroups($_SESSION['xoopsUserGroups']); + } + } } }