Removing translations. Part four
[squirrelmail.git] / src / redirect.php
index 89529f11559359c49168328ac30e9eb5d4dc412d..6bdff659d75063eb6e04219530f93e52df14992e 100644 (file)
@@ -37,7 +37,7 @@ header('Pragma: no-cache');
 $location = get_location();
 
 session_set_cookie_params (0, $base_uri);
-session_start();
+sqsession_is_active();
 
 sqsession_unregister ('user_is_logged_in');
 sqsession_register ($base_uri, 'base_uri');
@@ -49,6 +49,9 @@ sqGetGlobalVar('js_autodetect_results', $js_autodetect_results);
 if(!sqGetGlobalVar('squirrelmail_language', $squirrelmail_language) || $squirrelmail_language == '') {
        $squirrelmail_language = $squirrelmail_default_language;
 }
+if (!sqgetGlobalVar('mailto', $mailto)) {
+    $mailto = '';
+}
 
 /* end of get globals */
 
@@ -135,18 +138,24 @@ if ($javascript_setting != SMPREF_JS_ON){
 setPref($data_dir, $username, 'javascript_on', $js_pref);
 
 /* Compute the URL to forward the user to. */
-$redirect_url = 'webmail.php';
+$redirect_url = $location . '/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) {
+        // do not prefix $location here because $session_expired_location is set to PHP_SELF
+        // of the last page
         $redirect_url = $session_expired_location;
     } elseif ( strpos($session_expired_location, 'webmail.php') === FALSE ) {
-        $redirect_url = 'webmail.php?right_frame='.urldecode($session_expired_location);
+        $redirect_url = $location.'/webmail.php?right_frame='.urldecode($session_expired_location);
     }
     unset($session_expired_location);
 }
+if($mailto != '') {
+    $redirect_url  = $location . '/webmail.php?right_frame=compose.php&mailto=';
+    $redirect_url .= $mailto;
+}
 
 /* Write session data and send them off to the appropriate page. */
 session_write_close();