ed52ffe1ab0de89b8cb439c0b5071f943c138802
[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-2004 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 /* SquirrelMail required files. */
22 require_once(SM_PATH . 'include/validate.php');
23 require_once(SM_PATH . 'functions/prefs.php');
24 require_once(SM_PATH . 'functions/plugin.php');
25 require_once(SM_PATH . 'functions/strings.php');
26 require_once(SM_PATH . 'functions/html.php');
27
28 /* Erase any lingering attachments */
29 if (isset($attachments) && is_array($attachments)
30 && sizeof($attachments)){
31 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
32 foreach ($attachments as $info) {
33 $attached_file = "$hashed_attachment_dir/$info[localfilename]";
34 if (file_exists($attached_file)) {
35 unlink($attached_file);
36 }
37 }
38 }
39
40 if (!isset($frame_top)) {
41 $frame_top = '_top';
42 }
43
44 /* If a user hits reload on the last page, $base_uri isn't set
45 * because it was deleted with the session. */
46 if (! sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION) ) {
47 require_once(SM_PATH . 'functions/display_messages.php');
48 $base_uri = sqm_baseuri();
49 }
50
51 do_hook('logout');
52
53 sqsession_destroy();
54
55 if ($signout_page) {
56 header('Status: 303 See Other');
57 header("Location: $signout_page");
58 exit; /* we send no content if we're redirecting. */
59 }
60 ?>
61 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
62 <html>
63 <head>
64 <?php
65 if ($theme_css != '') {
66 ?>
67 <link rel="stylesheet" type="text/css" href="<?php echo $theme_css; ?>" />
68 <?php
69 }
70 ?>
71 <title><?php echo $org_title . ' - ' . _("Signout"); ?></title>
72 </head>
73 <body text="<?php echo $color[8]; ?>" bgcolor="<?php echo $color[4]; ?>"
74 link="<?php echo $color[7]; ?>" vlink="<?php echo $color[7]; ?>"
75 alink="<?php echo $color[7]; ?>">
76 <br /><br />
77 <?php
78 $plugin_message = concat_hook_function('logout_above_text');
79 echo
80 html_tag( 'table',
81 html_tag( 'tr',
82 html_tag( 'th', _("Sign Out"), 'center' ) ,
83 '', $color[0], 'width="100%"' ) .
84 $plugin_message .
85 html_tag( 'tr',
86 html_tag( 'td', _("You have been successfully signed out.") .
87 '<br /><a href="login.php" target="' . $frame_top . '">' .
88 _("Click here to log back in.") . '</a><br />' ,
89 'center' ) ,
90 '', $color[4], 'width="100%"' ) .
91 html_tag( 'tr',
92 html_tag( 'td', '<br />', 'center' ) ,
93 '', $color[0], 'width="100%"' ) ,
94 'center', $color[4], 'width="50%" cols="1" cellpadding="2" cellspacing="0" border="0"' )
95 ?>
96 </body>
97 </html>