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 | * |
f197ec88 |
8 | * @copyright 1999-2016 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 |
15 | define('PAGE_NAME', 'signout'); |
a140422a |
16 | |
30967a1e |
17 | /** |
202bcbcc |
18 | * Include the SquirrelMail initialization file. |
30967a1e |
19 | */ |
202bcbcc |
20 | require('../include/init.php'); |
f740c049 |
21 | |
46b0c6f4 |
22 | /* Erase any lingering attachments */ |
c077ffeb |
23 | sqgetGlobalVar('compose_messages', $compose_messages, SQ_SESSION); |
f9b9ca12 |
24 | |
25 | if (!empty($compose_message) && is_array($compose_messages)) { |
26 | foreach($compose_messages as $composeMessage) { |
27 | $composeMessage->purgeAttachments(); |
28 | } |
32f4e318 |
29 | } |
288491a4 |
30 | |
32f4e318 |
31 | if (!isset($frame_top)) { |
fb745cc7 |
32 | $frame_top = '_top'; |
32f4e318 |
33 | } |
d03f3582 |
34 | |
779d6095 |
35 | $login_uri = 'login.php'; |
36 | |
6e515418 |
37 | do_hook('logout', $login_uri); |
f923b93d |
38 | |
e8bef7f4 |
39 | sqsession_destroy(); |
40 | |
32f4e318 |
41 | if ($signout_page) { |
29d387e7 |
42 | // Status 303 header is disabled. PHP fastcgi bug. See 1.91 changelog. |
43 | //header('Status: 303 See Other'); |
32f4e318 |
44 | header("Location: $signout_page"); |
45 | exit; /* we send no content if we're redirecting. */ |
46 | } |
118eb9a4 |
47 | |
af48f48c |
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) ) { |
3e6ee6ca |
51 | require_once(SM_PATH . 'class/template/Template.class.php'); |
c36e49dd |
52 | $sTemplateID = Template::get_default_template_set(); |
3e6ee6ca |
53 | $icon_theme_path = !$use_icons ? NULL : Template::calculate_template_images_directory($sTemplateID); |
54 | $oTemplate = Template::construct_template($sTemplateID); |
3c62d3ea |
55 | |
56 | // We want some variables to always be available to the template |
457e8593 |
57 | $oTemplate->assign('javascript_on', checkForJavascript()); |
fe8103c2 |
58 | $oTemplate->assign('base_uri', sqm_baseuri()); |
457e8593 |
59 | $always_include = array('sTemplateID', 'icon_theme_path'); |
3c62d3ea |
60 | foreach ($always_include as $var) { |
61 | $oTemplate->assign($var, (isset($$var) ? $$var : NULL)); |
62 | } |
af48f48c |
63 | } |
64 | |
3c62d3ea |
65 | // The error handler object is probably also not initialized on a refresh |
3c62d3ea |
66 | $oErrorHandler = new ErrorHandler($oTemplate,'error_message.tpl'); |
8f8188ae |
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); |
779d6095 |
74 | $oTemplate->assign('login_uri', $login_uri); |
8f8188ae |
75 | |
76 | $oTemplate->display('signout.tpl'); |
77 | |
5c4ff7bf |
78 | $oTemplate->display('footer.tpl'); |
af48f48c |
79 | |