Keep on going... filters plugin rg=0 compat.
authorkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 25 Sep 2002 16:19:53 +0000 (16:19 +0000)
committerkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 25 Sep 2002 16:19:53 +0000 (16:19 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3728 7612ce4b-ef26-0410-bec9-ea0150e637f0

plugins/filters/filters.php
plugins/filters/options.php
plugins/filters/setup.php
plugins/filters/spamoptions.php

index 4d88d6f..9b19eca 100644 (file)
@@ -162,9 +162,12 @@ function filters_bulkquery($filters_spam_scan, $filters, $read) {
 }
 
 function start_filters() {
-    global $mailbox, $username, $key, $imapServerAddress, $imapPort, $imap,
+    global $mailbox, $imapServerAddress, $imapPort, $imap,
            $imap_general, $filters, $imap_stream, $imapConnection,
-           $UseSeparateImapConnection, $AllowSpamFilters;
+           $UseSeparateImapConnection, $AllowSpamFilters, $_SESSION, $_COOKIE;
+
+    $username = $_SESSION['username'];
+    $key = $_COOKIE['key'];
 
 #    if ($mailbox == 'INBOX') {
         // Detect if we have already connected to IMAP or not.
@@ -411,7 +414,7 @@ function spam_filters($imap_stream) {
     if ($SpamFilters_SharedCache) {
        filters_SaveCache();
     } else {
-       session_register('SpamFilters_DNScache');
+       sqsession_register($SpamFilters_DNScache, 'SpamFilters_DNScache');
     }
 
 }
index 747890f..f402a1f 100644 (file)
@@ -39,8 +39,32 @@ require_once(SM_PATH . 'plugins/filters/filters.php');
 
    displayPageHeader($color, 'None');
 
-   if (isset($filter_submit)) {
-      if (!isset($theid)) $theid = 0;
+   $username = $_SESSION['username'];
+   $key = $_COOKIE['key'];
+   $onetimepad = $_SESSION['onetimepad'];
+   $delimiter = $_SESSION['delimiter'];
+   if(isset($_GET['theid'])) {
+       $theid = $_GET['theid'];
+   }
+   if(isset($_POST['theid'])) {
+       $theid = $_POST['theid'];
+   }
+   if(isset($_GET['action'])) {
+       $action = $_GET['action'];
+   }
+
+   if (isset($_POST['filter_submit'])) {
+      if(isset($_GET['theid'])) {
+          $theid = $_GET['theid'];
+      } elseif (isset($_POST['theid'])) {
+          $theid = $_POST['theid'];
+      } else {
+          $theid = 0;
+      }
+      $filter_what   = $_POST['filter_what'];
+      $filter_where  = $_POST['filter_where'];
+      $filter_folder = $_POST['filter_folder'];
+
       $filter_what = ereg_replace(",", " ", $filter_what);
       $filter_what = str_replace("\\\\", "\\", $filter_what);
       $filter_what = str_replace("\\\"", "\"", $filter_what);
@@ -60,9 +84,9 @@ require_once(SM_PATH . 'plugins/filters/filters.php');
       filter_swap($theid, $theid - 1);
    } elseif (isset($action) && $action == 'move_down') {
       filter_swap($theid, $theid + 1);
-   } elseif (isset($user_submit)) {
-       echo "<br><center><b>"._("Saved Scan type")."</b></center>\n";
-       setPref($data_dir, $username, 'filters_user_scan', $filters_user_scan_set);
+   } elseif (isset($_POST['user_submit'])) {
+       setPref($data_dir, $username, 'filters_user_scan', $_POST['filters_user_scan_set']);
+       echo '<br><center><b>'._("Saved Scan type")."</b></center>\n";
    }
 
    $filters = load_filters();
@@ -105,6 +129,9 @@ require_once(SM_PATH . 'plugins/filters/filters.php');
         'center' ) . '<br>';
 
     if (isset($action) && ($action == 'add' || $action == 'edit')) {
+        $username = $_SESSION['username'];
+        $key = $_COOKIE['key'];
+
         $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
         $boxes = sqimap_mailbox_list($imapConnection);
         sqimap_logout($imapConnection);
index 1522a1a..7a53e91 100644 (file)
@@ -105,10 +105,19 @@ $SpamFilters_CacheTTL = 7200;
 
 function squirrelmail_plugin_init_filters() {
     global $squirrelmail_plugin_hooks;
-    global $mailbox, $imap_stream, $imapConnection;
+
+    if (isset($_GET['mailbox'])) {
+        $mailbox = $_GET['mailbox'];
+    }
+    elseif (isset($_POST['mailbox'])) {
+        $mailbox = $_POST['mailbox'];
+    }
+    else {
+        $mailbox = 'INBOX';
+    }
 
     $squirrelmail_plugin_hooks['left_main_before']['filters'] = 'start_filters';
-    if ($mailbox == 'INBOX') {
+    if (isset($mailbox) && $mailbox == 'INBOX') {
         $squirrelmail_plugin_hooks['right_main_after_header']['filters'] = 'start_filters';
     }
     $squirrelmail_plugin_hooks['optpage_register_block']['filters'] = 'filters_optpage_register_block';
index f0cc8e1..2cc694b 100644 (file)
@@ -36,17 +36,26 @@ require_once(SM_PATH . 'functions/html.php');
 require_once(SM_PATH . 'plugins/filters/filters.php');
 global $AllowSpamFilters;
 
+$username = $_SESSION['username'];
+$key = $_COOKIE['key'];
+$onetimepad = $_SESSION['onetimepad'];
+$delimiter = $_SESSION['delimiter'];
+
+if (isset($_GET['action'])) {
+    $action = $_GET['action'];
+}
+
 displayPageHeader($color, 'None');
 
-if (isset($spam_submit)) {
+if (isset($_POST['spam_submit'])) {
     $spam_filters = load_spam_filters();
-    setPref($data_dir, $username, 'filters_spam_folder', $filters_spam_folder_set);
-    setPref($data_dir, $username, 'filters_spam_scan', $filters_spam_scan_set);
+    setPref($data_dir, $username, 'filters_spam_folder', $_POST['filters_spam_folder_set']);
+    setPref($data_dir, $username, 'filters_spam_scan', $_POST['filters_spam_scan_set']);
     foreach ($spam_filters as $Key => $Value) {
         $input = $spam_filters[$Key]['prefname'] . '_set';
-        if ( isset( $$input ) ) {
+        if ( isset( $_POST[$input] ) ) {
             setPref( $data_dir, $username, $spam_filters[$Key]['prefname'],
-                     $$input);
+                     $_POST[$input]);
         } else {
             removePref($data_dir, $username, $spam_filters[$Key]['prefname']);
         }
@@ -78,10 +87,9 @@ if (isset($action) && $action == 'spam') {
     $boxes = sqimap_mailbox_list($imapConnection);
     sqimap_logout($imapConnection);
     for ($i = 0; $i < count($boxes) && $filters_spam_folder == ''; $i++) {
-
-        if ($boxes[$i]['flags'][0] != 'noselect' &&
-            $boxes[$i]['flags'][1] != 'noselect' &&
-            $boxes[$i]['flags'][2] != 'noselect') {
+        if ((isset($boxes[$i]['flags'][0]) && $boxes[$i]['flags'][0] != 'noselect') &&
+            (isset($boxes[$i]['flags'][1]) && $boxes[$i]['flags'][1] != 'noselect') &&
+            (isset($boxes[$i]['flags'][2]) && $boxes[$i]['flags'][2] != 'noselect')) {
             $filters_spam_folder = $boxes[$i]['unformatted'];
         }
     }
@@ -176,7 +184,7 @@ if (isset($action) && $action == 'spam') {
 
 }
 
-if (! isset($action) || $action != 'spam') {
+if (! isset($_GET['action']) || $_GET['action'] != 'spam') {
 
     echo html_tag( 'p', '', 'center' ) .
          '[<a href="spamoptions.php?action=spam">' . _("Edit") . '</a>]' .