refactor: Refactor fix php codesniffer 3.x issues (#7816)

We cannot use 3.x because it  requires php 5.4, so update to 2.9.1 or newer 2.x release.
This commit is contained in:
Tony Murray
2017-11-29 02:23:19 -06:00
committed by Neil Lathwood
parent ce913cd8d3
commit d6db01abb5
23 changed files with 231 additions and 171 deletions

View File

@@ -302,7 +302,7 @@ class Component
} }
// Ignore type, we cant change that. // Ignore type, we cant change that.
unset($AVP['type'],$OLD[$device_id][$COMPONENT]['type']); unset($AVP['type'], $OLD[$device_id][$COMPONENT]['type']);
// If the Status has changed we need to add a log entry // If the Status has changed we need to add a log entry
if ($AVP['status'] != $OLD[$device_id][$COMPONENT]['status']) { if ($AVP['status'] != $OLD[$device_id][$COMPONENT]['status']) {
@@ -322,7 +322,7 @@ class Component
} }
// Unset the reserved field. We don't want to insert it below. // Unset the reserved field. We don't want to insert it below.
unset($AVP[$k],$OLD[$device_id][$COMPONENT][$k]); unset($AVP[$k], $OLD[$device_id][$COMPONENT][$k]);
} }
} }

View File

@@ -163,7 +163,7 @@ class Config
* @param string $group webui group (only set when initially created) * @param string $group webui group (only set when initially created)
* @param string $sub_group webui subgroup (only set when initially created) * @param string $sub_group webui subgroup (only set when initially created)
*/ */
public static function set($key, $value, $persist = false, $default ='', $descr='', $group='', $sub_group='') public static function set($key, $value, $persist = false, $default = '', $descr = '', $group = '', $sub_group = '')
{ {
global $config; global $config;

View File

@@ -34,7 +34,7 @@
"palanik/corsslim": "^1.1" "palanik/corsslim": "^1.1"
}, },
"require-dev": { "require-dev": {
"squizlabs/php_codesniffer": "2.6.*", "squizlabs/php_codesniffer": "^2.9.1",
"phpunit/phpunit": "4.*", "phpunit/phpunit": "4.*",
"jakub-onderka/php-parallel-lint": "*", "jakub-onderka/php-parallel-lint": "*",
"jakub-onderka/php-console-highlighter": "*", "jakub-onderka/php-console-highlighter": "*",

View File

@@ -63,7 +63,7 @@ header('Content-type: application/json');
$obj = array(array('name' => 'Error: No suggestions found.')); $obj = array(array('name' => 'Error: No suggestions found.'));
$term = array(); $term = array();
$current = false; $current = false;
if (isset($_GET['term'],$_GET['device_id'])) { if (isset($_GET['term'], $_GET['device_id'])) {
$chk = array(); $chk = array();
$_GET['term'] = mres($_GET['term']); $_GET['term'] = mres($_GET['term']);
$_GET['device_id'] = mres($_GET['device_id']); $_GET['device_id'] = mres($_GET['device_id']);

View File

@@ -80,7 +80,7 @@ if (empty($rule)) {
$_POST['target'] = $target; $_POST['target'] = $target;
$_POST['map_id'] = ''; $_POST['map_id'] = '';
include 'create-map-item.inc.php'; include 'create-map-item.inc.php';
unset($ret,$target,$raw,$rule,$msg,$map_id); unset($ret, $target, $raw, $rule, $msg, $map_id);
} }
} }
} else { } else {

View File

@@ -50,7 +50,7 @@ if (file_exists($config['install_dir']."/includes/alerts/transport.".$transport.
$opts = $config['alert']['transports'][$transport]; $opts = $config['alert']['transports'][$transport];
if ($opts) { if ($opts) {
eval('$tmp = function($obj,$opts) { global $config; '.file_get_contents($config['install_dir'].'/includes/alerts/transport.'.$transport.'.php').' return false; };'); eval('$tmp = function($obj,$opts) { global $config; '.file_get_contents($config['install_dir'].'/includes/alerts/transport.'.$transport.'.php').' return false; };');
$tmp = $tmp($obj,$opts); $tmp = $tmp($obj, $opts);
if ($tmp) { if ($tmp) {
$status = 'ok'; $status = 'ok';
} }

View File

@@ -53,7 +53,8 @@ if (is_admin() !== false) {
<label class="col-sm-4 control-label" for="port_id">Port</label> <label class="col-sm-4 control-label" for="port_id">Port</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select class="form-control input-sm" id="port_id" name="port_id"> <select class="form-control input-sm" id="port_id" name="port_id">
<?php if (is_array($port)) { <?php
if (is_array($port)) {
// Need to pre-populate port as we've got a port pre-selected // Need to pre-populate port as we've got a port pre-selected
foreach (dbFetch('SELECT * FROM ports WHERE device_id = ?', array($port_device_id)) as $interface) { foreach (dbFetch('SELECT * FROM ports WHERE device_id = ?', array($port_device_id)) as $interface) {
$interface = cleanPort($interface); $interface = cleanPort($interface);
@@ -61,7 +62,8 @@ if (is_admin() !== false) {
$selected = $interface['port_id'] === $port['port_id'] ? " selected" : ""; $selected = $interface['port_id'] === $port['port_id'] ? " selected" : "";
echo "<option value='${interface['port_id']}' $selected>$string</option>\n"; echo "<option value='${interface['port_id']}' $selected>$string</option>\n";
} }
} ?> }
?>
</select> </select>
</div> </div>
</div> </div>

View File

@@ -221,9 +221,12 @@ echo "</td></tr>";
<div class="col-md-6 col-md-offset-3"> <div class="col-md-6 col-md-offset-3">
<form class="form-inline" role="form" method="post"> <form class="form-inline" role="form" method="post">
<input type="hidden" name="stage" value="1"> <input type="hidden" name="stage" value="1">
<button type="submit" class="btn btn-success pull-right" <?php if (!$complete) { <button type="submit" class="btn btn-success pull-right"
<?php
if (!$complete) {
echo "disabled='disabled'"; echo "disabled='disabled'";
} ?>>Next Stage</button> }
?>>Next Stage</button>
</form> </form>
</div> </div>
</div> </div>
@@ -498,9 +501,12 @@ if (Auth::get()->canManageUsers()) {
<input type="hidden" name="dbpass" value="<?php echo $dbpass; ?>"> <input type="hidden" name="dbpass" value="<?php echo $dbpass; ?>">
<input type="hidden" name="dbname" value="<?php echo $dbname; ?>"> <input type="hidden" name="dbname" value="<?php echo $dbname; ?>">
<input type="hidden" name="dbsocket" value="<?php echo $dbsocket; ?>"> <input type="hidden" name="dbsocket" value="<?php echo $dbsocket; ?>">
<button type="submit" class="btn btn-success pull-right" <?php if ($proceed == "1") { <button type="submit" class="btn btn-success pull-right"
<?php
if ($proceed == "1") {
echo "disabled='disabled'"; echo "disabled='disabled'";
} ?>>Generate Config</button> }
?>>Generate Config</button>
</form> </form>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">

View File

@@ -99,41 +99,41 @@ if (bill_permitted($bill_id)) {
'transfer' => 'Transfer Graphs', 'transfer' => 'Transfer Graphs',
'history' => 'Historical Graphs' 'history' => 'Historical Graphs'
); );
if ($_SESSION['userlevel'] >= '10') { if ($_SESSION['userlevel'] >= '10') {
$menu_options['edit'] = 'Edit'; $menu_options['edit'] = 'Edit';
$menu_options['delete'] = 'Delete'; $menu_options['delete'] = 'Delete';
$menu_options['reset'] = 'Reset'; $menu_options['reset'] = 'Reset';
} }
$sep = ''; $sep = '';
foreach ($menu_options as $option => $text) { foreach ($menu_options as $option => $text) {
echo $sep; echo $sep;
if ($vars['view'] == $option) { if ($vars['view'] == $option) {
echo "<span class='pagemenu-selected'>"; echo "<span class='pagemenu-selected'>";
}
echo generate_link($text, $vars, array('view' => $option));
if ($vars['view'] == $option) {
echo '</span>';
}
$sep = ' | ';
} }
echo generate_link($text, $vars, array('view' => $option));
if ($vars['view'] == $option) {
echo '</span>';
}
$sep = ' | ';
}
echo '<div style="font-weight: bold; float: right;"><a href="'.generate_url(array('page' => 'bills')).'/"><i class="fa fa-arrow-left fa-lg icon-theme" aria-hidden="true"></i> Back to Bills</a></div>'; echo '<div style="font-weight: bold; float: right;"><a href="'.generate_url(array('page' => 'bills')).'/"><i class="fa fa-arrow-left fa-lg icon-theme" aria-hidden="true"></i> Back to Bills</a></div>';
print_optionbar_end(); print_optionbar_end();
if ($vars['view'] == 'edit' && $_SESSION['userlevel'] >= '10') { if ($vars['view'] == 'edit' && $_SESSION['userlevel'] >= '10') {
include 'pages/bill/edit.inc.php'; include 'pages/bill/edit.inc.php';
} elseif ($vars['view'] == 'delete' && $_SESSION['userlevel'] >= '10') { } elseif ($vars['view'] == 'delete' && $_SESSION['userlevel'] >= '10') {
include 'pages/bill/delete.inc.php'; include 'pages/bill/delete.inc.php';
} elseif ($vars['view'] == 'reset' && $_SESSION['userlevel'] >= '10') { } elseif ($vars['view'] == 'reset' && $_SESSION['userlevel'] >= '10') {
include 'pages/bill/reset.inc.php'; include 'pages/bill/reset.inc.php';
} elseif ($vars['view'] == 'history') { } elseif ($vars['view'] == 'history') {
include 'pages/bill/history.inc.php'; include 'pages/bill/history.inc.php';
} elseif ($vars['view'] == 'transfer') { } elseif ($vars['view'] == 'transfer') {
include 'pages/bill/transfer.inc.php'; include 'pages/bill/transfer.inc.php';
} elseif ($vars['view'] == 'quick' || $vars['view'] == 'accurate') { } elseif ($vars['view'] == 'quick' || $vars['view'] == 'accurate') {
?> ?>
<?php if ($bill_data['bill_type'] == 'quota') { ?> <?php if ($bill_data['bill_type'] == 'quota') { ?>
@@ -147,18 +147,18 @@ if (bill_permitted($bill_id)) {
<br /><br /> <br /><br />
<div class="row"> <div class="row">
<div class="col-lg-6 col-lg-push-6"> <div class="col-lg-6 col-lg-push-6">
<?php print_port_list() ?> <?php print_port_list() ?>
</div>
<div class="col-lg-6 col-lg-pull-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
Bill Summary
</h3>
</div> </div>
<div class="col-lg-6 col-lg-pull-6"> <table class="table">
<div class="panel panel-default"> <tr>
<div class="panel-heading">
<h3 class="panel-title">
Bill Summary
</h3>
</div>
<table class="table">
<tr>
<?php if ($bill_data['bill_type'] == 'quota') { <?php if ($bill_data['bill_type'] == 'quota') {
// The Customer is billed based on a pre-paid quota with overage in xB // The Customer is billed based on a pre-paid quota with overage in xB
$percent = round((($total_data) / $bill_data['bill_quota'] * 100), 2); $percent = round((($total_data) / $bill_data['bill_quota'] * 100), 2);
@@ -204,17 +204,17 @@ if (bill_permitted($bill_id)) {
<?php }//end if <?php }//end if
?> ?>
</tr> </tr>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
<?php <?php
$lastmonth = dbFetchCell('SELECT UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 MONTH))'); $lastmonth = dbFetchCell('SELECT UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 MONTH))');
$yesterday = dbFetchCell('SELECT UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 DAY))'); $yesterday = dbFetchCell('SELECT UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 DAY))');
$rightnow = date(U); $rightnow = date(U);
if ($vars['view'] == 'accurate') { if ($vars['view'] == 'accurate') {
$bi = "<img src='billing-graph.php?bill_id=".$bill_id.'&amp;bill_code='.$_GET['bill_code']; $bi = "<img src='billing-graph.php?bill_id=".$bill_id.'&amp;bill_code='.$_GET['bill_code'];
@@ -255,28 +255,28 @@ if ($vars['view'] == 'accurate') {
}//end if }//end if
?> ?>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title">Billing View</h3> <h3 class="panel-title">Billing View</h3>
</div> </div>
<?php echo $bi ?> <?php echo $bi ?>
</div> </div>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title">24 Hour View</h3> <h3 class="panel-title">24 Hour View</h3>
</div> </div>
<?php echo $di ?> <?php echo $di ?>
</div> </div>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title">Monthly View</h3> <h3 class="panel-title">Monthly View</h3>
</div> </div>
<?php echo $mi ?> <?php echo $mi ?>
</div> </div>
<?php <?php
} //end if } //end if
} else { } else {
include 'includes/error-no-perm.inc.php'; include 'includes/error-no-perm.inc.php';
}//end if }//end if

View File

@@ -9,14 +9,20 @@
<label class="col-sm-4 control-label" for="bill_type">Billing Type</label> <label class="col-sm-4 control-label" for="bill_type">Billing Type</label>
<div class="col-sm-8"> <div class="col-sm-8">
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="bill_type" id="bill_type_cdr" value="cdr" <?php if ($bill_data['bill_type'] == 'cdr') { <input type="radio" name="bill_type" id="bill_type_cdr" value="cdr"
echo "checked"; <?php
} ?> onchange="javascript: billType();" /> CDR 95th if ($bill_data['bill_type'] == 'cdr') {
echo "checked";
}
?> onchange="javascript: billType();" /> CDR 95th
</label> </label>
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="bill_type" id="bill_type_quota" value="quota" <?php if ($bill_data['bill_type'] == 'quota') { <input type="radio" name="bill_type" id="bill_type_quota" value="quota"
echo "checked"; <?php
} ?> onchange="javascript: billType();" /> Quota if ($bill_data['bill_type'] == 'quota') {
echo "checked";
}
?> onchange="javascript: billType();" /> Quota
</label> </label>
</div> </div>
</div> </div>

View File

@@ -128,7 +128,7 @@ if ($bill_data['bill_type'] == 'cdr') {
<?php } <?php }
if (!$emptyCheck) { ?> if (!$emptyCheck) { ?>
<div class="alert alert-info">There are no ports assigned to this bill</alert> <div class="alert alert-info">There are no ports assigned to this bill</alert>
<?php } ?> <?php } ?>
</div> </div>

View File

@@ -127,21 +127,33 @@ include 'includes/modal/new_bill.inc.php';
</select> </select>
<select name='bill_type' id='bill_type' class="form-control input-sm"> <select name='bill_type' id='bill_type' class="form-control input-sm">
<option value=''>All Types</option> <option value=''>All Types</option>
<option value='cdr' <?php if ($_GET['bill_type'] === 'cdr') { <option value='cdr'
echo 'selected'; <?php
} ?>>CDR</option> if ($_GET['bill_type'] === 'cdr') {
<option value='quota' <?php if ($_GET['bill_type'] === 'quota') { echo 'selected';
echo 'selected'; }
} ?>>Quota</option> ?>>CDR</option>
<option value='quota'
<?php
if ($_GET['bill_type'] === 'quota') {
echo 'selected';
}
?>>Quota</option>
</select> </select>
<select name='state' id='state' class="form-control input-sm"> <select name='state' id='state' class="form-control input-sm">
<option value=''>All States</option> <option value=''>All States</option>
<option value='under' <?php if ($_GET['state'] === 'under') { <option value='under'
echo 'selected'; <?php
} ?>>Under Quota</option> if ($_GET['state'] === 'under') {
<option value='over' <?php if ($_GET['state'] === 'over') { echo 'selected';
echo 'selected'; }
} ?>>Over Quota</option> ?>>Under Quota</option>
<option value='over'
<?php
if ($_GET['state'] === 'over') {
echo 'selected';
}
?>>Over Quota</option>
</select> </select>
</fieldset> </fieldset>
</span> </span>

View File

@@ -145,33 +145,45 @@ if ($updated && $update_message) {
<div class="form-group"> <div class="form-group">
<label for="sysLocation" class="col-sm-2 control-label">Override sysLocation:</label> <label for="sysLocation" class="col-sm-2 control-label">Override sysLocation:</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input onclick="edit.sysLocation.disabled=!edit.override_sysLocation.checked" type="checkbox" name="override_sysLocation"<?php if ($override_sysLocation) { <input onclick="edit.sysLocation.disabled=!edit.override_sysLocation.checked" type="checkbox" name="override_sysLocation"
echo(' checked="1"'); <?php
} ?> /> if ($override_sysLocation) {
echo(' checked="1"');
}
?> />
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-sm-2"></div> <div class="col-sm-2"></div>
<div class="col-sm-6"> <div class="col-sm-6">
<input id="sysLocation" name="sysLocation" class="form-control" <?php if (!$override_sysLocation) { <input id="sysLocation" name="sysLocation" class="form-control"
echo(' disabled="1"'); <?php
} ?> value="<?php echo($override_sysLocation_string); ?>" /> if (!$override_sysLocation) {
echo(' disabled="1"');
}
?> value="<?php echo($override_sysLocation_string); ?>" />
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="disabled" class="col-sm-2 control-label">Disable:</label> <label for="disabled" class="col-sm-2 control-label">Disable:</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input name="disabled" type="checkbox" id="disabled" value="1" <?php if ($device["disabled"]) { <input name="disabled" type="checkbox" id="disabled" value="1"
echo("checked=checked"); <?php
} ?> /> if ($device["disabled"]) {
echo("checked=checked");
}
?> />
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="ignore" class="col-sm-2 control-label">Ignore</label> <label for="ignore" class="col-sm-2 control-label">Ignore</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input name="ignore" type="checkbox" id="ignore" value="1" <?php if ($device['ignore']) { <input name="ignore" type="checkbox" id="ignore" value="1"
echo("checked=checked"); <?php
} ?> /> if ($device['ignore']) {
echo("checked=checked");
}
?> />
</div> </div>
</div> </div>
<div class="row"> <div class="row">

View File

@@ -114,22 +114,37 @@ foreach ($results as $data) {
?> ?>
</select> </select>
<input type="text" name="hostname" id="hostname" title="Hostname" class="form-control input-sm" <?php if (strlen($vars['hostname'])) { <input type="text" name="hostname" id="hostname" title="Hostname" class="form-control input-sm"
echo('value="'.$vars['hostname'].'"'); <?php
} ?> placeholder="Hostname" /> if (strlen($vars['hostname'])) {
echo('value="' . $vars['hostname'] . '"');
}
?> placeholder="Hostname"/>
</div> </div>
<div class="form-group"> <div class="form-group">
<select name="state" id="state" class="form-control input-sm"> <select name="state" id="state" class="form-control input-sm">
<option value="">All States</option> <option value="">All States</option>
<option value="up" <?php if ($vars['state'] == "up") { <option value="up"
echo("selected"); <?php
} ?>>Up</option> if ($vars['state'] == "up") {
<option value="down"<?php if ($vars['state'] == "down") { echo("selected");
echo("selected"); }
} ?>>Down</option> ?>>Up
<option value="admindown" <?php if ($vars['state'] == "admindown") { </option>
echo("selected"); <option value="down"
} ?>>Shutdown</option> <?php
if ($vars['state'] == "down") {
echo("selected");
}
?>>Down
</option>
<option value="admindown"
<?php
if ($vars['state'] == "admindown") {
echo("selected");
}
?>>Shutdown
</option>
</select> </select>
<select name="ifSpeed" id="ifSpeed" class="form-control input-sm"> <select name="ifSpeed" id="ifSpeed" class="form-control input-sm">
@@ -201,9 +216,12 @@ foreach ($ports as $data) {
</select> </select>
</div> </div>
<div class="form-group"> <div class="form-group">
<input title="Port Description" type="text" name="ifAlias" id="ifAlias" class="form-control input-sm" <?php if (strlen($vars['ifAlias'])) { <input title="Port Description" type="text" name="ifAlias" id="ifAlias" class="form-control input-sm"
echo('value="'.$vars['ifAlias'].'"'); <?php
} ?> placeholder="Port Description"/> if (strlen($vars['ifAlias'])) {
echo('value="' . $vars['ifAlias'] . '"');
}
?> placeholder="Port Description"/>
<select title="Location" name="location" id="location" class="form-control input-sm"> <select title="Location" name="location" id="location" class="form-control input-sm">
<option value="">All Locations</option> <option value="">All Locations</option>
<?php <?php
@@ -223,17 +241,26 @@ foreach (getlocations() as $location) {
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="ignore">Ignored</label> <label for="ignore">Ignored</label>
<input type=checkbox id="ignore" name="ignore" value="1" <?php if ($vars['ignore']) { <input type=checkbox id="ignore" name="ignore" value="1"
echo("checked"); <?php
} ?> > if ($vars['ignore']) {
echo("checked");
}
?> >
<label for="disabled">Disabled</label> <label for="disabled">Disabled</label>
<input type=checkbox id="disabled" name="disabled" value=1 <?php if ($vars['disabled']) { <input type=checkbox id="disabled" name="disabled" value=1
echo("checked"); <?php
} ?> > if ($vars['disabled']) {
echo("checked");
}
?> >
<label for="deleted">Deleted</label> <label for="deleted">Deleted</label>
<input type=checkbox id="deleted" name="deleted" value=1 <?php if ($vars['deleted']) { <input type=checkbox id="deleted" name="deleted" value=1
echo("checked"); <?php
} ?> > if ($vars['deleted']) {
echo("checked");
}
?> >
</div> </div>
<button type="submit" class="btn btn-default btn-sm">Search</button> <button type="submit" class="btn btn-default btn-sm">Search</button>
<a class="btn btn-default btn-sm" href="<?php echo(generate_url(array('page' => 'ports', 'section' => $vars['section'], 'bare' => $vars['bare']))); ?>" title="Reset critera to default." >Reset</a> <a class="btn btn-default btn-sm" href="<?php echo(generate_url(array('page' => 'ports', 'section' => $vars['section'], 'bare' => $vars['bare']))); ?>" title="Reset critera to default." >Reset</a>

View File

@@ -849,7 +849,7 @@ function ExtTransports($obj)
$obj['msg'] = $msg; $obj['msg'] = $msg;
echo $transport.' => '; echo $transport.' => ';
eval('$tmp = function($obj,$opts) { global $config; '.file_get_contents($config['install_dir'].'/includes/alerts/transport.'.$transport.'.php').' return false; };'); eval('$tmp = function($obj,$opts) { global $config; '.file_get_contents($config['install_dir'].'/includes/alerts/transport.'.$transport.'.php').' return false; };');
$tmp = $tmp($obj,$opts); $tmp = $tmp($obj, $opts);
$prefix = array( 0=>"recovery", 1=>$obj['severity']." alert", 2=>"acknowledgment" ); $prefix = array( 0=>"recovery", 1=>$obj['severity']." alert", 2=>"acknowledgment" );
$prefix[3] = &$prefix[0]; $prefix[3] = &$prefix[0];
$prefix[4] = &$prefix[0]; $prefix[4] = &$prefix[0];

View File

@@ -74,7 +74,7 @@ if (is_array($hrDevice_array)) {
discover_processor($valid['processor'], $device, $usage_oid, $index, 'hr', $descr, '1', $usage, null, $hrDeviceIndex); discover_processor($valid['processor'], $device, $usage_oid, $index, 'hr', $descr, '1', $usage, null, $hrDeviceIndex);
} }
unset($old_rrd,$new_rrd,$descr,$entry,$usage_oid,$index,$usage,$hrDeviceIndex,$descr_array); unset($old_rrd, $new_rrd, $descr, $entry, $usage_oid, $index, $usage, $hrDeviceIndex, $descr_array);
}//end if }//end if
unset($entry); unset($entry);

View File

@@ -42,4 +42,4 @@ $fields = array (
); );
$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def'); $tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
data_update($device, 'app', $tags, $fields); data_update($device, 'app', $tags, $fields);
unset($lines , $freeswitch, $rrd_name, $rrd_def, $fields, $tags); unset($lines, $freeswitch, $rrd_name, $rrd_def, $fields, $tags);

View File

@@ -76,4 +76,4 @@ $fields = array (
$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def'); $tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
data_update($device, 'app', $tags, $fields); data_update($device, 'app', $tags, $fields);
unset($lines , $unbound, $rrd_name, $rrd_def, $fields, $tags); unset($lines, $unbound, $rrd_name, $rrd_def, $fields, $tags);

View File

@@ -43,5 +43,5 @@ if ($device['os_group'] == 'cisco' && $device['os'] == 'asa' && $device['type']
echo ' ASA Connections'; echo ' ASA Connections';
} }
unset($data,$rrd_def); unset($data, $rrd_def);
}//end if }//end if

View File

@@ -47,5 +47,5 @@ foreach ($db_info_list as $db_info) {
* Finished discovering MEF Links information. * Finished discovering MEF Links information.
*/ */
unset($db_info_list,$current_mefinfo); unset($db_info_list, $current_mefinfo);
echo PHP_EOL; echo PHP_EOL;

View File

@@ -93,4 +93,4 @@ if ($num_radios > 1) {
); );
} }
poll_mib_def($device, "MWRM-RADIO-MIB:ceragon-radio", "ceraos", $mib_oids, $mib_graphs, $graphs); poll_mib_def($device, "MWRM-RADIO-MIB:ceragon-radio", "ceraos", $mib_oids, $mib_graphs, $graphs);
unset($feature, $num_radios, $radioNumber, $ifIndex, $ifIndex_array, $ifName, $ifDescr, $mib_graphs, $mib_oids, $snmp_get_oids); unset($feature, $num_radios, $radioNumber, $ifIndex, $ifIndex_array, $ifName, $ifDescr, $mib_graphs, $mib_oids, $snmp_get_oids);

View File

@@ -15,9 +15,7 @@
if (strstr($sysObjectId, '.6321.1.2.3')) { // E5-1xx Series if (strstr($sysObjectId, '.6321.1.2.3')) { // E5-1xx Series
if (strpos($device['sysObjectID'], 'enterprises.6321.1.2.3.4') !== false) { // E5-121 if (strpos($device['sysObjectID'], 'enterprises.6321.1.2.3.4') !== false) { // E5-121
$version = snmp_get($device, 'iesSlotModuleFWVersion.0.0', '-Oqv', '+E5-121-IESCOMMON-MIB', 'calix'); $version = snmp_get($device, 'iesSlotModuleFWVersion.0.0', '-Oqv', '+E5-121-IESCOMMON-MIB', 'calix');
$hardware = snmp_get($device, 'iesSlotModuleDescr.0.0', '-Ovqs', '+E5-121-IESCOMMON-MIB', 'calix'); $hardware = snmp_get($device, 'iesSlotModuleDescr.0.0', '-Ovqs', '+E5-121-IESCOMMON-MIB', 'calix');
$serial = snmp_get($device, 'iesChassisSerialNumber.0', '-OQv', '+E5-121-IESCOMMON-MIB', 'calix'); $serial = snmp_get($device, 'iesChassisSerialNumber.0', '-OQv', '+E5-121-IESCOMMON-MIB', 'calix');
@@ -29,7 +27,6 @@ if (strstr($sysObjectId, '.6321.1.2.3')) { // E5-1xx Series
} }
if (strpos($device['sysObjectID'], 'enterprises.6321.1.2.3.3') !== false) { // E5-120 if (strpos($device['sysObjectID'], 'enterprises.6321.1.2.3.3') !== false) { // E5-120
$version = snmp_get($device, 'iesSlotModuleFWVersion.0.0', '-Oqv', '+E5-120-IESCOMMON-MIB', 'calix'); $version = snmp_get($device, 'iesSlotModuleFWVersion.0.0', '-Oqv', '+E5-120-IESCOMMON-MIB', 'calix');
$hardware = snmp_get($device, 'iesSlotModuleDescr.0.0', '-Ovqs', '+E5-120-IESCOMMON-MIB', 'calix'); $hardware = snmp_get($device, 'iesSlotModuleDescr.0.0', '-Ovqs', '+E5-120-IESCOMMON-MIB', 'calix');
$serial = snmp_get($device, 'iesChassisSerialNumber.0', '-OQv', '+E5-120-IESCOMMON-MIB', 'calix'); $serial = snmp_get($device, 'iesChassisSerialNumber.0', '-OQv', '+E5-120-IESCOMMON-MIB', 'calix');
@@ -41,7 +38,6 @@ if (strstr($sysObjectId, '.6321.1.2.3')) { // E5-1xx Series
} }
if (strpos($device['sysObjectID'], 'enterprises.6321.1.2.3.2') !== false) { // E5-111 if (strpos($device['sysObjectID'], 'enterprises.6321.1.2.3.2') !== false) { // E5-111
$version = snmp_get($device, 'iesSlotModuleFWVersion.0.0', '-Oqv', '+E5-111-IESCOMMON-MIB', 'calix'); $version = snmp_get($device, 'iesSlotModuleFWVersion.0.0', '-Oqv', '+E5-111-IESCOMMON-MIB', 'calix');
$hardware = snmp_get($device, 'iesSlotModuleDescr.0.0', '-Ovqs', '+E5-111-IESCOMMON-MIB', 'calix'); $hardware = snmp_get($device, 'iesSlotModuleDescr.0.0', '-Ovqs', '+E5-111-IESCOMMON-MIB', 'calix');
$serial = snmp_get($device, 'iesChassisSerialNumber.0', '-OQv', '+E5-111-IESCOMMON-MIB', 'calix'); $serial = snmp_get($device, 'iesChassisSerialNumber.0', '-OQv', '+E5-111-IESCOMMON-MIB', 'calix');
@@ -53,7 +49,6 @@ if (strstr($sysObjectId, '.6321.1.2.3')) { // E5-1xx Series
} }
if (strpos($device['sysObjectID'], 'enterprises.6321.1.2.3.1') !== false) { // E5-110 if (strpos($device['sysObjectID'], 'enterprises.6321.1.2.3.1') !== false) { // E5-110
$version = snmp_get($device, 'iesSlotModuleFWVersion.0.0', '-Oqv', '+E5-110-IESCOMMON-MIB', 'calix'); $version = snmp_get($device, 'iesSlotModuleFWVersion.0.0', '-Oqv', '+E5-110-IESCOMMON-MIB', 'calix');
$hardware = snmp_get($device, 'iesSlotModuleDescr.0.0', '-Ovqs', '+E5-110-IESCOMMON-MIB', 'calix'); $hardware = snmp_get($device, 'iesSlotModuleDescr.0.0', '-Ovqs', '+E5-110-IESCOMMON-MIB', 'calix');
$serial = snmp_get($device, 'iesChassisSerialNumber.0', '-OQv', '+E5-110-IESCOMMON-MIB', 'calix'); $serial = snmp_get($device, 'iesChassisSerialNumber.0', '-OQv', '+E5-110-IESCOMMON-MIB', 'calix');

View File

@@ -54,7 +54,7 @@ if (strstr($hardware, 'CMM') == false) {
$tags = compact('rrd_def'); $tags = compact('rrd_def');
data_update($device, 'cambium-generic-signalHV', $tags, $fields); data_update($device, 'cambium-generic-signalHV', $tags, $fields);
$graphs['cambium_generic_signalHV'] = true; $graphs['cambium_generic_signalHV'] = true;
unset($rrd_filename,$vertical,$horizontal,$combined); unset($rrd_filename, $vertical, $horizontal, $combined);
} }
$rssi = snmp_get($device, "1.3.6.1.4.1.161.19.3.2.2.2.0", "-Ovqn", ""); $rssi = snmp_get($device, "1.3.6.1.4.1.161.19.3.2.2.2.0", "-Ovqn", "");
@@ -66,7 +66,7 @@ if (strstr($hardware, 'CMM') == false) {
$tags = compact('rrd_def'); $tags = compact('rrd_def');
data_update($device, 'cambium-generic-rssi', $tags, $fields); data_update($device, 'cambium-generic-rssi', $tags, $fields);
$graphs['cambium_generic_rssi'] = true; $graphs['cambium_generic_rssi'] = true;
unset($rrd_filename,$rssi); unset($rrd_filename, $rssi);
} }
$jitter = snmp_get($device, "jitter.0", "-Ovqn", "WHISP-SM-MIB"); $jitter = snmp_get($device, "jitter.0", "-Ovqn", "WHISP-SM-MIB");
@@ -78,7 +78,7 @@ if (strstr($hardware, 'CMM') == false) {
$tags = compact('rrd_def'); $tags = compact('rrd_def');
data_update($device, 'cambium-generic-jitter', $tags, $fields); data_update($device, 'cambium-generic-jitter', $tags, $fields);
$graphs['cambium_generic_jitter'] = true; $graphs['cambium_generic_jitter'] = true;
unset($rrd_filename,$jitter); unset($rrd_filename, $jitter);
} }
$horizontal = str_replace('"', "", snmp_get($device, "radioDbmHorizontal.0", "-Ovqn", "WHISP-SM-MIB")); $horizontal = str_replace('"', "", snmp_get($device, "radioDbmHorizontal.0", "-Ovqn", "WHISP-SM-MIB"));
@@ -94,7 +94,7 @@ if (strstr($hardware, 'CMM') == false) {
$tags = compact('rrd_def'); $tags = compact('rrd_def');
data_update($device, 'cambium-generic-450-slaveHV', $tags, $fields); data_update($device, 'cambium-generic-450-slaveHV', $tags, $fields);
$graphs['cambium_generic_450_slaveHV'] = true; $graphs['cambium_generic_450_slaveHV'] = true;
unset($rrd_filename,$horizontal,$vertical); unset($rrd_filename, $horizontal, $vertical);
} }
$ssr = str_replace('"', "", snmp_get($device, "signalStrengthRatio.0", "-Ovqn", "WHISP-SM-MIB")); $ssr = str_replace('"', "", snmp_get($device, "signalStrengthRatio.0", "-Ovqn", "WHISP-SM-MIB"));
@@ -106,7 +106,7 @@ if (strstr($hardware, 'CMM') == false) {
$tags = compact('rrd_def'); $tags = compact('rrd_def');
data_update($device, 'cambium-generic-450-slaveSSR', $tags, $fields); data_update($device, 'cambium-generic-450-slaveSSR', $tags, $fields);
$graphs['cambium_generic_450_slaveSSR'] = true; $graphs['cambium_generic_450_slaveSSR'] = true;
unset($rrd_filename,$ssr); unset($rrd_filename, $ssr);
} }
$horizontal = str_replace('"', "", snmp_get($device, "signalToNoiseRatioSMHorizontal.0", "-Ovqn", "WHISP-SM-MIB")); $horizontal = str_replace('"', "", snmp_get($device, "signalToNoiseRatioSMHorizontal.0", "-Ovqn", "WHISP-SM-MIB"));
@@ -122,7 +122,7 @@ if (strstr($hardware, 'CMM') == false) {
$tags = compact('rrd_def'); $tags = compact('rrd_def');
data_update($device, 'cambium-generic-450-slaveSNR', $tags, $fields); data_update($device, 'cambium-generic-450-slaveSNR', $tags, $fields);
$graphs['cambium_generic_450_slaveSNR'] = true; $graphs['cambium_generic_450_slaveSNR'] = true;
unset($rrd_filename,$horizontal,$vertical); unset($rrd_filename, $horizontal, $vertical);
} }
} }
@@ -143,7 +143,7 @@ if (strstr($hardware, 'AP') || strstr($hardware, 'Master') || strstr($hardware,
$tags = compact('rrd_def'); $tags = compact('rrd_def');
data_update($device, 'cambium-generic-whispGPSStats', $tags, $fields); data_update($device, 'cambium-generic-whispGPSStats', $tags, $fields);
$graphs['cambium_generic_whispGPSStats'] = true; $graphs['cambium_generic_whispGPSStats'] = true;
unset($rrd_filename,$gpsStatus); unset($rrd_filename, $gpsStatus);
} }
$visible = str_replace('"', "", snmp_get($device, ".1.3.6.1.4.1.161.19.3.4.4.7.0", "-Ovqn", "")); $visible = str_replace('"', "", snmp_get($device, ".1.3.6.1.4.1.161.19.3.4.4.7.0", "-Ovqn", ""));
@@ -159,7 +159,7 @@ if (strstr($hardware, 'AP') || strstr($hardware, 'Master') || strstr($hardware,
$tags = compact('rrd_def'); $tags = compact('rrd_def');
data_update($device, 'cambium-generic-gpsStats', $tags, $fields); data_update($device, 'cambium-generic-gpsStats', $tags, $fields);
$graphs['cambium_generic_gpsStats'] = true; $graphs['cambium_generic_gpsStats'] = true;
unset($rrd_filename,$visible,$tracked); unset($rrd_filename, $visible, $tracked);
} }
} }
//PTP Equipment //PTP Equipment
@@ -189,7 +189,7 @@ if (strstr($version, 'AP') == false) {
$tags = compact('rrd_def'); $tags = compact('rrd_def');
data_update($device, 'cambium-generic-450-linkRadioDbm', $tags, $fields); data_update($device, 'cambium-generic-450-linkRadioDbm', $tags, $fields);
$graphs['cambium_generic_450_linkRadioDbm'] = true; $graphs['cambium_generic_450_linkRadioDbm'] = true;
unset($rrd_filename,$horizontal,$horizontal); unset($rrd_filename, $horizontal, $horizontal);
} }
$horizontal = str_replace('"', "", snmp_get($device, "signalToNoiseRatioHorizontal.2", "-Ovqn", "WHISP-APS-MIB")); $horizontal = str_replace('"', "", snmp_get($device, "signalToNoiseRatioHorizontal.2", "-Ovqn", "WHISP-APS-MIB"));
@@ -205,7 +205,7 @@ if (strstr($version, 'AP') == false) {
$tags = compact('rrd_def'); $tags = compact('rrd_def');
data_update($device, 'cambium-generic-450-ptpSNR', $tags, $fields); data_update($device, 'cambium-generic-450-ptpSNR', $tags, $fields);
$graphs['cambium_generic_450_ptpSNR'] = true; $graphs['cambium_generic_450_ptpSNR'] = true;
unset($rrd_filename,$horizontal,$horizontal); unset($rrd_filename, $horizontal, $horizontal);
} }
$ssr = str_replace('"', "", snmp_get($device, "linkSignalStrengthRatio.2", "-Ovqn", "WHISP-APS-MIB")); $ssr = str_replace('"', "", snmp_get($device, "linkSignalStrengthRatio.2", "-Ovqn", "WHISP-APS-MIB"));
@@ -217,7 +217,7 @@ if (strstr($version, 'AP') == false) {
$tags = compact('rrd_def'); $tags = compact('rrd_def');
data_update($device, 'cambium-generic-450-masterSSR', $tags, $fields); data_update($device, 'cambium-generic-450-masterSSR', $tags, $fields);
$graphs['cambium_generic_450_masterSSR'] = true; $graphs['cambium_generic_450_masterSSR'] = true;
unset($rrd_filename,$ssr); unset($rrd_filename, $ssr);
} }
if (strstr($hardware, 'PTP 230')) { if (strstr($hardware, 'PTP 230')) {
@@ -241,7 +241,7 @@ if (strstr($version, 'AP') == false) {
$tags = compact('rrd_def'); $tags = compact('rrd_def');
data_update($device, 'cambium-generic-radioDbm', $tags, $fields); data_update($device, 'cambium-generic-radioDbm', $tags, $fields);
$graphs['cambium_generic_radioDbm'] = true; $graphs['cambium_generic_radioDbm'] = true;
unset($rrd_filename,$dbmRadio,$minRadio,$maxRadio,$avgRadio); unset($rrd_filename, $dbmRadio, $minRadio, $maxRadio, $avgRadio);
} }
} }
} }
@@ -261,7 +261,7 @@ if (strstr($version, 'AP')) {
$tags = compact('rrd_def'); $tags = compact('rrd_def');
data_update($device, 'cambium-generic-regCount', $tags, $fields); data_update($device, 'cambium-generic-regCount', $tags, $fields);
$graphs['cambium_generic_regCount'] = true; $graphs['cambium_generic_regCount'] = true;
unset($rrd_filename,$registered,$failed); unset($rrd_filename, $registered, $failed);
} }
$freq = str_replace('"', "", snmp_get($device, "currentRadioFreqCarrier.0", "-Ovqn", "WHISP-APS-MIB")); $freq = str_replace('"', "", snmp_get($device, "currentRadioFreqCarrier.0", "-Ovqn", "WHISP-APS-MIB"));
@@ -278,6 +278,6 @@ if (strstr($version, 'AP')) {
$tags = compact('rrd_def'); $tags = compact('rrd_def');
data_update($device, 'cambium-generic-freq', $tags, $fields); data_update($device, 'cambium-generic-freq', $tags, $fields);
$graphs['cambium_generic_freq'] = true; $graphs['cambium_generic_freq'] = true;
unset($rrd_filename,$freq); unset($rrd_filename, $freq);
} }
} }