Another sneaky folder list (or two)
authorsizzlingmercury <sizzlingmercury@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 24 Oct 2002 06:20:56 +0000 (06:20 +0000)
committersizzlingmercury <sizzlingmercury@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 24 Oct 2002 06:20:56 +0000 (06:20 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3994 7612ce4b-ef26-0410-bec9-ea0150e637f0

plugins/filters/spamoptions.php
plugins/mail_fetch/options.php

index e4769ca..015aa17 100644 (file)
@@ -104,17 +104,10 @@ if (isset($action) && $action == 'spam') {
                 html_tag( 'td', '', 'left' ) .
                     '<select name="filters_spam_folder_set">';
 
                 html_tag( 'td', '', 'left' ) .
                     '<select name="filters_spam_folder_set">';
 
-    for ($i = 0; $i < $numboxes; $i++) {
-        if (! in_array('noselect', $boxes[$i]['flags'])) {
-            $box = $boxes[$i]['unformatted'];
-            $box2 = str_replace(' ', '&nbsp;', $boxes[$i]['formatted']);
-            if ($filters_spam_folder == $box) {
-                echo "<OPTION VALUE=\"$box\" SELECTED>$box2</OPTION>\n";
-            } else {
-                echo "<OPTION VALUE=\"$box\">$box2</OPTION>\n";
-            }
-        }
-    }
+        $selected = 0;
+        if ( isset($filters_spam_folder) )
+          $selected = array(strtolower($filters_spam_folder));
+        echo sqimap_mailbox_option_list(0, $selected, 0, $boxes);
     echo    '</select>'.
         '</td>'.
         '</tr>'.
     echo    '</select>'.
         '</td>'.
         '</tr>'.
index 2771528..af8ec27 100644 (file)
@@ -208,17 +208,11 @@ require_once(SM_PATH . 'include/load_prefs.php');
         $imapConnection = sqimap_login ($username, $key, $imapServerAddress, $imapPort, 0);
         $boxes = sqimap_mailbox_list($imapConnection);
         echo '<select name="mf_subfolder">';
         $imapConnection = sqimap_login ($username, $key, $imapServerAddress, $imapPort, 0);
         $boxes = sqimap_mailbox_list($imapConnection);
         echo '<select name="mf_subfolder">';
-        $boxes = sqimap_mailbox_list($imapConnection);
-        for ($i = 0; $i < count($boxes); $i++) {
-            if (!in_array('noselect', $boxes[$i]['flags'])) {
-                $box = $boxes[$i]['unformatted'];
-                $box2 = str_replace(' ', '&nbsp;', $boxes[$i]['unformatted-disp']);
-                if ( strtolower( $box2 ) == 'inbox' ) {
-                    $box2 = _("INBOX");
-                }
-                echo "<option value=\"$box\">$box2</option>\n";
-            }
-        }        
+
+        $selected = 0;
+        if ( isset($mf_subfolder) )
+          $selected = array(strtolower($mf_subfolder));
+        echo sqimap_mailbox_option_list($imapConnection, $selected);
         echo '</select></td></tr>' .
                 html_tag( 'tr',
                     html_tag( 'th', '&nbsp;', 'right' ) .
         echo '</select></td></tr>' .
                 html_tag( 'tr',
                     html_tag( 'th', '&nbsp;', 'right' ) .
@@ -326,19 +320,10 @@ require_once(SM_PATH . 'include/load_prefs.php');
         $imapConnection = sqimap_login ($username, $key, $imapServerAddress, $imapPort, 0);
         $boxes = sqimap_mailbox_list($imapConnection);
         echo '<select name="mf_subfolder">';
         $imapConnection = sqimap_login ($username, $key, $imapServerAddress, $imapPort, 0);
         $boxes = sqimap_mailbox_list($imapConnection);
         echo '<select name="mf_subfolder">';
-        $boxes = sqimap_mailbox_list($imapConnection);
-        for ($i = 0; $i < count($boxes); $i++) {
-            if (!in_array('noselect', $boxes[$i]['flags'])) {
-                $box = $boxes[$i]['unformatted'];
-                $box2 = str_replace(' ', '&nbsp;', $boxes[$i]['unformatted-disp']);
-                if ( strtolower( $box2 ) == 'inbox' ) {
-                    $box2 = _("INBOX");
-                }
-                echo '<option ' .
-                     (strcmp($mailfetch_subfolder_[$mf_sn],$box)==0?'selected':'') .
-                     " value=\"$box\">$box2</option>\n";
-            }
-        }                
+        $selected = 0;
+        if ( isset($mf_subfolder) )
+          $selected = array(strtolower($mf_subfolder));
+        echo sqimap_mailbox_option_list($imapConnection, $selected);
         echo '</select></td></tr>' .
 
                 html_tag( 'tr',
         echo '</select></td></tr>' .
 
                 html_tag( 'tr',