From 174523e3a1dc61d86e1ab04776665b731a375b8f Mon Sep 17 00:00:00 2001 From: jangliss Date: Mon, 21 Feb 2005 06:59:59 +0000 Subject: [PATCH] Fix for bug on filters plugin which allows user to select INBOX as a destination. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@8889 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 2 ++ plugins/filters/filters.php | 7 ++++++- plugins/filters/options.php | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 59fad243..2127841d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -233,6 +233,8 @@ Version 1.5.1 -- CVS - Fixed bug #1032366, remove NUL characters in text attachments on sent. - URL Encode required for string being passed in mailto: links to pass on additional values (cc, body, subject etc). + - Fixed bug #801060. Removed option for INBOX in filters plugin as source + is always INBOX. Version 1.5.0 -------------------- diff --git a/plugins/filters/filters.php b/plugins/filters/filters.php index 8261c27c..3c80671e 100644 --- a/plugins/filters/filters.php +++ b/plugins/filters/filters.php @@ -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 { @@ -793,4 +798,4 @@ function do_error($string) { echo $string; echo "

\n"; } -?> \ No newline at end of file +?> diff --git a/plugins/filters/options.php b/plugins/filters/options.php index 01802334..f7043992 100644 --- a/plugins/filters/options.php +++ b/plugins/filters/options.php @@ -84,11 +84,18 @@ if (sqgetGlobalVar('filter_submit',$filter_submit,SQ_POST)) { $filter_what = str_replace("\\\"", '"', $filter_what); $filter_what = str_replace('"', '"', $filter_what); + if (empty($filter_what)) { + do_error(_("WARNING! You must enter something to search for.")); + $action = 'edit'; + } + if (($filter_where == 'Header') && (strchr($filter_what,':') == '')) { do_error(_("WARNING! Header filters should be of the format "Header: value"")); $action = 'edit'; } + if ($action != 'edit') { setPref($data_dir, $username, 'filter'.$theid, $filter_where.','.$filter_what.','.$filter_folder); + } $filters[$theid]['where'] = $filter_where; $filters[$theid]['what'] = $filter_what; $filters[$theid]['folder'] = $filter_folder; @@ -149,6 +156,13 @@ if (sqgetGlobalVar('filter_submit',$filter_submit,SQ_POST)) { $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); $boxes = sqimap_mailbox_list($imapConnection); + + for ($a = 0, $cnt = count($boxes); $a < $cnt; $a++) { + if (strtolower($boxes[$a]['formatted']) == 'inbox') { + unset($boxes[$a]); + } + } + sqimap_logout($imapConnection); if ( !isset($theid) ) { $theid = count($filters); -- 2.25.1