Fixed formatting on these files.
[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)) {
21 $attachments = array();
22 }
23 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
24 foreach ($attachments as $info) {
25 $attached_file = "$hashed_attachment_dir/$info[localfilename]";
26 if (file_exists($attached_file)) {
27 unlink($attached_file);
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 ereg ('(^.*/)[^/]+/[^/]+$', $PHP_SELF, $regs);
39 $base_uri = $regs[1];
40 }
41
42 do_hook('logout');
43 setcookie('username', '', 0, $base_uri);
44 setcookie('key', '', 0, $base_uri);
45 session_destroy();
46
47 if ($signout_page) {
48 header('Status: 303 See Other');
49 header("Location: $signout_page");
50 exit; /* we send no content if we're redirecting. */
51 }
52 ?>
53 <HTML>
54 <HEAD>
55 <?php
56 if ($theme_css != '') {
57 ?>
58 <LINK REL="stylesheet" TYPE="text/css" HREF="<?php echo $theme_css ?>">
59 <?php
60 }
61 ?>
62 <TITLE><?php echo $org_title ?> - Signout</TITLE>
63 </HEAD>
64 <BODY TEXT="<?php echo $color[8] ?>" BGCOLOR="<?php echo $color[4] ?>"
65 LINK="<?php echo $color[7] ?>" VLINK="<?php echo $color[7] ?>"
66 ALINK="<?php echo $color[7] ?>">
67 <BR><BR>
68 <TABLE BGCOLOR="<?php echo $color[4]; ?>" BORDER="0" COLS="1" WIDTH="50%" CELLSPACING="0"
69 CELLPADDING="2" ALIGN="CENTER">
70 <TR BGCOLOR="<?php echo $color[0] ?>" WIDTH="100%">
71 <TD ALIGN="CENTER">
72 <B><?php echo _("Sign Out") ?></B>
73 </TD>
74 </TR>
75 <TR BGCOLOR="<?php echo $color[4] ?>" WIDTH="100%">
76 <TD ALIGN="CENTER">
77 <?php do_hook('logout_above_text'); ?>
78 <?php echo _("You have been successfully signed out.") ?><BR>
79 <A HREF="login.php" TARGET="<?php echo $frame_top ?>">
80 <?php echo _("Click here to log back in.") ?>
81 </A><BR><BR>
82 </TD>
83 </TR>
84 <TR BGCOLOR="<?php echo $color[0] ?>" WIDTH="100%">
85 <TD ALIGN="CENTER">
86 <BR>
87 </TD>
88 </TR>
89 </TABLE>
90 </BODY>
91 </HTML>