adding sq_setlocale function in order to use multiple locale names without
[squirrelmail.git] / src / signout.php
CommitLineData
59177427 1<?php
895905c0 2
35586184 3/**
4 * signout.php -- cleans up session and logs the user out
5 *
82d304a0 6 * Copyright (c) 1999-2004 The SquirrelMail Project Team
35586184 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 *
30967a1e 11 * @version $Id$
8f6f9ba5 12 * @package squirrelmail
35586184 13 */
8b522a59 14
30967a1e 15/**
16 * Path for SquirrelMail required files.
17 * @ignore
18 */
86725763 19define('SM_PATH','../');
20
d6599308 21/* check if we're already logged out (e.g. when this page is reloaded),
22 * so we can skip to the output and not give error messages */
23if( ! isset($_SESSION) || empty($_SESSION['user_is_logged_in']) ) {
24 $loggedin = false;
25} else {
26 $loggedin = true;
27}
28
29if($loggedin) {
30 require_once(SM_PATH . 'include/validate.php');
31 require_once(SM_PATH . 'functions/prefs.php');
32} else {
33 // this comes in through validate.php usually
34 require_once(SM_PATH . 'config/config.php');
35 require_once(SM_PATH . 'functions/i18n.php');
36 require_once(SM_PATH . 'functions/page_header.php');
37 if (@file_exists($theme[$theme_default]['PATH'])) {
38 @include ($theme[$theme_default]['PATH']);
39 }
40}
86725763 41require_once(SM_PATH . 'functions/plugin.php');
42require_once(SM_PATH . 'functions/strings.php');
43require_once(SM_PATH . 'functions/html.php');
f740c049 44
d6599308 45if($loggedin) {
46 /* Erase any lingering attachments */
47 if (isset($attachments) && is_array($attachments)
48 && sizeof($attachments)){
49 $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
50 foreach ($attachments as $info) {
51 $attached_file = "$hashed_attachment_dir/$info[localfilename]";
52 if (file_exists($attached_file)) {
53 unlink($attached_file);
54 }
fb745cc7 55 }
32f4e318 56 }
57}
288491a4 58
32f4e318 59if (!isset($frame_top)) {
fb745cc7 60 $frame_top = '_top';
32f4e318 61}
d03f3582 62
32f4e318 63/* If a user hits reload on the last page, $base_uri isn't set
64 * because it was deleted with the session. */
f38b7cf0 65if (! sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION) ) {
66 require_once(SM_PATH . 'functions/display_messages.php');
f3bc099d 67 $base_uri = sqm_baseuri();
32f4e318 68}
e8bef7f4 69
32f4e318 70do_hook('logout');
f923b93d 71
e8bef7f4 72sqsession_destroy();
73
32f4e318 74if ($signout_page) {
75 header('Status: 303 See Other');
76 header("Location: $signout_page");
77 exit; /* we send no content if we're redirecting. */
78}
21c3249f 79?>
e8bef7f4 80<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
fab3baa6 81<html>
e8bef7f4 82<head>
59177427 83<?php
32f4e318 84 if ($theme_css != '') {
8c65f339 85?>
3c621ba1 86 <link rel="stylesheet" type="text/css" href="<?php echo $theme_css; ?>" />
8c65f339 87<?php
32f4e318 88 }
21c3249f 89?>
8178e728 90 <title><?php echo $org_title . ' - ' . _("Signout"); ?></title>
fab3baa6 91</head>
91e0dccc 92<body text="<?php echo $color[8]; ?>" bgcolor="<?php echo $color[4]; ?>"
3c621ba1 93link="<?php echo $color[7]; ?>" vlink="<?php echo $color[7]; ?>"
94alink="<?php echo $color[7]; ?>">
95<br /><br />
d4651fa2 96<?php
ed89e55b 97$plugin_message = concat_hook_function('logout_above_text');
fab3baa6 98echo
99html_tag( 'table',
100 html_tag( 'tr',
ca52e31b 101 html_tag( 'th', _("Sign Out"), 'center' ) ,
fab3baa6 102 '', $color[0], 'width="100%"' ) .
ed89e55b 103 $plugin_message .
fab3baa6 104 html_tag( 'tr',
105 html_tag( 'td', _("You have been successfully signed out.") .
3c621ba1 106 '<br /><a href="login.php" target="' . $frame_top . '">' .
107 _("Click here to log back in.") . '</a><br />' ,
fab3baa6 108 'center' ) ,
109 '', $color[4], 'width="100%"' ) .
110 html_tag( 'tr',
3c621ba1 111 html_tag( 'td', '<br />', 'center' ) ,
fab3baa6 112 '', $color[0], 'width="100%"' ) ,
113'center', $color[4], 'width="50%" cols="1" cellpadding="2" cellspacing="0" border="0"' )
114?>
115</body>
d6599308 116</html>