Skip to content

Commit 355d431

Browse files
committed
qa: Fixing php-cs-fixer issues
1 parent 8b1d11f commit 355d431

14 files changed

Lines changed: 59 additions & 59 deletions

lib/mactrack_functions.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
7 => __('Authorization Failed', 'mactrack')
4646
];
4747

48-
4948
/**
5049
* plugin_get_rows_per_page - resolve rows-per-page from request vars
5150
*
@@ -56,14 +55,15 @@ function plugin_get_rows_per_page() {
5655

5756
if ($rows == -1) {
5857
return read_config_option('num_rows_table');
59-
} elseif ($rows == -2) {
58+
}
59+
60+
if ($rows == -2) {
6061
return 999999;
6162
}
6263

6364
return $rows;
6465
}
6566

66-
6767
function mactrack_debug($message) {
6868
global $debug, $web, $config;
6969

@@ -3323,17 +3323,17 @@ function mactrack_dot1x_row_class($port_result) {
33233323
}
33243324

33253325
/** mactrack_create_sql_filter - this routine will take a filter string and process it into a
3326-
sql where clause that will be returned to the caller with a formatted SQL where clause
3327-
that can then be integrated into the overall where clause.
3328-
The filter takes the following forms. The default is to find occurrence that match "all"
3329-
Any string prefixed by a "-" will mean "exclude" this search string. Boolean expressions
3330-
are currently not supported.
3331-
@arg $filter - (string) The filter provided by the user
3332-
@arg $fields - (array) A list of field names to include in the where clause. They can also
3333-
contain the table name in cases where joins are important.
3334-
* @param mixed $filter
3335-
* @param mixed $fields
3336-
@returns - (string) The formatted SQL syntax */
3326+
* sql where clause that will be returned to the caller with a formatted SQL where clause
3327+
* that can then be integrated into the overall where clause.
3328+
* The filter takes the following forms. The default is to find occurrence that match "all"
3329+
* Any string prefixed by a "-" will mean "exclude" this search string. Boolean expressions
3330+
* are currently not supported.
3331+
* @arg $filter - (string) The filter provided by the user
3332+
* @arg $fields - (array) A list of field names to include in the where clause. They can also
3333+
* contain the table name in cases where joins are important.
3334+
* @param mixed $filter
3335+
* @param mixed $fields
3336+
* @returns - (string) The formatted SQL syntax */
33373337
function mactrack_create_sql_filter($filter, $fields) {
33383338
$query = '';
33393339

@@ -3369,7 +3369,7 @@ function mactrack_create_sql_filter($filter, $fields) {
33693369
$query .= '(';
33703370
}
33713371

3372-
$query .= ($field_no == 1 ? '' : " $operator ") . "($field $type LIKE " . db_qstr('%' . $filter . '%') . ")";
3372+
$query .= ($field_no == 1 ? '' : " $operator ") . "($field $type LIKE " . db_qstr('%' . $filter . '%') . ')';
33733373

33743374
$field_no++;
33753375
}

mactrack_device_types.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -900,10 +900,10 @@ function mactrack_device_type_edit() {
900900

901901
function mactrack_get_device_types(&$sql_where, $rows, $apply_limits = true) {
902902
if (get_request_var('filter') != '') {
903-
$sql_where = " WHERE (mtdt.vendor LIKE " . db_qstr('%' . get_request_var('filter') . '%') . " OR
904-
mtdt.description LIKE " . db_qstr('%' . get_request_var('filter') . '%') . " OR
905-
mtdt.sysDescr_match LIKE " . db_qstr('%' . get_request_var('filter') . '%') . " OR
906-
mtdt.sysObjectID_match LIKE " . db_qstr('%' . get_request_var('filter') . '%') . ")";
903+
$sql_where = ' WHERE (mtdt.vendor LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ' OR
904+
mtdt.description LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ' OR
905+
mtdt.sysDescr_match LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ' OR
906+
mtdt.sysObjectID_match LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ')';
907907
}
908908

909909
if (get_request_var('vendor') == 'All') {

mactrack_devices.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -972,9 +972,9 @@ function mactrack_device_edit() {
972972
function mactrack_get_devices(&$sql_where, $rows, $apply_limits = true) {
973973
// form the 'where' clause for our main sql query
974974
if (get_request_var('filter') != '') {
975-
$sql_where = ($sql_where != '' ? ' AND ' : 'WHERE ') . "(mtd.hostname LIKE " . db_qstr('%' . get_request_var('filter') . '%') . "
976-
OR mtd.device_name LIKE " . db_qstr('%' . get_request_var('filter') . '%') . "
977-
OR mtd.notes LIKE " . db_qstr('%' . get_request_var('filter') . '%') . ")";
975+
$sql_where = ($sql_where != '' ? ' AND ' : 'WHERE ') . '(mtd.hostname LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . '
976+
OR mtd.device_name LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . '
977+
OR mtd.notes LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ')';
978978
}
979979

980980
if (get_request_var('status') == '-1') {

mactrack_macauth.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ function mactrack_maca_get_maca_records(&$sql_where, $rows, $apply_limits = true
219219
$sql_where = '';
220220

221221
if (get_request_var('filter') != '') {
222-
$sql_where = "WHERE (mac_address LIKE " . db_qstr('%' . str_replace(['-', '.', ':'],'',get_request_var('filter')) . '%') . " OR " .
223-
"description LIKE " . db_qstr('%' . get_request_var('filter') . '%') . ")";
222+
$sql_where = 'WHERE (mac_address LIKE ' . db_qstr('%' . str_replace(['-', '.', ':'],'',get_request_var('filter')) . '%') . ' OR ' .
223+
'description LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ')';
224224
}
225225

226226
$sql_order = get_order_string();

mactrack_macwatch.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,10 @@ function mactrack_macw_get_macw_records(&$sql_where, $rows, $apply_limits = true
203203

204204
// form the 'where' clause for our main sql query
205205
if (get_request_var('filter') != '') {
206-
$sql_where = "WHERE (mac_address LIKE " . db_qstr('%' . get_request_var('filter') . '%') . " OR " .
207-
"name LIKE " . db_qstr('%' . get_request_var('filter') . '%') . " OR " .
208-
"ticket_number LIKE " . db_qstr('%' . get_request_var('filter') . '%') . " OR " .
209-
"description LIKE " . db_qstr('%' . get_request_var('filter') . '%') . ")";
206+
$sql_where = 'WHERE (mac_address LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ' OR ' .
207+
'name LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ' OR ' .
208+
'ticket_number LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ' OR ' .
209+
'description LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ')';
210210
}
211211

212212
$sql_order = get_order_string();

mactrack_sites.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,11 @@ function mactrack_site_get_site_records(&$sql_where, $rows, $apply_limits = true
291291
// form the 'where' clause for our main sql query
292292
if (get_request_var('filter') != '') {
293293
if (get_request_var('detail') == 'false') {
294-
$sql_where = "WHERE (mts.site_name LIKE " . db_qstr('%' . get_request_var('filter') . '%') . ")";
294+
$sql_where = 'WHERE (mts.site_name LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ')';
295295
} else {
296-
$sql_where = "WHERE (mts.vendor LIKE " . db_qstr('%' . get_request_var('filter') . '%') . " OR " .
297-
"mtdt.description LIKE " . db_qstr('%' . get_request_var('filter') . '%') . " OR " .
298-
"mts.site_name LIKE " . db_qstr('%' . get_request_var('filter') . '%') . ")";
296+
$sql_where = 'WHERE (mts.vendor LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ' OR ' .
297+
'mtdt.description LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ' OR ' .
298+
'mts.site_name LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ')';
299299
}
300300
}
301301

mactrack_snmp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ function mactrack_snmp() {
541541
$sql_where = '';
542542

543543
if (get_request_var('filter') != '') {
544-
$sql_where .= "WHERE (mac_track_snmp.name LIKE " . db_qstr('%' . get_request_var('filter') . '%') . ")";
544+
$sql_where .= 'WHERE (mac_track_snmp.name LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ')';
545545
}
546546

547547
$total_rows = db_fetch_cell("SELECT

mactrack_utilities.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,8 @@ function applyFilter() {
336336

337337
break;
338338
default:
339-
$other_processes += $run['devices'];
340-
$other_rundate = $run['last_rundate'];
339+
$other_processes += $run['devices'];
340+
$other_rundate = $run['last_rundate'];
341341
}
342342
}
343343
}

mactrack_vendormacs.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ function mactrack_vmacs_get_vmac_records(&$sql_where, $rows, $apply_limits = tru
103103

104104
// form the 'where' clause for our main sql query
105105
if (get_request_var('filter') != '') {
106-
$sql_where = "WHERE (mac_track_oui_database.vendor_name LIKE " . db_qstr('%' . get_request_var('filter') . '%') . " OR " .
107-
"mac_track_oui_database.vendor_mac LIKE " . db_qstr('%' . get_request_var('filter') . '%') . " OR " .
108-
"mac_track_oui_database.vendor_address LIKE " . db_qstr('%' . get_request_var('filter') . '%') . ")";
106+
$sql_where = 'WHERE (mac_track_oui_database.vendor_name LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ' OR ' .
107+
'mac_track_oui_database.vendor_mac LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ' OR ' .
108+
'mac_track_oui_database.vendor_address LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ')';
109109
}
110110

111111
$sql_order = get_order_string();

mactrack_view_devices.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,10 @@ function mactrack_view_get_device_records(&$sql_where, $rows, $apply_limits = tr
155155

156156
// form the 'where' clause for our main sql query
157157
if (get_request_var('filter') != '') {
158-
$sql_where .= ($sql_where != '' ? ' AND ' : 'WHERE ') . "(mac_track_devices.hostname LIKE " . db_qstr('%' . get_request_var('filter') . '%') . " OR " .
159-
"mac_track_devices.notes LIKE " . db_qstr('%' . get_request_var('filter') . '%') . " OR " .
160-
"mac_track_devices.device_name LIKE " . db_qstr('%' . get_request_var('filter') . '%') . " OR " .
161-
"mac_track_sites.site_name LIKE " . db_qstr('%' . get_request_var('filter') . '%') . ")";
158+
$sql_where .= ($sql_where != '' ? ' AND ' : 'WHERE ') . '(mac_track_devices.hostname LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ' OR ' .
159+
'mac_track_devices.notes LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ' OR ' .
160+
'mac_track_devices.device_name LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ' OR ' .
161+
'mac_track_sites.site_name LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ')';
162162
}
163163

164164
if (cacti_sizeof($device_type_info)) {

0 commit comments

Comments
 (0)