improve Name and Source filtering. Default to case insensitive text search.

pull/2103/head
Isaac Connor 2018-05-08 14:07:24 -04:00
parent 6bff8811e7
commit 3c4befc73a
1 changed files with 17 additions and 20 deletions

View File

@ -195,16 +195,15 @@ $html .= htmlSelect( 'Status[]', $status_options,
$Monitor = new Monitor($monitors[$i]); $Monitor = new Monitor($monitors[$i]);
ini_set('track_errors', 'on'); ini_set('track_errors', 'on');
$php_errormsg = ''; $php_errormsg = '';
@preg_match($_SESSION['MonitorName'], ''); $regexp = $_SESSION['MonitorName'];
if ( !$php_errormsg ) {
# regexp is valid @preg_match($regexp, '');
if ( !preg_match($_SESSION['MonitorName'], $Monitor->Name()) ) { if ( $php_errormsg ) {
continue; $regexp = '/'.preg_quote($regexp,'/').'/i';
} }
} else {
if ( ! strstr($Monitor->Name(), $_SESSION['MonitorName']) ) { if ( !preg_match($regexp, $Monitor->Name()) ) {
continue; continue;
}
} }
} }
@ -212,16 +211,14 @@ $html .= htmlSelect( 'Status[]', $status_options,
$Monitor = new Monitor($monitors[$i]); $Monitor = new Monitor($monitors[$i]);
ini_set('track_errors', 'on'); ini_set('track_errors', 'on');
$php_errormsg = ''; $php_errormsg = '';
@preg_match($_SESSION['Source'], ''); $regexp = $_SESSION['Source'];
if ( !$php_errormsg ) {
# regexp is valid @preg_match($regexp, '');
if ( !preg_match($_SESSION['Source'], $Monitor->Source()) ) { if ( $php_errormsg ) {
continue; $regexp = '/'.preg_quote($regexp,'/').'/i';
} }
} else { if ( !preg_match($regexp, $Monitor->Source()) ) {
if ( ! strstr($Monitor->Source(), $_SESSION['Source']) ) { continue;
continue;
}
} }
} }