Fix for bug on filters plugin which allows user to select INBOX as a
[squirrelmail.git] / plugins / filters / filters.php
index 135cfda33fa64d195739c8ff089922998995a2c9..3c80671e65a33d8337c9c6ce1e6ca440c39c0571 100644 (file)
@@ -19,7 +19,7 @@
  * Also view plugins/README.plugins for more information.
  *
  * @version $Id$
- * @copyright (c) 1999-2004 The SquirrelMail Project Team
+ * @copyright (c) 1999-2005 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @package plugins
  * @subpackage filters
@@ -210,6 +210,11 @@ function filter_search_and_delete($imap_stream, $where, $what, $where_to, $user_
                                   $should_expunge) {
     global $languages, $squirrelmail_language, $allow_charset_search, $imap_server_type;
 
+    if (strtolower($where_to) == 'inbox') {
+        return array();
+    }
+
+
     if ($user_scan == 'new') {
         $category = 'UNSEEN';
     } else {
@@ -231,10 +236,11 @@ function filter_search_and_delete($imap_stream, $where, $what, $where_to, $user_
         $what  = addslashes(trim($what[1]));
     }
 
-    if ($imap_server_type == 'macosx') {
-       $search_str .= ' ' . $where . ' ' . $what;
+    // see comments in squirrelmail sqimap_search function
+    if ($imap_server_type == 'macosx' || $imap_server_type == 'hmailserver') {
+        $search_str .= ' ' . $where . ' ' . $what;
     } else {
-       $search_str .= ' ' . $where . ' {' . strlen($what) . "}\r\n"
+        $search_str .= ' ' . $where . ' {' . strlen($what) . "}\r\n"
                     . $what . "\r\n";
     }
 
@@ -792,4 +798,4 @@ function do_error($string) {
     echo $string;
     echo "</font></p>\n";
 }
-?>
\ No newline at end of file
+?>