Location: header automatically adds 302 Status header. If extra Status header
[squirrelmail.git] / src / signout.php
1 <?php
2
3 /**
4 * signout.php -- cleans up session and logs the user out
5 *
6 * Cleans up after the user. Resets cookies and terminates session.
7 *
8 * @copyright &copy; 1999-2006 The SquirrelMail Project Team
9 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
10 * @version $Id$
11 * @package squirrelmail
12 */
13
14 /**
15 * Include the SquirrelMail initialization file.
16 */
17 require('../include/init.php');
18
19 /* Erase any lingering attachments */
20 sqgetGlobalVar('compose_messages', $compose_messages, SQ_SESSION);
21
22 if (!empty($compose_message) && is_array($compose_messages)) {
23 foreach($compose_messages as $composeMessage) {
24 $composeMessage->purgeAttachments();
25 }
26 }
27
28 if (!isset($frame_top)) {
29 $frame_top = '_top';
30 }
31
32 /* If a user hits reload on the last page, $base_uri isn't set
33 * because it was deleted with the session. */
34 if (! sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION) ) {
35 $base_uri = sqm_baseuri();
36 }
37
38 do_hook('logout');
39
40 sqsession_destroy();
41
42 if ($signout_page) {
43 // Status 303 header is disabled. PHP fastcgi bug. See 1.91 changelog.
44 //header('Status: 303 See Other');
45 header("Location: $signout_page");
46 exit; /* we send no content if we're redirecting. */
47 }
48
49 /* internal gettext functions will fail, if language is not set */
50 set_up_language($squirrelmail_language, true, true);
51 ?>
52 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
53 "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
54 <html>
55 <head>
56 <?php
57 if ($theme_css != '') {
58 ?>
59 <link rel="stylesheet" type="text/css" href="<?php echo $theme_css; ?>" />
60 <?php
61 }
62 ?>
63 <meta name="robots" content="noindex,nofollow">
64 <title><?php echo $org_title . ' - ' . _("Signout"); ?></title>
65 </head>
66 <body text="<?php echo $color[8]; ?>" bgcolor="<?php echo $color[4]; ?>"
67 link="<?php echo $color[7]; ?>" vlink="<?php echo $color[7]; ?>"
68 alink="<?php echo $color[7]; ?>">
69 <br /><br />
70 <?php
71 $plugin_message = concat_hook_function('logout_above_text');
72 echo
73 html_tag( 'table',
74 html_tag( 'tr',
75 html_tag( 'th', _("Sign Out"), 'center' ) ,
76 '', $color[0] ) .
77 $plugin_message .
78 html_tag( 'tr',
79 html_tag( 'td', _("You have been successfully signed out.") .
80 '<br /><a href="login.php" target="' . $frame_top . '">' .
81 _("Click here to log back in.") . '</a><br />' ,
82 'center' ) ,
83 '', $color[4] ) .
84 html_tag( 'tr',
85 html_tag( 'td', '<br />', 'center' ) ,
86 '', $color[0] ) ,
87 'center', $color[4], 'width="50%" cellpadding="2" cellspacing="0" border="0"' );
88
89 /* After a reload of signout.php, $oTemplate might not exist anymore.
90 * Recover, so that we don't get all kinds of errors in that situation. */
91 if ( !isset($oTemplate) || !is_object($oTemplate) ) {
92 require_once(SM_PATH . 'class/template/template.class.php');
93 $aTemplateSet = ( !isset($aTemplateSet) ? array() : $aTemplateSet );
94 $templateset_default = ( !isset($templateset_default) ? 0 : $templateset_default );
95
96 $sTplDir = ( !isset($aTemplateSet[$templateset_default]['PATH']) ?
97 SM_PATH . 'templates/default/' :
98 $aTemplateSet[$templateset_default]['PATH'] );
99 $oTemplate = new Template($sTplDir);
100 }
101
102 $oTemplate->display('footer.tpl');
103
104 ?>