SM_PATH already defined
[squirrelmail.git] / src / redirect.php
index 8144be017f7d329a99e04fe610441d7bba84bd73..c570974339cc64f775ab5273f7ff92268fbf3da3 100644 (file)
@@ -82,7 +82,7 @@ if (!isset($login_username)) {
     exit;
 }
 
-if (!session_is_registered('user_is_logged_in')) {
+if (!sqsession_is_registered('user_is_logged_in')) {
     do_hook ('login_before');
 
     $onetimepad = OneTimePadCreate(strlen($secretkey));
@@ -164,10 +164,12 @@ if ($javascript_setting != SMPREF_JS_ON){
 /* Update the prefs */
 setPref($data_dir, $username, 'javascript_on', $js_pref);
 
-global $attachments;
-$attachments = unserialize(getPref($data_dir, $username, 'attachments', 0));
 /* Compute the URL to forward the user to. */
-    global $session_expired_location, $session_expired_post;
+    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) {
@@ -177,26 +179,12 @@ $attachments = unserialize(getPref($data_dir, $username, 'attachments', 0));
        }
        sqsession_unregister('session_expired_location');
        unset($session_expired_location);
-       if (is_array($compose_messages)) {
-          sqsession_register('compose_messages');
-       }
     } else {
-/* need to be adapted to compose_messages.
-       if (is_array($attachments)) {
-          $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
-          foreach ($attachments as $attachment) {
-            $attached_file = $hashed_attachment_dir.'/'.$attachment['localfilename'];
-            if (file_exists($attached_file)) {
-                unlink($attached_file);
-            }
-          }
-          removePref($data_dir, $username, 'attachments');
-       }
-*/       
        $redirect_url = 'webmail.php';
     }
 
-/* Send them off to the appropriate page. */
+/* Write session data and send them off to the appropriate page. */
+session_write_close();
 header("Location: $redirect_url");
 
 /* --------------------- end main ----------------------- */