- added more hooks
[squirrelmail.git] / src / move_messages.php
index 8bf6e87e08f094e17731fe6122b295ab88807d0e..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;
             }
             $i++;
          }
-         if ($auto_expunge)
+         if ($auto_expunge) {
             sqimap_mailbox_expunge($imapConnection, $mailbox);
-
-         if ($auto_forward) {   
-            header ("Location: right_main.php");
-         } 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);
       }
          if ($auto_expunge == true)
             sqimap_mailbox_expunge($imapConnection, $mailbox);
 
-         if ($auto_forward) {   
-            header ("Location: right_main.php");
-         } 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);
       }