remove PHP closing tag in example config file
[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/**
15 * Include the SquirrelMail initialization file.
16 */
17require('../include/init.php');
18
19/* Erase any lingering attachments */
20sqgetGlobalVar('compose_messages', $compose_messages, SQ_SESSION);
21
22if (!empty($compose_message) && is_array($compose_messages)) {
23 foreach($compose_messages as $composeMessage) {
24 $composeMessage->purgeAttachments();
25 }
26}
27
28if (!isset($frame_top)) {
29 $frame_top = '_top';
30}
31
32/* If a user hits reload on the last page, $base_uri isn't set
33 * because it was deleted with the session. */
34if (! sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION) ) {
35 $base_uri = sqm_baseuri();
36}
37
38$login_uri = 'login.php';
39
40do_hook('logout', $login_uri);
41
42sqsession_destroy();
43
44if ($signout_page) {
45 // Status 303 header is disabled. PHP fastcgi bug. See 1.91 changelog.
46 //header('Status: 303 See Other');
47 header("Location: $signout_page");
48 exit; /* we send no content if we're redirecting. */
49}
50
51/* After a reload of signout.php, $oTemplate might not exist anymore.
52 * Recover, so that we don't get all kinds of errors in that situation. */
53if ( !isset($oTemplate) || !is_object($oTemplate) ) {
54 require_once(SM_PATH . 'class/template/Template.class.php');
55 $sTemplateID = Template::get_default_template_set();
56 $icon_theme_path = !$use_icons ? NULL : Template::calculate_template_images_directory($sTemplateID);
57 $oTemplate = Template::construct_template($sTemplateID);
58
59 // We want some variables to always be available to the template
60 $oTemplate->assign('javascript_on', checkForJavascript());
61 $oTemplate->assign('base_uri', sqm_baseuri());
62 $always_include = array('sTemplateID', 'icon_theme_path');
63 foreach ($always_include as $var) {
64 $oTemplate->assign($var, (isset($$var) ? $$var : NULL));
65 }
66}
67
68// The error handler object is probably also not initialized on a refresh
69$oErrorHandler = new ErrorHandler($oTemplate,'error_message.tpl');
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$oTemplate->assign('login_uri', $login_uri);
78
79$oTemplate->display('signout.tpl');
80
81$oTemplate->display('footer.tpl');
82