fixed warnings when not using search history
authorjmunro <jmunro@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 4 Apr 2002 14:43:19 +0000 (14:43 +0000)
committerjmunro <jmunro@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 4 Apr 2002 14:43:19 +0000 (14:43 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2678 7612ce4b-ef26-0410-bec9-ea0150e637f0

src/search.php

index 74faba4404b96d12bf812f32a8a4418fba5a7683..27fe5ca7590fd58d2924f4da7c6e18c99f43ba74 100644 (file)
@@ -165,6 +165,7 @@ $attributes = array ();
 $saved_attributes = array ();
 $search_all = 'none';
 $perbox_count = array ();
+$recent_count = getPref($data_dir, $username, 'search_memory', 0);
 
 /*  get mailbox names  */
 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
@@ -188,7 +189,9 @@ if ((!isset($submit) || empty($submit)) && !empty($what)) {
 if ( !isset( $submit ) ) {
     $submit = '';
 } else if ($submit == _("Search") && !empty($what)) {
-    update_recent($what, $where, $mailbox, $username, $data_dir);
+    if ($recent_count > 0) {
+        update_recent($what, $where, $mailbox, $username, $data_dir);
+    }
 }
 elseif ($submit == 'forget') {
     forget_recent($count, $username, $data_dir);
@@ -211,7 +214,6 @@ echo "<BR>\n".
 
 /*  update the recent and saved searches from the pref files  */
 $attributes = get_recent($username, $data_dir);
-$recent_count = getPref($data_dir, $username, 'search_memory', 0);
 $saved_attributes = get_saved($username, $data_dir);
 $saved_count = count($saved_attributes['saved_what']);
 $count_all = 0;