phase 1 of interface improvements -- alternating row colors (needs some work)
[squirrelmail.git] / functions / array.php
index 5d959fe1441d4a219b5d1daddb572b0714d4a85f..a64eb60779d60515a5381ed635a3031abb4ee558 100644 (file)
          $col = array($col);
       }
       $GLOBALS['col'] = $col;  // Column or Columns as an array
+      if ($dir > 0)
+          $dir = 1;
+      else
+          $dir = -1;
       $GLOBALS['dir'] = $dir;  // Direction, a positive number for ascending a negative for descending
 
-      usort($ary,'comp2');
+      usort($ary,'array_comp2');
       return $ary;
   }
 
-  function comp2($a,$b,$i = 0) {
+  function array_comp2($a,$b,$i = 0) {
          global $col;
          global $dir;
          $c = count($col) -1;
                $r = comp2($a,$b,$i);
             }
          } elseif($a[$col[$i]] < $b[$col[$i]]){
-            $r = -1 * $dir; // Im not sure why you must * dir here, but it wont work just before the return...
-         } else {
-            $r = 1 * $dir;
-         }
-         return $r;
+            return (- $dir);
+         } 
+        return $dir;
       }
 
    function removeElement($array, $element) {