mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
add broadcom detection and image. add ability to define image in $config['os'][$os]['icon']
git-svn-id: http://www.observium.org/svn/observer/trunk@1377 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -207,13 +207,21 @@ function getImage($host)
|
||||
$sql = "SELECT * FROM `devices` WHERE `device_id` = '$host'";
|
||||
$data = mysql_fetch_array(mysql_query($sql));
|
||||
$type = strtolower($data['os']);
|
||||
if (file_exists($config['html_dir'] . "/images/os/$type" . ".png")){ $image = '<img src="'.$config['base_url'].'/images/os/'.$type.'.png" />';
|
||||
} elseif (file_exists($config['html_dir'] . "/images/os/$type" . ".gif")){ $image = '<img src="'.$config['base_url'].'/images/os/'.$type.'.gif" />'; }
|
||||
if ($type == "linux") {
|
||||
$features = strtolower(trim($data['features']));
|
||||
list($distro) = split(" ", $features);
|
||||
if (file_exists($config['html_dir'] . "/images/os/$distro" . ".png")){ $image = '<img src="'.$config['base_url'].'/images/os/'.$distro.'.png" />';
|
||||
} elseif (file_exists($config['html_dir'] . "/images/os/$distro" . ".gif")){ $image = '<img src="'.$config['base_url'].'/images/os/'.$distro.'.gif" />'; }
|
||||
if ($config['os'][$type]['icon'] && file_exists($config['html_dir'] . "/images/os/" . $config['os'][$type]['icon'] . ".png"))
|
||||
{
|
||||
$image = '<img src="'.$config['base_url'].'/images/os/'.$config['os'][$type]['icon'].'.png" />';
|
||||
} elseif ($config['os'][$type]['icon'] && file_exists($config['html_dir'] . "/images/os/". $config['os'][$type]['icon'] . ".gif"))
|
||||
{
|
||||
$image = '<img src="'.$config['base_url'].'/images/os/'.$config['os'][$type]['icon'].'.gif" />';
|
||||
} else {
|
||||
if (file_exists($config['html_dir'] . "/images/os/$type" . ".png")){ $image = '<img src="'.$config['base_url'].'/images/os/'.$type.'.png" />';
|
||||
} elseif (file_exists($config['html_dir'] . "/images/os/$type" . ".gif")){ $image = '<img src="'.$config['base_url'].'/images/os/'.$type.'.gif" />'; }
|
||||
if ($type == "linux") {
|
||||
$features = strtolower(trim($data['features']));
|
||||
list($distro) = split(" ", $features);
|
||||
if (file_exists($config['html_dir'] . "/images/os/$distro" . ".png")){ $image = '<img src="'.$config['base_url'].'/images/os/'.$distro.'.png" />';
|
||||
} elseif (file_exists($config['html_dir'] . "/images/os/$distro" . ".gif")){ $image = '<img src="'.$config['base_url'].'/images/os/'.$distro.'.gif" />'; }
|
||||
}
|
||||
}
|
||||
return $image;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user