diff options
-rw-r--r-- | etc/inc/globals.inc | 2 | ||||
-rw-r--r-- | etc/inc/util.inc | 27 | ||||
-rwxr-xr-x | usr/local/www/pkg_mgr.php | 4 |
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]; |