on second thought, revise r12527 to use one, generic constant
[squirrelmail.git] / src / signout.php
... / ...
CommitLineData
1<?php
2
3/**
4 * signout.php -- cleans up session and logs the user out
5 *
6 * Cleans up after the user. Resets cookies and terminates session.
7 *
8 * @copyright &copy; 1999-2007 The SquirrelMail Project Team
9 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
10 * @version $Id$
11 * @package squirrelmail
12 */
13
14/** This is the signout page */
15define('PAGE_NAME', 'signout');
16
17/**
18 * Include the SquirrelMail initialization file.
19 */
20require('../include/init.php');
21
22/* Erase any lingering attachments */
23sqgetGlobalVar('compose_messages', $compose_messages, SQ_SESSION);
24
25if (!empty($compose_message) && is_array($compose_messages)) {
26 foreach($compose_messages as $composeMessage) {
27 $composeMessage->purgeAttachments();
28 }
29}
30
31if (!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. */
37if (! sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION) ) {
38 $base_uri = sqm_baseuri();
39}
40
41$login_uri = 'login.php';
42
43do_hook('logout', $login_uri);
44
45sqsession_destroy();
46
47if ($signout_page) {
48 // Status 303 header is disabled. PHP fastcgi bug. See 1.91 changelog.
49 //header('Status: 303 See Other');
50 header("Location: $signout_page");
51 exit; /* we send no content if we're redirecting. */
52}
53
54/* After a reload of signout.php, $oTemplate might not exist anymore.
55 * Recover, so that we don't get all kinds of errors in that situation. */
56if ( !isset($oTemplate) || !is_object($oTemplate) ) {
57 require_once(SM_PATH . 'class/template/Template.class.php');
58 $sTemplateID = Template::get_default_template_set();
59 $icon_theme_path = !$use_icons ? NULL : Template::calculate_template_images_directory($sTemplateID);
60 $oTemplate = Template::construct_template($sTemplateID);
61
62 // We want some variables to always be available to the template
63 $oTemplate->assign('javascript_on', checkForJavascript());
64 $oTemplate->assign('base_uri', sqm_baseuri());
65 $always_include = array('sTemplateID', 'icon_theme_path');
66 foreach ($always_include as $var) {
67 $oTemplate->assign($var, (isset($$var) ? $$var : NULL));
68 }
69}
70
71// The error handler object is probably also not initialized on a refresh
72$oErrorHandler = new ErrorHandler($oTemplate,'error_message.tpl');
73
74/* internal gettext functions will fail, if language is not set */
75set_up_language($squirrelmail_language, true, true);
76
77displayHtmlHeader($org_title . ' - ' . _("Signout"));
78
79$oTemplate->assign('frame_top', $frame_top);
80$oTemplate->assign('login_uri', $login_uri);
81
82$oTemplate->display('signout.tpl');
83
84$oTemplate->display('footer.tpl');
85