Inserting new rules the mailbox folders are not sorted. This patch should fix that until it's included in avelsieve or squirrelmail aswell. --- a/include/support.inc.php +++ b/include/support.inc.php @@ -181,11 +181,30 @@ $mailboxlist = $mailboxlist."\n".'<option selected value="">[ '._("None")." ] </option>\n"; } } - - for ($i = 0; $i < count($boxes); $i++) { - $box = $boxes[$i]['unformatted-dm']; - $box2 = str_replace(' ', ' ', $boxes[$i]['formatted']); - //$box2 = str_replace(' ', ' ', $boxes[$i]['formatted']); + + $tmpKey=''; + $ResArray=array(); + $maIndex=array_keys($boxes); + $maSize=count($boxes)-1; + for($i=0; $i < $maSize ; $i++) { + $minElement=$i; + $tempMin=$boxes[$maIndex[$i]]['id']; + $tmpKey=$maIndex[$i]; + + for($j=$i+1; $j <= $maSize; $j++) + if($boxes[$maIndex[$j]]['id'] < $tempMin ) { + $minElement=$j; + $tmpKey=$maIndex[$j]; + $tempMin=$boxes[$maIndex[$j]]['id']; + } + $maIndex[$minElement]=$maIndex[$i]; + $maIndex[$i]=$tmpKey; + } + + for ($i = 0; $i < $maSize; $i++) { + $box = $boxes[$maIndex[$i]]['unformatted-dm']; + $box2 = str_replace(' ', ' ', $boxes[$maIndex[$i]]['formatted']); + //$box2 = str_replace(' ', ' ', $boxes[$i]['formatted']); if (strtolower($imap_server_type) != 'courier' || strtolower($box) != 'inbox.trash') { $mailboxlist .= '<option value="'.htmlspecialchars($box).'"';