Signout.php needed the error class to be loaded earlier.
[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 *
47ccfad4 8 * @copyright &copy; 1999-2006 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
30967a1e 14/**
202bcbcc 15 * Include the SquirrelMail initialization file.
30967a1e 16 */
202bcbcc 17require('../include/init.php');
f740c049 18
46b0c6f4 19/* Erase any lingering attachments */
c077ffeb 20sqgetGlobalVar('compose_messages', $compose_messages, SQ_SESSION);
f9b9ca12 21
22if (!empty($compose_message) && is_array($compose_messages)) {
23 foreach($compose_messages as $composeMessage) {
24 $composeMessage->purgeAttachments();
25 }
32f4e318 26}
288491a4 27
32f4e318 28if (!isset($frame_top)) {
fb745cc7 29 $frame_top = '_top';
32f4e318 30}
d03f3582 31
32f4e318 32/* If a user hits reload on the last page, $base_uri isn't set
33 * because it was deleted with the session. */
f38b7cf0 34if (! sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION) ) {
f3bc099d 35 $base_uri = sqm_baseuri();
32f4e318 36}
e8bef7f4 37
32f4e318 38do_hook('logout');
f923b93d 39
e8bef7f4 40sqsession_destroy();
41
32f4e318 42if ($signout_page) {
29d387e7 43 // Status 303 header is disabled. PHP fastcgi bug. See 1.91 changelog.
44 //header('Status: 303 See Other');
32f4e318 45 header("Location: $signout_page");
46 exit; /* we send no content if we're redirecting. */
47}
118eb9a4 48
af48f48c 49/* After a reload of signout.php, $oTemplate might not exist anymore.
50 * Recover, so that we don't get all kinds of errors in that situation. */
51if ( !isset($oTemplate) || !is_object($oTemplate) ) {
3e6ee6ca 52 require_once(SM_PATH . 'class/template/Template.class.php');
c36e49dd 53 $sTemplateID = Template::get_default_template_set();
3e6ee6ca 54 $icon_theme_path = !$use_icons ? NULL : Template::calculate_template_images_directory($sTemplateID);
55 $oTemplate = Template::construct_template($sTemplateID);
3c62d3ea 56
57 // We want some variables to always be available to the template
4b145052 58 $always_include = array('sTemplateID', 'icon_theme_path', 'javascript_on');
3c62d3ea 59 foreach ($always_include as $var) {
60 $oTemplate->assign($var, (isset($$var) ? $$var : NULL));
61 }
af48f48c 62}
63
3c62d3ea 64// The error handler object is probably also not initialized on a refresh
3c62d3ea 65$oErrorHandler = new ErrorHandler($oTemplate,'error_message.tpl');
8f8188ae 66
67/* internal gettext functions will fail, if language is not set */
68set_up_language($squirrelmail_language, true, true);
69
70displayHtmlHeader($org_title . ' - ' . _("Signout"));
71
72$oTemplate->assign('frame_top', $frame_top);
73
74$oTemplate->display('signout.tpl');
75
5c4ff7bf 76$oTemplate->display('footer.tpl');
af48f48c 77