From 0d672ac0213e1aa4b87954a10796cf4fdc0adf3c Mon Sep 17 00:00:00 2001 From: philippe_mingo Date: Fri, 4 Jan 2002 11:39:06 +0000 Subject: [PATCH] Added the possibility to remember up to 9 searchs. 0 disables searching memory. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2086 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/load_prefs.php | 3 + src/options_folder.php | 16 +++++ src/search.php | 140 +++++++++++++++++++++++++---------------- 3 files changed, 106 insertions(+), 53 deletions(-) diff --git a/src/load_prefs.php b/src/load_prefs.php index 30bce80e..07856cf1 100644 --- a/src/load_prefs.php +++ b/src/load_prefs.php @@ -225,6 +225,9 @@ $javascript_setting = getPref($data_dir, $username, 'javascript_setting', SMPREF_JS_AUTODETECT); $javascript_on = getPref($data_dir, $username, 'javascript_on', SMPREF_ON); +global $search_memory; +$search_memory = getPref($data_dir, $username, 'search_memory', 2); + do_hook('loading_prefs'); ?> \ No newline at end of file diff --git a/src/options_folder.php b/src/options_folder.php index 383d6ff0..0cd7333e 100644 --- a/src/options_folder.php +++ b/src/options_folder.php @@ -185,6 +185,22 @@ function load_optpage_data_folder() { SMPREF_TIME_24HR => _("24-hour clock")) ); + $optvals[SMOPT_GRP_FOLDERLIST][] = array( + 'name' => 'search_memory', + 'caption' => _("Memory Search"), + 'type' => SMOPT_TYPE_STRLIST, + 'refresh' => SMOPT_REFRESH_FOLDERLIST, + 'posvals' => array( 0 => _("Disabled"), + 1 => '1', + 2 => '2', + 3 => '3', + 4 => '4', + 5 => '5', + 6 => '6', + 7 => '7', + 8 => '8', + 9 => '9') + /* Assemble all this together and return it as our result. */ $result = array( 'grps' => $optgrps, diff --git a/src/search.php b/src/search.php index 8081f0c2..eddf8ae3 100644 --- a/src/search.php +++ b/src/search.php @@ -16,80 +16,114 @@ require_once('../functions/array.php'); function s_opt( $val, $sel, $tit ) { echo " \n"; } +/* ------------------------ main ------------------------ */ + displayPageHeader($color, $mailbox); $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); +if( !isset( $search_memory ) ) { + $search_memory = 0; +} + do_hook('search_before_form'); echo "
\n". - " \n". - " \n". - '
\n". - "
"._("Search")."
\n". - "
'. + " \n". + " \n". + '
\n". + "
"._("Search")."
\n". + "
'; - "
\n". - " \n". - " \n". - " \n". - " '. - "\n". - " \n". - " \n". - "
\n". - ' '. - " \n"; -if (!isset($what)) { - $what = ''; -} -$what_disp = ereg_replace(',', ' ', $what); -$what_disp = str_replace('\\\\', '\\', $what_disp); -$what_disp = str_replace('\\"', '"', $what_disp); -$what_disp = str_replace('"', '"', $what_disp); -echo " \n". - '\n". - '\n"; + if( !($form == 0 && $search_memory > 0) ) { -s_opt( 'BODY', ($where == 'BODY'), _("Body") ); -s_opt( 'TEXT', ($where == 'TEXT'), _("Everywhere") ); -s_opt( 'SUBJECT', ($where == 'SUBJECT'), _("Subject") ); -s_opt( 'FROM', ($where == 'FROM'), _("From") ); -s_opt( 'CC', ($where == 'CC'), _("Cc") ); -s_opt( 'TO', ($where == 'TO'), _("To") ); + echo "\n". + "". + " \n". + " \n". + " '. + "\n". + " \n". + " \n". + ''; + } + echo "
\n". + ' '. + " \n"; + if (!isset($$what)) { + $$what = ''; + } + $what_disp = str_replace(',', ' ', $$what); + $what_disp = str_replace('\\\\', '\\', $what_disp); + $what_disp = str_replace('\\"', '"', $what_disp); + $what_disp = str_replace('"', '"', $what_disp); + echo " \n". + '\n". + "\n" . + " \n". + " \n". + "
\n"; +} -echo " \n" . - "
\n". - " \n". - "
\n". - "". - "
"; +echo "
"; do_hook("search_after_form"); -if (isset($where) && $where && isset($what) && $what) { +if( !isset( $pos ) ) { + $pos = $frm; +} +$what = "what$pos"; +$where = "where$pos"; + +if (isset($$where) && $$where && isset($$what) && $$what) { sqimap_mailbox_select($imapConnection, $mailbox); - sqimap_search($imapConnection, $where, $what, $mailbox, $color); + sqimap_search($imapConnection, $$where, $$what, $mailbox, $color); } do_hook("search_bottom"); sqimap_logout ($imapConnection); echo ''; -?> +?> \ No newline at end of file -- 2.25.1