whoops, i submitted the wrong compose. :)
[squirrelmail.git] / src / move_messages.php
index 6ddcc1e03b86f7eeb112fe72039372751a584d83..8b7b7cf802770ac1c1c61041ed2fdf131a90f3ac 100644 (file)
@@ -1,4 +1,13 @@
-<?
+<?php
+   /**
+    **  move_messages.php
+    **
+    **  Copyright (c) 1999-2000 The SquirrelMail development team
+    **  Licensed under the GNU GPL. For full terms see the file COPYING.
+    **
+    **  Enables message moving between folders on the IMAP server.
+    **/
+
    session_start();
 
    if (!isset($config_php))
@@ -14,8 +23,6 @@
 
    include("../src/load_prefs.php");
 
-//   echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
-
    function putSelectedMessagesIntoString($msg) {
       $j = 0;
       $i = 0;
@@ -44,7 +51,6 @@
 
    // If the delete button was pressed, the moveButton variable will not be set.
    if (!$moveButton) {
- //     displayPageHeader($color, $mailbox);
       if (is_array($msg) == 1) {
          // Marks the selected messages ad 'Deleted'
          $j = 0;
             }
             $i++;
          }
-         if ($auto_expunge)
+         if ($auto_expunge) {
             sqimap_mailbox_expunge($imapConnection, $mailbox);
-
-         if ($auto_forward) {   
-            header ("Location: right_main.php?PHPSESSID=$PHPSESSID");
-         } else {
-            echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
-            displayPageHeader($color, $mailbox);
-            messages_deleted_message($mailbox, $sort, $startMessage, $color);
          }
+         $location = get_location();
+         if ($where && $what)
+            header ("Location: $location/search.php?mailbox=".urlencode($mailbox)."&what=".urlencode($what)."&where=".urlencode($where));
+         else   
+            header ("Location: $location/right_main.php?sort=$sort&startMessage=$startMessage&mailbox=". urlencode($mailbox));
       } else {
-         echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
          displayPageHeader($color, $mailbox);
          error_message(_("No messages were selected."), $mailbox, $sort, $startMessage, $color);
       }
    } else {    // Move messages
-//      displayPageHeader($color, $mailbox);
       // lets check to see if they selected any messages
       if (is_array($msg) == 1) {
          $j = 0;
          if ($auto_expunge == true)
             sqimap_mailbox_expunge($imapConnection, $mailbox);
 
-         if ($auto_forward) {   
-            header ("Location: right_main.php?PHPSESSID=$PHPSESSID");
-         } else {
-            echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
-            displayPageHeader($color, $mailbox);
-            messages_moved_message($mailbox, $sort, $startMessage, $color);
-         }
+         $location = get_location();
+         if ($where && $what)
+            header ("Location: $location/search.php?mailbox=".urlencode($mailbox)."&what=".urlencode($what)."&where=".urlencode($where));
+         else   
+            header ("Location: $location/right_main.php?sort=$sort&startMessage=$startMessage&mailbox=". urlencode($mailbox));
       } else {
-         echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
          displayPageHeader($color, $mailbox);
          error_message(_("No messages were selected."), $mailbox, $sort, $startMessage, $color);
       }