Mostly moved from base template dir
[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) ) {
52 require_once(SM_PATH . 'class/template/template.class.php');
53 $aTemplateSet = ( !isset($aTemplateSet) ? array() : $aTemplateSet );
54 $templateset_default = ( !isset($templateset_default) ? 0 : $templateset_default );
55
3c62d3ea 56 $sTplDir = !isset($aTemplateSet[$templateset_default]['PATH']) ? SM_PATH . 'templates/default/' : $aTemplateSet[$templateset_default]['PATH'];
57 $icon_theme_path = !$use_icons ? NULL : $sTplDir . 'images/';
af48f48c 58 $oTemplate = new Template($sTplDir);
3c62d3ea 59
60 // We want some variables to always be available to the template
61 $always_include = array('sTplDir', 'icon_theme_path');
62 foreach ($always_include as $var) {
63 $oTemplate->assign($var, (isset($$var) ? $$var : NULL));
64 }
af48f48c 65}
66
3c62d3ea 67// The error handler object is probably also not initialized on a refresh
32e0556a 68require_once(SM_PATH . 'class/error.class.php');
3c62d3ea 69$oErrorHandler = new ErrorHandler($oTemplate,'error_message.tpl');
8f8188ae 70
71/* internal gettext functions will fail, if language is not set */
72set_up_language($squirrelmail_language, true, true);
73
74displayHtmlHeader($org_title . ' - ' . _("Signout"));
75
76$oTemplate->assign('frame_top', $frame_top);
77
78$oTemplate->display('signout.tpl');
79
5c4ff7bf 80$oTemplate->display('footer.tpl');
af48f48c 81