59177427 |
1 | <?php |
895905c0 |
2 | |
35586184 |
3 | /** |
4 | * signout.php -- cleans up session and logs the user out |
5 | * |
35586184 |
6 | * Cleans up after the user. Resets cookies and terminates session. |
7 | * |
4b5049de |
8 | * @copyright © 1999-2007 The SquirrelMail Project Team |
4b4abf93 |
9 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
30967a1e |
10 | * @version $Id$ |
8f6f9ba5 |
11 | * @package squirrelmail |
35586184 |
12 | */ |
8b522a59 |
13 | |
30967a1e |
14 | /** |
202bcbcc |
15 | * Include the SquirrelMail initialization file. |
30967a1e |
16 | */ |
202bcbcc |
17 | require('../include/init.php'); |
f740c049 |
18 | |
46b0c6f4 |
19 | /* Erase any lingering attachments */ |
c077ffeb |
20 | sqgetGlobalVar('compose_messages', $compose_messages, SQ_SESSION); |
f9b9ca12 |
21 | |
22 | if (!empty($compose_message) && is_array($compose_messages)) { |
23 | foreach($compose_messages as $composeMessage) { |
24 | $composeMessage->purgeAttachments(); |
25 | } |
32f4e318 |
26 | } |
288491a4 |
27 | |
32f4e318 |
28 | if (!isset($frame_top)) { |
fb745cc7 |
29 | $frame_top = '_top'; |
32f4e318 |
30 | } |
d03f3582 |
31 | |
32f4e318 |
32 | /* If a user hits reload on the last page, $base_uri isn't set |
33 | * because it was deleted with the session. */ |
f38b7cf0 |
34 | if (! sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION) ) { |
f3bc099d |
35 | $base_uri = sqm_baseuri(); |
32f4e318 |
36 | } |
e8bef7f4 |
37 | |
779d6095 |
38 | $login_uri = 'login.php'; |
39 | |
6e515418 |
40 | do_hook('logout', $login_uri); |
f923b93d |
41 | |
e8bef7f4 |
42 | sqsession_destroy(); |
43 | |
32f4e318 |
44 | if ($signout_page) { |
29d387e7 |
45 | // Status 303 header is disabled. PHP fastcgi bug. See 1.91 changelog. |
46 | //header('Status: 303 See Other'); |
32f4e318 |
47 | header("Location: $signout_page"); |
48 | exit; /* we send no content if we're redirecting. */ |
49 | } |
118eb9a4 |
50 | |
af48f48c |
51 | /* After a reload of signout.php, $oTemplate might not exist anymore. |
52 | * Recover, so that we don't get all kinds of errors in that situation. */ |
53 | if ( !isset($oTemplate) || !is_object($oTemplate) ) { |
3e6ee6ca |
54 | require_once(SM_PATH . 'class/template/Template.class.php'); |
c36e49dd |
55 | $sTemplateID = Template::get_default_template_set(); |
3e6ee6ca |
56 | $icon_theme_path = !$use_icons ? NULL : Template::calculate_template_images_directory($sTemplateID); |
57 | $oTemplate = Template::construct_template($sTemplateID); |
3c62d3ea |
58 | |
59 | // We want some variables to always be available to the template |
457e8593 |
60 | $oTemplate->assign('javascript_on', checkForJavascript()); |
fe8103c2 |
61 | $oTemplate->assign('base_uri', sqm_baseuri()); |
457e8593 |
62 | $always_include = array('sTemplateID', 'icon_theme_path'); |
3c62d3ea |
63 | foreach ($always_include as $var) { |
64 | $oTemplate->assign($var, (isset($$var) ? $$var : NULL)); |
65 | } |
af48f48c |
66 | } |
67 | |
3c62d3ea |
68 | // The error handler object is probably also not initialized on a refresh |
3c62d3ea |
69 | $oErrorHandler = new ErrorHandler($oTemplate,'error_message.tpl'); |
8f8188ae |
70 | |
71 | /* internal gettext functions will fail, if language is not set */ |
72 | set_up_language($squirrelmail_language, true, true); |
73 | |
74 | displayHtmlHeader($org_title . ' - ' . _("Signout")); |
75 | |
76 | $oTemplate->assign('frame_top', $frame_top); |
779d6095 |
77 | $oTemplate->assign('login_uri', $login_uri); |
8f8188ae |
78 | |
79 | $oTemplate->display('signout.tpl'); |
80 | |
5c4ff7bf |
81 | $oTemplate->display('footer.tpl'); |
af48f48c |
82 | |