Better white space and wrapping
[squirrelmail.git] / src / signout.php
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 1999-2017 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 /** This is the signout page */
15 define('PAGE_NAME', 'signout');
16
17 /**
18 * Include the SquirrelMail initialization file.
19 */
20 require('../include/init.php');
21
22 /* Erase any lingering attachments */
23 sqgetGlobalVar('compose_messages', $compose_messages, SQ_SESSION);
24
25 if (!empty($compose_message) && is_array($compose_messages)) {
26 foreach($compose_messages as $composeMessage) {
27 $composeMessage->purgeAttachments();
28 }
29 }
30
31 if (!isset($frame_top)) {
32 $frame_top = '_top';
33 }
34
35 $login_uri = 'login.php';
36
37 do_hook('logout', $login_uri);
38
39 sqsession_destroy();
40
41 if ($signout_page) {
42 // Status 303 header is disabled. PHP fastcgi bug. See 1.91 changelog.
43 //header('Status: 303 See Other');
44 header("Location: $signout_page");
45 exit; /* we send no content if we're redirecting. */
46 }
47
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. */
50 if ( !isset($oTemplate) || !is_object($oTemplate) ) {
51 require_once(SM_PATH . 'class/template/Template.class.php');
52 $sTemplateID = Template::get_default_template_set();
53 $icon_theme_path = !$use_icons ? NULL : Template::calculate_template_images_directory($sTemplateID);
54 $oTemplate = Template::construct_template($sTemplateID);
55
56 // We want some variables to always be available to the template
57 $oTemplate->assign('javascript_on', checkForJavascript());
58 $oTemplate->assign('base_uri', sqm_baseuri());
59 $always_include = array('sTemplateID', 'icon_theme_path');
60 foreach ($always_include as $var) {
61 $oTemplate->assign($var, (isset($$var) ? $$var : NULL));
62 }
63 }
64
65 // The error handler object is probably also not initialized on a refresh
66 $oErrorHandler = new ErrorHandler($oTemplate,'error_message.tpl');
67
68 /* internal gettext functions will fail, if language is not set */
69 set_up_language($squirrelmail_language, true, true);
70
71 displayHtmlHeader($org_title . ' - ' . _("Signout"));
72
73 $oTemplate->assign('frame_top', $frame_top);
74 $oTemplate->assign('login_uri', $login_uri);
75
76 $oTemplate->display('signout.tpl');
77
78 $oTemplate->display('footer.tpl');
79