mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 00:24:21 +02:00
ports sort done in php
git-svn-id: http://www.observium.org/svn/observer/trunk@3238 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
+31
-14
@@ -36,21 +36,38 @@ if ($config['alerts']['email']['enable'])
|
||||
include_once($config['install_dir'] . "/includes/phpmailer/class.smtp.php");
|
||||
}
|
||||
|
||||
function nicecase($item)
|
||||
function array_sort($array, $on, $order=SORT_ASC)
|
||||
{
|
||||
switch ($item)
|
||||
{
|
||||
case "dbm":
|
||||
return "dBm";
|
||||
case "mysql":
|
||||
return" MySQL";
|
||||
case "powerdns":
|
||||
return "PowerDNS";
|
||||
case "bind":
|
||||
return "BIND";
|
||||
default:
|
||||
return ucfirst($item);
|
||||
}
|
||||
$new_array = array();
|
||||
$sortable_array = array();
|
||||
|
||||
if (count($array) > 0) {
|
||||
foreach ($array as $k => $v) {
|
||||
if (is_array($v)) {
|
||||
foreach ($v as $k2 => $v2) {
|
||||
if ($k2 == $on) {
|
||||
$sortable_array[$k] = $v2;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$sortable_array[$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
switch ($order) {
|
||||
case SORT_ASC:
|
||||
asort($sortable_array);
|
||||
break;
|
||||
case SORT_DESC:
|
||||
arsort($sortable_array);
|
||||
break;
|
||||
}
|
||||
|
||||
foreach ($sortable_array as $k => $v) {
|
||||
$new_array[$k] = $array[$k];
|
||||
}
|
||||
}
|
||||
return $new_array;
|
||||
}
|
||||
|
||||
function mac_clean_to_readable($mac)
|
||||
|
||||
@@ -42,7 +42,7 @@ if ($serial && $serial != $device['serial'])
|
||||
if ($icon && $icon != $device['icon'])
|
||||
{
|
||||
$update_array['icon'] = $icon;
|
||||
log_event("Icon -> ".nicecase($icon), $device, 'system');
|
||||
log_event("Icon -> ".$icon, $device, 'system');
|
||||
}
|
||||
|
||||
echo("\nHardware: ".$hardware." Version: ".$version." Features: ".$features." Serial: ".$serial."\n");
|
||||
|
||||
Reference in New Issue
Block a user