当前位置: 首页>>代码示例>>PHP>>正文


PHP UserUtil::logout方法代码示例

本文整理汇总了PHP中UserUtil::logout方法的典型用法代码示例。如果您正苦于以下问题:PHP UserUtil::logout方法的具体用法?PHP UserUtil::logout怎么用?PHP UserUtil::logout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserUtil的用法示例。


在下文中一共展示了UserUtil::logout方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: siteOff

 /**
  * Listens for 'frontcontroller.predispatch'.
  *
  * @param Zikula_Event $event
  *
  * @return void
  */
 public function siteOff(Zikula_Event $event)
 {
     // Get variables
     $module = FormUtil::getPassedValue('module', '', 'GETPOST', FILTER_SANITIZE_STRING);
     $func = FormUtil::getPassedValue('func', '', 'GETPOST', FILTER_SANITIZE_STRING);
     // Check for site closed
     if (System::getVar('siteoff') && !SecurityUtil::checkPermission('Settings::', 'SiteOff::', ACCESS_ADMIN) && !($module == 'Users' && $func == 'siteofflogin') || Zikula_Core::VERSION_NUM != System::getVar('Version_Num')) {
         if (SecurityUtil::checkPermission('Users::', '::', ACCESS_OVERVIEW) && UserUtil::isLoggedIn()) {
             UserUtil::logout();
         }
         header('HTTP/1.1 503 Service Unavailable');
         require_once System::getSystemErrorTemplate('siteoff.tpl');
         System::shutdown();
     }
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:22,代码来源:SystemListeners.php

示例2: onKernelRequestSiteOff

 public function onKernelRequestSiteOff(GetResponseEvent $event)
 {
     if (!$event->isMasterRequest()) {
         return;
     }
     $response = $event->getResponse();
     $request = $event->getRequest();
     if ($response instanceof PlainResponse || $response instanceof JsonResponse || $request->isXmlHttpRequest()) {
         return;
     }
     if (\System::isInstalling()) {
         return;
     }
     // Get variables
     $module = strtolower($request->query->get('module'));
     $type = strtolower($request->query->get('type'));
     $func = strtolower($request->query->get('func'));
     $siteOff = (bool) \System::getVar('siteoff');
     $hasAdminPerms = \SecurityUtil::checkPermission('ZikulaSettingsModule::', 'SiteOff::', ACCESS_ADMIN);
     $urlParams = $module == 'users' && $type == 'user' && $func == 'siteofflogin';
     // params are lowercase
     $versionCheck = \Zikula_Core::VERSION_NUM != \System::getVar('Version_Num');
     // Check for site closed
     if ($siteOff && !$hasAdminPerms && !$urlParams || $versionCheck) {
         $hasOnlyOverviewAccess = \SecurityUtil::checkPermission('ZikulaUsersModule::', '::', ACCESS_OVERVIEW);
         if ($hasOnlyOverviewAccess && \UserUtil::isLoggedIn()) {
             \UserUtil::logout();
         }
         // initialise the language system to enable translations (#1764)
         $lang = \ZLanguage::getInstance();
         $lang->setup($request);
         $response = new Response();
         $response->headers->add(array('HTTP/1.1 503 Service Unavailable'));
         $response->setStatusCode(503);
         $content = (require_once \System::getSystemErrorTemplate('siteoff.tpl'));
         // move to CoreBundle and use Twig
         $response->setContent($content);
         $event->setResponse($response);
         $event->stopPropagation();
     }
 }
开发者ID:rmaiwald,项目名称:core,代码行数:41,代码来源:SiteOffListener.php

示例3: init


//.........这里部分代码省略.........
     // 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)));
     }
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:101,代码来源:Core.php

示例4: die

 * @license GNU/LGPLv3 (or at your option, any later version).
 * @package Zikula
 *
 * Please see the NOTICE file distributed with this source code for further
 * information regarding copyright and licensing.
 */
include 'lib/bootstrap.php';
$core->init(Zikula_Core::STAGE_ALL | Zikula_Core::STAGE_AJAX & ~Zikula_Core::STAGE_DECODEURLS);
// Get variables
$module = FormUtil::getPassedValue('module', '', 'GETPOST', FILTER_SANITIZE_STRING);
$type = FormUtil::getPassedValue('type', 'ajax', 'GETPOST', FILTER_SANITIZE_STRING);
$func = FormUtil::getPassedValue('func', '', 'GETPOST', FILTER_SANITIZE_STRING);
// Check for site closed
if (System::getVar('siteoff') && !SecurityUtil::checkPermission('Settings::', 'SiteOff::', ACCESS_ADMIN) && !($module == 'Users' && $func == 'siteofflogin')) {
    if (SecurityUtil::checkPermission('Users::', '::', ACCESS_OVERVIEW) && UserUtil::isLoggedIn()) {
        UserUtil::logout();
    }
    die(new Zikula_Response_Ajax_Unavailable(__('The site is currently off-line.')));
}
if (empty($func)) {
    die(new Zikula_Response_Ajax_NotFound(__f("Missing parameter '%s'", 'func')));
}
// get module information
$modinfo = ModUtil::getInfoFromName($module);
if ($modinfo == false) {
    die(new Zikula_Response_Ajax_NotFound(__f("Error! The '%s' module is unknown.", DataUtil::formatForDisplay($module))));
}
if (!ModUtil::available($modinfo['name'])) {
    die(new Zikula_Response_Ajax_NotFound(__f("Error! The '%s' module is not available.", DataUtil::formatForDisplay($module))));
}
if (!ModUtil::load($modinfo['name'], $type)) {
开发者ID:projectesIF,项目名称:Sirius,代码行数:31,代码来源:ajax.php

示例5: updateconfig

    /**
     * This is a standard function to update the configuration parameters of the
     * module given the information passed back by the modification form
     * @see securitycenter_admin_modifyconfig()
     *
     * @param int enableanticracker
     * @param int itemsperpage
     * @param int emailhackattempt
     * @param int loghackattempttodb
     * @param int onlysendsummarybyemail
     * @param int updatecheck
     * @param int updatefrequency
     * @param int keyexpiry
     * @param int sessionauthkeyua
     * @param string secure_domain
     * @param int signcookies
     * @param string signingkey
     * @param string seclevel
     * @param int secmeddays
     * @param int secinactivemins
     * @param int sessionstoretofile
     * @param string sessionsavepath
     * @param int gc_probability
     * @param int anonymoussessions
     * @param int sessionrandregenerate
     * @param int sessionregenerate
     * @param int sessionregeneratefreq
     * @param int sessionipcheck
     * @param string sessionname
     * @param int filtergetvars
     * @param int filterpostvars
     * @param int filtercookievars
     * @param int outputfilter
     * @param string summarycontent
     * @param string fullcontent
     *
     * @return bool true if successful, false otherwise.
     */
    public function updateconfig()
    {
        $this->checkCsrfToken();

        // Security check
        if (!SecurityUtil::checkPermission('SecurityCenter::', '::', ACCESS_ADMIN)) {
            return LogUtil::registerPermissionError();
        }

        $validates = true;

        // Update module variables.
        $updatecheck = (int)FormUtil::getPassedValue('updatecheck', 0, 'POST');
        System::setVar('updatecheck', $updatecheck);

        // if update checks are disabled, reset values to force new update check if re-enabled
        if ($updatecheck == 0) {
            System::setVar('updateversion', Zikula_Core::VERSION_NUM);
            System::setVar('updatelastchecked', 0);
        }

        $updatefrequency = (int)FormUtil::getPassedValue('updatefrequency', 30, 'POST');
        System::setVar('updatefrequency', $updatefrequency);

        $keyexpiry = (int)FormUtil::getPassedValue('keyexpiry', 0, 'POST');
        if ($keyexpiry < 0 || $keyexpiry > 3600) {
            $keyexpiry = 0;
        }
        System::setVar('keyexpiry', $keyexpiry);

        $sessionauthkeyua = (int)FormUtil::getPassedValue('sessionauthkeyua', 0, 'POST');
        System::setVar('sessionauthkeyua', $sessionauthkeyua);

        $secure_domain = FormUtil::getPassedValue('secure_domain', '', 'POST');
        System::setVar('secure_domain', $secure_domain);

        $signcookies = (int)FormUtil::getPassedValue('signcookies', 1, 'POST');
        System::setVar('signcookies', $signcookies);

        $signingkey = FormUtil::getPassedValue('signingkey', '', 'POST');
        System::setVar('signingkey', $signingkey);

        $seclevel = FormUtil::getPassedValue('seclevel', 'High', 'POST');
        System::setVar('seclevel', $seclevel);

        $secmeddays = (int)FormUtil::getPassedValue('secmeddays', 7, 'POST');
        if ($secmeddays < 1 || $secmeddays > 365) {
            $secmeddays = 7;
        }
        System::setVar('secmeddays', $secmeddays);

        $secinactivemins = (int)FormUtil::getPassedValue('secinactivemins', 20, 'POST');
        if ($secinactivemins < 1 || $secinactivemins > 1440) {
            $secinactivemins = 7;
        }
        System::setVar('secinactivemins', $secinactivemins);

        $sessionstoretofile = (int)FormUtil::getPassedValue('sessionstoretofile', 0, 'POST');
        $sessionsavepath = FormUtil::getPassedValue('sessionsavepath', '', 'POST');

        // check session path config is writable (if method is being changed to session file storage)
        $cause_logout = false;
//.........这里部分代码省略.........
开发者ID:projectesIF,项目名称:Sirius,代码行数:101,代码来源:Admin.php

示例6: onInit


//.........这里部分代码省略.........
     //        }
     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());
 }
开发者ID:planetenkiller,项目名称:core,代码行数:101,代码来源:InitListener.php

示例7: init


//.........这里部分代码省略.........
         /***************************************************
          * 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)));
     }
 }
开发者ID:Silwereth,项目名称:core,代码行数:101,代码来源:Core.php

示例8: init


//.........这里部分代码省略.........
         $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)));
     }
 }
开发者ID:rojblake,项目名称:core,代码行数:101,代码来源:Core.php

示例9: siteOffLogin

    /**
     * Log into a site that is currently "off" (normal logins are not allowed).
     *
     * Allows the administrator to access the site during maintenance.
     *
     * Parameters passed via GET:
     * --------------------------
     * None.
     *
     * Parameters passed via POST:
     * ---------------------------
     * string  user       The user name of the user attempting to log in.
     * string  pass       The password of the user attempting to log in.
     * boolean rememberme Whether the login session should persist.
     *
     * Parameters passed via SESSION:
     * ------------------------------
     * None.
     *
     * @return bool True.
     */
    public function siteOffLogin()
    {
        // do not process if the site is enabled
        $this->redirectIf(!System::getVar('siteoff', false), System::getHomepageUrl());

        if ($this->request->isPost()) {
            $user = $this->request->request->get('user', null);
            $pass = $this->request->request->get('pass', null);
            $rememberme = $this->request->request->get('rememberme', false);
        } else {
            throw new Zikula_Exception_Forbidden();
        }

        $redirectUrl = System::getHomepageUrl();

        $authenticationInfo = array(
            'login_id'  => $user,
            'pass'      => $pass
        );
        $authenticationMethod = array(
            'modname'   => $this->name,
            'method'    => 'uname',
        );

        if (UserUtil::loginUsing($authenticationMethod, $authenticationInfo, $rememberme)) {
            $user = UserUtil::getVars(UserUtil::getVar('uid'));
            if (!SecurityUtil::checkPermission('Settings::', 'SiteOff::', ACCESS_ADMIN)) {
                UserUtil::logout();

                $eventArgs = array(
                    'authentication_method' => $authenticationMethod,
                    'redirecturl'           => '',
                );
                $event = new Zikula_Event('module.users.ui.login.failed', $user, $eventArgs);
                $event = $this->eventManager->notify($event);
                $redirectUrl = $event->hasArg('redirecturl') ? $event->getArg('redirecturl') : $redirectUrl;
            } else {
                $eventArgs = array(
                    'authentication_method' => $authenticationMethod,
                    'redirecturl'           => $redirectUrl,
                );
                $event = new Zikula_Event('module.users.ui.login.succeeded', $user, $eventArgs);
                $event = $this->eventManager->notify($event);
                $redirectUrl = $event->hasArg('redirecturl') ? $event->getArg('redirecturl') : $redirectUrl;
            }
        } else {
            $eventArgs = array(
                'authentication_method' => $authenticationMethod,
                'authentication_info'   => $authenticationInfo,
                'redirecturl'           => '',
            );
            $event = new Zikula_Event('module.users.ui.login.failed', null, $eventArgs);
            $event = $this->eventManager->notify($event);
            $redirectUrl = $event->hasArg('redirecturl') ? $event->getArg('redirecturl') : '';
        }

        $this->redirect($redirectUrl);
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:79,代码来源:User.php


注:本文中的UserUtil::logout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。