diff --git a/LibreNMS/Alert/AlertRules.php b/LibreNMS/Alert/AlertRules.php index d60c923880..d42a88ea6a 100644 --- a/LibreNMS/Alert/AlertRules.php +++ b/LibreNMS/Alert/AlertRules.php @@ -39,7 +39,6 @@ class AlertRules { public function runRules($device_id) { - //Check to see if under maintenance if (AlertUtil::isMaintenance($device_id) > 0) { echo "Under Maintenance, skipping alert rules check.\r\n"; diff --git a/LibreNMS/Alert/Transport/Alertmanager.php b/LibreNMS/Alert/Transport/Alertmanager.php index 4d84e19ac0..929666c630 100644 --- a/LibreNMS/Alert/Transport/Alertmanager.php +++ b/LibreNMS/Alert/Transport/Alertmanager.php @@ -70,7 +70,7 @@ class Alertmanager extends Transport unset($api['url']); foreach ($api as $label => $value) { // To allow dynamic values - if ((preg_match('/^extra_[A-Za-z0-9_]+$/', $label)) && (! empty($obj['faults'][1][$value]))) { + if (preg_match('/^extra_[A-Za-z0-9_]+$/', $label) && (! empty($obj['faults'][1][$value]))) { $data[0]['labels'][$label] = $obj['faults'][1][$value]; } else { $data[0]['labels'][$label] = $value; diff --git a/LibreNMS/Alert/Transport/Boxcar.php b/LibreNMS/Alert/Transport/Boxcar.php index 287d11c489..34fe5626a0 100644 --- a/LibreNMS/Alert/Transport/Boxcar.php +++ b/LibreNMS/Alert/Transport/Boxcar.php @@ -90,7 +90,6 @@ class Boxcar extends Transport default: $title_text = $severity; break; - } $data['notification[title]'] = $title_text . ' - ' . $obj['hostname'] . ' - ' . $obj['name']; $message_text = 'Timestamp: ' . $obj['timestamp']; diff --git a/LibreNMS/Alert/Transport/Discord.php b/LibreNMS/Alert/Transport/Discord.php index 6978f28efe..4e43b8906b 100644 --- a/LibreNMS/Alert/Transport/Discord.php +++ b/LibreNMS/Alert/Transport/Discord.php @@ -21,6 +21,7 @@ * * @copyright 2018 Ryan Finney * @author https://github.com/theherodied/ + * * @contributer f0o, sdef2 * Thanks to F0o for creating the Slack transport which is the majority of this code. * Thanks to sdef2 for figuring out the differences needed to make Discord work. diff --git a/LibreNMS/Alert/Transport/Telegram.php b/LibreNMS/Alert/Transport/Telegram.php index 3e0ee269b9..ffb9403294 100644 --- a/LibreNMS/Alert/Transport/Telegram.php +++ b/LibreNMS/Alert/Transport/Telegram.php @@ -56,7 +56,7 @@ class Telegram extends Transport if (! empty($data['message_thread_id'])) { $messageThreadId = '&message_thread_id=' . $data['message_thread_id']; } - curl_setopt($curl, CURLOPT_URL, ("https://api.telegram.org/bot{$data['token']}/sendMessage?chat_id={$data['chat_id']}$messageThreadId&text=$text{$format}")); + curl_setopt($curl, CURLOPT_URL, "https://api.telegram.org/bot{$data['token']}/sendMessage?chat_id={$data['chat_id']}$messageThreadId&text=$text{$format}"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $ret = curl_exec($curl); $code = curl_getinfo($curl, CURLINFO_HTTP_CODE); diff --git a/LibreNMS/Alerting/QueryBuilderFilter.php b/LibreNMS/Alerting/QueryBuilderFilter.php index f05a86878a..f3bf426d93 100644 --- a/LibreNMS/Alerting/QueryBuilderFilter.php +++ b/LibreNMS/Alerting/QueryBuilderFilter.php @@ -70,7 +70,7 @@ class QueryBuilderFilter implements \JsonSerializable continue; // don't include the time based macros, they don't work like that } - if ((Str::endsWith($key, '_usage_perc')) || (Str::startsWith($key, 'packet_loss_'))) { + if (Str::endsWith($key, '_usage_perc') || Str::startsWith($key, 'packet_loss_')) { $this->filter[$field] = [ 'id' => $field, 'type' => 'integer', diff --git a/LibreNMS/Data/Source/NetSnmpQuery.php b/LibreNMS/Data/Source/NetSnmpQuery.php index d170fce297..5c32c75874 100644 --- a/LibreNMS/Data/Source/NetSnmpQuery.php +++ b/LibreNMS/Data/Source/NetSnmpQuery.php @@ -347,11 +347,11 @@ class NetSnmpQuery implements SnmpQueryInterface case 'authpriv': array_push($cmd, '-x', $this->device->cryptoalgo); array_push($cmd, '-X', $this->device->cryptopass); - // fallthrough + // fallthrough case 'authnopriv': array_push($cmd, '-a', $this->device->authalgo); array_push($cmd, '-A', $this->device->authpass); - // fallthrough + // fallthrough case 'noauthnopriv': array_push($cmd, '-u', $this->device->authname ?: 'root'); break; diff --git a/LibreNMS/Data/Store/Rrd.php b/LibreNMS/Data/Store/Rrd.php index 5ce88c6d64..14df167ba8 100644 --- a/LibreNMS/Data/Store/Rrd.php +++ b/LibreNMS/Data/Store/Rrd.php @@ -656,9 +656,9 @@ class Rrd extends BaseDatastore $substr_count_length = $length <= 0 ? null : min(strlen($descr), $length); $extra = substr_count($descr, ':', 0, $substr_count_length); - $result = substr(str_pad($result, $length), 0, ($length + $extra)); + $result = substr(str_pad($result, $length), 0, $length + $extra); if ($extra > 0) { - $result = substr($result, 0, (-1 * $extra)); + $result = substr($result, 0, -1 * $extra); } } diff --git a/LibreNMS/Enum/ImageFormat.php b/LibreNMS/Enum/ImageFormat.php index 7e949e6f1b..3e68bfd152 100644 --- a/LibreNMS/Enum/ImageFormat.php +++ b/LibreNMS/Enum/ImageFormat.php @@ -27,7 +27,7 @@ namespace LibreNMS\Enum; use LibreNMS\Config; -enum ImageFormat : string +enum ImageFormat: string { case png = 'png'; case svg = 'svg'; diff --git a/LibreNMS/IRCBot.php b/LibreNMS/IRCBot.php index fbc0f01cf4..e8355e8815 100644 --- a/LibreNMS/IRCBot.php +++ b/LibreNMS/IRCBot.php @@ -225,7 +225,7 @@ class IRCBot return false; } - if (($this->socket['alert'] = fopen($f, 'r+'))) { + if ($this->socket['alert'] = fopen($f, 'r+')) { $this->log('Opened Alert-File'); stream_set_blocking($this->socket['alert'], false); @@ -246,7 +246,7 @@ class IRCBot $r = strlen($r); if (strstr($this->buff[$buff], "\n")) { $tmp = explode("\n", $this->buff[$buff], 2); - $this->buff[$buff] = substr($this->buff[$buff], (strlen($tmp[0]) + 1)); + $this->buff[$buff] = substr($this->buff[$buff], strlen($tmp[0]) + 1); if ($this->debug) { $this->log("Returning buffer '$buff': '" . trim($tmp[0]) . "'"); } @@ -369,7 +369,7 @@ class IRCBot } } - if (($this->config['irc_ctcp']) && (preg_match('/^:' . chr(1) . '.*/', $ex[3]))) { + if ($this->config['irc_ctcp'] && preg_match('/^:' . chr(1) . '.*/', $ex[3])) { // Handle CTCP $ctcp = trim(preg_replace('/[^A-Z]/', '', $ex[3])); $ctcp_reply = null; @@ -529,7 +529,7 @@ class IRCBot if ($try > $this->max_retry) { $this->log('Failed too many connection attempts, aborting'); - return exit(); + return exit; } $this->log('Trying to connect (' . ($try + 1) . ') to ' . $this->server . ':' . $this->port . ($this->ssl ? ' (SSL)' : '')); @@ -612,7 +612,7 @@ class IRCBot } catch (\PDOException $e) { $this->log('Cannot connect to MySQL: ' . $e->getMessage()); - return exit(); + return exit; } } @@ -765,7 +765,7 @@ class IRCBot if ($this->user['level'] == 10) { $this->ircRaw('QUIT :Requested'); - return exit(); + return exit; } else { return $this->respond('Permission denied.'); } diff --git a/LibreNMS/Modules/PrinterSupplies.php b/LibreNMS/Modules/PrinterSupplies.php index d69d89844d..9fc372a3ca 100644 --- a/LibreNMS/Modules/PrinterSupplies.php +++ b/LibreNMS/Modules/PrinterSupplies.php @@ -112,7 +112,7 @@ class PrinterSupplies implements Module 'toner', Alert::NOTICE, $toner['supply_id'] - ); + ); } $toner->supply_current = $tonerperc; diff --git a/LibreNMS/OS/Allied.php b/LibreNMS/OS/Allied.php index 6ba0a8a574..33b14e4c28 100644 --- a/LibreNMS/OS/Allied.php +++ b/LibreNMS/OS/Allied.php @@ -89,7 +89,7 @@ class Allied extends OS implements OSDiscovery $serial = snmp_get($this->getDeviceArray(), 'arBoardSerialNumber.1', '-OsvQU', 'AT-INTERFACES-MIB'); //AT-GS950/24 Gigabit Ethernet WebSmart Switch - //Also requires system description as no OIDs provide $hardware + //Also requires system description as no OIDs provide $hardware } elseif ($d == 'WebSmart' && $e == 'Switch') { $version = snmp_get($this->getDeviceArray(), 'swhub.167.81.1.3.0', '-OsvQU', 'AtiL2-MIB'); $version = $d . ' ' . $version; diff --git a/LibreNMS/OS/Fortigate.php b/LibreNMS/OS/Fortigate.php index 2f30dc1109..24e4963f6f 100644 --- a/LibreNMS/OS/Fortigate.php +++ b/LibreNMS/OS/Fortigate.php @@ -34,9 +34,9 @@ use LibreNMS\OS\Shared\Fortinet; use LibreNMS\RRD\RrdDefinition; class Fortigate extends Fortinet implements - OSPolling, - WirelessClientsDiscovery, - WirelessApCountDiscovery + OSPolling, + WirelessClientsDiscovery, + WirelessApCountDiscovery { public function discoverOS(Device $device): void { diff --git a/LibreNMS/OS/Ruckuswireless.php b/LibreNMS/OS/Ruckuswireless.php index 8cc243a489..3147e81ee6 100644 --- a/LibreNMS/OS/Ruckuswireless.php +++ b/LibreNMS/OS/Ruckuswireless.php @@ -13,8 +13,7 @@ class Ruckuswireless extends OS implements { public function discoverWirelessClients() { - -// Find Per SSID Client Count + // Find Per SSID Client Count $sensors = []; $ssids = $this->getCacheByIndex('ruckusZDWLANSSID', 'RUCKUS-ZD-WLAN-MIB'); $counts = $this->getCacheByIndex('ruckusZDWLANNumSta', 'RUCKUS-ZD-WLAN-MIB'); @@ -42,7 +41,7 @@ class Ruckuswireless extends OS implements if (count($total_oids) > 1) { // Find Total Client Count $oid = '.1.3.6.1.4.1.25053.1.2.1.1.1.15.2.0'; //RUCKUS-ZD-SYSTEM-MIB::ruckusZDSystemStatsNumSta.0 - array_push($sensors, new WirelessSensor('clients', $this->getDeviceId(), $oid, 'ruckuswireless', ($index + 1), 'System Total:')); + array_push($sensors, new WirelessSensor('clients', $this->getDeviceId(), $oid, 'ruckuswireless', $index + 1, 'System Total:')); } return $sensors; @@ -56,13 +55,13 @@ class Ruckuswireless extends OS implements $oidtotal = '.1.3.6.1.4.1.25053.1.2.1.1.1.15.15.0'; //RUCKUS-ZD-SYSTEM-MIB::ruckusZDSystemStatsNumRegisteredAP.0 $sensorindex = 0; $sensors[] = new WirelessSensor( - 'ap-count', - $this->getDeviceId(), - $oidconnected, - 'ruckuswireless', - ++$sensorindex, - 'Connected APs' - ); + 'ap-count', + $this->getDeviceId(), + $oidconnected, + 'ruckuswireless', + ++$sensorindex, + 'Connected APs' + ); array_push($sensors, new WirelessSensor('ap-count', $this->getDeviceId(), $oidtotal, 'ruckuswireless', ++$sensorindex, 'Total APs')); diff --git a/LibreNMS/OS/RuckuswirelessSz.php b/LibreNMS/OS/RuckuswirelessSz.php index d342e8b90a..61fb524149 100644 --- a/LibreNMS/OS/RuckuswirelessSz.php +++ b/LibreNMS/OS/RuckuswirelessSz.php @@ -55,7 +55,7 @@ class RuckuswirelessSz extends OS implements if (count($total_oids) > 1) { // clients - Discover System Total Client Count $oid = '.1.3.6.1.4.1.25053.1.4.1.1.1.15.2.0'; //RUCKUS-SZ-SYSTEM-MIB::ruckusSZSystemStatsNumSta.0 - array_push($sensors, new WirelessSensor('clients', $this->getDeviceId(), $oid, 'ruckuswireless-sz', ($index + 1), 'System Total:')); + array_push($sensors, new WirelessSensor('clients', $this->getDeviceId(), $oid, 'ruckuswireless-sz', $index + 1, 'System Total:')); } return $sensors; diff --git a/LibreNMS/OS/Shared/Cisco.php b/LibreNMS/OS/Shared/Cisco.php index 65b3588c61..ac474a207f 100755 --- a/LibreNMS/OS/Shared/Cisco.php +++ b/LibreNMS/OS/Shared/Cisco.php @@ -430,7 +430,7 @@ class Cisco extends OS implements $rtt_type = $sla->rtt_type; // Lets process each SLA - $unixtime = intval(($data[$sla_nr]['rttMonLatestRttOperTime'] / 100 + $time_offset)); + $unixtime = intval($data[$sla_nr]['rttMonLatestRttOperTime'] / 100 + $time_offset); $time = date('Y-m-d H:i:s', $unixtime); // Save data diff --git a/LibreNMS/OS/Shared/Zyxel.php b/LibreNMS/OS/Shared/Zyxel.php index c112a0f705..694eb6b335 100644 --- a/LibreNMS/OS/Shared/Zyxel.php +++ b/LibreNMS/OS/Shared/Zyxel.php @@ -57,7 +57,7 @@ class Zyxel extends OS return; } $device->hardware = $data['.1.3.6.1.4.1.890.1.15.3.1.11.0'] ?? null; - [$device->version,] = explode(' | ', $data['.1.3.6.1.4.1.890.1.15.3.1.6.0'] ?? null); + [$device->version] = explode(' | ', $data['.1.3.6.1.4.1.890.1.15.3.1.6.0'] ?? null); $device->serial = $data['.1.3.6.1.4.1.890.1.15.3.1.12.0'] ?? null; } } diff --git a/LibreNMS/OS/ThreeCom.php b/LibreNMS/OS/ThreeCom.php index 16903ab422..aa4efde77d 100644 --- a/LibreNMS/OS/ThreeCom.php +++ b/LibreNMS/OS/ThreeCom.php @@ -37,7 +37,7 @@ class ThreeCom extends OS implements OSDiscovery if (Str::contains($device->sysDescr, 'Software')) { $device->hardware = str_replace('3Com ', '', substr($device->sysDescr, 0, strpos($device->sysDescr, 'Software'))); // Version is the last word in the sysDescr's first line - [$device->version] = explode("\n", substr($device->sysDescr, (strpos($device->sysDescr, 'Version') + 8))); + [$device->version] = explode("\n", substr($device->sysDescr, strpos($device->sysDescr, 'Version') + 8)); return; } diff --git a/LibreNMS/OS/Vrp.php b/LibreNMS/OS/Vrp.php index 1a4d1796b8..116af9f414 100644 --- a/LibreNMS/OS/Vrp.php +++ b/LibreNMS/OS/Vrp.php @@ -467,7 +467,7 @@ class Vrp extends OS implements // We have at least 1 SSID, so we can count the total of STA $sensors[] = new WirelessSensor( 'clients', - $this->getDeviceId(), + $this->getDeviceId(), $ssid_total_oid_array, 'vrp-clients', 'total-all-ssids', diff --git a/LibreNMS/Snmptrap/Handlers/HpFault.php b/LibreNMS/Snmptrap/Handlers/HpFault.php index 38faf51e27..5b966e5036 100644 --- a/LibreNMS/Snmptrap/Handlers/HpFault.php +++ b/LibreNMS/Snmptrap/Handlers/HpFault.php @@ -20,18 +20,18 @@ class HpFault implements SnmptrapHandler { $type = $trap->getOidData($trap->findOid('HP-ICF-FAULT-FINDER-MIB::hpicfFfLogFaultType')); switch ($type) { - case 'badXcvr': - $trap->log('Fault - CRC Error ' . $trap->getOidData($trap->findOid('HP-ICF-FAULT-FINDER-MIB::hpicfFfFaultInfoURL')), 4, $type); - break; - case 'badCable': - $trap->log('Fault - Bad Cable ' . $trap->getOidData($trap->findOid('HP-ICF-FAULT-FINDER-MIB::hpicfFfFaultInfoURL')), 4, $type); - break; - case 'bcastStorm': - $trap->log('Fault - Broadcaststorm ' . $trap->getOidData($trap->findOid('HP-ICF-FAULT-FINDER-MIB::hpicfFfFaultInfoURL')), 5, $type); - break; - default: - $trap->log('Fault - Unhandled ' . $trap->getOidData($trap->findOid('HP-ICF-FAULT-FINDER-MIB::hpicfFfFaultInfoURL')), 2, $type); - break; - } + case 'badXcvr': + $trap->log('Fault - CRC Error ' . $trap->getOidData($trap->findOid('HP-ICF-FAULT-FINDER-MIB::hpicfFfFaultInfoURL')), 4, $type); + break; + case 'badCable': + $trap->log('Fault - Bad Cable ' . $trap->getOidData($trap->findOid('HP-ICF-FAULT-FINDER-MIB::hpicfFfFaultInfoURL')), 4, $type); + break; + case 'bcastStorm': + $trap->log('Fault - Broadcaststorm ' . $trap->getOidData($trap->findOid('HP-ICF-FAULT-FINDER-MIB::hpicfFfFaultInfoURL')), 5, $type); + break; + default: + $trap->log('Fault - Unhandled ' . $trap->getOidData($trap->findOid('HP-ICF-FAULT-FINDER-MIB::hpicfFfFaultInfoURL')), 2, $type); + break; + } } } diff --git a/LibreNMS/Util/Graph.php b/LibreNMS/Util/Graph.php index fd89316327..1446f65529 100644 --- a/LibreNMS/Util/Graph.php +++ b/LibreNMS/Util/Graph.php @@ -295,7 +295,7 @@ SVG; $px = (int) ((imagesx($img) - 7.5 * strlen($text)) / 2); $font = $width < 200 ? 3 : 5; - imagestring($img, $font, $px, ($height / 2 - 8), $text, imagecolorallocate($img, ...$color)); + imagestring($img, $font, $px, $height / 2 - 8, $text, imagecolorallocate($img, ...$color)); // Output the image ob_start(); diff --git a/LibreNMS/Util/ModuleTestHelper.php b/LibreNMS/Util/ModuleTestHelper.php index ef19e280b6..7f88c8f971 100644 --- a/LibreNMS/Util/ModuleTestHelper.php +++ b/LibreNMS/Util/ModuleTestHelper.php @@ -489,7 +489,7 @@ class ModuleTestHelper foreach ($snmprec_data as $line) { if (! empty($line)) { - [$oid,] = explode('|', $line, 2); + [$oid] = explode('|', $line, 2); $result[$oid] = $line; } } diff --git a/LibreNMS/Util/Number.php b/LibreNMS/Util/Number.php index 499e8334f3..078d0a41c5 100644 --- a/LibreNMS/Util/Number.php +++ b/LibreNMS/Util/Number.php @@ -45,14 +45,14 @@ class Number if ($value >= '0.1') { $sizes = ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']; $ext = $sizes[0]; - for ($i = 1; (($i < count($sizes)) && ($value >= 1000)); $i++) { + for ($i = 1; ($i < count($sizes)) && ($value >= 1000); $i++) { $value = $value / 1000; $ext = $sizes[$i]; } } else { $sizes = ['', 'm', 'u', 'n', 'p']; $ext = $sizes[0]; - for ($i = 1; (($i < count($sizes)) && ($value != 0) && ($value <= 0.1)); $i++) { + for ($i = 1; ($i < count($sizes)) && ($value != 0) && ($value <= 0.1); $i++) { $value = $value * 1000; $ext = $sizes[$i]; } @@ -74,7 +74,7 @@ class Number } $sizes = ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi']; $ext = $sizes[0]; - for ($i = 1; (($i < count($sizes)) && ($value >= 1024)); $i++) { + for ($i = 1; ($i < count($sizes)) && ($value >= 1024); $i++) { $value = $value / 1024; $ext = $sizes[$i]; } diff --git a/LibreNMS/Util/Rewrite.php b/LibreNMS/Util/Rewrite.php index 6f4350d8e8..57623e59fa 100644 --- a/LibreNMS/Util/Rewrite.php +++ b/LibreNMS/Util/Rewrite.php @@ -155,7 +155,7 @@ class Rewrite */ public static function readableOUI($mac) { - $cached = Cache::get('OUIDB-' . (substr($mac, 0, 6)), ''); + $cached = Cache::get('OUIDB-' . substr($mac, 0, 6), ''); if ($cached == 'IEEE Registration Authority') { // Then we may have a shorter prefix, so let's try them one ater the other, ordered by probability return Cache::get('OUIDB-' . substr($mac, 0, 9)) ?: Cache::get('OUIDB-' . substr($mac, 0, 7)); diff --git a/LibreNMS/Validations/Database/CheckDatabaseServerVersion.php b/LibreNMS/Validations/Database/CheckDatabaseServerVersion.php index 1eb66af02a..6f1256c4fd 100644 --- a/LibreNMS/Validations/Database/CheckDatabaseServerVersion.php +++ b/LibreNMS/Validations/Database/CheckDatabaseServerVersion.php @@ -50,7 +50,7 @@ class CheckDatabaseServerVersion implements Validation trans('validation.validations.database.CheckDatabaseServerVersion.fix', ['server' => 'MariaDB', 'suggested' => Database::MARIADB_RECOMMENDED_VERSION]), ); } - break; + break; case 'MySQL': if (version_compare($version, Database::MYSQL_MIN_VERSION, '<=')) { return ValidationResult::fail( @@ -58,7 +58,7 @@ class CheckDatabaseServerVersion implements Validation trans('validation.validations.database.CheckDatabaseServerVersion.fix', ['server' => 'MySQL', 'suggested' => Database::MYSQL_RECOMMENDED_VERSION]), ); } - break; + break; } return ValidationResult::ok(trans('validation.validations.database.CheckDatabaseServerVersion.ok')); diff --git a/LibreNMS/Validations/Updates.php b/LibreNMS/Validations/Updates.php index 0f4854fd2a..5c991ccb6f 100644 --- a/LibreNMS/Validations/Updates.php +++ b/LibreNMS/Validations/Updates.php @@ -111,7 +111,6 @@ class Updates extends BaseValidation $modifiedcmd = 'git diff --name-only --exit-code'; $validator->execAsUser($modifiedcmd, $cmdoutput, $code); if ($code !== 0 && ! empty($cmdoutput)) { - // Check so it's not only plugins that "pests" the diff if (! ($cmdoutput === ['composer.json', 'composer.lock'] && ComposerHelper::getPlugins())) { $result = ValidationResult::warn( diff --git a/app/Console/Commands/DevSimulate.php b/app/Console/Commands/DevSimulate.php index 6190b99ce6..1d06eb8545 100644 --- a/app/Console/Commands/DevSimulate.php +++ b/app/Console/Commands/DevSimulate.php @@ -116,14 +116,14 @@ class DevSimulate extends LnmsCommand { if (function_exists('pcntl_signal')) { pcntl_signal(SIGINT, function () { - exit(); // exit normally on SIGINT + exit; // exit normally on SIGINT }); } register_shutdown_function(function () use ($device_id) { Device::findOrNew($device_id)->delete(); $this->info(trans('commands.dev:simulate.removed', ['id' => $device_id])); - exit(); + exit; }); } diff --git a/app/Console/Commands/KeyRotate.php b/app/Console/Commands/KeyRotate.php index 29b563f84d..f1c4cc752e 100644 --- a/app/Console/Commands/KeyRotate.php +++ b/app/Console/Commands/KeyRotate.php @@ -97,8 +97,8 @@ class KeyRotate extends LnmsCommand if ($this->option('generate-new-key')) { $old = $new; // use key in env as existing key $new = 'base64:' . base64_encode( - Encrypter::generateKey($this->laravel['config']['app.cipher']) - ); + Encrypter::generateKey($this->laravel['config']['app.cipher']) + ); } $this->line(trans('commands.key:rotate.old_key', ['key' => $old])); diff --git a/app/Http/Controllers/Device/Tabs/NetflowController.php b/app/Http/Controllers/Device/Tabs/NetflowController.php index 80fb3c5666..731ab6e6bc 100644 --- a/app/Http/Controllers/Device/Tabs/NetflowController.php +++ b/app/Http/Controllers/Device/Tabs/NetflowController.php @@ -35,7 +35,7 @@ class NetflowController implements DeviceTab { if (Config::get('nfsen_enable')) { foreach ((array) Config::get('nfsen_rrds', []) as $nfsenrrds) { - if ($nfsenrrds[(strlen($nfsenrrds) - 1)] != '/') { + if ($nfsenrrds[strlen($nfsenrrds) - 1] != '/') { $nfsenrrds .= '/'; } diff --git a/app/Http/Controllers/Device/Tabs/ShowConfigController.php b/app/Http/Controllers/Device/Tabs/ShowConfigController.php index e3dd84a73c..a724dda733 100644 --- a/app/Http/Controllers/Device/Tabs/ShowConfigController.php +++ b/app/Http/Controllers/Device/Tabs/ShowConfigController.php @@ -104,7 +104,7 @@ class ShowConfigController extends Controller implements DeviceTab if (Config::has('rancid_configs.0')) { $device = DeviceCache::getPrimary(); foreach (Config::get('rancid_configs') as $configs) { - if ($configs[(strlen($configs) - 1)] != '/') { + if ($configs[strlen($configs) - 1] != '/') { $configs .= '/'; } diff --git a/app/Http/Controllers/PaginatedAjaxController.php b/app/Http/Controllers/PaginatedAjaxController.php index 4d9454bc05..587f871cec 100644 --- a/app/Http/Controllers/PaginatedAjaxController.php +++ b/app/Http/Controllers/PaginatedAjaxController.php @@ -76,6 +76,7 @@ abstract class PaginatedAjaxController extends Controller * * @param \Illuminate\Http\Request $request * @return array + * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ protected function searchFields($request) @@ -88,6 +89,7 @@ abstract class PaginatedAjaxController extends Controller * * @param \Illuminate\Http\Request $request * @return array + * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ protected function filterFields($request) @@ -100,6 +102,7 @@ abstract class PaginatedAjaxController extends Controller * * @param \Illuminate\Http\Request $request * @return array + * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ protected function sortFields($request) diff --git a/app/Http/Controllers/Select/EventlogController.php b/app/Http/Controllers/Select/EventlogController.php index b58b0ba214..7068236b35 100644 --- a/app/Http/Controllers/Select/EventlogController.php +++ b/app/Http/Controllers/Select/EventlogController.php @@ -49,6 +49,7 @@ class EventlogController extends SelectController * * @param \Illuminate\Http\Request $request * @return array + * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ protected function sortFields($request) diff --git a/app/Http/Controllers/Table/LocationController.php b/app/Http/Controllers/Table/LocationController.php index e9ae6fdf32..430f93445a 100644 --- a/app/Http/Controllers/Table/LocationController.php +++ b/app/Http/Controllers/Table/LocationController.php @@ -35,6 +35,7 @@ class LocationController extends TableController * * @param \Illuminate\Http\Request $request * @return array + * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function searchFields($request) diff --git a/app/Http/Controllers/Table/OutagesController.php b/app/Http/Controllers/Table/OutagesController.php index 9c09f0a8a1..e46eceda0b 100644 --- a/app/Http/Controllers/Table/OutagesController.php +++ b/app/Http/Controllers/Table/OutagesController.php @@ -113,7 +113,7 @@ class OutagesController extends TableController } $output = ""; - $output .= (Carbon::createFromTimestamp($timestamp))->format(Config::get('dateformat.compact')); // Convert epoch to local time + $output .= Carbon::createFromTimestamp($timestamp)->format(Config::get('dateformat.compact')); // Convert epoch to local time $output .= ''; return $output; diff --git a/app/Listeners/QueryDebugListener.php b/app/Listeners/QueryDebugListener.php index ad5b0802c8..8ab946364d 100644 --- a/app/Listeners/QueryDebugListener.php +++ b/app/Listeners/QueryDebugListener.php @@ -27,7 +27,6 @@ class QueryDebugListener public function handle(QueryExecuted $query) { if (Debug::queryDebugIsEnabled()) { - // collect bindings and make them a little more readable $bindings = collect($query->bindings)->map(function ($item) { if ($item instanceof \Carbon\Carbon) { diff --git a/app/Models/AlertTransport.php b/app/Models/AlertTransport.php index e5582e90d8..b299e39fff 100644 --- a/app/Models/AlertTransport.php +++ b/app/Models/AlertTransport.php @@ -23,6 +23,7 @@ use LibreNMS\Alert\Transport; * @method static \Illuminate\Database\Eloquent\Builder|AlertTransport whereTransportId($value) * @method static \Illuminate\Database\Eloquent\Builder|AlertTransport whereTransportName($value) * @method static \Illuminate\Database\Eloquent\Builder|AlertTransport whereTransportType($value) + * * @mixin \Eloquent */ class AlertTransport extends Model diff --git a/app/Models/Port.php b/app/Models/Port.php index e83c0810db..4b45342da0 100644 --- a/app/Models/Port.php +++ b/app/Models/Port.php @@ -106,7 +106,7 @@ class Port extends DeviceRelatedModel */ public function getDescription(): string { - return (string) ($this->ifAlias); + return (string) $this->ifAlias; } /** diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 5a6438df19..b936b589f0 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -42,7 +42,6 @@ class EventServiceProvider extends ServiceProvider */ public function boot() { - // } } diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 666e343d0f..234b9ac90c 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -38,7 +38,6 @@ class RouteServiceProvider extends ServiceProvider //$this->configureRateLimiting(); $this->routes(function () { - /** * Define the "api" routes for the application. * diff --git a/config/app.php b/config/app.php index dbd47c59b1..c012bd357f 100644 --- a/config/app.php +++ b/config/app.php @@ -8,250 +8,250 @@ | request an environment variable to be created upstream or send a pull request. */ -return [ + return [ - /* - |-------------------------------------------------------------------------- - | Application Name - |-------------------------------------------------------------------------- - | - | This value is the name of your application. This value is used when the - | framework needs to place the application's name in a notification or - | any other location as required by the application or its packages. - | - */ + /* + |-------------------------------------------------------------------------- + | Application Name + |-------------------------------------------------------------------------- + | + | This value is the name of your application. This value is used when the + | framework needs to place the application's name in a notification or + | any other location as required by the application or its packages. + | + */ - 'name' => env('APP_NAME', 'LibreNMS'), + 'name' => env('APP_NAME', 'LibreNMS'), - /* - |-------------------------------------------------------------------------- - | Application Environment - |-------------------------------------------------------------------------- - | - | This value determines the "environment" your application is currently - | running in. This may determine how you prefer to configure various - | services the application utilizes. Set this in your ".env" file. - | - */ + /* + |-------------------------------------------------------------------------- + | Application Environment + |-------------------------------------------------------------------------- + | + | This value determines the "environment" your application is currently + | running in. This may determine how you prefer to configure various + | services the application utilizes. Set this in your ".env" file. + | + */ - 'env' => env('APP_ENV', 'production'), + 'env' => env('APP_ENV', 'production'), - /* - |-------------------------------------------------------------------------- - | Application Debug Mode - |-------------------------------------------------------------------------- - | - | When your application is in debug mode, detailed error messages with - | stack traces will be shown on every error that occurs within your - | application. If disabled, a simple generic error page is shown. - | - */ + /* + |-------------------------------------------------------------------------- + | Application Debug Mode + |-------------------------------------------------------------------------- + | + | When your application is in debug mode, detailed error messages with + | stack traces will be shown on every error that occurs within your + | application. If disabled, a simple generic error page is shown. + | + */ - 'debug' => (bool) env('APP_DEBUG', false), + 'debug' => (bool) env('APP_DEBUG', false), - /* - |-------------------------------------------------------------------------- - | Application URL - |-------------------------------------------------------------------------- - | - | This URL is used by the console to properly generate URLs when using - | the Artisan command line tool. You should set this to the root of - | your application so that it is used when running Artisan tasks. - | - */ + /* + |-------------------------------------------------------------------------- + | Application URL + |-------------------------------------------------------------------------- + | + | This URL is used by the console to properly generate URLs when using + | the Artisan command line tool. You should set this to the root of + | your application so that it is used when running Artisan tasks. + | + */ - 'url' => env('APP_URL', 'http://localhost'), + 'url' => env('APP_URL', 'http://localhost'), - 'asset_url' => env('ASSET_URL', null), + 'asset_url' => env('ASSET_URL', null), - /* - |-------------------------------------------------------------------------- - | Application Timezone - |-------------------------------------------------------------------------- - | - | Here you may specify the default timezone for your application, which - | will be used by the PHP date and date-time functions. We have gone - | ahead and set this to a sensible default for you out of the box. - | - */ + /* + |-------------------------------------------------------------------------- + | Application Timezone + |-------------------------------------------------------------------------- + | + | Here you may specify the default timezone for your application, which + | will be used by the PHP date and date-time functions. We have gone + | ahead and set this to a sensible default for you out of the box. + | + */ - 'timezone' => ini_get('date.timezone') ?: 'UTC', // use existing timezone + 'timezone' => ini_get('date.timezone') ?: 'UTC', // use existing timezone - /* - |-------------------------------------------------------------------------- - | Application Locale Configuration - |-------------------------------------------------------------------------- - | - | The application locale determines the default locale that will be used - | by the translation service provider. You are free to set this value - | to any of the locales which will be supported by the application. - | - */ + /* + |-------------------------------------------------------------------------- + | Application Locale Configuration + |-------------------------------------------------------------------------- + | + | The application locale determines the default locale that will be used + | by the translation service provider. You are free to set this value + | to any of the locales which will be supported by the application. + | + */ - 'locale' => env('APP_LOCALE', 'en'), + 'locale' => env('APP_LOCALE', 'en'), - /* - |-------------------------------------------------------------------------- - | Application Fallback Locale - |-------------------------------------------------------------------------- - | - | The fallback locale determines the locale to use when the current one - | is not available. You may change the value to correspond to any of - | the language folders that are provided through your application. - | - */ + /* + |-------------------------------------------------------------------------- + | Application Fallback Locale + |-------------------------------------------------------------------------- + | + | The fallback locale determines the locale to use when the current one + | is not available. You may change the value to correspond to any of + | the language folders that are provided through your application. + | + */ - 'fallback_locale' => 'en', + 'fallback_locale' => 'en', - /* - |-------------------------------------------------------------------------- - | Faker Locale - |-------------------------------------------------------------------------- - | - | This locale will be used by the Faker PHP library when generating fake - | data for your database seeds. For example, this will be used to get - | localized telephone numbers, street address information and more. - | - */ + /* + |-------------------------------------------------------------------------- + | Faker Locale + |-------------------------------------------------------------------------- + | + | This locale will be used by the Faker PHP library when generating fake + | data for your database seeds. For example, this will be used to get + | localized telephone numbers, street address information and more. + | + */ - 'faker_locale' => 'en_US', + 'faker_locale' => 'en_US', - /* - |-------------------------------------------------------------------------- - | Encryption Key - |-------------------------------------------------------------------------- - | - | This key is used by the Illuminate encrypter service and should be set - | to a random, 32 character string, otherwise these encrypted strings - | will not be safe. Please do this before deploying an application! - | - */ + /* + |-------------------------------------------------------------------------- + | Encryption Key + |-------------------------------------------------------------------------- + | + | This key is used by the Illuminate encrypter service and should be set + | to a random, 32 character string, otherwise these encrypted strings + | will not be safe. Please do this before deploying an application! + | + */ - 'key' => env('APP_KEY'), + 'key' => env('APP_KEY'), - 'cipher' => 'AES-256-CBC', + 'cipher' => 'AES-256-CBC', - /* - |-------------------------------------------------------------------------- - | Autoloaded Service Providers - |-------------------------------------------------------------------------- - | - | The service providers listed here will be automatically loaded on the - | request to your application. Feel free to add your own services to - | this array to grant expanded functionality to your applications. - | - */ + /* + |-------------------------------------------------------------------------- + | Autoloaded Service Providers + |-------------------------------------------------------------------------- + | + | The service providers listed here will be automatically loaded on the + | request to your application. Feel free to add your own services to + | this array to grant expanded functionality to your applications. + | + */ - 'providers' => [ + 'providers' => [ - /* - * Laravel Framework Service Providers... - */ - Illuminate\Auth\AuthServiceProvider::class, - Illuminate\Broadcasting\BroadcastServiceProvider::class, - Illuminate\Bus\BusServiceProvider::class, - Illuminate\Cache\CacheServiceProvider::class, - Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, - Illuminate\Cookie\CookieServiceProvider::class, - Illuminate\Database\DatabaseServiceProvider::class, - Illuminate\Encryption\EncryptionServiceProvider::class, - Illuminate\Filesystem\FilesystemServiceProvider::class, - Illuminate\Foundation\Providers\FoundationServiceProvider::class, - Illuminate\Hashing\HashServiceProvider::class, - Illuminate\Mail\MailServiceProvider::class, - Illuminate\Notifications\NotificationServiceProvider::class, - Illuminate\Pagination\PaginationServiceProvider::class, - Illuminate\Pipeline\PipelineServiceProvider::class, - Illuminate\Queue\QueueServiceProvider::class, - Illuminate\Redis\RedisServiceProvider::class, - Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, - Illuminate\Session\SessionServiceProvider::class, - Illuminate\Translation\TranslationServiceProvider::class, - Illuminate\Validation\ValidationServiceProvider::class, - Illuminate\View\ViewServiceProvider::class, + /* + * Laravel Framework Service Providers... + */ + Illuminate\Auth\AuthServiceProvider::class, + Illuminate\Broadcasting\BroadcastServiceProvider::class, + Illuminate\Bus\BusServiceProvider::class, + Illuminate\Cache\CacheServiceProvider::class, + Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, + Illuminate\Cookie\CookieServiceProvider::class, + Illuminate\Database\DatabaseServiceProvider::class, + Illuminate\Encryption\EncryptionServiceProvider::class, + Illuminate\Filesystem\FilesystemServiceProvider::class, + Illuminate\Foundation\Providers\FoundationServiceProvider::class, + Illuminate\Hashing\HashServiceProvider::class, + Illuminate\Mail\MailServiceProvider::class, + Illuminate\Notifications\NotificationServiceProvider::class, + Illuminate\Pagination\PaginationServiceProvider::class, + Illuminate\Pipeline\PipelineServiceProvider::class, + Illuminate\Queue\QueueServiceProvider::class, + Illuminate\Redis\RedisServiceProvider::class, + Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, + Illuminate\Session\SessionServiceProvider::class, + Illuminate\Translation\TranslationServiceProvider::class, + Illuminate\Validation\ValidationServiceProvider::class, + Illuminate\View\ViewServiceProvider::class, - /* - * Package Service Providers... - */ + /* + * Package Service Providers... + */ - /* - * LibreNMS Service Providers... - */ - App\Providers\ConfigServiceProvider::class, - App\Providers\ErrorReportingProvider::class, // This should always be after the config is loaded - App\Providers\AppServiceProvider::class, - App\Providers\CliServiceProvider::class, - App\Providers\AuthServiceProvider::class, - // App\Providers\BroadcastServiceProvider::class, - App\Providers\EventServiceProvider::class, - App\Providers\RouteServiceProvider::class, - App\Providers\ComposerServiceProvider::class, - App\Providers\DatastoreServiceProvider::class, - App\Providers\SnmptrapProvider::class, - App\Providers\PluginProvider::class, - ], + /* + * LibreNMS Service Providers... + */ + App\Providers\ConfigServiceProvider::class, + App\Providers\ErrorReportingProvider::class, // This should always be after the config is loaded + App\Providers\AppServiceProvider::class, + App\Providers\CliServiceProvider::class, + App\Providers\AuthServiceProvider::class, + // App\Providers\BroadcastServiceProvider::class, + App\Providers\EventServiceProvider::class, + App\Providers\RouteServiceProvider::class, + App\Providers\ComposerServiceProvider::class, + App\Providers\DatastoreServiceProvider::class, + App\Providers\SnmptrapProvider::class, + App\Providers\PluginProvider::class, + ], - /* - |-------------------------------------------------------------------------- - | Class Aliases - |-------------------------------------------------------------------------- - | - | This array of class aliases will be registered when this application - | is started. However, feel free to register as many as you wish as - | the aliases are "lazy" loaded so they don't hinder performance. - | - */ + /* + |-------------------------------------------------------------------------- + | Class Aliases + |-------------------------------------------------------------------------- + | + | This array of class aliases will be registered when this application + | is started. However, feel free to register as many as you wish as + | the aliases are "lazy" loaded so they don't hinder performance. + | + */ - 'aliases' => [ + 'aliases' => [ - 'App' => Illuminate\Support\Facades\App::class, - 'Arr' => Illuminate\Support\Arr::class, - 'Artisan' => Illuminate\Support\Facades\Artisan::class, - 'Auth' => Illuminate\Support\Facades\Auth::class, - 'Blade' => Illuminate\Support\Facades\Blade::class, - 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, - 'Bus' => Illuminate\Support\Facades\Bus::class, - 'Cache' => Illuminate\Support\Facades\Cache::class, - 'Config' => Illuminate\Support\Facades\Config::class, - 'Cookie' => Illuminate\Support\Facades\Cookie::class, - 'Crypt' => Illuminate\Support\Facades\Crypt::class, - 'Date' => Illuminate\Support\Facades\Date::class, - 'DB' => Illuminate\Support\Facades\DB::class, - 'Eloquent' => Illuminate\Database\Eloquent\Model::class, - 'Event' => Illuminate\Support\Facades\Event::class, - 'File' => Illuminate\Support\Facades\File::class, - 'Gate' => Illuminate\Support\Facades\Gate::class, - 'Hash' => Illuminate\Support\Facades\Hash::class, - 'Http' => Illuminate\Support\Facades\Http::class, - 'Lang' => Illuminate\Support\Facades\Lang::class, - 'Log' => Illuminate\Support\Facades\Log::class, - 'Mail' => Illuminate\Support\Facades\Mail::class, - 'Notification' => Illuminate\Support\Facades\Notification::class, - 'Password' => Illuminate\Support\Facades\Password::class, - 'Queue' => Illuminate\Support\Facades\Queue::class, - 'RateLimiter' => Illuminate\Support\Facades\RateLimiter::class, - 'Redirect' => Illuminate\Support\Facades\Redirect::class, - 'Redis' => Illuminate\Support\Facades\Redis::class, - 'Request' => Illuminate\Support\Facades\Request::class, - 'Response' => Illuminate\Support\Facades\Response::class, - 'Route' => Illuminate\Support\Facades\Route::class, - 'Schema' => Illuminate\Support\Facades\Schema::class, - 'Session' => Illuminate\Support\Facades\Session::class, - 'Storage' => Illuminate\Support\Facades\Storage::class, - 'Str' => Illuminate\Support\Str::class, - 'URL' => Illuminate\Support\Facades\URL::class, - 'Validator' => Illuminate\Support\Facades\Validator::class, - 'View' => Illuminate\Support\Facades\View::class, - 'Debugbar' => Barryvdh\Debugbar\Facades\Debugbar::class, - 'Flare' => Facade\Ignition\Facades\Flare::class, + 'App' => Illuminate\Support\Facades\App::class, + 'Arr' => Illuminate\Support\Arr::class, + 'Artisan' => Illuminate\Support\Facades\Artisan::class, + 'Auth' => Illuminate\Support\Facades\Auth::class, + 'Blade' => Illuminate\Support\Facades\Blade::class, + 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, + 'Bus' => Illuminate\Support\Facades\Bus::class, + 'Cache' => Illuminate\Support\Facades\Cache::class, + 'Config' => Illuminate\Support\Facades\Config::class, + 'Cookie' => Illuminate\Support\Facades\Cookie::class, + 'Crypt' => Illuminate\Support\Facades\Crypt::class, + 'Date' => Illuminate\Support\Facades\Date::class, + 'DB' => Illuminate\Support\Facades\DB::class, + 'Eloquent' => Illuminate\Database\Eloquent\Model::class, + 'Event' => Illuminate\Support\Facades\Event::class, + 'File' => Illuminate\Support\Facades\File::class, + 'Gate' => Illuminate\Support\Facades\Gate::class, + 'Hash' => Illuminate\Support\Facades\Hash::class, + 'Http' => Illuminate\Support\Facades\Http::class, + 'Lang' => Illuminate\Support\Facades\Lang::class, + 'Log' => Illuminate\Support\Facades\Log::class, + 'Mail' => Illuminate\Support\Facades\Mail::class, + 'Notification' => Illuminate\Support\Facades\Notification::class, + 'Password' => Illuminate\Support\Facades\Password::class, + 'Queue' => Illuminate\Support\Facades\Queue::class, + 'RateLimiter' => Illuminate\Support\Facades\RateLimiter::class, + 'Redirect' => Illuminate\Support\Facades\Redirect::class, + 'Redis' => Illuminate\Support\Facades\Redis::class, + 'Request' => Illuminate\Support\Facades\Request::class, + 'Response' => Illuminate\Support\Facades\Response::class, + 'Route' => Illuminate\Support\Facades\Route::class, + 'Schema' => Illuminate\Support\Facades\Schema::class, + 'Session' => Illuminate\Support\Facades\Session::class, + 'Storage' => Illuminate\Support\Facades\Storage::class, + 'Str' => Illuminate\Support\Str::class, + 'URL' => Illuminate\Support\Facades\URL::class, + 'Validator' => Illuminate\Support\Facades\Validator::class, + 'View' => Illuminate\Support\Facades\View::class, + 'Debugbar' => Barryvdh\Debugbar\Facades\Debugbar::class, + 'Flare' => Facade\Ignition\Facades\Flare::class, - // LibreNMS - 'Permissions' => \App\Facades\Permissions::class, - 'PluginManager' => \App\Facades\PluginManager::class, - 'DeviceCache' => \App\Facades\DeviceCache::class, - 'Rrd' => \App\Facades\Rrd::class, - 'SnmpQuery' => \App\Facades\FacadeAccessorSnmp::class, - ], + // LibreNMS + 'Permissions' => \App\Facades\Permissions::class, + 'PluginManager' => \App\Facades\PluginManager::class, + 'DeviceCache' => \App\Facades\DeviceCache::class, + 'Rrd' => \App\Facades\Rrd::class, + 'SnmpQuery' => \App\Facades\FacadeAccessorSnmp::class, + ], - 'charset' => env('CHARSET', ini_get('php.output_encoding') ?: ini_get('default_charset') ?: 'UTF-8'), -]; + 'charset' => env('CHARSET', ini_get('php.output_encoding') ?: ini_get('default_charset') ?: 'UTF-8'), + ]; diff --git a/config/auth.php b/config/auth.php index 0cfaa01e6b..40041d00be 100644 --- a/config/auth.php +++ b/config/auth.php @@ -8,129 +8,129 @@ | request an environment variable to be created upstream or send a pull request. */ -return [ + return [ - /* - |-------------------------------------------------------------------------- - | Authentication Defaults - |-------------------------------------------------------------------------- - | - | This option controls the default authentication "guard" and password - | reset options for your application. You may change these defaults - | as required, but they're a perfect start for most applications. - | - */ + /* + |-------------------------------------------------------------------------- + | Authentication Defaults + |-------------------------------------------------------------------------- + | + | This option controls the default authentication "guard" and password + | reset options for your application. You may change these defaults + | as required, but they're a perfect start for most applications. + | + */ - 'defaults' => [ - 'guard' => 'web', - 'passwords' => 'users', - ], + 'defaults' => [ + 'guard' => 'web', + 'passwords' => 'users', + ], - /* - |-------------------------------------------------------------------------- - | Authentication Guards - |-------------------------------------------------------------------------- - | - | Next, you may define every authentication guard for your application. - | Of course, a great default configuration has been defined for you - | here which uses session storage and the Eloquent user provider. - | - | All authentication drivers have a user provider. This defines how the - | users are actually retrieved out of your database or other storage - | mechanisms used by this application to persist your user's data. - | - | Supported: "session" - | - */ + /* + |-------------------------------------------------------------------------- + | Authentication Guards + |-------------------------------------------------------------------------- + | + | Next, you may define every authentication guard for your application. + | Of course, a great default configuration has been defined for you + | here which uses session storage and the Eloquent user provider. + | + | All authentication drivers have a user provider. This defines how the + | users are actually retrieved out of your database or other storage + | mechanisms used by this application to persist your user's data. + | + | Supported: "session" + | + */ - 'guards' => [ - 'web' => [ - 'driver' => 'session', - 'provider' => 'legacy', - ], + 'guards' => [ + 'web' => [ + 'driver' => 'session', + 'provider' => 'legacy', + ], - 'api' => [ - 'driver' => 'token', - 'provider' => 'users', - 'hash' => false, - ], + 'api' => [ + 'driver' => 'token', + 'provider' => 'users', + 'hash' => false, + ], - 'token' => [ - 'driver' => 'token_driver', - 'provider' => 'token_provider', - 'hash' => false, - ], - ], + 'token' => [ + 'driver' => 'token_driver', + 'provider' => 'token_provider', + 'hash' => false, + ], + ], - /* - |-------------------------------------------------------------------------- - | User Providers - |-------------------------------------------------------------------------- - | - | All authentication drivers have a user provider. This defines how the - | users are actually retrieved out of your database or other storage - | mechanisms used by this application to persist your user's data. - | - | If you have multiple user tables or models you may configure multiple - | sources which represent each model / table. These sources may then - | be assigned to any extra authentication guards you have defined. - | - | Supported: "database", "eloquent" - | - */ + /* + |-------------------------------------------------------------------------- + | User Providers + |-------------------------------------------------------------------------- + | + | All authentication drivers have a user provider. This defines how the + | users are actually retrieved out of your database or other storage + | mechanisms used by this application to persist your user's data. + | + | If you have multiple user tables or models you may configure multiple + | sources which represent each model / table. These sources may then + | be assigned to any extra authentication guards you have defined. + | + | Supported: "database", "eloquent" + | + */ - 'providers' => [ - 'users' => [ - 'driver' => 'eloquent', - 'model' => App\Models\User::class, - ], + 'providers' => [ + 'users' => [ + 'driver' => 'eloquent', + 'model' => App\Models\User::class, + ], - 'legacy' => [ - 'driver' => 'legacy', - 'model' => App\Models\User::class, - ], + 'legacy' => [ + 'driver' => 'legacy', + 'model' => App\Models\User::class, + ], - // 'users' => [ - // 'driver' => 'database', - // 'table' => 'users', - // ], - ], + // 'users' => [ + // 'driver' => 'database', + // 'table' => 'users', + // ], + ], - /* - |-------------------------------------------------------------------------- - | Resetting Passwords - |-------------------------------------------------------------------------- - | - | You may specify multiple password reset configurations if you have more - | than one user table or model in the application and you want to have - | separate password reset settings based on the specific user types. - | - | The expire time is the number of minutes that the reset token should be - | considered valid. This security feature keeps tokens short-lived so - | they have less time to be guessed. You may change this as needed. - | - */ + /* + |-------------------------------------------------------------------------- + | Resetting Passwords + |-------------------------------------------------------------------------- + | + | You may specify multiple password reset configurations if you have more + | than one user table or model in the application and you want to have + | separate password reset settings based on the specific user types. + | + | The expire time is the number of minutes that the reset token should be + | considered valid. This security feature keeps tokens short-lived so + | they have less time to be guessed. You may change this as needed. + | + */ - 'passwords' => [ - 'users' => [ - 'provider' => 'users', - 'table' => 'password_resets', - 'expire' => 60, - 'throttle' => 60, - ], - ], + 'passwords' => [ + 'users' => [ + 'provider' => 'users', + 'table' => 'password_resets', + 'expire' => 60, + 'throttle' => 60, + ], + ], - /* - |-------------------------------------------------------------------------- - | Password Confirmation Timeout - |-------------------------------------------------------------------------- - | - | Here you may define the amount of seconds before a password confirmation - | times out and the user is prompted to re-enter their password via the - | confirmation screen. By default, the timeout lasts for three hours. - | - */ + /* + |-------------------------------------------------------------------------- + | Password Confirmation Timeout + |-------------------------------------------------------------------------- + | + | Here you may define the amount of seconds before a password confirmation + | times out and the user is prompted to re-enter their password via the + | confirmation screen. By default, the timeout lasts for three hours. + | + */ - 'password_timeout' => 10800, + 'password_timeout' => 10800, -]; + ]; diff --git a/config/broadcasting.php b/config/broadcasting.php index e77a290fc2..0d4d6f62bb 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -8,65 +8,65 @@ | request an environment variable to be created upstream or send a pull request. */ -return [ + return [ - /* - |-------------------------------------------------------------------------- - | Default Broadcaster - |-------------------------------------------------------------------------- - | - | This option controls the default broadcaster that will be used by the - | framework when an event needs to be broadcast. You may set this to - | any of the connections defined in the "connections" array below. - | - | Supported: "pusher", "ably", "redis", "log", "null" - | - */ + /* + |-------------------------------------------------------------------------- + | Default Broadcaster + |-------------------------------------------------------------------------- + | + | This option controls the default broadcaster that will be used by the + | framework when an event needs to be broadcast. You may set this to + | any of the connections defined in the "connections" array below. + | + | Supported: "pusher", "ably", "redis", "log", "null" + | + */ - 'default' => env('BROADCAST_DRIVER', 'null'), + 'default' => env('BROADCAST_DRIVER', 'null'), - /* - |-------------------------------------------------------------------------- - | Broadcast Connections - |-------------------------------------------------------------------------- - | - | Here you may define all of the broadcast connections that will be used - | to broadcast events to other systems or over websockets. Samples of - | each available type of connection are provided inside this array. - | - */ + /* + |-------------------------------------------------------------------------- + | Broadcast Connections + |-------------------------------------------------------------------------- + | + | Here you may define all of the broadcast connections that will be used + | to broadcast events to other systems or over websockets. Samples of + | each available type of connection are provided inside this array. + | + */ - 'connections' => [ + 'connections' => [ - 'pusher' => [ - 'driver' => 'pusher', - 'key' => env('PUSHER_APP_KEY'), - 'secret' => env('PUSHER_APP_SECRET'), - 'app_id' => env('PUSHER_APP_ID'), - 'options' => [ - 'cluster' => env('PUSHER_APP_CLUSTER'), - 'useTLS' => true, - ], - ], + 'pusher' => [ + 'driver' => 'pusher', + 'key' => env('PUSHER_APP_KEY'), + 'secret' => env('PUSHER_APP_SECRET'), + 'app_id' => env('PUSHER_APP_ID'), + 'options' => [ + 'cluster' => env('PUSHER_APP_CLUSTER'), + 'useTLS' => true, + ], + ], - 'ably' => [ - 'driver' => 'ably', - 'key' => env('ABLY_KEY'), - ], + 'ably' => [ + 'driver' => 'ably', + 'key' => env('ABLY_KEY'), + ], - 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - ], + 'redis' => [ + 'driver' => 'redis', + 'connection' => 'default', + ], - 'log' => [ - 'driver' => 'log', - ], + 'log' => [ + 'driver' => 'log', + ], - 'null' => [ - 'driver' => 'null', - ], + 'null' => [ + 'driver' => 'null', + ], - ], + ], -]; + ]; diff --git a/config/cache.php b/config/cache.php index dd4ccffde6..6cd55eff7e 100644 --- a/config/cache.php +++ b/config/cache.php @@ -8,111 +8,111 @@ | request an environment variable to be created upstream or send a pull request. */ -use Illuminate\Support\Str; + use Illuminate\Support\Str; -return [ + return [ - /* - |-------------------------------------------------------------------------- - | Default Cache Store - |-------------------------------------------------------------------------- - | - | This option controls the default cache connection that gets used while - | using this caching library. This connection is used when another is - | not explicitly specified when executing a given caching function. - | - */ + /* + |-------------------------------------------------------------------------- + | Default Cache Store + |-------------------------------------------------------------------------- + | + | This option controls the default cache connection that gets used while + | using this caching library. This connection is used when another is + | not explicitly specified when executing a given caching function. + | + */ - 'default' => env('CACHE_DRIVER', 'database'), + 'default' => env('CACHE_DRIVER', 'database'), - /* - |-------------------------------------------------------------------------- - | Cache Stores - |-------------------------------------------------------------------------- - | - | Here you may define all of the cache "stores" for your application as - | well as their drivers. You may even define multiple stores for the - | same cache driver to group types of items stored in your caches. - | - | Supported drivers: "apc", "array", "database", "file", - | "memcached", "redis", "dynamodb", "octane", "null" - | - */ + /* + |-------------------------------------------------------------------------- + | Cache Stores + |-------------------------------------------------------------------------- + | + | Here you may define all of the cache "stores" for your application as + | well as their drivers. You may even define multiple stores for the + | same cache driver to group types of items stored in your caches. + | + | Supported drivers: "apc", "array", "database", "file", + | "memcached", "redis", "dynamodb", "octane", "null" + | + */ - 'stores' => [ + 'stores' => [ - 'apc' => [ - 'driver' => 'apc', - ], + 'apc' => [ + 'driver' => 'apc', + ], - 'array' => [ - 'driver' => 'array', - 'serialize' => false, - ], + 'array' => [ + 'driver' => 'array', + 'serialize' => false, + ], - 'database' => [ - 'driver' => 'database', - 'table' => 'cache', - 'connection' => null, - 'lock_connection' => null, - ], + 'database' => [ + 'driver' => 'database', + 'table' => 'cache', + 'connection' => null, + 'lock_connection' => null, + ], - 'file' => [ - 'driver' => 'file', - 'path' => storage_path('framework/cache/data'), - ], + 'file' => [ + 'driver' => 'file', + 'path' => storage_path('framework/cache/data'), + ], - 'memcached' => [ - 'driver' => 'memcached', - 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), - 'sasl' => [ - env('MEMCACHED_USERNAME'), - env('MEMCACHED_PASSWORD'), - ], - 'options' => [ - // Memcached::OPT_CONNECT_TIMEOUT => 2000, - ], - 'servers' => [ - [ - 'host' => env('MEMCACHED_HOST', '127.0.0.1'), - 'port' => env('MEMCACHED_PORT', 11211), - 'weight' => 100, - ], - ], - ], + 'memcached' => [ + 'driver' => 'memcached', + 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), + 'sasl' => [ + env('MEMCACHED_USERNAME'), + env('MEMCACHED_PASSWORD'), + ], + 'options' => [ + // Memcached::OPT_CONNECT_TIMEOUT => 2000, + ], + 'servers' => [ + [ + 'host' => env('MEMCACHED_HOST', '127.0.0.1'), + 'port' => env('MEMCACHED_PORT', 11211), + 'weight' => 100, + ], + ], + ], - 'redis' => [ - 'driver' => 'redis', - 'connection' => 'cache', - 'lock_connection' => 'default', - ], + 'redis' => [ + 'driver' => 'redis', + 'connection' => 'cache', + 'lock_connection' => 'default', + ], - 'dynamodb' => [ - 'driver' => 'dynamodb', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), - 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), - 'endpoint' => env('DYNAMODB_ENDPOINT'), - ], + 'dynamodb' => [ + 'driver' => 'dynamodb', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), + 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), + 'endpoint' => env('DYNAMODB_ENDPOINT'), + ], - 'octane' => [ - 'driver' => 'octane', - ], + 'octane' => [ + 'driver' => 'octane', + ], - ], + ], - /* - |-------------------------------------------------------------------------- - | Cache Key Prefix - |-------------------------------------------------------------------------- - | - | When utilizing a RAM based store such as APC or Memcached, there might - | be other applications utilizing the same cache. So, we'll specify a - | value to get prefixed to all our keys so we can avoid collisions. - | - */ + /* + |-------------------------------------------------------------------------- + | Cache Key Prefix + |-------------------------------------------------------------------------- + | + | When utilizing a RAM based store such as APC or Memcached, there might + | be other applications utilizing the same cache. So, we'll specify a + | value to get prefixed to all our keys so we can avoid collisions. + | + */ - 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache'), + 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache'), -]; + ]; diff --git a/config/database.php b/config/database.php index 1f3d00d2c6..5e8dcf2444 100644 --- a/config/database.php +++ b/config/database.php @@ -8,225 +8,225 @@ | request an environment variable to be created upstream or send a pull request. */ -use Illuminate\Support\Str; + use Illuminate\Support\Str; -return [ + return [ - /* - |-------------------------------------------------------------------------- - | Default Database Connection Name - |-------------------------------------------------------------------------- - | - | Here you may specify which of the database connections below you wish - | to use as your default connection for all database work. Of course - | you may use many connections at once using the Database library. - | - */ + /* + |-------------------------------------------------------------------------- + | Default Database Connection Name + |-------------------------------------------------------------------------- + | + | Here you may specify which of the database connections below you wish + | to use as your default connection for all database work. Of course + | you may use many connections at once using the Database library. + | + */ - 'default' => env('DB_CONNECTION', env('DBTEST') ? 'testing' : 'mysql'), + 'default' => env('DB_CONNECTION', env('DBTEST') ? 'testing' : 'mysql'), - /* - |-------------------------------------------------------------------------- - | Database Connections - |-------------------------------------------------------------------------- - | - | Here are each of the database connections setup for your application. - | Of course, examples of configuring each database platform that is - | supported by Laravel is shown below to make development simple. - | - | - | All database work in Laravel is done through the PHP PDO facilities - | so make sure you have the driver for your particular database of - | choice installed on your machine before you begin development. - | - */ + /* + |-------------------------------------------------------------------------- + | Database Connections + |-------------------------------------------------------------------------- + | + | Here are each of the database connections setup for your application. + | Of course, examples of configuring each database platform that is + | supported by Laravel is shown below to make development simple. + | + | + | All database work in Laravel is done through the PHP PDO facilities + | so make sure you have the driver for your particular database of + | choice installed on your machine before you begin development. + | + */ - 'connections' => [ + 'connections' => [ - 'sqlite' => [ - 'driver' => 'sqlite', - 'url' => env('DATABASE_URL'), - 'database' => env('DB_DATABASE', storage_path('librenms.sqlite')), - 'prefix' => '', - 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), - ], + 'sqlite' => [ + 'driver' => 'sqlite', + 'url' => env('DATABASE_URL'), + 'database' => env('DB_DATABASE', storage_path('librenms.sqlite')), + 'prefix' => '', + 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), + ], - 'mysql' => [ - 'driver' => 'mysql', - 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', 'localhost'), - 'port' => env('DB_PORT', '3306'), - 'database' => env('DB_DATABASE', 'librenms'), - 'username' => env('DB_USERNAME', 'librenms'), - 'password' => env('DB_PASSWORD', ''), - 'unix_socket' => env('DB_SOCKET', ''), - 'charset' => 'utf8mb4', - 'collation' => 'utf8mb4_unicode_ci', - 'prefix' => '', - 'prefix_indexes' => true, - 'strict' => true, - 'engine' => null, - 'sslmode' => env('DB_SSLMODE', 'disabled'), - 'options' => extension_loaded('pdo_mysql') ? array_filter([ - PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), - ]) : [], - ], + 'mysql' => [ + 'driver' => 'mysql', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', 'localhost'), + 'port' => env('DB_PORT', '3306'), + 'database' => env('DB_DATABASE', 'librenms'), + 'username' => env('DB_USERNAME', 'librenms'), + 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'prefix' => '', + 'prefix_indexes' => true, + 'strict' => true, + 'engine' => null, + 'sslmode' => env('DB_SSLMODE', 'disabled'), + 'options' => extension_loaded('pdo_mysql') ? array_filter([ + PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + ]) : [], + ], - 'mysql_cluster' => [ - 'read' => [ - 'host' => [ - env('DB_HOST', 'localhost'), - env('DB_HOST_R2', ''), - env('DB_HOST_R3', ''), - env('DB_HOST_R4', ''), - env('DB_HOST_R5', ''), - env('DB_HOST_R6', ''), - env('DB_HOST_R7', ''), - env('DB_HOST_R8', ''), - env('DB_HOST_R9', ''), - ], - ], - 'write' => [ - 'host' => [ - env('DB_HOST', 'localhost'), - env('DB_HOST_W2', ''), - env('DB_HOST_W3', ''), - env('DB_HOST_W4', ''), - env('DB_HOST_W5', ''), - env('DB_HOST_W6', ''), - env('DB_HOST_W7', ''), - env('DB_HOST_W8', ''), - env('DB_HOST_W9', ''), - ], - ], - 'sticky' => env('DB_STICKY', null), - 'driver' => 'mysql', - 'host' => env('DB_HOST', 'localhost'), - 'port' => env('DB_PORT', '3306'), - 'database' => env('DB_DATABASE', 'librenms'), - 'username' => env('DB_USERNAME', 'librenms'), - 'password' => env('DB_PASSWORD', ''), - 'unix_socket' => env('DB_SOCKET', ''), - 'charset' => 'utf8mb4', - 'collation' => 'utf8mb4_unicode_ci', - 'prefix' => '', - 'prefix_indexes' => true, - 'strict' => true, - 'engine' => null, - 'options' => extension_loaded('pdo_mysql') ? array_filter([ - PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), - ]) : [], - ], + 'mysql_cluster' => [ + 'read' => [ + 'host' => [ + env('DB_HOST', 'localhost'), + env('DB_HOST_R2', ''), + env('DB_HOST_R3', ''), + env('DB_HOST_R4', ''), + env('DB_HOST_R5', ''), + env('DB_HOST_R6', ''), + env('DB_HOST_R7', ''), + env('DB_HOST_R8', ''), + env('DB_HOST_R9', ''), + ], + ], + 'write' => [ + 'host' => [ + env('DB_HOST', 'localhost'), + env('DB_HOST_W2', ''), + env('DB_HOST_W3', ''), + env('DB_HOST_W4', ''), + env('DB_HOST_W5', ''), + env('DB_HOST_W6', ''), + env('DB_HOST_W7', ''), + env('DB_HOST_W8', ''), + env('DB_HOST_W9', ''), + ], + ], + 'sticky' => env('DB_STICKY', null), + 'driver' => 'mysql', + 'host' => env('DB_HOST', 'localhost'), + 'port' => env('DB_PORT', '3306'), + 'database' => env('DB_DATABASE', 'librenms'), + 'username' => env('DB_USERNAME', 'librenms'), + 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'prefix' => '', + 'prefix_indexes' => true, + 'strict' => true, + 'engine' => null, + 'options' => extension_loaded('pdo_mysql') ? array_filter([ + PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + ]) : [], + ], - 'testing' => [ - 'driver' => env('DB_TEST_DRIVER', 'mysql'), - 'host' => env('DB_TEST_HOST', 'localhost'), - 'port' => env('DB_TEST_PORT', '3306'), - 'database' => env('DB_TEST_DATABASE', 'librenms_phpunit_78hunjuybybh'), - 'username' => env('DB_TEST_USERNAME', 'root'), - 'password' => env('DB_TEST_PASSWORD', ''), - 'unix_socket' => env('DB_TEST_SOCKET', ''), - 'charset' => 'utf8mb4', - 'collation' => 'utf8mb4_unicode_ci', - 'prefix' => '', - 'strict' => true, - 'engine' => null, - ], + 'testing' => [ + 'driver' => env('DB_TEST_DRIVER', 'mysql'), + 'host' => env('DB_TEST_HOST', 'localhost'), + 'port' => env('DB_TEST_PORT', '3306'), + 'database' => env('DB_TEST_DATABASE', 'librenms_phpunit_78hunjuybybh'), + 'username' => env('DB_TEST_USERNAME', 'root'), + 'password' => env('DB_TEST_PASSWORD', ''), + 'unix_socket' => env('DB_TEST_SOCKET', ''), + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'prefix' => '', + 'strict' => true, + 'engine' => null, + ], - 'pgsql' => [ - 'driver' => 'pgsql', - 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', '5432'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', - 'prefix' => '', - 'prefix_indexes' => true, - 'schema' => 'public', - 'sslmode' => 'prefer', - ], + 'pgsql' => [ + 'driver' => 'pgsql', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '5432'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => 'utf8', + 'prefix' => '', + 'prefix_indexes' => true, + 'schema' => 'public', + 'sslmode' => 'prefer', + ], - 'sqlsrv' => [ - 'driver' => 'sqlsrv', - 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', 'localhost'), - 'port' => env('DB_PORT', '1433'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', - 'prefix' => '', - 'prefix_indexes' => true, - ], + 'sqlsrv' => [ + 'driver' => 'sqlsrv', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', 'localhost'), + 'port' => env('DB_PORT', '1433'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => 'utf8', + 'prefix' => '', + 'prefix_indexes' => true, + ], - 'testing_memory' => [ - 'driver' => 'sqlite', - 'database' => ':memory:', - 'prefix' => '', - 'foreign_key_constraints' => true, - ], + 'testing_memory' => [ + 'driver' => 'sqlite', + 'database' => ':memory:', + 'prefix' => '', + 'foreign_key_constraints' => true, + ], - 'testing_persistent' => [ - 'driver' => 'sqlite', - 'database' => storage_path('testing.sqlite'), - 'prefix' => '', - 'foreign_key_constraints' => true, - ], + 'testing_persistent' => [ + 'driver' => 'sqlite', + 'database' => storage_path('testing.sqlite'), + 'prefix' => '', + 'foreign_key_constraints' => true, + ], - ], + ], - /* - |-------------------------------------------------------------------------- - | Migration Repository Table - |-------------------------------------------------------------------------- - | - | This table keeps track of all the migrations that have already run for - | your application. Using this information, we can determine which of - | the migrations on disk haven't actually been run in the database. - | - */ + /* + |-------------------------------------------------------------------------- + | Migration Repository Table + |-------------------------------------------------------------------------- + | + | This table keeps track of all the migrations that have already run for + | your application. Using this information, we can determine which of + | the migrations on disk haven't actually been run in the database. + | + */ - 'migrations' => 'migrations', + 'migrations' => 'migrations', - /* - |-------------------------------------------------------------------------- - | Redis Databases - |-------------------------------------------------------------------------- - | - | Redis is an open source, fast, and advanced key-value store that also - | provides a richer body of commands than a typical key-value system - | such as APC or Memcached. Laravel makes it easy to dig right in. - | - */ + /* + |-------------------------------------------------------------------------- + | Redis Databases + |-------------------------------------------------------------------------- + | + | Redis is an open source, fast, and advanced key-value store that also + | provides a richer body of commands than a typical key-value system + | such as APC or Memcached. Laravel makes it easy to dig right in. + | + */ - 'redis' => [ + 'redis' => [ - 'client' => env('REDIS_CLIENT', 'predis'), + 'client' => env('REDIS_CLIENT', 'predis'), - 'options' => [ - 'cluster' => env('REDIS_CLUSTER', 'redis'), - 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'), - ], + 'options' => [ + 'cluster' => env('REDIS_CLUSTER', 'redis'), + 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'), + ], - 'default' => [ - 'scheme' => env('REDIS_SCHEME', 'tcp'), - 'url' => env('REDIS_URL'), - 'host' => env('REDIS_HOST', '127.0.0.1'), - 'password' => env('REDIS_PASSWORD', null), - 'port' => env('REDIS_PORT', '6379'), - 'database' => env('REDIS_DB', '0'), - ], + 'default' => [ + 'scheme' => env('REDIS_SCHEME', 'tcp'), + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'password' => env('REDIS_PASSWORD', null), + 'port' => env('REDIS_PORT', '6379'), + 'database' => env('REDIS_DB', '0'), + ], - 'cache' => [ - 'url' => env('REDIS_URL'), - 'host' => env('REDIS_HOST', '127.0.0.1'), - 'password' => env('REDIS_PASSWORD', null), - 'port' => env('REDIS_PORT', '6379'), - 'database' => env('REDIS_CACHE_DB', '1'), - ], + 'cache' => [ + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'password' => env('REDIS_PASSWORD', null), + 'port' => env('REDIS_PORT', '6379'), + 'database' => env('REDIS_CACHE_DB', '1'), + ], - ], + ], -]; + ]; diff --git a/config/debugbar.php b/config/debugbar.php index b86bd578b9..49a778d795 100644 --- a/config/debugbar.php +++ b/config/debugbar.php @@ -8,204 +8,204 @@ | request an environment variable to be created upstream or send a pull request. */ -return [ + return [ - /* - |-------------------------------------------------------------------------- - | Debugbar Settings - |-------------------------------------------------------------------------- - | - | Debugbar is enabled by default, when debug is set to true in app.php. - | You can override the value by setting enable to true or false instead of null. - | - | You can provide an array of URI's that must be ignored (eg. 'api/*') - | - */ + /* + |-------------------------------------------------------------------------- + | Debugbar Settings + |-------------------------------------------------------------------------- + | + | Debugbar is enabled by default, when debug is set to true in app.php. + | You can override the value by setting enable to true or false instead of null. + | + | You can provide an array of URI's that must be ignored (eg. 'api/*') + | + */ - 'enabled' => env('DEBUGBAR_ENABLED', null), - 'except' => [ - 'api*', - 'graph*', - 'push*', - ], + 'enabled' => env('DEBUGBAR_ENABLED', null), + 'except' => [ + 'api*', + 'graph*', + 'push*', + ], - /* - |-------------------------------------------------------------------------- - | Storage settings - |-------------------------------------------------------------------------- - | - | DebugBar stores data for session/ajax requests. - | You can disable this, so the debugbar stores data in headers/session, - | but this can cause problems with large data collectors. - | By default, file storage (in the storage folder) is used. Redis and PDO - | can also be used. For PDO, run the package migrations first. - | - */ - 'storage' => [ - 'enabled' => true, - 'driver' => 'file', // redis, file, pdo, custom - 'path' => storage_path('debugbar'), // For file driver - 'connection' => null, // Leave null for default connection (Redis/PDO) - 'provider' => '', // Instance of StorageInterface for custom driver - ], + /* + |-------------------------------------------------------------------------- + | Storage settings + |-------------------------------------------------------------------------- + | + | DebugBar stores data for session/ajax requests. + | You can disable this, so the debugbar stores data in headers/session, + | but this can cause problems with large data collectors. + | By default, file storage (in the storage folder) is used. Redis and PDO + | can also be used. For PDO, run the package migrations first. + | + */ + 'storage' => [ + 'enabled' => true, + 'driver' => 'file', // redis, file, pdo, custom + 'path' => storage_path('debugbar'), // For file driver + 'connection' => null, // Leave null for default connection (Redis/PDO) + 'provider' => '', // Instance of StorageInterface for custom driver + ], - /* - |-------------------------------------------------------------------------- - | Vendors - |-------------------------------------------------------------------------- - | - | Vendor files are included by default, but can be set to false. - | This can also be set to 'js' or 'css', to only include javascript or css vendor files. - | Vendor files are for css: font-awesome (including fonts) and highlight.js (css files) - | and for js: jquery and and highlight.js - | So if you want syntax highlighting, set it to true. - | jQuery is set to not conflict with existing jQuery scripts. - | - */ + /* + |-------------------------------------------------------------------------- + | Vendors + |-------------------------------------------------------------------------- + | + | Vendor files are included by default, but can be set to false. + | This can also be set to 'js' or 'css', to only include javascript or css vendor files. + | Vendor files are for css: font-awesome (including fonts) and highlight.js (css files) + | and for js: jquery and and highlight.js + | So if you want syntax highlighting, set it to true. + | jQuery is set to not conflict with existing jQuery scripts. + | + */ - 'include_vendors' => true, + 'include_vendors' => true, - /* - |-------------------------------------------------------------------------- - | Capture Ajax Requests - |-------------------------------------------------------------------------- - | - | The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors), - | you can use this option to disable sending the data through the headers. - | - | Optionally, you can also send ServerTiming headers on ajax requests for the Chrome DevTools. - */ + /* + |-------------------------------------------------------------------------- + | Capture Ajax Requests + |-------------------------------------------------------------------------- + | + | The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors), + | you can use this option to disable sending the data through the headers. + | + | Optionally, you can also send ServerTiming headers on ajax requests for the Chrome DevTools. + */ - 'capture_ajax' => true, - 'add_ajax_timing' => false, + 'capture_ajax' => true, + 'add_ajax_timing' => false, - /* - |-------------------------------------------------------------------------- - | Custom Error Handler for Deprecated warnings - |-------------------------------------------------------------------------- - | - | When enabled, the Debugbar shows deprecated warnings for Symfony components - | in the Messages tab. - | - */ - 'error_handler' => false, + /* + |-------------------------------------------------------------------------- + | Custom Error Handler for Deprecated warnings + |-------------------------------------------------------------------------- + | + | When enabled, the Debugbar shows deprecated warnings for Symfony components + | in the Messages tab. + | + */ + 'error_handler' => false, - /* - |-------------------------------------------------------------------------- - | Clockwork integration - |-------------------------------------------------------------------------- - | - | The Debugbar can emulate the Clockwork headers, so you can use the Chrome - | Extension, without the server-side code. It uses Debugbar collectors instead. - | - */ - 'clockwork' => false, + /* + |-------------------------------------------------------------------------- + | Clockwork integration + |-------------------------------------------------------------------------- + | + | The Debugbar can emulate the Clockwork headers, so you can use the Chrome + | Extension, without the server-side code. It uses Debugbar collectors instead. + | + */ + 'clockwork' => false, - /* - |-------------------------------------------------------------------------- - | DataCollectors - |-------------------------------------------------------------------------- - | - | Enable/disable DataCollectors - | - */ + /* + |-------------------------------------------------------------------------- + | DataCollectors + |-------------------------------------------------------------------------- + | + | Enable/disable DataCollectors + | + */ - 'collectors' => [ - 'phpinfo' => true, // Php version - 'messages' => true, // Messages - 'time' => true, // Time Datalogger - 'memory' => true, // Memory usage - 'exceptions' => true, // Exception displayer - 'log' => true, // Logs from Monolog (merged in messages if enabled) - 'db' => true, // Show database (PDO) queries and bindings - 'views' => true, // Views with their data - 'route' => true, // Current route information - 'auth' => true, // Display Laravel authentication status - 'gate' => true, // Display Laravel Gate checks - 'session' => true, // Display session data - 'symfony_request' => true, // Only one can be enabled.. - 'mail' => true, // Catch mail messages - 'laravel' => false, // Laravel version and environment - 'events' => false, // All events fired - 'default_request' => false, // Regular or special Symfony request logger - 'logs' => false, // Add the latest log messages - 'files' => false, // Show the included files - 'config' => false, // Display config settings - 'cache' => false, // Display cache events - ], + 'collectors' => [ + 'phpinfo' => true, // Php version + 'messages' => true, // Messages + 'time' => true, // Time Datalogger + 'memory' => true, // Memory usage + 'exceptions' => true, // Exception displayer + 'log' => true, // Logs from Monolog (merged in messages if enabled) + 'db' => true, // Show database (PDO) queries and bindings + 'views' => true, // Views with their data + 'route' => true, // Current route information + 'auth' => true, // Display Laravel authentication status + 'gate' => true, // Display Laravel Gate checks + 'session' => true, // Display session data + 'symfony_request' => true, // Only one can be enabled.. + 'mail' => true, // Catch mail messages + 'laravel' => false, // Laravel version and environment + 'events' => false, // All events fired + 'default_request' => false, // Regular or special Symfony request logger + 'logs' => false, // Add the latest log messages + 'files' => false, // Show the included files + 'config' => false, // Display config settings + 'cache' => false, // Display cache events + ], - /* - |-------------------------------------------------------------------------- - | Extra options - |-------------------------------------------------------------------------- - | - | Configure some DataCollectors - | - */ + /* + |-------------------------------------------------------------------------- + | Extra options + |-------------------------------------------------------------------------- + | + | Configure some DataCollectors + | + */ - 'options' => [ - 'auth' => [ - 'show_name' => true, // Also show the users name/email in the debugbar - ], - 'db' => [ - 'with_params' => true, // Render SQL with the parameters substituted - 'backtrace' => true, // Use a backtrace to find the origin of the query in your files. - 'timeline' => false, // Add the queries to the timeline - 'explain' => [ // Show EXPLAIN output on queries - 'enabled' => false, - 'types' => ['SELECT'], // // workaround ['SELECT'] only. https://github.com/barryvdh/laravel-debugbar/issues/888 ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+ - ], - 'hints' => true, // Show hints for common mistakes - ], - 'mail' => [ - 'full_log' => false, - ], - 'views' => [ - 'data' => false, //Note: Can slow down the application, because the data can be quite large.. - ], - 'route' => [ - 'label' => true, // show complete route on bar - ], - 'logs' => [ - 'file' => null, - ], - 'cache' => [ - 'values' => true, // collect cache values - ], - ], + 'options' => [ + 'auth' => [ + 'show_name' => true, // Also show the users name/email in the debugbar + ], + 'db' => [ + 'with_params' => true, // Render SQL with the parameters substituted + 'backtrace' => true, // Use a backtrace to find the origin of the query in your files. + 'timeline' => false, // Add the queries to the timeline + 'explain' => [ // Show EXPLAIN output on queries + 'enabled' => false, + 'types' => ['SELECT'], // // workaround ['SELECT'] only. https://github.com/barryvdh/laravel-debugbar/issues/888 ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+ + ], + 'hints' => true, // Show hints for common mistakes + ], + 'mail' => [ + 'full_log' => false, + ], + 'views' => [ + 'data' => false, //Note: Can slow down the application, because the data can be quite large.. + ], + 'route' => [ + 'label' => true, // show complete route on bar + ], + 'logs' => [ + 'file' => null, + ], + 'cache' => [ + 'values' => true, // collect cache values + ], + ], - /* - |-------------------------------------------------------------------------- - | Inject Debugbar in Response - |-------------------------------------------------------------------------- - | - | Usually, the debugbar is added just before , by listening to the - | Response after the App is done. If you disable this, you have to add them - | in your template yourself. See http://phpdebugbar.com/docs/rendering.html - | - */ + /* + |-------------------------------------------------------------------------- + | Inject Debugbar in Response + |-------------------------------------------------------------------------- + | + | Usually, the debugbar is added just before , by listening to the + | Response after the App is done. If you disable this, you have to add them + | in your template yourself. See http://phpdebugbar.com/docs/rendering.html + | + */ - 'inject' => true, + 'inject' => true, - /* - |-------------------------------------------------------------------------- - | DebugBar route prefix - |-------------------------------------------------------------------------- - | - | Sometimes you want to set route prefix to be used by DebugBar to load - | its resources from. Usually the need comes from misconfigured web server or - | from trying to overcome bugs like this: http://trac.nginx.org/nginx/ticket/97 - | - */ - 'route_prefix' => '_debugbar', + /* + |-------------------------------------------------------------------------- + | DebugBar route prefix + |-------------------------------------------------------------------------- + | + | Sometimes you want to set route prefix to be used by DebugBar to load + | its resources from. Usually the need comes from misconfigured web server or + | from trying to overcome bugs like this: http://trac.nginx.org/nginx/ticket/97 + | + */ + 'route_prefix' => '_debugbar', - /* - |-------------------------------------------------------------------------- - | DebugBar route domain - |-------------------------------------------------------------------------- - | - | By default DebugBar route served from the same domain that request served. - | To override default domain, specify it as a non-empty value. - */ - 'route_domain' => null, -]; + /* + |-------------------------------------------------------------------------- + | DebugBar route domain + |-------------------------------------------------------------------------- + | + | By default DebugBar route served from the same domain that request served. + | To override default domain, specify it as a non-empty value. + */ + 'route_domain' => null, + ]; diff --git a/config/filesystems.php b/config/filesystems.php index 31634535df..eb8a7aaa54 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -8,79 +8,79 @@ | request an environment variable to be created upstream or send a pull request. */ -return [ + return [ - /* - |-------------------------------------------------------------------------- - | Default Filesystem Disk - |-------------------------------------------------------------------------- - | - | Here you may specify the default filesystem disk that should be used - | by the framework. The "local" disk, as well as a variety of cloud - | based disks are available to your application. Just store away! - | - */ + /* + |-------------------------------------------------------------------------- + | Default Filesystem Disk + |-------------------------------------------------------------------------- + | + | Here you may specify the default filesystem disk that should be used + | by the framework. The "local" disk, as well as a variety of cloud + | based disks are available to your application. Just store away! + | + */ - 'default' => env('FILESYSTEM_DRIVER', 'local'), + 'default' => env('FILESYSTEM_DRIVER', 'local'), - /* - |-------------------------------------------------------------------------- - | Filesystem Disks - |-------------------------------------------------------------------------- - | - | Here you may configure as many filesystem "disks" as you wish, and you - | may even configure multiple disks of the same driver. Defaults have - | been setup for each driver as an example of the required options. - | - | Supported Drivers: "local", "ftp", "sftp", "s3" - | - */ + /* + |-------------------------------------------------------------------------- + | Filesystem Disks + |-------------------------------------------------------------------------- + | + | Here you may configure as many filesystem "disks" as you wish, and you + | may even configure multiple disks of the same driver. Defaults have + | been setup for each driver as an example of the required options. + | + | Supported Drivers: "local", "ftp", "sftp", "s3" + | + */ - 'disks' => [ + 'disks' => [ - 'local' => [ - 'driver' => 'local', - 'root' => storage_path('app'), - ], + 'local' => [ + 'driver' => 'local', + 'root' => storage_path('app'), + ], - 'base' => [ - 'driver' => 'local', - 'root' => base_path(), - ], + 'base' => [ + 'driver' => 'local', + 'root' => base_path(), + ], - 'public' => [ - 'driver' => 'local', - 'root' => storage_path('app/public'), - 'url' => env('APP_URL') . '/storage', - 'visibility' => 'public', - ], + 'public' => [ + 'driver' => 'local', + 'root' => storage_path('app/public'), + 'url' => env('APP_URL') . '/storage', + 'visibility' => 'public', + ], - 's3' => [ - 'driver' => 's3', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'region' => env('AWS_DEFAULT_REGION'), - 'bucket' => env('AWS_BUCKET'), - 'url' => env('AWS_URL'), - 'endpoint' => env('AWS_ENDPOINT'), - 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), - ], + 's3' => [ + 'driver' => 's3', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION'), + 'bucket' => env('AWS_BUCKET'), + 'url' => env('AWS_URL'), + 'endpoint' => env('AWS_ENDPOINT'), + 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), + ], - ], + ], - /* - |-------------------------------------------------------------------------- - | Symbolic Links - |-------------------------------------------------------------------------- - | - | Here you may configure the symbolic links that will be created when the - | `storage:link` Artisan command is executed. The array keys should be - | the locations of the links and the values should be their targets. - | - */ + /* + |-------------------------------------------------------------------------- + | Symbolic Links + |-------------------------------------------------------------------------- + | + | Here you may configure the symbolic links that will be created when the + | `storage:link` Artisan command is executed. The array keys should be + | the locations of the links and the values should be their targets. + | + */ - 'links' => [ - public_path('storage') => storage_path('app/public'), - ], + 'links' => [ + public_path('storage') => storage_path('app/public'), + ], -]; + ]; diff --git a/config/flare.php b/config/flare.php index 672d3663ba..88bc64b46f 100644 --- a/config/flare.php +++ b/config/flare.php @@ -8,63 +8,63 @@ | request an environment variable to be created upstream or send a pull request. */ -return [ - /* - | - |-------------------------------------------------------------------------- - | Flare API key - |-------------------------------------------------------------------------- - | - | Specify Flare's API key below to enable error reporting to the service. - | - | More info: https://flareapp.io/docs/general/projects - | - */ + return [ + /* + | + |-------------------------------------------------------------------------- + | Flare API key + |-------------------------------------------------------------------------- + | + | Specify Flare's API key below to enable error reporting to the service. + | + | More info: https://flareapp.io/docs/general/projects + | + */ - 'key' => env('FLARE_KEY', 'quYFBTFNKHLBqFCoeo5yDVOQNbs6muV1'), + 'key' => env('FLARE_KEY', 'quYFBTFNKHLBqFCoeo5yDVOQNbs6muV1'), - /* - |-------------------------------------------------------------------------- - | Reporting Options - |-------------------------------------------------------------------------- - | - | These options determine which information will be transmitted to Flare. - | - */ + /* + |-------------------------------------------------------------------------- + | Reporting Options + |-------------------------------------------------------------------------- + | + | These options determine which information will be transmitted to Flare. + | + */ - 'reporting' => [ - 'anonymize_ips' => true, - 'collect_git_information' => false, - 'report_queries' => true, - 'maximum_number_of_collected_queries' => 50, - 'report_query_bindings' => true, - 'report_view_data' => true, - 'grouping_type' => null, - 'report_logs' => false, - 'maximum_number_of_collected_logs' => 50, - 'censor_request_body_fields' => ['username', 'password', 'sysContact', 'community', 'authname', 'authpass', 'cryptopass'], - ], + 'reporting' => [ + 'anonymize_ips' => true, + 'collect_git_information' => false, + 'report_queries' => true, + 'maximum_number_of_collected_queries' => 50, + 'report_query_bindings' => true, + 'report_view_data' => true, + 'grouping_type' => null, + 'report_logs' => false, + 'maximum_number_of_collected_logs' => 50, + 'censor_request_body_fields' => ['username', 'password', 'sysContact', 'community', 'authname', 'authpass', 'cryptopass'], + ], - /* - |-------------------------------------------------------------------------- - | Reporting Log statements - |-------------------------------------------------------------------------- - | - | If this setting is `false` log statements won't be sent as events to Flare, - | no matter which error level you specified in the Flare log channel. - | - */ + /* + |-------------------------------------------------------------------------- + | Reporting Log statements + |-------------------------------------------------------------------------- + | + | If this setting is `false` log statements won't be sent as events to Flare, + | no matter which error level you specified in the Flare log channel. + | + */ - 'send_logs_as_events' => false, + 'send_logs_as_events' => false, - /* - |-------------------------------------------------------------------------- - | Censor request body fields - |-------------------------------------------------------------------------- - | - | These fields will be censored from your request when sent to Flare. - | - */ + /* + |-------------------------------------------------------------------------- + | Censor request body fields + |-------------------------------------------------------------------------- + | + | These fields will be censored from your request when sent to Flare. + | + */ - 'censor_request_body_fields' => ['username', 'password', 'sysContact', 'community', 'authname', 'authpass', 'cryptopass'], -]; + 'censor_request_body_fields' => ['username', 'password', 'sysContact', 'community', 'authname', 'authpass', 'cryptopass'], + ]; diff --git a/config/hashing.php b/config/hashing.php index c7922679ee..14ca2fbb30 100644 --- a/config/hashing.php +++ b/config/hashing.php @@ -8,53 +8,53 @@ | request an environment variable to be created upstream or send a pull request. */ -return [ + return [ - /* - |-------------------------------------------------------------------------- - | Default Hash Driver - |-------------------------------------------------------------------------- - | - | This option controls the default hash driver that will be used to hash - | passwords for your application. By default, the bcrypt algorithm is - | used; however, you remain free to modify this option if you wish. - | - | Supported: "bcrypt", "argon", "argon2id" - | - */ + /* + |-------------------------------------------------------------------------- + | Default Hash Driver + |-------------------------------------------------------------------------- + | + | This option controls the default hash driver that will be used to hash + | passwords for your application. By default, the bcrypt algorithm is + | used; however, you remain free to modify this option if you wish. + | + | Supported: "bcrypt", "argon", "argon2id" + | + */ - 'driver' => 'bcrypt', + 'driver' => 'bcrypt', - /* - |-------------------------------------------------------------------------- - | Bcrypt Options - |-------------------------------------------------------------------------- - | - | Here you may specify the configuration options that should be used when - | passwords are hashed using the Bcrypt algorithm. This will allow you - | to control the amount of time it takes to hash the given password. - | - */ + /* + |-------------------------------------------------------------------------- + | Bcrypt Options + |-------------------------------------------------------------------------- + | + | Here you may specify the configuration options that should be used when + | passwords are hashed using the Bcrypt algorithm. This will allow you + | to control the amount of time it takes to hash the given password. + | + */ - 'bcrypt' => [ - 'rounds' => env('BCRYPT_ROUNDS', 10), - ], + 'bcrypt' => [ + 'rounds' => env('BCRYPT_ROUNDS', 10), + ], - /* - |-------------------------------------------------------------------------- - | Argon Options - |-------------------------------------------------------------------------- - | - | Here you may specify the configuration options that should be used when - | passwords are hashed using the Argon algorithm. These will allow you - | to control the amount of time it takes to hash the given password. - | - */ + /* + |-------------------------------------------------------------------------- + | Argon Options + |-------------------------------------------------------------------------- + | + | Here you may specify the configuration options that should be used when + | passwords are hashed using the Argon algorithm. These will allow you + | to control the amount of time it takes to hash the given password. + | + */ - 'argon' => [ - 'memory' => 1024, - 'threads' => 2, - 'time' => 2, - ], + 'argon' => [ + 'memory' => 1024, + 'threads' => 2, + 'time' => 2, + ], -]; + ]; diff --git a/config/librenms.php b/config/librenms.php index bcaf953544..43c3cd3fdb 100644 --- a/config/librenms.php +++ b/config/librenms.php @@ -8,49 +8,49 @@ | request an environment variable to be created upstream or send a pull request. */ -return [ + return [ - /* - |-------------------------------------------------------------------------- - | User - |-------------------------------------------------------------------------- - | - | This value is the user LibreNMS runs as. It is used to secure permissions - | and grant access to things needed. Defaults to librenms. - */ + /* + |-------------------------------------------------------------------------- + | User + |-------------------------------------------------------------------------- + | + | This value is the user LibreNMS runs as. It is used to secure permissions + | and grant access to things needed. Defaults to librenms. + */ - 'user' => env('LIBRENMS_USER', 'librenms'), + 'user' => env('LIBRENMS_USER', 'librenms'), - /* - |-------------------------------------------------------------------------- - | Group - |-------------------------------------------------------------------------- - | - | This value is the group LibreNMS runs as. It is used to secure permissions - | and grant access to things needed. Defaults to the same as LIBRENMS_USER. - */ + /* + |-------------------------------------------------------------------------- + | Group + |-------------------------------------------------------------------------- + | + | This value is the group LibreNMS runs as. It is used to secure permissions + | and grant access to things needed. Defaults to the same as LIBRENMS_USER. + */ - 'group' => env('LIBRENMS_GROUP', env('LIBRENMS_USER', 'librenms')), + 'group' => env('LIBRENMS_GROUP', env('LIBRENMS_USER', 'librenms')), - /* - |-------------------------------------------------------------------------- - | Install - |-------------------------------------------------------------------------- - | - | This value sets if the install process needs to be run. - | You may also specify which install steps to present with a comma separated list. - */ + /* + |-------------------------------------------------------------------------- + | Install + |-------------------------------------------------------------------------- + | + | This value sets if the install process needs to be run. + | You may also specify which install steps to present with a comma separated list. + */ - 'install' => env('INSTALL', false), + 'install' => env('INSTALL', false), - /* - |-------------------------------------------------------------------------- - | NODE ID - |-------------------------------------------------------------------------- - | - | Unique value to identify this node. Primarily used for distributed polling. - */ + /* + |-------------------------------------------------------------------------- + | NODE ID + |-------------------------------------------------------------------------- + | + | Unique value to identify this node. Primarily used for distributed polling. + */ - 'node_id' => env('NODE_ID'), + 'node_id' => env('NODE_ID'), -]; + ]; diff --git a/config/logging.php b/config/logging.php index 4e94d2ee8d..7d3b46ac4a 100644 --- a/config/logging.php +++ b/config/logging.php @@ -8,144 +8,144 @@ | request an environment variable to be created upstream or send a pull request. */ -use Monolog\Handler\NullHandler; -use Monolog\Handler\StreamHandler; -use Monolog\Handler\SyslogUdpHandler; + use Monolog\Handler\NullHandler; + use Monolog\Handler\StreamHandler; + use Monolog\Handler\SyslogUdpHandler; -return [ + return [ - /* - |-------------------------------------------------------------------------- - | Default Log Channel - |-------------------------------------------------------------------------- - | - | This option defines the default log channel that gets used when writing - | messages to the logs. The name specified in this option should match - | one of the channels defined in the "channels" configuration array. - | - */ + /* + |-------------------------------------------------------------------------- + | Default Log Channel + |-------------------------------------------------------------------------- + | + | This option defines the default log channel that gets used when writing + | messages to the logs. The name specified in this option should match + | one of the channels defined in the "channels" configuration array. + | + */ - 'default' => env('LOG_CHANNEL', 'stack'), + 'default' => env('LOG_CHANNEL', 'stack'), - /* - |-------------------------------------------------------------------------- - | Log Channels - |-------------------------------------------------------------------------- - | - | Here you may configure the log channels for your application. Out of - | the box, Laravel uses the Monolog PHP logging library. This gives - | you a variety of powerful log handlers / formatters to utilize. - | - | Available Drivers: "single", "daily", "slack", "syslog", - | "errorlog", "monolog", - | "custom", "stack" - | - */ + /* + |-------------------------------------------------------------------------- + | Log Channels + |-------------------------------------------------------------------------- + | + | Here you may configure the log channels for your application. Out of + | the box, Laravel uses the Monolog PHP logging library. This gives + | you a variety of powerful log handlers / formatters to utilize. + | + | Available Drivers: "single", "daily", "slack", "syslog", + | "errorlog", "monolog", + | "custom", "stack" + | + */ - 'channels' => [ - 'stack' => [ - 'driver' => 'stack', - 'channels' => ['single', 'flare'], - 'ignore_exceptions' => false, - ], + 'channels' => [ + 'stack' => [ + 'driver' => 'stack', + 'channels' => ['single', 'flare'], + 'ignore_exceptions' => false, + ], - 'console' => [ - 'driver' => 'stack', - 'channels' => ['single', 'stdout', 'flare'], - 'ignore_exceptions' => false, - ], + 'console' => [ + 'driver' => 'stack', + 'channels' => ['single', 'stdout', 'flare'], + 'ignore_exceptions' => false, + ], - 'console_debug' => [ - 'driver' => 'stack', - 'channels' => ['single', 'stdout_debug'], - 'ignore_exceptions' => false, - ], + 'console_debug' => [ + 'driver' => 'stack', + 'channels' => ['single', 'stdout_debug'], + 'ignore_exceptions' => false, + ], - 'single' => [ - 'driver' => 'single', - 'path' => env('APP_LOG', \LibreNMS\Config::get('log_file', base_path('logs/librenms.log'))), - 'formatter' => \App\Logging\NoColorFormatter::class, - 'level' => env('LOG_LEVEL', 'error'), - ], + 'single' => [ + 'driver' => 'single', + 'path' => env('APP_LOG', \LibreNMS\Config::get('log_file', base_path('logs/librenms.log'))), + 'formatter' => \App\Logging\NoColorFormatter::class, + 'level' => env('LOG_LEVEL', 'error'), + ], - 'daily' => [ - 'driver' => 'daily', - 'path' => env('APP_LOG', \LibreNMS\Config::get('log_file', base_path('logs/librenms.log'))), - 'formatter' => \App\Logging\NoColorFormatter::class, - 'level' => env('LOG_LEVEL', 'error'), - 'days' => 14, - ], + 'daily' => [ + 'driver' => 'daily', + 'path' => env('APP_LOG', \LibreNMS\Config::get('log_file', base_path('logs/librenms.log'))), + 'formatter' => \App\Logging\NoColorFormatter::class, + 'level' => env('LOG_LEVEL', 'error'), + 'days' => 14, + ], - 'slack' => [ - 'driver' => 'slack', - 'url' => env('LOG_SLACK_WEBHOOK_URL'), - 'username' => 'Laravel Log', - 'emoji' => ':boom:', - 'level' => env('LOG_LEVEL', 'critical'), - ], + 'slack' => [ + 'driver' => 'slack', + 'url' => env('LOG_SLACK_WEBHOOK_URL'), + 'username' => 'Laravel Log', + 'emoji' => ':boom:', + 'level' => env('LOG_LEVEL', 'critical'), + ], - 'papertrail' => [ - 'driver' => 'monolog', - 'level' => env('LOG_LEVEL', 'debug'), - 'handler' => SyslogUdpHandler::class, - 'handler_with' => [ - 'host' => env('PAPERTRAIL_URL'), - 'port' => env('PAPERTRAIL_PORT'), - ], - ], + 'papertrail' => [ + 'driver' => 'monolog', + 'level' => env('LOG_LEVEL', 'debug'), + 'handler' => SyslogUdpHandler::class, + 'handler_with' => [ + 'host' => env('PAPERTRAIL_URL'), + 'port' => env('PAPERTRAIL_PORT'), + ], + ], - 'stderr' => [ - 'driver' => 'monolog', - 'handler' => StreamHandler::class, - 'formatter' => \App\Logging\CliColorFormatter::class, - 'with' => [ - 'stream' => 'php://stderr', - ], - 'level' => 'debug', - ], + 'stderr' => [ + 'driver' => 'monolog', + 'handler' => StreamHandler::class, + 'formatter' => \App\Logging\CliColorFormatter::class, + 'with' => [ + 'stream' => 'php://stderr', + ], + 'level' => 'debug', + ], - 'stdout_debug' => [ - 'driver' => 'monolog', - 'handler' => StreamHandler::class, - 'formatter' => \App\Logging\CliColorFormatter::class, - 'with' => [ - 'stream' => 'php://output', - ], - 'level' => 'debug', - ], + 'stdout_debug' => [ + 'driver' => 'monolog', + 'handler' => StreamHandler::class, + 'formatter' => \App\Logging\CliColorFormatter::class, + 'with' => [ + 'stream' => 'php://output', + ], + 'level' => 'debug', + ], - 'stdout' => [ - 'driver' => 'monolog', - 'handler' => StreamHandler::class, - 'formatter' => \App\Logging\CliColorFormatter::class, - 'with' => [ - 'stream' => 'php://output', - ], - 'level' => 'info', - ], + 'stdout' => [ + 'driver' => 'monolog', + 'handler' => StreamHandler::class, + 'formatter' => \App\Logging\CliColorFormatter::class, + 'with' => [ + 'stream' => 'php://output', + ], + 'level' => 'info', + ], - 'syslog' => [ - 'driver' => 'syslog', - 'level' => env('LOG_LEVEL', 'debug'), - ], + 'syslog' => [ + 'driver' => 'syslog', + 'level' => env('LOG_LEVEL', 'debug'), + ], - 'errorlog' => [ - 'driver' => 'errorlog', - 'level' => env('LOG_LEVEL', 'debug'), - ], + 'errorlog' => [ + 'driver' => 'errorlog', + 'level' => env('LOG_LEVEL', 'debug'), + ], - 'null' => [ - 'driver' => 'monolog', - 'handler' => NullHandler::class, - ], + 'null' => [ + 'driver' => 'monolog', + 'handler' => NullHandler::class, + ], - 'emergency' => [ - 'path' => storage_path('logs/laravel.log'), - ], + 'emergency' => [ + 'path' => storage_path('logs/laravel.log'), + ], - 'flare' => [ - 'driver' => 'flare', - ], - ], + 'flare' => [ + 'driver' => 'flare', + ], + ], -]; + ]; diff --git a/config/queue.php b/config/queue.php index b1b5bbb65e..2c93339529 100644 --- a/config/queue.php +++ b/config/queue.php @@ -8,94 +8,94 @@ | request an environment variable to be created upstream or send a pull request. */ -return [ + return [ - /* - |-------------------------------------------------------------------------- - | Default Queue Connection Name - |-------------------------------------------------------------------------- - | - | Laravel's queue API supports an assortment of back-ends via a single - | API, giving you convenient access to each back-end using the same - | syntax for every one. Here you may define a default connection. - | - */ + /* + |-------------------------------------------------------------------------- + | Default Queue Connection Name + |-------------------------------------------------------------------------- + | + | Laravel's queue API supports an assortment of back-ends via a single + | API, giving you convenient access to each back-end using the same + | syntax for every one. Here you may define a default connection. + | + */ - 'default' => env('QUEUE_CONNECTION', 'sync'), + 'default' => env('QUEUE_CONNECTION', 'sync'), - /* - |-------------------------------------------------------------------------- - | Queue Connections - |-------------------------------------------------------------------------- - | - | Here you may configure the connection information for each server that - | is used by your application. A default configuration has been added - | for each back-end shipped with Laravel. You are free to add more. - | - | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" - | - */ + /* + |-------------------------------------------------------------------------- + | Queue Connections + |-------------------------------------------------------------------------- + | + | Here you may configure the connection information for each server that + | is used by your application. A default configuration has been added + | for each back-end shipped with Laravel. You are free to add more. + | + | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" + | + */ - 'connections' => [ + 'connections' => [ - 'sync' => [ - 'driver' => 'sync', - ], + 'sync' => [ + 'driver' => 'sync', + ], - 'database' => [ - 'driver' => 'database', - 'table' => 'jobs', - 'queue' => 'default', - 'retry_after' => 90, - 'after_commit' => false, - ], + 'database' => [ + 'driver' => 'database', + 'table' => 'jobs', + 'queue' => 'default', + 'retry_after' => 90, + 'after_commit' => false, + ], - 'beanstalkd' => [ - 'driver' => 'beanstalkd', - 'host' => 'localhost', - 'queue' => 'default', - 'retry_after' => 90, - 'block_for' => 0, - 'after_commit' => false, - ], + 'beanstalkd' => [ + 'driver' => 'beanstalkd', + 'host' => 'localhost', + 'queue' => 'default', + 'retry_after' => 90, + 'block_for' => 0, + 'after_commit' => false, + ], - 'sqs' => [ - 'driver' => 'sqs', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), - 'queue' => env('SQS_QUEUE', 'default'), - 'suffix' => env('SQS_SUFFIX'), - 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), - 'after_commit' => false, - ], + 'sqs' => [ + 'driver' => 'sqs', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), + 'queue' => env('SQS_QUEUE', 'default'), + 'suffix' => env('SQS_SUFFIX'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), + 'after_commit' => false, + ], - 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - 'queue' => env('REDIS_QUEUE', 'default'), - 'retry_after' => 90, - 'block_for' => null, - 'after_commit' => false, - ], + 'redis' => [ + 'driver' => 'redis', + 'connection' => 'default', + 'queue' => env('REDIS_QUEUE', 'default'), + 'retry_after' => 90, + 'block_for' => null, + 'after_commit' => false, + ], - ], + ], - /* - |-------------------------------------------------------------------------- - | Failed Queue Jobs - |-------------------------------------------------------------------------- - | - | These options configure the behavior of failed queue job logging so you - | can control which database and table are used to store the jobs that - | have failed. You may change them to any database / table you wish. - | - */ + /* + |-------------------------------------------------------------------------- + | Failed Queue Jobs + |-------------------------------------------------------------------------- + | + | These options configure the behavior of failed queue job logging so you + | can control which database and table are used to store the jobs that + | have failed. You may change them to any database / table you wish. + | + */ - 'failed' => [ - 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), - 'database' => env('DB_CONNECTION', 'mysql'), - 'table' => 'failed_jobs', - ], + 'failed' => [ + 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), + 'database' => env('DB_CONNECTION', 'mysql'), + 'table' => 'failed_jobs', + ], -]; + ]; diff --git a/config/services.php b/config/services.php index b1159caacb..d8c8d6364c 100644 --- a/config/services.php +++ b/config/services.php @@ -8,34 +8,34 @@ | request an environment variable to be created upstream or send a pull request. */ -return [ + return [ - /* - |-------------------------------------------------------------------------- - | Third Party Services - |-------------------------------------------------------------------------- - | - | This file is for storing the credentials for third party services such - | as Mailgun, Postmark, AWS and more. This file provides the de facto - | location for this type of information, allowing packages to have - | a conventional file to locate the various service credentials. - | - */ + /* + |-------------------------------------------------------------------------- + | Third Party Services + |-------------------------------------------------------------------------- + | + | This file is for storing the credentials for third party services such + | as Mailgun, Postmark, AWS and more. This file provides the de facto + | location for this type of information, allowing packages to have + | a conventional file to locate the various service credentials. + | + */ - 'mailgun' => [ - 'domain' => env('MAILGUN_DOMAIN'), - 'secret' => env('MAILGUN_SECRET'), - 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), - ], + 'mailgun' => [ + 'domain' => env('MAILGUN_DOMAIN'), + 'secret' => env('MAILGUN_SECRET'), + 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), + ], - 'postmark' => [ - 'token' => env('POSTMARK_TOKEN'), - ], + 'postmark' => [ + 'token' => env('POSTMARK_TOKEN'), + ], - 'ses' => [ - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), - ], + 'ses' => [ + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), + ], -]; + ]; diff --git a/config/tinker.php b/config/tinker.php index dac814141d..d40617481c 100644 --- a/config/tinker.php +++ b/config/tinker.php @@ -8,19 +8,19 @@ | request an environment variable to be created upstream or send a pull request. */ -return [ + return [ - /* - |-------------------------------------------------------------------------- - | Alias Blacklist - |-------------------------------------------------------------------------- - | - | Typically, Tinker automatically aliases classes as you require them in - | Tinker. However, you may wish to never alias certain classes, which - | you may accomplish by listing the classes in the following array. - | - */ + /* + |-------------------------------------------------------------------------- + | Alias Blacklist + |-------------------------------------------------------------------------- + | + | Typically, Tinker automatically aliases classes as you require them in + | Tinker. However, you may wish to never alias certain classes, which + | you may accomplish by listing the classes in the following array. + | + */ - 'dont_alias' => [], + 'dont_alias' => [], -]; + ]; diff --git a/config/toastr.php b/config/toastr.php index 7e17b0e05c..a6810ae296 100644 --- a/config/toastr.php +++ b/config/toastr.php @@ -8,6 +8,6 @@ | request an environment variable to be created upstream or send a pull request. */ -return [ - 'options' => [], -]; + return [ + 'options' => [], + ]; diff --git a/daily.php b/daily.php index 9184e948ca..fdae94e82d 100644 --- a/daily.php +++ b/daily.php @@ -164,8 +164,8 @@ if ($options['f'] === 'handle_notifiable') { Notifications::create($title, "The daily update script (daily.sh) has failed on $poller_name." . 'Please check output by hand. If you need assistance, ' . 'visit the LibreNMS Website to find out how.', - 'daily.sh', - 2 + 'daily.sh', + 2 ); } } elseif ($options['t'] === 'phpver') { diff --git a/html/network-map.php b/html/network-map.php index 3732156d39..64c3e1b65e 100644 --- a/html/network-map.php +++ b/html/network-map.php @@ -168,7 +168,7 @@ if (isset($_GET['format']) && preg_match('/^[a-z]*$/', $_GET['format'])) { if ($_GET['debug'] == 1) { echo '
$map
'; - exit(); + exit; } switch ($_GET['format']) { @@ -179,7 +179,7 @@ if (isset($_GET['format']) && preg_match('/^[a-z]*$/', $_GET['format'])) { break; case 'dot': echo $map; - exit(); + exit; default: $_GET['format'] = 'png:gd'; } diff --git a/includes/billing.php b/includes/billing.php index c29dc5621f..6f62434d26 100644 --- a/includes/billing.php +++ b/includes/billing.php @@ -123,7 +123,7 @@ function get95thagg($bill_id, $datefrom, $dateto) $mq_sql = 'SELECT count(delta) FROM bill_data WHERE bill_id = ?'; $mq_sql .= ' AND timestamp > ? AND timestamp <= ?'; $measurements = dbFetchCell($mq_sql, [$bill_id, $datefrom, $dateto]); - $measurement_95th = (round(($measurements / 100 * 95)) - 1); + $measurement_95th = (round($measurements / 100 * 95) - 1); $q_95_sql = 'SELECT (delta / period * 8) AS rate FROM bill_data WHERE bill_id = ?'; $q_95_sql .= ' AND timestamp > ? AND timestamp <= ? ORDER BY rate ASC'; @@ -138,7 +138,7 @@ function get95thIn($bill_id, $datefrom, $dateto) $mq_sql = 'SELECT count(delta) FROM bill_data WHERE bill_id = ?'; $mq_sql .= ' AND timestamp > ? AND timestamp <= ?'; $measurements = dbFetchCell($mq_sql, [$bill_id, $datefrom, $dateto]); - $measurement_95th = (round(($measurements / 100 * 95)) - 1); + $measurement_95th = (round($measurements / 100 * 95) - 1); $q_95_sql = 'SELECT (in_delta / period * 8) AS rate FROM bill_data WHERE bill_id = ?'; $q_95_sql .= ' AND timestamp > ? AND timestamp <= ? ORDER BY rate ASC'; @@ -153,7 +153,7 @@ function get95thout($bill_id, $datefrom, $dateto) $mq_sql = 'SELECT count(delta) FROM bill_data WHERE bill_id = ?'; $mq_sql .= ' AND timestamp > ? AND timestamp <= ?'; $measurements = dbFetchCell($mq_sql, [$bill_id, $datefrom, $dateto]); - $measurement_95th = (round(($measurements / 100 * 95)) - 1); + $measurement_95th = (round($measurements / 100 * 95) - 1); $q_95_sql = 'SELECT (out_delta / period * 8) AS rate FROM bill_data WHERE bill_id = ?'; $q_95_sql .= ' AND timestamp > ? AND timestamp <= ? ORDER BY rate ASC'; @@ -293,8 +293,8 @@ function getBillingBitsGraphData($bill_id, $from, $to, $reducefactor) $tot_period += $period; if (++$iter >= $reducefactor) { - $out_data[$i] = round(($iter_out / $iter_period), 2); - $in_data[$i] = round(($iter_in / $iter_period), 2); + $out_data[$i] = round($iter_out / $iter_period, 2); + $in_data[$i] = round($iter_in / $iter_period, 2); $tot_data[$i] = ($out_data[$i] + $in_data[$i]); $ticks[$i] = $timestamp; $i++; @@ -305,8 +305,8 @@ function getBillingBitsGraphData($bill_id, $from, $to, $reducefactor) }//end foreach if (! empty($iter_in)) { // Write last element - $out_data[$i] = round(($iter_out / $iter_period), 2); - $in_data[$i] = round(($iter_in / $iter_period), 2); + $out_data[$i] = round($iter_out / $iter_period, 2); + $in_data[$i] = round($iter_in / $iter_period, 2); $tot_data[$i] = ($out_data[$i] + $in_data[$i]); $ticks[$i] = $timestamp; $i++; diff --git a/includes/discovery/bgp-peers/vrp.inc.php b/includes/discovery/bgp-peers/vrp.inc.php index 065c50f3e9..720410d4d7 100644 --- a/includes/discovery/bgp-peers/vrp.inc.php +++ b/includes/discovery/bgp-peers/vrp.inc.php @@ -122,7 +122,7 @@ if (Config::get('enable_bgp')) { 'bgpPeerDescr' => $value['bgpPeerDescr'] ?? '', ]; $affected = DeviceCache::getPrimary()->bgppeers()->where('bgpPeerIdentifier', $address)->where('vrf_id', $vrfId)->update($peers); - $seenPeerID[] = (DeviceCache::getPrimary()->bgppeers()->where('bgpPeerIdentifier', $address)->where('vrf_id', $vrfId)->select('bgpPeer_id')->orderBy('bgpPeer_id', 'ASC')->first()->bgpPeer_id); + $seenPeerID[] = DeviceCache::getPrimary()->bgppeers()->where('bgpPeerIdentifier', $address)->where('vrf_id', $vrfId)->select('bgpPeer_id')->orderBy('bgpPeer_id', 'ASC')->first()->bgpPeer_id; echo str_repeat('.', $affected); $vrp_bgp_peer_count += $affected; diff --git a/includes/discovery/discovery-protocols.inc.php b/includes/discovery/discovery-protocols.inc.php index c0652c23ab..be1f93ea83 100644 --- a/includes/discovery/discovery-protocols.inc.php +++ b/includes/discovery/discovery-protocols.inc.php @@ -128,7 +128,7 @@ if (($device['os'] == 'routeros') && ($device['version'] <= '7.6')) { }//end foreach } echo PHP_EOL; -} elseif (($device['os'] == 'pbn' || $device['os'] == 'bdcom')) { +} elseif ($device['os'] == 'pbn' || $device['os'] == 'bdcom') { echo ' NMS-LLDP-MIB: '; $lldp_array = snmpwalk_group($device, 'lldpRemoteSystemsData', 'NMS-LLDP-MIB'); @@ -161,7 +161,7 @@ if (($device['os'] == 'routeros') && ($device['version'] <= '7.6')) { } }//end foreach echo PHP_EOL; -} elseif (($device['os'] == 'timos')) { +} elseif ($device['os'] == 'timos') { echo ' TIMETRA-LLDP-MIB: '; $lldp_array = snmpwalk_group($device, 'tmnxLldpRemoteSystemsData', 'TIMETRA-LLDP-MIB'); foreach ($lldp_array as $key => $lldp) { @@ -195,7 +195,7 @@ if (($device['os'] == 'routeros') && ($device['version'] <= '7.6')) { } }//end foreach echo PHP_EOL; -} elseif (($device['os'] == 'jetstream')) { +} elseif ($device['os'] == 'jetstream') { echo ' JETSTREAM-LLDP MIB: '; $lldp_array = snmpwalk_group($device, 'lldpNeighborInfoEntry', 'TPLINK-LLDPINFO-MIB'); @@ -259,7 +259,7 @@ if (($device['os'] == 'routeros') && ($device['version'] <= '7.6')) { } } } - if (($device['os'] == 'aos7')) { + if ($device['os'] == 'aos7') { $lldp_local = snmpwalk_cache_oid($device, 'lldpLocPortEntry', [], 'LLDP-MIB'); $lldp_ports = snmpwalk_group($device, 'lldpLocPortId', 'LLDP-MIB'); } else { @@ -270,14 +270,14 @@ if (($device['os'] == 'routeros') && ($device['version'] <= '7.6')) { foreach ($lldp_array as $key => $lldp_if_array) { foreach ($lldp_if_array as $entry_key => $lldp_instance) { - if (($device['os'] == 'aos7')) { + if ($device['os'] == 'aos7') { $ifName = $lldp_local[$entry_key]['lldpLocPortDesc']; } elseif (is_numeric($dot1d_array[$entry_key]['dot1dBasePortIfIndex'])) { $ifIndex = $dot1d_array[$entry_key]['dot1dBasePortIfIndex']; } else { $ifIndex = $entry_key; } - if (($device['os'] == 'aos7')) { + if ($device['os'] == 'aos7') { $local_port_id = find_port_id($ifName, null, $device['device_id']); } else { $local_port_id = find_port_id($lldp_ports[$entry_key]['lldpLocPortId'], $ifIndex, $device['device_id']); diff --git a/includes/discovery/entity-physical/axos.inc.php b/includes/discovery/entity-physical/axos.inc.php index 1572ecf3e9..c5c2160b2b 100644 --- a/includes/discovery/entity-physical/axos.inc.php +++ b/includes/discovery/entity-physical/axos.inc.php @@ -51,11 +51,11 @@ foreach ($entity_array as $entPhysicalIndex => $entry) { echo "\n"; unset( -$physical_name, -$serial_number, -$card_array, -$card, -$entry, -$entity_array, -$id + $physical_name, + $serial_number, + $card_array, + $card, + $entry, + $entity_array, + $id ); diff --git a/includes/discovery/entity-physical/cimc.inc.php b/includes/discovery/entity-physical/cimc.inc.php index c4c8474348..f38b558105 100644 --- a/includes/discovery/entity-physical/cimc.inc.php +++ b/includes/discovery/entity-physical/cimc.inc.php @@ -125,7 +125,7 @@ if (is_null($tblUCSObjects)) { } break; - // System Board - rack-unit-1/board + // System Board - rack-unit-1/board case '1.3.6.1.4.1.9.9.719.1.9.6.1': foreach ($array[3] as $key => $item) { $result = []; @@ -161,7 +161,7 @@ if (is_null($tblUCSObjects)) { } break; - // Memory Modules - rack-unit-1/board/memarray-1/mem-0 + // Memory Modules - rack-unit-1/board/memarray-1/mem-0 case '1.3.6.1.4.1.9.9.719.1.30.11.1': foreach ($array[3] as $key => $item) { $result = []; @@ -203,7 +203,7 @@ if (is_null($tblUCSObjects)) { } break; - // CPU's - rack-unit-1/board/cpu-1 + // CPU's - rack-unit-1/board/cpu-1 case '1.3.6.1.4.1.9.9.719.1.41.9.1': foreach ($array[3] as $key => $item) { $result = []; @@ -245,7 +245,7 @@ if (is_null($tblUCSObjects)) { } break; - // SAS Storage Module - rack-unit-1/board/storage-SAS-2 + // SAS Storage Module - rack-unit-1/board/storage-SAS-2 case '1.3.6.1.4.1.9.9.719.1.45.1.1': foreach ($array[3] as $key => $item) { $result = []; @@ -282,7 +282,7 @@ if (is_null($tblUCSObjects)) { } break; - // SAS Disks - rack-unit-1/board/storage-SAS-2/disk-1 + // SAS Disks - rack-unit-1/board/storage-SAS-2/disk-1 case '1.3.6.1.4.1.9.9.719.1.45.4.1': foreach ($array[3] as $key => $item) { $result = []; @@ -294,7 +294,7 @@ if (is_null($tblUCSObjects)) { // Old Firmware returns 4294967296 as 1 MB. // The if below assumes we will never have < 1 Gb on old firmware or > 4 Pb on new firmware - if (($array[13][$key]) > 4294967296000) { + if ($array[13][$key] > 4294967296000) { // Old Firmware $result['string'] = $array[14][$key] . ' ' . $array[7][$key] . ', Rev: ' . $array[11][$key] . ', Size: ' . round($array[13][$key] / 4294967296000, 2) . ' GB'; d_echo('Disk: ' . $array[2][$key] . ', Raw Size: ' . $array[13][$key] . ', converted (old FW): ' . round($array[13][$key] / 4294967296000, 2) . "GB\n"); @@ -330,7 +330,7 @@ if (is_null($tblUCSObjects)) { } break; - // LUN's - rack-unit-1/board/storage-SAS-2/lun-0 + // LUN's - rack-unit-1/board/storage-SAS-2/lun-0 case '1.3.6.1.4.1.9.9.719.1.45.8.1': foreach ($array[3] as $key => $item) { $result = []; @@ -342,7 +342,7 @@ if (is_null($tblUCSObjects)) { // Old Firmware returns 4294967296 as 1 MB. // The if below assumes we will never have < 1 Gb on old firmware or > 4 Pb on new firmware - if (($array[13][$key]) > 4294967296000) { + if ($array[13][$key] > 4294967296000) { // Old Firmware $result['string'] = $array[3][$key] . ', Size: ' . round($array[13][$key] / 4294967296000, 2) . ' GB'; d_echo('LUN: ' . $array[2][$key] . ', Raw Size: ' . $array[13][$key] . ', converted (Old FW): ' . round($array[13][$key] / 4294967296000, 2) . "GB\n"); @@ -378,7 +378,7 @@ if (is_null($tblUCSObjects)) { } break; - // RAID Battery - rack-unit-1/board/storage-SAS-2/raid-battery + // RAID Battery - rack-unit-1/board/storage-SAS-2/raid-battery case '1.3.6.1.4.1.9.9.719.1.45.11.1': foreach ($array[3] as $key => $item) { $result = []; @@ -415,7 +415,7 @@ if (is_null($tblUCSObjects)) { } break; - // Fan's - rack-unit-1/fan-module-1-1/fan-1 + // Fan's - rack-unit-1/fan-module-1-1/fan-1 case '1.3.6.1.4.1.9.9.719.1.15.12.1': foreach ($array[3] as $key => $item) { $result = []; @@ -452,7 +452,7 @@ if (is_null($tblUCSObjects)) { } break; - // PSU's - rack-unit-1/psu-1 + // PSU's - rack-unit-1/psu-1 case '1.3.6.1.4.1.9.9.719.1.15.56.1': foreach ($array[3] as $key => $item) { $result = []; @@ -489,7 +489,7 @@ if (is_null($tblUCSObjects)) { } break; - // Adaptors - rack-unit-1/adaptor-1 + // Adaptors - rack-unit-1/adaptor-1 case '1.3.6.1.4.1.9.9.719.1.3.85.1': foreach ($array[3] as $key => $item) { $result = []; @@ -526,7 +526,7 @@ if (is_null($tblUCSObjects)) { } break; - // Unknown Table, ask the user to log an issue so this can be identified. + // Unknown Table, ask the user to log an issue so this can be identified. default: d_echo("Cisco-CIMC Error...\n"); d_echo("Please log an issue on github with the following information:\n"); diff --git a/includes/discovery/entity-physical/entity-physical.inc.php b/includes/discovery/entity-physical/entity-physical.inc.php index ef21f5de02..94298b0da0 100644 --- a/includes/discovery/entity-physical/entity-physical.inc.php +++ b/includes/discovery/entity-physical/entity-physical.inc.php @@ -15,26 +15,26 @@ if ($device['os'] == 'junos') { $ai_mib = 'AI-AP-MIB'; $ai_ig_data = snmpwalk_group($device, 'aiInfoGroup', $ai_mib); discover_entity_physical( - $valid, - $device, - 1, // entPhysicalIndex - $ai_ig_data['aiVirtualControllerIPAddress.0'], // entPhysicalDescr - 'chassis', // entPhysicalClass - $ai_ig_data['aiVirtualControllerName.0'], // entPhysicalName - 'Instant Virtual Controller Cluster', // entPhysicalModelName - $ai_ig_data['aiVirtualControllerKey.0'], // entPhysicalSerialNum - '0', // entPhysicalContainedIn - 'Aruba', // entPhysicalMfgName - '-1', // entPhysicalParentRelPos - 'Aruba', // entPhysicalVendorType - null, // entPhysicalHardwareRev - null, // entPhysicalFirmwareRev - null, // entPhysicalSoftwareRev - null, // entPhysicalIsFRU - null, // entPhysicalAlias - null, // entPhysicalAssetID - null // ifIndex - ); + $valid, + $device, + 1, // entPhysicalIndex + $ai_ig_data['aiVirtualControllerIPAddress.0'], // entPhysicalDescr + 'chassis', // entPhysicalClass + $ai_ig_data['aiVirtualControllerName.0'], // entPhysicalName + 'Instant Virtual Controller Cluster', // entPhysicalModelName + $ai_ig_data['aiVirtualControllerKey.0'], // entPhysicalSerialNum + '0', // entPhysicalContainedIn + 'Aruba', // entPhysicalMfgName + '-1', // entPhysicalParentRelPos + 'Aruba', // entPhysicalVendorType + null, // entPhysicalHardwareRev + null, // entPhysicalFirmwareRev + null, // entPhysicalSoftwareRev + null, // entPhysicalIsFRU + null, // entPhysicalAlias + null, // entPhysicalAssetID + null // ifIndex + ); $entity_array = snmpwalk_group($device, 'aiAccessPointEntry', $ai_mib); $instant_index = 2; diff --git a/includes/discovery/entity-physical/eurostor.inc.php b/includes/discovery/entity-physical/eurostor.inc.php index 76ac95a83e..d6e89f8cb6 100644 --- a/includes/discovery/entity-physical/eurostor.inc.php +++ b/includes/discovery/entity-physical/eurostor.inc.php @@ -78,8 +78,8 @@ foreach ($entity_array as $entPhysicalIndex => $entry) { echo "\n"; unset( -$update_data, -$insert_data, -$entry, -$entity_array + $update_data, + $insert_data, + $entry, + $entity_array ); diff --git a/includes/discovery/entity-physical/linux.inc.php b/includes/discovery/entity-physical/linux.inc.php index a09e840f36..9205222d7e 100644 --- a/includes/discovery/entity-physical/linux.inc.php +++ b/includes/discovery/entity-physical/linux.inc.php @@ -85,24 +85,24 @@ foreach ($entity_array as $entPhysicalIndex => $entry) { $ifIndex = array_key_exists('ifIndex', $entry) ? $entry['ifIndex'] : ''; discover_entity_physical($valid, - $device, - $entPhysicalIndex, - $entPhysicalDescr, - $entPhysicalClass, - $entPhysicalName, - $entPhysicalModelName, - $entPhysicalSerialNum, - $entPhysicalContainedIn, - $entPhysicalMfgName, - $entPhysicalParentRelPos, - $entPhysicalVendorType, - $entPhysicalHardwareRev, - $entPhysicalFirmwareRev, - $entPhysicalSoftwareRev, - $entPhysicalIsFRU, - $entPhysicalAlias, - $entPhysicalAssetID, - $ifIndex); + $device, + $entPhysicalIndex, + $entPhysicalDescr, + $entPhysicalClass, + $entPhysicalName, + $entPhysicalModelName, + $entPhysicalSerialNum, + $entPhysicalContainedIn, + $entPhysicalMfgName, + $entPhysicalParentRelPos, + $entPhysicalVendorType, + $entPhysicalHardwareRev, + $entPhysicalFirmwareRev, + $entPhysicalSoftwareRev, + $entPhysicalIsFRU, + $entPhysicalAlias, + $entPhysicalAssetID, + $ifIndex); }//end foreach echo "\n"; diff --git a/includes/discovery/libvirt-vminfo.inc.php b/includes/discovery/libvirt-vminfo.inc.php index 8f0809c3bc..32977494a5 100644 --- a/includes/discovery/libvirt-vminfo.inc.php +++ b/includes/discovery/libvirt-vminfo.inc.php @@ -38,7 +38,7 @@ if (Config::get('enable_libvirt') && $device['os'] == 'linux') { exec(Config::get('virsh') . ' -rc ' . $uri . ' list', $domlist); foreach ($domlist as $dom) { - [$dom_id,] = explode(' ', trim($dom), 2); + [$dom_id] = explode(' ', trim($dom), 2); if (is_numeric($dom_id)) { // Fetch the Virtual Machine information. diff --git a/includes/discovery/loadbalancers/f5-gtm.inc.php b/includes/discovery/loadbalancers/f5-gtm.inc.php index 2733c4fdcd..9b14e43639 100644 --- a/includes/discovery/loadbalancers/f5-gtm.inc.php +++ b/includes/discovery/loadbalancers/f5-gtm.inc.php @@ -45,7 +45,7 @@ $components = $keep; // Begin our master array, all other values will be processed into this array. $tblBigIP = []; -if ((snmp_get($device, 'sysModuleAllocationProvisionLevel.3.103.116.109', '-Ovqs', 'F5-BIGIP-SYSTEM-MIB')) != false) { +if (snmp_get($device, 'sysModuleAllocationProvisionLevel.3.103.116.109', '-Ovqs', 'F5-BIGIP-SYSTEM-MIB') != false) { $gtmWideIPEntry = snmpwalk_array_num($device, '1.3.6.1.4.1.3375.2.3.12.1.2.1', 0); if (! is_null($gtmWideIPEntry)) { $gtmWideStatusEntry = snmpwalk_array_num($device, '1.3.6.1.4.1.3375.2.3.12.3.2.1', 0); diff --git a/includes/discovery/route.inc.php b/includes/discovery/route.inc.php index 25784c391e..80f23796b5 100644 --- a/includes/discovery/route.inc.php +++ b/includes/discovery/route.inc.php @@ -30,7 +30,7 @@ $ipForwardNb = snmp_get_multi($device, ['inetCidrRouteNumber.0', 'ipCidrRouteNum //Get the configured max routes number $max_routes = 1000; -if (null != (Config::get('routes_max_number'))) { +if (null != Config::get('routes_max_number')) { $max_routes = Config::get('routes_max_number'); } diff --git a/includes/discovery/sensors/ber/junos.inc.php b/includes/discovery/sensors/ber/junos.inc.php index 63adee8b0c..5edd2ac53c 100644 --- a/includes/discovery/sensors/ber/junos.inc.php +++ b/includes/discovery/sensors/ber/junos.inc.php @@ -27,7 +27,7 @@ foreach ($pre_cache['junos_ifotn_oids'] as $index => $entry) { $limit = null; $warn_limit = null; $tmp_exp = $pre_cache['junos_ifotn_oids'][$index . '.1']['jnxoptIfOTNPMCurrentFECBERExponent']; - $current = ($entry['jnxoptIfOTNPMCurrentFECBERMantissa']) * pow(10, (-$tmp_exp)); + $current = $entry['jnxoptIfOTNPMCurrentFECBERMantissa'] * pow(10, -$tmp_exp); $entPhysicalIndex = $index; $entPhysicalIndex_measured = 'ports'; discover_sensor($valid['sensor'], 'ber', $device, $oid, $index, 'junos', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured); diff --git a/includes/discovery/sensors/charge/rfc1628.inc.php b/includes/discovery/sensors/charge/rfc1628.inc.php index 29b11842fb..8deff75166 100644 --- a/includes/discovery/sensors/charge/rfc1628.inc.php +++ b/includes/discovery/sensors/charge/rfc1628.inc.php @@ -7,19 +7,19 @@ $value = snmp_get($device, 'upsEstimatedChargeRemaining.0', '-OvqU', 'UPS-MIB'); if (is_numeric($value)) { discover_sensor( - $valid['sensor'], - 'charge', - $device, - '.1.3.6.1.2.1.33.1.2.4.0', - 500, - 'rfc1628', - 'Battery charge remaining', - 1, - 1, - 15, - 50, - null, - 101, - $value - ); + $valid['sensor'], + 'charge', + $device, + '.1.3.6.1.2.1.33.1.2.4.0', + 500, + 'rfc1628', + 'Battery charge remaining', + 1, + 1, + 15, + 50, + null, + 101, + $value + ); } diff --git a/includes/discovery/sensors/current/adva_fsp3kr7.inc.php b/includes/discovery/sensors/current/adva_fsp3kr7.inc.php index 5094dc7fa4..45524f7192 100644 --- a/includes/discovery/sensors/current/adva_fsp3kr7.inc.php +++ b/includes/discovery/sensors/current/adva_fsp3kr7.inc.php @@ -20,8 +20,8 @@ // ***** Sensors for ADVA FSP3000 R7 // ************************************************************* - $multiplier = 1; - $divisor = 1000; +$multiplier = 1; +$divisor = 1000; if (is_array($pre_cache['adva_fsp3kr7_Card'])) { foreach (array_keys($pre_cache['adva_fsp3kr7_Card']) as $index) { diff --git a/includes/discovery/sensors/current/apc.inc.php b/includes/discovery/sensors/current/apc.inc.php index bedf1ef88b..35965aabf0 100644 --- a/includes/discovery/sensors/current/apc.inc.php +++ b/includes/discovery/sensors/current/apc.inc.php @@ -15,7 +15,7 @@ if (isset($oids) && $oids) { if ($data) { [$oid,$kind] = explode(' ', $data); $split_oid = explode('.', $oid); - $index = $split_oid[(count($split_oid) - 1)]; + $index = $split_oid[count($split_oid) - 1]; $current_oid = '.1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.' . $index; // rPDULoadStatusLoad $phase_oid = '.1.3.6.1.4.1.318.1.1.12.2.3.1.1.4.' . $index; @@ -62,7 +62,7 @@ if (isset($oids) && $oids) { continue; } $split_oid = explode('.', $oid); - $index = $split_oid[(count($split_oid) - 1)]; + $index = $split_oid[count($split_oid) - 1]; $current_oid = '.1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.' . $index; // rPDULoadStatusLoad $phase_oid = '.1.3.6.1.4.1.318.1.1.12.2.3.1.1.4.' . $index; @@ -112,7 +112,7 @@ if (isset($oids) && $oids) { continue; } $split_oid = explode('.', $oid); - $index = $split_oid[(count($split_oid) - 1)]; + $index = $split_oid[count($split_oid) - 1]; $descr = 'Bank ' . $banknum; $current_oid = '.1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.' . $index; // rPDULoadStatusLoad @@ -150,7 +150,7 @@ if (isset($oids) && $oids) { if ($data) { [$oid,$kind] = explode(' ', $data); $split_oid = explode('.', $oid); - $index = $split_oid[(count($split_oid) - 1)]; + $index = $split_oid[count($split_oid) - 1]; $voltage_oid = '.1.3.6.1.4.1.318.1.1.26.6.3.1.6'; // rPDU2PhaseStatusVoltage $current_oid = '.1.3.6.1.4.1.318.1.1.26.9.4.3.1.6.' . $index; @@ -238,8 +238,8 @@ if (isset($in_oids)) { } } } - unset($index); - unset($data); +unset($index); +unset($data); foreach ($oids as $index => $data) { $type = 'apcUPS'; $descr = 'Phase ' . substr($index, -1) . ' Output'; @@ -256,5 +256,5 @@ foreach ($oids as $index => $data) { discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, $divisor, 1, null, null, null, null, $current); } } - unset($index); - unset($data); +unset($index); +unset($data); diff --git a/includes/discovery/sensors/current/raritan-pdu.inc.php b/includes/discovery/sensors/current/raritan-pdu.inc.php index 828f9838b8..2009860d7d 100644 --- a/includes/discovery/sensors/current/raritan-pdu.inc.php +++ b/includes/discovery/sensors/current/raritan-pdu.inc.php @@ -13,7 +13,7 @@ if ($inlet_oids) { if ($inlet_data) { [$inlet_oid,$inlet_descr] = explode(' ', $inlet_data, 2); $inlet_split_oid = explode('.', $inlet_oid); - $inlet_index = $inlet_split_oid[(count($inlet_split_oid) - 2)] . '.' . $inlet_split_oid[(count($inlet_split_oid) - 1)]; + $inlet_index = $inlet_split_oid[count($inlet_split_oid) - 2] . '.' . $inlet_split_oid[count($inlet_split_oid) - 1]; $inlet_oid = ".1.3.6.1.4.1.13742.6.5.2.3.1.4.$inlet_index.1"; $inlet_divisor = pow(10, snmp_get($device, "inletSensorDecimalDigits.$inlet_index.rmsCurrent", '-Ovq', 'PDU2-MIB')); $inlet_current = (snmp_get($device, "measurementsInletSensorValue.$inlet_index.1", '-Ovq', 'PDU2-MIB') / $inlet_divisor); @@ -34,7 +34,7 @@ if ($outlet_oids) { if ($outlet_data) { [$outlet_oid,$outlet_descr] = explode(' ', $outlet_data, 2); $outlet_split_oid = explode('.', $outlet_oid); - $outlet_index = $outlet_split_oid[(count($outlet_split_oid) - 1)]; + $outlet_index = $outlet_split_oid[count($outlet_split_oid) - 1]; $outletsuffix = "$outlet_index"; $outlet_insert_index = $outlet_index; // outletLoadValue: "A non-negative value indicates the measured load in milli Amps" @@ -62,7 +62,7 @@ if ($outlet_oids) { if ($outlet_data) { [$outlet_oid,$outlet_descr] = explode(' ', $outlet_data, 2); $outlet_split_oid = explode('.', $outlet_oid); - $outlet_index = $outlet_split_oid[(count($outlet_split_oid) - 1)]; + $outlet_index = $outlet_split_oid[count($outlet_split_oid) - 1]; $outletsuffix = "$outlet_index"; $outlet_insert_index = $outlet_index; $outlet_oid = ".1.3.6.1.4.1.13742.6.5.4.3.1.4.1.$outletsuffix.1"; diff --git a/includes/discovery/sensors/current/sentry3.inc.php b/includes/discovery/sensors/current/sentry3.inc.php index 8f41b1354e..ebc91f70a4 100644 --- a/includes/discovery/sensors/current/sentry3.inc.php +++ b/includes/discovery/sensors/current/sentry3.inc.php @@ -23,7 +23,7 @@ while ($towers <= $tower_count) { if ($infeed_data) { [$infeed_oid,$descr] = explode(' ', $infeed_data, 2); $split_oid = explode('.', $infeed_oid); - $infeed_index = $split_oid[(count($split_oid) - 1)]; + $infeed_index = $split_oid[count($split_oid) - 1]; // infeedLoadValue $infeed_oid = '.1.3.6.1.4.1.1718.3.2.2.1.7.' . $towers . '.' . $infeed_index; @@ -55,7 +55,7 @@ while ($towers <= $tower_count) { if ($outlet_data) { [$outlet_oid,$outlet_descr] = explode(' ', $outlet_data, 2); $outlet_split_oid = explode('.', $outlet_oid); - $outlet_index = $outlet_split_oid[(count($outlet_split_oid) - 1)]; + $outlet_index = $outlet_split_oid[count($outlet_split_oid) - 1]; $outletsuffix = "$towers.$infeed_index.$outlet_index"; diff --git a/includes/discovery/sensors/dbm/adva_fsp3kr7.inc.php b/includes/discovery/sensors/dbm/adva_fsp3kr7.inc.php index 66b3d32241..376348aeff 100644 --- a/includes/discovery/sensors/dbm/adva_fsp3kr7.inc.php +++ b/includes/discovery/sensors/dbm/adva_fsp3kr7.inc.php @@ -18,8 +18,8 @@ //********* ADVA FSP3000 R7 Series - $multiplier = 1; - $divisor = 10; +$multiplier = 1; +$divisor = 10; foreach ($pre_cache['adva_fsp3kr7'] as $index => $entry) { if ($entry['entityFacilityAidString'] and $entry['pmSnapshotCurrentInputPower']) { diff --git a/includes/discovery/sensors/entity-sensor.inc.php b/includes/discovery/sensors/entity-sensor.inc.php index e4c8ec1a46..cab2a6190e 100644 --- a/includes/discovery/sensors/entity-sensor.inc.php +++ b/includes/discovery/sensors/entity-sensor.inc.php @@ -83,13 +83,13 @@ if (! empty($entity_oids)) { if ($device['os'] === 'arista_eos') { $descr = $entity_array[$index]['entPhysicalDescr']; if (preg_match('/(Input|Output) (voltage|current) sensor/i', $descr) || Str::startsWith($descr, 'Power supply') || preg_match('/^(Power Supply|Hotspot|Inlet|Board)/i', $descr)) { - $descr = (ucwords($entity_array[substr_replace($index, '000', -3)]['entPhysicalDescr'] ?? '')) + $descr = ucwords($entity_array[substr_replace($index, '000', -3)]['entPhysicalDescr'] ?? '') . ' ' . preg_replace( - '/(Voltage|Current|Power Supply) Sensor$/i', - '', - ucwords($entity_array[$index]['entPhysicalDescr']) - ); + '/(Voltage|Current|Power Supply) Sensor$/i', + '', + ucwords($entity_array[$index]['entPhysicalDescr']) + ); } if (preg_match('/(temp|temperature) sensor$/i', $descr)) { $descr = preg_replace('/(temp|temperature) sensor$/i', '', $descr); diff --git a/includes/discovery/sensors/fanspeed/areca.inc.php b/includes/discovery/sensors/fanspeed/areca.inc.php index 0e5746b095..fd414f8bc7 100644 --- a/includes/discovery/sensors/fanspeed/areca.inc.php +++ b/includes/discovery/sensors/fanspeed/areca.inc.php @@ -12,7 +12,7 @@ foreach (explode("\n", $oids) as $data) { if ($data) { [$oid,$descr] = explode(' ', $data, 2); $split_oid = explode('.', $oid); - $index = $split_oid[(count($split_oid) - 1)]; + $index = $split_oid[count($split_oid) - 1]; $oid = '.1.3.6.1.4.1.18928.1.2.2.1.9.1.3.' . $index; $current = snmp_get($device, $oid, '-Oqv', ''); diff --git a/includes/discovery/sensors/fanspeed/drac.inc.php b/includes/discovery/sensors/fanspeed/drac.inc.php index 64e2987154..3f30b396c6 100644 --- a/includes/discovery/sensors/fanspeed/drac.inc.php +++ b/includes/discovery/sensors/fanspeed/drac.inc.php @@ -13,7 +13,7 @@ foreach (explode("\n", $oids) as $data) { if ($data) { [$oid,$kind] = explode(' ', $data); $split_oid = explode('.', $oid); - $index = $split_oid[(count($split_oid) - 1)]; + $index = $split_oid[count($split_oid) - 1]; $fan_oid = ".1.3.6.1.4.1.674.10892.5.4.700.12.1.6.1.$index"; $descr_oid = "coolingDeviceLocationName.1.$index"; $limit_oid = "coolingDeviceLowerCriticalThreshold.1.$index"; diff --git a/includes/discovery/sensors/fanspeed/equallogic.inc.php b/includes/discovery/sensors/fanspeed/equallogic.inc.php index f8bbfbb5e9..75cf81c263 100644 --- a/includes/discovery/sensors/fanspeed/equallogic.inc.php +++ b/includes/discovery/sensors/fanspeed/equallogic.inc.php @@ -17,9 +17,9 @@ if (! empty($oids)) { if (! empty($data)) { [$oid,$descr] = explode(' = ', $data, 2); $split_oid = explode('.', $oid); - $num_index = $split_oid[(count($split_oid) - 1)]; + $num_index = $split_oid[count($split_oid) - 1]; $index = $num_index; - $part_oid = $split_oid[(count($split_oid) - 2)]; + $part_oid = $split_oid[count($split_oid) - 2]; $num_index = $part_oid . '.' . $num_index; $base_oid = '.1.3.6.1.4.1.12740.2.1.7.1.3.1.'; $oid = $base_oid . $num_index; diff --git a/includes/discovery/sensors/fanspeed/supermicro.inc.php b/includes/discovery/sensors/fanspeed/supermicro.inc.php index ef450933c0..e9d67f7831 100644 --- a/includes/discovery/sensors/fanspeed/supermicro.inc.php +++ b/includes/discovery/sensors/fanspeed/supermicro.inc.php @@ -13,7 +13,7 @@ foreach (explode("\n", $oids) as $data) { if ($data) { [$oid,$kind] = explode(' ', $data); $split_oid = explode('.', $oid); - $index = $split_oid[(count($split_oid) - 1)]; + $index = $split_oid[count($split_oid) - 1]; if ($kind == 0) { $fan_oid = ".1.3.6.1.4.1.10876.2.1.1.1.1.4.$index"; $descr_oid = ".1.3.6.1.4.1.10876.2.1.1.1.1.2.$index"; diff --git a/includes/discovery/sensors/fanspeed/unix.inc.php b/includes/discovery/sensors/fanspeed/unix.inc.php index cda8cebf2b..c512ef1340 100644 --- a/includes/discovery/sensors/fanspeed/unix.inc.php +++ b/includes/discovery/sensors/fanspeed/unix.inc.php @@ -13,7 +13,7 @@ foreach (explode("\n", $oids) as $data) { if ($data) { [$oid,$descr] = explode(' ', $data, 2); $split_oid = explode('.', $oid); - $index = $split_oid[(count($split_oid) - 1)]; + $index = $split_oid[count($split_oid) - 1]; $oid = '.1.3.6.1.4.1.2021.13.16.3.1.3.' . $index; $current = snmp_get($device, $oid, '-Oqv', 'LM-SENSORS-MIB'); $descr = trim(str_ireplace('fan-', '', $descr)); diff --git a/includes/discovery/sensors/fanspeed/xos.inc.php b/includes/discovery/sensors/fanspeed/xos.inc.php index 18cef386bb..8e2a51310a 100644 --- a/includes/discovery/sensors/fanspeed/xos.inc.php +++ b/includes/discovery/sensors/fanspeed/xos.inc.php @@ -16,10 +16,10 @@ foreach ($oids as $index => $entry) { $value = snmp_get($device, $oid, '-Oqv', 'EXTREME-SYSTEM-MIB'); $descr = "Fan Speed $modindex"; // round function used to round limit values to hundreds to avoid h/w/l limits being changed on every discovery as a change of 1rpm for fan speed would cause the limit values to change since they're dynamically calculated - $high_limit = round_Nth(($value * 1.5), 100); - $high_warn_limit = round_Nth(($value * 1.25), 100); - $low_warn_limit = round_Nth(($value * 0.75), 100); - $low_limit = round_Nth(($value * 0.5), 100); + $high_limit = round_Nth($value * 1.5, 100); + $high_warn_limit = round_Nth($value * 1.25, 100); + $low_warn_limit = round_Nth($value * 0.75, 100); + $low_limit = round_Nth($value * 0.5, 100); if (is_numeric($value)) { discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $index, 'extreme-fanspeed', $descr, '1', '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $value); } diff --git a/includes/discovery/sensors/frequency/apc.inc.php b/includes/discovery/sensors/frequency/apc.inc.php index 793567c041..175e462d50 100644 --- a/includes/discovery/sensors/frequency/apc.inc.php +++ b/includes/discovery/sensors/frequency/apc.inc.php @@ -14,7 +14,7 @@ foreach (explode("\n", $oids) as $data) { if ($data) { [$oid,$current] = explode(' ', $data, 2); $split_oid = explode('.', $oid); - $index = $split_oid[(count($split_oid) - 1)]; + $index = $split_oid[count($split_oid) - 1]; $oid = '.1.3.6.1.4.1.318.1.1.8.5.3.2.1.4.' . $index; $descr = 'Input Feed ' . chr(64 + $index); discover_sensor($valid['sensor'], 'frequency', $device, $oid, "3.2.1.4.$index", $type, $descr, $divisor, '1', null, null, null, null, $current); @@ -35,7 +35,7 @@ foreach (explode("\n", $oids) as $data) { if ($data) { [$oid,$current] = explode(' ', $data, 2); $split_oid = explode('.', $oid); - $index = $split_oid[(count($split_oid) - 3)]; + $index = $split_oid[count($split_oid) - 3]; $oid = '.1.3.6.1.4.1.318.1.1.8.5.4.2.1.4.' . $index; $descr = 'Output Feed'; if (count(explode("\n", $oids)) > 1) { diff --git a/includes/discovery/sensors/frequency/netagent2.inc.php b/includes/discovery/sensors/frequency/netagent2.inc.php index 26f88c4beb..2aba0e806b 100644 --- a/includes/discovery/sensors/frequency/netagent2.inc.php +++ b/includes/discovery/sensors/frequency/netagent2.inc.php @@ -29,9 +29,9 @@ */ // Detect type of UPS (Signle-Phase/3 Phase) - // Number of input lines - $upsInputNumLines_oid = '.1.3.6.1.2.1.33.1.3.2.0'; - $in_phaseNum = snmp_get($device, $upsInputNumLines_oid, '-Oqv'); +// Number of input lines +$upsInputNumLines_oid = '.1.3.6.1.2.1.33.1.3.2.0'; +$in_phaseNum = snmp_get($device, $upsInputNumLines_oid, '-Oqv'); // Single-phase system if ($in_phaseNum == '1') { diff --git a/includes/discovery/sensors/frequency/raritan-pdu.inc.php b/includes/discovery/sensors/frequency/raritan-pdu.inc.php index 301c95a333..d6fe6d954a 100644 --- a/includes/discovery/sensors/frequency/raritan-pdu.inc.php +++ b/includes/discovery/sensors/frequency/raritan-pdu.inc.php @@ -12,7 +12,7 @@ foreach (explode("\n", $inlet_oids) as $inlet_data) { if ($inlet_data) { [$inlet_oid,$inlet_descr] = explode(' ', $inlet_data, 2); $inlet_split_oid = explode('.', $inlet_oid); - $inlet_index = $inlet_split_oid[(count($inlet_split_oid) - 2)] . '.' . $inlet_split_oid[(count($inlet_split_oid) - 1)]; + $inlet_index = $inlet_split_oid[count($inlet_split_oid) - 2] . '.' . $inlet_split_oid[count($inlet_split_oid) - 1]; $inlet_oid = ".1.3.6.1.4.1.13742.6.5.2.3.1.4.$inlet_index.23"; $inlet_divisor = pow(10, snmp_get($device, "inletSensorDecimalDigits.$inlet_index.frequency", '-Ovq', 'PDU2-MIB')); diff --git a/includes/discovery/sensors/humidity/minkelsrms.inc.php b/includes/discovery/sensors/humidity/minkelsrms.inc.php index 2d0ad1fcbb..7c35db4347 100644 --- a/includes/discovery/sensors/humidity/minkelsrms.inc.php +++ b/includes/discovery/sensors/humidity/minkelsrms.inc.php @@ -15,7 +15,7 @@ foreach (explode("\n", $oids) as $data) { if ($status == 2) { // 2 = normal, 0 = not connected $split_oid = explode('.', $oid); - $index = $split_oid[(count($split_oid) - 1)]; + $index = $split_oid[count($split_oid) - 1]; $descr_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.1.$index"; $oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.3.$index"; $warnlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.7.$index"; diff --git a/includes/discovery/sensors/load/dhcpatriot.inc.php b/includes/discovery/sensors/load/dhcpatriot.inc.php index dc43c95b55..5dab930fa3 100644 --- a/includes/discovery/sensors/load/dhcpatriot.inc.php +++ b/includes/discovery/sensors/load/dhcpatriot.inc.php @@ -44,7 +44,7 @@ if (! empty($dhcp_networks[$dhcp_networks_base_oid])) { foreach ($dhcp_networks[$dhcp_networks_base_oid] as $dhcp_type_index => $ignore_this) { if (! empty($dhcp_networks[$dhcp_networks_base_oid][$dhcp_type_index])) { foreach ($dhcp_networks[$dhcp_networks_base_oid][$dhcp_type_index] as $index => $entry) { - $description = (explode('[', $entry)); + $description = explode('[', $entry); $data_array[$array_index]['index'] = $index; if ($dhcp_type_index === intval($auth_dhcp_index)) { $data_array[$array_index]['type'] = 'dhcpatriotAuthDHCP'; diff --git a/includes/discovery/sensors/load/netagent2.inc.php b/includes/discovery/sensors/load/netagent2.inc.php index 8553675856..7efdd08eee 100644 --- a/includes/discovery/sensors/load/netagent2.inc.php +++ b/includes/discovery/sensors/load/netagent2.inc.php @@ -27,9 +27,9 @@ */ // Detect type of UPS (Signle-Phase/3 Phase) - // Number of input lines - $upsInputNumLines_oid = '.1.3.6.1.2.1.33.1.3.2.0'; - $in_phaseNum = snmp_get($device, $upsInputNumLines_oid, '-Oqv'); +// Number of input lines +$upsInputNumLines_oid = '.1.3.6.1.2.1.33.1.3.2.0'; +$in_phaseNum = snmp_get($device, $upsInputNumLines_oid, '-Oqv'); // Single-phase system if ($in_phaseNum == '1') { diff --git a/includes/discovery/sensors/power/hpblmos.inc.php b/includes/discovery/sensors/power/hpblmos.inc.php index 3210e1e441..fc2d2ffd08 100644 --- a/includes/discovery/sensors/power/hpblmos.inc.php +++ b/includes/discovery/sensors/power/hpblmos.inc.php @@ -13,7 +13,7 @@ foreach (explode("\n", $psus) as $psu) { [$oid, $presence] = explode(' ', $psu, 2); if ($presence != 2) { $split_oid = explode('.', $oid); - $current_id = $split_oid[(count($split_oid) - 1)]; + $current_id = $split_oid[count($split_oid) - 1]; $current_oid = $psu_usage_oid . $current_id; $psu_max_oid = $psu_max_usage_oid . $current_id; $descr = 'PSU ' . $current_id . ' output'; diff --git a/includes/discovery/sensors/power/raritan-pdu.inc.php b/includes/discovery/sensors/power/raritan-pdu.inc.php index fb92658a71..cd0ad95f27 100644 --- a/includes/discovery/sensors/power/raritan-pdu.inc.php +++ b/includes/discovery/sensors/power/raritan-pdu.inc.php @@ -13,7 +13,7 @@ if ($inlet_oids) { if ($inlet_data) { [$inlet_oid,$inlet_descr] = explode(' ', $inlet_data, 2); $inlet_split_oid = explode('.', $inlet_oid); - $inlet_index = $inlet_split_oid[(count($inlet_split_oid) - 2)] . '.' . $inlet_split_oid[(count($inlet_split_oid) - 1)]; + $inlet_index = $inlet_split_oid[count($inlet_split_oid) - 2] . '.' . $inlet_split_oid[count($inlet_split_oid) - 1]; $inlet_oid = ".1.3.6.1.4.1.13742.6.5.2.3.1.4.$inlet_index.5"; $inlet_divisor = pow(10, snmp_get($device, "inletSensorDecimalDigits.$inlet_index.activePower", '-Ovq', 'PDU2-MIB')); $inlet_power = (snmp_get($device, "measurementsInletSensorValue.$inlet_index.activePower", '-Ovq', 'PDU2-MIB') / $inlet_divisor); @@ -34,12 +34,12 @@ if ($outlet_oids) { if ($outlet_data) { [$outlet_oid,$outlet_descr] = explode(' ', $outlet_data, 2); $outlet_split_oid = explode('.', $outlet_oid); - $outlet_index = $outlet_split_oid[(count($outlet_split_oid) - 1)]; + $outlet_index = $outlet_split_oid[count($outlet_split_oid) - 1]; $outletsuffix = "$outlet_index"; $outlet_insert_index = $outlet_index; $outlet_oid = ".1.3.6.1.4.1.13742.4.1.2.2.1.8.$outletsuffix"; $outlet_descr = snmp_get($device, "outletLabel.$outletsuffix", '-Ovq', 'PDU-MIB'); - $outlet_power = (snmp_get($device, "outletApparentPower.$outletsuffix", '-Ovq', 'PDU-MIB')); + $outlet_power = snmp_get($device, "outletApparentPower.$outletsuffix", '-Ovq', 'PDU-MIB'); if ($outlet_power >= 0) { discover_sensor($valid['sensor'], 'power', $device, $outlet_oid, $outlet_insert_index, 'raritan', $outlet_descr, $divisor, $multiplier, null, null, null, null, $outlet_power); } @@ -57,7 +57,7 @@ if ($outlet_oids) { if ($outlet_data) { [$outlet_oid,$outlet_descr] = explode(' ', $outlet_data, 2); $outlet_split_oid = explode('.', $outlet_oid); - $outlet_index = $outlet_split_oid[(count($outlet_split_oid) - 1)]; + $outlet_index = $outlet_split_oid[count($outlet_split_oid) - 1]; $outletsuffix = "$outlet_index"; $outlet_insert_index = $outlet_index; $outlet_oid = ".1.3.6.1.4.1.13742.6.5.4.3.1.4.1.$outletsuffix.5"; diff --git a/includes/discovery/sensors/rittal-cmc-iii-sensors.inc.php b/includes/discovery/sensors/rittal-cmc-iii-sensors.inc.php index ae86db2fda..da3e268f5c 100644 --- a/includes/discovery/sensors/rittal-cmc-iii-sensors.inc.php +++ b/includes/discovery/sensors/rittal-cmc-iii-sensors.inc.php @@ -105,8 +105,8 @@ foreach ($cmc_iii_var_table as $index => $entry) { } elseif ($unit == '%') { $type = 'percent'; } - $cmc_iii_sensors[$sensor_id]['type'] = $type; - break; + $cmc_iii_sensors[$sensor_id]['type'] = $type; + break; } } diff --git a/includes/discovery/sensors/state/aos-emu2.inc.php b/includes/discovery/sensors/state/aos-emu2.inc.php index 259a408591..599c1e3f20 100644 --- a/includes/discovery/sensors/state/aos-emu2.inc.php +++ b/includes/discovery/sensors/state/aos-emu2.inc.php @@ -23,7 +23,7 @@ * @author Ben Gibbons */ - // Input Contact discovery +// Input Contact discovery $contacts['emu2_contacts'] = snmpwalk_group($device, 'emsInputContactStatusEntry', 'PowerNet-MIB'); diff --git a/includes/discovery/sensors/state/aos6.inc.php b/includes/discovery/sensors/state/aos6.inc.php index 1793f7e42f..5a8aabfb91 100644 --- a/includes/discovery/sensors/state/aos6.inc.php +++ b/includes/discovery/sensors/state/aos6.inc.php @@ -14,7 +14,7 @@ foreach ($aos6_fan_oids as $index => $data) { $oid = '.1.3.6.1.4.1.6486.800.1.1.1.3.1.1.11.1.2.' . $index; $state_name = 'alaChasEntPhysFanStatus'; $current = $data['alaChasEntPhysFanStatus']; - [$revindex, $revchass, $revdata,] = explode('.', strrev($oid), 4); + [$revindex, $revchass, $revdata] = explode('.', strrev($oid), 4); $chassis = strrev($revchass); $indexName = strrev($revindex); $descr = 'Chassis-' . ($chassis - 568) . " Fan $indexName"; diff --git a/includes/discovery/sensors/state/equallogic.inc.php b/includes/discovery/sensors/state/equallogic.inc.php index 4228260b5a..76994034f4 100644 --- a/includes/discovery/sensors/state/equallogic.inc.php +++ b/includes/discovery/sensors/state/equallogic.inc.php @@ -53,7 +53,7 @@ if (! empty($oids)) { if (! empty($data)) { [$oid,$current] = explode(' = ', $data, 2); $split_oid = explode('.', $oid); - $num_index = $split_oid[(count($split_oid) - 1)]; + $num_index = $split_oid[count($split_oid) - 1]; $index = (int) cast_number($num_index); $low_limit = 0.5; $high_limit = 2.5; @@ -97,9 +97,9 @@ if (! empty($oids1)) { if (! empty($data)) { [$oid,$descr] = explode(' = ', $data, 2); $split_oid = explode('.', $oid); - $num_index = $split_oid[(count($split_oid) - 1)]; + $num_index = $split_oid[count($split_oid) - 1]; $index = (int) cast_number($num_index); - $member_id = $split_oid[(count($split_oid) - 2)]; + $member_id = $split_oid[count($split_oid) - 2]; $num_index = $member_id . '.' . $num_index; $oid = $base_oid . $num_index; $extra = snmp_get_multi($device, $oid, '-OQne', 'EQLMEMBER-MIB', 'equallogic'); @@ -142,8 +142,8 @@ if (! empty($oids_disks)) { if (! empty($data)) { [$oid,$descr] = explode(' = ', $data, 2); $split_oid = explode('.', $oid); - $disk_index = $split_oid[(count($split_oid) - 1)]; - $member_id = $split_oid[(count($split_oid) - 2)]; + $disk_index = $split_oid[count($split_oid) - 1]; + $member_id = $split_oid[count($split_oid) - 2]; $num_index = $member_id . '.' . $disk_index; $oid = $disks_base_oid . $num_index; $extra = snmp_get($device, $oid, '-OQne', 'EQLDISK-MIB', 'equallogic'); diff --git a/includes/discovery/sensors/state/hirschmann.inc.php b/includes/discovery/sensors/state/hirschmann.inc.php index d357b45bbd..3e470f09f9 100644 --- a/includes/discovery/sensors/state/hirschmann.inc.php +++ b/includes/discovery/sensors/state/hirschmann.inc.php @@ -20,7 +20,7 @@ if ($device['os'] == 'hirschmann') { foreach ($oid as $index => $entry) { //Discover Sensors - discover_sensor($valid['sensor'], 'state', $device, $cur_oid . $index, 'hmPowerSupplyStatus' . $index, $state_name, 'Power Supply ' . $oid[$index]['hmPSID'], 1, 1, null, null, null, null, ($oid[$index]['hmPowerSupplyStatus'] ?? null), 'snmp', 'hmPowerSupplyStatus' . $index); + discover_sensor($valid['sensor'], 'state', $device, $cur_oid . $index, 'hmPowerSupplyStatus' . $index, $state_name, 'Power Supply ' . $oid[$index]['hmPSID'], 1, 1, null, null, null, null, $oid[$index]['hmPowerSupplyStatus'] ?? null, 'snmp', 'hmPowerSupplyStatus' . $index); //Create Sensor To State Index create_sensor_to_state_index($device, $state_name, 'hmPowerSupplyStatus' . $index); diff --git a/includes/discovery/sensors/state/hpblmos.inc.php b/includes/discovery/sensors/state/hpblmos.inc.php index 316cad9c6c..bbc2dae432 100644 --- a/includes/discovery/sensors/state/hpblmos.inc.php +++ b/includes/discovery/sensors/state/hpblmos.inc.php @@ -13,7 +13,7 @@ foreach (explode("\n", $fans) as $fan) { [$oid, $presence] = explode(' ', $fan, 2); if ($presence != 2) { $split_oid = explode('.', $oid); - $current_id = $split_oid[(count($split_oid) - 1)]; + $current_id = $split_oid[count($split_oid) - 1]; $current_oid = $fan_state_oid . $current_id; $descr = $fan_state_descr . $current_id; $state = snmp_get($device, $current_oid, '-Oqv'); @@ -45,7 +45,7 @@ foreach (explode("\n", $psus) as $psu) { [$oid, $presence] = explode(' ', $psu, 2); if ($presence != 2) { $split_oid = explode('.', $oid); - $current_id = $split_oid[(count($split_oid) - 1)]; + $current_id = $split_oid[count($split_oid) - 1]; $current_oid = $psu_state_oid . $current_id; $descr = $psu_state_descr . $current_id; $state = snmp_get($device, $current_oid, '-Oqv'); diff --git a/includes/discovery/sensors/state/nxos.inc.php b/includes/discovery/sensors/state/nxos.inc.php index 1139be9fd4..4ad419db9c 100644 --- a/includes/discovery/sensors/state/nxos.inc.php +++ b/includes/discovery/sensors/state/nxos.inc.php @@ -24,7 +24,7 @@ if (is_array($fan_trays)) { foreach ($fan_trays as $oid => $array) { $state = current($array); $split_oid = explode('.', $oid); - $index = $split_oid[(count($split_oid) - 1)]; + $index = $split_oid[count($split_oid) - 1]; $current_oid = "$fan_tray_oid.$index"; $entity_oid = '.1.3.6.1.2.1.47.1.1.1.1.7'; diff --git a/includes/discovery/sensors/state/serverscheck.inc.php b/includes/discovery/sensors/state/serverscheck.inc.php index ca6ca64004..e2c28a7ed8 100644 --- a/includes/discovery/sensors/state/serverscheck.inc.php +++ b/includes/discovery/sensors/state/serverscheck.inc.php @@ -34,7 +34,7 @@ $serverscheck_oids = [ ]; foreach ($pre_cache['serverscheck_control'] as $oid_name => $oid_value) { - if ((Str::contains($oid_name, 'name')) && (Str::contains($oid_value, ['Flooding', 'Leckage']))) { + if (Str::contains($oid_name, 'name') && Str::contains($oid_value, ['Flooding', 'Leckage'])) { preg_match("/(\d+)/", $oid_name, $temp_x); $tmp_oid = 'sensor' . $temp_x[0] . 'Value.0'; $current = $pre_cache['serverscheck_control'][$tmp_oid]; diff --git a/includes/discovery/sensors/state/voss.inc.php b/includes/discovery/sensors/state/voss.inc.php index d90dcfaf64..9efad7b575 100644 --- a/includes/discovery/sensors/state/voss.inc.php +++ b/includes/discovery/sensors/state/voss.inc.php @@ -26,8 +26,8 @@ if (is_array($voss_fan)) { foreach ($voss_fan as $oid => $array) { $state = current($array); $split_oid = explode('.', $oid); - $tray_num = $split_oid[(count($split_oid) - 2)]; - $fan_num = $split_oid[(count($split_oid) - 1)]; + $tray_num = $split_oid[count($split_oid) - 2]; + $fan_num = $split_oid[count($split_oid) - 1]; $current_oid = ".1.3.6.1.4.1.2272.1.101.1.1.4.1.4.$tray_num.$fan_num"; $descr = "VOSS Tray $tray_num Fan $fan_num"; @@ -47,7 +47,7 @@ if (is_array($voss_fan)) { foreach ($fan as $oid => $array) { $state = current($array); $split_oid = explode('.', $oid); - $index = $split_oid[(count($split_oid) - 1)]; + $index = $split_oid[count($split_oid) - 1]; $current_oid = ".1.3.6.1.4.1.2272.1.4.7.1.1.2.$index"; $descr = "VOSS Fan $index"; @@ -78,7 +78,7 @@ if (is_array($power_supply)) { foreach ($power_supply as $oid => $array) { $state = current($array); $split_oid = explode('.', $oid); - $index = $split_oid[(count($split_oid) - 1)]; + $index = $split_oid[count($split_oid) - 1]; $current_oid = ".1.3.6.1.4.1.2272.1.4.8.1.1.2.$index"; $descr = "VOSS Power Supply $index"; diff --git a/includes/discovery/sensors/temperature/adva_fsp3kr7.inc.php b/includes/discovery/sensors/temperature/adva_fsp3kr7.inc.php index ecfaa63154..09aa12bc5c 100644 --- a/includes/discovery/sensors/temperature/adva_fsp3kr7.inc.php +++ b/includes/discovery/sensors/temperature/adva_fsp3kr7.inc.php @@ -20,8 +20,8 @@ // ***** Temperature Sensors for ADVA FSP3000 R7 // ************************************************************* - $multiplier = 1; - $divisor = 10; +$multiplier = 1; +$divisor = 10; if (is_array($pre_cache['adva_fsp3kr7_Card'])) { foreach (array_keys($pre_cache['adva_fsp3kr7_Card']) as $index) { diff --git a/includes/discovery/sensors/temperature/areca.inc.php b/includes/discovery/sensors/temperature/areca.inc.php index 57f5ff5e83..3ae0f35d31 100644 --- a/includes/discovery/sensors/temperature/areca.inc.php +++ b/includes/discovery/sensors/temperature/areca.inc.php @@ -13,7 +13,7 @@ foreach (explode("\n", $oids) as $data) { if ($data) { [$oid,$descr] = explode(' ', $data, 2); $split_oid = explode('.', $oid); - $temperature_id = $split_oid[(count($split_oid) - 1)]; + $temperature_id = $split_oid[count($split_oid) - 1]; $temperature_oid = ".1.3.6.1.4.1.18928.1.1.2.14.1.2.$temperature_id"; $temperature = snmp_get($device, $temperature_oid, '-Oqv', ''); $descr = "Hard disk $temperature_id"; @@ -37,7 +37,7 @@ foreach (explode("\n", $oids) as $data) { if ($data) { [$oid,$descr] = explode(' ', $data, 2); $split_oid = explode('.', $oid); - $index = $split_oid[(count($split_oid) - 1)]; + $index = $split_oid[count($split_oid) - 1]; $oid = '.1.3.6.1.4.1.18928.1.2.2.1.10.1.3.' . $index; $current = snmp_get($device, $oid, '-Oqv', ''); diff --git a/includes/discovery/sensors/temperature/drac.inc.php b/includes/discovery/sensors/temperature/drac.inc.php index dfda2fa40a..0191943d76 100644 --- a/includes/discovery/sensors/temperature/drac.inc.php +++ b/includes/discovery/sensors/temperature/drac.inc.php @@ -22,7 +22,7 @@ foreach (explode("\n", $oids) as $data) { if ($status == 'ok') { $split_oid = explode('.', $oid); - $temperature_id = $split_oid[(count($split_oid) - 2)] . '.' . $split_oid[(count($split_oid) - 1)]; + $temperature_id = $split_oid[count($split_oid) - 2] . '.' . $split_oid[count($split_oid) - 1]; $descr_oid = ".1.3.6.1.4.1.674.10892.5.4.700.20.1.8.$temperature_id"; $temperature_oid = ".1.3.6.1.4.1.674.10892.5.4.700.20.1.6.$temperature_id"; $limit_oid = ".1.3.6.1.4.1.674.10892.5.4.700.20.1.10.$temperature_id"; @@ -37,7 +37,7 @@ foreach (explode("\n", $oids) as $data) { $limit = snmp_get($device, $limit_oid, '-Oqv', 'IDRAC-MIB-SMIv2'); $lowlimit = snmp_get($device, $lowlimit_oid, '-Oqv', 'IDRAC-MIB-SMIv2'); - discover_sensor($valid['sensor'], 'temperature', $device, $temperature_oid, $temperature_id, 'drac', $descr, '10', '1', ($lowlimit / 10), ($lowwarnlimit / 10), ($warnlimit / 10), ($limit / 10), ($temperature / 10)); + discover_sensor($valid['sensor'], 'temperature', $device, $temperature_oid, $temperature_id, 'drac', $descr, '10', '1', $lowlimit / 10, $lowwarnlimit / 10, $warnlimit / 10, $limit / 10, $temperature / 10); } }//end if } diff --git a/includes/discovery/sensors/temperature/equallogic.inc.php b/includes/discovery/sensors/temperature/equallogic.inc.php index 358581bd0c..1338d4edd4 100644 --- a/includes/discovery/sensors/temperature/equallogic.inc.php +++ b/includes/discovery/sensors/temperature/equallogic.inc.php @@ -23,9 +23,9 @@ if (! empty($oids)) { if (! empty($data)) { [$oid,$descr] = explode(' = ', $data, 2); $split_oid = explode('.', $oid); - $num_index = $split_oid[(count($split_oid) - 1)]; + $num_index = $split_oid[count($split_oid) - 1]; $index = $num_index; - $part_oid = $split_oid[(count($split_oid) - 2)]; + $part_oid = $split_oid[count($split_oid) - 2]; $num_index = $part_oid . '.' . $num_index; $base_oid = '.1.3.6.1.4.1.12740.2.1.6.1.3.1.'; $oid = $base_oid . $num_index; diff --git a/includes/discovery/sensors/temperature/hpblmos.inc.php b/includes/discovery/sensors/temperature/hpblmos.inc.php index 1d2e10255c..fed3fda2f1 100644 --- a/includes/discovery/sensors/temperature/hpblmos.inc.php +++ b/includes/discovery/sensors/temperature/hpblmos.inc.php @@ -12,7 +12,7 @@ foreach (explode("\n", $temps) as $temp) { [$oid, $descr] = explode(' ', $temp, 2); if ($descr != '') { $split_oid = explode('.', $oid); - $current_id = $split_oid[(count($split_oid) - 1)]; + $current_id = $split_oid[count($split_oid) - 1]; $current_oid = $sensor_value_oid . $current_id; $value = snmp_get($device, $current_oid, '-Oqve'); if ($value > 0) { diff --git a/includes/discovery/sensors/temperature/linux.inc.php b/includes/discovery/sensors/temperature/linux.inc.php index 3c17476f99..2eea6af068 100644 --- a/includes/discovery/sensors/temperature/linux.inc.php +++ b/includes/discovery/sensors/temperature/linux.inc.php @@ -25,7 +25,7 @@ if (Str::startsWith($device['sysObjectID'], '.1.3.6.1.4.1.232.')) { if ($data != '') { [$oid] = explode(' ', $data); $split_oid = explode('.', $oid); - $temperature_id = $split_oid[(count($split_oid) - 2)] . '.' . $split_oid[(count($split_oid) - 1)]; + $temperature_id = $split_oid[count($split_oid) - 2] . '.' . $split_oid[count($split_oid) - 1]; $descr_oid = ".1.3.6.1.4.1.232.6.2.6.8.1.3.$temperature_id"; $descr = snmp_get($device, $descr_oid, '-Oqnv', 'CPQHLTH-MIB', 'hp'); diff --git a/includes/discovery/sensors/temperature/mgeups.inc.php b/includes/discovery/sensors/temperature/mgeups.inc.php index 7d9ec35655..c79d701c42 100644 --- a/includes/discovery/sensors/temperature/mgeups.inc.php +++ b/includes/discovery/sensors/temperature/mgeups.inc.php @@ -49,5 +49,5 @@ foreach (array_keys($mge_env_data) as $index) { d_echo("low_limit : $low_limit\nlow_warn_limit : $low_warn_limit\nhigh_warn_limit : $high_warn_limit\nhigh_limit : $high_limit\n"); - discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, $sensorType, $descr, '10', '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, ($current / 10)); + discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, $sensorType, $descr, '10', '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current / 10); } diff --git a/includes/discovery/sensors/temperature/minkelsrms.inc.php b/includes/discovery/sensors/temperature/minkelsrms.inc.php index 4b0cad0da2..42f5288499 100644 --- a/includes/discovery/sensors/temperature/minkelsrms.inc.php +++ b/includes/discovery/sensors/temperature/minkelsrms.inc.php @@ -15,7 +15,7 @@ foreach (explode("\n", $oids) as $data) { if ($status == 2) { // 2 = normal, 0 = not connected $split_oid = explode('.', $oid); - $temperature_id = $split_oid[(count($split_oid) - 1)]; + $temperature_id = $split_oid[count($split_oid) - 1]; $descr_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.1.$temperature_id"; $temperature_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.3.$temperature_id"; $warnlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.7.$temperature_id"; diff --git a/includes/discovery/sensors/temperature/seos.inc.php b/includes/discovery/sensors/temperature/seos.inc.php index e64a1d6997..b5867c3b86 100644 --- a/includes/discovery/sensors/temperature/seos.inc.php +++ b/includes/discovery/sensors/temperature/seos.inc.php @@ -12,7 +12,7 @@ foreach (explode("\n", $oids) as $data) { if ($data) { [$oid,$descr] = explode(' ', $data, 2); $split_oid = explode('.', $oid); - $index = $split_oid[(count($split_oid) - 2)] . '.' . $split_oid[(count($split_oid) - 1)]; + $index = $split_oid[count($split_oid) - 2] . '.' . $split_oid[count($split_oid) - 1]; $oid = '.1.3.6.1.4.1.2352.2.4.1.4.1.3.' . $index; $temperature = snmp_get($device, $oid, '-Oqv'); $descr = str_replace('"', '', $descr); @@ -29,7 +29,7 @@ foreach (explode("\n", $oids) as $data) { if ($data) { [$oid,$descr] = explode(' ', $data, 2); $split_oid = explode('.', $oid); - $index = $split_oid[(count($split_oid) - 2)] . '.' . $split_oid[(count($split_oid) - 1)]; + $index = $split_oid[count($split_oid) - 2] . '.' . $split_oid[count($split_oid) - 1]; $oid = '.1.3.6.1.4.1.2352.2.4.1.6.1.3.' . $index; $temperature = snmp_get($device, $oid, '-Oqv'); $descr = str_replace('"', '', $descr); diff --git a/includes/discovery/sensors/temperature/supermicro.inc.php b/includes/discovery/sensors/temperature/supermicro.inc.php index 0069393001..500742b117 100644 --- a/includes/discovery/sensors/temperature/supermicro.inc.php +++ b/includes/discovery/sensors/temperature/supermicro.inc.php @@ -10,7 +10,7 @@ if ($oids) { if ($data) { [$oid, $type] = explode(' ', $data); $oid_ex = explode('.', $oid); - $index = $oid_ex[(count($oid_ex) - 1)]; + $index = $oid_ex[count($oid_ex) - 1]; if ($type == 2) { $temperature_oid = ".1.3.6.1.4.1.10876.2.1.1.1.1.4.$index"; $descr_oid = ".1.3.6.1.4.1.10876.2.1.1.1.1.2.$index"; diff --git a/includes/discovery/sensors/temperature/unix.inc.php b/includes/discovery/sensors/temperature/unix.inc.php index 01e0484699..53d6e04ea2 100644 --- a/includes/discovery/sensors/temperature/unix.inc.php +++ b/includes/discovery/sensors/temperature/unix.inc.php @@ -12,7 +12,7 @@ if ($oids) { $divisor = 1000; [$oid,$descr] = explode(' ', $data, 2); $split_oid = explode('.', $oid); - $temperature_id = $split_oid[(count($split_oid) - 1)]; + $temperature_id = $split_oid[count($split_oid) - 1]; $temperature_oid = ".1.3.6.1.4.1.2021.13.16.2.1.3.$temperature_id"; $temperature = floatval(snmp_get($device, $temperature_oid, '-Ovq')) / $divisor; $descr = str_ireplace('temperature-', '', $descr); diff --git a/includes/discovery/sensors/temperature/voss.inc.php b/includes/discovery/sensors/temperature/voss.inc.php index ecb91b6b0c..2fb60fa0b7 100644 --- a/includes/discovery/sensors/temperature/voss.inc.php +++ b/includes/discovery/sensors/temperature/voss.inc.php @@ -29,7 +29,7 @@ $index = 'rcSingleCpSystemCpuTemperature.0'; $oid = '.1.3.6.1.4.1.2272.1.212.1.0'; $descr = 'VOSS CPU temperature'; $value = snmp_get($device, $index, '-OvqU', 'RAPID-CITY'); -if ((is_numeric($value) && $value != 0)) { +if (is_numeric($value) && $value != 0) { discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'avaya-vsp', $descr, '1', '1', null, null, null, null, $value); } @@ -37,7 +37,7 @@ $index = 'rcSingleCpSystemMacTemperature.0'; $oid = '.1.3.6.1.4.1.2272.1.212.2.0'; $descr = 'VOSS MAC temperature'; $value = snmp_get($device, $index, '-OvqU', 'RAPID-CITY'); -if ((is_numeric($value) && $value != 0)) { +if (is_numeric($value) && $value != 0) { discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'avaya-vsp', $descr, '1', '1', null, null, null, null, $value); } @@ -45,7 +45,7 @@ $index = 'rcSingleCpSystemPhy1Temperature.0'; $oid = '.1.3.6.1.4.1.2272.1.212.3.0'; $descr = 'VOSS PHY1 temperature'; $value = snmp_get($device, $index, '-OvqU', 'RAPID-CITY'); -if ((is_numeric($value) && $value != 0)) { +if (is_numeric($value) && $value != 0) { discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'avaya-vsp', $descr, '1', '1', null, null, null, null, $value); } @@ -54,7 +54,7 @@ $oid = '.1.3.6.1.4.1.2272.1.212.4.0'; $descr = 'VOSS PHY2 temperature'; $value = snmp_get($device, $index, '-OvqU', 'RAPID-CITY'); d_echo("VOSS $var1: $value\n"); -if ((is_numeric($value) && $value != 0)) { +if (is_numeric($value) && $value != 0) { discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'avaya-vsp', $descr, '1', '1', null, null, null, null, $value); } @@ -63,6 +63,6 @@ $oid = '.1.3.6.1.4.1.2272.1.212.5.0'; $descr = 'VOSS MAC2 temperature'; $value = snmp_get($device, $index, '-OvqU', 'RAPID-CITY'); d_echo("VOSS $var1: $value\n"); -if ((is_numeric($value) && $value != 0)) { +if (is_numeric($value) && $value != 0) { discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'avaya-vsp', $descr, '1', '1', null, null, null, null, $value); } diff --git a/includes/discovery/sensors/voltage/adva_fsp150.inc.php b/includes/discovery/sensors/voltage/adva_fsp150.inc.php index 74207d8bda..6f14c8cec6 100644 --- a/includes/discovery/sensors/voltage/adva_fsp150.inc.php +++ b/includes/discovery/sensors/voltage/adva_fsp150.inc.php @@ -20,98 +20,98 @@ // ***** Sensors for ADVA FSP150 // ****************************************** - // Define Sensors - $sensors_adva = [ - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.4.1.6', 'sensor_name' => 'psuOutputVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.6.1.5', 'sensor_name' => 'scuVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.7.1.5', 'sensor_name' => 'nemiVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.8.1.5', 'sensor_name' => 'ethernetNTUCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.9.1.5', 'sensor_name' => 'ethernetCPMRCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.10.1.5', 'sensor_name' => 'ethernetNTEGE101CardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.11.1.5', 'sensor_name' => 'ethernetNTEGE206CardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.13.1.5', 'sensor_name' => 'scuTVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.14.1.5', 'sensor_name' => 'ethernetNTECardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.15.1.5', 'sensor_name' => 'ethernetNTEGE201CardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.16.1.5', 'sensor_name' => 'ethernetNTEGE201SyncECardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.17.1.5', 'sensor_name' => 'ethernetNTEGE206FCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.25.1.5', 'sensor_name' => 'ethernetNTEGE112CardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.26.1.5', 'sensor_name' => 'ethernetNTEGE114CardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.27.1.5', 'sensor_name' => 'ethernetNTEGE206VCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.28.1.5', 'sensor_name' => 'ethernetGE4SCCCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.29.1.5', 'sensor_name' => 'ethernetGE4ECCCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.30.1.5', 'sensor_name' => 'ethernetNTEXG210CardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.31.1.5', 'sensor_name' => 'ethernetXG1XCCCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.32.1.5', 'sensor_name' => 'ethernetXG1SCCCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.38.1.5', 'sensor_name' => 'ethernetNTET1804CardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.39.1.5', 'sensor_name' => 'ethernetNTET3204CardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.41.1.5', 'sensor_name' => 'ethernetGE8SCCCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.42.1.5', 'sensor_name' => 'ethernetNTEGE114HCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.43.1.5', 'sensor_name' => 'ethernetNTEGE114PHCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.45.1.5', 'sensor_name' => 'ethernetNTEGE114SHCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.46.1.5', 'sensor_name' => 'ethernetNTEGE114SCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.49.1.5', 'sensor_name' => 'ethernetGE8ECCCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.53.1.5', 'sensor_name' => 'ethernetNTEGE112ProCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.54.1.5', 'sensor_name' => 'ethernetNTEGE112ProMCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.55.1.5', 'sensor_name' => 'ethernetNTEXG210CCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.56.1.5', 'sensor_name' => 'ethernetGE8SCryptoConnectorCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.57.1.5', 'sensor_name' => 'ethernetNTEGE114ProCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.58.1.5', 'sensor_name' => 'ethernetNTEGE114ProCCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.59.1.5', 'sensor_name' => 'ethernetNTEGE114ProSHCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.60.1.5', 'sensor_name' => 'ethernetNTEGE114ProCSHCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.61.1.5', 'sensor_name' => 'ethernetNTEGE114ProHECardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.62.1.5', 'sensor_name' => 'ethernetNTEGE112ProHCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.67.1.5', 'sensor_name' => 'ethernetNTEGE114ProVmHCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.68.1.5', 'sensor_name' => 'ethernetNTEGE114ProVmCHCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.69.1.5', 'sensor_name' => 'ethernetNTEGE114ProVmCSHCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.70.1.5', 'sensor_name' => 'serverCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.74.1.5', 'sensor_name' => 'ethernetNTEGE101ProCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.75.1.5', 'sensor_name' => 'ethernetNTEGO102ProSCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.76.1.5', 'sensor_name' => 'ethernetNTEGO102ProSPCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.80.1.5', 'sensor_name' => 'ethernetNTEXG116PROCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.81.1.5', 'sensor_name' => 'ethernetNTEXG120PROCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.82.1.5', 'sensor_name' => 'ethernetNTEGE112ProVmCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.85.1.5', 'sensor_name' => 'ethernetCSMCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.88.1.5', 'sensor_name' => 'ethernetNTEGE102ProHCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.89.1.5', 'sensor_name' => 'ethernetNTEGE102ProEFMHCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.91.1.5', 'sensor_name' => 'ethernetNTEXG116PROHCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.92.1.5', 'sensor_name' => 'ethernetNTEGO102ProSMCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.93.1.5', 'sensor_name' => 'ethernetNTEXG118PROSHCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.94.1.5', 'sensor_name' => 'ethernetNTEXG118PROACSHCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.95.1.5', 'sensor_name' => 'ethernetNTEGE114ProVmSHCardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.96.1.5', 'sensor_name' => 'ethernetNTEGE104CardVoltage'], - ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.97.1.5', 'sensor_name' => 'ethernetNTEXG120PROSHCardVoltage'], - ]; +// Define Sensors +$sensors_adva = [ + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.4.1.6', 'sensor_name' => 'psuOutputVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.6.1.5', 'sensor_name' => 'scuVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.7.1.5', 'sensor_name' => 'nemiVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.8.1.5', 'sensor_name' => 'ethernetNTUCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.9.1.5', 'sensor_name' => 'ethernetCPMRCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.10.1.5', 'sensor_name' => 'ethernetNTEGE101CardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.11.1.5', 'sensor_name' => 'ethernetNTEGE206CardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.13.1.5', 'sensor_name' => 'scuTVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.14.1.5', 'sensor_name' => 'ethernetNTECardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.15.1.5', 'sensor_name' => 'ethernetNTEGE201CardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.16.1.5', 'sensor_name' => 'ethernetNTEGE201SyncECardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.17.1.5', 'sensor_name' => 'ethernetNTEGE206FCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.25.1.5', 'sensor_name' => 'ethernetNTEGE112CardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.26.1.5', 'sensor_name' => 'ethernetNTEGE114CardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.27.1.5', 'sensor_name' => 'ethernetNTEGE206VCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.28.1.5', 'sensor_name' => 'ethernetGE4SCCCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.29.1.5', 'sensor_name' => 'ethernetGE4ECCCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.30.1.5', 'sensor_name' => 'ethernetNTEXG210CardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.31.1.5', 'sensor_name' => 'ethernetXG1XCCCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.32.1.5', 'sensor_name' => 'ethernetXG1SCCCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.38.1.5', 'sensor_name' => 'ethernetNTET1804CardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.39.1.5', 'sensor_name' => 'ethernetNTET3204CardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.41.1.5', 'sensor_name' => 'ethernetGE8SCCCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.42.1.5', 'sensor_name' => 'ethernetNTEGE114HCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.43.1.5', 'sensor_name' => 'ethernetNTEGE114PHCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.45.1.5', 'sensor_name' => 'ethernetNTEGE114SHCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.46.1.5', 'sensor_name' => 'ethernetNTEGE114SCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.49.1.5', 'sensor_name' => 'ethernetGE8ECCCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.53.1.5', 'sensor_name' => 'ethernetNTEGE112ProCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.54.1.5', 'sensor_name' => 'ethernetNTEGE112ProMCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.55.1.5', 'sensor_name' => 'ethernetNTEXG210CCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.56.1.5', 'sensor_name' => 'ethernetGE8SCryptoConnectorCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.57.1.5', 'sensor_name' => 'ethernetNTEGE114ProCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.58.1.5', 'sensor_name' => 'ethernetNTEGE114ProCCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.59.1.5', 'sensor_name' => 'ethernetNTEGE114ProSHCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.60.1.5', 'sensor_name' => 'ethernetNTEGE114ProCSHCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.61.1.5', 'sensor_name' => 'ethernetNTEGE114ProHECardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.62.1.5', 'sensor_name' => 'ethernetNTEGE112ProHCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.67.1.5', 'sensor_name' => 'ethernetNTEGE114ProVmHCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.68.1.5', 'sensor_name' => 'ethernetNTEGE114ProVmCHCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.69.1.5', 'sensor_name' => 'ethernetNTEGE114ProVmCSHCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.70.1.5', 'sensor_name' => 'serverCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.74.1.5', 'sensor_name' => 'ethernetNTEGE101ProCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.75.1.5', 'sensor_name' => 'ethernetNTEGO102ProSCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.76.1.5', 'sensor_name' => 'ethernetNTEGO102ProSPCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.80.1.5', 'sensor_name' => 'ethernetNTEXG116PROCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.81.1.5', 'sensor_name' => 'ethernetNTEXG120PROCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.82.1.5', 'sensor_name' => 'ethernetNTEGE112ProVmCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.85.1.5', 'sensor_name' => 'ethernetCSMCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.88.1.5', 'sensor_name' => 'ethernetNTEGE102ProHCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.89.1.5', 'sensor_name' => 'ethernetNTEGE102ProEFMHCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.91.1.5', 'sensor_name' => 'ethernetNTEXG116PROHCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.92.1.5', 'sensor_name' => 'ethernetNTEGO102ProSMCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.93.1.5', 'sensor_name' => 'ethernetNTEXG118PROSHCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.94.1.5', 'sensor_name' => 'ethernetNTEXG118PROACSHCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.95.1.5', 'sensor_name' => 'ethernetNTEGE114ProVmSHCardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.96.1.5', 'sensor_name' => 'ethernetNTEGE104CardVoltage'], + ['sensor_oid' => '.1.3.6.1.4.1.2544.1.12.3.1.97.1.5', 'sensor_name' => 'ethernetNTEXG120PROSHCardVoltage'], +]; - $multiplier = 1; - $divisor = 1000; +$multiplier = 1; +$divisor = 1000; - foreach (array_keys($pre_cache['adva_fsp150']) as $index) { - foreach ($sensors_adva as $entry) { - $sensor_name = $entry['sensor_name']; - if (isset($pre_cache['adva_fsp150'][$index][$sensor_name])) { - $oid = $entry['sensor_oid'] . '.' . $index; - $rrd_filename = $pre_cache['adva_fsp150'][$index]['slotCardUnitName'] . '-' . $pre_cache['adva_fsp150'][$index]['slotIndex']; - $descr = $pre_cache['adva_fsp150'][$index]['slotCardUnitName'] . ' [#' . $pre_cache['adva_fsp150'][$index]['slotIndex'] . ']'; - $current = $pre_cache['adva_fsp150'][$index][$entry['sensor_name']] / $divisor; +foreach (array_keys($pre_cache['adva_fsp150']) as $index) { + foreach ($sensors_adva as $entry) { + $sensor_name = $entry['sensor_name']; + if (isset($pre_cache['adva_fsp150'][$index][$sensor_name])) { + $oid = $entry['sensor_oid'] . '.' . $index; + $rrd_filename = $pre_cache['adva_fsp150'][$index]['slotCardUnitName'] . '-' . $pre_cache['adva_fsp150'][$index]['slotIndex']; + $descr = $pre_cache['adva_fsp150'][$index]['slotCardUnitName'] . ' [#' . $pre_cache['adva_fsp150'][$index]['slotIndex'] . ']'; + $current = $pre_cache['adva_fsp150'][$index][$entry['sensor_name']] / $divisor; - discover_sensor( - $valid['sensor'], - 'voltage', - $device, - $oid, - $entry['sensor_name'] . $index, - 'adva_fsp150', - $descr, - $divisor, - $multiplier, - null, - null, - null, - null, - $current - ); - }//End if sensor exists - }//End foreach $entry - }//End foreach $index - unset($sensors_adva, $entry); + discover_sensor( + $valid['sensor'], + 'voltage', + $device, + $oid, + $entry['sensor_name'] . $index, + 'adva_fsp150', + $descr, + $divisor, + $multiplier, + null, + null, + null, + null, + $current + ); + }//End if sensor exists + }//End foreach $entry +}//End foreach $index +unset($sensors_adva, $entry); // ************** End of Sensors for ADVA FSP150CC Series ********** diff --git a/includes/discovery/sensors/voltage/adva_fsp3kr7.inc.php b/includes/discovery/sensors/voltage/adva_fsp3kr7.inc.php index b6a37ce26a..8af7b1d3bf 100644 --- a/includes/discovery/sensors/voltage/adva_fsp3kr7.inc.php +++ b/includes/discovery/sensors/voltage/adva_fsp3kr7.inc.php @@ -20,8 +20,8 @@ // ***** Sensors for ADVA FSP3000 R7 // ************************************************************* - $multiplier = 1; - $divisor = 1000; +$multiplier = 1; +$divisor = 1000; if (is_array($pre_cache['adva_fsp3kr7_Card'])) { foreach (array_keys($pre_cache['adva_fsp3kr7_Card']) as $index) { diff --git a/includes/discovery/sensors/voltage/apc.inc.php b/includes/discovery/sensors/voltage/apc.inc.php index e61d5c5778..5d0652b285 100644 --- a/includes/discovery/sensors/voltage/apc.inc.php +++ b/includes/discovery/sensors/voltage/apc.inc.php @@ -28,8 +28,8 @@ unset($oids); //Three Phase Detection & Support $phasecount = $pre_cache['apcups_phase_count']; - d_echo($phasecount); - d_echo($pre_cache['apcups_phase_count']); +d_echo($phasecount); +d_echo($pre_cache['apcups_phase_count']); // Check for three phase UPS devices - else skip to normal discovery if ($phasecount > 1) { $oids = snmpwalk_cache_oid($device, 'upsPhaseOutputVoltage', $oids, 'PowerNet-MIB'); @@ -72,7 +72,7 @@ if ($phasecount > 1) { if ($data) { [$oid, $current] = explode(' ', $data, 2); $split_oid = explode('.', $oid); - $index = $split_oid[(count($split_oid) - 3)]; + $index = $split_oid[count($split_oid) - 3]; $oid = '.1.3.6.1.4.1.318.1.1.8.5.3.3.1.3.' . $index . '.1.1'; $descr = 'Input Feed ' . chr(64 + $index); discover_sensor($valid['sensor'], 'voltage', $device, $oid, "3.3.1.3.$index", $type, $descr, $divisor, '1', null, null, null, null, $current); @@ -90,7 +90,7 @@ if ($phasecount > 1) { if ($data) { [$oid, $current] = explode(' ', $data, 2); $split_oid = explode('.', $oid); - $index = $split_oid[(count($split_oid) - 3)]; + $index = $split_oid[count($split_oid) - 3]; $oid = '.1.3.6.1.4.1.318.1.1.8.5.4.3.1.3.' . $index . '.1.1'; $descr = 'Output Feed'; if (count(explode("\n", $oids)) > 1) { diff --git a/includes/discovery/sensors/voltage/areca.inc.php b/includes/discovery/sensors/voltage/areca.inc.php index 2913f40073..d0119ba3c8 100644 --- a/includes/discovery/sensors/voltage/areca.inc.php +++ b/includes/discovery/sensors/voltage/areca.inc.php @@ -13,7 +13,7 @@ if ($oids) { if ($data) { [$oid,$descr] = explode(' ', $data, 2); $split_oid = explode('.', $oid); - $index = $split_oid[(count($split_oid) - 1)]; + $index = $split_oid[count($split_oid) - 1]; $oid = '.1.3.6.1.4.1.18928.1.2.2.1.8.1.3.' . $index; $current = (snmp_get($device, $oid, '-Oqv', '') / $divisor); if (trim($descr, '"') != 'Battery Status') { diff --git a/includes/discovery/sensors/voltage/linux.inc.php b/includes/discovery/sensors/voltage/linux.inc.php index 755284ce51..e9851d5a6f 100644 --- a/includes/discovery/sensors/voltage/linux.inc.php +++ b/includes/discovery/sensors/voltage/linux.inc.php @@ -45,7 +45,7 @@ foreach (explode("\n", $oids) as $data) { if ($data) { [$oid,$kind] = explode(' ', $data); $split_oid = explode('.', $oid); - $index = $split_oid[(count($split_oid) - 1)]; + $index = $split_oid[count($split_oid) - 1]; if ($kind == 1) { $volt_oid = '.1.3.6.1.4.1.10876.2.1.1.1.1.4.' . $index; $descr_oid = '.1.3.6.1.4.1.10876.2.1.1.1.1.2.' . $index; diff --git a/includes/discovery/sensors/voltage/netagent2.inc.php b/includes/discovery/sensors/voltage/netagent2.inc.php index 95205803f1..6b98758e30 100644 --- a/includes/discovery/sensors/voltage/netagent2.inc.php +++ b/includes/discovery/sensors/voltage/netagent2.inc.php @@ -30,38 +30,38 @@ // Config // RRD graph color start value - $index = 0; // Text color number to start increasing +1 +$index = 0; // Text color number to start increasing +1 // Voltage levels - EU and UK 230 volts +10% - 6% (ie. between 216.2 volts and 253 volts) - $limit = 270; // Maximum graph level - $warnlimit = 253; // Warning limit (High) - $lowlimit = 210; // Minimum graph level - $lowwarnlimit = 216; // Warning limit (Low) - $divisor1phase = 10; // Divisor to set sensor input value (eg. value 2324/10=232,4 Volts) - $divisor3phase = 10; // Divisor to set sensor input value (eg. value 22/1=22 Volts) +$limit = 270; // Maximum graph level +$warnlimit = 253; // Warning limit (High) +$lowlimit = 210; // Minimum graph level +$lowwarnlimit = 216; // Warning limit (Low) +$divisor1phase = 10; // Divisor to set sensor input value (eg. value 2324/10=232,4 Volts) +$divisor3phase = 10; // Divisor to set sensor input value (eg. value 22/1=22 Volts) // UPS single-phase battery system values - $bat_1phase_limit = 30; // Remember to check correct values - $bat_1phase_warnlimit = 28; - $bat_1phase_lowlimit = 10; - $bat_1phase_lowwarnlimit = 18; - $bat_1phase_divisor = 10; +$bat_1phase_limit = 30; // Remember to check correct values +$bat_1phase_warnlimit = 28; +$bat_1phase_lowlimit = 10; +$bat_1phase_lowwarnlimit = 18; +$bat_1phase_divisor = 10; // UPS 3 phase battery system values - $bat_3phase_limit = 270; // Remember to check correct values - $bat_3phase_warnlimit = 270; - $bat_3phase_lowlimit = 210; - $bat_3phase_lowwarnlimit = 215; - $bat_3phase_divisor = 10; +$bat_3phase_limit = 270; // Remember to check correct values +$bat_3phase_warnlimit = 270; +$bat_3phase_lowlimit = 210; +$bat_3phase_lowwarnlimit = 215; +$bat_3phase_divisor = 10; // Detect type of UPS (Signle-Phase/3 Phase) // Number of input lines - $upsInputNumLines_oid = '.1.3.6.1.2.1.33.1.3.2.0'; - $in_phaseNum = snmp_get($device, $upsInputNumLines_oid, '-Oqv'); +$upsInputNumLines_oid = '.1.3.6.1.2.1.33.1.3.2.0'; +$in_phaseNum = snmp_get($device, $upsInputNumLines_oid, '-Oqv'); - // Number of output lines - $upsOutputNumLines_oid = '.1.3.6.1.2.1.33.1.4.3.0'; - $out_phaseNum = snmp_get($device, $upsOutputNumLines_oid, '-Oqv'); +// Number of output lines +$upsOutputNumLines_oid = '.1.3.6.1.2.1.33.1.4.3.0'; +$out_phaseNum = snmp_get($device, $upsOutputNumLines_oid, '-Oqv'); // INPUT single-phase system if ($in_phaseNum == '1') { diff --git a/includes/discovery/sensors/voltage/unix.inc.php b/includes/discovery/sensors/voltage/unix.inc.php index 417f43b084..de20d301f7 100644 --- a/includes/discovery/sensors/voltage/unix.inc.php +++ b/includes/discovery/sensors/voltage/unix.inc.php @@ -14,7 +14,7 @@ if ($oids) { if ($data) { [$oid,$descr] = explode(' ', $data, 2); $split_oid = explode('.', $oid); - $index = $split_oid[(count($split_oid) - 1)]; + $index = $split_oid[count($split_oid) - 1]; $oid = '.1.3.6.1.4.1.2021.13.16.4.1.3.' . $index; $current = floatval(snmp_get($device, $oid, '-Oqv', 'LM-SENSORS-MIB')) / $divisor; diff --git a/includes/discovery/services.inc.php b/includes/discovery/services.inc.php index 24c499833c..1332fe8924 100644 --- a/includes/discovery/services.inc.php +++ b/includes/discovery/services.inc.php @@ -26,7 +26,7 @@ if (Config::get('discover_services')) { [$oid, $tcpstatus] = explode(' ', $data); if (trim($tcpstatus) == 'listen') { $split_oid = explode('.', $oid); - $tcp_port = $split_oid[(count($split_oid) - 6)]; + $tcp_port = $split_oid[count($split_oid) - 6]; if ($known_services[$tcp_port]) { discover_service($device, $known_services[$tcp_port]); } diff --git a/includes/discovery/vrf.inc.php b/includes/discovery/vrf.inc.php index c9ec67486b..fcc1848815 100644 --- a/includes/discovery/vrf.inc.php +++ b/includes/discovery/vrf.inc.php @@ -67,7 +67,7 @@ if (Config::get('enable_vrfs')) { $t = explode(' ', $port); $dotpos = strrpos($t[0], '.'); $vrf_oid = substr($t[0], 0, $dotpos); - $port_id = substr($t[0], ($dotpos + 1)); + $port_id = substr($t[0], $dotpos + 1); if (empty($port_table[$vrf_oid])) { $port_table[$vrf_oid][0] = $port_id; diff --git a/includes/functions.php b/includes/functions.php index a08a8de048..18beee5a50 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -245,7 +245,7 @@ function addHost($host, $snmp_version = '', $port = 161, $transport = 'udp', $po // Test reachability if (! $force_add) { - if (! ((new \LibreNMS\Polling\ConnectivityHelper(new Device(['hostname' => $ip])))->isPingable()->success())) { + if (! (new \LibreNMS\Polling\ConnectivityHelper(new Device(['hostname' => $ip])))->isPingable()->success()) { throw new HostUnreachablePingException($host); } } @@ -970,7 +970,7 @@ function create_sensor_to_state_index($device, $state_name, $index) function delta_to_bits($delta, $period) { - return round(($delta * 8 / $period), 2); + return round($delta * 8 / $period, 2); } function report_this($message) diff --git a/includes/html/collectd/functions.php b/includes/html/collectd/functions.php index 2402ae0db0..d52a0565a6 100644 --- a/includes/html/collectd/functions.php +++ b/includes/html/collectd/functions.php @@ -139,7 +139,7 @@ function collectd_list_pinsts($arg_host, $arg_plugin) if ($dent != '.' && $dent != '..' && is_dir($datadir . '/' . $arg_host . '/' . $dent)) { if ($i = strpos($dent, '-')) { $plugin = substr($dent, 0, $i); - $pinst = substr($dent, ($i + 1)); + $pinst = substr($dent, $i + 1); } else { $plugin = $dent; $pinst = ''; @@ -165,7 +165,9 @@ function collectd_list_pinsts($arg_host, $arg_plugin) * Fetch list of types found in collectd's datadirs for given host+plugin+instance * * @arg_host Name of host + * * @arg_plugin Name of plugin + * * @arg_pinst Plugin instance * * @return array Sorted list of types (sorted alphabetically) @@ -181,8 +183,8 @@ function collectd_list_types($arg_host, $arg_plugin, $arg_pinst) foreach (Config::get('datadirs') as $datadir) { if (preg_match(REGEXP_HOST, $arg_host) && ($d = @opendir($datadir . '/' . $arg_host . '/' . $my_plugin))) { while (($dent = readdir($d)) !== false) { - if ($dent != '.' && $dent != '..' && is_file($datadir . '/' . $arg_host . '/' . $my_plugin . '/' . $dent) && substr($dent, (strlen($dent) - 4)) == '.rrd') { - $dent = substr($dent, 0, (strlen($dent) - 4)); + if ($dent != '.' && $dent != '..' && is_file($datadir . '/' . $arg_host . '/' . $my_plugin . '/' . $dent) && substr($dent, strlen($dent) - 4) == '.rrd') { + $dent = substr($dent, 0, strlen($dent) - 4); if ($i = strpos($dent, '-')) { $types[] = substr($dent, 0, $i); } else { @@ -205,8 +207,11 @@ function collectd_list_types($arg_host, $arg_plugin, $arg_pinst) * Fetch list of type instances found in collectd's datadirs for given host+plugin+instance+type * * @arg_host Name of host + * * @arg_plugin Name of plugin + * * @arg_pinst Plugin instance + * * @arg_type Type * * @return array Sorted list of type instances (sorted alphabetically) @@ -222,11 +227,11 @@ function collectd_list_tinsts($arg_host, $arg_plugin, $arg_pinst, $arg_type) foreach (Config::get('datadirs') as $datadir) { if (preg_match(REGEXP_HOST, $arg_host) && ($d = @opendir($datadir . '/' . $arg_host . '/' . $my_plugin))) { while (($dent = readdir($d)) !== false) { - if ($dent != '.' && $dent != '..' && is_file($datadir . '/' . $arg_host . '/' . $my_plugin . '/' . $dent) && substr($dent, (strlen($dent) - 4)) == '.rrd') { - $dent = substr($dent, 0, (strlen($dent) - 4)); + if ($dent != '.' && $dent != '..' && is_file($datadir . '/' . $arg_host . '/' . $my_plugin . '/' . $dent) && substr($dent, strlen($dent) - 4) == '.rrd') { + $dent = substr($dent, 0, strlen($dent) - 4); if ($i = strpos($dent, '-')) { $type = substr($dent, 0, $i); - $tinst = substr($dent, ($i + 1)); + $tinst = substr($dent, $i + 1); } else { $type = $dent; $tinst = ''; @@ -275,7 +280,7 @@ function collectd_identifier($host, $plugin, $type, $pinst, $tinst) if ($rrd_realpath) { $identifier = basename($rrd_realpath); - $identifier = substr($identifier, 0, (strlen($identifier) - 4)); + $identifier = substr($identifier, 0, strlen($identifier) - 4); $rrd_realpath = dirname($rrd_realpath); $identifier = basename($rrd_realpath) . '/' . $identifier; $rrd_realpath = dirname($rrd_realpath); @@ -351,8 +356,8 @@ function collectd_flush($identifier) */ function rrd_strip_quotes($str) { - if ($str[0] == '"' && $str[(strlen($str) - 1)] == '"') { - return substr($str, 1, (strlen($str) - 2)); + if ($str[0] == '"' && $str[strlen($str) - 1] == '"') { + return substr($str, 1, strlen($str) - 2); } else { return $str; } @@ -377,16 +382,16 @@ function _rrd_info($file) } $key = trim(substr($s, 0, $p)); - $value = trim(substr($s, ($p + 1))); + $value = trim(substr($s, $p + 1)); if (strncmp($key, 'ds[', 3) == 0) { // DS definition $p = strpos($key, ']'); - $ds = substr($key, 3, ($p - 3)); + $ds = substr($key, 3, $p - 3); if (! isset($info['DS'])) { $info['DS'] = []; } - $ds_key = substr($key, ($p + 2)); + $ds_key = substr($key, $p + 2); if (strpos($ds_key, '[') === false) { if (! isset($info['DS']["$ds"])) { @@ -398,12 +403,12 @@ function _rrd_info($file) } elseif (strncmp($key, 'rra[', 4) == 0) { // RRD definition $p = strpos($key, ']'); - $rra = substr($key, 4, ($p - 4)); + $rra = substr($key, 4, $p - 4); if (! isset($info['RRA'])) { $info['RRA'] = []; } - $rra_key = substr($key, ($p + 2)); + $rra_key = substr($key, $p + 2); if (strpos($rra_key, '[') === false) { if (! isset($info['RRA']["$rra"])) { @@ -552,7 +557,7 @@ function collectd_draw_rrd($host, $plugin, $type, $pinst = null, $tinst = null, reset($rrdinfo['DS']); $n = 1; foreach ($rrdinfo['DS'] as $k => $v) { - $graph[] = sprintf('LINE1:%s_avg#%s:%s ', $k, rrd_get_color($n++, true), $k . substr(' ', 0, ($l_max - strlen($k)))); + $graph[] = sprintf('LINE1:%s_avg#%s:%s ', $k, rrd_get_color($n++, true), $k . substr(' ', 0, $l_max - strlen($k))); if (isset($opts['tinylegend']) && $opts['tinylegend']) { continue; } diff --git a/includes/html/forms/alert-rules.inc.php b/includes/html/forms/alert-rules.inc.php index 948c87b5c2..11f68d6733 100644 --- a/includes/html/forms/alert-rules.inc.php +++ b/includes/html/forms/alert-rules.inc.php @@ -58,7 +58,7 @@ $mute = isset($_POST['mute']) ? $_POST['mute'] : null; $invert = isset($_POST['invert']) ? $_POST['invert'] : null; $name = strip_tags($_POST['name']); $proc = $_POST['proc']; -$recovery = ($vars['recovery']); +$recovery = $vars['recovery']; $invert_map = isset($_POST['invert_map']) ? $_POST['invert_map'] : null; $severity = $_POST['severity']; diff --git a/includes/html/forms/customoid.inc.php b/includes/html/forms/customoid.inc.php index e3dc73103c..42a3165832 100644 --- a/includes/html/forms/customoid.inc.php +++ b/includes/html/forms/customoid.inc.php @@ -18,7 +18,7 @@ $action = $_POST['action']; $name = strip_tags($_POST['name']); $oid = strip_tags($_POST['oid']); $datatype = strip_tags($_POST['datatype']); -if (! empty(($_POST['unit']))) { +if (! empty($_POST['unit'])) { $unit = $_POST['unit']; } else { $unit = ['NULL']; @@ -31,7 +31,7 @@ $alerts = ($_POST['alerts'] == 'on' ? 1 : 0); $passed = ($_POST['passed'] == 'on' ? 1 : 0); $divisor = set_numeric($_POST['divisor'], 1); $multiplier = set_numeric($_POST['multiplier'], 1); -if (! empty(($_POST['user_func']))) { +if (! empty($_POST['user_func'])) { $user_func = $_POST['user_func']; } else { $user_func = ['NULL']; diff --git a/includes/html/forms/parse-poller-groups.inc.php b/includes/html/forms/parse-poller-groups.inc.php index 105a84d20b..a10f3150b9 100644 --- a/includes/html/forms/parse-poller-groups.inc.php +++ b/includes/html/forms/parse-poller-groups.inc.php @@ -17,7 +17,7 @@ if (! Auth::user()->hasGlobalAdmin()) { exit('ERROR: You need to be admin'); } -$group_id = ($_POST['group_id']); +$group_id = $_POST['group_id']; if (is_numeric($group_id) && $group_id > 0) { $group = dbFetchRow('SELECT * FROM `poller_groups` WHERE `id` = ? LIMIT 1', [$group_id]); diff --git a/includes/html/graphs/application/shoutcast_multi_stats.inc.php b/includes/html/graphs/application/shoutcast_multi_stats.inc.php index fb3c84b6b2..4ecf7c5ad2 100644 --- a/includes/html/graphs/application/shoutcast_multi_stats.inc.php +++ b/includes/html/graphs/application/shoutcast_multi_stats.inc.php @@ -30,15 +30,15 @@ if ($width > '500') { } if ($width > '500') { - $rrd_options .= ' COMMENT:"' . substr(str_pad($unit_text, ($descr_len + 2)), 0, ($descr_len + 2)) . ' Current Unique Average Peak\\n"'; + $rrd_options .= ' COMMENT:"' . substr(str_pad($unit_text, $descr_len + 2), 0, $descr_len + 2) . ' Current Unique Average Peak\\n"'; } else { - $rrd_options .= ' COMMENT:"' . substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5)) . ' Now Unique Average Peak\\n"'; + $rrd_options .= ' COMMENT:"' . substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5) . ' Now Unique Average Peak\\n"'; } foreach ($rrd_list as $rrd) { $colours = (isset($rrd['colour']) ? $rrd['colour'] : 'default'); $strlen = ((strlen($rrd['descr']) < $descr_len) ? ($descr_len - strlen($rrd['descr'])) : '0'); - $descr = (isset($rrd['descr']) ? \LibreNMS\Data\Store\Rrd::fixedSafeDescr($rrd['descr'], ($desc_len + $strlen)) : 'Unknown'); + $descr = (isset($rrd['descr']) ? \LibreNMS\Data\Store\Rrd::fixedSafeDescr($rrd['descr'], $desc_len + $strlen) : 'Unknown'); for ($z = 0; $z < $strlen; $z++) { $descr .= ' '; } @@ -70,7 +70,7 @@ foreach ($rrd_list as $rrd) { if (! $nototal) { $strlen = ((strlen($total_text) < $descr_len) ? ($descr_len - strlen($total_text)) : '0'); - $descr = (isset($total_text) ? \LibreNMS\Data\Store\Rrd::fixedSafeDescr($total_text, ($desc_len + $strlen)) : 'Total'); + $descr = (isset($total_text) ? \LibreNMS\Data\Store\Rrd::fixedSafeDescr($total_text, $desc_len + $strlen) : 'Total'); $colour = \LibreNMS\Config::get("graph_colours.$colours.$x"); for ($z = 0; $z < $strlen; $z++) { $descr .= ' '; diff --git a/includes/html/graphs/bill/bits.inc.php b/includes/html/graphs/bill/bits.inc.php index 89edb1d3bd..ea755f2c8c 100644 --- a/includes/html/graphs/bill/bits.inc.php +++ b/includes/html/graphs/bill/bits.inc.php @@ -35,7 +35,7 @@ $ds_out = 'OUTOCTETS'; if ($bill['bill_type'] == 'cdr') { $custom_graph = " COMMENT:'\\r' "; $custom_graph .= ' HRULE:' . $rates['rate_95th'] . "#cc0000:'95th %ile \: " . Number::formatSi($rates['rate_95th'], 2, 3, - 'bps') . ' (' . $rates['dir_95th'] . ') (CDR\: ' . Number::formatSi($bill['bill_cdr'], 2, 3, 'bps') . ")'"; + 'bps') . ' (' . $rates['dir_95th'] . ') (CDR\: ' . Number::formatSi($bill['bill_cdr'], 2, 3, 'bps') . ")'"; $custom_graph .= ' HRULE:' . ($rates['rate_95th'] * -1) . '#cc0000'; } elseif ($bill['bill_type'] == 'quota') { $custom_graph = " COMMENT:'\\r' "; diff --git a/includes/html/graphs/bill/historicbits.inc.php b/includes/html/graphs/bill/historicbits.inc.php index 8c0b2a3d67..373561a867 100644 --- a/includes/html/graphs/bill/historicbits.inc.php +++ b/includes/html/graphs/bill/historicbits.inc.php @@ -10,7 +10,7 @@ if (is_numeric($bill_hist_id)) { if ($reducefactor < 2) { $extents = dbFetchRow('SELECT UNIX_TIMESTAMP(bill_datefrom) as `from`, UNIX_TIMESTAMP(bill_dateto) AS `to`FROM bill_history WHERE bill_id = ? AND bill_hist_id = ?', [$bill_id, $bill_hist_id]); $dur = $extents['to'] - $extents['from']; - $reducefactor = round(($dur / 300 / (($vars['height'] - 100) * 3)), 0); + $reducefactor = round($dur / 300 / (($vars['height'] - 100) * 3), 0); if ($reducefactor < 2) { $reducefactor = 2; @@ -20,7 +20,7 @@ if (is_numeric($bill_hist_id)) { } else { if ($reducefactor < 2) { $dur = $vars['to'] - $vars['from']; - $reducefactor = round(($dur / 300 / (($vars['height'] - 100) * 3)), 0); + $reducefactor = round($dur / 300 / (($vars['height'] - 100) * 3), 0); if ($reducefactor < 2) { $reducefactor = 2; @@ -35,7 +35,7 @@ if (is_numeric($bill_hist_id)) { $n = count($graph_data['ticks']); $xmin = $graph_data['ticks'][0]; -$xmax = $graph_data['ticks'][($n - 1)]; +$xmax = $graph_data['ticks'][$n - 1]; function TimeCallback($aVal) { diff --git a/includes/html/graphs/device/cisco-iosdsp.inc.php b/includes/html/graphs/device/cisco-iosdsp.inc.php index 7dbfd03c4c..7be5d116e6 100644 --- a/includes/html/graphs/device/cisco-iosdsp.inc.php +++ b/includes/html/graphs/device/cisco-iosdsp.inc.php @@ -12,23 +12,23 @@ * the source code distribution for details. */ -include 'includes/html/graphs/common.inc.php'; -$rrd_options .= ' -l 0 -E '; -$rrd_filename = Rrd::name($device['hostname'], 'cisco-iosdsp'); + include 'includes/html/graphs/common.inc.php'; + $rrd_options .= ' -l 0 -E '; + $rrd_filename = Rrd::name($device['hostname'], 'cisco-iosdsp'); -if (Rrd::checkRrdExists($rrd_filename)) { - $rrd_options .= " COMMENT:' Cur Min Max\\n'"; - $rrd_options .= ' DEF:Total=' . $rrd_filename . ':total:AVERAGE '; - $rrd_options .= ' AREA:Total#c099ff '; - $rrd_options .= " LINE1.25:Total#0000ee:'DSPs total ' "; - $rrd_options .= ' GPRINT:Total:LAST:%3.0lf '; - $rrd_options .= ' GPRINT:Total:MIN:%3.0lf '; - $rrd_options .= " GPRINT:Total:MAX:%3.0lf\l "; + if (Rrd::checkRrdExists($rrd_filename)) { + $rrd_options .= " COMMENT:' Cur Min Max\\n'"; + $rrd_options .= ' DEF:Total=' . $rrd_filename . ':total:AVERAGE '; + $rrd_options .= ' AREA:Total#c099ff '; + $rrd_options .= " LINE1.25:Total#0000ee:'DSPs total ' "; + $rrd_options .= ' GPRINT:Total:LAST:%3.0lf '; + $rrd_options .= ' GPRINT:Total:MIN:%3.0lf '; + $rrd_options .= " GPRINT:Total:MAX:%3.0lf\l "; - $rrd_options .= ' DEF:Active=' . $rrd_filename . ':active:AVERAGE '; - $rrd_options .= ' AREA:Active#aaff99 '; - $rrd_options .= " LINE1.25:Active#00ee00:'DSPs in use ' "; - $rrd_options .= ' GPRINT:Active:LAST:%3.0lf '; - $rrd_options .= ' GPRINT:Active:MIN:%3.0lf '; - $rrd_options .= " GPRINT:Active:MAX:%3.0lf\l "; -} + $rrd_options .= ' DEF:Active=' . $rrd_filename . ':active:AVERAGE '; + $rrd_options .= ' AREA:Active#aaff99 '; + $rrd_options .= " LINE1.25:Active#00ee00:'DSPs in use ' "; + $rrd_options .= ' GPRINT:Active:LAST:%3.0lf '; + $rrd_options .= ' GPRINT:Active:MIN:%3.0lf '; + $rrd_options .= " GPRINT:Active:MAX:%3.0lf\l "; + } diff --git a/includes/html/graphs/device/cisco-iosmtp.inc.php b/includes/html/graphs/device/cisco-iosmtp.inc.php index 87c72b65dd..561065600a 100644 --- a/includes/html/graphs/device/cisco-iosmtp.inc.php +++ b/includes/html/graphs/device/cisco-iosmtp.inc.php @@ -12,23 +12,23 @@ * the source code distribution for details. */ -include 'includes/html/graphs/common.inc.php'; -$rrd_options .= ' -l 0 -E '; -$rrd_filename = Rrd::name($device['hostname'], 'cisco-iosmtp'); + include 'includes/html/graphs/common.inc.php'; + $rrd_options .= ' -l 0 -E '; + $rrd_filename = Rrd::name($device['hostname'], 'cisco-iosmtp'); -if (Rrd::checkRrdExists($rrd_filename)) { - $rrd_options .= " COMMENT:' Cur Min Max\\n'"; - $rrd_options .= ' DEF:Total=' . $rrd_filename . ':total:AVERAGE '; - $rrd_options .= ' AREA:Total#c099ff '; - $rrd_options .= " LINE1.25:Total#0000ee:'Hardware MTP total ' "; - $rrd_options .= ' GPRINT:Total:LAST:%3.0lf '; - $rrd_options .= ' GPRINT:Total:MIN:%3.0lf '; - $rrd_options .= " GPRINT:Total:MAX:%3.0lf\\\l "; + if (Rrd::checkRrdExists($rrd_filename)) { + $rrd_options .= " COMMENT:' Cur Min Max\\n'"; + $rrd_options .= ' DEF:Total=' . $rrd_filename . ':total:AVERAGE '; + $rrd_options .= ' AREA:Total#c099ff '; + $rrd_options .= " LINE1.25:Total#0000ee:'Hardware MTP total ' "; + $rrd_options .= ' GPRINT:Total:LAST:%3.0lf '; + $rrd_options .= ' GPRINT:Total:MIN:%3.0lf '; + $rrd_options .= " GPRINT:Total:MAX:%3.0lf\\\l "; - $rrd_options .= ' DEF:Active=' . $rrd_filename . ':active:AVERAGE '; - $rrd_options .= ' AREA:Active#aaff99 '; - $rrd_options .= " LINE1.25:Active#00ee00:'Hardware MTP in use ' "; - $rrd_options .= ' GPRINT:Active:LAST:%3.0lf '; - $rrd_options .= ' GPRINT:Active:MIN:%3.0lf '; - $rrd_options .= " GPRINT:Active:MAX:%3.0lf\\\l "; -} + $rrd_options .= ' DEF:Active=' . $rrd_filename . ':active:AVERAGE '; + $rrd_options .= ' AREA:Active#aaff99 '; + $rrd_options .= " LINE1.25:Active#00ee00:'Hardware MTP in use ' "; + $rrd_options .= ' GPRINT:Active:LAST:%3.0lf '; + $rrd_options .= ' GPRINT:Active:MIN:%3.0lf '; + $rrd_options .= " GPRINT:Active:MAX:%3.0lf\\\l "; + } diff --git a/includes/html/graphs/device/cisco-iospri.inc.php b/includes/html/graphs/device/cisco-iospri.inc.php index 165fea75ff..ef1b6927e3 100644 --- a/includes/html/graphs/device/cisco-iospri.inc.php +++ b/includes/html/graphs/device/cisco-iospri.inc.php @@ -12,23 +12,23 @@ * the source code distribution for details. */ -include 'includes/html/graphs/common.inc.php'; -$rrd_options .= ' -l 0 -E '; -$rrd_filename = Rrd::name($device['hostname'], 'cisco-iospri'); + include 'includes/html/graphs/common.inc.php'; + $rrd_options .= ' -l 0 -E '; + $rrd_filename = Rrd::name($device['hostname'], 'cisco-iospri'); -if (Rrd::checkRrdExists($rrd_filename)) { - $rrd_options .= " COMMENT:' Cur Min Max\\n'"; - $rrd_options .= ' DEF:Total=' . $rrd_filename . ':total:AVERAGE '; - $rrd_options .= ' AREA:Total#c099ff '; - $rrd_options .= " LINE1.25:Total#0000ee:'PRI Channels total ' "; - $rrd_options .= ' GPRINT:Total:LAST:%3.0lf '; - $rrd_options .= ' GPRINT:Total:MIN:%3.0lf '; - $rrd_options .= " GPRINT:Total:MAX:%3.0lf\l "; + if (Rrd::checkRrdExists($rrd_filename)) { + $rrd_options .= " COMMENT:' Cur Min Max\\n'"; + $rrd_options .= ' DEF:Total=' . $rrd_filename . ':total:AVERAGE '; + $rrd_options .= ' AREA:Total#c099ff '; + $rrd_options .= " LINE1.25:Total#0000ee:'PRI Channels total ' "; + $rrd_options .= ' GPRINT:Total:LAST:%3.0lf '; + $rrd_options .= ' GPRINT:Total:MIN:%3.0lf '; + $rrd_options .= " GPRINT:Total:MAX:%3.0lf\l "; - $rrd_options .= ' DEF:Active=' . $rrd_filename . ':active:AVERAGE '; - $rrd_options .= ' AREA:Active#aaff99 '; - $rrd_options .= " LINE1.25:Active#00ee00:'PRI Channels in use ' "; - $rrd_options .= ' GPRINT:Active:LAST:%3.0lf '; - $rrd_options .= ' GPRINT:Active:MIN:%3.0lf '; - $rrd_options .= " GPRINT:Active:MAX:%3.0lf\l "; -} + $rrd_options .= ' DEF:Active=' . $rrd_filename . ':active:AVERAGE '; + $rrd_options .= ' AREA:Active#aaff99 '; + $rrd_options .= " LINE1.25:Active#00ee00:'PRI Channels in use ' "; + $rrd_options .= ' GPRINT:Active:LAST:%3.0lf '; + $rrd_options .= ' GPRINT:Active:MIN:%3.0lf '; + $rrd_options .= " GPRINT:Active:MAX:%3.0lf\l "; + } diff --git a/includes/html/graphs/device/cisco-iosxcode.inc.php b/includes/html/graphs/device/cisco-iosxcode.inc.php index 7a673a75fd..eebe9e7031 100644 --- a/includes/html/graphs/device/cisco-iosxcode.inc.php +++ b/includes/html/graphs/device/cisco-iosxcode.inc.php @@ -12,23 +12,23 @@ * the source code distribution for details. */ -include 'includes/html/graphs/common.inc.php'; -$rrd_options .= ' -l 0 -E '; -$rrd_filename = Rrd::name($device['hostname'], 'cisco-iosxcode'); + include 'includes/html/graphs/common.inc.php'; + $rrd_options .= ' -l 0 -E '; + $rrd_filename = Rrd::name($device['hostname'], 'cisco-iosxcode'); -if (Rrd::checkRrdExists($rrd_filename)) { - $rrd_options .= " COMMENT:' Cur Min Max\\n'"; - $rrd_options .= ' DEF:Total=' . $rrd_filename . ':total:AVERAGE '; - $rrd_options .= ' AREA:Total#c099ff '; - $rrd_options .= " LINE1.25:Total#0000ee:'Transcoder Resources Total ' "; - $rrd_options .= ' GPRINT:Total:LAST:%3.0lf '; - $rrd_options .= ' GPRINT:Total:MIN:%3.0lf '; - $rrd_options .= " GPRINT:Total:MAX:%3.0lf\\\l "; + if (Rrd::checkRrdExists($rrd_filename)) { + $rrd_options .= " COMMENT:' Cur Min Max\\n'"; + $rrd_options .= ' DEF:Total=' . $rrd_filename . ':total:AVERAGE '; + $rrd_options .= ' AREA:Total#c099ff '; + $rrd_options .= " LINE1.25:Total#0000ee:'Transcoder Resources Total ' "; + $rrd_options .= ' GPRINT:Total:LAST:%3.0lf '; + $rrd_options .= ' GPRINT:Total:MIN:%3.0lf '; + $rrd_options .= " GPRINT:Total:MAX:%3.0lf\\\l "; - $rrd_options .= ' DEF:Active=' . $rrd_filename . ':active:AVERAGE '; - $rrd_options .= ' AREA:Active#aaff99 '; - $rrd_options .= " LINE1.25:Active#00ee00:'Transcoder Resources in use ' "; - $rrd_options .= ' GPRINT:Active:LAST:%3.0lf '; - $rrd_options .= ' GPRINT:Active:MIN:%3.0lf '; - $rrd_options .= " GPRINT:Active:MAX:%3.0lf\\\l "; -} + $rrd_options .= ' DEF:Active=' . $rrd_filename . ':active:AVERAGE '; + $rrd_options .= ' AREA:Active#aaff99 '; + $rrd_options .= " LINE1.25:Active#00ee00:'Transcoder Resources in use ' "; + $rrd_options .= ' GPRINT:Active:LAST:%3.0lf '; + $rrd_options .= ' GPRINT:Active:MIN:%3.0lf '; + $rrd_options .= " GPRINT:Active:MAX:%3.0lf\\\l "; + } diff --git a/includes/html/graphs/device/cisco-voice-ip.inc.php b/includes/html/graphs/device/cisco-voice-ip.inc.php index d91d5999bc..87a671374b 100644 --- a/includes/html/graphs/device/cisco-voice-ip.inc.php +++ b/includes/html/graphs/device/cisco-voice-ip.inc.php @@ -12,48 +12,48 @@ * the source code distribution for details. */ -include 'includes/html/graphs/common.inc.php'; -$rrd_options .= ' -l 0 -E '; -$rrd_filename = Rrd::name($device['hostname'], 'cisco-voice-ip'); -if (Rrd::checkRrdExists($rrd_filename)) { - $rrd_options .= " COMMENT:' Cur Min Max\\n'"; - $rrd_options .= ' DEF:sip=' . $rrd_filename . ':sip:AVERAGE '; - $rrd_options .= ' DEF:sip_max=' . $rrd_filename . ':sip:MAX'; - $rrd_options .= ' AREA:sip_max#c099ff77 '; - $rrd_options .= " LINE1.25:sip#0000ee:'sip active calls ' "; - $rrd_options .= ' GPRINT:sip:LAST:%3.0lf '; - $rrd_options .= ' GPRINT:sip:MIN:%3.0lf '; - $rrd_options .= " GPRINT:sip_max:MAX:%3.0lf\\\l "; + include 'includes/html/graphs/common.inc.php'; + $rrd_options .= ' -l 0 -E '; + $rrd_filename = Rrd::name($device['hostname'], 'cisco-voice-ip'); + if (Rrd::checkRrdExists($rrd_filename)) { + $rrd_options .= " COMMENT:' Cur Min Max\\n'"; + $rrd_options .= ' DEF:sip=' . $rrd_filename . ':sip:AVERAGE '; + $rrd_options .= ' DEF:sip_max=' . $rrd_filename . ':sip:MAX'; + $rrd_options .= ' AREA:sip_max#c099ff77 '; + $rrd_options .= " LINE1.25:sip#0000ee:'sip active calls ' "; + $rrd_options .= ' GPRINT:sip:LAST:%3.0lf '; + $rrd_options .= ' GPRINT:sip:MIN:%3.0lf '; + $rrd_options .= " GPRINT:sip_max:MAX:%3.0lf\\\l "; - $rrd_options .= ' DEF:h323=' . $rrd_filename . ':h323:AVERAGE '; - $rrd_options .= ' DEF:h323_max=' . $rrd_filename . ':h323:MAX'; - $rrd_options .= ' AREA:h323_max#aaff99dd '; - $rrd_options .= " LINE1.25:h323#00ee00:'h323 active calls ' "; - $rrd_options .= ' GPRINT:h323:LAST:%3.0lf '; - $rrd_options .= ' GPRINT:h323:MIN:%3.0lf '; - $rrd_options .= " GPRINT:h323_max:MAX:%3.0lf\\\l "; + $rrd_options .= ' DEF:h323=' . $rrd_filename . ':h323:AVERAGE '; + $rrd_options .= ' DEF:h323_max=' . $rrd_filename . ':h323:MAX'; + $rrd_options .= ' AREA:h323_max#aaff99dd '; + $rrd_options .= " LINE1.25:h323#00ee00:'h323 active calls ' "; + $rrd_options .= ' GPRINT:h323:LAST:%3.0lf '; + $rrd_options .= ' GPRINT:h323:MIN:%3.0lf '; + $rrd_options .= " GPRINT:h323_max:MAX:%3.0lf\\\l "; - $rrd_options .= ' DEF:mgcp=' . $rrd_filename . ':mgcp:AVERAGE '; - $rrd_options .= ' DEF:mgcp_max=' . $rrd_filename . ':mgcp:MAX'; - $rrd_options .= ' AREA:mgcp_max#ffaa99dd '; - $rrd_options .= " LINE1.25:mgcp#ee0000:'mgcp active calls ' "; - $rrd_options .= ' GPRINT:mgcp:LAST:%3.0lf '; - $rrd_options .= ' GPRINT:mgcp:MIN:%3.0lf '; - $rrd_options .= " GPRINT:mgcp_max:MAX:%3.0lf\\\l "; + $rrd_options .= ' DEF:mgcp=' . $rrd_filename . ':mgcp:AVERAGE '; + $rrd_options .= ' DEF:mgcp_max=' . $rrd_filename . ':mgcp:MAX'; + $rrd_options .= ' AREA:mgcp_max#ffaa99dd '; + $rrd_options .= " LINE1.25:mgcp#ee0000:'mgcp active calls ' "; + $rrd_options .= ' GPRINT:mgcp:LAST:%3.0lf '; + $rrd_options .= ' GPRINT:mgcp:MIN:%3.0lf '; + $rrd_options .= " GPRINT:mgcp_max:MAX:%3.0lf\\\l "; - $rrd_options .= ' DEF:sccp=' . $rrd_filename . ':sccp:AVERAGE '; - $rrd_options .= ' DEF:sccp_max=' . $rrd_filename . ':sccp:MAX'; - $rrd_options .= ' AREA:sccp_max#ddffffdd '; - $rrd_options .= " LINE1.25:sccp#99ccff:'sccp active calls ' "; - $rrd_options .= ' GPRINT:sccp:LAST:%3.0lf '; - $rrd_options .= ' GPRINT:sccp:MIN:%3.0lf '; - $rrd_options .= " GPRINT:sccp_max:MAX:%3.0lf\\\l "; + $rrd_options .= ' DEF:sccp=' . $rrd_filename . ':sccp:AVERAGE '; + $rrd_options .= ' DEF:sccp_max=' . $rrd_filename . ':sccp:MAX'; + $rrd_options .= ' AREA:sccp_max#ddffffdd '; + $rrd_options .= " LINE1.25:sccp#99ccff:'sccp active calls ' "; + $rrd_options .= ' GPRINT:sccp:LAST:%3.0lf '; + $rrd_options .= ' GPRINT:sccp:MIN:%3.0lf '; + $rrd_options .= " GPRINT:sccp_max:MAX:%3.0lf\\\l "; - $rrd_options .= ' DEF:multicast=' . $rrd_filename . ':multicast:AVERAGE '; - $rrd_options .= ' DEF:multicast_max=' . $rrd_filename . ':multicast:MAX'; - $rrd_options .= ' AREA:multicast_max#ffddffdd '; - $rrd_options .= " LINE1.25:multicast#cc77ff:'multicast active calls ' "; - $rrd_options .= ' GPRINT:multicast:LAST:%3.0lf '; - $rrd_options .= ' GPRINT:multicast:MIN:%3.0lf '; - $rrd_options .= " GPRINT:multicast_max:MAX:%3.0lf\\\l "; -} + $rrd_options .= ' DEF:multicast=' . $rrd_filename . ':multicast:AVERAGE '; + $rrd_options .= ' DEF:multicast_max=' . $rrd_filename . ':multicast:MAX'; + $rrd_options .= ' AREA:multicast_max#ffddffdd '; + $rrd_options .= " LINE1.25:multicast#cc77ff:'multicast active calls ' "; + $rrd_options .= ' GPRINT:multicast:LAST:%3.0lf '; + $rrd_options .= ' GPRINT:multicast:MIN:%3.0lf '; + $rrd_options .= " GPRINT:multicast_max:MAX:%3.0lf\\\l "; + } diff --git a/includes/html/graphs/device/collectd.inc.php b/includes/html/graphs/device/collectd.inc.php index 46bbeddae7..dc6177162a 100644 --- a/includes/html/graphs/device/collectd.inc.php +++ b/includes/html/graphs/device/collectd.inc.php @@ -48,8 +48,11 @@ function makeTextBlock($text, $fontfile, $fontsize, $width) * No RRD files found that could match request * * @code HTTP error code + * * @code_msg Short text description of HTTP error code + * * @title Title for fake RRD graph + * * @msg Complete error message to display in place of graph content */ function error($code, $code_msg, $title, $msg) @@ -76,30 +79,30 @@ function error($code, $code_msg, $title, $msg) } imagefilledrectangle($png, 0, 0, $w, $h, $c_bkgnd); - imagefilledrectangle($png, 51, 33, ($w - 31), ($h - 47), $c_fgnd); - imageline($png, 51, 30, 51, ($h - 43), $c_grln); - imageline($png, 48, ($h - 46), ($w - 28), ($h - 46), $c_grln); + imagefilledrectangle($png, 51, 33, $w - 31, $h - 47, $c_fgnd); + imageline($png, 51, 30, 51, $h - 43, $c_grln); + imageline($png, 48, $h - 46, $w - 28, $h - 46, $c_grln); imagefilledpolygon($png, [49, 30, 51, 26, 53, 30], 3, $c_grarr); imagefilledpolygon($png, [$w - 28, $h - 48, $w - 24, $h - 46, $w - 28, $h - 44], 3, $c_grarr); imageline($png, 0, 0, $w, 0, $c_blt); imageline($png, 0, 1, $w, 1, $c_blt); imageline($png, 0, 0, 0, $h, $c_blt); imageline($png, 1, 0, 1, $h, $c_blt); - imageline($png, ($w - 1), 0, ($w - 1), $h, $c_brb); - imageline($png, ($w - 2), 1, ($w - 2), $h, $c_brb); - imageline($png, 1, ($h - 2), $w, ($h - 2), $c_brb); - imageline($png, 0, ($h - 1), $w, ($h - 1), $c_brb); + imageline($png, $w - 1, 0, $w - 1, $h, $c_brb); + imageline($png, $w - 2, 1, $w - 2, $h, $c_brb); + imageline($png, 1, $h - 2, $w, $h - 2, $c_brb); + imageline($png, 0, $h - 1, $w, $h - 1, $c_brb); imagestring($png, 4, ceil(($w - strlen($title) * imagefontwidth(4)) / 2), 10, $title, $c_txt); imagestring($png, 5, 60, 35, sprintf('%s [%d]', $code_msg, $code), $c_etxt); if (function_exists('imagettfbbox') && is_file(Config::get('error_font'))) { // Detailled error message $errorfont = Config::get('error_font'); - $fmt_msg = makeTextBlock($msg, $errorfont, 10, ($w - 86)); + $fmt_msg = makeTextBlock($msg, $errorfont, 10, $w - 86); $fmtbox = imagettfbbox(12, 0, $errorfont, $fmt_msg); - imagettftext($png, 10, 0, 55, (35 + 3 + imagefontwidth(5) - $fmtbox[7] + $fmtbox[1]), $c_txt, $errorfont, $fmt_msg); + imagettftext($png, 10, 0, 55, 35 + 3 + imagefontwidth(5) - $fmtbox[7] + $fmtbox[1], $c_txt, $errorfont, $fmt_msg); } else { - imagestring($png, 4, 53, (35 + 6 + imagefontwidth(5)), $msg, $c_txt); + imagestring($png, 4, 53, 35 + 6 + imagefontwidth(5), $msg, $c_txt); } imagepng($png); diff --git a/includes/html/graphs/device/nfsen_channel_common.inc.php b/includes/html/graphs/device/nfsen_channel_common.inc.php index eeb43f0ea9..0446db8186 100644 --- a/includes/html/graphs/device/nfsen_channel_common.inc.php +++ b/includes/html/graphs/device/nfsen_channel_common.inc.php @@ -3,7 +3,7 @@ $simple_rrd = true; foreach ((array) \LibreNMS\Config::get('nfsen_rrds', []) as $nfsenrrds) { - if ($nfsenrrds[(strlen($nfsenrrds) - 1)] != '/') { + if ($nfsenrrds[strlen($nfsenrrds) - 1] != '/') { $nfsenrrds .= '/'; } diff --git a/includes/html/graphs/device/nfsen_common.inc.php b/includes/html/graphs/device/nfsen_common.inc.php index 14767ba636..90da48850a 100644 --- a/includes/html/graphs/device/nfsen_common.inc.php +++ b/includes/html/graphs/device/nfsen_common.inc.php @@ -3,7 +3,7 @@ $simple_rrd = true; foreach ((array) \LibreNMS\Config::get('nfsen_rrds', []) as $nfsenrrds) { - if ($nfsenrrds[(strlen($nfsenrrds) - 1)] != '/') { + if ($nfsenrrds[strlen($nfsenrrds) - 1] != '/') { $nfsenrrds .= '/'; } diff --git a/includes/html/graphs/device/smokeping_all_common.inc.php b/includes/html/graphs/device/smokeping_all_common.inc.php index c366ee784f..6fac7e9caf 100644 --- a/includes/html/graphs/device/smokeping_all_common.inc.php +++ b/includes/html/graphs/device/smokeping_all_common.inc.php @@ -22,9 +22,9 @@ if ($width > '500') { } if ($width > '500') { - $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5)) . " RTT Loss SDev RTT\:SDev\l'"; + $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5) . " RTT Loss SDev RTT\:SDev\l'"; } else { - $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5)) . " RTT Loss SDev RTT\:SDev\l'"; + $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5) . " RTT Loss SDev RTT\:SDev\l'"; } foreach ($smokeping_files[$direction][$device['hostname']] as $source => $filename) { diff --git a/includes/html/graphs/device/smokeping_all_common_avg.inc.php b/includes/html/graphs/device/smokeping_all_common_avg.inc.php index 05b32b4ff5..a54cf9f18f 100644 --- a/includes/html/graphs/device/smokeping_all_common_avg.inc.php +++ b/includes/html/graphs/device/smokeping_all_common_avg.inc.php @@ -23,9 +23,9 @@ if ($width > '500') { // FIXME str_pad really needs a "limit to length" so we can rid of all the substrs all over the code to limit the length as below... if ($width > '500') { - $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5)) . " RTT Loss SDev RTT\:SDev\l'"; + $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5) . " RTT Loss SDev RTT\:SDev\l'"; } else { - $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5)) . " RTT Loss SDev RTT\:SDev\l'"; + $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5) . " RTT Loss SDev RTT\:SDev\l'"; } foreach ($smokeping_files[$direction][$device['hostname']] as $source => $filename) { diff --git a/includes/html/graphs/generic_multi.inc.php b/includes/html/graphs/generic_multi.inc.php index fb096d7b29..874f416eb5 100644 --- a/includes/html/graphs/generic_multi.inc.php +++ b/includes/html/graphs/generic_multi.inc.php @@ -29,14 +29,14 @@ if ($nototal) { } if ($width > '500') { - $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5)) . "Now Min Max Avg\l'"; + $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5) . "Now Min Max Avg\l'"; if (! $nototal) { $rrd_options .= " COMMENT:'Total '"; } $rrd_options .= " COMMENT:'\l'"; } else { - $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5)) . "Now Min Max Avg\l'"; + $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5) . "Now Min Max Avg\l'"; } $i = 0; diff --git a/includes/html/graphs/generic_multi_bits_separated.inc.php b/includes/html/graphs/generic_multi_bits_separated.inc.php index 7eae2a02be..28b67e7cad 100644 --- a/includes/html/graphs/generic_multi_bits_separated.inc.php +++ b/includes/html/graphs/generic_multi_bits_separated.inc.php @@ -32,7 +32,7 @@ $unit_text = 'Bits/sec'; if (! $noagg || ! $nodetails) { if ($width > '500') { - $rrd_options .= sprintf(" COMMENT:'%s'", substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))); + $rrd_options .= sprintf(" COMMENT:'%s'", substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5)); $rrd_options .= sprintf(" COMMENT:'%12s'", 'Current'); $rrd_options .= sprintf(" COMMENT:'%10s'", 'Average'); $rrd_options .= sprintf(" COMMENT:'%10s'", 'Maximum'); @@ -42,7 +42,7 @@ if (! $noagg || ! $nodetails) { $rrd_options .= " COMMENT:'\l'"; } else { $nototal = true; - $rrd_options .= sprintf(" COMMENT:'%s'", substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5))); + $rrd_options .= sprintf(" COMMENT:'%s'", substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5)); $rrd_options .= sprintf(" COMMENT:'%12s'", 'Now'); $rrd_options .= sprintf(" COMMENT:'%10s'", 'Avg'); $rrd_options .= sprintf(" COMMENT:'%10s\l'", 'Max'); @@ -140,7 +140,7 @@ if (! $noagg) { $rrd_options .= ' VDEF:totalin=aggrinbytes,TOTAL'; $rrd_options .= ' VDEF:totalout=aggroutbytes,TOTAL'; $rrd_options .= " COMMENT:' \\n'"; - $rrd_options .= " COMMENT:'" . substr(str_pad('Aggregate', ($descr_len + 5)), 0, ($descr_len + 5)) . 'In' . "'"; + $rrd_options .= " COMMENT:'" . substr(str_pad('Aggregate', $descr_len + 5), 0, $descr_len + 5) . 'In' . "'"; $rrd_options .= ' GPRINT:aggrinbits:LAST:%6.' . $float_precision . "lf%s$units"; $rrd_options .= ' GPRINT:aggrinbits:AVERAGE:%6.' . $float_precision . "lf%s$units"; $rrd_options .= ' GPRINT:aggrinbits:MAX:%6.' . $float_precision . "lf%s$units"; @@ -149,7 +149,7 @@ if (! $noagg) { } $rrd_options .= '\\n'; - $rrd_options .= " COMMENT:'" . substr(str_pad('Aggregate', ($descr_len + 4)), 0, ($descr_len + 4)) . 'Out' . "'"; + $rrd_options .= " COMMENT:'" . substr(str_pad('Aggregate', $descr_len + 4), 0, $descr_len + 4) . 'Out' . "'"; $rrd_options .= ' GPRINT:aggroutbits:LAST:%6.' . $float_precision . "lf%s$units"; $rrd_options .= ' GPRINT:aggroutbits:AVERAGE:%6.' . $float_precision . "lf%s$units"; $rrd_options .= ' GPRINT:aggroutbits:MAX:%6.' . $float_precision . "lf%s$units"; diff --git a/includes/html/graphs/generic_multi_data_separated.inc.php b/includes/html/graphs/generic_multi_data_separated.inc.php index c99b977f8b..d4b8b78ae9 100644 --- a/includes/html/graphs/generic_multi_data_separated.inc.php +++ b/includes/html/graphs/generic_multi_data_separated.inc.php @@ -28,14 +28,14 @@ if ($width > '500') { $unit_text = 'Bits/sec'; if ($width > '500') { - $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5)) . " Current Average Maximum '"; + $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5) . " Current Average Maximum '"; if (! $nototal) { $rrd_options .= " COMMENT:'Total '"; } $rrd_options .= " COMMENT:'\l'"; } else { - $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5)) . " Now Ave Max\l'"; + $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5) . " Now Ave Max\l'"; } if (! isset($multiplier)) { diff --git a/includes/html/graphs/generic_multi_line_exact_numbers.inc.php b/includes/html/graphs/generic_multi_line_exact_numbers.inc.php index 14c5a44cdf..57fb2b6c6c 100644 --- a/includes/html/graphs/generic_multi_line_exact_numbers.inc.php +++ b/includes/html/graphs/generic_multi_line_exact_numbers.inc.php @@ -16,13 +16,13 @@ if ($printtotal === 1) { $unit_text = str_pad(truncate($unit_text, $unitlen), $unitlen); if ($width > '500') { - $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, ($descr_len + 10)), 0, ($descr_len + 10)) . "Now Min Max Avg\l'"; + $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 10), 0, $descr_len + 10) . "Now Min Max Avg\l'"; if ($printtotal === 1) { $rrd_options .= " COMMENT:'Total '"; } $rrd_options .= " COMMENT:'\l'"; } else { - $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, ($descr_len + 10)), 0, ($descr_len + 10)) . "Now Min Max Avg\l'"; + $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 10), 0, $descr_len + 10) . "Now Min Max Avg\l'"; } foreach ($rrd_list as $rrd) { diff --git a/includes/html/graphs/generic_v3_multiline.inc.php b/includes/html/graphs/generic_v3_multiline.inc.php index 79a8577f2d..7fba8a35d8 100644 --- a/includes/html/graphs/generic_v3_multiline.inc.php +++ b/includes/html/graphs/generic_v3_multiline.inc.php @@ -16,13 +16,13 @@ if ($printtotal === 1) { $unit_text = str_pad(truncate($unit_text, $unitlen), $unitlen); if ($width > '500') { - $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, ($descr_len + 10)), 0, ($descr_len + 10)) . "Now Min Max Avg\l'"; + $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 10), 0, $descr_len + 10) . "Now Min Max Avg\l'"; if ($printtotal === 1) { $rrd_options .= " COMMENT:'Total '"; } $rrd_options .= " COMMENT:'\l'"; } else { - $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, ($descr_len + 10)), 0, ($descr_len + 10)) . "Now Min Max Avg\l'"; + $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 10), 0, $descr_len + 10) . "Now Min Max Avg\l'"; } foreach ($rrd_list as $rrd) { diff --git a/includes/html/graphs/generic_v3_multiline_float.inc.php b/includes/html/graphs/generic_v3_multiline_float.inc.php index 984a3614dd..d18348a235 100644 --- a/includes/html/graphs/generic_v3_multiline_float.inc.php +++ b/includes/html/graphs/generic_v3_multiline_float.inc.php @@ -16,13 +16,13 @@ if ($printtotal === 1) { $unit_text = str_pad(truncate($unit_text, $unitlen), $unitlen); if ($width > '500') { - $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, ($descr_len + 10)), 0, ($descr_len + 10)) . "Now Min Max Avg\l'"; + $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 10), 0, $descr_len + 10) . "Now Min Max Avg\l'"; if ($printtotal === 1) { $rrd_options .= " COMMENT:'Total '"; } $rrd_options .= " COMMENT:'\l'"; } else { - $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, ($descr_len + 10)), 0, ($descr_len + 10)) . "Now Min Max Avg\l'"; + $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 10), 0, $descr_len + 10) . "Now Min Max Avg\l'"; } foreach ($rrd_list as $rrd) { diff --git a/includes/html/graphs/mempool/usage.inc.php b/includes/html/graphs/mempool/usage.inc.php index db9522cf80..3544c926e5 100644 --- a/includes/html/graphs/mempool/usage.inc.php +++ b/includes/html/graphs/mempool/usage.inc.php @@ -18,10 +18,10 @@ if ($width > '500') { } if ($width > '500') { - $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5)) . "Total Used Free( Min Max Ave)'"; + $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5) . "Total Used Free( Min Max Ave)'"; $rrd_options .= " COMMENT:'\l'"; } else { - $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5)) . "Total Used Free\l'"; + $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5) . "Total Used Free\l'"; } $descr = \LibreNMS\Data\Store\Rrd::fixedSafeDescr(short_hrDeviceDescr($mempool['mempool_descr']), $descr_len); @@ -44,7 +44,7 @@ if ($width > '500') { $rrd_options .= " GPRINT:{$mempool['mempool_id']}free:MIN:%5.2lf%sB"; $rrd_options .= " GPRINT:{$mempool['mempool_id']}free:MAX:%5.2lf%sB"; $rrd_options .= " GPRINT:{$mempool['mempool_id']}free:AVERAGE:%5.2lf%sB\\n"; - $rrd_options .= " COMMENT:'" . substr(str_pad('', ($descr_len + 12)), 0, ($descr_len + 12)) . " '"; + $rrd_options .= " COMMENT:'" . substr(str_pad('', $descr_len + 12), 0, $descr_len + 12) . " '"; $rrd_options .= " GPRINT:{$mempool['mempool_id']}perc:LAST:'%5.2lf%% '"; $rrd_options .= " GPRINT:{$mempool['mempool_id']}percx:LAST:'%5.2lf%% '"; $rrd_options .= " GPRINT:{$mempool['mempool_id']}perc:MIN:'%5.2lf%% '"; @@ -56,7 +56,7 @@ if ($width > '500') { $rrd_options .= " GPRINT:{$mempool['mempool_id']}used:LAST:%6.2lf%sB"; $rrd_options .= " GPRINT:{$mempool['mempool_id']}free:LAST:%6.2lf%sB"; $rrd_options .= " COMMENT:'\l'"; - $rrd_options .= " COMMENT:'" . substr(str_pad('', ($descr_len + 12)), 0, ($descr_len + 12)) . " '"; + $rrd_options .= " COMMENT:'" . substr(str_pad('', $descr_len + 12), 0, $descr_len + 12) . " '"; $rrd_options .= " GPRINT:{$mempool['mempool_id']}perc:LAST:'%5.2lf%% '"; $rrd_options .= " GPRINT:{$mempool['mempool_id']}percx:LAST:'%5.2lf%% '"; $rrd_options .= " COMMENT:'\l'"; diff --git a/includes/html/graphs/qfp/memory.inc.php b/includes/html/graphs/qfp/memory.inc.php index 0a7d620a7b..ba94e020dc 100644 --- a/includes/html/graphs/qfp/memory.inc.php +++ b/includes/html/graphs/qfp/memory.inc.php @@ -25,10 +25,10 @@ if ($width > '500') { } if ($width > '500') { - $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5)) . "Total Used Free (Min Max Ave)'"; + $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5) . "Total Used Free (Min Max Ave)'"; $rrd_options .= " COMMENT:'\l'"; } else { - $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5)) . "Total Used Free\l'"; + $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5) . "Total Used Free\l'"; } $descr = \LibreNMS\Data\Store\Rrd::fixedSafeDescr(short_hrDeviceDescr($components['name']), $descr_len); @@ -57,7 +57,7 @@ if ($width > '500') { $rrd_options .= ' GPRINT:qfp_free:MIN:%5.2lf%sB'; $rrd_options .= ' GPRINT:qfp_free:MAX:%5.2lf%sB'; $rrd_options .= ' GPRINT:qfp_free:AVERAGE:%5.2lf%sB\\n'; - $rrd_options .= " COMMENT:'" . substr(str_pad('', ($descr_len + 12)), 0, ($descr_len + 12)) . " '"; + $rrd_options .= " COMMENT:'" . substr(str_pad('', $descr_len + 12), 0, $descr_len + 12) . " '"; $rrd_options .= " GPRINT:qfp_perc:LAST:'%6.2lf%% '"; $rrd_options .= " GPRINT:qfp_percx:LAST:'%6.2lf%% '"; $rrd_options .= " GPRINT:qfp_perc:MIN:'%5.2lf%% '"; @@ -72,7 +72,7 @@ if ($width > '500') { $rrd_options .= ' GPRINT:qfp_used:LAST:%6.2lf%sB'; $rrd_options .= ' GPRINT:qfp_free:LAST:%6.2lf%sB'; $rrd_options .= " COMMENT:'\l'"; - $rrd_options .= " COMMENT:'" . substr(str_pad('', ($descr_len + 12)), 0, ($descr_len + 12)) . " '"; + $rrd_options .= " COMMENT:'" . substr(str_pad('', $descr_len + 12), 0, $descr_len + 12) . " '"; $rrd_options .= " GPRINT:qfp_perc:LAST:'%5.2lf%% '"; $rrd_options .= " GPRINT:qfp_percx:LAST:'%5.2lf%% '"; $rrd_options .= " COMMENT:'\l'"; diff --git a/includes/html/graphs/smokeping/in.inc.php b/includes/html/graphs/smokeping/in.inc.php index 04c4aecdba..d0694391bd 100644 --- a/includes/html/graphs/smokeping/in.inc.php +++ b/includes/html/graphs/smokeping/in.inc.php @@ -24,9 +24,9 @@ if ($width > '500') { } if ($width > '500') { - $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5)) . " RTT Loss SDev RTT\:SDev \l'"; + $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5) . " RTT Loss SDev RTT\:SDev \l'"; } else { - $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5)) . " RTT Loss SDev RTT\:SDev \l'"; + $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5) . " RTT Loss SDev RTT\:SDev \l'"; } $filename_dir = generate_smokeping_file($device); @@ -49,22 +49,22 @@ if (! Config::has("graph_colours.$colourset.$iter")) { } $colour = Config::get("graph_colours.$colourset.$iter"); - $iter++; +$iter++; - $descr = \LibreNMS\Data\Store\Rrd::fixedSafeDescr($source, $descr_len); +$descr = \LibreNMS\Data\Store\Rrd::fixedSafeDescr($source, $descr_len); - $rrd_options .= " DEF:median$i=" . $filename . ':median:AVERAGE '; - $rrd_options .= " DEF:loss$i=" . $filename . ':loss:AVERAGE'; - $rrd_options .= " CDEF:ploss$i=loss$i,$pings,/,100,*"; - $rrd_options .= " CDEF:dm$i=median$i"; +$rrd_options .= " DEF:median$i=" . $filename . ':median:AVERAGE '; +$rrd_options .= " DEF:loss$i=" . $filename . ':loss:AVERAGE'; +$rrd_options .= " CDEF:ploss$i=loss$i,$pings,/,100,*"; +$rrd_options .= " CDEF:dm$i=median$i"; // $rrd_options .= " CDEF:dm$i=median$i,0,".$max->{$start}.",LIMIT"; - // start emulate Smokeping::calc_stddev +// start emulate Smokeping::calc_stddev foreach (range(1, $pings) as $p) { $rrd_options .= ' DEF:pin' . $i . 'p' . $p . '=' . $filename . ':ping' . $p . ':AVERAGE'; $rrd_options .= ' CDEF:p' . $i . 'p' . $p . '=pin' . $i . 'p' . $p . ',UN,0,pin' . $i . 'p' . $p . ',IF'; } - unset($pings_options, $m_options, $sdev_options); +unset($pings_options, $m_options, $sdev_options); foreach (range(2, $pings) as $p) { $pings_options .= ',p' . $i . 'p' . $p . ',UN,+'; @@ -72,26 +72,26 @@ foreach (range(2, $pings) as $p) { $sdev_options .= ',p' . $i . 'p' . $p . ',m' . $i . ',-,DUP,*,+'; } - $rrd_options .= ' CDEF:pings' . $i . '=' . $pings . ',p' . $i . 'p1,UN' . $pings_options . ',-'; - $rrd_options .= ' CDEF:m' . $i . '=p' . $i . 'p1' . $m_options . ',pings' . $i . ',/'; - $rrd_options .= ' CDEF:sdev' . $i . '=p' . $i . 'p1,m' . $i . ',-,DUP,*' . $sdev_options . ',pings' . $i . ',/,SQRT'; - // end emulate Smokeping::calc_stddev - $rrd_options .= " CDEF:dmlow$i=dm$i,sdev$i,2,/,-"; - $rrd_options .= " CDEF:s2d$i=sdev$i"; - $rrd_options .= " AREA:dmlow$i"; - $rrd_options .= " AREA:s2d$i#" . $colour . '30::STACK'; - $rrd_options .= " LINE1:dm$i#" . $colour . ":'$descr'"; +$rrd_options .= ' CDEF:pings' . $i . '=' . $pings . ',p' . $i . 'p1,UN' . $pings_options . ',-'; +$rrd_options .= ' CDEF:m' . $i . '=p' . $i . 'p1' . $m_options . ',pings' . $i . ',/'; +$rrd_options .= ' CDEF:sdev' . $i . '=p' . $i . 'p1,m' . $i . ',-,DUP,*' . $sdev_options . ',pings' . $i . ',/,SQRT'; +// end emulate Smokeping::calc_stddev +$rrd_options .= " CDEF:dmlow$i=dm$i,sdev$i,2,/,-"; +$rrd_options .= " CDEF:s2d$i=sdev$i"; +$rrd_options .= " AREA:dmlow$i"; +$rrd_options .= " AREA:s2d$i#" . $colour . '30::STACK'; +$rrd_options .= " LINE1:dm$i#" . $colour . ":'$descr'"; // $rrd_options .= " LINE1:sdev$i#000000:$descr"; - $rrd_options .= " VDEF:avmed$i=median$i,AVERAGE"; - $rrd_options .= " VDEF:avsd$i=sdev$i,AVERAGE"; - $rrd_options .= " CDEF:msr$i=median$i,POP,avmed$i,avsd$i,/"; - $rrd_options .= " VDEF:avmsr$i=msr$i,AVERAGE"; +$rrd_options .= " VDEF:avmed$i=median$i,AVERAGE"; +$rrd_options .= " VDEF:avsd$i=sdev$i,AVERAGE"; +$rrd_options .= " CDEF:msr$i=median$i,POP,avmed$i,avsd$i,/"; +$rrd_options .= " VDEF:avmsr$i=msr$i,AVERAGE"; - $rrd_options .= " GPRINT:avmed$i:'%5.1lf%ss'"; - $rrd_options .= " GPRINT:ploss$i:AVERAGE:'%5.1lf%%'"; +$rrd_options .= " GPRINT:avmed$i:'%5.1lf%ss'"; +$rrd_options .= " GPRINT:ploss$i:AVERAGE:'%5.1lf%%'"; - $rrd_options .= " GPRINT:avsd$i:'%5.1lf%Ss'"; - $rrd_options .= " GPRINT:avmsr$i:'%5.1lf%s\\l'"; +$rrd_options .= " GPRINT:avsd$i:'%5.1lf%Ss'"; +$rrd_options .= " GPRINT:avmsr$i:'%5.1lf%s\\l'"; - $i++; +$i++; diff --git a/includes/html/graphs/smokeping/out.inc.php b/includes/html/graphs/smokeping/out.inc.php index 075dad2f78..0cd5d9b8a8 100644 --- a/includes/html/graphs/smokeping/out.inc.php +++ b/includes/html/graphs/smokeping/out.inc.php @@ -24,9 +24,9 @@ if ($width > '500') { } if ($width > '500') { - $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5)) . " RTT Loss SDev RTT\:SDev \l'"; + $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5) . " RTT Loss SDev RTT\:SDev \l'"; } else { - $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, ($descr_len + 5)), 0, ($descr_len + 5)) . " RTT Loss SDev RTT\:SDev \l'"; + $rrd_options .= " COMMENT:'" . substr(str_pad($unit_text, $descr_len + 5), 0, $descr_len + 5) . " RTT Loss SDev RTT\:SDev \l'"; } $filename_dir = generate_smokeping_file($device); @@ -49,22 +49,22 @@ if (! Config::has("graph_colours.$colourset.$iter")) { } $colour = Config::get("graph_colours.$colourset.$iter"); - $iter++; +$iter++; - $descr = \LibreNMS\Data\Store\Rrd::fixedSafeDescr($source, $descr_len); +$descr = \LibreNMS\Data\Store\Rrd::fixedSafeDescr($source, $descr_len); - $rrd_options .= " DEF:median$i=" . $filename . ':median:AVERAGE '; - $rrd_options .= " DEF:loss$i=" . $filename . ':loss:AVERAGE'; - $rrd_options .= " CDEF:ploss$i=loss$i,$pings,/,100,*"; - $rrd_options .= " CDEF:dm$i=median$i"; +$rrd_options .= " DEF:median$i=" . $filename . ':median:AVERAGE '; +$rrd_options .= " DEF:loss$i=" . $filename . ':loss:AVERAGE'; +$rrd_options .= " CDEF:ploss$i=loss$i,$pings,/,100,*"; +$rrd_options .= " CDEF:dm$i=median$i"; // $rrd_options .= " CDEF:dm$i=median$i,0,".$max->{$start}.",LIMIT"; - // start emulate Smokeping::calc_stddev +// start emulate Smokeping::calc_stddev foreach (range(1, $pings) as $p) { $rrd_options .= ' DEF:pin' . $i . 'p' . $p . '=' . $filename . ':ping' . $p . ':AVERAGE'; $rrd_options .= ' CDEF:p' . $i . 'p' . $p . '=pin' . $i . 'p' . $p . ',UN,0,pin' . $i . 'p' . $p . ',IF'; } - unset($pings_options, $m_options, $sdev_options); +unset($pings_options, $m_options, $sdev_options); foreach (range(2, $pings) as $p) { $pings_options .= ',p' . $i . 'p' . $p . ',UN,+'; @@ -72,26 +72,26 @@ foreach (range(2, $pings) as $p) { $sdev_options .= ',p' . $i . 'p' . $p . ',m' . $i . ',-,DUP,*,+'; } - $rrd_options .= ' CDEF:pings' . $i . '=' . $pings . ',p' . $i . 'p1,UN' . $pings_options . ',-'; - $rrd_options .= ' CDEF:m' . $i . '=p' . $i . 'p1' . $m_options . ',pings' . $i . ',/'; - $rrd_options .= ' CDEF:sdev' . $i . '=p' . $i . 'p1,m' . $i . ',-,DUP,*' . $sdev_options . ',pings' . $i . ',/,SQRT'; - // end emulate Smokeping::calc_stddev - $rrd_options .= " CDEF:dmlow$i=dm$i,sdev$i,2,/,-"; - $rrd_options .= " CDEF:s2d$i=sdev$i"; - $rrd_options .= " AREA:dmlow$i"; - $rrd_options .= " AREA:s2d$i#" . $colour . '30::STACK'; - $rrd_options .= " LINE1:dm$i#" . $colour . ":'$descr'"; +$rrd_options .= ' CDEF:pings' . $i . '=' . $pings . ',p' . $i . 'p1,UN' . $pings_options . ',-'; +$rrd_options .= ' CDEF:m' . $i . '=p' . $i . 'p1' . $m_options . ',pings' . $i . ',/'; +$rrd_options .= ' CDEF:sdev' . $i . '=p' . $i . 'p1,m' . $i . ',-,DUP,*' . $sdev_options . ',pings' . $i . ',/,SQRT'; +// end emulate Smokeping::calc_stddev +$rrd_options .= " CDEF:dmlow$i=dm$i,sdev$i,2,/,-"; +$rrd_options .= " CDEF:s2d$i=sdev$i"; +$rrd_options .= " AREA:dmlow$i"; +$rrd_options .= " AREA:s2d$i#" . $colour . '30::STACK'; +$rrd_options .= " LINE1:dm$i#" . $colour . ":'$descr'"; // $rrd_options .= " LINE1:sdev$i#000000:$descr"; - $rrd_options .= " VDEF:avmed$i=median$i,AVERAGE"; - $rrd_options .= " VDEF:avsd$i=sdev$i,AVERAGE"; - $rrd_options .= " CDEF:msr$i=median$i,POP,avmed$i,avsd$i,/"; - $rrd_options .= " VDEF:avmsr$i=msr$i,AVERAGE"; +$rrd_options .= " VDEF:avmed$i=median$i,AVERAGE"; +$rrd_options .= " VDEF:avsd$i=sdev$i,AVERAGE"; +$rrd_options .= " CDEF:msr$i=median$i,POP,avmed$i,avsd$i,/"; +$rrd_options .= " VDEF:avmsr$i=msr$i,AVERAGE"; - $rrd_options .= " GPRINT:avmed$i:'%5.1lf%ss'"; - $rrd_options .= " GPRINT:ploss$i:AVERAGE:'%5.1lf%%'"; +$rrd_options .= " GPRINT:avmed$i:'%5.1lf%ss'"; +$rrd_options .= " GPRINT:ploss$i:AVERAGE:'%5.1lf%%'"; - $rrd_options .= " GPRINT:avsd$i:'%5.1lf%Ss'"; - $rrd_options .= " GPRINT:avmsr$i:'%5.1lf%s\\l'"; +$rrd_options .= " GPRINT:avsd$i:'%5.1lf%Ss'"; +$rrd_options .= " GPRINT:avmsr$i:'%5.1lf%s\\l'"; - $i++; +$i++; diff --git a/includes/html/graphs/toner/usage.inc.php b/includes/html/graphs/toner/usage.inc.php index b4b00c3e23..baaf87ce50 100644 --- a/includes/html/graphs/toner/usage.inc.php +++ b/includes/html/graphs/toner/usage.inc.php @@ -14,7 +14,7 @@ if ($colour['left'] == null) { $descr = \LibreNMS\Data\Store\Rrd::safeDescr(substr(str_pad($toner['supply_descr'], 26), 0, 26)); -$background = \LibreNMS\Util\Color::percentage((100 - $toner['supply_current'])); +$background = \LibreNMS\Util\Color::percentage(100 - $toner['supply_current']); $rrd_options .= ' DEF:toner' . $toner['supply_id'] . '=' . $rrd_filename . ':toner:AVERAGE '; diff --git a/includes/html/output/capture.inc.php b/includes/html/output/capture.inc.php index 2c99e4a7a1..634566f0a3 100644 --- a/includes/html/output/capture.inc.php +++ b/includes/html/output/capture.inc.php @@ -24,7 +24,7 @@ */ if (! Auth::user()->hasGlobalAdmin()) { echo 'Insufficient Privileges'; - exit(); + exit; } $hostname = escapeshellcmd($_REQUEST['hostname']); diff --git a/includes/html/output/query.inc.php b/includes/html/output/query.inc.php index 0368628f12..6aeacacfa6 100644 --- a/includes/html/output/query.inc.php +++ b/includes/html/output/query.inc.php @@ -29,7 +29,7 @@ use LibreNMS\Alerting\QueryBuilderParser; if (! Auth::user()->hasGlobalAdmin()) { echo 'Insufficient Privileges'; - exit(); + exit; } $hostname = escapeshellcmd($_REQUEST['hostname']); @@ -99,7 +99,7 @@ switch ($type) { break; default: echo 'You must specify a valid type'; - exit(); + exit; } // ---- Output ---- diff --git a/includes/html/pages/device/entphysical.inc.php b/includes/html/pages/device/entphysical.inc.php index 633df569da..8a4f9e1bef 100644 --- a/includes/html/pages/device/entphysical.inc.php +++ b/includes/html/pages/device/entphysical.inc.php @@ -133,7 +133,7 @@ function printEntPhysical($device, $ent, $level, $class) $count = dbFetchCell("SELECT COUNT(*) FROM `entPhysical` WHERE device_id = '" . $device['device_id'] . "' AND entPhysicalContainedIn = '" . $ent['entPhysicalIndex'] . "'"); if ($count) { echo ''; } diff --git a/includes/html/pages/device/graphs.inc.php b/includes/html/pages/device/graphs.inc.php index 7b1051627c..afc15f1d49 100644 --- a/includes/html/pages/device/graphs.inc.php +++ b/includes/html/pages/device/graphs.inc.php @@ -56,7 +56,7 @@ print_optionbar_end(); $group = $vars['group'] ?? array_key_first($graph_enable); $graph_enable = $graph_enable[$group] ?? []; -if (($group != 'customoid') && (is_file("includes/html/pages/device/graphs/$group.inc.php"))) { +if (($group != 'customoid') && is_file("includes/html/pages/device/graphs/$group.inc.php")) { include "includes/html/pages/device/graphs/$group.inc.php"; } else { foreach ($graph_enable as $graph => $entry) { diff --git a/includes/html/pages/device/loadbalancer/netscaler_vsvr.inc.php b/includes/html/pages/device/loadbalancer/netscaler_vsvr.inc.php index 0fb5d661c2..e9fef93d13 100644 --- a/includes/html/pages/device/loadbalancer/netscaler_vsvr.inc.php +++ b/includes/html/pages/device/loadbalancer/netscaler_vsvr.inc.php @@ -42,8 +42,8 @@ if (is_numeric($vars['vsvr'])) { echo '' . $vsvr['vsvr_ip'] . ':' . $vsvr['vsvr_port'] . ''; echo "" . $vsvr['vsvr_state'] . ''; echo '' . $vsvr['vsvr_type'] . ''; - echo '' . \LibreNMS\Util\Number::formatSi(($vsvr['vsvr_bps_in'] * 8), 2, 3, '') . 'bps'; - echo '' . \LibreNMS\Util\Number::formatSi(($vsvr['vsvr_bps_out'] * 8), 2, 3, '') . 'bps'; + echo '' . \LibreNMS\Util\Number::formatSi($vsvr['vsvr_bps_in'] * 8, 2, 3, '') . 'bps'; + echo '' . \LibreNMS\Util\Number::formatSi($vsvr['vsvr_bps_out'] * 8, 2, 3, '') . 'bps'; echo ''; foreach ($graph_types as $graph_type => $graph_text) { @@ -166,8 +166,8 @@ if (is_numeric($vars['vsvr'])) { echo '' . $vsvr['vsvr_ip'] . ':' . $vsvr['vsvr_port'] . ''; echo "" . $vsvr['vsvr_state'] . ''; echo '' . $vsvr['vsvr_type'] . ''; - echo '' . \LibreNMS\Util\Number::formatSi(($vsvr['vsvr_bps_in'] * 8), 2, 3, '') . 'bps'; - echo '' . \LibreNMS\Util\Number::formatSi(($vsvr['vsvr_bps_out'] * 8), 2, 3, '') . 'bps'; + echo '' . \LibreNMS\Util\Number::formatSi($vsvr['vsvr_bps_in'] * 8, 2, 3, '') . 'bps'; + echo '' . \LibreNMS\Util\Number::formatSi($vsvr['vsvr_bps_out'] * 8, 2, 3, '') . 'bps'; echo ''; if ($vars['view'] == 'graphs') { echo ''; diff --git a/includes/html/pages/device/nfsen/stats.inc.php b/includes/html/pages/device/nfsen/stats.inc.php index 26d8af6697..c844588d22 100644 --- a/includes/html/pages/device/nfsen/stats.inc.php +++ b/includes/html/pages/device/nfsen/stats.inc.php @@ -114,7 +114,7 @@ if (isset($vars['process'])) { if (isset($vars['lastN']) && is_numeric($vars['lastN']) && ($vars['lastN'] <= \LibreNMS\Config::get('nfsen_last_max')) - ) { + ) { $lastN = $vars['lastN']; } @@ -123,7 +123,7 @@ if (isset($vars['process'])) { if (isset($vars['topN']) && is_numeric($vars['topN']) && ($vars['topN'] <= \LibreNMS\Config::get('nfsen_top_max')) - ) { + ) { $topN = $vars['topN']; } diff --git a/includes/html/pages/device/overview/c6kxbar.inc.php b/includes/html/pages/device/overview/c6kxbar.inc.php index 2a3c8128c4..d78a89648e 100644 --- a/includes/html/pages/device/overview/c6kxbar.inc.php +++ b/includes/html/pages/device/overview/c6kxbar.inc.php @@ -85,7 +85,7 @@ foreach ($entity_state['group']['c6kxbar'] as $index => $entry) { Fabric ' . $subindex . " (" . round((($cef['drop'] - $cef['drop_prev']) / $interval), 2) . '/sec)'; + echo " (" . round(($cef['drop'] - $cef['drop_prev']) / $interval, 2) . '/sec)'; } echo ''; echo '' . \LibreNMS\Util\Number::formatSi($cef['punt'], 2, 3, ''); if ($cef['punt'] > $cef['punt_prev']) { - echo " (" . round((($cef['punt'] - $cef['punt_prev']) / $interval), 2) . '/sec)'; + echo " (" . round(($cef['punt'] - $cef['punt_prev']) / $interval, 2) . '/sec)'; } echo ''; echo '' . \LibreNMS\Util\Number::formatSi($cef['punt2host'], 2, 3, ''); if ($cef['punt2host'] > $cef['punt2host_prev']) { - echo " (" . round((($cef['punt2host'] - $cef['punt2host_prev']) / $interval), 2) . '/sec)'; + echo " (" . round(($cef['punt2host'] - $cef['punt2host_prev']) / $interval, 2) . '/sec)'; } echo ''; diff --git a/includes/html/pages/device/showconfig.inc.php b/includes/html/pages/device/showconfig.inc.php index d73b67ad5f..d01950062c 100644 --- a/includes/html/pages/device/showconfig.inc.php +++ b/includes/html/pages/device/showconfig.inc.php @@ -81,7 +81,7 @@ if (Auth::user()->hasGlobalAdmin()) { if (Config::get('rancid_repo_type') == 'svn') { if (function_exists('svn_log') && in_array($vars['rev'], $revlist)) { - [$diff, $errors] = svn_diff($rancid_file, ($vars['rev'] - 1), $rancid_file, $vars['rev']); + [$diff, $errors] = svn_diff($rancid_file, $vars['rev'] - 1, $rancid_file, $vars['rev']); if (! $diff) { $text = 'No Difference'; } else { diff --git a/includes/html/pages/graphs.inc.php b/includes/html/pages/graphs.inc.php index ebbdc8be0b..a00e1de526 100644 --- a/includes/html/pages/graphs.inc.php +++ b/includes/html/pages/graphs.inc.php @@ -120,7 +120,7 @@ if (! $auth) { if ($screen_height > 960) { $graph_array['height'] = ($screen_height - ($screen_height / 2)); } else { - $graph_array['height'] = max($graph_array['height'], ($screen_height - ($screen_height / 1.5))); + $graph_array['height'] = max($graph_array['height'], $screen_height - ($screen_height / 1.5)); } } diff --git a/includes/html/pages/ports/graph.inc.php b/includes/html/pages/ports/graph.inc.php index 63422e3f42..19569a1981 100644 --- a/includes/html/pages/ports/graph.inc.php +++ b/includes/html/pages/ports/graph.inc.php @@ -152,8 +152,8 @@ foreach ($ports as $port) { $speed = \LibreNMS\Util\Number::formatSi($port['ifSpeed'], 2, 3, 'bps'); $type = \LibreNMS\Util\Rewrite::normalizeIfType($port['ifType']); - $port['in_rate'] = \LibreNMS\Util\Number::formatSi(($port['ifInOctets_rate'] * 8), 2, 3, 'bps'); - $port['out_rate'] = \LibreNMS\Util\Number::formatSi(($port['ifOutOctets_rate'] * 8), 2, 3, 'bps'); + $port['in_rate'] = \LibreNMS\Util\Number::formatSi($port['ifInOctets_rate'] * 8, 2, 3, 'bps'); + $port['out_rate'] = \LibreNMS\Util\Number::formatSi($port['ifOutOctets_rate'] * 8, 2, 3, 'bps'); if ($port['ifInErrors_delta'] > 0 || $port['ifOutErrors_delta'] > 0) { $error_img = generate_port_link($port, "", 'errors'); diff --git a/includes/html/pages/routing/vrf.inc.php b/includes/html/pages/routing/vrf.inc.php index e923c62689..3f6f7ee277 100644 --- a/includes/html/pages/routing/vrf.inc.php +++ b/includes/html/pages/routing/vrf.inc.php @@ -92,7 +92,7 @@ if (! Auth::user()->hasGlobalRead()) { echo "
"; $i = '1'; foreach (dbFetchRows('SELECT `vrf_name`, `mplsVpnVrfRouteDistinguisher`, `mplsVpnVrfDescription` FROM `vrfs` GROUP BY `mplsVpnVrfRouteDistinguisher`, `mplsVpnVrfDescription`,`vrf_name`') as $vrf) { - if (($i % 2)) { + if ($i % 2) { $bg_colour = Config::get('list_colour.even'); } else { $bg_colour = Config::get('list_colour.odd'); @@ -107,14 +107,14 @@ if (! Auth::user()->hasGlobalRead()) { echo '
'; $x = 1; foreach ($vrf_devices[$vrf['vrf_name']][$vrf['mplsVpnVrfRouteDistinguisher']] as $device) { - if (($i % 2)) { - if (($x % 2)) { + if ($i % 2) { + if ($x % 2) { $dev_colour = Config::get('list_colour.even_alt'); } else { $dev_colour = Config::get('list_colour.even_alt2'); } } else { - if (($x % 2)) { + if ($x % 2) { $dev_colour = Config::get('list_colour.odd_alt2'); } else { $dev_colour = Config::get('list_colour.odd_alt'); diff --git a/includes/html/print-interface-adsl.inc.php b/includes/html/print-interface-adsl.inc.php index 5793d04f21..5cdb55fa04 100644 --- a/includes/html/print-interface-adsl.inc.php +++ b/includes/html/print-interface-adsl.inc.php @@ -53,7 +53,7 @@ $height = '40'; $from = Config::get('time.day'); echo '
'; -echo \LibreNMS\Util\Number::formatSi(($port['ifInOctets_rate'] * 8), 2, 3, 'bps') . " " . \LibreNMS\Util\Number::formatSi(($port['ifOutOctets_rate'] * 8), 2, 3, 'bps'); +echo \LibreNMS\Util\Number::formatSi($port['ifInOctets_rate'] * 8, 2, 3, 'bps') . " " . \LibreNMS\Util\Number::formatSi($port['ifOutOctets_rate'] * 8, 2, 3, 'bps'); echo '
'; $port['graph_type'] = 'port_bits'; echo generate_port_link( diff --git a/includes/html/print-interface-vdsl.inc.php b/includes/html/print-interface-vdsl.inc.php index cb8b661b08..b6f0bbef32 100644 --- a/includes/html/print-interface-vdsl.inc.php +++ b/includes/html/print-interface-vdsl.inc.php @@ -55,7 +55,7 @@ $height = '40'; $from = Config::get('time.day'); echo '
'; -echo \LibreNMS\Util\Number::formatSi(($port['ifInOctets_rate'] * 8), 2, 3, 'bps') . " " . \LibreNMS\Util\Number::formatSi(($port['ifOutOctets_rate'] * 8), 2, 3, 'bps'); +echo \LibreNMS\Util\Number::formatSi($port['ifInOctets_rate'] * 8, 2, 3, 'bps') . " " . \LibreNMS\Util\Number::formatSi($port['ifOutOctets_rate'] * 8, 2, 3, 'bps'); echo '
'; $port['graph_type'] = 'port_bits'; echo generate_port_link( diff --git a/includes/html/reports/ports.csv.inc.php b/includes/html/reports/ports.csv.inc.php index 8cf2b16f81..fa8de82902 100644 --- a/includes/html/reports/ports.csv.inc.php +++ b/includes/html/reports/ports.csv.inc.php @@ -168,8 +168,8 @@ foreach ($ports as $port) { if (port_permitted($port['port_id'], $port['device_id'])) { $speed = \LibreNMS\Util\Number::formatSi($port['ifSpeed'], 2, 3, 'bps'); $type = \LibreNMS\Util\Rewrite::normalizeIfType($port['ifType']); - $port['in_rate'] = \LibreNMS\Util\Number::formatSi(($port['ifInOctets_rate'] * 8), 2, 3, 'bps'); - $port['out_rate'] = \LibreNMS\Util\Number::formatSi(($port['ifOutOctets_rate'] * 8), 2, 3, 'bps'); + $port['in_rate'] = \LibreNMS\Util\Number::formatSi($port['ifInOctets_rate'] * 8, 2, 3, 'bps'); + $port['out_rate'] = \LibreNMS\Util\Number::formatSi($port['ifOutOctets_rate'] * 8, 2, 3, 'bps'); $port = cleanPort($port, $device); $csv[] = [ format_hostname($port), diff --git a/includes/html/table/address-search.inc.php b/includes/html/table/address-search.inc.php index 4460509e81..ad3a3f7397 100644 --- a/includes/html/table/address-search.inc.php +++ b/includes/html/table/address-search.inc.php @@ -69,7 +69,7 @@ if (! isset($sort) || empty($sort)) { $sql .= " ORDER BY $sort"; if (isset($current)) { - $limit_low = (($current * $rowCount) - ($rowCount)); + $limit_low = (($current * $rowCount) - $rowCount); $limit_high = $rowCount; } diff --git a/includes/html/table/alertlog-stats.inc.php b/includes/html/table/alertlog-stats.inc.php index 5f6fac2766..44d22a359f 100644 --- a/includes/html/table/alertlog-stats.inc.php +++ b/includes/html/table/alertlog-stats.inc.php @@ -55,7 +55,7 @@ if (empty($total)) { $sql .= ' GROUP BY D.device_id, R.name ORDER BY COUNT(*) DESC'; if (isset($current)) { - $limit_low = (($current * $rowCount) - ($rowCount)); + $limit_low = (($current * $rowCount) - $rowCount); $limit_high = $rowCount; } diff --git a/includes/html/table/alertlog.inc.php b/includes/html/table/alertlog.inc.php index 104fb42fe6..7c8359cd0d 100644 --- a/includes/html/table/alertlog.inc.php +++ b/includes/html/table/alertlog.inc.php @@ -74,7 +74,7 @@ if (! isset($sort) || empty($sort)) { $sql .= " ORDER BY $sort"; if (isset($current)) { - $limit_low = (($current * $rowCount) - ($rowCount)); + $limit_low = (($current * $rowCount) - $rowCount); $limit_high = $rowCount; } @@ -111,9 +111,9 @@ foreach (dbFetchRows($sql, $param) as $alertlog) { $response[] = [ 'id' => $rulei++, 'time_logged' => $alertlog['humandate'], - 'details' => '', + 'details' => '', 'verbose_details' => "", - 'hostname' => '
' . generate_device_link($dev) . '
' . $fault_detail . '
', + 'hostname' => '
' . generate_device_link($dev) . '
' . $fault_detail . '
', 'alert' => htmlspecialchars($alertlog['alert']), 'status' => "", 'severity' => $alertlog['severity'], diff --git a/includes/html/table/alerts.inc.php b/includes/html/table/alerts.inc.php index 57021cdf6c..dbf94f1c8f 100644 --- a/includes/html/table/alerts.inc.php +++ b/includes/html/table/alerts.inc.php @@ -105,7 +105,7 @@ if (! isset($vars['sort']) || empty($vars['sort'])) { $sql .= " ORDER BY $sort"; if (isset($current)) { - $limit_low = (($current * $rowCount) - ($rowCount)); + $limit_low = (($current * $rowCount) - $rowCount); $limit_high = $rowCount; } @@ -145,7 +145,7 @@ foreach (dbFetchRows($sql, $param) as $alert) { } } - $hostname = '
' . generate_device_link($alert, shorthost(format_hostname($alert))) . '
$rulei++, 'rule' => '' . htmlentities($alert['name']) . '', - 'details' => '', + 'details' => '', 'verbose_details' => "", 'hostname' => $hostname, 'location' => generate_link($alert['location'], ['page' => 'devices', 'location' => $alert['location']]), diff --git a/includes/html/table/arp-search.inc.php b/includes/html/table/arp-search.inc.php index 1de5f8517c..b3dcd4367e 100644 --- a/includes/html/table/arp-search.inc.php +++ b/includes/html/table/arp-search.inc.php @@ -54,7 +54,7 @@ if (! isset($sort) || empty($sort)) { $sql .= " ORDER BY $sort"; if (isset($current)) { - $limit_low = (($current * $rowCount) - ($rowCount)); + $limit_low = (($current * $rowCount) - $rowCount); $limit_high = $rowCount; } diff --git a/includes/html/table/as-selection.inc.php b/includes/html/table/as-selection.inc.php index a87f405db1..54d84d0410 100644 --- a/includes/html/table/as-selection.inc.php +++ b/includes/html/table/as-selection.inc.php @@ -25,7 +25,7 @@ if (! isset($sort) || empty($sort)) { $sql .= " GROUP BY `bgpLocalAs` ORDER BY $sort"; if (isset($current)) { - $limit_low = (($current * $rowCount) - ($rowCount)); + $limit_low = (($current * $rowCount) - $rowCount); $limit_high = $rowCount; } diff --git a/includes/html/table/bills.inc.php b/includes/html/table/bills.inc.php index be5aecffe4..95de085a4d 100644 --- a/includes/html/table/bills.inc.php +++ b/includes/html/table/bills.inc.php @@ -71,7 +71,7 @@ if (! isset($sort) || empty($sort)) { $sql .= "\nORDER BY $sort"; if (isset($current)) { - $limit_low = (($current * $rowCount) - ($rowCount)); + $limit_low = (($current * $rowCount) - $rowCount); $limit_high = $rowCount; } diff --git a/includes/html/table/component.inc.php b/includes/html/table/component.inc.php index 1c498132c1..6d4b04c11c 100644 --- a/includes/html/table/component.inc.php +++ b/includes/html/table/component.inc.php @@ -21,7 +21,7 @@ if (! isset($sort) || empty($sort)) { // Define the Limit parameters if (isset($current)) { - $start = (($current * $rowCount) - ($rowCount)); + $start = (($current * $rowCount) - $rowCount); } if ($rowCount != -1) { $options['limit'] = [$start, $rowCount]; diff --git a/includes/html/table/eventlog.inc.php b/includes/html/table/eventlog.inc.php index d79b622356..a1eb99695a 100644 --- a/includes/html/table/eventlog.inc.php +++ b/includes/html/table/eventlog.inc.php @@ -60,7 +60,7 @@ if (! isset($sort) || empty($sort)) { $sql .= " ORDER BY $sort"; if (isset($current)) { - $limit_low = (($current * $rowCount) - ($rowCount)); + $limit_low = (($current * $rowCount) - $rowCount); $limit_high = $rowCount; } diff --git a/includes/html/table/graylog.inc.php b/includes/html/table/graylog.inc.php index 019888cac5..00ac76eeaf 100644 --- a/includes/html/table/graylog.inc.php +++ b/includes/html/table/graylog.inc.php @@ -31,7 +31,7 @@ if (isset($searchPhrase) && ! empty($searchPhrase)) { } if (isset($current)) { - $offset = ($current * $rowCount) - ($rowCount); + $offset = ($current * $rowCount) - $rowCount; $limit = $rowCount; } diff --git a/includes/html/table/inventory.inc.php b/includes/html/table/inventory.inc.php index 8f364857b6..9655297ad3 100644 --- a/includes/html/table/inventory.inc.php +++ b/includes/html/table/inventory.inc.php @@ -57,7 +57,7 @@ if (! isset($sort) || empty($sort)) { $sql .= " ORDER BY $sort"; if (isset($current)) { - $limit_low = (($current * $rowCount) - ($rowCount)); + $limit_low = (($current * $rowCount) - $rowCount); $limit_high = $rowCount; } diff --git a/includes/html/table/ix-list.inc.php b/includes/html/table/ix-list.inc.php index e2b04aab08..50c8914a21 100644 --- a/includes/html/table/ix-list.inc.php +++ b/includes/html/table/ix-list.inc.php @@ -44,7 +44,7 @@ if (! isset($sort) || empty($sort)) { $sql .= " ORDER BY $sort"; if (isset($current)) { - $limit_low = (($current * $rowCount) - ($rowCount)); + $limit_low = (($current * $rowCount) - $rowCount); $limit_high = $rowCount; } diff --git a/includes/html/table/ix-peers.inc.php b/includes/html/table/ix-peers.inc.php index ca96fa6ca6..a586e455ac 100644 --- a/includes/html/table/ix-peers.inc.php +++ b/includes/html/table/ix-peers.inc.php @@ -57,7 +57,7 @@ if (! isset($sort) || empty($sort)) { $sql .= " ORDER BY $sort"; if (isset($current)) { - $limit_low = (($current * $rowCount) - ($rowCount)); + $limit_low = (($current * $rowCount) - $rowCount); $limit_high = $rowCount; } diff --git a/includes/html/table/mempool-edit.inc.php b/includes/html/table/mempool-edit.inc.php index 6e03adee4e..c1b0108a9d 100644 --- a/includes/html/table/mempool-edit.inc.php +++ b/includes/html/table/mempool-edit.inc.php @@ -27,7 +27,7 @@ if (! isset($sort) || empty($sort)) { $sql .= " ORDER BY $sort"; if (isset($current)) { - $limit_low = ($current * $rowCount) - ($rowCount); + $limit_low = ($current * $rowCount) - $rowCount; $limit_high = $rowCount; } diff --git a/includes/html/table/poll-log.inc.php b/includes/html/table/poll-log.inc.php index eb4bd8fbd4..81d6621159 100644 --- a/includes/html/table/poll-log.inc.php +++ b/includes/html/table/poll-log.inc.php @@ -47,7 +47,7 @@ if (empty($total)) { } if (isset($current)) { - $limit_low = (($current * $rowCount) - ($rowCount)); + $limit_low = (($current * $rowCount) - $rowCount); $limit_high = $rowCount; } diff --git a/includes/html/table/processor-edit.inc.php b/includes/html/table/processor-edit.inc.php index 5246a517d2..edce1f8975 100644 --- a/includes/html/table/processor-edit.inc.php +++ b/includes/html/table/processor-edit.inc.php @@ -27,7 +27,7 @@ if (! isset($sort) || empty($sort)) { $sql .= " ORDER BY $sort"; if (isset($current)) { - $limit_low = ($current * $rowCount) - ($rowCount); + $limit_low = ($current * $rowCount) - $rowCount; $limit_high = $rowCount; } diff --git a/includes/html/table/processor.inc.php b/includes/html/table/processor.inc.php index 7d05e9d480..9e522a224e 100644 --- a/includes/html/table/processor.inc.php +++ b/includes/html/table/processor.inc.php @@ -45,7 +45,7 @@ if (! isset($sort) || empty($sort)) { $sql .= " ORDER BY $sort"; if (isset($current)) { - $limit_low = (($current * $rowCount) - ($rowCount)); + $limit_low = (($current * $rowCount) - $rowCount); $limit_high = $rowCount; } diff --git a/includes/html/table/routing-edit.inc.php b/includes/html/table/routing-edit.inc.php index ee22e0cd86..0e098904b8 100644 --- a/includes/html/table/routing-edit.inc.php +++ b/includes/html/table/routing-edit.inc.php @@ -38,7 +38,7 @@ if (! isset($sort) || empty($sort)) { $sql .= " ORDER BY $sort"; if (isset($current)) { - $limit_low = ($current * $rowCount) - ($rowCount); + $limit_low = ($current * $rowCount) - $rowCount; $limit_high = $rowCount; } diff --git a/includes/html/table/sensors-common.php b/includes/html/table/sensors-common.php index db70476216..bfbb80e706 100644 --- a/includes/html/table/sensors-common.php +++ b/includes/html/table/sensors-common.php @@ -53,7 +53,7 @@ if (! isset($sort) || empty($sort)) { $sql .= " ORDER BY $sort"; if (isset($current)) { - $limit_low = (($current * $rowCount) - ($rowCount)); + $limit_low = (($current * $rowCount) - $rowCount); $limit_high = $rowCount; } diff --git a/includes/html/table/storage-edit.inc.php b/includes/html/table/storage-edit.inc.php index 092e69fe83..a317b0f504 100644 --- a/includes/html/table/storage-edit.inc.php +++ b/includes/html/table/storage-edit.inc.php @@ -27,7 +27,7 @@ if (! isset($sort) || empty($sort)) { $sql .= " ORDER BY $sort"; if (isset($current)) { - $limit_low = ($current * $rowCount) - ($rowCount); + $limit_low = ($current * $rowCount) - $rowCount; $limit_high = $rowCount; } diff --git a/includes/html/table/storage.inc.php b/includes/html/table/storage.inc.php index bd831b13bc..9a6d33df2b 100644 --- a/includes/html/table/storage.inc.php +++ b/includes/html/table/storage.inc.php @@ -52,7 +52,7 @@ if (! isset($sort) || empty($sort)) { $sql .= " ORDER BY $sort"; if (isset($current)) { - $limit_low = (($current * $rowCount) - ($rowCount)); + $limit_low = (($current * $rowCount) - $rowCount); $limit_high = $rowCount; } diff --git a/includes/html/table/tnmsneinfo.inc.php b/includes/html/table/tnmsneinfo.inc.php index 724695c69e..be79ff488a 100644 --- a/includes/html/table/tnmsneinfo.inc.php +++ b/includes/html/table/tnmsneinfo.inc.php @@ -54,7 +54,7 @@ if (isset($vars['device_id'])) { // select only the required rows if (isset($current)) { - $limit_low = (($current * $rowCount) - ($rowCount)); + $limit_low = (($current * $rowCount) - $rowCount); $limit_high = $rowCount; } if ($rowCount != -1) { diff --git a/includes/html/table/toner.inc.php b/includes/html/table/toner.inc.php index bf600d0fc9..2e310be65f 100644 --- a/includes/html/table/toner.inc.php +++ b/includes/html/table/toner.inc.php @@ -46,7 +46,7 @@ if (empty($sort)) { $sql .= " ORDER BY $sort"; if (isset($current)) { - $limit_low = (($current * $rowCount) - ($rowCount)); + $limit_low = (($current * $rowCount) - $rowCount); $limit_high = $rowCount; } diff --git a/includes/html/vars.inc.php b/includes/html/vars.inc.php index f57be98348..4f3791fb55 100644 --- a/includes/html/vars.inc.php +++ b/includes/html/vars.inc.php @@ -7,7 +7,7 @@ foreach ($_GET as $name => $value) { } foreach ($_POST as $name => $value) { - $vars[$name] = ($value); + $vars[$name] = $value; } // don't leak login and other data diff --git a/includes/init.php b/includes/init.php index 55451a9187..0a5ec8e2b2 100644 --- a/includes/init.php +++ b/includes/init.php @@ -112,7 +112,7 @@ try { } catch (Exception $exception) { print_error('ERROR: no valid auth_mechanism defined!'); echo $exception->getMessage() . PHP_EOL; - exit(); + exit; } if (module_selected('web', $init_modules)) { diff --git a/includes/polling/applications/fbsd-nfs-client.inc.php b/includes/polling/applications/fbsd-nfs-client.inc.php index 956a14be2b..f7a6719551 100644 --- a/includes/polling/applications/fbsd-nfs-client.inc.php +++ b/includes/polling/applications/fbsd-nfs-client.inc.php @@ -17,15 +17,15 @@ try { ]; [$nfs['data']['Getattr'], $nfs['data']['Setattr'], $nfs['data']['Lookup'], $nfs['data']['Readlink'], - $nfs['data']['Read'], $nfs['data']['Write'], $nfs['data']['Create'], $nfs['data']['Remove'], $nfs['data']['Rename'], - $nfs['data']['Link'], $nfs['data']['Symlink'], $nfs['data']['Mkdir'], $nfs['data']['Rmdir'], $nfs['data']['Readdir'], - $nfs['data']['RdirPlus'], $nfs['data']['Access'], $nfs['data']['Mknod'], $nfs['data']['Fsstat'], $nfs['data']['Fsinfo'], - $nfs['data']['PathConf'], $nfs['data']['Commit'], $nfs['data']['TimedOut'], $nfs['data']['Invalid'], $nfs['data']['XReplies'], - $nfs['data']['Retries'], $nfs['data']['Requests'], $nfs['data']['AttrHits'], $nfs['data']['AttrMisses'], $nfs['data']['LkupHits'], - $nfs['data']['LkupMisses'], $nfs['data']['BioRHits'], $nfs['data']['BioRMisses'], $nfs['data']['BioWHits'], - $nfs['data']['BioWMisses'], $nfs['data']['BioRLHits'], $nfs['data']['BioRLMisses'], $nfs['data']['BioDHits'], - $nfs['data']['BioDMisses'], $nfs['data']['DirEHits'], $nfs['data']['DirEMisses'], $nfs['data']['AccsHits'], - $nfs['data']['AccsMisses']] = explode("\n", $legacy); + $nfs['data']['Read'], $nfs['data']['Write'], $nfs['data']['Create'], $nfs['data']['Remove'], $nfs['data']['Rename'], + $nfs['data']['Link'], $nfs['data']['Symlink'], $nfs['data']['Mkdir'], $nfs['data']['Rmdir'], $nfs['data']['Readdir'], + $nfs['data']['RdirPlus'], $nfs['data']['Access'], $nfs['data']['Mknod'], $nfs['data']['Fsstat'], $nfs['data']['Fsinfo'], + $nfs['data']['PathConf'], $nfs['data']['Commit'], $nfs['data']['TimedOut'], $nfs['data']['Invalid'], $nfs['data']['XReplies'], + $nfs['data']['Retries'], $nfs['data']['Requests'], $nfs['data']['AttrHits'], $nfs['data']['AttrMisses'], $nfs['data']['LkupHits'], + $nfs['data']['LkupMisses'], $nfs['data']['BioRHits'], $nfs['data']['BioRMisses'], $nfs['data']['BioWHits'], + $nfs['data']['BioWMisses'], $nfs['data']['BioRLHits'], $nfs['data']['BioRLMisses'], $nfs['data']['BioDHits'], + $nfs['data']['BioDMisses'], $nfs['data']['DirEHits'], $nfs['data']['DirEMisses'], $nfs['data']['AccsHits'], + $nfs['data']['AccsMisses']] = explode("\n", $legacy); } catch (JsonAppException $e) { echo PHP_EOL . $name . ':' . $e->getCode() . ':' . $e->getMessage() . PHP_EOL; update_application($app, $e->getCode() . ':' . $e->getMessage(), []); // Set empty metrics and error message diff --git a/includes/polling/applications/fbsd-nfs-server.inc.php b/includes/polling/applications/fbsd-nfs-server.inc.php index 2d325627a2..121cf7981c 100644 --- a/includes/polling/applications/fbsd-nfs-server.inc.php +++ b/includes/polling/applications/fbsd-nfs-server.inc.php @@ -16,13 +16,13 @@ try { 'data' => [], ]; [$nfs['data']['Getattr'], $nfs['data']['Setattr'], $nfs['data']['Lookup'], $nfs['data']['Readlink'], - $nfs['data']['Read'], $nfs['data']['Write'], $nfs['data']['Create'], $nfs['data']['Remove'], - $nfs['data']['Rename'], $nfs['data']['Link'], $nfs['data']['Symlink'], $nfs['data']['Mkdir'], - $nfs['data']['Rmdir'], $nfs['data']['Readdir'], $nfs['data']['RdirPlus'], $nfs['data']['Access'], - $nfs['data']['Mknod'], $nfs['data']['Fsstat'], $nfs['data']['Fsinfo'], $nfs['data']['PathConf'], - $nfs['data']['Commit'], $nfs['data']['RetFailed'], $nfs['data']['Faults'], $nfs['data']['Inprog'], - $nfs['data']['Idem'], $nfs['data']['Nonidem'], $nfs['data']['Misses'], $nfs['data']['WriteOps'], - $nfs['data']['WriteRPC'], $nfs['data']['Opsaved']] = explode("\n", $legacy); + $nfs['data']['Read'], $nfs['data']['Write'], $nfs['data']['Create'], $nfs['data']['Remove'], + $nfs['data']['Rename'], $nfs['data']['Link'], $nfs['data']['Symlink'], $nfs['data']['Mkdir'], + $nfs['data']['Rmdir'], $nfs['data']['Readdir'], $nfs['data']['RdirPlus'], $nfs['data']['Access'], + $nfs['data']['Mknod'], $nfs['data']['Fsstat'], $nfs['data']['Fsinfo'], $nfs['data']['PathConf'], + $nfs['data']['Commit'], $nfs['data']['RetFailed'], $nfs['data']['Faults'], $nfs['data']['Inprog'], + $nfs['data']['Idem'], $nfs['data']['Nonidem'], $nfs['data']['Misses'], $nfs['data']['WriteOps'], + $nfs['data']['WriteRPC'], $nfs['data']['Opsaved']] = explode("\n", $legacy); } catch (JsonAppException $e) { echo PHP_EOL . $name . ':' . $e->getCode() . ':' . $e->getMessage() . PHP_EOL; update_application($app, $e->getCode() . ':' . $e->getMessage(), []); // Set empty metrics and error message diff --git a/includes/polling/applications/ntp-client.inc.php b/includes/polling/applications/ntp-client.inc.php index 60dc1561b8..764ac6b19f 100644 --- a/includes/polling/applications/ntp-client.inc.php +++ b/includes/polling/applications/ntp-client.inc.php @@ -16,7 +16,7 @@ try { 'data' => [], ]; [$ntp['data']['offset'], $ntp['data']['frequency'], $ntp['data']['sys_jitter'], - $ntp['data']['clk_jitter'], $ntp['data']['clk_wander']] = explode("\n", $legacy); + $ntp['data']['clk_jitter'], $ntp['data']['clk_wander']] = explode("\n", $legacy); } catch (JsonAppException $e) { echo PHP_EOL . $name . ':' . $e->getCode() . ':' . $e->getMessage() . PHP_EOL; update_application($app, $e->getCode() . ':' . $e->getMessage(), []); // Set empty metrics and error message diff --git a/includes/polling/applications/ntp-server.inc.php b/includes/polling/applications/ntp-server.inc.php index dc4e0cf5f0..e2ab4f9d84 100644 --- a/includes/polling/applications/ntp-server.inc.php +++ b/includes/polling/applications/ntp-server.inc.php @@ -17,9 +17,9 @@ try { ]; [$ntp['data']['stratum'], $ntp['data']['offset'], $ntp['data']['frequency'], $ntp['data']['jitter'], - $ntp['data']['noise'], $ntp['data']['stability'], $ntp['data']['uptime'], $ntp['data']['buffer_recv'], - $ntp['data']['buffer_free'], $ntp['data']['buffer_used'], $ntp['data']['packets_drop'], - $ntp['data']['packets_ignore'], $ntp['data']['packets_recv'], $ntp['data']['packets_sent']] = explode("\n", $legacy); + $ntp['data']['noise'], $ntp['data']['stability'], $ntp['data']['uptime'], $ntp['data']['buffer_recv'], + $ntp['data']['buffer_free'], $ntp['data']['buffer_used'], $ntp['data']['packets_drop'], + $ntp['data']['packets_ignore'], $ntp['data']['packets_recv'], $ntp['data']['packets_sent']] = explode("\n", $legacy); } catch (JsonAppException $e) { echo PHP_EOL . $name . ':' . $e->getCode() . ':' . $e->getMessage() . PHP_EOL; update_application($app, $e->getCode() . ':' . $e->getMessage(), []); // Set empty metrics and error message diff --git a/includes/polling/applications/nvidia.inc.php b/includes/polling/applications/nvidia.inc.php index be8415282f..2de844a594 100644 --- a/includes/polling/applications/nvidia.inc.php +++ b/includes/polling/applications/nvidia.inc.php @@ -35,10 +35,10 @@ foreach ($gpuArray as $index => $gpu) { if (count($stats) == 19 || count($stats) == 20) { [$gpu, $pwr, $temp, $memtemp, $sm, $mem, $enc, $dec, $mclk, $pclk, $pviol, $tviol, - $fb, $bar1, $sbecc, $dbecc, $pci, $rxpci, $txpci] = $stats; + $fb, $bar1, $sbecc, $dbecc, $pci, $rxpci, $txpci] = $stats; } else { [$gpu, $pwr, $temp, $sm, $mem, $enc, $dec, $mclk, $pclk, $pviol, $tviol, - $fb, $bar1, $sbecc, $dbecc, $pci, $rxpci, $txpci] = $stats; + $fb, $bar1, $sbecc, $dbecc, $pci, $rxpci, $txpci] = $stats; } $sm_total += $sm; diff --git a/includes/polling/applications/php-fpm.inc.php b/includes/polling/applications/php-fpm.inc.php index 321d3323b9..7528007592 100644 --- a/includes/polling/applications/php-fpm.inc.php +++ b/includes/polling/applications/php-fpm.inc.php @@ -13,7 +13,7 @@ if (! empty($agent_data['app'][$name])) { } [$pool,$start_time,$start_since,$accepted_conn,$listen_queue,$max_listen_queue,$listen_queue_len,$idle_processes, - $active_processes,$total_processes,$max_active_processes,$max_children_reached,$slow_requests] = explode("\n", $phpfpm); + $active_processes,$total_processes,$max_active_processes,$max_children_reached,$slow_requests] = explode("\n", $phpfpm); $rrd_name = ['app', $name, $app->app_id]; $rrd_def = RrdDefinition::make() diff --git a/includes/polling/applications/postfix.inc.php b/includes/polling/applications/postfix.inc.php index 4e2dcbfc27..027bbc8561 100644 --- a/includes/polling/applications/postfix.inc.php +++ b/includes/polling/applications/postfix.inc.php @@ -12,8 +12,8 @@ $detail = snmp_walk($device, $detailOID, $options); [$incomingq, $activeq, $deferredq, $holdq] = explode("\n", $mailq); [$received, $delivered, $forwarded, $deferred, $bounced, $rejected, $rejectw, $held, $discarded, $bytesr, - $bytesd, $senders, $sendinghd, $recipients, $recipienthd, $deferralcr, $deferralhid, $chr, $hcrnfqh, $sardnf, - $sarnobu, $bu, $raruu, $hcrin, $sarnfqa, $rardnf, $rarnfqa, $iuscp, $sce, $scp, $urr] = explode("\n", $detail); + $bytesd, $senders, $sendinghd, $recipients, $recipienthd, $deferralcr, $deferralhid, $chr, $hcrnfqh, $sardnf, + $sarnobu, $bu, $raruu, $hcrin, $sarnfqa, $rardnf, $rarnfqa, $iuscp, $sce, $scp, $urr] = explode("\n", $detail); $rrd_name = ['app', $name, $app->app_id]; $rrd_def = RrdDefinition::make() diff --git a/includes/polling/applications/powerdns.inc.php b/includes/polling/applications/powerdns.inc.php index fe1a5166d5..525bc20d1c 100644 --- a/includes/polling/applications/powerdns.inc.php +++ b/includes/polling/applications/powerdns.inc.php @@ -80,7 +80,7 @@ if (isset($legacy)) { $powerdns['udp4-queries'], $powerdns['udp6-answers'], $powerdns['udp6-queries'], - ] = explode("\n", $legacy); + ] = explode("\n", $legacy); } d_echo($powerdns); diff --git a/includes/polling/applications/tinydns.inc.php b/includes/polling/applications/tinydns.inc.php index 30695aec14..a0117e8d15 100644 --- a/includes/polling/applications/tinydns.inc.php +++ b/includes/polling/applications/tinydns.inc.php @@ -56,7 +56,7 @@ if (! empty($agent_data['app'][$name]) && $app->app_id > 0) { [ $a, $ns, $cname, $soa, $ptr, $hinfo, $mx, $txt, $rp, $sig, $key, $aaaa, $axfr, $any, $total, $other, $notauth, $notimpl, $badclass, $noquery - ] = explode(':', $agent_data['app'][$name]); + ] = explode(':', $agent_data['app'][$name]); $fields = [ 'a' => $a, diff --git a/includes/polling/aruba-controller.inc.php b/includes/polling/aruba-controller.inc.php index ee397a8f96..c209903978 100644 --- a/includes/polling/aruba-controller.inc.php +++ b/includes/polling/aruba-controller.inc.php @@ -75,7 +75,7 @@ if ($device['type'] == 'wireless' && $device['os'] == 'arubaos') { $nummonbssid = cast_number($aruba_apstats[$key1][".1.3.6.1.4.1.14823.2.2.1.5.2.1.5.1.10.$radioid"]); $interference = cast_number($aruba_apstats[$key1][".1.3.6.1.4.1.14823.2.2.1.5.3.1.6.1.11.$radioid"]); - $radionum = substr($radioid, (strlen($radioid) - 1), 1); + $radionum = substr($radioid, strlen($radioid) - 1, 1); d_echo($key . PHP_EOL); d_echo($value . PHP_EOL); diff --git a/includes/polling/ports.inc.php b/includes/polling/ports.inc.php index 36b3e4f55d..3dc487403c 100644 --- a/includes/polling/ports.inc.php +++ b/includes/polling/ports.inc.php @@ -806,8 +806,8 @@ foreach ($ports as $port) { echo 'Wrote port debugging data'; } - $port['stats']['ifInBits_rate'] = round(($port['stats']['ifInOctets_rate'] * 8)); - $port['stats']['ifOutBits_rate'] = round(($port['stats']['ifOutOctets_rate'] * 8)); + $port['stats']['ifInBits_rate'] = round($port['stats']['ifInOctets_rate'] * 8); + $port['stats']['ifOutBits_rate'] = round($port['stats']['ifOutOctets_rate'] * 8); // If we have a valid ifSpeed we should populate the stats for checking if (is_numeric($this_port['ifSpeed']) && $this_port['ifSpeed'] > 0) { diff --git a/includes/polling/ports/exalink-fusion.inc.php b/includes/polling/ports/exalink-fusion.inc.php index b70ce9f356..c3c1002220 100644 --- a/includes/polling/ports/exalink-fusion.inc.php +++ b/includes/polling/ports/exalink-fusion.inc.php @@ -47,7 +47,7 @@ $ifType = 'ethernetCsmacd'; foreach ($exa_stats as $name => $tmp_stats) { $e_name = explode('.', $name); - $index = (((int) ($e_name[0])) - 1) * 16 + (int) ($e_name[1]); + $index = (((int) $e_name[0]) - 1) * 16 + (int) $e_name[1]; $port_stats[$index] = []; $port_stats[$index]['ifName'] = $name; $port_stats[$index]['ifType'] = $ifType; diff --git a/includes/polling/ports/port-poe.inc.php b/includes/polling/ports/port-poe.inc.php index 269c889acc..0bb1c4f862 100644 --- a/includes/polling/ports/port-poe.inc.php +++ b/includes/polling/ports/port-poe.inc.php @@ -9,7 +9,7 @@ $rrd_def = RrdDefinition::make() ->addDataset('PortConsumption', 'GAUGE', 0) ->addDataset('PortMaxPwrDrawn', 'GAUGE', 0); -if (($device['os'] == 'vrp')) { +if ($device['os'] == 'vrp') { //Tested against Huawei 5720 access switches if (isset($this_port['hwPoePortEnable'])) { $upd = "$polled:" . $this_port['hwPoePortReferencePower'] . ':' . $this_port['hwPoePortMaximumPower'] . ':' . $this_port['hwPoePortConsumingPower'] . ':' . $this_port['hwPoePortPeakPower']; @@ -25,7 +25,7 @@ if (($device['os'] == 'vrp')) { data_update($device, 'poe', $tags, $fields); echo 'PoE(vrp) '; } -} elseif (($device['os'] == 'linksys-ss')) { +} elseif ($device['os'] == 'linksys-ss') { //Tested 318P if (isset($this_port['pethPsePortAdminEnable'])) { $upd = "$polled:" . $this_port['rlPethPsePortPowerLimit'] . ':' . $this_port['rlPethPsePortOutputPower']; @@ -59,7 +59,7 @@ if (($device['os'] == 'vrp')) { data_update($device, 'poe', $tags, $fields); echo 'PoE(IOS) '; }//end if -} elseif (($device['os'] == 'jetstream')) { +} elseif ($device['os'] == 'jetstream') { if (isset($this_port['tpPoePortStatus'])) { // TP-Link uses .1W for their units; convert to milliwatts. $fields = [ diff --git a/includes/polling/sensors/ber/junos.inc.php b/includes/polling/sensors/ber/junos.inc.php index e2f222890b..190a0f9854 100644 --- a/includes/polling/sensors/ber/junos.inc.php +++ b/includes/polling/sensors/ber/junos.inc.php @@ -4,6 +4,6 @@ if ($device['os'] == 'junos') { echo 'JunOS: '; $sensor_exp_value = snmp_get($device, 'JNX-OPT-IF-EXT-MIB::jnxoptIfOTNPMCurrentFECBERExponent.' . $sensor['sensor_index'] . '.1', '-Oqv'); - $sensor_value = ($sensor_value) * pow(10, -$sensor_exp_value); + $sensor_value = $sensor_value * pow(10, -$sensor_exp_value); unset($sensor_exp_value); } diff --git a/includes/polling/unix-agent.inc.php b/includes/polling/unix-agent.inc.php index 94d8c4cc1f..2c0919bd4b 100644 --- a/includes/polling/unix-agent.inc.php +++ b/includes/polling/unix-agent.inc.php @@ -133,7 +133,7 @@ if ($device['os_group'] == 'unix' || $device['os'] == 'windows') { $days = floor($cputime / 86400); $hours = str_pad(floor(($cputime / 3600) % 24), 2, '0', STR_PAD_LEFT); $minutes = str_pad(floor(($cputime / 60) % 60), 2, '0', STR_PAD_LEFT); - $seconds = str_pad(($cputime % 60), 2, '0', STR_PAD_LEFT); + $seconds = str_pad($cputime % 60, 2, '0', STR_PAD_LEFT); $cputime = ($days > 0 ? "$days-" : '') . "$hours:$minutes:$seconds"; $data[] = ['device_id' => $device['device_id'], 'pid' => $processId, 'user' => $user, 'vsz' => $PageFileUsage + $WorkingSetSize, 'rss' => $WorkingSetSize, 'cputime' => $cputime, 'command' => $process_name]; } diff --git a/includes/polling/wireless/cambium-generic.inc.php b/includes/polling/wireless/cambium-generic.inc.php index 5620208d85..5c9e1087c6 100644 --- a/includes/polling/wireless/cambium-generic.inc.php +++ b/includes/polling/wireless/cambium-generic.inc.php @@ -163,7 +163,7 @@ if (strstr($hardware, 'AP') || strstr($hardware, 'Master') || strstr($hardware, } } //PTP Equipment - $lastLevel = str_replace('"', '', snmp_get($device, 'lastPowerLevel.2', '-Ovqn', 'WHISP-APS-MIB')); +$lastLevel = str_replace('"', '', snmp_get($device, 'lastPowerLevel.2', '-Ovqn', 'WHISP-APS-MIB')); if (is_numeric($lastLevel)) { $rrd_def = RrdDefinition::make()->addDataset('last', 'GAUGE', -100, 0); $fields = [ diff --git a/includes/services.inc.php b/includes/services.inc.php index d261730d05..5f5c96b206 100644 --- a/includes/services.inc.php +++ b/includes/services.inc.php @@ -165,7 +165,7 @@ function poll_service($service) // rrd definition $rrd_def = new RrdDefinition(); foreach ($perf as $k => $v) { - if (($v['uom'] == 'c') && ! (preg_match('/[Uu]ptime/', $k))) { + if (($v['uom'] == 'c') && ! preg_match('/[Uu]ptime/', $k)) { // This is a counter, create the DS as such $rrd_def->addDataset($k, 'COUNTER', 0); } else { @@ -259,7 +259,7 @@ function check_service($command) [$ds,$values] = explode('=', trim($string)); // Keep the first value, discard the others. - [$value,,,] = explode(';', trim($values)); + [$value] = explode(';', trim($values)); $value = trim($value); // Set an empty uom diff --git a/includes/snmp.inc.php b/includes/snmp.inc.php index 41772416ec..0cd3bbcbc7 100644 --- a/includes/snmp.inc.php +++ b/includes/snmp.inc.php @@ -535,7 +535,7 @@ function snmpwalk_cache_numerical_oid($device, $oid, $array = [], $mib = null, $ [$oid,$value] = explode('=', $entry, 2); $oid = trim($oid); $value = trim($value); - [$index,] = explode('.', strrev($oid), 2); + [$index] = explode('.', strrev($oid), 2); if (! strstr($value, 'at this OID') && isset($oid) && isset($index)) { $array[$index][$oid] = $value; } diff --git a/includes/syslog.php b/includes/syslog.php index 7ab46ae7a0..b7eceb21d3 100644 --- a/includes/syslog.php +++ b/includes/syslog.php @@ -65,7 +65,7 @@ function process_syslog($entry, $update) if (Config::get('enable_syslog_hooks') && is_array(Config::getOsSetting($os, 'syslog_hook'))) { foreach (Config::getOsSetting($os, 'syslog_hook') as $k => $v) { $syslogprogmsg = $entry['program'] . ': ' . $entry['msg']; - if ((isset($v['script'])) && (isset($v['regex'])) && ((preg_match($v['regex'], $syslogprogmsg)))) { + if ((isset($v['script'])) && (isset($v['regex'])) && preg_match($v['regex'], $syslogprogmsg)) { shell_exec(escapeshellcmd($v['script']) . ' ' . escapeshellarg($hostname) . ' ' . escapeshellarg($os) . ' ' . escapeshellarg($syslogprogmsg) . ' >/dev/null 2>&1 &'); } } diff --git a/routes/web.php b/routes/web.php index 398b4126c3..b127300842 100644 --- a/routes/web.php +++ b/routes/web.php @@ -29,7 +29,6 @@ Route::get('graph/{path?}', 'GraphController') // WebUI Route::group(['middleware' => ['auth'], 'guard' => 'auth'], function () { - // pages Route::post('alert/{alert}/ack', [\App\Http\Controllers\AlertController::class, 'ack'])->name('alert.ack'); Route::resource('device-groups', 'DeviceGroupController'); diff --git a/scripts/gen_smokeping.php b/scripts/gen_smokeping.php index 8670670380..b458a653d5 100755 --- a/scripts/gen_smokeping.php +++ b/scripts/gen_smokeping.php @@ -33,4 +33,4 @@ if (php_sapi_name() === 'cli') { exit($return); } -exit(); +exit; diff --git a/scripts/json-app-tool.php b/scripts/json-app-tool.php index dc8f105365..20cebe02d3 100755 --- a/scripts/json-app-tool.php +++ b/scripts/json-app-tool.php @@ -63,7 +63,7 @@ if (isset($options['h'])) { prints it in a slightly neater manner and in a manner and in tested order. '; - exit(); + exit; } // make sure we have a JSON file to work with @@ -105,7 +105,7 @@ if ((isset($options['l'])) || ( (! isset($options['t'])) && (! isset($options['s'])) && (! isset($options['m'])) - )) { +)) { exit(0); } diff --git a/scripts/new-os.php b/scripts/new-os.php index b155b1533a..215b0fd23b 100755 --- a/scripts/new-os.php +++ b/scripts/new-os.php @@ -96,7 +96,7 @@ discovery: exit(1); } preg_match('/(.* DEFINITIONS ::)/', $mib_data, $matches); - [$mib_name,] = explode(' ', $matches[0], 2); + [$mib_name] = explode(' ', $matches[0], 2); if (file_exists(Config::get('install_dir') . "/mibs/$vendor/") == false) { mkdir(Config::get('install_dir') . "/mibs/$vendor/"); } diff --git a/scripts/removespikes.php b/scripts/removespikes.php index d79bda83dd..88d75877b3 100755 --- a/scripts/removespikes.php +++ b/scripts/removespikes.php @@ -528,7 +528,7 @@ function calculateOverallStatistics(&$rra, &$samples) foreach ($samples[$rra_num][$ds_num] as $sample) { if (($sample > $rra[$rra_num][$ds_num]['max_cutoff']) || ($sample < $rra[$rra_num][$ds_num]['min_cutoff'])) { - debug(sprintf("Std Kill: Value '%.4e', StandardDev '%.4e', StdDevLimit '%.4e'", $sample, $rra[$rra_num][$ds_num]['standard_deviation'], ($rra[$rra_num][$ds_num]['max_cutoff'] * (1 + $percent)))); + debug(sprintf("Std Kill: Value '%.4e', StandardDev '%.4e', StdDevLimit '%.4e'", $sample, $rra[$rra_num][$ds_num]['standard_deviation'], $rra[$rra_num][$ds_num]['max_cutoff'] * (1 + $percent))); $rra[$rra_num][$ds_num]['stddev_killed']++; $std_kills = true; } else { @@ -540,7 +540,7 @@ function calculateOverallStatistics(&$rra, &$samples) /* not enought samples to calculate */ } elseif ($sample > ($rra[$rra_num][$ds_num]['variance_avg'] * (1 + $percent))) { /* kill based upon variance */ - debug(sprintf("Var Kill: Value '%.4e', VarianceDev '%.4e', VarianceLimit '%.4e'", $sample, $rra[$rra_num][$ds_num]['variance_avg'], ($rra[$rra_num][$ds_num]['variance_avg'] * (1 + $percent)))); + debug(sprintf("Var Kill: Value '%.4e', VarianceDev '%.4e', VarianceLimit '%.4e'", $sample, $rra[$rra_num][$ds_num]['variance_avg'], $rra[$rra_num][$ds_num]['variance_avg'] * (1 + $percent))); $rra[$rra_num][$ds_num]['variance_killed']++; $var_kills = true; } @@ -637,17 +637,17 @@ function outputStatistics($rra) $ds_name[$dskey], $rra_cf[$rra_key], $ds['totalsamples'], - (isset($ds['numsamples']) ? $ds['numsamples'] : '0'), - ($ds['average'] != 'N/A' ? round($ds['average'], 2) : $ds['average']), - ($ds['standard_deviation'] != 'N/A' ? round($ds['standard_deviation'], 2) : $ds['standard_deviation']), - (isset($ds['max_value']) ? round($ds['max_value'], 2) : 'N/A'), - (isset($ds['min_value']) ? round($ds['min_value'], 2) : 'N/A'), - ($ds['max_cutoff'] != 'N/A' ? round($ds['max_cutoff'], 2) : $ds['max_cutoff']), - ($ds['min_cutoff'] != 'N/A' ? round($ds['min_cutoff'], 2) : $ds['min_cutoff']), + isset($ds['numsamples']) ? $ds['numsamples'] : '0', + $ds['average'] != 'N/A' ? round($ds['average'], 2) : $ds['average'], + $ds['standard_deviation'] != 'N/A' ? round($ds['standard_deviation'], 2) : $ds['standard_deviation'], + isset($ds['max_value']) ? round($ds['max_value'], 2) : 'N/A', + isset($ds['min_value']) ? round($ds['min_value'], 2) : 'N/A', + $ds['max_cutoff'] != 'N/A' ? round($ds['max_cutoff'], 2) : $ds['max_cutoff'], + $ds['min_cutoff'] != 'N/A' ? round($ds['min_cutoff'], 2) : $ds['min_cutoff'], $ds['stddev_killed'], $ds['variance_killed'], - ($ds['avgnksamples'] != 'N/A' ? round($ds['avgnksamples'], 2) : $ds['avgnksamples']), - (isset($ds['variance_avg']) ? round($ds['variance_avg'], 2) : 'N/A') + $ds['avgnksamples'] != 'N/A' ? round($ds['avgnksamples'], 2) : $ds['avgnksamples'], + isset($ds['variance_avg']) ? round($ds['variance_avg'], 2) : 'N/A' ); } } @@ -691,17 +691,17 @@ function outputStatistics($rra) $ds_name[$dskey], $rra_cf[$rra_key], $ds['totalsamples'], - (isset($ds['numsamples']) ? $ds['numsamples'] : '0'), - ($ds['average'] != 'N/A' ? round($ds['average'], 2) : $ds['average']), - ($ds['standard_deviation'] != 'N/A' ? round($ds['standard_deviation'], 2) : $ds['standard_deviation']), - (isset($ds['max_value']) ? round($ds['max_value'], 2) : 'N/A'), - (isset($ds['min_value']) ? round($ds['min_value'], 2) : 'N/A'), - ($ds['max_cutoff'] != 'N/A' ? round($ds['max_cutoff'], 2) : $ds['max_cutoff']), - ($ds['min_cutoff'] != 'N/A' ? round($ds['min_cutoff'], 2) : $ds['min_cutoff']), + isset($ds['numsamples']) ? $ds['numsamples'] : '0', + $ds['average'] != 'N/A' ? round($ds['average'], 2) : $ds['average'], + $ds['standard_deviation'] != 'N/A' ? round($ds['standard_deviation'], 2) : $ds['standard_deviation'], + isset($ds['max_value']) ? round($ds['max_value'], 2) : 'N/A', + isset($ds['min_value']) ? round($ds['min_value'], 2) : 'N/A', + $ds['max_cutoff'] != 'N/A' ? round($ds['max_cutoff'], 2) : $ds['max_cutoff'], + $ds['min_cutoff'] != 'N/A' ? round($ds['min_cutoff'], 2) : $ds['min_cutoff'], $ds['stddev_killed'], $ds['variance_killed'], - ($ds['avgnksamples'] != 'N/A' ? round($ds['avgnksamples'], 2) : $ds['avgnksamples']), - (isset($ds['variance_avg']) ? round($ds['variance_avg'], 2) : 'N/A') + $ds['avgnksamples'] != 'N/A' ? round($ds['avgnksamples'], 2) : $ds['avgnksamples'], + isset($ds['variance_avg']) ? round($ds['variance_avg'], 2) : 'N/A' ); } } @@ -866,7 +866,7 @@ function standard_deviation($samples) $sample_square[$current_sample] = pow($samples[$current_sample], 2); } - return sqrt(array_sum($sample_square) / $sample_count - pow((array_sum($samples) / $sample_count), 2)); + return sqrt(array_sum($sample_square) / $sample_count - pow(array_sum($samples) / $sample_count, 2)); } /* display_help - displays the usage of the function */ diff --git a/tests/AuthHTTPTest.php b/tests/AuthHTTPTest.php index 7d8cef3998..b5dfb45ec9 100644 --- a/tests/AuthHTTPTest.php +++ b/tests/AuthHTTPTest.php @@ -27,6 +27,7 @@ namespace LibreNMS\Tests; use LibreNMS\Authentication\LegacyAuth; use LibreNMS\Config; + use function strip_tags; use function strip_tags as strip_tags1; diff --git a/tests/MibTest.php b/tests/MibTest.php index ce53adeee2..77c090a463 100644 --- a/tests/MibTest.php +++ b/tests/MibTest.php @@ -41,6 +41,7 @@ class MibTest extends TestCase * Test mib file in a directory for errors * * @group mibs + * * @dataProvider mibDirs * * @param string $dir @@ -57,6 +58,7 @@ class MibTest extends TestCase * Test that each mib only exists once. * * @group mibs + * * @dataProvider mibFiles * * @param string $path @@ -88,6 +90,7 @@ class MibTest extends TestCase * Test that the file name matches the mib name * * @group mibs + * * @dataProvider mibFiles * * @param string $path @@ -107,6 +110,7 @@ class MibTest extends TestCase * Test each mib file for errors * * @group mibs + * * @dataProvider mibFiles * * @param string $path diff --git a/tests/OSDiscoveryTest.php b/tests/OSDiscoveryTest.php index 9276591675..aa56116c66 100644 --- a/tests/OSDiscoveryTest.php +++ b/tests/OSDiscoveryTest.php @@ -63,6 +63,7 @@ class OSDiscoveryTest extends TestCase * Test each OS provided by osProvider * * @group os + * * @dataProvider osProvider * * @param string $os_name diff --git a/tests/OSModulesTest.php b/tests/OSModulesTest.php index f5fe29c11a..b6831680fd 100644 --- a/tests/OSModulesTest.php +++ b/tests/OSModulesTest.php @@ -64,6 +64,7 @@ class OSModulesTest extends DBTestCase * Test all modules for a particular OS * * @group os + * * @dataProvider dumpedDataProvider */ public function testDataIsValid($os, $variant, $modules) @@ -80,6 +81,7 @@ class OSModulesTest extends DBTestCase * Test all modules for a particular OS * * @group os + * * @dataProvider dumpedDataProvider * * @param string $os base os diff --git a/tests/Unit/Util/RewriteTest.php b/tests/Unit/Util/RewriteTest.php index ea99d393e1..c5350cfdd1 100644 --- a/tests/Unit/Util/RewriteTest.php +++ b/tests/Unit/Util/RewriteTest.php @@ -9,6 +9,7 @@ class RewriteTest extends TestCase { /** * @test + * * @dataProvider validMacProvider */ public function testMacToHex(string $from, string $to): void diff --git a/tests/Unit/Util/StringHelperTest.php b/tests/Unit/Util/StringHelperTest.php index 0c491b83d2..3a6275cc58 100644 --- a/tests/Unit/Util/StringHelperTest.php +++ b/tests/Unit/Util/StringHelperTest.php @@ -70,8 +70,7 @@ class StringHelperTest extends TestCase }; $this->assertTrue(StringHelpers::isStringable($stringable)); - $nonstringable = new class - { + $nonstringable = new class { }; $this->assertFalse(StringHelpers::isStringable($nonstringable)); }