Minahito
minah****@users*****
2006年 2月 2日 (木) 18:22:45 JST
Index: xoops2jp/html/modules/user/kernel/UserEventFunction.class.php diff -u xoops2jp/html/modules/user/kernel/UserEventFunction.class.php:1.1.2.6 xoops2jp/html/modules/user/kernel/UserEventFunction.class.php:1.1.2.7 --- xoops2jp/html/modules/user/kernel/UserEventFunction.class.php:1.1.2.6 Tue Jan 17 19:38:18 2006 +++ xoops2jp/html/modules/user/kernel/UserEventFunction.class.php Thu Feb 2 18:22:45 2006 @@ -18,7 +18,7 @@ else { $xoopsUser=&$controller->getXoopsUser(); if(is_object($xoopsUser)) - $url=XOOPS_MODULE_URL."/user/index.php?action=UserInfo&uid=".$xoopsUser->getVar('uid'); + $url=XOOPS_MODULE_URL."/user/index.php?action=UserInfo&uid=".$xoopsUser->get('uid'); } $controller->executeForward($url); @@ -56,7 +56,7 @@ switch($op) { case "main": - $url=is_object($xoopsUser) ? XOOPS_MODULE_URL."/user/index.php?action=UserInfo&uid=".$xoopsUser->getVar('uid') + $url=is_object($xoopsUser) ? XOOPS_MODULE_URL."/user/index.php?action=UserInfo&uid=".$xoopsUser->get('uid') : XOOPS_MODULE_URL."/user/index.php"; $controller->executeForward($url); break; @@ -79,8 +79,13 @@ */ function AccessToRegister(&$controller,&$eventArgs) { - // TODO user check? - $controller->executeForward(XOOPS_MODULE_URL."/user/register.php"); + $xoopsUser =& $controller->getXoopsUser(); + if (is_object($xoopsUser)) { + $controller->executeForward(XOOPS_URL); + } + else { + $controller->executeForward(XOOPS_MODULE_URL . "/user/index.php?action=RegisterUser"); + } } function CheckLogin(&$controller,&$eventArgs) @@ -99,7 +104,7 @@ return; } - if($user->getVar('level')==0) { + if($user->get('level')==0) { $eventArgs->setRedirectUrl(XOOPS_URL); $eventArgs->setRedirectMessage(_US_NOACTTPADM); return; @@ -107,7 +112,7 @@ // Regist to session $_SESSION = array(); - $_SESSION['xoopsUserId'] = $user->getVar('uid'); + $_SESSION['xoopsUserId'] = $user->get('uid'); $_SESSION['xoopsUserGroups'] = $user->getGroups(); if (!empty($_POST['xoops_redirect']) && !strpos($_POST['xoops_redirect'], 'register')) { @@ -147,7 +152,7 @@ // clear entry from online users table if (is_object($xoopsUser)) { $onlineHandler =& xoops_gethandler('online'); - $onlineHandler->destroy($xoopsUser->getVar('uid')); + $onlineHandler->destroy($xoopsUser->get('uid')); } $eventArgs['successFlag']=true; @@ -164,6 +169,22 @@ $userHandler->insert($eventArgs['xoopsUser']); } } + + /** + * If the current user is registered user, kick out to the top page. + * Else, forward to the lost-pass page. + */ + function AccessToLostpass(&$controller, &$eventArgs) + { + $xoopsUser =& $controller->getXoopsUser(); + if (is_object($xoopsUser)) { + $controller->executeForward(XOOPS_URL); + } + else { + $controller->executeForward(XOOPS_MODULE_URL . "/user/index.php?action=LostPass"); + } + } + }