Fix coding style part 2

This commit is contained in:
Job Snijders
2015-07-15 11:04:22 +02:00
parent ad9590df9b
commit d8693f05ae
733 changed files with 37338 additions and 33926 deletions
+59 -42
View File
@@ -1,49 +1,66 @@
<?php
if (!$os)
{
if (preg_match("/^Linux/", $sysDescr)) { $os = "linux"; }
// Specific Linux-derivatives
if ($os == "linux")
{
// Check for QNAP Systems TurboNAS
$entPhysicalMfgName = snmp_get($device, "ENTITY-MIB::entPhysicalMfgName.1", "-Osqnv");
if (strstr($sysObjectId, ".1.3.6.1.4.1.5528.100.20.10.2014") || strstr($sysObjectId, ".1.3.6.1.4.1.5528.100.20.10.2016")) { $os = "netbotz"; }
elseif (strstr($sysDescr, "endian")) { $os = "endian"; }
elseif (preg_match("/Cisco Small Business/", $sysDescr)) { $os = "ciscosmblinux"; }
elseif (strpos($entPhysicalMfgName, "QNAP") !== FALSE) { $os = "qnap"; }
elseif (stristr($sysObjectId, "packetlogic") || strstr($sysObjectId, ".1.3.6.1.4.1.15397.2")) { $os = "procera"; }
elseif (strstr($sysObjectId, ".1.3.6.1.4.1.10002.1") || strstr($sysObjectId, ".1.3.6.1.4.1.41112.1.4") || strpos(trim(snmp_get($device, "dot11manufacturerName.5", "-Osqnv", "IEEE802dot11-MIB")), "Ubiquiti") !== FALSE)
{
$os = "airos";
if (strpos(trim(snmp_get($device, "dot11manufacturerProductName.5", "-Osqnv", "IEEE802dot11-MIB")), "UAP") !== FALSE) { $os = "unifi"; }
elseif (strpos(trim(snmp_get($device, "dot11manufacturerProductName.2", "-Osqnv", "IEEE802dot11-MIB")), "UAP") !== FALSE) { $os = "unifi"; }
elseif (strpos(trim(snmp_get($device, "dot11manufacturerProductName.3", "-Osqnv", "IEEE802dot11-MIB")), "UAP") !== FALSE) { $os = "unifi"; }
elseif (strpos(trim(snmp_get($device, "dot11manufacturerProductName.4", "-Osqnv", "IEEE802dot11-MIB")), "UAP") !== FALSE) { $os = "unifi"; }
elseif (strpos(trim(snmp_get($device, "dot11manufacturerProductName.6", "-Osqnv", "IEEE802dot11-MIB")), "UAP") !== FALSE) { $os = "unifi"; }
elseif (trim(snmp_get($device, "fwVersion.1", "-Osqnv", "UBNT-AirFIBER-MIB")) != '') { $os = "airos-af"; }
if (!$os) {
if (preg_match('/^Linux/', $sysDescr)) {
$os = 'linux';
}
else
{
// Check for Synology DSM
$hrSystemInitialLoadParameters = trim(snmp_get($device, "HOST-RESOURCES-MIB::hrSystemInitialLoadParameters.0", "-Osqnv"));
if (strpos($hrSystemInitialLoadParameters, "syno_hw_version") !== FALSE) { $os = "dsm"; }
else
{
// Check for Carel PCOweb
$roomTemp = trim(snmp_get($device,"roomTemp.0", "-OqvU", "CAREL-ug40cdz-MIB"));
// Specific Linux-derivatives
if ($os == 'linux') {
// Check for QNAP Systems TurboNAS
$entPhysicalMfgName = snmp_get($device, 'ENTITY-MIB::entPhysicalMfgName.1', '-Osqnv');
if (is_numeric($roomTemp))
{
$os = "pcoweb";
if (strstr($sysObjectId, '.1.3.6.1.4.1.5528.100.20.10.2014') || strstr($sysObjectId, '.1.3.6.1.4.1.5528.100.20.10.2016')) {
$os = 'netbotz';
}
}
}
}
}
else if (strstr($sysDescr, 'endian')) {
$os = 'endian';
}
else if (preg_match('/Cisco Small Business/', $sysDescr)) {
$os = 'ciscosmblinux';
}
else if (strpos($entPhysicalMfgName, 'QNAP') !== false) {
$os = 'qnap';
}
else if (stristr($sysObjectId, 'packetlogic') || strstr($sysObjectId, '.1.3.6.1.4.1.15397.2')) {
$os = 'procera';
}
else if (strstr($sysObjectId, '.1.3.6.1.4.1.10002.1') || strstr($sysObjectId, '.1.3.6.1.4.1.41112.1.4') || strpos(trim(snmp_get($device, 'dot11manufacturerName.5', '-Osqnv', 'IEEE802dot11-MIB')), 'Ubiquiti') !== false) {
$os = 'airos';
if (strpos(trim(snmp_get($device, 'dot11manufacturerProductName.5', '-Osqnv', 'IEEE802dot11-MIB')), 'UAP') !== false) {
$os = 'unifi';
}
else if (strpos(trim(snmp_get($device, 'dot11manufacturerProductName.2', '-Osqnv', 'IEEE802dot11-MIB')), 'UAP') !== false) {
$os = 'unifi';
}
else if (strpos(trim(snmp_get($device, 'dot11manufacturerProductName.3', '-Osqnv', 'IEEE802dot11-MIB')), 'UAP') !== false) {
$os = 'unifi';
}
else if (strpos(trim(snmp_get($device, 'dot11manufacturerProductName.4', '-Osqnv', 'IEEE802dot11-MIB')), 'UAP') !== false) {
$os = 'unifi';
}
else if (strpos(trim(snmp_get($device, 'dot11manufacturerProductName.6', '-Osqnv', 'IEEE802dot11-MIB')), 'UAP') !== false) {
$os = 'unifi';
}
else if (trim(snmp_get($device, 'fwVersion.1', '-Osqnv', 'UBNT-AirFIBER-MIB')) != '') {
$os = 'airos-af';
}
}
else {
// Check for Synology DSM
$hrSystemInitialLoadParameters = trim(snmp_get($device, 'HOST-RESOURCES-MIB::hrSystemInitialLoadParameters.0', '-Osqnv'));
?>
if (strpos($hrSystemInitialLoadParameters, 'syno_hw_version') !== false) {
$os = 'dsm';
}
else {
// Check for Carel PCOweb
$roomTemp = trim(snmp_get($device, 'roomTemp.0', '-OqvU', 'CAREL-ug40cdz-MIB'));
if (is_numeric($roomTemp)) {
$os = 'pcoweb';
}
}
}
}
}