[xoops-cvslog 3540] CVS update: xoops2jp/html/modules/base/preload

Zurück zum Archiv-Index

Minahito minah****@users*****
2006年 7月 11日 (火) 14:08:32 JST


Index: xoops2jp/html/modules/base/preload/ThemeSelect.class.php
diff -u xoops2jp/html/modules/base/preload/ThemeSelect.class.php:1.1.2.2 xoops2jp/html/modules/base/preload/ThemeSelect.class.php:1.1.2.3
--- xoops2jp/html/modules/base/preload/ThemeSelect.class.php:1.1.2.2	Fri Jun 23 10:29:54 2006
+++ xoops2jp/html/modules/base/preload/ThemeSelect.class.php	Tue Jul 11 14:08:32 2006
@@ -1,5 +1,5 @@
 <?php
-// $Id: ThemeSelect.class.php,v 1.1.2.2 2006/06/23 01:29:54 minahito Exp $
+// $Id: ThemeSelect.class.php,v 1.1.2.3 2006/07/11 05:08:32 minahito Exp $
 //  ------------------------------------------------------------------------ //
 //                XOOPS - PHP Content Management System                      //
 //                    Copyright (c) 2000 XOOPS.org                           //
@@ -27,18 +27,36 @@
 
 if (!defined('XOOPS_ROOT_PATH')) exit();
 
+/**
+ * Theme select mechanism is that base knows the method to change themes
+ * without RenderSystem. So this class uses delegate to check whether the
+ * specified theme is selectable. Functions should be added to this delegate in
+ * constructor, because the delegate is called in preBlockFilter().
+ */
 class Base_ThemeSelect extends XCube_ActionFilter
 {
+	/**
+	 * @var XCube_NewDelegate
+	 */
+	var $mIsSelectableTheme = null;
+	
+	function Base_ThemeSelect(&$controller)
+	{
+		parent::XCube_ActionFilter($controller);
+		$this->mIsSelectableTheme =& new XCube_NewDelegate();
+		$this->mIsSelectableTheme->register('Base_ThemeSelect.IsSelectableTheme');
+	}
+	
 	function preBlockFilter()
 	{
-		if (!empty($_POST['xoops_theme_select']) && in_array($_POST['xoops_theme_select'], $this->mController->mConfig['theme_set_allowed'])) {
+		if (!empty($_POST['xoops_theme_select']) && $this->_isSelectableTheme($_POST['xoops_theme_select'])) {
 			$this->mController->mConfig['theme_set'] = $_POST['xoops_theme_select'];
 			$_SESSION['xoopsUserTheme'] = $_POST['xoops_theme_select'];
-		} elseif (!empty($_SESSION['xoopsUserTheme']) && in_array($_SESSION['xoopsUserTheme'], $this->mController->mConfig['theme_set_allowed'])) {
+		} elseif (!empty($_SESSION['xoopsUserTheme']) && $this->_isSelectableTheme($_POST['xoops_theme_select'])) {
 			$this->mController->mConfig['theme_set'] = $_SESSION['xoopsUserTheme'];
 		}
-
-		$delegate=new XCube_Delegate("Base_ThemeSelect","callbackCheckLoginSuccess");
+		
+		$delegate = new XCube_Delegate("Base_ThemeSelect","callbackCheckLoginSuccess");
 		$this->mController->mRoot->mEventManager->add("Site.CheckLogin.Success",$delegate);
 	}
 
@@ -60,6 +78,14 @@
 			$_SESSION['xoopsUserTheme'] = $userTheme;
 		}
 	}
+	
+	function _isSelectableTheme($theme_name)
+	{
+		$flag = false;
+		$this->mIsSelectableTheme->call(new XCube_Ref($flag), $theme_name);
+		
+		return $flag;
+	}
 }
 
 ?>
\ No newline at end of file


xoops-cvslog メーリングリストの案内
Zurück zum Archiv-Index