本文整理汇总了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();
}
示例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));
}
示例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();
}
示例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;
}
示例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));
}