21 public $mStatusFlag = LEGACY_CONTROLLER_STATE_ADMIN;
27 public $mSetupBlock =
null;
37 public function __construct(&$controller)
41 parent::__construct($controller);
46 if (!defined(
'LEGACY_DEPENDENCE_RENDERER')) {
47 define(
'LEGACY_DEPENDENCE_RENDERER',
'Legacy_AdminRenderSystem');
50 $controller->mRoot->mContext->mBaseRenderSystemName =
'Legacy_AdminRenderSystem';
55 if (isset($_REQUEST[
'fct']) &&
'users' == $_REQUEST[
'fct']) {
56 $GLOBALS[
'xoopsOption'][
'pagetype'] =
'user';
60 $this->mSetupBlock->register(
'Legacy_AdminControllerStrategy.SetupBlock');
63 public function _setupFilterChain()
65 parent::_setupFilterChain();
70 if (1 == $this->mController->mRoot->getSiteConfig(
'Legacy',
'AutoPreload')) {
71 $this->mController->_processPreload(XOOPS_ROOT_PATH .
'/preload/admin');
77 if (
null == $dirname) {
81 parent::setupModuleContext($context, $dirname);
90 require_once XOOPS_LEGACY_PATH .
'/admin/blocks/AdminActionSearch.class.php';
91 require_once XOOPS_LEGACY_PATH .
'/admin/blocks/AdminSideMenu.class.php';
95 $this->mSetupBlock->call(
new XCube_Ref($this->mController));
98 public function _processPreBlockFilter()
100 parent::_processPreBlockFilter();
101 $this->mController->_processModulePreload(
'/admin/preload');
107 if (is_object($ret_module)) {
111 if (
null != $this->mController->mRoot->mContext->mModule) {
112 $module =& $this->mController->mRoot->mContext->mXoopsModule;
114 if (
'legacy' == $module->get(
'dirname') && isset($_REQUEST[
'dirname'])) {
115 if (in_array(xoops_getrequest(
'action'), $this->_mSpecialActions)) {
116 $handler =& xoops_gethandler(
'module');
117 $t_xoopsModule =& $handler->getByDirname(xoops_getrequest(
'dirname'));
118 $ret_module =& Legacy_Utils::createModule($t_xoopsModule);
120 } elseif (
'legacy' == $module->get(
'dirname') &&
'PreferenceEdit' == xoops_getrequest(
'action') && isset($_REQUEST[
'confmod_id'])) {
121 $handler =& xoops_gethandler(
'module');
122 $t_xoopsModule =& $handler->get((
int)xoops_getrequest(
'confmod_id'));
123 $ret_module =& Legacy_Utils::createModule($t_xoopsModule);
126 if (!is_object($ret_module)) {
127 $ret_module =& Legacy_Utils::createModule($module);
134 public function &getMainThemeObject()
136 $handler =& xoops_getmodulehandler(
'theme',
'legacy');
137 $theme =& $handler->create();
142 $theme->set(
'dirname', $this->mController->mRoot->mSiteConfig[
'Legacy'][
'Theme']);
143 $theme->set(
'render_system',
'Legacy_AdminRenderSystem');
155 $principal =& $this->mController->mRoot->mContext->mUser;
157 if (!$principal->mIdentity->isAuthenticated()) {
161 if (
null != $this->mController->mRoot->mContext->mModule) {
162 $dirname = $this->mController->mRoot->mContext->mXoopsModule->get(
'dirname');
164 if (
'legacy' == $dirname) {
165 return $principal->isInRole(
'Site.Administrator');
166 } elseif (defined(
'_LEGACY_ALLOW_ACCESS_FROM_ANY_ADMINS_')) {
167 return $this->mController->mRoot->mContext->mXoopsUser->isAdmin(0);
170 return $principal->isInRole(
"Module.{$dirname}.Admin");
172 return $principal->isInRole(
'Site.Administrator');
179 public function setupModuleLanguage()
181 $root =& XCube_Root::getSingleton();
183 $root->mContext->mXoopsModule->loadInfo($root->mContext->mXoopsModule->get(
'dirname'));
185 if (isset($root->mContext->mXoopsModule->modinfo[
'cube_style']) &&
false != $root->mContext->mXoopsModule->modinfo[
'cube_style']) {
186 $root->mLanguageManager->loadModuleMessageCatalog($root->mContext->mXoopsModule->get(
'dirname'));
188 $root->mLanguageManager->loadModuleAdminMessageCatalog($root->mContext->mXoopsModule->get(
'dirname'));
189 $root->mLanguageManager->loadModinfoMessageCatalog($root->mContext->mXoopsModule->get(
'dirname'));