Move some HTML out of core (src/login.php)
[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 *
4b5049de 8 * @copyright &copy; 1999-2007 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
32f4e318 35/* If a user hits reload on the last page, $base_uri isn't set
36 * because it was deleted with the session. */
f38b7cf0 37if (! sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION) ) {
f3bc099d 38 $base_uri = sqm_baseuri();
32f4e318 39}
e8bef7f4 40
779d6095 41$login_uri = 'login.php';
42
6e515418 43do_hook('logout', $login_uri);
f923b93d 44
e8bef7f4 45sqsession_destroy();
46
32f4e318 47if ($signout_page) {
29d387e7 48 // Status 303 header is disabled. PHP fastcgi bug. See 1.91 changelog.
49 //header('Status: 303 See Other');
32f4e318 50 header("Location: $signout_page");
51 exit; /* we send no content if we're redirecting. */
52}
118eb9a4 53
af48f48c 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) ) {
3e6ee6ca 57 require_once(SM_PATH . 'class/template/Template.class.php');
c36e49dd 58 $sTemplateID = Template::get_default_template_set();
3e6ee6ca 59 $icon_theme_path = !$use_icons ? NULL : Template::calculate_template_images_directory($sTemplateID);
60 $oTemplate = Template::construct_template($sTemplateID);
3c62d3ea 61
62 // We want some variables to always be available to the template
457e8593 63 $oTemplate->assign('javascript_on', checkForJavascript());
fe8103c2 64 $oTemplate->assign('base_uri', sqm_baseuri());
457e8593 65 $always_include = array('sTemplateID', 'icon_theme_path');
3c62d3ea 66 foreach ($always_include as $var) {
67 $oTemplate->assign($var, (isset($$var) ? $$var : NULL));
68 }
af48f48c 69}
70
3c62d3ea 71// The error handler object is probably also not initialized on a refresh
3c62d3ea 72$oErrorHandler = new ErrorHandler($oTemplate,'error_message.tpl');
8f8188ae 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);
779d6095 80$oTemplate->assign('login_uri', $login_uri);
8f8188ae 81
82$oTemplate->display('signout.tpl');
83
5c4ff7bf 84$oTemplate->display('footer.tpl');
af48f48c 85