- // $squirrelmail_language is set by a cookie when the user
- // selects language
- if (isset($squirrelmail_language)) {
- if ($squirrelmail_language != "en") {
- putenv("LANG=".$squirrelmail_language);
- bindtextdomain("squirrelmail", "../locale/");
- textdomain("squirrelmail");
- }
- }
-
- setcookie("username", "", time(), "/");
- setcookie("key", "", time(), "/");
- setcookie("logged_in", 0, time(), "/");
+ require_once('../src/validate.php');
+ require_once('../functions/prefs.php');
+ require_once('../functions/plugin.php');
+
+ // Erase any lingering attachments
+ if (! isset($attachments)) {
+ $attachments = array();
+ }
+ foreach ($attachments as $info) {
+ if (file_exists($attachment_dir . $info['localfilename'])) {
+ unlink($attachment_dir . $info['localfilename']);
+ }
+ }
+
+ // If a user hits reload on the last page, $base_uri isn't set
+ // because it was deleted with the session.
+ if (! isset($base_uri)) {
+ ereg ("(^.*/)[^/]+/[^/]+$", $PHP_SELF, $regs);
+ $base_uri = $regs[1];
+ }
+
+ do_hook('logout');
+ setcookie('username', '', 0, $base_uri);
+ setcookie('key', '', 0, $base_uri);
+ session_destroy();
+
+ if ($signout_page) {
+ header("Status: 303 See Other");
+ header("Location: $signout_page");
+ exit; /* we send no content if we're redirecting. */
+ }