Minor fix
[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 *
35586184 6 * Cleans up after the user. Resets cookies and terminates session.
7 *
5e5daa47 8 * @copyright 1999-2015 The SquirrelMail Project Team
4b4abf93 9 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
30967a1e 10 * @version $Id$
8f6f9ba5 11 * @package squirrelmail
35586184 12 */
8b522a59 13
a140422a 14/** This is the signout page */
4329d54c 15define('PAGE_NAME', 'signout');
a140422a 16
30967a1e 17/**
202bcbcc 18 * Include the SquirrelMail initialization file.
30967a1e 19 */
202bcbcc 20require('../include/init.php');
f740c049 21
46b0c6f4 22/* Erase any lingering attachments */
c077ffeb 23sqgetGlobalVar('compose_messages', $compose_messages, SQ_SESSION);
f9b9ca12 24
25if (!empty($compose_message) && is_array($compose_messages)) {
26 foreach($compose_messages as $composeMessage) {
27 $composeMessage->purgeAttachments();
28 }
32f4e318 29}
288491a4 30
32f4e318 31if (!isset($frame_top)) {
fb745cc7 32 $frame_top = '_top';
32f4e318 33}
d03f3582 34
779d6095 35$login_uri = 'login.php';
36
6e515418 37do_hook('logout', $login_uri);
f923b93d 38
e8bef7f4 39sqsession_destroy();
40
32f4e318 41if ($signout_page) {
29d387e7 42 // Status 303 header is disabled. PHP fastcgi bug. See 1.91 changelog.
43 //header('Status: 303 See Other');
32f4e318 44 header("Location: $signout_page");
45 exit; /* we send no content if we're redirecting. */
46}
118eb9a4 47
af48f48c 48/* After a reload of signout.php, $oTemplate might not exist anymore.
49 * Recover, so that we don't get all kinds of errors in that situation. */
50if ( !isset($oTemplate) || !is_object($oTemplate) ) {
3e6ee6ca 51 require_once(SM_PATH . 'class/template/Template.class.php');
c36e49dd 52 $sTemplateID = Template::get_default_template_set();
3e6ee6ca 53 $icon_theme_path = !$use_icons ? NULL : Template::calculate_template_images_directory($sTemplateID);
54 $oTemplate = Template::construct_template($sTemplateID);
3c62d3ea 55
56 // We want some variables to always be available to the template
457e8593 57 $oTemplate->assign('javascript_on', checkForJavascript());
fe8103c2 58 $oTemplate->assign('base_uri', sqm_baseuri());
457e8593 59 $always_include = array('sTemplateID', 'icon_theme_path');
3c62d3ea 60 foreach ($always_include as $var) {
61 $oTemplate->assign($var, (isset($$var) ? $$var : NULL));
62 }
af48f48c 63}
64
3c62d3ea 65// The error handler object is probably also not initialized on a refresh
3c62d3ea 66$oErrorHandler = new ErrorHandler($oTemplate,'error_message.tpl');
8f8188ae 67
68/* internal gettext functions will fail, if language is not set */
69set_up_language($squirrelmail_language, true, true);
70
71displayHtmlHeader($org_title . ' - ' . _("Signout"));
72
73$oTemplate->assign('frame_top', $frame_top);
779d6095 74$oTemplate->assign('login_uri', $login_uri);
8f8188ae 75
76$oTemplate->display('signout.tpl');
77
5c4ff7bf 78$oTemplate->display('footer.tpl');
af48f48c 79