Browse Source

Another sneaky folder list (or two)

sizzlingmercury 23 years ago
parent
commit
40388aee0b
2 changed files with 13 additions and 35 deletions
  1. 4 11
      plugins/filters/spamoptions.php
  2. 9 24
      plugins/mail_fetch/options.php

+ 4 - 11
plugins/filters/spamoptions.php

@@ -104,17 +104,10 @@ if (isset($action) && $action == 'spam') {
                 html_tag( 'td', '', 'left' ) .
                 html_tag( 'td', '', 'left' ) .
                     '<select name="filters_spam_folder_set">';
                     '<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>'.
     echo    '</select>'.
         '</td>'.
         '</td>'.
         '</tr>'.
         '</tr>'.

+ 9 - 24
plugins/mail_fetch/options.php

@@ -208,17 +208,11 @@ require_once(SM_PATH . 'include/load_prefs.php');
         $imapConnection = sqimap_login ($username, $key, $imapServerAddress, $imapPort, 0);
         $imapConnection = sqimap_login ($username, $key, $imapServerAddress, $imapPort, 0);
         $boxes = sqimap_mailbox_list($imapConnection);
         $boxes = sqimap_mailbox_list($imapConnection);
         echo '<select name="mf_subfolder">';
         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>' .
         echo '</select></td></tr>' .
                 html_tag( 'tr',
                 html_tag( 'tr',
                     html_tag( 'th', '&nbsp;', 'right' ) .
                     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);
         $imapConnection = sqimap_login ($username, $key, $imapServerAddress, $imapPort, 0);
         $boxes = sqimap_mailbox_list($imapConnection);
         $boxes = sqimap_mailbox_list($imapConnection);
         echo '<select name="mf_subfolder">';
         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>' .
         echo '</select></td></tr>' .
 
 
                 html_tag( 'tr',
                 html_tag( 'tr',