Add access keys to mailbox list
[squirrelmail.git] / src / redirect.php
index 6443ce5aa162012bad1da3d5a6e6fc754d5ce6d9..dd9df62d3905f2a01b955010f4b63575204ca257 100644 (file)
@@ -136,6 +136,12 @@ if ( sqgetGlobalVar('HTTP_ACCEPT', $http_accept, SQ_SERVER) &&
     attachment_common_parse($http_accept);
 }
 
+// having just logged in, need to synch the template file cache
+// so the right template set is displayed (per user prefs)
+require(SM_PATH . 'include/load_prefs.php');
+global $sTemplateID;
+Template::cache_template_file_hierarchy($sTemplateID, TRUE);
+
 /* Complete autodetection of Javascript. */
 checkForJavascript();
 
@@ -149,12 +155,13 @@ if ( sqgetGlobalVar('session_expired_location', $session_expired_location, SQ_SE
         if ($compose_new_win) {
             // do not prefix $location here because $session_expired_location is set to the PAGE_NAME
             // of the last page
-            $redirect_url = $location . $session_expired_location . '.php';
+            $redirect_url = $location . '/' . $session_expired_location . '.php';
         } else {
-            $redirect_url = $location . '/webmail.php?right_frame=compose.php';
+            $redirect_url = $location . '/webmail.php?right_frame=' . urlencode($session_expired_location . '.php');
         }
-    } else {
-        $redirect_url = $location . '/webmail.php?right_frame=' . urlencode($session_expired_location) . '.php';
+    } else if ($session_expired_location != 'webmail' 
+            && $session_expired_location != 'left_main') {
+        $redirect_url = $location . '/webmail.php?right_frame=' . urlencode($session_expired_location . '.php');
     }
     unset($session_expired_location);
 }