Fix prefs so they work under 4.2 as well as 4.1.x. This really needs to
[squirrelmail.git] / plugins / filters / filters.php
index 887d2c87d1995b98dc2bdff2d9d9863c5c1a786c..2c5c8809f668b5d7e491896700bd2903ae01fd49 100644 (file)
@@ -57,6 +57,7 @@ function filters_LoadCache () {
     global $data_dir, $SpamFilters_DNScache;
 
     if (file_exists($data_dir . "/dnscache")) {
+        $SpamFilters_DNScache = array();
         if ($fp = fopen ($data_dir . "/dnscache", "r")) {
             flock($fp,LOCK_SH);
             while ($data=fgetcsv($fp,1024)) {
@@ -73,7 +74,8 @@ function filters_LoadCache () {
 
 function filters_bulkquery($filters_spam_scan, $filters, $read) {
     global $SpamFilters_YourHop, $attachment_dir, $username,
-           $SpamFilters_DNScache, $SpamFilters_BulkQuery;
+           $SpamFilters_DNScache, $SpamFilters_BulkQuery,
+           $SpamFilters_CacheTTL;
 
     $IPs = array();
     $i = 0;
@@ -152,6 +154,7 @@ function filters_bulkquery($filters_spam_scan, $filters, $read) {
 
         $bqfil = $attachment_dir . $username . "-bq.in";
         $fp = fopen($bqfil, "w");
+        fputs ($fp, $SpamFilters_CacheTTL . "\n");
         foreach ($rbls as $key => $value) {
             fputs ($fp, "." . $key . "\n");
         }
@@ -333,6 +336,11 @@ function filter_search_and_delete($imap, $where, $what, $where_to) {
     } else {
         $search_str = "SEARCH CHARSET US-ASCII ALL ";
     }
+    if ($where == "Header") {
+       $what = explode(':', $what);
+       $where = trim($where . ' ' . $what[0]);
+       $what = addslashes(trim($what[1]));
+    }
     $search_str .= $where . ' {' . strlen($what) . "}\r\n" . $what . "\r\n";
     
     fputs ($imap, "a001 $search_str");