Sophie

Sophie

distrib > Mageia > 6 > armv7hl > media > core-updates-src > by-pkgid > 0796f3a4146744711e43968234de3795 > files > 57

squirrelmail-1.4.22-15.1.mga6.src.rpm

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(' ', '&nbsp;', $boxes[$i]['formatted']);
-                    //$box2 = str_replace(' ', '&nbsp;', $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(' ', '&nbsp;', $boxes[$maIndex[$i]]['formatted']);
+		//$box2 = str_replace(' ', '&nbsp;', $boxes[$i]['formatted']);
     
                     if (strtolower($imap_server_type) != 'courier' || strtolower($box) != 'inbox.trash') {
                         $mailboxlist .= '<option value="'.htmlspecialchars($box).'"';