| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * signout.php -- cleans up session and logs the user out |
| 5 | * |
| 6 | * Copyright (c) 1999-2002 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 | * $Id$ |
| 12 | */ |
| 13 | |
| 14 | require_once('../src/validate.php'); |
| 15 | require_once('../functions/prefs.php'); |
| 16 | require_once('../functions/plugin.php'); |
| 17 | require_once('../functions/strings.php'); |
| 18 | require_once('../functions/html.php'); |
| 19 | |
| 20 | /* Erase any lingering attachments */ |
| 21 | if (isset($attachments) && is_array($attachments) |
| 22 | && sizeof($attachments)){ |
| 23 | $hashed_attachment_dir = getHashedDir($username, $attachment_dir); |
| 24 | foreach ($attachments as $info) { |
| 25 | $attached_file = "$hashed_attachment_dir/$info[localfilename]"; |
| 26 | if (file_exists($attached_file)) { |
| 27 | unlink($attached_file); |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | if (!isset($frame_top)) { |
| 33 | $frame_top = '_top'; |
| 34 | } |
| 35 | |
| 36 | /* If a user hits reload on the last page, $base_uri isn't set |
| 37 | * because it was deleted with the session. */ |
| 38 | if (!isset($base_uri)) { |
| 39 | if (!function_exists('sqm_baseuri')){ |
| 40 | require_once('../functions/display_messages.php'); |
| 41 | } |
| 42 | $base_uri = sqm_baseuri(); |
| 43 | } |
| 44 | |
| 45 | do_hook('logout'); |
| 46 | setcookie('username', '', 0, $base_uri); |
| 47 | setcookie('key', '', 0, $base_uri); |
| 48 | session_destroy(); |
| 49 | |
| 50 | if ($signout_page) { |
| 51 | header('Status: 303 See Other'); |
| 52 | header("Location: $signout_page"); |
| 53 | exit; /* we send no content if we're redirecting. */ |
| 54 | } |
| 55 | ?> |
| 56 | <html> |
| 57 | <head> |
| 58 | <?php |
| 59 | if ($theme_css != '') { |
| 60 | ?> |
| 61 | <link rel="stylesheet" type="text/css" href="<?php echo $theme_css ?>"> |
| 62 | <?php |
| 63 | } |
| 64 | ?> |
| 65 | <title><?php echo $org_title ?> - Signout</title> |
| 66 | </head> |
| 67 | <body text="<?php echo $color[8] ?>" bgcolor="<?php echo $color[4] ?>" |
| 68 | link="<?php echo $color[7] ?>" vlink="<?php echo $color[7] ?>" |
| 69 | alink="<?php echo $color[7] ?>"> |
| 70 | <br><br> |
| 71 | <? |
| 72 | do_hook('logout_above_text'); |
| 73 | echo |
| 74 | html_tag( 'table', |
| 75 | html_tag( 'tr', |
| 76 | html_tag( 'th', _("Sign Out"), 'center' ) , |
| 77 | '', $color[0], 'width="100%"' ) . |
| 78 | html_tag( 'tr', |
| 79 | html_tag( 'td', _("You have been successfully signed out.") . |
| 80 | '<br><a href="login.php" target="' . $frame_top . '">' . |
| 81 | _("Click here to log back in.") . '</a><br>' , |
| 82 | 'center' ) , |
| 83 | '', $color[4], 'width="100%"' ) . |
| 84 | html_tag( 'tr', |
| 85 | html_tag( 'td', '<br>', 'center' ) , |
| 86 | '', $color[0], 'width="100%"' ) , |
| 87 | 'center', $color[4], 'width="50%" cols="1" cellpadding="2" cellspacing="0" border="0"' ) |
| 88 | ?> |
| 89 | </body> |
| 90 | </html> |