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