fixed comp_in_new handling
[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-2002 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 * $Id$
12 */
13
14 require_once('../src/validate.php');
15 require_once('../functions/prefs.php');
16 require_once('../functions/plugin.php');
17 require_once('../functions/strings.php');
18
19 /* Erase any lingering attachments */
20 if (isset($attachments) && is_array($attachments)
21 && sizeof($attachments)){
22 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
23 foreach ($attachments as $info) {
24 $attached_file = "$hashed_attachment_dir/$info[localfilename]";
25 if (file_exists($attached_file)) {
26 unlink($attached_file);
27 }
28 }
29 }
30
31 if (!isset($frame_top)) {
32 $frame_top = '_top';
33 }
34
35 /* If a user hits reload on the last page, $base_uri isn't set
36 * because it was deleted with the session. */
37 if (!isset($base_uri)) {
38 if (!function_exists('sqm_baseuri')){
39 require_once('../functions/display_messages.php');
40 }
41 $base_uri = sqm_baseuri();
42 }
43
44 do_hook('logout');
45 setcookie('username', '', 0, $base_uri);
46 setcookie('key', '', 0, $base_uri);
47 session_destroy();
48
49 if ($signout_page) {
50 header('Status: 303 See Other');
51 header("Location: $signout_page");
52 exit; /* we send no content if we're redirecting. */
53 }
54 ?>
55 <HTML>
56 <HEAD>
57 <?php
58 if ($theme_css != '') {
59 ?>
60 <LINK REL="stylesheet" TYPE="text/css" HREF="<?php echo $theme_css ?>">
61 <?php
62 }
63 ?>
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 <TABLE BGCOLOR="<?php echo $color[4]; ?>" BORDER="0" COLS="1" WIDTH="50%" CELLSPACING="0"
71 CELLPADDING="2" ALIGN="CENTER">
72 <TR BGCOLOR="<?php echo $color[0] ?>" WIDTH="100%">
73 <TD ALIGN="CENTER">
74 <B><?php echo _("Sign Out") ?></B>
75 </TD>
76 </TR>
77 <TR BGCOLOR="<?php echo $color[4] ?>" WIDTH="100%">
78 <TD ALIGN="CENTER">
79 <?php do_hook('logout_above_text'); ?>
80 <?php echo _("You have been successfully signed out.") ?><BR>
81 <A HREF="login.php" TARGET="<?php echo $frame_top ?>">
82 <?php echo _("Click here to log back in.") ?>
83 </A><BR><BR>
84 </TD>
85 </TR>
86 <TR BGCOLOR="<?php echo $color[0] ?>" WIDTH="100%">
87 <TD ALIGN="CENTER">
88 <BR>
89 </TD>
90 </TR>
91 </TABLE>
92 </BODY>
93 </HTML>