NobuNobu
nobun****@users*****
2006年 4月 2日 (日) 22:07:48 JST
Index: xoops2jp/html/modules/base/preload/SiteClose/SiteClose.class.php diff -u xoops2jp/html/modules/base/preload/SiteClose/SiteClose.class.php:1.1.2.5 xoops2jp/html/modules/base/preload/SiteClose/SiteClose.class.php:1.1.2.6 --- xoops2jp/html/modules/base/preload/SiteClose/SiteClose.class.php:1.1.2.5 Tue Mar 28 22:30:25 2006 +++ xoops2jp/html/modules/base/preload/SiteClose/SiteClose.class.php Sun Apr 2 22:07:48 2006 @@ -6,7 +6,7 @@ { function preBlockFilter() { - if($this->mController->mConfig['closesite']==1) { + if(($this->mController->mConfig['closesite']==1)||is_array(XCube_Utils::checkSystemModules())) { $this->mController->mRoot->mEventManager->add("Site.Login",new XCube_InstanceDelegate($this,"callbackSiteLogin")); $this->mController->mRoot->mEventManager->add("Site.CheckLogin.Success",new XCube_InstanceDelegate($this,"callbackCheckLoginSuccess")); } @@ -27,6 +27,101 @@ } } } + // @todo Devide following lines to another preload file + if ($accessAllowFlag) { + $retArray = XCube_Utils::checkSystemModules(); + if (is_array($retArray)) { + if (in_array(XOOPS_GROUP_ADMIN, $this->mController->mXoopsUser->getGroups())) { + $GLOBALS['xoopsUser'] = $this->mController->mXoopsUser; + if (!empty($_POST['cube_module_install'])) { //@todo use Ticket + require_once XOOPS_BASE_PATH."/admin/class/ModuleInstaller.class.php"; + if (isset($_POST['uninstalled_modules']) && is_array($_POST['uninstalled_modules']) ){ + foreach($_POST['uninstalled_modules'] as $module) { + $module = basename($module); + if (in_array($module, $retArray['uninstalled'])) { + $installer = new Legacy_ModuleInstaller($module); + $installer->execute(); + } + } + } + if (isset($_POST['disabled_modules']) &&is_array($_POST['disabled_modules'])){ + $moduleHandler =& xoops_gethandler('module'); + foreach($_POST['disabled_modules'] as $module) { + $module = basename($module); + if (in_array($module, $retArray['disabled'])) { + if($moduleObject =& $moduleHandler->getByDirname($module)) { + $moduleObject->setVar('isactive',1); + $moduleHandler->insert($moduleObject); + } + } + } + } + if (isset($_POST['option_modules']) && is_array($_POST['option_modules']) ){ + $handler =& xoops_getmodulehandler('non_installation_module','base'); + $objects = $handler->getObjects(); + $optionModules = array(); + foreach($objects as $module) { + if (!in_array($module->getVar('dirname'), $retArray['uninstalled'])) { + $optionModules[] = $module->getVar('dirname'); + } + } + foreach($_POST['option_modules'] as $module) { + $module = basename($module); + if (in_array($module, $optionModules)) { + $installer = new Legacy_ModuleInstaller($module); + $installer->execute(); + } + } + } + XCube_Utils::redirectHeader(XOOPS_URL,1); + } else if (!empty($_GET['cube_module_uninstall'])) { + require_once XOOPS_ROOT_PATH.'/class/template.php'; + $xoopsTpl = new XoopsTpl(); + $xoopsTpl->assign('cube_module_uninstall',htmlspecialchars($_GET['cube_module_uninstall'],ENT_QUOTES)); + $xoopsTpl->assign( array( + 'xoops_sitename' => htmlspecialchars($this->mController->mConfig['sitename']), + 'xoops_themecss' => xoops_getcss(), + 'xoops_imageurl' => XOOPS_THEME_URL.'/'.$this->mController->mConfig['theme_set'].'/', + )); + ///< @todo filebase template with absolute file path + $xoopsTpl->display(XOOPS_ROOT_PATH.'/modules/base/templates/legacy_uninstall_modules.html'); + exit(); + } else if (!empty($_POST['cube_module_uninstallok'])) { //@todo use Ticket + require_once XOOPS_BASE_PATH."/admin/class/ModuleUninstaller.class.php"; + $module = basename($_POST['cube_module_uninstallok']); + if (in_array($module, $retArray['disabled'])) { + $uninstaller = new Legacy_ModuleUninstaller($module); + $uninstaller->execute(); + } + XCube_Utils::redirectHeader(XOOPS_URL,1); + } else { + $handler =& xoops_getmodulehandler('non_installation_module','base'); + $objects = $handler->getObjects(); + $optionModules = array(); + foreach($objects as $module) { + if (!in_array($module->getVar('dirname'), $retArray['uninstalled'])) { + $optionModules[] = $module->getVar('dirname'); + } + } + require_once XOOPS_ROOT_PATH.'/class/template.php'; + $xoopsTpl = new XoopsTpl(); + $xoopsTpl->assign('uninstalled',$retArray['uninstalled']); + $xoopsTpl->assign('disabled',$retArray['disabled']); + $xoopsTpl->assign('option',$optionModules); + $xoopsTpl->assign( array( + 'xoops_sitename' => htmlspecialchars($this->mController->mConfig['sitename']), + 'xoops_themecss' => xoops_getcss(), + 'xoops_imageurl' => XOOPS_THEME_URL.'/'.$this->mController->mConfig['theme_set'].'/', + )); + ///< @todo filebase template with absolute file path + $xoopsTpl->display(XOOPS_ROOT_PATH.'/modules/base/templates/legacy_install_modules.html'); + exit(); + } + } else { + $accessAllowFlag = false; + } + } + } if (!$accessAllowFlag) { require_once XOOPS_ROOT_PATH.'/class/template.php'; @@ -39,7 +134,8 @@ 'lang_password' => _PASSWORD, 'lang_siteclosemsg' => $this->mController->mConfig['closesite_text'])); $xoopsTpl->xoops_setCaching(1); - $xoopsTpl->display('db:system_siteclosed.html'); ///< @todo depends schema + // @todo filebase template with absolute file path + $xoopsTpl->display(XOOPS_ROOT_PATH.'/modules/base/templates/legacy_site_closed.html'); exit(); } }