- /**
- ** redirect.php
- ** Derived from webmail.php by Ralf Kraudelt <kraude@wiwi.uni-rostock.de>
- **
- ** Copyright (c) 1999-2001 The Squirrelmail Development Team
- ** Licensed under the GNU GPL. For full terms see the file COPYING.
- **
- ** Prevents users from reposting their form data after a successful logout.
- **
- ** $Id$
- **/
-
- require_once('../functions/i18n.php');
- require_once('../functions/strings.php');
- require_once('../config/config.php');
- require_once('../functions/prefs.php');
- require_once('../functions/imap.php');
- require_once('../functions/plugin.php');
- require_once('../functions/constants.php');
-
- function attachment_common_parse($str, $debug) {
- global $attachment_common_types, $attachment_common_types_parsed;
-
- $attachment_common_types_parsed[$str] = true;
- $types = explode(', ', $str);
-
- foreach ($types as $val)
- {
- // Ignore the ";q=1.0" stuff
- if (strpos($val, ';') !== false)
- $val = substr($val, 0, strpos($val, ';'));
-
- if (! isset($attachment_common_types[$val])) {
- $attachment_common_types[$val] = true;
- }
- }
+/**
+ * Prevents users from reposting their form data after a successful logout.
+ *
+ * Derived from webmail.php by Ralf Kraudelt <kraude@wiwi.uni-rostock.de>
+ *
+ * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id$
+ * @package squirrelmail
+ */
+$sInitLocation = 'redirect';
+
+/**
+ * Include the SquirrelMail initialization file.
+ */
+require('../include/init.php');
+
+/* SquirrelMail required files. */
+require_once(SM_PATH . 'functions/imap_general.php');
+require_once(SM_PATH . 'functions/strings.php');
+
+header('Pragma: no-cache');
+$location = get_location();
+
+// session_set_cookie_params (0, $base_uri);
+
+sqsession_unregister ('user_is_logged_in');
+sqsession_register ($base_uri, 'base_uri');
+
+/* get globals we me need */
+sqGetGlobalVar('login_username', $login_username);
+sqGetGlobalVar('secretkey', $secretkey);
+if(!sqGetGlobalVar('squirrelmail_language', $squirrelmail_language) || $squirrelmail_language == '') {
+ $squirrelmail_language = $squirrelmail_default_language;
+}
+if (!sqgetGlobalVar('mailtodata', $mailtodata)) {
+ $mailtodata = '';
+}
+
+/* end of get globals */
+
+set_up_language($squirrelmail_language, true);
+/* Refresh the language cookie. */
+sqsetcookie('squirrelmail_language', $squirrelmail_language, time()+2592000,
+ $base_uri);
+
+if (!isset($login_username)) {
+ logout_error( _("You must be logged in to access this page.") );
+ exit;
+}
+
+if (!sqsession_is_registered('user_is_logged_in')) {
+ do_hook('login_before', $null);
+
+ $onetimepad = OneTimePadCreate(strlen($secretkey));
+ $key = OneTimePadEncrypt($secretkey, $onetimepad);
+
+ /* remove redundant spaces */
+ $login_username = trim($login_username);
+
+ /* Verify that username and password are correct. */
+ if ($force_username_lowercase) {
+ $login_username = strtolower($login_username);