Fix an odd circular loop in redirect.
authorebullient <ebullient@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 28 Jan 2003 17:44:53 +0000 (17:44 +0000)
committerebullient <ebullient@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 28 Jan 2003 17:44:53 +0000 (17:44 +0000)
If you have compose in new window off:
*  close SquirrelMail session.
*  go directly to webmail.php (causes redirect for login)
*  in redirect.php, url was assigned: webmail.php?right_frame=webmail.php
   which caused nested frameset.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4479 7612ce4b-ef26-0410-bec9-ea0150e637f0

src/redirect.php

index 3b25fff92a16a27fc3309feca5668a302752008a..ad0d31de6149f79afddb51c34c64e105dbfff6f1 100644 (file)
@@ -154,23 +154,18 @@ if ($javascript_setting != SMPREF_JS_ON){
 setPref($data_dir, $username, 'javascript_on', $js_pref);
 
 /* Compute the URL to forward the user to. */
-    if (isset($_SESSION['session_expired_location'])) {
-       $session_expired_location= $_SESSION['session_expired_location'];
-    } else {
-       $session_expired_location=false;
-    }
-    if (isset($session_expired_location) && $session_expired_location) {
-       $compose_new_win = getPref($data_dir, $username, 'compose_new_win', 0);
-       if ($compose_new_win) {
-          $redirect_url = $session_expired_location;
-       } else {
-          $redirect_url = 'webmail.php?right_frame='.urldecode($session_expired_location);
-       }
-       sqsession_unregister('session_expired_location');
-       unset($session_expired_location);
-    } else {
-       $redirect_url = 'webmail.php';
+$redirect_url = 'webmail.php';
+
+if ( sqgetGlobalVar('session_expired_location', $session_expired_location, SQ_SESSION) ) {
+    sqsession_unregister('session_expired_location');
+    $compose_new_win = getPref($data_dir, $username, 'compose_new_win', 0);
+    if ($compose_new_win) {
+        $redirect_url = $session_expired_location;
+    } elseif ( strpos($session_expired_location, 'webmail.php') === FALSE ) {
+        $redirect_url = 'webmail.php?right_frame='.urldecode($session_expired_location);
     }
+    unset($session_expired_location);
+}
 
 /* Write session data and send them off to the appropriate page. */
 session_write_close();