From: kink Date: Wed, 25 Sep 2002 16:19:53 +0000 (+0000) Subject: Keep on going... filters plugin rg=0 compat. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=41100fce5421f43c40c4db946fe01b4f31e34913;p=squirrelmail.git Keep on going... filters plugin rg=0 compat. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3728 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/plugins/filters/filters.php b/plugins/filters/filters.php index 4d88d6f7..9b19ecaa 100644 --- a/plugins/filters/filters.php +++ b/plugins/filters/filters.php @@ -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'); } } diff --git a/plugins/filters/options.php b/plugins/filters/options.php index 747890f8..f402a1f1 100644 --- a/plugins/filters/options.php +++ b/plugins/filters/options.php @@ -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 "
"._("Saved Scan type")."
\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 '
'._("Saved Scan type")."
\n"; } $filters = load_filters(); @@ -105,6 +129,9 @@ require_once(SM_PATH . 'plugins/filters/filters.php'); 'center' ) . '
'; 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); diff --git a/plugins/filters/setup.php b/plugins/filters/setup.php index 1522a1a7..7a53e910 100644 --- a/plugins/filters/setup.php +++ b/plugins/filters/setup.php @@ -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'; diff --git a/plugins/filters/spamoptions.php b/plugins/filters/spamoptions.php index f0cc8e11..2cc694b4 100644 --- a/plugins/filters/spamoptions.php +++ b/plugins/filters/spamoptions.php @@ -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' ) . '[' . _("Edit") . ']' .