Minahito
minah****@users*****
2006年 9月 7日 (木) 16:21:13 JST
Index: xoops2jp/html/modules/base/preload/ThemeSelect.class.php diff -u xoops2jp/html/modules/base/preload/ThemeSelect.class.php:1.1.2.7 xoops2jp/html/modules/base/preload/ThemeSelect.class.php:1.1.2.8 --- xoops2jp/html/modules/base/preload/ThemeSelect.class.php:1.1.2.7 Mon Aug 7 20:30:59 2006 +++ xoops2jp/html/modules/base/preload/ThemeSelect.class.php Thu Sep 7 16:21:13 2006 @@ -1,7 +1,7 @@ <?php /** * @package Legacy - * @version $Id: ThemeSelect.class.php,v 1.1.2.7 2006/08/07 11:30:59 minahito Exp $ + * @version $Id: ThemeSelect.class.php,v 1.1.2.8 2006/09/07 07:21:13 minahito Exp $ */ if (!defined('XOOPS_ROOT_PATH')) exit(); @@ -27,18 +27,29 @@ parent::XCube_ActionFilter($controller); $this->mIsSelectableTheme =& new XCube_Delegate(); $this->mIsSelectableTheme->register('Base_ThemeSelect.IsSelectableTheme'); + + $controller->mSiteLogin->add(array(&$this, 'doChangeTheme')); } function preBlockFilter() { + $this->mController->mRoot->mDelegateManager->add("Site.CheckLogin.Success", "Base_ThemeSelect::callbackCheckLoginSuccess"); + } + + /** + * Because this process needs sessions, this functions is added to + * SiteLogin event. + * + * @param XoopsUser $xoopsUser Must parameter, because this is added to login event. + */ + function doChangeTheme(&$xoopsUser) + { if (!empty($_POST['xoops_theme_select']) && $this->_isSelectableTheme($_POST['xoops_theme_select'])) { $this->mController->setMainTheme($_POST['xoops_theme_select']); $_SESSION['xoopsUserTheme'] = $_POST['xoops_theme_select']; - } elseif (!empty($_SESSION['xoopsUserTheme']) && $this->_isSelectableTheme($_POST['xoops_theme_select'])) { + } elseif (!empty($_SESSION['xoopsUserTheme']) && $this->_isSelectableTheme($_SESSION['xoopsUserTheme'])) { $this->mController->setMainTheme($_SESSION['xoopsUserTheme']); } - - $this->mController->mRoot->mDelegateManager->add("Site.CheckLogin.Success", "Base_ThemeSelect::callbackCheckLoginSuccess"); } function callbackCheckLoginSuccess(&$xoopsUser)