當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CWebUser::logout方法代碼示例

本文整理匯總了PHP中CWebUser::logout方法的典型用法代碼示例。如果您正苦於以下問題:PHP CWebUser::logout方法的具體用法?PHP CWebUser::logout怎麽用?PHP CWebUser::logout使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CWebUser的用法示例。


在下文中一共展示了CWebUser::logout方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: logout

 /**
  * Logout Function
  * @param boolean $destroySession destroy the session or not
  */
 public function logout($destroySession = true)
 {
     // I always remove the session variable model.
     Yii::app()->getSession()->remove('current_user');
     Yii::app()->session->clear();
     Yii::app()->session->destroy();
     parent::logout();
 }
開發者ID:nganhtuan63,項目名稱:gxc-cms,代碼行數:12,代碼來源:GxcUser.php

示例2: testLoginLogout

 /**
  * @runInSeparateProcess
  * @outputBuffering enabled
  * @dataProvider booleanProvider
  */
 public function testLoginLogout($destroySession)
 {
     $identity = new CUserIdentity('testUser', 'testPassword');
     $user = new CWebUser();
     $user->init();
     // be guest before login
     $this->assertTrue($user->isGuest);
     // do a login
     $this->assertTrue($user->login($identity));
     // don't be guest after login
     $this->assertFalse($user->isGuest);
     $this->assertEquals('testUser', $user->getId());
     $this->assertEquals('testUser', $user->getName());
     $user->logout($destroySession);
     // be guest after logout
     $this->assertNull($user->getId());
     $this->assertEquals($user->guestName, $user->getName());
 }
開發者ID:super-d2,項目名稱:codeigniter_demo,代碼行數:23,代碼來源:CWebUserTest.php

示例3: logout

 /**
  * This is here since there is a bug with cookies
  * that have been saved to a domain name such as
  * .domain.com so all subdomains can access it as well
  * @see http://code.google.com/p/yii/issues/detail?id=856
  */
 public function logout($destroySession = true)
 {
     if ($this->allowAutoLogin && isset($this->identityCookie['domain'])) {
         $cookies = Yii::app()->getRequest()->getCookies();
         if (null !== ($cookie = $cookies[$this->getStateKeyPrefix()])) {
             $originalCookie = new CHttpCookie($cookie->name, $cookie->value);
             $cookie->domain = $this->identityCookie['domain'];
             $cookies->remove($this->getStateKeyPrefix());
             $cookies->add($originalCookie->name, $originalCookie);
         }
         // Remove Roles
         $assigned_roles = Yii::app()->authManager->getRoles(Yii::app()->user->id);
         if (!empty($assigned_roles)) {
             $auth = Yii::app()->authManager;
             foreach ($assigned_roles as $n => $role) {
                 if ($auth->revoke($n, Yii::app()->user->id)) {
                     Yii::app()->authManager->save();
                 }
             }
         }
     }
     parent::logout($destroySession);
 }
開發者ID:hansenmakangiras,項目名稱:yiiframework-cms,代碼行數:29,代碼來源:CustomWebUser.php

示例4: logout

 public function logout($destroySession = true)
 {
     $result = false;
     $usersession = $this->getICrugeSession();
     if ($usersession != null) {
         $filtro = $this->getum()->getSessionFilter();
         $usersession->logout();
         if ($filtro->onStore($usersession)) {
             $filtro->onLogout($usersession);
             $result = true;
         } else {
             Yii::log(CHtml::errorSummary($usersession, "error al guardar una sesion"), "error");
             $this->_lastError = CrugeTranslator::t("Error al almacenar sesion");
         }
     }
     parent::logout($destroySession);
     return $result;
 }
開發者ID:AndressJose,項目名稱:bolsa-proyecto-integrado,代碼行數:18,代碼來源:CrugeWebUser.php

示例5: logout

 public function logout($destroySession = true)
 {
     $result = false;
     $usersession = $this->getICrugeSession();
     if ($usersession != null) {
         $filtro = $this->getum()->getSessionFilter();
         // para compatibilidad con anteriores versiones del filtro
         if (method_exists($filtro, 'onBeforeLogout')) {
             if ($filtro->onBeforeLogout($usersession) == false) {
                 return false;
             }
         }
         $usersession->logout();
         if ($filtro->onStore($usersession)) {
             $filtro->onLogout($usersession);
             $result = true;
         } else {
             Yii::log(CHtml::errorSummary($usersession, "error al guardar una sesion"), "error");
             $this->_lastError = CrugeTranslator::t("Error al almacenar sesion");
         }
     }
     parent::logout($destroySession);
     return $result;
 }
開發者ID:Telemedellin,項目名稱:tm,代碼行數:24,代碼來源:CrugeWebUser.php

示例6: define

**/
define('ZBX_PAGE_NO_AUTHORIZATION', true);
define('ZBX_NOT_ALLOW_ALL_NODES', true);
define('ZBX_HIDE_NODE_SELECTION', true);
define('ZBX_PAGE_NO_MENU', true);
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/forms.inc.php';
$page['title'] = _('ZABBIX');
$page['file'] = 'index.php';
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('name' => array(T_ZBX_STR, O_NO, null, NOT_EMPTY, 'isset({enter})', _('Username')), 'password' => array(T_ZBX_STR, O_OPT, null, null, 'isset({enter})'), 'sessionid' => array(T_ZBX_STR, O_OPT, null, null, null), 'reconnect' => array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0, 65535), null), 'enter' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'autologin' => array(T_ZBX_INT, O_OPT, null, null, null), 'request' => array(T_ZBX_STR, O_OPT, null, null, null));
check_fields($fields);
// logout
if (isset($_REQUEST['reconnect'])) {
    add_audit(AUDIT_ACTION_LOGOUT, AUDIT_RESOURCE_USER, _('Manual Logout'));
    CWebUser::logout();
}
$config = select_config();
if ($config['authentication_type'] == ZBX_AUTH_HTTP) {
    if (!empty($_SERVER['PHP_AUTH_USER'])) {
        $_REQUEST['enter'] = _('Sign in');
        $_REQUEST['name'] = $_SERVER['PHP_AUTH_USER'];
    } else {
        access_deny();
    }
}
// login via form
if (isset($_REQUEST['enter']) && $_REQUEST['enter'] == _('Sign in')) {
    // try to login
    if (CWebUser::login(get_request('name', ''), get_request('password', ''))) {
        // save remember login preference
開發者ID:quanta-computing,項目名稱:debian-packages,代碼行數:31,代碼來源:index.php

示例7: logout

 /**
  * Logouts user and sends some goodbye messages.
  *
  * @param bool $destroySession Whether to destroy session or not. Please
  *                             note that if set to true, messages will be
  *                             muted and `$mute` flag won't have any effect.
  * @param bool $mute           Controls user flash messages generation.
  *
  * @return void
  * @since 0.1.0
  */
 public function logout($destroySession = false, $mute = false)
 {
     if ($this->getIsGuest()) {
         if (!$destroySession && !$mute) {
             $this->sendErrorMessage('auth.logout.guestAttempt');
         }
         return;
     }
     parent::logout($destroySession);
     if (!$mute) {
         $this->sendNotice('auth.logout.goodbye');
     }
 }
開發者ID:EhteshamMehmood,項目名稱:BlogMVC,代碼行數:24,代碼來源:WebUserLayer.php

示例8: logout

 /**
  * @param boolean
  */
 public function logout($destroySession = true)
 {
     parent::logout($destroySession);
 }
開發者ID:jasonhai,項目名稱:onehome,代碼行數:7,代碼來源:WebUser.php


注:本文中的CWebUser::logout方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。