From 23a9084b656f292a848e504835db89ab5f20b453 Mon Sep 17 00:00:00 2001 From: jmunro Date: Thu, 7 Feb 2002 04:52:51 +0000 Subject: [PATCH] small changes/fixes. duplicate searches are not saved in recent table. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2376 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap_search.php | 2 +- src/search.php | 135 +++++++++++++++++++------------------- 2 files changed, 70 insertions(+), 67 deletions(-) diff --git a/functions/imap_search.php b/functions/imap_search.php index 9ae1323a..fbc9baeb 100644 --- a/functions/imap_search.php +++ b/functions/imap_search.php @@ -201,7 +201,7 @@ function sqimap_search($imapConnection,$search_where,$search_what,$mailbox,$colo echo ''; } echo ''; - $count_all += count($msgs); + $count_all = count($msgs); } return $count_all; } diff --git a/src/search.php b/src/search.php index 035cedc7..5d6cc4ec 100644 --- a/src/search.php +++ b/src/search.php @@ -16,9 +16,9 @@ require_once('../functions/array.php'); require_once('../functions/strings.php'); -// here are some functions, could go in imap_search.php -// this was here, pretty handy +/* here are some functions, could go in imap_search.php + this was here, pretty handy */ function s_opt( $val, $sel, $tit ) { echo " \n"; } -// function to get the recent searches and put them in arrays - +/* function to get the recent searches and put them in arrays */ function get_recent($pref_name, $username, $data_dir) { $array = array (); $recent_count = getPref($data_dir, $username, 'search_memory', 0); $n = 0; for ($x=1;$x<=$recent_count;$x++) { - $array[$n] = getPref($data_dir, $username, "$pref_name" . "$x", ""); - $n++; + $array[$n] = getPref($data_dir, $username, "$pref_name" . "$x", ""); + $n++; } return $array; } -// function to get the saved searches and put them in arrays - +/* function to get the saved searches and put them in arrays */ function get_saved($pref_name, $username, $data_dir) { $array = array (); $n = 0; for ($x=1;;$x++) { $array[$n] = getPref($data_dir, $username, "$pref_name" . "$x", ""); - if ($array[$n] == "") { - array_pop($array); - return $array; - } - $n++; + if ($array[$n] == "") { + array_pop($array); + return $array; + } + $n++; } return $array; } -// function to update pref file with recent searches - -function update_recent($array, $recent_value, $pref_name, $username, $data_dir) { - $array = get_recent($pref_name, $username, $data_dir); - array_push ($array, $recent_value); - array_shift ($array); +/* function to update recent pref arrays */ +function update_recent($what, $where, $mailbox, $username, $data_dir) { + $what_array = get_recent("search_what", $username, $data_dir); + $where_array = get_recent("search_where", $username, $data_dir); + $folder_array = get_recent("search_folder", $username, $data_dir); + $dupe = "no"; + for ($i=0;$i\n". @@ -197,8 +199,7 @@ echo "
\n". "\n". "\n"; -// update the recent and saved searches from the pref files - +/* update the recent and saved searches from the pref files */ $what_array = get_recent("search_what", $username, $data_dir); $where_array = get_recent("search_where", $username, $data_dir); $folder_array = get_recent("search_folder", $username, $data_dir); @@ -347,7 +348,7 @@ do_hook('search_after_form'); /* search all folders option still in the works. returns a table for each - folder it finds a match in. The toggle all link does not work + folder it finds a match in. */ if ($search_all == 'all') { @@ -363,17 +364,23 @@ if ($search_all == 'all') { if (($submit == "Search" || $submit == "Search_no_update") && !empty($what)) { sqimap_mailbox_select($imapConnection, $mailbox); $count_all = sqimap_search($imapConnection, $where, $what, $mailbox, $color, 0, $search_all, $count_all); + array_push($perbox_count, $count_all); + } + } + for ($i=0;$i' . _("No Messages found") . '
'; } } -// search one folder option - +/* search one folder option */ else { if (($submit == 'Search' || $submit == 'Search_no_update') && !empty($what)) { echo '
' . @@ -384,16 +391,12 @@ else { } } -// must have search terms to search - +/* must have search terms to search */ if ($submit == 'Search' && empty($what)) { echo "
Please enter something to search for
\n"; } do_hook("search_bottom"); - -// all done - sqimap_logout ($imapConnection); echo ''; -- 2.25.1