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


PHP phpCAS::logoutWithRedirectServiceAndUrl方法代碼示例

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


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

示例1: user_logout

	/**
	 * @param string $user : username
	 * @param bool $remote : logged out remotely (so do not redirect)
	 * @param string $redir : url to redirect to. Uses home page according to prefs if empty
	 * @return void : redirects to suitable homepage or redir param if not remote
	 */
	function user_logout($user, $remote = false, $redir = '')
	{
		global $prefs, $logslib, $lslib, $user_cookie_site;

		$logslib->add_log('login', 'logged out');

		$userInfo = $this->get_user_info($user);
		$this->delete_user_cookie($userInfo['userId']);

		if ($remote && $prefs['feature_intertiki'] == 'y' and $prefs['feature_intertiki_sharedcookie'] == 'y' and !empty($prefs['feature_intertiki_mymaster'])) {
			include_once('XML/RPC.php');
			$remote = $prefs['interlist'][$prefs['feature_intertiki_mymaster']];
			$remote['path'] = preg_replace('/^\/?/', '/', $remote['path']);
			$client = new XML_RPC_Client($remote['path'], $remote['host'], $remote['port']);
			$client->setDebug(0);
			$msg = new XML_RPC_Message(
							'intertiki.logout',
							array(
								 new XML_RPC_Value($prefs['tiki_key'], 'string'),
								 new XML_RPC_Value($user, 'string')
							)
			);
			$client->send($msg);
			return;
		}

		// more local cleanup originally from tiki-logout.php

		// go offline in Live Support
		if ($prefs['feature_live_support'] == 'y') {
			global $access; include_once ('lib/live_support/lslib.php');
			if ($lslib->get_operator_status($user) != 'offline') {
				$lslib->set_operator_status($user, 'offline');
			}
		}
		setcookie($user_cookie_site, '', -3600, $prefs['cookie_path'], $prefs['cookie_domain']);
		/* change group home page or deactivate if no page is set */
		if (!empty($redir)) {
			$url = $redir;
		} else if (($groupHome = $this->get_group_home('Anonymous')) != '') {
			$url = (preg_match('/^(\/|https?:)/', $groupHome)) ? $groupHome : 'tiki-index.php?page=' . $groupHome;
		} else {
			$url = $prefs['site_tikiIndex'];
		}
		// RFC 2616 defines that the 'Location' HTTP headerconsists of an absolute URI
		if (!preg_match('/^https?\:/i', $url)) {
			global $url_scheme, $url_host, $url_port, $base_url;
			$url = (preg_match('#^/#', $url) ? $url_scheme . '://' . $url_host . (($url_port != '') ? ":$url_port" : '') : $base_url) . $url;
		}
		if (SID) 
			$url .= '?' . SID;

		if ( $prefs['auth_method'] === 'cas' && $user !== 'admin' && $user !== '' && $prefs['cas_force_logout'] === 'y' ) {
			phpCAS::logoutWithRedirectServiceAndUrl($url, $url);
		}
		unset($_SESSION['cas_validation_time']);
		unset($_SESSION[$user_cookie_site]);
		session_unset();
		session_destroy();

		if ($prefs['auth_method'] === 'ws') {
			header('Location: ' . str_replace('//', '//admin:@', $url)); // simulate a fake login to logout the user
		} else {
			header('Location: ' . $url);
		}
		return;
	}
開發者ID:railfuture,項目名稱:tiki-website,代碼行數:73,代碼來源:userslib.php

示例2: reset

 protected function reset($hard = false)
 {
     // Log out from the CAS server
     if (phpCAS::isAuthenticated()) {
         $service = "http" . (IS_SECURE ? 's' : '') . "://" . SERVER_HOST . $_SERVER['REQUEST_URI'];
         phpCAS::logoutWithRedirectServiceAndUrl($service, $service);
     }
     return true;
 }
開發者ID:nncsang,項目名稱:Kurogo,代碼行數:9,代碼來源:CASAuthentication.php

示例3: casLogout

function casLogout()
{
    global $CASAuth;
    global $casIsSetUp;
    global $wgUser, $wgRequest, $wgLanguageCode;
    require_once $CASAuth["phpCAS"] . "/CAS.php";
    // Logout from MediaWiki
    $wgUser->logout();
    // Get returnto value
    $returnto = $wgRequest->getVal("returnto");
    if ($returnto) {
        $lg = Language::factory($wgLanguageCode);
        $target = Title::newFromText($returnto);
        if ($target && $target->getPrefixedDBkey() != $lg->specialPage("Userlogout")) {
            $redirecturl = $target->getFullUrl();
        }
    }
    if (!$casIsSetUp) {
        return false;
    }
    // Logout from CAS (will redirect user to CAS server)
    if (isset($redirecturl)) {
        phpCAS::logoutWithRedirectServiceAndUrl($redirecturl, $redirecturl);
    } else {
        phpCAS::logout();
    }
    return true;
    // We won't get here
}
開發者ID:jordane,項目名稱:CASAuth,代碼行數:29,代碼來源:CASAuth.php

示例4:

phpCAS::setNoCasServerValidation();
//Don't validate with SSL
$url = 'http://128.187.104.23:1337/demeter/CASLogic.php';
//Return url after validation
phpCAS::setFixedServiceURL($url);
//Set the return URL
if (isset($_REQUEST['logout'])) {
    //If wanting to log out
    echo "Logging Out.";
    $_SESSION['AUTH'] = false;
    //Make user unable to call backend functions
    $_SESSION['AUTH_USER'] = '';
    //Removed stored user
    $url = "http://128.187.104.23:1337/demeter/index.html";
    //url to return to after completion
    phpCAS::logoutWithRedirectServiceAndUrl($url, '');
    //set return url
} else {
    $auth = phpCAS::checkAuthentication();
    //Go to CAS and verify
    if ($auth == false) {
        //CAS failed the authentication
        $_SESSION['AUTH'] = false;
        //Make user unable to call backend functions
        $_SESSION['AUTH_USER'] = '';
        //Removed stored user
        phpCAS::forceAuthentication();
        //Take User to CAS sign in page
    } else {
        Session::put('AUTH', true);
        Session::save();
開發者ID:DCUnit711,項目名稱:Demeter,代碼行數:31,代碼來源:CASLogic.php


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