[xoops-cvslog 4779] CVS update: xoops2jp/html/modules/base/kernel

Zurück zum Archiv-Index

Minahito minah****@users*****
2006年 10月 5日 (木) 18:08:39 JST


Index: xoops2jp/html/modules/base/kernel/Legacy_Controller.class.php
diff -u xoops2jp/html/modules/base/kernel/Legacy_Controller.class.php:1.1.2.79.2.3 xoops2jp/html/modules/base/kernel/Legacy_Controller.class.php:1.1.2.79.2.4
--- xoops2jp/html/modules/base/kernel/Legacy_Controller.class.php:1.1.2.79.2.3	Fri Sep 29 17:14:20 2006
+++ xoops2jp/html/modules/base/kernel/Legacy_Controller.class.php	Thu Oct  5 18:08:39 2006
@@ -1,7 +1,7 @@
 <?php
 /**
  * @package Legacy
- * @version $Id: Legacy_Controller.class.php,v 1.1.2.79.2.3 2006/09/29 08:14:20 minahito Exp $
+ * @version $Id: Legacy_Controller.class.php,v 1.1.2.79.2.4 2006/10/05 09:08:39 minahito Exp $
  */
 
 if (!defined('XOOPS_ROOT_PATH')) exit();
@@ -9,10 +9,15 @@
 define("LEGACY_CONTROLLER_STATE_PUBLIC", 1);
 define("LEGACY_CONTROLLER_STATE_ADMIN", 2);
 
+define("LEGACY_XOOPS_MODULE_MANIFESTO_FILENAME", "xoops_version.php");
+
 require_once XOOPS_ROOT_PATH . "/modules/base/kernel/Legacy_BlockProcedure.class.php";
 require_once XOOPS_ROOT_PATH . "/modules/base/class/Legacy_Utils.class.php";
 require_once XOOPS_ROOT_PATH . "/modules/base/kernel/Legacy_Identity.class.php";
 
+require_once XOOPS_ROOT_PATH . "/modules/base/kernel/Legacy_CacheInformation.class.php";
+require_once XOOPS_ROOT_PATH . "/modules/base/kernel/Legacy_PublicControllerStrategy.class.php";
+
 /**
  * This class is a virtual controller that has the compatibility with XOOPS 2.0.x.
  * 
@@ -27,20 +32,12 @@
  */
 class Legacy_Controller extends XCube_Controller
 {
-	var $mXoopsUser;
-
 	var $_mAdminModeFlag = false;
 	var $_mStrategy = null;
 	
 	var $mDialogMode = false;
 	
 	/**
-	 * @var Legacy_ModuleController
-	 * @todo Rename this with "mModuleContext"
-	 */
-	var $mModuleController = null;
-	
-	/**
 	 * @var XCube_Delegate
 	 */
 	var $mGetCountUnreadPM = null;
@@ -123,6 +120,11 @@
 		$this->mGetBlockCacheFilePath =& new XCube_Delegate();
 
 		set_magic_quotes_runtime(0);	// ^^;
+	}
+	
+	function prepare(&$root)
+	{
+		parent::prepare($root);
 		
 		//
 		// Decide status. [TEST]
@@ -141,8 +143,14 @@
 		elseif(substr($urlInfo[0], 0, 9) == "admin.php") {
 			$adminStateFlag=true;
 		}
-
-		$this->_mStrategy = $adminStateFlag ?  new Legacy_AdminControllerStrategy($this) : new Legacy_PublicControllerStrategy($this);
+		
+		if ($adminStateFlag) {
+			require_once XOOPS_ROOT_PATH . "/modules/base/kernel/Legacy_AdminControllerStrategy.class.php";
+			$this->_mStrategy =& new Legacy_AdminControllerStrategy($this);
+		}
+		else {
+			$this->_mStrategy =& new Legacy_PublicControllerStrategy($this);
+		}
 	}
 
 	/**
@@ -179,8 +187,8 @@
 
 		$this->_setupUser();
 
-		$this->_setupModuleController();
-
+		$this->setupModuleContext();
+		
 		$this->_processModuleController();
 	}
 	
@@ -273,7 +281,7 @@
 		
 		$cacheInfo =& new Legacy_BlockCacheInformation();
 
-		foreach ($this->mBlockChain as $blockProcedure) {
+		foreach ($this->_mBlockChain as $blockProcedure) {
 			$renderTarget->reset();
 			
 			//
@@ -287,7 +295,7 @@
 				// Reset the block cache information structure, and initialize.
 				//
 				$cacheInfo->reset();
-				$cacheInfo->setBlock($blockProcedure->mAdapteeBlockObject);	//< FIXME
+				$cacheInfo->setBlock($blockProcedure);	//< FIXME
 				$this->mCheckEnableBlockCache->call(new XCube_Ref($cacheInfo));
 
 				$filepath = $this->getBlockCacheFilePath($cacheInfo);
@@ -312,26 +320,24 @@
 			}
 			
 			if (!$usedCacheFlag) {
-				$renderSystem =& $this->mRoot->getRenderSystem($blockProcedure->getRenderSystemName());
-				
-				$blockProcedure->execute($this, $this->getXoopsUser(), $renderTarget);
+				$blockProcedure->execute();
 
-				if (!$blockProcedure->hasResult()) {
+				if (!$blockProcedure->isDisplay()) {
 					continue;
 				}
 				
-				$renderSystem->renderBlock($renderTarget);
+				$renderBuffer =& $blockProcedure->getRenderBuffer();
 				
 				$this->mBlockShowFlags[$blockProcedure->getEntryIndex()] = true;
 				$this->mBlockContents[$blockProcedure->getEntryIndex()][] = array(
 						'name' => $blockProcedure->getName(),
 						'title'=>$blockProcedure->getTitle(),
-						'content'=>$renderTarget->getResult(),
+						'content'=>$renderBuffer->getResult(),
 						'weight'=>$blockProcedure->getWeight()
 				);
 
 				if ($this->isEnableCacheFeature() && $blockProcedure->getCacheTime() > 0 && $cacheInfo->isEnableCache()) {
-					$this->cacheRenderTarget($this->getBlockCacheFilePath($cacheInfo), $renderTarget);
+					$this->cacheRenderTarget($this->getBlockCacheFilePath($cacheInfo), $renderBuffer);
 				}
 			}
 
@@ -349,33 +355,50 @@
 		return explode("/",$subPath);
 	}
 
-	function _setupModuleController()
+	function setupModuleContext($dirname = null)
 	{
-		$this->_mStrategy->setupModuleController();
+		if ($dirname == null) {
+			//
+			// Sets a module object.
+			//
+			$urlInfo = $this->_parseUrl();
+
+			if (count($urlInfo) >= 2) {
+				if (strtolower($urlInfo[0]) == 'modules') {
+					$dirname = $urlInfo[1];
+				}
+			}
+			elseif (substr($urlInfo[0], 0, 9) == 'admin.php') {
+				$dirname = 'base';
+			}
+		}
+		
+		if ($dirname == null) {
+			return;
+		}
+		
+		if (!file_exists(XOOPS_ROOT_PATH . "/modules/" . $dirname . "/" . LEGACY_XOOPS_MODULE_MANIFESTO_FILENAME)) {
+			return;
+		}
+		
+		$this->_mStrategy->setupModuleContext($this->mRoot->mContext, $dirname);
 	}
 	
-	function &getModuleController()
-	{
-		return $this->mModuleController;
-	}
-
 	function _processModuleController()
 	{
-		$this->mModuleController->prepare();
-
-		if ($this->mModuleController->isModuleProcess()) {
-			if (!$this->mModuleController->isActive()) {
+		if ($this->mRoot->mContext->mModule != null) {
+			if (!$this->mRoot->mContext->mModule->isActive()) {
 				die('NOT ACTIVE');	///< @todo
 			}
-
-   			if (!$this->mModuleController->hasPermission()) {
+			
+			if (!$this->_mStrategy->enableAccess()) {
 				$this->executeRedirect(XOOPS_URL . '/',1,_NOPERM);	// TODO Depens on const message catalog.
-   			}
-
-			$this->mModuleController->setupLanguage();
+			}
+			
+			$this->mRoot->mContext->mModule->setupLanguage();
 			
-			$GLOBALS['xoopsModule'] =& $this->mModuleController->mModuleObject;			// TODO
-			$GLOBALS['xoopsModuleConfig'] = $this->mModuleController->getConfig();
+			$GLOBALS['xoopsModule'] =& $this->mRoot->mContext->mXoopsModule;
+			$GLOBALS['xoopsModuleConfig'] =& $this->mRoot->mContext->mModuleConfig;
 		}
 	}
 
@@ -415,21 +438,10 @@
 		/****************************************************/
 		/* Principal                                        */
 		/****************************************************/
-				
-		if (is_object($this->mXoopsUser)) {
-/*			$this->mUser->_mId = $this->mXoopsUser->get('uid');	//< FIXME
-			$this->mUser->setGuest(false);
-			$this->mUser->setService(false);*/
-		}
-/*		else {
-			$this->mUser->_mId = 0;	//< FIXME
-			$this->mUser->setGuest(true);
-			$this->mUser->setService(false);
-		}*/
 		
 		// Set instance to global variable for compatiblity with XOOPS 2.0.x
-		$GLOBALS['xoopsUser'] =& $this->mXoopsUser;
-		$GLOBALS['xoopsUserIsAdmin'] = is_object($this->mXoopsUser) ? $this->mXoopsUser->isAdmin(1) : false;	//@todo Remove '1'
+		$GLOBALS['xoopsUser'] =& $this->mRoot->mContext->mXoopsUser;
+		$GLOBALS['xoopsUserIsAdmin'] = is_object($this->mRoot->mContext->mXoopsUser) ? $this->mRoot->mContext->mXoopsUser->isAdmin(1) : false;	//@todo Remove '1'
 
 		//
 		// Set member handler to global variables for compatibility with XOOPS 2.0.x.
@@ -671,31 +683,33 @@
 		//
 		// cache check
 		//
-		$cacheInfo =& $this->mModuleController->createCacheInfo();
-		
-		$this->mCheckEnableModuleCache->call(new XCube_Ref($cacheInfo));
-		
-		if ($this->isEnableCacheFeature() && $this->mModuleController->hasCacheConfig()) {
-			//
-			// Checks whether the cache file exists.
-			//
-			$xoopsModule =& $this->mModuleController->getXoopsModule();
-
-			$cachetime = $this->mConfig['module_cache'][$xoopsModule->get('mid')];
-			$filepath = $this->getModuleCacheFilePath($cacheInfo);
+		if ($this->mRoot->mContext->mModule != null && $this->isEnableCacheFeature()) {
+			$cacheInfo =& $this->mRoot->mContext->mModule->createCacheInfo();
 			
-			//
-			// Checks whether the active cache file exists. If it's OK, load
-			// cache and do display.
-			//			
-			if ($cacheInfo->isEnableCache() && $this->existActiveCacheFile($filepath, $cachetime)) {
-				$renderSystem =& $this->mRoot->getRenderSystem($this->mModuleController->getDependRenderSystem());
-				$renderTarget =& $renderSystem->createRenderTarget(XCUBE_RENDER_TARGET_TYPE_MAIN);
-				$renderTarget->setResult($this->loadCache($filepath));
-				
-				$this->_executeViewTheme($renderTarget);
+			$this->mCheckEnableModuleCache->call(new XCube_Ref($cacheInfo));
+			
+			if ($this->mRoot->mContext->mModule->hasCacheConfig()) {
+				//
+				// Checks whether the cache file exists.
+				//
+				$xoopsModule =& $this->mRoot->mContext->mXoopsModule;
+	
+				$cachetime = $this->mConfig['module_cache'][$xoopsModule->get('mid')];
+				$filepath = $this->getModuleCacheFilePath($cacheInfo);
 				
-				exit(0);
+				//
+				// Checks whether the active cache file exists. If it's OK, load
+				// cache and do display.
+				//			
+				if ($cacheInfo->isEnableCache() && $this->existActiveCacheFile($filepath, $cachetime)) {
+					$renderSystem =& $this->mRoot->getRenderSystem($this->mModule->getRenderSystemName());
+					$renderTarget =& $renderSystem->createRenderTarget(XCUBE_RENDER_TARGET_TYPE_MAIN);
+					$renderTarget->setResult($this->loadCache($filepath));
+					
+					$this->_executeViewTheme($renderTarget);
+					
+					exit(0);
+				}
 			}
 		}
 
@@ -713,44 +727,43 @@
 	
 	function executeView()
 	{
-		$renderSystem =& $this->mRoot->getRenderSystem($this->mModuleController->getDependRenderSystem());
-		$renderTarget =& $this->mModuleController->getRenderTarget();
+		if ($this->mRoot->mContext->mModule != null) {
+			$renderSystem =& $this->mRoot->getRenderSystem($this->mRoot->mContext->mModule->getRenderSystemName());
+			$renderTarget =& $this->mRoot->mContext->mModule->getRenderBuffer();
 		
-		//
-		//  Buffering handling of standard output for main render target is responsibility
-		// of a controller. Of course all controllers do not have to implement this.
-		// The following lines are movement for compatibility and the feature of
-		// this controller.
-		//
+			//
+			//  Buffering handling of standard output for main render target is responsibility
+			// of a controller. Of course all controllers do not have to implement this.
+			// The following lines are movement for compatibility and the feature of
+			// this controller.
+			//
 		
-
-		// require_once XOOPS_ROOT_PATH . '/include/notification_select.php';
-
-		// Wmm...
-		if (is_object($renderTarget)) {
-			if ($renderTarget->getTemplateName() == null) {
-				if (isset($GLOBALS['xoopsOption']['template_main'])) {
-					$renderTarget->setTemplateName($GLOBALS['xoopsOption']['template_main']);
+			// Wmm...
+			if (is_object($renderTarget)) {
+				if ($renderTarget->getTemplateName() == null) {
+					if (isset($GLOBALS['xoopsOption']['template_main'])) {
+						$renderTarget->setTemplateName($GLOBALS['xoopsOption']['template_main']);
+					}
 				}
+				
+				$renderTarget->setAttribute("stdout_buffer", ob_get_contents());
 			}
+	
+			ob_end_clean();
 			
-			$renderTarget->setAttribute("stdout_buffer", ob_get_contents());
-		}
-
-		ob_end_clean();
-		
-		if (is_object($renderTarget)) {
-			$renderSystem->renderWithTarget($renderTarget);
-
-			//
-			// Cache Control
-			//
-			if ($this->isEnableCacheFeature() && $this->mModuleController->hasCacheConfig()) {
-				if ($this->mModuleController->mCacheInfo->isEnableCache()) {
-					$this->cacheRenderTarget($this->getModuleCacheFilePath($this->mModuleController->mCacheInfo), $renderTarget);
+			if (is_object($renderTarget)) {
+				$renderSystem->renderWithTarget($renderTarget);
+	
+				//
+				// Cache Control
+				//
+				if ($this->isEnableCacheFeature() && $this->mRoot->mContext->mModule->hasCacheConfig()) {
+					if ($this->mRoot->mContext->mModule->mCacheInfo->isEnableCache()) {
+						$this->cacheRenderTarget($this->getModuleCacheFilePath($this->mRoot->mContext->mModule->mCacheInfo), $renderTarget);
+					}
+				}
+				else {
 				}
-			}
-			else {
 			}
 		}
 		
@@ -763,20 +776,18 @@
 	function _executeViewTheme(&$resultRenderTarget)
 	{
 		//
-		// Theme Control
+		// Get the render-system through theme object.
 		//
-		$screenTarget = $this->mDialogMode ? new Legacy_DialogRenderTarget() : new Legacy_ThemeRenderTarget();
+		$theme =& $this->_mStrategy->getMainThemeObject();
+		
+		$renderSystem =& $this->mRoot->getRenderSystem($theme->get('render_system'));
+		$screenTarget = $renderSystem->getThemeRenderTarget($this->mDialogMode);
 		
 		if (is_object($resultRenderTarget)) {
 			$screenTarget->setAttribute('xoops_contents', $resultRenderTarget->getResult());
 		}
 
-		//
-		// Get the render-system through theme object.
-		//
-		$theme =& $this->_mStrategy->getMainThemeObject();
 
-		$renderSystem =& $this->mRoot->getRenderSystem($theme->get('render_system'));
 		$screenTarget->setTemplateName($theme->get('dirname'));
 
 		//
@@ -788,16 +799,16 @@
 		// Debug Process
 		//
 		$isAdmin=false;
-		if(is_object($this->mXoopsUser)) {
-			if($this->mModuleController->isModuleProcess() && $this->mModuleController->isActive()) {
+		if(is_object($this->mRoot->mContext->mXoopsUser)) {
+			if($this->mRoot->mContext->mModule != null && $this->mRoot->mContext->mModule->isActive()) {
 				// @todo I depend on Legacy Module Controller.
-				$mid=$this->mModuleController->mModuleObject->getVar('mid');
+				$mid = $this->mRoot->mContext->mXoopsModule->getVar('mid');
 			}
 			else {
-				$mid=1;	///< @todo Do not use literal directly!
+				$mid = 1;	///< @todo Do not use literal directly!
 			}
 
-			$isAdmin = $this->mXoopsUser->isAdmin($mid);
+			$isAdmin = $this->mRoot->mContext->mXoopsUser->isAdmin($mid);
 		}
 
 		if ($isAdmin) {
@@ -809,7 +820,7 @@
 	{
 		$delegateManager =& parent::_createDelegateManager();
 		
-		$file = XOOPS_ROOT_PATH . "/modules/base/kernel/Legacy_EventFunctions.class.php";
+		$file = XOOPS_ROOT_PATH . "/modules/base/include/Legacy_EventFunctions.class.php";
 		
 		$delegateManager->add('Legacypage.Notifications.Access', 'Legacy_EventFunction::notifications', $file);
 		$delegateManager->add('Legacyfunction.Notifications.Select', 'Legacy_EventFunction::notifications_select', $file);
@@ -843,18 +854,18 @@
 	 */
 	function checkLogin()
 	{
-		if (!is_object($this->mXoopsUser)) {
-			$this->mCheckLogin->call(new XCube_Ref($this->mXoopsUser));
+		if (!is_object($this->mRoot->mContext->mXoopsUser)) {
+			$this->mCheckLogin->call(new XCube_Ref($this->mRoot->mContext->mXoopsUser));
 			
 			$this->mRoot->mLanguageManager->loadModuleMessageCatalog('base');
 
-			if(is_object($this->mXoopsUser)) {
+			if(is_object($this->mRoot->mContext->mXoopsUser)) {
 				// RMV-NOTIFY
 				// Perform some maintenance of notification records
 				$notification_handler =& xoops_gethandler('notification');
-				$notification_handler->doLoginMaintenance($this->mXoopsUser->get('uid'));
+				$notification_handler->doLoginMaintenance($this->mRoot->mContext->mXoopsUser->get('uid'));
 
-				XCube_DelegateUtils::call("Site.CheckLogin.Success", new XCube_Ref($this->mXoopsUser));
+				XCube_DelegateUtils::call("Site.CheckLogin.Success", new XCube_Ref($this->mRoot->mContext->mXoopsUser));
 
 				//
 				// Fall back process for login success.
@@ -871,10 +882,10 @@
 					}
 				}
 				
-				$this->executeRedirect($url, 1, XCube_Utils::formatMessage(_MD_BASE_MESSAGE_LOGIN_SUCCESS, $this->mXoopsUser->get('uname')));
+				$this->executeRedirect($url, 1, XCube_Utils::formatMessage(_MD_BASE_MESSAGE_LOGIN_SUCCESS, $this->mRoot->mContext->mXoopsUser->get('uname')));
 			}
 			else {
-				XCube_DelegateUtils::call("Site.CheckLogin.Fail", new XCube_Ref($this->mXoopsUser));
+				XCube_DelegateUtils::call("Site.CheckLogin.Fail", new XCube_Ref($this->mRoot->mContext->mXoopsUser));
 				
 				//
 				// Fall back process for login fail.
@@ -895,7 +906,7 @@
 	function logout()
 	{
 		$successFlag = false;
-		$xoopsUser =& $this->getXoopsUser();
+		$xoopsUser =& $this->mRoot->mContext->mXoopsUser;
 		
 		
 		if (is_object($xoopsUser)) {
@@ -941,16 +952,11 @@
 			// The following line depends on XCube_Controller process of executeCommon.
 			// But, There is no other method.
 			//
-			$this->_setupModuleController();
+			$this->setupModuleContext();
 			$this->_processModuleController();
 		}
 	}
 
-	function &getXoopsUser()
-	{
-		return $this->mXoopsUser;
-	}
-
 	/**
 	 * Set bool flag to dialog mode flag.
 	 * If you set true, executeView() will use Legacy_DialogRenderTarget class as
@@ -1197,6 +1203,17 @@
 		
 		return null;
 	}
+	
+	function &_createContext()
+	{
+		require_once XOOPS_ROOT_PATH . "/modules/base/kernel/Legacy_HttpContext.class.php";
+		
+		$context =& new Legacy_HttpContext();
+		$request =& new XCube_HttpRequest();
+		$context->setRequest($request);
+		
+		return $context;
+	}
 }
 
 /**
@@ -1238,12 +1255,18 @@
 	}
 
 	/**
-	 * Create a instance of ModuleController, and set it to mModuleController
-	 * property of $controller.
-	 * 
-	 * @param $controller Legacy_Controller
-	 */
-	function setupModuleController()
+	 * Create some instances for the module process.
+	 * @param Legacy_HttpContext $context
+	 */	
+	function setupModuleContext(&$context)
+	{
+	}
+
+	/**
+	 * Gets the module object.
+	 * @return Legacy_Module
+	 */	
+	function &_createModule()
 	{
 	}
 
@@ -1276,189 +1299,13 @@
 	function isEnableCacheFeature()
 	{
 	}
-}
-
-class Legacy_PublicControllerStrategy extends Legacy_AbstractControllerStrategy
-{
-	var $mStatusFlag = LEGACY_CONTROLLER_STATE_PUBLIC;
-	
-	function Legacy_PublicControllerStrategy(&$controller)
-	{
-		parent::Legacy_AbstractControllerStrategy($controller);
-		
-		if (!defined("LEGACY_DEPENDENCE_RENDERER")) {
-			define("LEGACY_DEPENDENCE_RENDERER", "Legacy_RenderSystem");
-		}
-	}
-
-	function setupModuleController()
-	{
-		require_once XOOPS_BASE_PATH . "/kernel/Legacy_ModuleController.class.php";
-		$this->mController->mModuleController =& new Legacy_ModuleController($this->mController);
-	}
-
-	function setupBlock()
-	{
-		$showFlag =0;
-		$mid=0;
-
-		if($this->mController->mModuleController->isModuleProcess()) {
-			$showFlag = (preg_match("/index\.php$/i", xoops_getenv('PHP_SELF')) && $this->mController->mConfig['startpage'] == $this->mController->mModuleController->mModuleObject->getVar('dirname'));
-			$mid = $this->mController->mModuleController->mModuleObject->getVar('mid');
-		}
-		else {
-			//
-			// If you does not have module_contoller, this request is to toppage or other pages of toppage.
-			//
-			$mid = preg_match("/index\.php$/i", xoops_getenv('PHP_SELF')) ? -1 : 0;
-		}
-
-        $blockHandler =& xoops_gethandler('block');
-		$showCenterFlag = (SHOW_CENTERBLOCK_LEFT | SHOW_CENTERBLOCK_CENTER | SHOW_CENTERBLOCK_RIGHT);
-		$showRightFlag = SHOW_SIDEBLOCK_RIGHT;
-		$showFlag = SHOW_SIDEBLOCK_LEFT | $showRightFlag | $showCenterFlag;
-		$groups = is_object($this->mController->mXoopsUser) ? $this->mController->mXoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
-
-		$blockObjects=&$blockHandler->getBlocks($groups, $mid, $showFlag);
-		foreach($blockObjects as $blockObject) {
-			$this->mController->mBlockChain[] =& new Legacy_AdaptBlockProcedure($blockObject);
-			unset($blockObject);
-		}
-	}
-
-	function &getMainThemeObject()
-	{
-		// [TODO]
-		// Because get() of the virtual handler is heavy, we have to consider
-		// the new solution about this process.
-		//
-		$handler =& xoops_getmodulehandler('theme', 'base');
-		$theme =& $handler->get($this->mController->getTheme());
-		
-		return $theme;
-	}
-	
-	function isEnableCacheFeature()
-	{
-		return true;
-	}
-}
-
-class Legacy_AdminControllerStrategy extends Legacy_AbstractControllerStrategy
-{
-	var $mStatusFlag = LEGACY_CONTROLLER_STATE_ADMIN;
 	
 	/**
-	 * @var XCube_Delegate
-	 * @param XCube_Controller &$controller
-	 */
-	var $mSetupBlock = null;
-	
-	/**
-	 *  If this array includes current action, getVirtualCurrentModule() returns
-	 * the module object that specified by dirname.
-	 * 
-	 * @access private
+	 * Gets a value indicating whether the current user can access to the current module.
+	 * @return bool
 	 */
-	var $_mSpecialActions = array("Help", "CommentList");
-
-	function Legacy_AdminControllerStrategy(&$controller)
-	{
-		global $xoopsOption;
-		
-		parent::Legacy_AbstractControllerStrategy($controller);
-		
-		//
-		// TODO We have to develop complated-switching-controller-mechanizm.
-		//
-		if (!defined("LEGACY_DEPENDENCE_RENDERER")) {
-			define("LEGACY_DEPENDENCE_RENDERER", "Legacy_AdminRenderSystem");
-		}
-
-		//
-		// Cover the spec of admin.php of the system module, for the compatibility.
-		//
-		if (isset($_REQUEST['fct']) && $_REQUEST['fct'] == "users") {
-			$GLOBALS['xoopsOption']['pagetype'] = "user";
-		}		
-		
-		$this->mSetupBlock =& new XCube_Delegate();
-		$this->mSetupBlock->register('Legacy_AdminControllerStrategy.SetupBlock');
-	}
-
-	function _setupFilterChain()
-	{
-		parent::_setupFilterChain();
-
-		//
-		// Auto pre-loading.
-		//
-		if($this->mController->mRoot->getSiteConfig('Legacy', 'AutoPreload') == 1) {
-			$this->mController->_processPreload(XOOPS_ROOT_PATH . "/preload/admin");
-		}
-	}
-	
-	function setupModuleController()
-	{
-		require_once XOOPS_BASE_PATH . "/kernel/Legacy_AdminModuleController.class.php";
-		$this->mController->mModuleController =& new Legacy_AdminModuleController($this->mController);
-	}
-
-	function setupBlock()
-	{
-		require_once XOOPS_BASE_PATH . "/admin/blocks/AdminActionSearch.class.php";
-		require_once XOOPS_BASE_PATH . "/admin/blocks/AdminSideMenu.class.php";
-		$this->mController->mBlockChain[] =& new Legacy_AdminActionSearch();
-		$this->mController->mBlockChain[] =& new Legacy_AdminSideMenu();
-		
-		$this->mSetupBlock->call(new XCube_Ref($this->mController));
-	}
-
-	function _processPreBlockFilter()
+	function enableAccess()
 	{
-		parent::_processPreBlockFilter();
-		$this->mController->_processModulePreload('/admin/preload');
-	}
-
-	function &getVirtualCurrentModule()
-	{
-		$module = null;
-		
-		if ($this->mController->mModuleController->isModuleProcess()) {
-			$module =& $this->mController->mModuleController->getXoopsModule();
-			
-			if ($module->get('dirname') == "base" && isset($_REQUEST['dirname'])) {
-				if (in_array(xoops_getrequest('action'), $this->_mSpecialActions)) {
-					$handler =& xoops_gethandler('module');
-					$module =& $handler->getByDirname(xoops_getrequest('dirname'));
-				}
-			}
-			elseif ($module->get('dirname') == "base" && xoops_getrequest('action') == 'PreferenceEdit' && isset($_REQUEST['confmod_id'])) {
-				$handler =& xoops_gethandler('module');
-				$module =& $handler->get(intval(xoops_getrequest('confmod_id')));
-			}
-		}
-
-		return $module;
-	}
-
-	function &getMainThemeObject()
-	{
-		$handler =& xoops_getmodulehandler('theme', 'base');
-		$theme =& $handler->create();
-		
-		//
-		// TODO Load manifesto here.
-		//
-		$theme->set('dirname', $this->mController->mRoot->mSiteConfig['Legacy']['Theme']);
-		$theme->set('render_system', 'Legacy_AdminRenderSystem');
-		
-		return $theme;
-	}
-	
-	function isEnableCacheFeature()
-	{
-		return false;
 	}
 }
 


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