diff --git a/src/admin/reports.php b/src/admin/reports.php
index 94e9819..44156c7 100644
--- a/src/admin/reports.php
+++ b/src/admin/reports.php
@@ -491,6 +491,37 @@ if ( isset($_POST['op']) )
}
// ---
+
+ // --- Now Verify Report Source!
+ // Create tmpSavedReport!
+ $tmpSavedReport["SavedReportID"] = $content['customFilters'];
+ $tmpSavedReport["sourceid"] = $content['SourceID'];
+ $tmpSavedReport["customTitle"] = $content['customTitle'];
+ $tmpSavedReport["customComment"] = $content['customComment'];
+ $tmpSavedReport["filterString"] = $content['filterString'];
+ $tmpSavedReport["customFilters"] = $content['customFilters'];
+ $tmpSavedReport["outputFormat"] = $content['outputFormat'];
+ $tmpSavedReport["outputTarget"] = $content['outputTarget'];
+ $tmpSavedReport["scheduleSettings"] = $content['scheduleSettings'];
+
+ // Get Objectreference to report
+ $myReportObj = $myReport["ObjRef"];
+
+ // Set SavedReport Settings!
+ $myReportObj->InitFromSavedReport($tmpSavedReport);
+
+ // Perform check
+ $res = $myReportObj->verifyDataSource();
+ if ( $res != SUCCESS )
+ {
+ $content['ISERROR'] = true;
+ $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_REPORTS_ERROR_ERRORCHECKINGSOURCE'], GetAndReplaceLangStr( GetErrorMessage($res), $content['SourceID']) );
+ if ( isset($extraErrorDescription) )
+ $content['ERROR_MSG'] .= "
" . GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
+ }
+ // ---
+
+
// --- Now ADD/EDIT do the processing!
if ( !isset($content['ISERROR']) )
{
diff --git a/src/chartgenerator.php b/src/chartgenerator.php
index 6722a5c..974627e 100644
--- a/src/chartgenerator.php
+++ b/src/chartgenerator.php
@@ -133,7 +133,7 @@ if ( !$content['error_occured'] )
// Create LogStream Object
$stream = $stream_config->LogStreamFactory($stream_config);
- // Set Columns we want to open!
+ // Set Columns we want to open!
$content['ChartColumns'][] = SYSLOG_UID;
$content['ChartColumns'][] = $content['chart_field'];
$res = $stream->Open( $content['ChartColumns'], true );
diff --git a/src/classes/logstreamdisk.class.php b/src/classes/logstreamdisk.class.php
index 3d7ae46..721bc95 100644
--- a/src/classes/logstreamdisk.class.php
+++ b/src/classes/logstreamdisk.class.php
@@ -116,6 +116,7 @@ class LogStreamDisk extends LogStream {
* @return integer Error state
*/
public function Verify() {
+
// Check if file exists!
if(!file_exists($this->_logStreamConfigObj->FileName)) {
return ERROR_FILE_NOT_FOUND;
diff --git a/src/classes/reports/report.class.php b/src/classes/reports/report.class.php
index 9bed981..db27946 100644
--- a/src/classes/reports/report.class.php
+++ b/src/classes/reports/report.class.php
@@ -43,6 +43,10 @@ require_once($gl_root_path . 'include/constants_errors.php');
require_once($gl_root_path . 'include/constants_logstream.php');
// ---
+// Include LogStream facility
+include_once($gl_root_path . 'classes/logstream.class.php');
+
+
abstract class Report {
// Common Properties
@@ -55,10 +59,15 @@ abstract class Report {
public $_reportNeedsInit = false; // True means that this report needs additional init stuff
public $_reportInitialized = false; // True means report is installed
- // Configuration Properties
+ // SavedReport Configuration Properties
+ protected $_customTitle = "";
+ protected $_customComment = "";
protected $_filterString = "";
- protected $_advancedOptionsXml = "";
- protected $_outputType = REPORT_OUTPUT_HTML; // Default HTML Output
+ protected $_customFilters = "";
+ protected $_outputFormat = REPORT_OUTPUT_HTML; // Default HTML Output
+ protected $_outputTarget = "";
+ protected $_scheduleSettings = "";
+
protected $_mySourceID = "";
protected $_arrProperties = null; // List of properties we need for the main logstream query!
@@ -150,13 +159,31 @@ abstract class Report {
/*
* Helper function to set the OutputType
*/
- public function SetOutputType($newOutputType)
+ public function SetOutputFormat($newOutputType)
{
// Set new Outputtype
- $this->_outputType = $newOutputType;
+ $this->_outputFormat = $newOutputType;
// Set Filebasename
- $this->_baseFileName = $this->_reportID . ".template." . $this->_outputType;
+ $this->_baseFileName = $this->_reportID . ".template." . $this->_outputFormat;
+ }
+
+ /*
+ * Helper function to set the OutputTarget
+ */
+ public function SetOutputTarget($newOutputTarget)
+ {
+ // Set new OutputTarget
+ $this->_outputTarget = $newOutputTarget;
+ }
+
+ /*
+ * Helper function to set the Scheduled Settings
+ */
+ public function SetScheduleSettings($newScheduleSettings)
+ {
+ // Set new ScheduleSettings
+ $this->_scheduleSettings = $newScheduleSettings;
}
/*
@@ -171,12 +198,31 @@ abstract class Report {
/*
* Helper function to set the FilterString
*/
- public function SetAdvancedOptions($newAdvancedOptions)
+ public function SetCustomFilters($newAdvancedOptions)
{
// Set new Outputtype
- $this->_advancedOptionsXml = $newAdvancedOptions;
+ $this->_customFilters = $newAdvancedOptions;
}
+ /*
+ * Helper function to set the FilterString
+ */
+ public function SetCustomTitle($newCustomTitle)
+ {
+ // Set new Custom Title
+ $this->_customTitle = $newCustomTitle;
+ }
+
+ /*
+ * Helper function to set the FilterString
+ */
+ public function SetCustomComment($newCustomComment)
+ {
+ // Set new Custom Comment
+ $this->_customComment = $newCustomComment;
+ }
+
+
/*
* Helper function to set the FilterString
*/
@@ -194,7 +240,6 @@ abstract class Report {
}
}
-
/*
* Helper function to trigger initialisation
*/
@@ -203,6 +248,22 @@ abstract class Report {
$this->SetOutputType( REPORT_OUTPUT_HTML );
}
+ /*
+ * Helper function to set settings from savedreport!
+ */
+ public function InitFromSavedReport( $mySavedReport )
+ {
+ // Copy settings from saved report!
+ $this->SetSourceID( $mySavedReport["sourceid"] );
+ $this->SetCustomTitle( $mySavedReport["customTitle"] );
+ $this->SetCustomComment( $mySavedReport["customComment"] );
+ $this->SetFilterString( $mySavedReport["filterString"] );
+ $this->SetCustomFilters( $mySavedReport["customFilters"] );
+ $this->SetOutputFormat( $mySavedReport["outputFormat"] );
+ $this->SetOutputTarget( $mySavedReport["outputTarget"] );
+ $this->SetScheduleSettings( $mySavedReport["scheduleSettings"] );
+ }
+
}
?>
\ No newline at end of file
diff --git a/src/classes/reports/report.eventlog.monilog.class.php b/src/classes/reports/report.eventlog.monilog.class.php
index f87cde8..d9cc183 100644
--- a/src/classes/reports/report.eventlog.monilog.class.php
+++ b/src/classes/reports/report.eventlog.monilog.class.php
@@ -121,10 +121,21 @@ class Report_monilog extends Report {
*/
public function verifyDataSource()
{
+ global $content;
+
if ( $this->_streamCfgObj == null )
{
- // Obtain and get the Config Object
- $this->_streamCfgObj = $content['Sources'][$this->_mySourceID]['ObjRef'];
+ if ( isset($content['Sources'][$this->_mySourceID]['ObjRef']) )
+ {
+ // Obtain and get the Config Object
+ $this->_streamCfgObj = $content['Sources'][$this->_mySourceID]['ObjRef'];
+
+ // Fix Filename manually for FILE LOGSTREAM!
+ if ( $content['Sources'][$this->_mySourceID]['SourceType'] == SOURCE_DISK )
+ $this->_streamCfgObj->FileName = CheckAndPrependRootPath(DB_StripSlahes($content['Sources'][$this->_mySourceID]['DiskFile']));
+ }
+ else
+ return ERROR_SOURCENOTFOUND;
}
if ( $this->_streamObj == null )
@@ -133,8 +144,9 @@ class Report_monilog extends Report {
$this->_streamObj = $this->_streamCfgObj ->LogStreamFactory($this->_streamCfgObj);
}
- // Success!
- return SUCCESS;
+ // Check datasource and return result
+ $res = $this->_streamObj->Verify();
+ return $res;
}
diff --git a/src/include/functions_common.php b/src/include/functions_common.php
index db0c9cf..2a132b1 100644
--- a/src/include/functions_common.php
+++ b/src/include/functions_common.php
@@ -1672,8 +1672,14 @@ function CheckAndPrependRootPath( $szFileName)
// Nothing really todo
true;
}
- else // prepend basepath!
- $szNewFileName = $gl_root_path . $szFileName;
+ else
+ {
+ // replace ./ with gl_root_path in this case
+ if ( ($pos = strpos($szFileName, "./")) !== FALSE )
+ $szNewFileName = str_replace( "./", $gl_root_path, $szFileName );
+ else // prepend basepath!
+ $szNewFileName = $gl_root_path . $szFileName;
+ }
// return result
return $szNewFileName;
diff --git a/src/lang/en/admin.php b/src/lang/en/admin.php
index f94939b..a86c77b 100644
--- a/src/lang/en/admin.php
+++ b/src/lang/en/admin.php
@@ -421,6 +421,7 @@ $content['LN_REPORTS_RUNNOW'] = "Run saved report now!";
$content['LN_REPORTS_WARNDELETESAVEDREPORT'] = "Are you sure that you want to delete the savedreport '%1'?";
$content['LN_REPORTS_ERROR_DELSAVEDREPORT'] = "Deleting of the savedreport with id '%1' failed!";
$content['LN_REPORTS_ERROR_HASBEENDEL'] = "The savedreport '%1' has been successfully deleted!";
+$content['LN_REPORTS_ERROR_ERRORCHECKINGSOURCE'] = "Error while checking Savedreport Source: %1";
$content['LN_REPORTS_'] = "";