diff --git a/src/asktheoracle.php b/src/asktheoracle.php new file mode 100644 index 0000000..296da6f --- /dev/null +++ b/src/asktheoracle.php @@ -0,0 +1,152 @@ + This "oracle" is a helper page which generates and shows a bunch + * of usefull links ;)! + * + * 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 . + * + * A copy of the GPL can be found in the file "COPYING" in this + * distribution + ********************************************************************* +*/ + +// *** Default includes and procedures *** // +define('IN_PHPLOGCON', true); +$gl_root_path = './'; + +// Now include necessary include files! +include($gl_root_path . 'include/functions_common.php'); +include($gl_root_path . 'include/functions_frontendhelpers.php'); +include($gl_root_path . 'include/functions_filters.php'); + +InitPhpLogCon(); +InitSourceConfigs(); +InitFrontEndDefaults(); // Only in WebFrontEnd +InitFilterHelpers(); // Helpers for frontend filtering! +// --- + +// --- Define Extra Stylesheet! +//$content['EXTRA_STYLESHEET'] = '' . "\r\n"; +//$content['EXTRA_STYLESHEET'] .= ''; +// --- + +// --- READ Vars +if ( isset($_GET['type']) ) + $content['oracle_type'] = $_GET['type']; +else + $content['oracle_type'] = ""; + +if ( isset($_GET['query']) ) + $content['oracle_query'] = $_GET['query']; +else + $content['oracle_query'] = ""; + +if ( isset($_GET['uid']) ) + $content['uid_current'] = $_GET['uid']; +else + $content['uid_current'] = "-1"; + +// Init + +// --- BEGIN Custom Code + +// Set readable type +if ( $content['oracle_type'] == "ip" ) + $content['oracle_type_readable'] = "ip"; +else if ( $content['oracle_type'] == "domain" ) + $content['oracle_type_readable'] = "domain"; +else + $content['oracle_type_readable'] = "unknown type"; + +$content['ORACLE_HELP_DETAIL'] = GetAndReplaceLangStr( $content['LN_ORACLE_HELP_DETAIL'], $content['oracle_type_readable'], $content['oracle_query'] ) ; + + +// Enable help links! +$content['helplinksenabled'] = true; + +// Loop through all Sources +$i = 0; +foreach( $content['Sources'] as $mySource ) +{ + $myHelpLink['SourceName'] = GetAndReplaceLangStr("Source %1",$mySource['Name'] ); + $myHelpLink['MsgUrl'] = $content['BASEPATH'] . "index.php?filter=" . urlencode($content['oracle_query']) . "&search=Search&sourceid=" . $mySource['ID']; + $myHelpLink['MsgDisplayName'] = GetAndReplaceLangStr( $content['LN_ORACLE_SEARCHINFIELD'], "Message" ); + $myHelpLink['SourceUrl'] = $content['BASEPATH'] . "index.php?filter=" . urlencode("source:=" . $content['oracle_query']) . "&search=Search&sourceid=" . $mySource['ID']; + $myHelpLink['SourceDisplayName'] = GetAndReplaceLangStr( $content['LN_ORACLE_SEARCHINFIELD'], "Source" ); + + // --- Set CSS Class + if ( $i % 2 == 0 ) + $myHelpLink['cssclass'] = "line1"; + else + $myHelpLink['cssclass'] = "line2"; + $i++; + // --- + + // Add to help Link array! + $content['HelpLinks'][] = $myHelpLink; +} + +/* +if ( isset($content['Sources'][$currentSourceID]) ) // && $content['uid_current'] != UID_UNKNOWN ) // && $content['Sources'][$currentSourceID]['SourceType'] == SOURCE_DISK ) +{ + // Obtain and get the Config Object + $stream_config = $content['Sources'][$currentSourceID]['ObjRef']; + + // Create LogStream Object + $stream = $stream_config->LogStreamFactory($stream_config); +// $stream->SetFilter($content['searchstr']); + + // --- Init the fields we need + foreach($fields as $mycolkey => $myfield) + { + $content['fields'][$mycolkey]['FieldID'] = $mycolkey; + $content['fields'][$mycolkey]['FieldCaption'] = $content[ $myfield['FieldCaptionID'] ]; + $content['fields'][$mycolkey]['FieldType'] = $myfield['FieldType']; + $content['fields'][$mycolkey]['DefaultWidth'] = $myfield['DefaultWidth']; + + // Append to columns array + $content['AllColumns'][] = $mycolkey; + } + // --- + + // Close file! + $stream->Close(); +} +*/ +// --- + +// --- BEGIN CREATE TITLE +$content['TITLE'] = InitPageTitle(); +// Append custom title part! +$content['TITLE'] .= GetAndReplaceLangStr( $content['LN_ORACLE_TITLE'], $content['oracle_query']); +// --- END CREATE TITLE + +// --- Parsen and Output +InitTemplateParser(); +$page -> parser($content, "asktheoracle.html"); +$page -> output(); +// --- + +?> \ No newline at end of file diff --git a/src/include/functions_common.php b/src/include/functions_common.php index add4c3b..4a05fdc 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -1065,10 +1065,18 @@ function AddContextLinks(&$sourceTxt) */ function InsertLookupLink( $szIP, $szDomain, $prepend, $append ) { - global $content; + global $content, $uID; // Create string - $szReturn = $prepend; + $szReturn = $prepend; + + // Set IUD property if available + if ( isset($uID) ) + $includeLinkUID = "&uid=" . $uID; + else + $includeLinkUID = ""; + + // check if it is an IP or domain if ( strlen($szIP) > 0 ) { // Split IP into array @@ -1088,14 +1096,14 @@ function InsertLookupLink( $szIP, $szDomain, $prepend, $append ) $szReturn .= '' . $szIP . ''; // Add InfoSearch Link - $szReturn .= ''; + $szReturn .= ''; } else if ( strlen($szDomain) > 0 ) { $szReturn .= '' . $szDomain . ''; // Add InfoSearch Link - $szReturn .= ''; + $szReturn .= ''; } diff --git a/src/lang/en/main.php b/src/lang/en/main.php index fefbf44..9bce6aa 100644 --- a/src/lang/en/main.php +++ b/src/lang/en/main.php @@ -322,5 +322,13 @@ $content['LN_CONVERT_ERROR_SOURCEIMPORT'] = "Critical Error while importing the $content['LN_CHART_TYPE_BARS_HORIZONTAL'] = "Bars horizontal"; $content['LN_STATS_WARNINGDISPLAY'] = "Generating graphics on large data sources currently is very time consuming. This will be addressed in later versions. If processing takes too long, please simply cancel the request."; +// asktheoracle site +$content['LN_ORACLE_TITLE'] = "Asking the oracle for '%1'"; +$content['LN_ORACLE_HELP_FOR'] = "These are the links the oracle got for you"; +$content['LN_ORACLE_HELP_TEXT'] = "Spieglein Spieglein an der Wand, wer hat das größte Logfile im ganzen Land?"; +$content['LN_ORACLE_HELP_DETAIL'] = "Usefull search links for the type '%1', value = '%2'"; +$content['LN_ORACLE_SEARCHINFIELD'] = "Search in '%1' Field"; + + ?> \ No newline at end of file diff --git a/src/statistics.php b/src/statistics.php index 9fe7dd7..5763c8d 100644 --- a/src/statistics.php +++ b/src/statistics.php @@ -128,6 +128,7 @@ else // Set error code $content['ISERROR'] = true; $content['ERROR_MSG'] = GetErrorMessage(ERROR_CHARTS_NOTCONFIGURED); + $content['detailederror_code'] = ERROR_CHARTS_NOTCONFIGURED; } // --- diff --git a/src/templates/asktheoracle.html b/src/templates/asktheoracle.html new file mode 100644 index 0000000..c1e3e43 --- /dev/null +++ b/src/templates/asktheoracle.html @@ -0,0 +1,74 @@ + + + +

+
+
+
{LN_GEN_ERRORDETAILS}
+

{ERROR_MSG}

+

+ + + {LN_GEN_MOREINFORMATION} + +

+
+

+
+

+ + + + + + + + + + + + + + + + + +
{LN_ORACLE_HELP_FOR}
+ + + + +
+ {LN_DETAIL_BACKTOLIST} {LN_DETAIL_BACKTOLIST} +
+

{LN_ORACLE_HELP_TEXT}

+ +

+ + + + + + + + + + + + +
{ORACLE_HELP_DETAIL}
{SourceName} + +   + {MsgDisplayName} + + + +   + {SourceDisplayName} + +
+

+ +
+ + \ No newline at end of file diff --git a/src/templates/statistics.html b/src/templates/statistics.html index c40ff08..42a90eb 100644 --- a/src/templates/statistics.html +++ b/src/templates/statistics.html @@ -5,7 +5,13 @@
{LN_GEN_ERRORDETAILS}
-

{ERROR_MSG}

+

{ERROR_MSG}

+

+ + + {LN_GEN_MOREINFORMATION} + +