logout.php 1.04 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php

    /**
	 * Elgg logout action for use with UNL CAS
	 * 
	 * @package Elgg
	 * @subpackage Core
	 * @overwritten cas_auth_unl/actions/logout.php
	 * @author Curverider Ltd
	 * @link http://elgg.org/
	 */    
	
	// Save this session value since the next step wipes it out
		$loggedInWithCas = $_SESSION['loggedInWithCas'];

    // Log out
        $result = logout();
            
    // Set the system_message as appropriate
        
        if ($result) {
            system_message(elgg_echo('logoutok'));
        } else {
            register_error(elgg_echo('logouterror'));
        }
	
    // We've destoyed all the Elgg session data, now do CAS logout if neccessary
    // Due to problems getting the SimpleCAS logout to work, we're just forwarding to the right URL since
    //   the Elgg logout function above took care of destroying the session, which is all the SimpleCAS logout 
    //   was doing anyway.

        if ($loggedInWithCas) { 
        	global $CONFIG;
        	forward('https://login.unl.edu/cas/logout?url='.$CONFIG->url);
        }
?>