/** * Zikula_View function to register a page variable * * This function registers a page-specific variable with the Zikula system. * * Available parameters: * - name: The name of the page variable to obtain * * Zikula doesn't impose any restriction on the page variable's name except for duplicate * and reserved names. As of this writing, the list of reserved names consists of * <ul> * <li>title</li> * <li>description</li> * <li>keywords</li> * <li>stylesheet</li> * <li>javascript</li> * <li>body</li> * <li>header</li> * <li>footer</li> * </ul> * * In addition, if your system is operating in legacy compatibility mode, then * the variable 'rawtext' is reserved, and maps to 'header'. (When not operating in * legacy compatibility mode, 'rawtext' is not reserved and will not be rendered * to the page output by the page variable output filter.) * * Example * {pageregistervar name='title'} * * @param array $params All attributes passed to this function from the template. * @param Zikula_View $view Reference to the Zikula_View object. * * @return string The module variable. */ function smarty_function_pageregistervar($params, Zikula_View $view) { $name = isset($params['name']) ? $params['name'] : null; $multivalue = isset($params['multivalue']) ? $params['multivalue'] : null; $default = isset($params['default']) ? $params['default'] : null; if (!$name) { $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('pnpageregistervar', 'name'))); return false; } PageUtil::registerVar($name, $multivalue, $default); return; }
/** * Initialise Zikula. * * Carries out a number of initialisation tasks to get Zikula up and * running. * * @param integer $stage Stage to load. * * @return boolean True initialisation successful false otherwise. */ public function init($stage = self::STAGE_ALL) { $coreInitEvent = new Zikula_Event('core.init', $this); // store the load stages in a global so other API's can check whats loaded $this->stage = $this->stage | $stage; if ($stage & self::STAGE_PRE && $this->stage & ~self::STAGE_PRE) { ModUtil::flushCache(); System::flushCache(); $this->eventManager->notify(new Zikula_Event('core.preinit', $this)); } // Initialise and load configuration if ($stage & self::STAGE_CONFIG) { if (System::isLegacyMode()) { require_once 'lib/legacy/Compat.php'; } // error reporting if (!System::isInstalling()) { // this is here because it depends on the config.php loading. $event = new Zikula_Event('setup.errorreporting', null, array('stage' => $stage)); $this->eventManager->notify($event); } // initialise custom event listeners from config.php settings $coreInitEvent->setArg('stage', self::STAGE_CONFIG); $this->eventManager->notify($coreInitEvent); } // Check that Zikula is installed before continuing if (System::getVar('installed') == 0 && !System::isInstalling()) { System::redirect(System::getBaseUrl() . 'install.php?notinstalled'); System::shutDown(); } if ($stage & self::STAGE_DB) { try { $dbEvent = new Zikula_Event('core.init', $this, array('stage' => self::STAGE_DB)); $this->eventManager->notify($dbEvent); } catch (PDOException $e) { if (!System::isInstalling()) { header('HTTP/1.1 503 Service Unavailable'); require_once System::getSystemErrorTemplate('dbconnectionerror.tpl'); System::shutDown(); } else { return false; } } } if ($stage & self::STAGE_TABLES) { // Initialise dbtables ModUtil::dbInfoLoad('Extensions', 'Extensions'); ModUtil::initCoreVars(); ModUtil::dbInfoLoad('Settings', 'Settings'); ModUtil::dbInfoLoad('Theme', 'Theme'); ModUtil::dbInfoLoad('Users', 'Users'); ModUtil::dbInfoLoad('Groups', 'Groups'); ModUtil::dbInfoLoad('Permissions', 'Permissions'); ModUtil::dbInfoLoad('Categories', 'Categories'); if (!System::isInstalling()) { ModUtil::registerAutoloaders(); } $coreInitEvent->setArg('stage', self::STAGE_TABLES); $this->eventManager->notify($coreInitEvent); } if ($stage & self::STAGE_SESSIONS) { SessionUtil::requireSession(); $coreInitEvent->setArg('stage', self::STAGE_SESSIONS); $this->eventManager->notify($coreInitEvent); } // Have to load in this order specifically since we cant setup the languages until we've decoded the URL if required (drak) // start block if ($stage & self::STAGE_LANGS) { $lang = ZLanguage::getInstance(); } if ($stage & self::STAGE_DECODEURLS) { System::queryStringDecode(); $coreInitEvent->setArg('stage', self::STAGE_DECODEURLS); $this->eventManager->notify($coreInitEvent); } if ($stage & self::STAGE_LANGS) { $lang->setup(); $coreInitEvent->setArg('stage', self::STAGE_LANGS); $this->eventManager->notify($coreInitEvent); } // end block if ($stage & self::STAGE_MODS) { // Set compression on if desired if (System::getVar('UseCompression') == 1) { //ob_start("ob_gzhandler"); } ModUtil::load('SecurityCenter'); $coreInitEvent->setArg('stage', self::STAGE_MODS); $this->eventManager->notify($coreInitEvent); } if ($stage & self::STAGE_THEME) { // register default page vars PageUtil::registerVar('title'); PageUtil::setVar('title', System::getVar('defaultpagetitle')); PageUtil::registerVar('keywords', true); PageUtil::registerVar('stylesheet', true); PageUtil::registerVar('javascript', true); PageUtil::registerVar('jsgettext', true); PageUtil::registerVar('body', true); PageUtil::registerVar('header', true); PageUtil::registerVar('footer', true); $theme = Zikula_View_Theme::getInstance(); // set some defaults // Metadata for SEO $this->serviceManager['zikula_view.metatags']['description'] = System::getVar('defaultmetadescription'); $this->serviceManager['zikula_view.metatags']['keywords'] = System::getVar('metakeywords'); $coreInitEvent->setArg('stage', self::STAGE_THEME); $this->eventManager->notify($coreInitEvent); } // check the users status, if not 1 then log him out if (UserUtil::isLoggedIn()) { $userstatus = UserUtil::getVar('activated'); if ($userstatus != Users_Constant::ACTIVATED_ACTIVE) { UserUtil::logout(); // TODO - When getting logged out this way, the existing session is destroyed and // then a new one is created on the reentry into index.php. The message // set by the registerStatus call below gets lost. LogUtil::registerStatus(__('You have been logged out.')); System::redirect(ModUtil::url('Users', 'user', 'login')); } } if ($stage & self::STAGE_POST && $this->stage & ~self::STAGE_POST) { $this->eventManager->notify(new Zikula_Event('core.postinit', $this, array('stages' => $stage))); } }
/** * View sitemap * * @return Renderer */ public function sitemap($args) { $this->throwForbiddenUnless(SecurityUtil::checkPermission('Content:page:', '::', ACCESS_READ), LogUtil::getErrorMsgPermission()); $pages = ModUtil::apiFunc('Content', 'Page', 'getPages', array('orderBy' => 'setLeft', 'makeTree' => true, 'filter' => array('checkInMenu' => true))); if ($pages === false) { return false; } if ($this->getVar('overrideTitle')) { PageUtil::setVar('title', $this->__('Sitemap')); } $this->view->assign('pages', $pages); Content_Util::contentAddAccess($this->view, null); $tpl = FormUtil::getPassedValue('tpl', '', 'GET'); if ($tpl == 'xml') { $this->view->display('user/sitemap.xml'); return true; } // Register a page variable breadcrumbs with the Content page hierarchy as array of array(url, title) if ((bool) $this->getVar('registerBreadcrumbs', false) === true) { // first include self, then loop over parents until root is reached $modInfo = $this->getModInfo(); $breadcrumbs[] = array('url' => ModUtil::url('Content', 'user', 'sitemap'), 'title' => $modInfo['displayname'] . ' ' . $this->__('Sitemap')); PageUtil::registerVar('breadcrumbs', false, $breadcrumbs); } return $this->view->fetch('user/sitemap.tpl'); }
<?php // some needed variables common for all called files from site index.php // include this at the front of each of them include_once 'modules/ZphpBB2/lib/ZphpBB2/Util.php'; define('IN_PHPBB', true); global $phpbb_root_path; $phpbb_root_path = 'modules/ZphpBB2/vendor/phpBB2/'; global $minmax; $minmax = FormUtil::getPassedValue('minmax', 0, 'GETPOST'); # ZphpBB2 if ($minmax == 1) { PageUtil::registerVar('sitemaxstate', false, 1); #ZphpBB2: to be available in theme, to mimic maximized forum } // to prevent errors when included from function global $template; // SEO $page_title = ModUtil::getVar('ZphpBB2', 'page_title', ''); if ($page_title) { PageUtil::setVar('title', $page_title); } $page_description = ModUtil::getVar('ZphpBB2', 'page_description', ''); if ($page_description) { PageUtil::setVar('description', $page_description); } $page_robots = ModUtil::getVar('ZphpBB2', 'page_robots', ''); if ($page_robots) { $sm = ServiceUtil::getManager(); $sm['zikula_view.metatags']['robots'] = $page_robots; }
/** * Initialise Zikula. * * Carries out a number of initialisation tasks to get Zikula up and * running. * * @param integer $stage Stage to load. * * @return boolean True initialisation successful false otherwise. */ public function onInit(GetResponseEvent $event) { if ($event->getRequestType() === HttpKernelInterface::SUB_REQUEST) { return; } $this->dispatcher = $event->getDispatcher(); $this->stage = $stage = self::STAGE_ALL; $coreInitEvent = new GenericEvent($this); $coreInitEvent['request'] = $event->getRequest(); // store the load stages in a global so other API's can check whats loaded $this->dispatcher->dispatch(CoreEvents::PREINIT, new GenericEvent($this)); // // Initialise and load configuration // if ($stage & self::STAGE_CONFIG) { // // error reporting // if (!\System::isInstalling()) { // // this is here because it depends on the config.php loading. // $event = new GenericEvent(null, array('stage' => $stage)); // $this->dispatcher->dispatch(CoreEvents::ERRORREPORTING, $event); // } // // // initialise custom event listeners from config.php settings // $coreInitEvent->setArg('stage', self::STAGE_CONFIG); // $this->dispatcher->dispatch(CoreEvents::INIT, $coreInitEvent); // } // // Check that Zikula is installed before continuing // if (\System::getVar('installed') == 0 && !\System::isInstalling()) { // $response = new RedirectResponse(\System::getBaseUrl().'install.php?notinstalled'); // $response->send(); // \System::shutdown(); // } if ($stage & self::STAGE_DB) { try { $dbEvent = new GenericEvent(); $this->dispatcher->dispatch('doctrine.init_connection', $dbEvent); $dbEvent = new GenericEvent($this, array('stage' => self::STAGE_DB)); $this->dispatcher->dispatch(CoreEvents::INIT, $dbEvent); } catch (\PDOException $e) { if (!\System::isInstalling()) { header('HTTP/1.1 503 Service Unavailable'); require_once \System::getSystemErrorTemplate('dbconnectionerror.tpl'); \System::shutDown(); } else { return false; } } } if ($stage & self::STAGE_TABLES) { // Initialise dbtables \ModUtil::initCoreVars(); \ModUtil::dbInfoLoad('SettingsModule', 'SettingsModule'); \ModUtil::dbInfoLoad('ThemeModule', 'ThemeModule'); \ModUtil::dbInfoLoad('UsersModule', 'UsersModule'); \ModUtil::dbInfoLoad('GroupsModule', 'GroupsModule'); \ModUtil::dbInfoLoad('PermissionsModule', 'PermissionsModule'); \ModUtil::dbInfoLoad('CategoriesModule', 'CategoriesModule'); if (!\System::isInstalling()) { \ModUtil::registerAutoloaders(); } $coreInitEvent->setArg('stage', self::STAGE_TABLES); $this->dispatcher->dispatch(CoreEvents::INIT, $coreInitEvent); } if ($stage & self::STAGE_SESSIONS) { \SessionUtil::requireSession(); $coreInitEvent->setArg('stage', self::STAGE_SESSIONS); $this->dispatcher->dispatch(CoreEvents::INIT, $coreInitEvent); } // Have to load in this order specifically since we cant setup the languages until we've decoded the URL if required (drak) // start block if ($stage & self::STAGE_LANGS) { $lang = \ZLanguage::getInstance(); } if ($stage & self::STAGE_DECODEURLS) { \System::queryStringDecode(); $coreInitEvent->setArg('stage', self::STAGE_DECODEURLS); $this->dispatcher->dispatch(CoreEvents::INIT, $coreInitEvent); } if ($stage & self::STAGE_LANGS) { $lang->setup(); $coreInitEvent->setArg('stage', self::STAGE_LANGS); $this->dispatcher->dispatch(CoreEvents::INIT, $coreInitEvent); } // end block if ($stage & self::STAGE_MODS) { // Set compression on if desired if (\System::getVar('UseCompression') == 1) { //ob_start("ob_gzhandler"); } \ModUtil::load('SecurityCenter'); $coreInitEvent->setArg('stage', self::STAGE_MODS); $this->dispatcher->dispatch(CoreEvents::INIT, $coreInitEvent); } if ($stage & self::STAGE_THEME) { // register default page vars \PageUtil::registerVar('title'); \PageUtil::setVar('title', \System::getVar('defaultpagetitle')); \PageUtil::registerVar('keywords', true); \PageUtil::registerVar('stylesheet', true); \PageUtil::registerVar('javascript', true); \PageUtil::registerVar('jsgettext', true); \PageUtil::registerVar('body', true); \PageUtil::registerVar('header', true); \PageUtil::registerVar('footer', true); $theme = \Zikula_View_Theme::getInstance(); // set some defaults // Metadata for SEO $this->container['zikula_view.metatags']['description'] = \System::getVar('defaultmetadescription'); $this->container['zikula_view.metatags']['keywords'] = \System::getVar('metakeywords'); $coreInitEvent->setArg('stage', self::STAGE_THEME); $this->dispatcher->dispatch(CoreEvents::INIT, $coreInitEvent); } // check the users status, if not 1 then log him out if (\UserUtil::isLoggedIn()) { $userstatus = \UserUtil::getVar('activated'); if ($userstatus != UsersConstant::ACTIVATED_ACTIVE) { \UserUtil::logout(); // TODO - When getting logged out this way, the existing session is destroyed and // then a new one is created on the reentry into index.php. The message // set by the registerStatus call below gets lost. \LogUtil::registerStatus(__('You have been logged out.')); $response = new RedirectResponse(\ModUtil::url('Users', 'user', 'login')); $response->send(); exit; } } if ($stage & self::STAGE_POST && $this->stage & ~self::STAGE_POST) { $this->dispatcher->dispatch(CoreEvents::POSTINIT, new GenericEvent($this, array('stages' => $stage))); } $this->dispatcher->dispatch('frontcontroller.predispatch', new GenericEvent()); }
/** * Initialise Zikula. * * Carries out a number of initialisation tasks to get Zikula up and * running. * * @param integer $stage Stage to load. * @param Zikula_Request_Http $request * * @return boolean True initialisation successful false otherwise. */ public function init($stage = self::STAGE_ALL, Request $request) { $GLOBALS['__request'] = $request; // hack for pre 1.5.0 - drak $coreInitEvent = new GenericEvent($this); // store the load stages in a global so other API's can check whats loaded $this->stage = $this->stage | $stage; if ($stage & self::STAGE_PRE && $this->stage & ~self::STAGE_PRE) { ModUtil::flushCache(); System::flushCache(); $args = !System::isInstalling() ? array('lazy' => true) : array(); $this->dispatcher->dispatch('core.preinit', new GenericEvent($this, $args)); } // Initialise and load configuration if ($stage & self::STAGE_CONFIG) { // for BC only. remove this code in 2.0.0 if (!System::isInstalling()) { $this->dispatcher->dispatch('setup.errorreporting', new GenericEvent(null, array('stage' => $stage))); } // initialise custom event listeners from config.php settings $coreInitEvent->setArgument('stage', self::STAGE_CONFIG); /*************************************************** * NOTE: this event is monitored by * \Zikula\Bundle\CoreInstallerBundle\EventListener\InstallUpgradeCheckListener * to see if install or upgrade is needed ***************************************************/ $this->dispatcher->dispatch('core.init', $coreInitEvent); } if ($stage & self::STAGE_DB) { try { $dbEvent = new GenericEvent($this, array('stage' => self::STAGE_DB)); $this->dispatcher->dispatch('core.init', $dbEvent); } catch (PDOException $e) { if (!System::isInstalling()) { header('HTTP/1.1 503 Service Unavailable'); require_once System::getSystemErrorTemplate('dbconnectionerror.tpl'); System::shutDown(); } else { return false; } } } if ($stage & self::STAGE_TABLES) { // Initialise dbtables ModUtil::dbInfoLoad('ZikulaExtensionsModule', 'ZikulaExtensionsModule'); ModUtil::initCoreVars(); ModUtil::dbInfoLoad('ZikulaSettingsModule', 'ZikulaSettingsModule'); ModUtil::dbInfoLoad('ZikulaThemeModule', 'ZikulaThemeModule'); ModUtil::dbInfoLoad('ZikulaUsersModule', 'ZikulaUsersModule'); ModUtil::dbInfoLoad('ZikulaGroupsModule', 'ZikulaGroupsModule'); ModUtil::dbInfoLoad('ZikulaPermissionsModule', 'ZikulaPermissionsModule'); ModUtil::dbInfoLoad('ZikulaCategoriesModule', 'ZikulaCategoriesModule'); // Add AutoLoading for non-symfony 1.3 modules in /modules if (!System::isInstalling()) { ModUtil::registerAutoloaders(); } $coreInitEvent->setArgument('stage', self::STAGE_TABLES); $this->dispatcher->dispatch('core.init', $coreInitEvent); } if ($stage & self::STAGE_SESSIONS) { // SessionUtil::requireSession(); $coreInitEvent->setArgument('stage', self::STAGE_SESSIONS); $this->dispatcher->dispatch('core.init', $coreInitEvent); } // Have to load in this order specifically since we cant setup the languages until we've decoded the URL if required (drak) // start block if ($stage & self::STAGE_LANGS) { $lang = ZLanguage::getInstance(); } if ($stage & self::STAGE_DECODEURLS) { System::queryStringDecode($request); $coreInitEvent->setArgument('stage', self::STAGE_DECODEURLS); $this->dispatcher->dispatch('core.init', $coreInitEvent); } if ($stage & self::STAGE_LANGS) { $lang->setup($request); $coreInitEvent->setArgument('stage', self::STAGE_LANGS); $this->dispatcher->dispatch('core.init', $coreInitEvent); } // end block if ($stage & self::STAGE_MODS) { if (!System::isInstalling()) { ModUtil::load('ZikulaSecurityCenterModule'); } $coreInitEvent->setArgument('stage', self::STAGE_MODS); $this->dispatcher->dispatch('core.init', $coreInitEvent); } if ($stage & self::STAGE_THEME) { // register default page vars PageUtil::registerVar('polyfill_features', true); PageUtil::registerVar('title'); PageUtil::setVar('title', System::getVar('defaultpagetitle')); PageUtil::registerVar('keywords', true); PageUtil::registerVar('stylesheet', true); PageUtil::registerVar('javascript', true); PageUtil::registerVar('jsgettext', true); PageUtil::registerVar('body', true); PageUtil::registerVar('header', true); PageUtil::registerVar('footer', true); // set some defaults // Metadata for SEO $this->container->setParameter('zikula_view.metatags', array('description' => System::getVar('defaultmetadescription'), 'keywords' => System::getVar('metakeywords'))); $coreInitEvent->setArgument('stage', self::STAGE_THEME); $this->dispatcher->dispatch('core.init', $coreInitEvent); } // check the users status, if not 1 then log him out if (!System::isInstalling() && UserUtil::isLoggedIn()) { $userstatus = UserUtil::getVar('activated'); if ($userstatus != Users_Constant::ACTIVATED_ACTIVE) { UserUtil::logout(); // TODO - When getting logged out this way, the existing session is destroyed and // then a new one is created on the reentry into index.php. The message // set by the registerStatus call below gets lost. LogUtil::registerStatus(__('You have been logged out.')); System::redirect(ModUtil::url('ZikulaUsersModule', 'user', 'login')); } } if ($stage & self::STAGE_POST && $this->stage & ~self::STAGE_POST) { $this->dispatcher->dispatch('core.postinit', new GenericEvent($this, array('stages' => $stage))); } }
/** * Initialise Zikula. * * Carries out a number of initialisation tasks to get Zikula up and * running. * * @param integer $stage Stage to load. * @param Zikula_Request_Http $request * * @return boolean True initialisation successful false otherwise. */ public function init($stage = self::STAGE_ALL, Request $request) { $GLOBALS['__request'] = $request; // hack for pre 1.5.0 - drak $coreInitEvent = new GenericEvent($this); // store the load stages in a global so other API's can check whats loaded $this->stage = $this->stage | $stage; if ($stage & self::STAGE_PRE && $this->stage & ~self::STAGE_PRE) { ModUtil::flushCache(); System::flushCache(); $args = !System::isInstalling() ? array('lazy' => true) : array(); $this->dispatcher->dispatch('core.preinit', new GenericEvent($this, $args)); } // Initialise and load configuration if ($stage & self::STAGE_CONFIG) { // for BC only. remove this code in 2.0.0 if (!System::isInstalling()) { $this->dispatcher->dispatch('setup.errorreporting', new GenericEvent(null, array('stage' => $stage))); } // initialise custom event listeners from config.php settings $coreInitEvent->setArgument('stage', self::STAGE_CONFIG); $this->dispatcher->dispatch('core.init', $coreInitEvent); } // create several booleans to test condition of request regrading install/upgrade $installed = $this->getContainer()->getParameter('installed'); if ($installed) { self::defineCurrentInstalledCoreVersion($this->getContainer()); } $requiresUpgrade = $installed && version_compare(ZIKULACORE_CURRENT_INSTALLED_VERSION, self::VERSION_NUM, '<'); // can't use $request->get('_route') to get any of the following // all these routes are hard-coded in xml files $uriContainsInstall = strpos($request->getRequestUri(), '/install') !== false; $uriContainsUpgrade = strpos($request->getRequestUri(), '/upgrade') !== false; $uriContainsDoc = strpos($request->getRequestUri(), '/installdoc') !== false; $uriContainsWdt = strpos($request->getRequestUri(), '/_wdt') !== false; $uriContainsProfiler = strpos($request->getRequestUri(), '/_profiler') !== false; $uriContainsRouter = strpos($request->getRequestUri(), '/js/routing?callback=fos.Router.setData') !== false; $doNotRedirect = $uriContainsProfiler || $uriContainsWdt || $uriContainsRouter || $request->isXmlHttpRequest(); // check if Zikula Core is not installed if (!$installed && !$uriContainsDoc && !$uriContainsInstall && !$doNotRedirect) { $this->container->get('router')->getContext()->setBaseUrl($request->getBasePath()); // compensate for sub-directory installs $url = $this->container->get('router')->generate('install'); $response = new RedirectResponse($url); $response->send(); System::shutDown(); } // check if Zikula Core requires upgrade if ($requiresUpgrade && !$uriContainsDoc && !$uriContainsUpgrade && !$doNotRedirect) { $this->container->get('router')->getContext()->setBaseUrl($request->getBasePath()); // compensate for sub-directory installs $url = $this->container->get('router')->generate('upgrade'); $response = new RedirectResponse($url); $response->send(); System::shutDown(); } if (!$installed || $requiresUpgrade || $this->getContainer()->hasParameter('upgrading')) { System::setInstalling(true); } if ($stage & self::STAGE_DB) { try { $dbEvent = new GenericEvent($this, array('stage' => self::STAGE_DB)); $this->dispatcher->dispatch('core.init', $dbEvent); } catch (PDOException $e) { if (!System::isInstalling()) { header('HTTP/1.1 503 Service Unavailable'); require_once System::getSystemErrorTemplate('dbconnectionerror.tpl'); System::shutDown(); } else { return false; } } } if ($stage & self::STAGE_TABLES) { // Initialise dbtables ModUtil::dbInfoLoad('ZikulaExtensionsModule', 'ZikulaExtensionsModule'); ModUtil::initCoreVars(); ModUtil::dbInfoLoad('ZikulaSettingsModule', 'ZikulaSettingsModule'); ModUtil::dbInfoLoad('ZikulaThemeModule', 'ZikulaThemeModule'); ModUtil::dbInfoLoad('ZikulaUsersModule', 'ZikulaUsersModule'); ModUtil::dbInfoLoad('ZikulaGroupsModule', 'ZikulaGroupsModule'); ModUtil::dbInfoLoad('ZikulaPermissionsModule', 'ZikulaPermissionsModule'); ModUtil::dbInfoLoad('ZikulaCategoriesModule', 'ZikulaCategoriesModule'); // Add AutoLoading for non-symfony 1.3 modules in /modules if (!System::isInstalling()) { ModUtil::registerAutoloaders(); } $coreInitEvent->setArgument('stage', self::STAGE_TABLES); $this->dispatcher->dispatch('core.init', $coreInitEvent); } if ($stage & self::STAGE_SESSIONS) { // SessionUtil::requireSession(); $coreInitEvent->setArgument('stage', self::STAGE_SESSIONS); $this->dispatcher->dispatch('core.init', $coreInitEvent); } // Have to load in this order specifically since we cant setup the languages until we've decoded the URL if required (drak) // start block if ($stage & self::STAGE_LANGS) { $lang = ZLanguage::getInstance(); } if ($stage & self::STAGE_DECODEURLS) { System::queryStringDecode($request); $coreInitEvent->setArgument('stage', self::STAGE_DECODEURLS); $this->dispatcher->dispatch('core.init', $coreInitEvent); } if ($stage & self::STAGE_LANGS) { $lang->setup($request); $coreInitEvent->setArgument('stage', self::STAGE_LANGS); $this->dispatcher->dispatch('core.init', $coreInitEvent); } // end block if ($stage & self::STAGE_MODS) { if (!System::isInstalling()) { ModUtil::load('ZikulaSecurityCenterModule'); } $coreInitEvent->setArgument('stage', self::STAGE_MODS); $this->dispatcher->dispatch('core.init', $coreInitEvent); } if ($stage & self::STAGE_THEME) { // register default page vars PageUtil::registerVar('polyfill_features', true); PageUtil::registerVar('title'); PageUtil::setVar('title', System::getVar('defaultpagetitle')); PageUtil::registerVar('keywords', true); PageUtil::registerVar('stylesheet', true); PageUtil::registerVar('javascript', true); PageUtil::registerVar('jsgettext', true); PageUtil::registerVar('body', true); PageUtil::registerVar('header', true); PageUtil::registerVar('footer', true); // set some defaults // Metadata for SEO $this->container->setParameter('zikula_view.metatags', array('description' => System::getVar('defaultmetadescription'), 'keywords' => System::getVar('metakeywords'))); $coreInitEvent->setArgument('stage', self::STAGE_THEME); $this->dispatcher->dispatch('core.init', $coreInitEvent); } // check the users status, if not 1 then log him out if (!System::isInstalling() && UserUtil::isLoggedIn()) { $userstatus = UserUtil::getVar('activated'); if ($userstatus != Users_Constant::ACTIVATED_ACTIVE) { UserUtil::logout(); // TODO - When getting logged out this way, the existing session is destroyed and // then a new one is created on the reentry into index.php. The message // set by the registerStatus call below gets lost. LogUtil::registerStatus(__('You have been logged out.')); System::redirect(ModUtil::url('ZikulaUsersModule', 'user', 'login')); } } if ($stage & self::STAGE_POST && $this->stage & ~self::STAGE_POST) { $this->dispatcher->dispatch('core.postinit', new GenericEvent($this, array('stages' => $stage))); } }