Small optimization and fixed None folder bug.
authorphilippe_mingo <philippe_mingo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 4 Jan 2002 11:52:26 +0000 (11:52 +0000)
committerphilippe_mingo <philippe_mingo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 4 Jan 2002 11:52:26 +0000 (11:52 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2089 7612ce4b-ef26-0410-bec9-ea0150e637f0

src/search.php

index eddf8ae3943bf7c20ca5846350dae3cc7623b350..14de0d8626107697b779142d2a0bceae8bdcd35d 100644 (file)
@@ -24,8 +24,14 @@ function s_opt( $val, $sel, $tit ) {
 
 /* ------------------------ main ------------------------ */
 
-displayPageHeader($color, $mailbox);
 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+$boxes = sqimap_mailbox_list($imapConnection);
+
+if( $mailbox == 'None' ) {
+    $mailbox = $boxes[0]['unformatted'];
+}
+
+displayPageHeader($color, $mailbox);
 
 if( !isset( $search_memory ) ) {
     $search_memory = 0;
@@ -63,8 +69,6 @@ for ( $form = 0; $form <= $search_memory; $form++ ) {
              "       <TD WIDTH=\"33%\">\n".
              '         <TT><SMALL><SELECT NAME="mailbox">';
         
-        $boxes = sqimap_mailbox_list($imapConnection);
-        
         for ($i = 0; $i < count($boxes); $i++) {
             if (!in_array('noselect', $boxes[$i]['flags'])) {
                 $box = $boxes[$i]['unformatted'];