| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * signout.php -- cleans up session and logs the user out |
| 5 | * |
| 6 | * Copyright (c) 1999-2005 The SquirrelMail Project Team |
| 7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 8 | * |
| 9 | * Cleans up after the user. Resets cookies and terminates session. |
| 10 | * |
| 11 | * @version $Id$ |
| 12 | * @package squirrelmail |
| 13 | */ |
| 14 | |
| 15 | /** |
| 16 | * Path for SquirrelMail required files. |
| 17 | * @ignore |
| 18 | */ |
| 19 | define('SM_PATH','../'); |
| 20 | |
| 21 | /* check if we're already logged out (e.g. when this page is reloaded), |
| 22 | * so we can skip to the output and not give error messages */ |
| 23 | if( ! isset($_SESSION) || empty($_SESSION['user_is_logged_in']) ) { |
| 24 | $loggedin = false; |
| 25 | } else { |
| 26 | $loggedin = true; |
| 27 | } |
| 28 | |
| 29 | if($loggedin) { |
| 30 | require_once(SM_PATH . 'include/validate.php'); |
| 31 | require_once(SM_PATH . 'functions/prefs.php'); |
| 32 | } else { |
| 33 | // this comes in through validate.php usually |
| 34 | require_once(SM_PATH . 'config/config.php'); |
| 35 | require_once(SM_PATH . 'functions/i18n.php'); |
| 36 | require_once(SM_PATH . 'functions/page_header.php'); |
| 37 | if (@file_exists($theme[$theme_default]['PATH'])) { |
| 38 | @include ($theme[$theme_default]['PATH']); |
| 39 | } |
| 40 | } |
| 41 | require_once(SM_PATH . 'functions/plugin.php'); |
| 42 | require_once(SM_PATH . 'functions/strings.php'); |
| 43 | require_once(SM_PATH . 'functions/html.php'); |
| 44 | |
| 45 | if($loggedin) { |
| 46 | /* Erase any lingering attachments */ |
| 47 | if (isset($attachments) && is_array($attachments) |
| 48 | && sizeof($attachments)){ |
| 49 | $hashed_attachment_dir = getHashedDir($username, $attachment_dir); |
| 50 | foreach ($attachments as $info) { |
| 51 | $attached_file = "$hashed_attachment_dir/$info[localfilename]"; |
| 52 | if (file_exists($attached_file)) { |
| 53 | unlink($attached_file); |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | if (!isset($frame_top)) { |
| 60 | $frame_top = '_top'; |
| 61 | } |
| 62 | |
| 63 | /* If a user hits reload on the last page, $base_uri isn't set |
| 64 | * because it was deleted with the session. */ |
| 65 | if (! sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION) ) { |
| 66 | require_once(SM_PATH . 'functions/display_messages.php'); |
| 67 | $base_uri = sqm_baseuri(); |
| 68 | } |
| 69 | |
| 70 | do_hook('logout'); |
| 71 | |
| 72 | sqsession_destroy(); |
| 73 | |
| 74 | if ($signout_page) { |
| 75 | header('Status: 303 See Other'); |
| 76 | header("Location: $signout_page"); |
| 77 | exit; /* we send no content if we're redirecting. */ |
| 78 | } |
| 79 | |
| 80 | /* internal gettext functions will fail, if language is not set */ |
| 81 | set_up_language($squirrelmail_language, true, true); |
| 82 | ?> |
| 83 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 84 | <html> |
| 85 | <head> |
| 86 | <?php |
| 87 | if ($theme_css != '') { |
| 88 | ?> |
| 89 | <link rel="stylesheet" type="text/css" href="<?php echo $theme_css; ?>" /> |
| 90 | <?php |
| 91 | } |
| 92 | ?> |
| 93 | <title><?php echo $org_title . ' - ' . _("Signout"); ?></title> |
| 94 | </head> |
| 95 | <body text="<?php echo $color[8]; ?>" bgcolor="<?php echo $color[4]; ?>" |
| 96 | link="<?php echo $color[7]; ?>" vlink="<?php echo $color[7]; ?>" |
| 97 | alink="<?php echo $color[7]; ?>"> |
| 98 | <br /><br /> |
| 99 | <?php |
| 100 | $plugin_message = concat_hook_function('logout_above_text'); |
| 101 | echo |
| 102 | html_tag( 'table', |
| 103 | html_tag( 'tr', |
| 104 | html_tag( 'th', _("Sign Out"), 'center' ) , |
| 105 | '', $color[0], 'width="100%"' ) . |
| 106 | $plugin_message . |
| 107 | html_tag( 'tr', |
| 108 | html_tag( 'td', _("You have been successfully signed out.") . |
| 109 | '<br /><a href="login.php" target="' . $frame_top . '">' . |
| 110 | _("Click here to log back in.") . '</a><br />' , |
| 111 | 'center' ) , |
| 112 | '', $color[4], 'width="100%"' ) . |
| 113 | html_tag( 'tr', |
| 114 | html_tag( 'td', '<br />', 'center' ) , |
| 115 | '', $color[0], 'width="100%"' ) , |
| 116 | 'center', $color[4], 'width="50%" cols="1" cellpadding="2" cellspacing="0" border="0"' ) |
| 117 | ?> |
| 118 | </body> |
| 119 | </html> |