source: sandbox/2.4.3-expresso-rest/logout.php @ 3018

Revision 3018, 2.6 KB checked in by amuller, 14 years ago (diff)

Ticket #1135 - Aplicando alterações do branches 2.0 no branches 2.2

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2        /**************************************************************************\
3        * phpGroupWare                                                             *
4        * http://www.phpgroupware.org                                              *
5        * Written by Joseph Engo <jengo@phpgroupware.org>                          *
6        * --------------------------------------------                             *
7        *  This program is free software; you can redistribute it and/or modify it *
8        *  under the terms of the GNU General Public License as published by the   *
9        *  Free Software Foundation; either version 2 of the License, or (at your  *
10        *  option) any later version.                                              *
11        \**************************************************************************/
12
13
14        $phpgw_info = array();
15        $GLOBALS['phpgw_info']['flags'] = array(
16                'disable_Template_class' => True,
17                'currentapp'             => 'logout',
18                'noheader'               => True,
19                'nofooter'               => True,
20                'nonavbar'               => True
21        );
22        include(dirname( __FILE__ ).'/header.inc.php');
23
24        $GLOBALS['sessionid'] = get_var('sessionid',array('GET','COOKIE'));
25        $GLOBALS['kp3']       = get_var('kp3',array('GET','COOKIE'));
26        $account_id = $GLOBALS['phpgw_info']['user']['account_id'];
27        $verified = $GLOBALS['phpgw']->session->verify();
28        if ($verified)
29        {
30                if (file_exists($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP . $GLOBALS['sessionid']))
31                {
32                        $dh = opendir($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP . $GLOBALS['sessionid']);
33                        while ($file = readdir($dh))
34                        {
35                                if ($file != '.' && $file != '..')
36                                {
37                                        unlink($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP . $GLOBALS['sessionid'] . SEP . $file);
38                                }
39                        }
40                        rmdir($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP . $GLOBALS['sessionid']);
41                }
42                $GLOBALS['phpgw']->hooks->process('logout');
43                $GLOBALS['phpgw']->session->destroy($GLOBALS['sessionid'],$GLOBALS['kp3']);
44        }
45        else
46        {       
47                if(is_object($GLOBALS['phpgw']->log) && $account_id != '')
48                {
49                        $GLOBALS['phpgw']->log->write(array(
50                                'text' => 'W-VerifySession, could not verify session during logout',
51                                'line' => __LINE__,
52                                'file' => __FILE__
53                        ));
54                }
55        }
56        $GLOBALS['phpgw']->session->phpgw_setcookie('sessionid');
57        $GLOBALS['phpgw']->session->phpgw_setcookie('kp3');
58        $GLOBALS['phpgw']->session->phpgw_setcookie('domain');
59        if($GLOBALS['phpgw_info']['server']['sessions_type'] == 'php4')
60        {
61                $GLOBALS['phpgw']->session->phpgw_setcookie(PHPGW_PHPSESSID);
62        }
63
64        $GLOBALS['phpgw']->redirect($GLOBALS['phpgw_info']['server']['webserver_url'].'/login.php?cd=1');
65?>
Note: See TracBrowser for help on using the repository browser.