3f2a13f5d58873725998f6cb1f7b6dcbea7fb8d3
[squirrelmail.git] / src / signout.php
1 <?php
2
3 /**
4 * signout.php -- cleans up session and logs the user out
5 *
6 * Copyright (c) 1999-2005 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * Cleans up after the user. Resets cookies and terminates session.
10 *
11 * @version $Id$
12 * @package squirrelmail
13 */
14
15 /**
16 * Path for SquirrelMail required files.
17 * @ignore
18 */
19 define('SM_PATH','../');
20
21 require_once(SM_PATH . 'include/validate.php');
22 require_once(SM_PATH . 'functions/prefs.php');
23 require_once(SM_PATH . 'functions/plugin.php');
24 require_once(SM_PATH . 'functions/strings.php');
25 require_once(SM_PATH . 'functions/html.php');
26
27 /* Erase any lingering attachments */
28 if (isset($attachments) && is_array($attachments)
29 && sizeof($attachments)){
30 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
31 foreach ($attachments as $info) {
32 $attached_file = "$hashed_attachment_dir/$info[localfilename]";
33 if (file_exists($attached_file)) {
34 unlink($attached_file);
35 }
36 }
37 }
38
39 if (!isset($frame_top)) {
40 $frame_top = '_top';
41 }
42
43 /* If a user hits reload on the last page, $base_uri isn't set
44 * because it was deleted with the session. */
45 if (! sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION) ) {
46 require_once(SM_PATH . 'functions/display_messages.php');
47 $base_uri = sqm_baseuri();
48 }
49
50 do_hook('logout');
51
52 sqsession_destroy();
53
54 if ($signout_page) {
55 header('Status: 303 See Other');
56 header("Location: $signout_page");
57 exit; /* we send no content if we're redirecting. */
58 }
59
60 /* internal gettext functions will fail, if language is not set */
61 set_up_language($squirrelmail_language, true, true);
62 ?>
63 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
64 <html>
65 <head>
66 <?php
67 if ($theme_css != '') {
68 ?>
69 <link rel="stylesheet" type="text/css" href="<?php echo $theme_css; ?>" />
70 <?php
71 }
72 ?>
73 <meta name="robots" content="noindex,nofollow">
74 <title><?php echo $org_title . ' - ' . _("Signout"); ?></title>
75 </head>
76 <body text="<?php echo $color[8]; ?>" bgcolor="<?php echo $color[4]; ?>"
77 link="<?php echo $color[7]; ?>" vlink="<?php echo $color[7]; ?>"
78 alink="<?php echo $color[7]; ?>">
79 <br /><br />
80 <?php
81 $plugin_message = concat_hook_function('logout_above_text');
82 echo
83 html_tag( 'table',
84 html_tag( 'tr',
85 html_tag( 'th', _("Sign Out"), 'center' ) ,
86 '', $color[0] ) .
87 $plugin_message .
88 html_tag( 'tr',
89 html_tag( 'td', _("You have been successfully signed out.") .
90 '<br /><a href="login.php" target="' . $frame_top . '">' .
91 _("Click here to log back in.") . '</a><br />' ,
92 'center' ) ,
93 '', $color[4] ) .
94 html_tag( 'tr',
95 html_tag( 'td', '<br />', 'center' ) ,
96 '', $color[0] ) ,
97 'center', $color[4], 'width="50%" cellpadding="2" cellspacing="0" border="0"' )
98 ?>
99 </body>
100 </html>