summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@su.local>2009-09-11 13:34:09 -0400
committerScott Ullrich <sullrich@su.local>2009-09-11 13:34:27 -0400
commit4a8bc5a23db6e673894e816079580dd1dca829d5 (patch)
treed4d9347bd814696df1777e502fabdb081b47f322
parentf441ab6809cdf358c321144bb74da1f550136b17 (diff)
downloadpfsense-4a8bc5a23db6e673894e816079580dd1dca829d5.zip
pfsense-4a8bc5a23db6e673894e816079580dd1dca829d5.tar.gz
Add msort() which will sort lower and uppercase items teogether (packages for example). Sort packages by lower/upper. IE: arping, arpwatch, Backup
-rw-r--r--etc/inc/globals.inc2
-rw-r--r--etc/inc/util.inc27
-rwxr-xr-xusr/local/www/pkg_mgr.php4
3 files changed, 30 insertions, 3 deletions
diff --git a/etc/inc/globals.inc b/etc/inc/globals.inc
index cf16cac..2cc39c8 100644
--- a/etc/inc/globals.inc
+++ b/etc/inc/globals.inc
@@ -54,7 +54,7 @@ function get_nics_with_capabilities($CAPABILITIES) {
}
$g = array(
- "base_packages" => "AutoConfigBackup, siproxd",
+ "base_packages" => "siproxd",
"factory_shipped_username" => "admin",
"factory_shipped_password" => "pfsense",
"upload_path" => "/root",
diff --git a/etc/inc/util.inc b/etc/inc/util.inc
index 818b08e..85bf991 100644
--- a/etc/inc/util.inc
+++ b/etc/inc/util.inc
@@ -996,4 +996,29 @@ function timeout($timer = 9) {
return $key;
}
-?>
+function msort($array, $id="id", $sort_ascending=true) {
+ $temp_array = array();
+ while(count($array)>0) {
+ $lowest_id = 0;
+ $index=0;
+ foreach ($array as $item) {
+ if (isset($item[$id])) {
+ if ($array[$lowest_id][$id]) {
+ if (strtolower($item[$id]) < strtolower($array[$lowest_id][$id])) {
+ $lowest_id = $index;
+ }
+ }
+ }
+ $index++;
+ }
+ $temp_array[] = $array[$lowest_id];
+ $array = array_merge(array_slice($array, 0,$lowest_id), array_slice($array, $lowest_id+1));
+ }
+ if ($sort_ascending) {
+ return $temp_array;
+ } else {
+ return array_reverse($temp_array);
+ }
+}
+
+?> \ No newline at end of file
diff --git a/usr/local/www/pkg_mgr.php b/usr/local/www/pkg_mgr.php
index a1bfb5d..5187a99 100755
--- a/usr/local/www/pkg_mgr.php
+++ b/usr/local/www/pkg_mgr.php
@@ -114,9 +114,11 @@ include("head.inc");
foreach($config['installedpackages']['package'] as $instpkg) $instpkgs[] = $instpkg['name'];
$pkg_names = array_keys($pkg_info);
$pkg_keys = array();
+
foreach($pkg_names as $name)
if(!in_array($name, $instpkgs)) $pkg_keys[] = $name;
- sort($pkg_keys);
+ $pkg_keys = msort($pkg_keys);
+ print_r($pkg_keys);
if(count($pkg_keys) != 0) {
foreach($pkg_keys as $key) {
$index = &$pkg_info[$key];
OpenPOWER on IntegriCloud