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


PHP cmsUser::logout方法代码示例

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


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

示例1: actionLogout

 public function actionLogout()
 {
     cmsEventsManager::hook('auth_logout', cmsUser::getInstance()->id);
     cmsUser::logout();
     $this->redirectToHome();
     $this->halt();
 }
开发者ID:asphix,项目名称:icms2,代码行数:7,代码来源:frontend.php

示例2: run

 public function run()
 {
     if (cmsUser::isLogged()) {
         $this->redirectToHome();
     }
     $email = $this->request->get('login_email');
     $password = $this->request->get('login_password');
     $remember = (bool) $this->request->get('remember');
     $back_url = $this->request->has('back') ? $this->request->get('back') : false;
     $is_site_offline = !cmsConfig::get('is_site_on');
     if ($this->request->has('submit')) {
         $is_captcha_valid = true;
         if (cmsUser::sessionGet('is_auth_captcha') && $this->options['auth_captcha']) {
             $is_captcha_valid = cmsEventsManager::hook('captcha_validate', $this->request);
         }
         if ($is_captcha_valid) {
             cmsUser::sessionUnset('is_auth_captcha');
             $logged_id = cmsUser::login($email, $password, $remember);
             if ($logged_id) {
                 if ($is_site_offline) {
                     $userSession = cmsUser::sessionGet('user');
                     if (!$userSession['is_admin']) {
                         cmsUser::addSessionMessage(LANG_LOGIN_ADMIN_ONLY, 'error');
                         cmsUser::logout();
                         $this->redirectBack();
                     }
                 }
                 cmsEventsManager::hook('auth_login', $logged_id);
                 $is_back = $this->request->get('is_back');
                 if ($is_back) {
                     $this->redirectBack();
                 }
                 if ($back_url) {
                     $this->redirect($back_url);
                 } else {
                     $this->redirectToHome();
                 }
             }
         }
         if ($this->options['auth_captcha'] && !$is_site_offline) {
             cmsUser::sessionSet('is_auth_captcha', true);
         }
         if ($is_captcha_valid) {
             cmsUser::addSessionMessage(LANG_LOGIN_ERROR, 'error');
             if ($is_site_offline) {
                 $this->redirectBack();
             }
         } else {
             cmsUser::addSessionMessage(LANG_CAPTCHA_ERROR, 'error');
         }
     }
     if ($back_url) {
         cmsUser::addSessionMessage(LANG_LOGIN_REQUIRED, 'error');
     }
     if (cmsUser::sessionGet('is_auth_captcha')) {
         $captcha_html = cmsEventsManager::hook('captcha_html');
     }
     return cmsTemplate::getInstance()->render('login', array('back_url' => $back_url, 'captcha_html' => isset($captcha_html) ? $captcha_html : false));
 }
开发者ID:asphix,项目名称:icms2,代码行数:59,代码来源:login.php

示例3: actionLogout

 public function actionLogout()
 {
     cmsEventsManager::hook('auth_logout', $this->cms_user->id);
     cmsUser::logout();
     if (!function_exists('get_headers')) {
         $this->redirectToHome();
     }
     $back_url = $this->getBackURL();
     $h = get_headers($this->getBackURL(), true);
     $code = substr($h[0], 9, 3);
     if ((int) $code < 400) {
         $this->redirect($back_url);
     }
     $this->redirectToHome();
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:15,代码来源:frontend.php

示例4: logoutLockedUser

 public function logoutLockedUser($user)
 {
     $now = time();
     $lock_until = !empty($user['lock_until']) ? strtotime($user['lock_until']) : false;
     if ($lock_until && $lock_until <= $now) {
         $this->model->unlockUser($user['id']);
         return;
     }
     $notice_text = array();
     $notice_text[] = sprintf(LANG_USERS_LOCKED_NOTICE);
     if ($user['lock_until']) {
         $notice_text[] = sprintf(LANG_USERS_LOCKED_NOTICE_UNTIL, html_date($user['lock_until']));
     }
     if ($user['lock_reason']) {
         $notice_text[] = sprintf(LANG_USERS_LOCKED_NOTICE_REASON, $user['lock_reason']);
     }
     $notice_text = implode('<br>', $notice_text);
     cmsUser::addSessionMessage($notice_text, 'error');
     cmsUser::logout();
     return;
 }
开发者ID:bitbybit,项目名称:icms2,代码行数:21,代码来源:frontend.php

示例5: run

 public function run()
 {
     if (cmsUser::isLogged()) {
         $this->redirectToHome();
     }
     $email = $this->request->get('login_email', '');
     $password = $this->request->get('login_password', '');
     $remember = (bool) $this->request->get('remember');
     $back_url = $this->request->get('back', '');
     $is_site_offline = !cmsConfig::get('is_site_on');
     $is_submit = $this->request->has('submit');
     if ($is_submit) {
         $is_captcha_valid = true;
         if (cmsUser::sessionGet('is_auth_captcha') && $this->options['auth_captcha']) {
             $is_captcha_valid = cmsEventsManager::hook('captcha_validate', $this->request);
         }
         if ($is_captcha_valid) {
             cmsUser::sessionUnset('is_auth_captcha');
             $logged_id = cmsUser::login($email, $password, $remember);
             if ($logged_id) {
                 if ($is_site_offline) {
                     $userSession = cmsUser::sessionGet('user');
                     if (!$userSession['is_admin']) {
                         cmsUser::addSessionMessage(LANG_LOGIN_ADMIN_ONLY, 'error');
                         cmsUser::logout();
                         $this->redirectBack();
                     }
                 }
                 cmsEventsManager::hook('auth_login', $logged_id);
                 $auth_redirect = $this->options['auth_redirect'];
                 $is_first_auth = cmsUser::getUPS('first_auth', $logged_id);
                 if ($is_first_auth) {
                     $auth_redirect = $this->options['first_auth_redirect'];
                     cmsUser::deleteUPS('first_auth', $logged_id);
                 }
                 if ($back_url) {
                     $this->redirect($back_url);
                 } else {
                     $this->redirect($this->getAuthRedirectUrl($auth_redirect));
                 }
             }
         }
         if ($this->options['auth_captcha'] && !$is_site_offline) {
             cmsUser::sessionSet('is_auth_captcha', true);
         }
         if ($is_captcha_valid) {
             cmsUser::addSessionMessage(LANG_LOGIN_ERROR, 'error');
             if ($is_site_offline) {
                 $this->redirectBack();
             }
         } else {
             cmsUser::addSessionMessage(LANG_CAPTCHA_ERROR, 'error');
         }
         if ($this->options['auth_redirect'] == 'none' || !empty($is_first_auth) && $this->options['first_auth_redirect'] == 'none') {
             if (!$back_url) {
                 $back_url = $this->getBackURL();
             }
         }
     }
     if ($back_url && !$is_submit) {
         cmsUser::addSessionMessage(LANG_LOGIN_REQUIRED, 'error');
     }
     if (cmsUser::sessionGet('is_auth_captcha')) {
         $captcha_html = cmsEventsManager::hook('captcha_html');
     }
     return $this->cms_template->render('login', array('back_url' => $back_url, 'captcha_html' => isset($captcha_html) ? $captcha_html : false));
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:67,代码来源:login.php


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