diff --git a/src/admin/reports.php b/src/admin/reports.php
index 44156c7..a99fea8 100644
--- a/src/admin/reports.php
+++ b/src/admin/reports.php
@@ -54,7 +54,7 @@ IncludeLanguageFile( $gl_root_path . '/lang/' . $LANG . '/admin.php' );
// --- BEGIN Custom Code
-// Firts of all init List of Parsers!
+// Firts of all init List of Reports!
InitReportModules();
// Handle GET requests
diff --git a/src/classes/reports/report.eventlog.monilog.class.php b/src/classes/reports/report.eventlog.monilog.class.php
index d9cc183..ebe9506 100644
--- a/src/classes/reports/report.eventlog.monilog.class.php
+++ b/src/classes/reports/report.eventlog.monilog.class.php
@@ -95,13 +95,30 @@ class Report_monilog extends Report {
*/
public function startDataProcessing()
{
+ global $content;
+
// Verify Datasource first!
if ( $this->verifyDataSource() == SUCCESS )
{
$res = $stream->Open( $this->_arrProperties, true );
if ( $res == SUCCESS )
{
- // report logic
+ // --- Report logic starts here
+
+ // Step 1: Gather Summaries
+ // Obtain data from the logstream!
+ $reportData = $stream->GetCountSortedByField( SYSLOG_SEVERITY, FILTER_TYPE_INT, 10 );
+
+print_r ( $reportData );
+exit;
+
+ // If data is valid, we have an array!
+ if ( is_array($reportData) && count($reportData) > 0 )
+ {
+ }
+
+
+ // ---
}
diff --git a/src/lang/en/main.php b/src/lang/en/main.php
index f287f33..f031f22 100644
--- a/src/lang/en/main.php
+++ b/src/lang/en/main.php
@@ -334,6 +334,9 @@ $content['LN_ORACLE_FIELD'] = "Field";
$content['LN_ORACLE_ONLINESEARCH'] = "Online Search";
$content['LN_ORACLE_WHOIS'] = "WHOIS Lookup for '%1' value '%2'";
+ $content['LN_GEN_ERROR_INVALIDOP'] = "Invalid or missing operation type";
+ $content['LN_GEN_ERROR_MISSINGSAVEDREPORTID'] = "Invalid or missing savedreport id";
+
?>
\ No newline at end of file
diff --git a/src/reportgenerator.php b/src/reportgenerator.php
new file mode 100644
index 0000000..9da4dd0
--- /dev/null
+++ b/src/reportgenerator.php
@@ -0,0 +1,496 @@
+ This file will create reports based on their saved values.
+ *
+ * All directives are explained within this file
+ *
+ * Copyright (C) 2008 Adiscon GmbH.
+ *
+ * This file is part of phpLogCon.
+ *
+ * PhpLogCon is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * PhpLogCon is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpLogCon. If not, see
";
+ $YchartData[] = intval($myData);
+ $XchartData[] = strlen($myKey) > 0 ? $myKey : "Unknown";
+ if ( isset($fields[$content['chart_field']]['SearchField']) && strlen($myKey) > 0 )
+ $chartImageMapLinks[] = $content['BASEPATH'] . "index.php?filter=" . $fields[$content['chart_field']]['SearchField'] . "%3A%3D" . urlencode($szEncodedKeyStr) . "&search=Search";
+ else
+ $chartImageMapLinks[] = "";
+
+ $chartImageMapAlts[] = $fields[$content['chart_field']]['FieldCaption'] . ": " . $myKey;
+ $chartImageMapTargets[] ="_top";
+ }
+
+ if ( $content['chart_type'] == CHART_CAKE )
+ {
+ // Include additional code filers for this chart!
+ include_once ($gl_root_path . "classes/jpgraph/jpgraph_pie.php");
+ include_once ($gl_root_path . "classes/jpgraph/jpgraph_pie3d.php");
+
+ // Create Basic Image, and set basic properties!
+ $graph = new PieGraph($content['chart_width'], $content['chart_width'], 'auto');
+ $graph->SetMargin(30,20,30,30); // Adjust margin area
+ $graph->SetScale("textlin");
+ $graph->SetMarginColor('white');
+ $graph->SetBox(); // Box around plotarea
+
+ // Set up the title for the graph
+// $graph->title->Set('Messagecount sorted by "' . $content[ $fields[$content['chart_field']]['FieldCaption'] ] . '"');
+// $graph->title->SetFont(FF_VERDANA,FS_NORMAL,12);
+// $graph->title->SetColor("darkred");
+
+ // Setup the tab title
+ $graph->tabtitle->Set( GetAndReplaceLangStr($content['LN_STATS_CHARTTITLE'], $content['maxrecords'], $fields[$content['chart_field']]['FieldCaption']) );
+ $graph->tabtitle->SetFont(FF_VERA,FS_BOLD,9);
+ $graph->tabtitle->SetPos('left');
+
+ // Set Graph footer
+ $graph->footer->left->Set ("phpLogCon v" . $content['BUILDNUMBER'] . "\n" . GetAndReplaceLangStr($content['LN_STATS_GENERATEDAT'], date("Y-m-d")) );
+ $graph->footer->left->SetFont( FF_VERA, FS_NORMAL, 7);
+// $graph->footer->right->Set ( GetAndReplaceLangStr($content['LN_STATS_GENERATEDAT'], date("Y-m-d")) );
+// $graph->footer->right->SetFont( FF_VERA, FS_NORMAL, 8);
+// $graph->footer->left->Set ("phpLogCon v" . $content['BUILDNUMBER'] . "\n" . GetAndReplaceLangStr($content['LN_STATS_GENERATEDAT'], date("Y-m-d")) );
+// $graph->footer->left->SetFont( FF_VERA, FS_NORMAL, 8);
+// $graph->footer->right->SetColor("darkred");
+
+ // Show 0 label on Y-axis (default is not to show)
+ $graph->yscale->ticks->SupressZeroLabel(false);
+
+ // Set Fonts for graph!
+ $graph->xaxis->SetFont(FF_VERA,FS_NORMAL,8);
+ $graph->yaxis->SetFont(FF_VERA,FS_NORMAL,8);
+ $graph->legend->SetFont(FF_VERA,FS_NORMAL,8);
+
+ // Create
+ $p1 = new PiePlot3D($YchartData);
+ $p1->SetLegends($XchartData);
+ $p1->SetEdge('#333333', 1);
+ $p1->SetTheme('earth'); /* "earth" * "pastel" * "sand" * "water" */
+ $p1->SetCSIMTargets($chartImageMapLinks, $chartImageMapAlts, $chartImageMapTargets);
+
+ // Set label format
+ if ( $content['showpercent'] == 1 )
+ {
+ $p1->SetLabelType(0);
+ $p1->value->SetFormat("%d%%");
+ }
+ else
+ {
+ $p1->SetLabelType(1);
+ $p1->value->SetFormat("%d");
+ }
+
+ // Set label properties
+ $p1->SetLabelPos(1.0);
+ $p1->SetSliceColors(array('#FFF584','#CBFF84','#FF6B9E','#FF9584','#EAFF84','#7BFF51','#51FFA6','#51FF52','#6BCFFF','#5170FF','#519CFF','#EAE3AD','#FFF184','#8584FF','#E698FF','#C384FF','#FF84EC','#FF98A3','#E5C285','#FFDA98' ));
+ $p1->value->SetFont(FF_VERA, FS_NORMAL, 8);
+ $p1->value->SetColor("black");
+
+ // Adjust other Pie Properties
+ $p1->SetLabelMargin(5);
+ $p1->SetCenter(0.4,0.65);
+ $p1->SetSize(0.3);
+ $p1->SetAngle(60);
+
+ $graph->Add($p1);
+ }
+ else if ( $content['chart_type'] == CHART_BARS_VERTICAL )
+ {
+ // Include additional code filers for this chart!
+ include_once ($gl_root_path . "classes/jpgraph/jpgraph_bar.php");
+ include_once ($gl_root_path . "classes/jpgraph/jpgraph_line.php");
+
+ // Create Basic Image, and set basic properties!
+ $graph = new Graph($content['chart_width'], $content['chart_width'], 'auto');
+ $graph->SetMargin(60,20,30,50); // Adjust margin area
+ $graph->SetScale("textlin");
+ $graph->SetMarginColor('white');
+ $graph->SetBox(); // Box around plotarea
+
+ // Setup X-AXIS
+// $graph->xaxis->SetFont(FF_VERA,FS_NORMAL,10);
+ $graph->xaxis->SetTickLabels($XchartData);
+
+ if ( count($XchartData) > 5 )
+ {
+ $graph->SetMargin(60,20,30,80); // Adjust margin area
+ $graph->xaxis->SetLabelAngle(45);
+ $graph->xaxis->SetLabelMargin(2);
+ }
+ else
+ $graph->xaxis->SetLabelAngle(0);
+
+// $graph->xaxis->scale->SetGrace(30); // So the value is readable
+
+ // Setup Y-AXIS
+ $graph->yaxis->scale->SetGrace(10); // So the value is readable
+// $graph->yaxis->SetLabelFormat('%d %%');
+
+ // Show 0 label on Y-axis (default is not to show)
+ $graph->yscale->ticks->SupressZeroLabel(false);
+
+ // Set Fonts for graph!
+ $graph->xaxis->SetFont(FF_VERA,FS_NORMAL,7);
+ $graph->yaxis->SetFont(FF_VERA,FS_NORMAL,8);
+
+ // Setup the tab title
+ $graph->tabtitle->Set( GetAndReplaceLangStr($content['LN_STATS_CHARTTITLE'], $content['maxrecords'], $fields[$content['chart_field']]['FieldCaption']) );
+ $graph->tabtitle->SetFont(FF_VERA,FS_BOLD,9);
+ $graph->tabtitle->SetPos('left');
+
+ // Set Graph footer
+ $graph->footer->left->Set ("phpLogCon v" . $content['BUILDNUMBER'] . "\n" . GetAndReplaceLangStr($content['LN_STATS_GENERATEDAT'], date("Y-m-d")) );
+ $graph->footer->left->SetFont( FF_VERA, FS_NORMAL, 7);
+// $graph->footer->right->Set ( GetAndReplaceLangStr($content['LN_STATS_GENERATEDAT'], date("Y-m-d")) );
+// $graph->footer->right->SetFont( FF_VERA, FS_NORMAL, 8);
+
+ // Setup the X and Y grid
+ $graph->ygrid->SetFill(true,'#DDDDDD@0.5','#BBBBBB@0.5');
+ $graph->ygrid->SetLineStyle('dashed');
+ $graph->ygrid->SetColor('gray');
+ $graph->xgrid->Show();
+ $graph->xgrid->SetLineStyle('dashed');
+ $graph->xgrid->SetColor('gray');
+
+ // Create and Add bar pot
+ $bplot = new BarPlot($YchartData);
+ $bplot->SetWidth(0.6);
+ $fcol='#440000';
+ $tcol='#FF9090';
+ $bplot->SetFillGradient($fcol,$tcol,GRAD_LEFT_REFLECTION);
+ $graph->Add($bplot);
+
+ // Display value in bars
+ $bplot->value->Show();
+ $bplot->value->SetFont(FF_VERA,FS_NORMAL,8);
+// $bplot->value->SetAlign('left','center');
+// $bplot->value->SetColor("black","darkred");
+ $bplot->value->SetFormat('%d');
+
+ // Add links
+ $bplot->SetCSIMTargets($chartImageMapLinks, $chartImageMapAlts, $chartImageMapTargets);
+
+
+// TODO: Make Optional!
+ // Create and Add filled line plot
+ $lplot = new LinePlot($YchartData);
+ $lplot->SetFillColor('skyblue@0.7');
+ $lplot->SetColor('navy@0.7');
+ $lplot->SetBarCenter();
+ $lplot->mark->SetType(MARK_SQUARE);
+ $lplot->mark->SetColor('blue@0.7');
+ $lplot->mark->SetFillColor('lightblue');
+ $lplot->mark->SetSize(6);
+ $graph->Add($lplot);
+ }
+ else if ( $content['chart_type'] == CHART_BARS_HORIZONTAL )
+ {
+ // Include additional code filers for this chart!
+ include_once ($gl_root_path . "classes/jpgraph/jpgraph_bar.php");
+ include_once ($gl_root_path . "classes/jpgraph/jpgraph_line.php");
+
+ // Create Basic Image, and set basic properties!
+ $graph = new Graph($content['chart_width'], $content['chart_width'], 'auto');
+// $graph->SetMargin(60,20,30,50);
+ $graph->SetScale("textlin");
+ $graph->Set90AndMargin(80,30,30,50); // Adjust margin area
+ $graph->SetMarginColor('white');
+ $graph->SetBox(); // Box around plotarea
+
+ // Setup X-AXIS
+ $graph->xaxis->SetTickLabels($XchartData);
+ $graph->xaxis->SetLabelAngle(0);
+// $graph->xaxis->SetLabelAlign('center','top');
+ $graph->xaxis->SetPos('min');
+ $graph->xaxis->SetLabelMargin(5);
+ $graph->xaxis->SetLabelAlign('right','center');
+
+ // Setup Y-AXIS
+ $graph->yaxis->scale->SetGrace(20); // So the value is readable
+ $graph->yaxis->SetLabelAlign('center','top');
+ $graph->yaxis->SetLabelFormat('%d');
+ $graph->yaxis->SetLabelSide(SIDE_RIGHT);
+ $graph->yaxis->SetTickSide(SIDE_LEFT);
+// $graph->yaxis->SetTitleSide(SIDE_RIGHT);
+// $graph->yaxis->SetTitleMargin(35);
+ $graph->yaxis->SetPos('max');
+ $graph->yaxis->SetTextLabelInterval(2);
+
+ // Show 0 label on Y-axis (default is not to show)
+ $graph->yscale->ticks->SupressZeroLabel(false);
+
+ // Set Fonts for graph!
+ $graph->xaxis->SetFont(FF_VERA,FS_NORMAL,7);
+ $graph->yaxis->SetFont(FF_VERA,FS_NORMAL,8);
+
+ // Setup the tab title
+ $graph->tabtitle->Set( GetAndReplaceLangStr($content['LN_STATS_CHARTTITLE'], $content['maxrecords'], $fields[$content['chart_field']]['FieldCaption']) );
+ $graph->tabtitle->SetFont(FF_VERA,FS_BOLD,9);
+ $graph->tabtitle->SetPos('right');
+ $graph->tabtitle->SetTabAlign('right');
+
+ // Set Graph footer
+ $graph->footer->left->Set ("phpLogCon v" . $content['BUILDNUMBER'] . "\n" . GetAndReplaceLangStr($content['LN_STATS_GENERATEDAT'], date("Y-m-d")) );
+ $graph->footer->left->SetFont( FF_VERA, FS_NORMAL, 7);
+// $graph->footer->right->Set ( GetAndReplaceLangStr($content['LN_STATS_GENERATEDAT'], date("Y-m-d")) );
+// $graph->footer->right->SetFont( FF_VERA, FS_NORMAL, 8);
+
+ // Setup the X and Y grid
+ $graph->ygrid->SetFill(true,'#DDDDDD@0.5','#BBBBBB@0.5');
+ $graph->ygrid->SetLineStyle('dashed');
+ $graph->ygrid->SetColor('gray');
+ $graph->xgrid->Show();
+ $graph->xgrid->SetLineStyle('dashed');
+ $graph->xgrid->SetColor('gray');
+
+ // Create and Add bar pot
+ $bplot = new BarPlot($YchartData);
+ $bplot->SetWidth(0.6);
+ $fcol='#440000';
+ $tcol='#FF9090';
+ $bplot->SetFillGradient($fcol,$tcol,GRAD_LEFT_REFLECTION);
+ $graph->Add($bplot);
+
+ // Display value in bars
+ $bplot->value->Show();
+ $bplot->value->SetFont(FF_VERA,FS_NORMAL, 8);
+// $bplot->value->SetAlign('left','center');
+// $bplot->value->SetColor("black","darkred");
+ $bplot->value->SetFormat('%d');
+
+ // Add links
+ $bplot->SetCSIMTargets($chartImageMapLinks, $chartImageMapAlts, $chartImageMapTargets);
+
+// TODO: Make Optional!
+ // Create and Add filled line plot
+ $lplot = new LinePlot($YchartData);
+ $lplot->SetFillColor('skyblue@0.7');
+ $lplot->SetColor('navy@0.7');
+ $lplot->SetBarCenter();
+ $lplot->mark->SetType(MARK_SQUARE);
+ $lplot->mark->SetColor('blue@0.7');
+ $lplot->mark->SetFillColor('lightblue');
+ $lplot->mark->SetSize(6);
+ $graph->Add($lplot);
+ }
+ else
+ {
+ $content['error_occured'] = true;
+ $content['error_details'] = $content['LN_GEN_ERROR_INVALIDTYPE'];
+ }
+ }
+ else
+ {
+ $content['error_occured'] = true;
+ $content['error_details'] = GetErrorMessage($chartData);
+ if ( isset($extraErrorDescription) )
+ $content['error_details'] .= "\n\n" . GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
+ }
+
+
+//$fields[SYSLOG_UID]['FieldID']
+
+ }
+ else
+ {
+ // This will disable to Main SyslogView and show an error message
+ $content['error_occured'] = true;
+ $content['error_details'] = GetErrorMessage($res);
+ if ( isset($extraErrorDescription) )
+ $content['error_details'] .= "\n\n" . GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
+ }
+
+ // Close file!
+ $stream->Close();
+ }
+ else
+ {
+ $content['error_occured'] = true;
+ $content['error_details'] = GetAndReplaceLangStr( $content['LN_GEN_ERROR_SOURCENOTFOUND'], $currentSourceID);
+ }
+}
+
+if ( $content['error_occured'] )
+{
+ // Use JpGraph to display errors!
+ $myError = new JpGraphErrObjectImg();
+ $myError->SetTitle($content['LN_GEN_ERRORDETAILS']);
+ $myError->Raise($content['error_details'], true);
+ exit;
+
+/* // QUICK AND DIRTY!
+ $myImage = imagecreatetruecolor( $content['chart_width'], $content['chart_width']);
+
+ $text_color = imagecolorallocate($myImage, 255, 0, 0);
+ imagestring($myImage, 3, 10, 10, $content['LN_GEN_ERRORDETAILS'], $text_color);
+ imagestring($myImage, 3, 10, 25, $content['error_details'], $text_color);
+
+ header ("Content-type: image/png");
+ imagepng($myImage); // Outputs the image to the browser
+ imagedestroy($myImage); // Clean Image resource
+*/
+}
+// ---
+
+// --- Output the image
+//$graph->Stroke();
+$graph->StrokeCSIM( basename(__FILE__), '', 0);
+// ---
+
+?>
\ No newline at end of file
diff --git a/src/templates/admin/admin_reports.html b/src/templates/admin/admin_reports.html
index 1005684..4529857 100644
--- a/src/templates/admin/admin_reports.html
+++ b/src/templates/admin/admin_reports.html
@@ -64,7 +64,7 @@
{customTitle}