diff --git a/ChangeLog b/ChangeLog index d605904..41998fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,8 @@ Version 3.2.2 (stable), ????-??-?? use Quotes to mark the start and end of a phrase, for example: "Search for this" // Searches for full phrase -"Search for this" // Excludes full phrase +- Report admin, fixed filter editor issues when full phrase strings + (with spaces) were configured. --------------------------------------------------------------------------- Version 3.2.1 (stable), 2011-04-12 - Fixed timezone parsing in GetEventTime function. This caused problems diff --git a/src/admin/reports.php b/src/admin/reports.php index 8245ca2..1519912 100644 --- a/src/admin/reports.php +++ b/src/admin/reports.php @@ -338,6 +338,7 @@ if ( isset($_GET['op']) ) $content['customTitle'] = $myReport['DisplayName']; $content['customComment'] = ""; $content['filterString'] = ""; + $content['filterString_htmlform'] = ""; // Init Custom Filters InitCustomFilterDefinitions($myReport, ""); @@ -427,6 +428,7 @@ if ( isset($_GET['op']) ) $content['customTitle'] = $mySavedReport['customTitle']; $content['customComment'] = $mySavedReport['customComment']; $content['filterString'] = $mySavedReport['filterString']; + $content['filterString_htmlform'] = htmlspecialchars($content['filterString']); // Init Custom Filters InitCustomFilterDefinitions($myReport, $mySavedReport['customFilters']); @@ -595,6 +597,7 @@ if ( isset($content['ISADDSAVEDREPORT']) && $content['ISADDSAVEDREPORT'] ) { // Overwrite filterString from form data instead of filter array! $content['filterString'] = DB_RemoveBadChars($_POST['report_filterString']); + $content['filterString_htmlform'] = htmlspecialchars($content['filterString']); } else { @@ -603,7 +606,7 @@ if ( isset($content['ISADDSAVEDREPORT']) && $content['ISADDSAVEDREPORT'] ) { // Get Filter array $AllFilters = $_POST['Filters']; - + // Loop through filters and build filterstring! $i = 0; foreach( $AllFilters as $tmpFilterID ) @@ -716,9 +719,12 @@ if ( isset($content['ISADDSAVEDREPORT']) && $content['ISADDSAVEDREPORT'] ) } // Append field value - $szFilterString .= $tmpFilterValue; + if ( strpos($tmpFilterValue, " ") === false || (substr($tmpFilterValue, 0, 1) == "\"" && substr($tmpFilterValue, strlen($tmpFilterValue)-1, 1) == "\"" ) ) + $szFilterString .= $tmpFilterValue; + else + // Spaces are in search value, so we add quotes to the string! + $szFilterString .= "\"" . $tmpFilterValue . "\""; } - // Append trailing space $szFilterString .= " "; } @@ -728,9 +734,10 @@ if ( isset($content['ISADDSAVEDREPORT']) && $content['ISADDSAVEDREPORT'] ) $i++; } - // echo $content['filterString'] . "
"; - // echo $szFilterString . "
"; - // print_r ( $AllFilters ); +// DEBUG stuff +// echo $content['filterString'] . "
\r\n"; +// echo $szFilterString . "
\r\n"; +// print_r ( $AllFilters ); } } diff --git a/src/classes/logstream.class.php b/src/classes/logstream.class.php index 2385e33..98b0fcb 100644 --- a/src/classes/logstream.class.php +++ b/src/classes/logstream.class.php @@ -563,7 +563,6 @@ abstract class LogStream { return $myField['FieldID']; } - return FALSE; } @@ -603,6 +602,7 @@ abstract class LogStream { // Use RegEx for intelligent splitting $szFilterRgx = '/[,\s]++(?=(?:(?:[^"]*+"){2})*+[^"]*+$)(?=(?:(?:[^\']*+\'){2})*+[^\']*+$)(?=(?:[^()]*+\([^()]*+\))*+[^()]*+$)/x'; $tmpEntries = preg_split($szFilterRgx, $szFilters, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); +//DEBUG print_r ( $tmpEntries ); foreach($tmpEntries as $myEntry) { // Continue if empty filter! @@ -1054,7 +1054,7 @@ abstract class LogStream { $myEntry = str_replace("\\:", ":", $myEntry); // Check for Begin and Ending Quotes and remove them from the search value! - $myEntry = preg_replace('/\\\\\\"/i', "$1", $myEntry); + $myEntry = preg_replace('/\\"/i', "$1", $myEntry); // Assign value to filter array $this->_filters[SYSLOG_MESSAGE][$iNum][FILTER_VALUE] = $myEntry; diff --git a/src/templates/admin/admin_reports.html b/src/templates/admin/admin_reports.html index ebfea81..8014aeb 100644 --- a/src/templates/admin/admin_reports.html +++ b/src/templates/admin/admin_reports.html @@ -288,7 +288,7 @@ {LN_REPORTS_FILTERSTRING} - {LN_REPORTS_FILTERSTRING_ONLYEDITIF}
+ {LN_REPORTS_FILTERSTRING_ONLYEDITIF}
{LN_REPORTS_FILTEREDITOR}