fixed for changes to conf.pl.
[squirrelmail.git] / src / search.php
index 74faba4404b96d12bf812f32a8a4418fba5a7683..3d49744ef5b0d40026b1d681966a446e6da072d5 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;
@@ -366,9 +368,9 @@ do_hook('search_after_form');
 */
 
 $old_value = 0;
-if ($allow_thread_sort == true) {
+if ($allow_thread_sort == TRUE) {
     $old_value = $allow_thread_sort;
-    $allow_thread_sort = false;
+    $allow_thread_sort = FALSE;
 }
 
 if ($search_all == 'all') {
@@ -389,11 +391,11 @@ if ($search_all == 'all') {
     }
     for ($i=0;$i<count($perbox_count);$i++) {
         if ($perbox_count[$i] != "") {
-           break;
+            $count_all = "found";
+            break;
         }
-        $count_all = "none";
     }
-    if ($count_all == "none") {
+    if ($count_all != "found") {
         echo '<br><b>' .
              _("No Messages found") .
              '</b><br>';