52 public $_mAdminModeFlag =
false;
54 public $_mStrategy =
null;
56 public $mDialogMode =
false;
61 public $mCheckLogin =
null;
66 public $mLogout =
null;
71 public $mCreateLanguageManager =
null;
76 public $mSetBlockCachePolicy =
null;
81 public $mActiveModules =
null;
86 public $mSetModuleCachePolicy =
null;
91 public $mGetLanguageName =
null;
96 public $mSetupDebugger =
null;
109 public $_mNotifyRedirectToUser =
null;
114 public $mLogger =
null;
116 public function __construct()
118 parent::__construct();
123 $this->mSetupUser->register(
'Legacy_Controller.SetupUser');
126 $this->mCheckLogin->register(
'Site.CheckLogin');
129 $this->mLogout->register(
'Site.Logout');
132 $this->mCreateLanguageManager->register(
'Legacy_Controller.CreateLanguageManager');
135 $this->mGetLanguageName->register(
'Legacy_Controller.GetLanguageName');
141 $this->mSetupDebugger->add(
'Legacy_DebuggerManager::createInstance');
143 $this->mSetupTextFilter->add(
'Legacy_TextFilter::getInstance', XCUBE_DELEGATE_PRIORITY_FINAL-1);
151 parent::prepare($root);
158 $urlInfo = $this->_parseUrl();
160 $adminStateFlag =
false;
161 if ((is_countable($urlInfo) ? count($urlInfo) : 0) >= 3) {
162 if (
'modules' === strtolower($urlInfo[0])) {
163 if (
'admin' === strtolower($urlInfo[2])) {
164 $adminStateFlag =
true;
165 } elseif (
'legacy' === $urlInfo[1] &&
'include' === $urlInfo[2]) {
166 $adminStateFlag =
true;
167 } elseif (
'system' === $urlInfo[1] && strpos($urlInfo[2],
'admin.php') === 0) {
168 $adminStateFlag =
true;
171 } elseif (strpos($urlInfo[0],
'admin.php') === 0) {
172 $adminStateFlag =
true;
175 if ($adminStateFlag) {
176 require_once XOOPS_ROOT_PATH .
'/modules/legacy/kernel/Legacy_AdminControllerStrategy.class.php';
194 if (!defined(
'XC_FORCE_DEBUG_PHP')) {
199 $this->_setupErrorHandler();
202 if (function_exists(
'date_default_timezone_set')) {
203 date_default_timezone_set($this->_getLocalTimezone());
208 $this->_setupLogger();
218 $this->_setupScript();
222 $this->_loadInterfaceFiles();
230 $this->setupModuleContext();
250 $this->_setupErrorHandler();
253 $this->_setupLogger();
258 public function _setupLogger()
260 require_once XOOPS_ROOT_PATH .
'/class/logger.php';
262 $this->mLogger->startTime();
264 $GLOBALS[
'xoopsLogger'] =& $this->mLogger;
267 public function &getLogger()
269 return $this->mLogger;
272 public function _getLocalTimezone()
275 $arr = localtime($iTime);
278 $iTztime = gmmktime($arr[2], $arr[1], $arr[0], $arr[4], $arr[3], $arr[5]);
279 $offset = (float)(($iTztime - $iTime) / (60 * 60));
282 'Kwajalein' => -12.00,
283 'Pacific/Midway' => -11.00,
284 'Pacific/Honolulu' => -10.00,
285 'America/Anchorage' => -9.00,
286 'America/Los_Angeles' => -8.00,
287 'America/Denver' => -7.00,
288 'America/Tegucigalpa' => -6.00,
289 'America/New_York' => -5.00,
290 'America/Caracas' => -4.30,
291 'America/Halifax' => -4.00,
292 'America/St_Johns' => -3.30,
293 'America/Argentina/Buenos_Aires' => -3.00,
294 'America/Sao_Paulo' => -3.00,
295 'Atlantic/South_Georgia' => -2.00,
296 'Atlantic/Azores' => -1.00,
297 'Europe/Dublin' => 0,
298 'Europe/Belgrade' => 1.00,
299 'Europe/Minsk' => 2.00,
300 'Asia/Kuwait' => 3.00,
301 'Asia/Tehran' => 3.30,
302 'Asia/Muscat' => 4.00,
303 'Asia/Yekaterinburg' => 5.00,
304 'Asia/Kolkata' => 5.30,
305 'Asia/Katmandu' => 5.45,
306 'Asia/Dhaka' => 6.00,
307 'Asia/Rangoon' => 6.30,
308 'Asia/Krasnoyarsk' => 7.00,
309 'Asia/Brunei' => 8.00,
310 'Asia/Seoul' => 9.00,
311 'Australia/Darwin' => 9.30,
312 'Australia/Canberra' => 10.00,
313 'Asia/Magadan' => 11.00,
314 'Pacific/Fiji' => 12.00,
315 'Pacific/Tongatapu' => 13.00
317 $index = array_keys($zonelist, $offset);
318 if (1 !== count($index)) {
326 parent::_setupEnvironment();
328 require_once XOOPS_ROOT_PATH.
'/include/version.php';
330 require_once XOOPS_TRUST_PATH.
'/settings/definition.inc.php';
331 define(
'XOOPS_LEGACY_PATH', XOOPS_MODULE_PATH.
'/'.XOOPS_LEGACY_PROC_NAME);
333 require_once XOOPS_ROOT_PATH.
'/include/functions.php';
335 require_once XOOPS_ROOT_PATH.
'/kernel/object.php';
336 require_once XOOPS_ROOT_PATH.
'/class/criteria.php';
337 require_once XOOPS_ROOT_PATH.
'/class/token.php';
338 require_once XOOPS_ROOT_PATH.
'/class/module.textsanitizer.php';
340 require_once XOOPS_LEGACY_PATH.
'/kernel/object.php';
341 require_once XOOPS_LEGACY_PATH.
'/kernel/handler.php';
342 require_once XOOPS_ROOT_PATH.
'/core/XCube_Utils.class.php';
344 require_once XOOPS_ROOT_PATH.
'/class/xoopssecurity.php';
345 $GLOBALS[
'xoopsSecurity'] =
new XoopsSecurity();
363 $this->_mStrategy->_setupFilterChain();
368 $this->_mStrategy->setupBlock();
391 $context =& $this->mRoot->mContext;
393 foreach ($this->_mBlockChain as $blockProcedure) {
398 $usedCacheFlag =
false;
406 $cacheInfo =& $blockProcedure->createCacheInfo();
408 $this->mSetBlockCachePolicy->call(
new XCube_Ref($cacheInfo));
409 $filepath = $cacheInfo->getCacheFilePath();
415 if ($cacheInfo->isEnableCache() && $this->existActiveCacheFile($filepath, $blockProcedure->getCacheTime())) {
417 if ($blockProcedure->isDisplay() && !empty($content)) {
418 $context->mAttributes[
'legacy_BlockShowFlags'][$blockProcedure->getEntryIndex()] =
true;
419 $context->mAttributes[
'legacy_BlockContents'][$blockProcedure->getEntryIndex()][] = [
420 'id' => $blockProcedure->getId(),
421 'name' => $blockProcedure->getName(),
422 'title' => $blockProcedure->getTitle(),
423 'content' => $content,
424 'weight' => $blockProcedure->getWeight(),
425 'template' => $blockProcedure->getTemplate(),
429 $usedCacheFlag =
true;
433 if (!$usedCacheFlag) {
434 $blockProcedure->execute();
436 $renderBuffer =
null;
437 if ($blockProcedure->isDisplay()) {
438 $renderBuffer =& $blockProcedure->getRenderTarget();
441 $context->mAttributes[
'legacy_BlockShowFlags'][$blockProcedure->getEntryIndex()] =
true;
442 $context->mAttributes[
'legacy_BlockContents'][$blockProcedure->getEntryIndex()][] = [
443 'id' => $blockProcedure->getId(),
444 'name' => $blockProcedure->getName(),
445 'title' => $blockProcedure->getTitle(),
446 'content' => $renderBuffer->getResult(),
447 'weight' => $blockProcedure->getWeight(),
448 'template' => $blockProcedure->getTemplate(),
457 if ($this->
isEnableCacheFeature() && $blockProcedure->isEnableCache() && is_object($cacheInfo) && $cacheInfo->isEnableCache()) {
462 unset($blockProcedure);
464 XCube_DelegateUtils::call(
'Legacy.SetupModuleContextSuccess', is_object($this->mRoot->mContext->mModule)? $this->mRoot->mContext->mModule->mXoopsModule :
null);
468 public function _parseUrl()
471 $rootPathInfo = @parse_url(XOOPS_URL);
472 $rootPath = ($rootPathInfo[
'path'] ??
'') .
'/';
473 $php_info = xoops_getenv(
'PATH_INFO');
474 $requestPathInfo = @parse_url(!empty($php_info) ? substr(xoops_getenv(
'PHP_SELF'), 0, - strlen(xoops_getenv(
'PATH_INFO'))) : xoops_getenv(
'PHP_SELF'));
476 if (
false === $requestPathInfo) {
480 $requestPath = isset($requestPathInfo[
'path']) ? urldecode($requestPathInfo[
'path']) :
'';
481 $subPath=substr($requestPath, strlen($rootPath));
482 $subPath = trim($subPath,
'/');
483 $subPath = preg_replace(
'@/{2,}@',
'/', $subPath);
486 return explode(
'/', $subPath);
490 public function setupModuleContext($dirname =
null)
492 if (
null == $dirname) {
496 $urlInfo = $this->_parseUrl();
498 if ((is_countable($urlInfo) ? count($urlInfo) : 0) >= 2) {
499 if (
'modules' === strtolower($urlInfo[0])) {
500 $dirname = $urlInfo[1];
503 if (
'admin.php' === substr($urlInfo[0], 0, 9)) {
508 if (
null == $dirname) {
512 if (!file_exists(XOOPS_ROOT_PATH .
'/modules/' . $dirname .
'/' . LEGACY_XOOPS_MODULE_MANIFESTO_FILENAME)) {
516 $this->_mStrategy->setupModuleContext($this->mRoot->mContext, $dirname);
518 if (
null !== $this->mRoot->mContext->mModule) {
519 $this->mRoot->mContext->setAttribute(
'legacy_pagetitle', $this->mRoot->mContext->mModule->mXoopsModule->get(
'name'));
526 if (
null !== $this->mRoot->mContext->mModule) {
527 $module =& $this->mRoot->mContext->mModule;
528 if (!$module->isActive()) {
533 XCube_DelegateUtils::call(
'Legacy.Event.Exception.ModuleNotActive', $module);
538 if (!$this->_mStrategy->enableAccess()) {
539 XCube_DelegateUtils::call(
'Legacy.Event.Exception.ModuleSecurity', $module);
544 $this->_mStrategy->setupModuleLanguage();
547 $GLOBALS[
'xoopsModule'] =& $module->mXoopsModule;
548 $GLOBALS[
'xoopsModuleConfig'] =& $module->mModuleConfig;
551 Legacy_Utils::raiseUserControlEvent();
557 require_once XOOPS_ROOT_PATH.
'/include/functions.php';
559 $path_translated = xoops_getenv(
'PATH_TRANSLATED');
560 $script_filename = xoops_getenv(
'SCRIPT_FILENAME');
561 $request_uri = xoops_getenv(
'REQUEST_URI');
562 if (!isset($path_translated) && isset($script_filename)) {
567 $_SERVER[
'PATH_TRANSLATED'] =& $_SERVER[
'SCRIPT_FILENAME'];
568 } elseif (isset($path_translated) && !isset($script_filename)) {
570 $_SERVER[
'SCRIPT_FILENAME'] =& $_SERVER[
'PATH_TRANSLATED'];
577 if (empty($request_uri)) {
578 $query_string = xoops_getenv(
'QUERY_STRING');
579 if (!($_SERVER[
'REQUEST_URI'] = xoops_getenv(
'PHP_SELF'))) {
580 $_SERVER[
'REQUEST_URI'] = xoops_getenv(
'SCRIPT_NAME');
582 if (isset($query_string)) {
583 $_SERVER[
'REQUEST_URI'] .=
'?' . $query_string;
588 if (preg_match(
'/[<>\"\'\(\)]/', xoops_getenv(
'REQUEST_URI'))) {
598 $GLOBALS[
'xoopsRequestUri'] = xoops_getenv(
'REQUEST_URI');
603 parent::_setupUser();
606 $GLOBALS[
'xoopsUser'] =& $this->mRoot->mContext->mXoopsUser;
607 $GLOBALS[
'xoopsUserIsAdmin'] = is_object($this->mRoot->mContext->mXoopsUser) ? $this->mRoot->mContext->mXoopsUser->isAdmin(1) :
false;
612 $GLOBALS[
'xoopsMemberHandler'] = xoops_gethandler(
'member');
613 $GLOBALS[
'member_handler'] =& $GLOBALS[
'xoopsMemberHandler'];
616 public function _setupErrorHandler()
626 if (!defined(
'XOOPS_XMLRPC')) {
627 define(
'XOOPS_DB_CHKREF', 1);
629 define(
'XOOPS_DB_CHKREF', 0);
632 require_once XOOPS_ROOT_PATH.
'/class/database/databasefactory.php';
634 if (
true == $this->mRoot->getSiteConfig(
'Legacy',
'AllowDBProxy')) {
635 if (
'POST' !== xoops_getenv(
'REQUEST_METHOD') || !xoops_refcheck(XOOPS_DB_CHKREF)) {
636 define(
'XOOPS_DB_PROXY', 1);
638 } elseif (
'POST' !== xoops_getenv(
'REQUEST_METHOD')) {
639 define(
'XOOPS_DB_PROXY', 1);
644 $GLOBALS[
'xoopsDB']=&$this->mDB;
657 require_once XOOPS_LEGACY_PATH.
'/kernel/Legacy_LanguageManager.class.php';
661 $this->mGetLanguageName->call(
new XCube_Ref($language));
663 if (
null == $language) {
664 $handler = xoops_gethandler(
'config');
666 $criteria->add(
new Criteria(
'conf_catid', XOOPS_CONF));
667 $criteria->add(
new Criteria(
'conf_name',
'language'));
668 $configs =& $handler->getConfigs($criteria);
670 if ((is_countable($configs) ? count($configs) : 0) > 0) {
671 $language = $configs[0]->get(
'conf_value',
'none');
676 $this->mRoot->mLanguageManager->setLanguage($language);
677 $this->mRoot->mLanguageManager->prepare();
680 if (isset($GLOBALS[
'xoopsOption'][
'pagetype'])) {
681 $this->mRoot->mLanguageManager->loadPageTypeMessageCatalog($GLOBALS[
'xoopsOption'][
'pagetype']);
706 require_once XOOPS_LEGACY_PATH .
'/kernel/Legacy_LanguageManager.class.php';
708 $languageManager =
null;
710 $this->mCreateLanguageManager->call(
new XCube_Ref($languageManager), $language);
712 if (!is_object($languageManager)) {
713 $className =
'Legacy_LanguageManager_' . ucfirst(strtolower($language));
719 if (XC_CLASS_EXISTS($className)) {
720 $languageManager =
new $className();
722 $filePath = XOOPS_ROOT_PATH .
'/language/' . $language .
'/LanguageManager.class.php';
723 if (file_exists($filePath)) {
724 require_once $filePath;
727 if (XC_CLASS_EXISTS($className)) {
728 $languageManager =
new $className();
738 return $languageManager;
743 $configHandler = xoops_gethandler(
'config');
745 $this->mRoot->mContext->mXoopsConfig =& $configHandler->getConfigsByCat(XOOPS_CONF);
747 $this->mRoot->mContext->mXoopsConfig[
'language'] = $this->mRoot->mLanguageManager->getLanguage();
748 $GLOBALS[
'xoopsConfig'] =& $this->mRoot->mContext->mXoopsConfig;
749 $GLOBALS[
'config_handler'] =& $configHandler;
750 $GLOBALS[
'module_handler'] = xoops_gethandler(
'module');
752 if (0 == (is_countable($this->mRoot->mContext->mXoopsConfig) ? count($this->mRoot->mContext->mXoopsConfig) : 0)) {
758 $this->mRoot->mContext->setThemeName($this->mRoot->mContext->mXoopsConfig[
'theme_set']);
759 $this->mRoot->mContext->setAttribute(
'legacy_sitename', $this->mRoot->mContext->mXoopsConfig[
'sitename']);
760 $this->mRoot->mContext->setAttribute(
'legacy_pagetitle', $this->mRoot->mContext->mXoopsConfig[
'slogan']);
761 $this->mRoot->mContext->setAttribute(
'legacy_slogan', $this->mRoot->mContext->mXoopsConfig[
'slogan']);
764 public function _setupScript()
766 require_once XOOPS_MODULE_PATH.
'/legacy/class/Legacy_HeaderScript.class.php';
768 $this->mRoot->mContext->setAttribute(
'headerScript', $headerScript);
781 $debug_mode = $this->mRoot->mContext->mXoopsConfig[
'debug_mode'];
782 if (defined(
'XC_FORCE_DEBUG_PHP')) {
783 $debug_mode = XOOPS_DEBUG_PHP;
786 $this->mSetupDebugger->call(
new XCube_Ref($this->mDebugger), $debug_mode);
787 $this->mDebugger && $this->mDebugger->prepare();
789 $GLOBALS[
'xoopsDebugger']=&$this->mDebugger;
794 $this->_mStrategy->_processPreBlockFilter();
795 parent::_processPreBlockFilter();
798 public function _processModulePreload($dirname)
803 if ($this->mRoot->getSiteConfig(
'Legacy',
'AutoPreload') == 1) {
804 if ($this->mActiveModules) {
805 $moduleObjects = $this->mActiveModules;
807 $moduleHandler = xoops_gethandler(
'module');
808 $criteria =
new Criteria(
'isactive', 1);
809 $this->mActiveModules =
810 $moduleObjects =& $moduleHandler->getObjects($criteria);
812 foreach ($moduleObjects as $moduleObject) {
813 $mod_dir = $moduleObject->getVar(
'dirname');
814 $dir = XOOPS_ROOT_PATH .
'/modules/' . $mod_dir . $dirname .
'/';
816 $files = glob($dir.
'*.class.php');
818 foreach ($files as $file) {
820 $className = ucfirst($mod_dir) .
'_' . basename($file,
'.class.php');
822 if (XC_CLASS_EXISTS($className) && !isset($this->_mLoadedFilterNames[$className])) {
823 $instance =
new $className($this);
836 parent::_setupSession();
838 $root =& XCube_Root::getSingleton();
839 $xoopsConfig = $root->mContext->mXoopsConfig;
840 if ($xoopsConfig[
'use_mysession']) {
841 $this->mRoot->mSession->setParam($xoopsConfig[
'session_name'], $xoopsConfig[
'session_expire']);
843 $this->mRoot->mSession->start();
846 protected function _loadInterfaceFiles()
848 $dir = XOOPS_MODULE_PATH.
'/legacy/class/interface/';
849 $interfaces = glob($dir.
'*.php');
850 foreach ($interfaces as $file) {
858 parent::executeHeader();
867 if (
null !== $this->mRoot->mContext->mModule && $this->isEnableCacheFeature()) {
868 $cacheInfo =& $this->mRoot->mContext->mModule->createCacheInfo();
870 $this->mSetModuleCachePolicy->call($cacheInfo);
872 if ($this->mRoot->mContext->mModule->isEnableCache()) {
875 $xoopsModule =& $this->mRoot->mContext->mXoopsModule;
877 $cachetime = $this->mRoot->mContext->mXoopsConfig[
'module_cache'][$xoopsModule->get(
'mid')];
878 $filepath = $cacheInfo->getCacheFilePath();
884 if ($cacheInfo->isEnableCache() && $this->existActiveCacheFile($filepath, $cachetime)) {
885 $renderSystem =& $this->mRoot->getRenderSystem($this->mRoot->mContext->mModule->getRenderSystemName());
886 $renderTarget =& $renderSystem->createRenderTarget(XCUBE_RENDER_TARGET_TYPE_MAIN);
891 $renderCache = $this->
loadCache($filepath);
892 $renderTarget->setResult($renderCache);
906 if (
null !== $this->mRoot->mContext->mModule) {
907 $renderSystem =& $this->mRoot->getRenderSystem($this->mRoot->mContext->mModule->getRenderSystemName());
908 $renderTarget =& $this->mRoot->mContext->mModule->getRenderTarget();
917 if (is_object($renderTarget)) {
918 if (
null == $renderTarget->getTemplateName()) {
919 if (isset($GLOBALS[
'xoopsOption'][
'template_main'])) {
920 $renderTarget->setTemplateName($GLOBALS[
'xoopsOption'][
'template_main']);
924 $renderTarget->setAttribute(
'stdout_buffer', ob_get_contents());
929 if (is_object($renderTarget)) {
930 $renderSystem->render($renderTarget);
933 $module = $this->mRoot->mContext->mModule;
934 if ($this->
isEnableCacheFeature() && $module->isEnableCache() && $module->mCacheInfo->isEnableCache()) {
935 $this->
cacheRenderTarget($module->mCacheInfo->getCacheFilePath(), $renderTarget);
951 $theme =& $this->_mStrategy->getMainThemeObject();
952 if (!is_object($theme)) {
953 die(
'Could not found any compatible theme.');
956 $renderSystem =& $this->mRoot->getRenderSystem($theme->get(
'render_system'));
957 $screenTarget = $renderSystem->getThemeRenderTarget($this->mDialogMode);
959 if (is_object($resultRenderTarget)) {
960 $screenTarget->setAttribute(
'xoops_contents', $resultRenderTarget->getResult());
962 $screenTarget->setAttribute(
'xoops_contents', ob_get_contents());
966 $screenTarget->setTemplateName($theme->get(
'dirname'));
971 $renderSystem->render($screenTarget);
977 if (is_object($this->mRoot->mContext->mXoopsUser)) {
978 if (
null !== $this->mRoot->mContext->mModule && $this->mRoot->mContext->mModule->isActive()) {
980 $mid = $this->mRoot->mContext->mXoopsModule->getVar(
'mid');
985 $isAdmin = $this->mRoot->mContext->mXoopsUser->isAdmin($mid);
989 $this->mDebugger->displayLog();
998 $delegateManager =& parent::_createDelegateManager();
1000 $file = XOOPS_ROOT_PATH .
'/modules/legacy/kernel/Legacy_EventFunctions.class.php';
1002 $delegateManager->add(
'Legacypage.Notifications.Access',
'Legacy_EventFunction::notifications', $file);
1003 $delegateManager->add(
'Legacyfunction.Notifications.Select',
'Legacy_EventFunction::notifications_select', $file);
1004 $delegateManager->add(
'Legacypage.Search.Access',
'Legacy_EventFunction::search', $file);
1005 $delegateManager->add(
'Legacypage.Imagemanager.Access',
'Legacy_EventFunction::imageManager', $file);
1006 $delegateManager->add(
'Legacypage.Backend.Access',
'Legacy_EventFunction::backend', $file);
1007 $delegateManager->add(
'Legacypage.Misc.Access',
'Legacy_EventFunction::misc', $file);
1008 $delegateManager->add(
'User_UserViewAction.GetUserPosts',
'Legacy_EventFunction::recountPost', $file);
1010 return $delegateManager;
1018 $serviceManager =& parent::_createServiceManager();
1020 require_once XOOPS_ROOT_PATH .
'/modules/legacy/service/LegacySearchService.class.php';
1022 $searchService->prepare();
1024 $serviceManager->addService(
'LegacySearch', $searchService);
1026 return $serviceManager;
1037 if (!is_object($this->mRoot->mContext->mXoopsUser)) {
1038 $this->mCheckLogin->call(
new XCube_Ref($this->mRoot->mContext->mXoopsUser));
1040 $this->mRoot->mLanguageManager->loadModuleMessageCatalog(
'legacy');
1042 if (is_object($this->mRoot->mContext->mXoopsUser)) {
1044 $t_groups = $this->mRoot->mContext->mXoopsUser->getGroups();
1045 if (!is_array($t_groups)) {
1049 } elseif (0 == count($t_groups)) {
1057 $notification_handler = xoops_gethandler(
'notification');
1058 $notification_handler->doLoginMaintenance($this->mRoot->mContext->mXoopsUser->get(
'uid'));
1060 XCube_DelegateUtils::call(
'Site.CheckLogin.Success',
new XCube_Ref($this->mRoot->mContext->mXoopsUser));
1066 if (!empty($_POST[
'xoops_redirect']) && !strpos(xoops_getrequest(
'xoops_redirect'),
'register')) {
1067 $parsed = parse_url(XOOPS_URL);
1068 $url = isset($parsed[
'scheme']) ? $parsed[
'scheme'].
'://' :
'https://';
1070 if (isset($parsed[
'host'])) {
1071 $url .= isset($parsed[
'port']) ? $parsed[
'host'] .
':' . $parsed[
'port'] .
'/'.ltrim(trim(xoops_getrequest(
'xoops_redirect')),
'/') : $parsed[
'host'] .
'/'. ltrim(trim(xoops_getrequest(
'xoops_redirect')),
'/');
1073 $url .= xoops_getenv(
'HTTP_HOST') .
'/'. ltrim(trim(xoops_getrequest(
'xoops_redirect')),
'/');
1079 XCube_DelegateUtils::call(
'Site.CheckLogin.Fail',
new XCube_Ref($this->mRoot->mContext->mXoopsUser));
1084 $this->
executeRedirect(XOOPS_URL .
'/user.php', 1, _MD_LEGACY_ERROR_INCORRECTLOGIN);
1098 $successFlag =
false;
1099 $xoopsUser =& $this->mRoot->mContext->mXoopsUser;
1102 if (is_object($xoopsUser)) {
1103 $this->mRoot->mLanguageManager->loadModuleMessageCatalog(
'legacy');
1105 $this->mLogout->call(
new XCube_Ref($successFlag), $xoopsUser);
1107 XCube_DelegateUtils::call(
'Site.Logout.Success', $xoopsUser);
1112 $this->
executeRedirect(XOOPS_URL .
'/', 1, [_MD_LEGACY_MESSAGE_LOGGEDOUT, _MD_LEGACY_MESSAGE_THANKYOUFORVISIT]);
1114 XCube_DelegateUtils::call(
'Site.Logout.Fail', $xoopsUser);
1141 if ($strategy->mStatusFlag !== $this->_mStrategy->mStatusFlag) {
1142 $this->_mStrategy =& $strategy;
1148 $this->setupModuleContext();
1161 $this->mDialogMode = $flag;
1170 return $this->mDialogMode;
1183 $ret =& $this->_mStrategy->getVirtualCurrentModule();
1203 global $xoopsConfig, $xoopsRequestUri;
1208 if (preg_match(
'/(javascript|vbscript):/si', $url)) {
1212 $displayMessage =
'';
1213 if (is_array($message)) {
1214 foreach (array_keys($message) as $key) {
1215 $message[$key] = htmlspecialchars($message[$key], ENT_QUOTES);
1217 $displayMessage = implode(
'<br>', $message);
1219 $displayMessage = $message;
1222 $url = htmlspecialchars($url, ENT_QUOTES);
1229 if ($addRedirect && strpos($url,
'user.php') !==
false) {
1230 $this->_mNotifyRedirectToUser->call(
new XCube_Ref($url));
1233 if (defined(
'SID') && (! isset($_COOKIE[session_name()]) || ($xoopsConfig[
'use_mysession'] &&
'' !== $xoopsConfig[
'session_name'] && !isset($_COOKIE[$xoopsConfig[
'session_name']])))) {
1234 if (strpos($url, (
string) XOOPS_URL) === 0) {
1235 if (strpos($url,
'?') ===
false) {
1238 $connector =
'&';
1240 if (strpos($url,
'#') !==
false) {
1241 $urlArray = explode(
'#', $url);
1242 $url = $urlArray[0] . $connector . SID;
1243 if (! empty($urlArray[1])) {
1244 $url .=
'#' . $urlArray[1];
1247 $url .= $connector . SID;
1256 $moduleHandler = xoops_gethandler(
'module');
1257 $legacyRender =& $moduleHandler->getByDirname(
'legacyRender');
1258 $configHandler = xoops_gethandler(
'config');
1259 $configs =& $configHandler->getConfigsByCat(0, $legacyRender->get(
'mid'));
1261 if (!defined(
'XOOPS_CPFUNC_LOADED')) {
1262 require_once XOOPS_ROOT_PATH.
'/class/template.php';
1266 'xoops_sitename' =>htmlspecialchars($xoopsConfig[
'sitename'], ENT_QUOTES),
1267 'sitename' =>htmlspecialchars($xoopsConfig[
'sitename'], ENT_QUOTES),
1268 'theme_set' =>htmlspecialchars($xoopsConfig[
'theme_set'], ENT_QUOTES),
1269 'theme_url' =>XOOPS_THEME_URL .
'/' . $xoopsConfig[
'theme_set'],
1270 'theme_css' =>getcss(),
1271 'langcode' =>_LANGCODE,
1272 'charset' =>_CHARSET,
1275 'message' =>$displayMessage,
1276 'logotype' =>$configs[
'logotype'],
1277 'favicon' =>$configs[
'favicon'],
1278 'lang_ifnotreload' =>sprintf(_IFNOTRELOAD, $url)
1281 $GLOBALS[
'xoopsModuleUpdate'] = 1;
1283 $xoopsTpl->display(
'db:system_redirect.html');
1287 header(
'Content-Type:text/html; charset='._CHARSET);
1291 <title>'.htmlspecialchars($xoopsConfig[
'sitename']).
'</title>
1292 <meta http-equiv="Content-Type" content="text/html; charset='._CHARSET.
'">
1293 <{if !class_exists("AdelieDebug_Preload")}>
1294 <meta http-equiv="Refresh" content="'.$time.
'; url='.$url.
'">
1296 <link rel="stylesheet" href="<{$xoops_url}>/modules/legacy/admin/theme/style.css">
1298 body {margin:2em;transition:background 500ms ease-in-out, color 200ms ease;}
1301 align-content : center;
1303 flex-direction : column;
1304 justify-content : center;
1308 .wrapper-require > * {
1313 border-spacing: 1px;
1314 border-collapse: separate;
1320 margin-right : 1em; /* Space icon -> text */
1321 vertical-align : middle; /* Align icon and text */
1322 width : 1.5em; /* Size icon to text */
1330 <div class="wrapper-redirect">
1333 <h4>'.$displayMessage.
'</h4>
1335 <p>'.sprintf(_IFNOTRELOAD, $url).
'</p>
1337 <{if class_exists("AdelieDebug_Preload")}>
1338 <p style="color:red;text-align: center">No automatic redirect during AdelieDebug execution.</p>
1356 return $this->_mStrategy->isEnableCacheFeature();
1369 if (0 == $cachetime) {
1373 if (!file_exists($filepath)) {
1377 return ((time() - filemtime($filepath)) <= $cachetime);
1388 $fp = fopen($filepath,
'wb');
1390 fwrite($fp, $renderTarget->getResult());
1405 if (file_exists($filepath)) {
1406 return file_get_contents($filepath);
1414 require_once XOOPS_ROOT_PATH .
'/modules/legacy/kernel/Legacy_HttpContext.class.php';
1418 $context->setRequest($request);
1431 if (is_object($module)) {
1432 return XOOPS_MODULE_URL .
'/legacy/admin/index.php?action=PreferenceEdit&confmod_id=' . $module->get(
'mid');
1446 if (is_object($module)) {
1447 return XOOPS_MODULE_URL .
'/legacy/admin/index.php?action=Help&dirname=' . $module->get(
'dirname');
1462 public $mController =
null;
1464 public $mStatusFlag;
1466 public array $_mLoadedFilterNames = [];
1468 public function __construct(&$controller)
1470 $this->mController =& $controller;
1473 public function _setupFilterChain()
1475 $primaryPreloads = $this->mController->mRoot->getSiteConfig(
'Legacy.PrimaryPreloads');
1476 foreach ($primaryPreloads as $className => $classPath) {
1477 if (file_exists(XOOPS_ROOT_PATH . $classPath)) {
1478 require_once XOOPS_ROOT_PATH . $classPath;
1479 if (XC_CLASS_EXISTS($className) && !isset($this->_mLoadedFilterNames[$className])) {
1480 $this->_mLoadedFilterNames[$className] =
true;
1481 $filter =
new $className($this->mController);
1482 $this->mController->addActionFilter($filter);
1491 if (1 == $this->mController->mRoot->getSiteConfig(
'Legacy',
'AutoPreload')) {
1492 $this->mController->_processPreload(XOOPS_ROOT_PATH .
'/preload');
1507 $handler = xoops_gethandler(
'module');
1508 $module =& $handler->getByDirname($dirname);
1510 if (!is_object($module)) {
1511 XCube_DelegateUtils::call(
'Legacy.Event.Exception.XoopsModuleNotFound', $dirname);
1512 $this->mController->executeRedirect(XOOPS_URL .
'/', 1,
'You can\'t access this URL.');
1516 $context->mModule =& Legacy_Utils::createModule($module);
1517 $context->mXoopsModule =& $context->mModule->getXoopsModule();
1518 $context->mModuleConfig = $context->mModule->getModuleConfig();
1523 $this->mController->mRoot->mRoleManager->loadRolesByMid($context->mXoopsModule->get(
'mid'));
1526 public function setupBlock()
1530 public function _processPreBlockFilter()
1532 $this->mController->_processModulePreload(
'/preload');
1560 public function setupModuleLanguage()
[Secret Agreement] The context class for Legacy which extends to keep Legacy-module-specific informat...