From: <se...@us...> - 2009-11-18 08:31:17
|
Revision: 23349 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=23349&view=rev Author: sept_7 Date: 2009-11-18 08:31:05 +0000 (Wed, 18 Nov 2009) Log Message: ----------- [FIX] Correct the behaviour of tiki-logout with CAS Modified Paths: -------------- trunk/tiki-logout.php Modified: trunk/tiki-logout.php =================================================================== --- trunk/tiki-logout.php 2009-11-17 19:56:05 UTC (rev 23348) +++ trunk/tiki-logout.php 2009-11-18 08:31:05 UTC (rev 23349) @@ -1,9 +1,11 @@ <?php // (c) Copyright 2002-2009 by authors of the Tiki Wiki/CMS/Groupware Project -// -// All Rights Reserved. See copyright.txt for details and a complete list of authors. -// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. -// $Id: /cvsroot/tikiwiki/tiki/tiki-logout.php,v 1.29.2.3 2008-03-22 05:12:47 mose Exp $ +// All Rights Reserved. +// See copyright.txt for details and a complete list of authors. +// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. +// See license.txt for details. +// $Id$ + $bypass_siteclose_check = 'y'; require_once ('tiki-setup.php'); // go offline in Live Support @@ -13,25 +15,36 @@ $lslib->set_operator_status($user, 'offline'); } } + setcookie($user_cookie_site, '', -3600, $cookie_path, $prefs['cookie_domain']); $userlib->delete_user_cookie($user); $userlib->user_logout($user); $logslib->add_log('login', 'logged out'); -if ($phpcas_enabled == 'y' && $prefs['auth_method'] == 'cas' && $user != 'admin' && $user != '') { + +if ( ($groupHome = $userlib->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 ( !eregi('^https?\:', $url) ) { + $url = (ereg('^/', $url) ? $url_scheme . '://' . $url_host . (($url_port != '') ? ":$url_port" : '') : $base_url) . $url; +} + +if (SID) { + $url.= '?' . SID; +} +if ( $phpcas_enabled == 'y' && $prefs['auth_method'] == 'cas' && $user != 'admin' && $user != '' ) { require_once ('lib/phpcas/CAS.php'); phpCAS::client($prefs['cas_version'], '' . $prefs['cas_hostname'], (int)$prefs['cas_port'], '' . $prefs['cas_path']); - phpCAS::logout(); + // Logout and come back to the URL as Anonymous + // Pass URL AND Service as we don't know how the server will react + phpCAS::logoutWithRedirectServiceAndUrl($url,$url); } + session_unregister('user'); unset($_SESSION[$user_cookie_site]); session_destroy(); /* change group home page or desactivate if no page is set */ -if (($groupHome = $userlib->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 (!eregi('^https?\:', $url)) { - $url = (ereg('^/', $url) ? $url_scheme . '://' . $url_host . (($url_port != '') ? ":$url_port" : '') : $base_url) . $url; -} -if (SID) $url.= '?' . SID; header('Location: ' . $url); exit; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |