Added oracle page which helps building usefull search links used within phpLogCon

This commit is contained in:
Andre Lorbach 2008-09-18 18:00:52 +02:00
parent 976bc44cb0
commit c85667a00e
6 changed files with 254 additions and 5 deletions

152
src/asktheoracle.php Normal file
View File

@ -0,0 +1,152 @@
<?php
/*
*********************************************************************
* phpLogCon - http://www.phplogcon.org
* -----------------------------------------------------------------
* Details File
*
* -> 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 <http://www.gnu.org/licenses/>.
*
* 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'] = '<link rel="stylesheet" href="css/highlight.css" type="text/css">' . "\r\n";
//$content['EXTRA_STYLESHEET'] .= '<link rel="stylesheet" href="css/menu.css" type="text/css">';
// ---
// --- 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();
// ---
?>

View File

@ -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 .= '<a href="http://kb.monitorware.com/kbsearch.php?sa=whois&oid=ip&origin=phplogcon&q=' . $szIP . '" target="_top" class="contextlink">' . $szIP . '</a>';
// Add InfoSearch Link
$szReturn .= '<a href="asktheoracle.php?type=ip&query=' . $szIP . '" target="_top"><img src="' . $content['MENU_HELP_BLUE'] . '" width="16" height="16" title="' . $content['LN_GEN_MOREINFORMATION'] . '"></a>';
$szReturn .= '<a href="asktheoracle.php?type=ip&query=' . $szIP . $includeLinkUID . '" target="_top"><img src="' . $content['MENU_HELP_BLUE'] . '" width="16" height="16" title="' . $content['LN_GEN_MOREINFORMATION'] . '"></a>';
}
else if ( strlen($szDomain) > 0 )
{
$szReturn .= '<a href="http://kb.monitorware.com/kbsearch.php?sa=whois&oid=name&origin=phplogcon&q=' . $szDomain . '" target="_top" class="contextlink">' . $szDomain . '</a>';
// Add InfoSearch Link
$szReturn .= '<a href="asktheoracle.php?type=domain&query=' . $szDomain . '" target="_top"><img src="' . $content['MENU_HELP_BLUE'] . '" width="16" height="16" title="' . $content['LN_GEN_MOREINFORMATION'] . '"></a>';
$szReturn .= '<a href="asktheoracle.php?type=domain&query=' . $szDomain . $includeLinkUID . '" target="_top"><img src="' . $content['MENU_HELP_BLUE'] . '" width="16" height="16" title="' . $content['LN_GEN_MOREINFORMATION'] . '"></a>';
}

View File

@ -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";
?>

View File

@ -128,6 +128,7 @@ else
// Set error code
$content['ISERROR'] = true;
$content['ERROR_MSG'] = GetErrorMessage(ERROR_CHARTS_NOTCONFIGURED);
$content['detailederror_code'] = ERROR_CHARTS_NOTCONFIGURED;
}
// ---

View File

@ -0,0 +1,74 @@
<!-- INCLUDE include_header.html -->
<!-- IF ISERROR="true" -->
<br><br>
<center>
<div class="table_with_border_second ErrorMsg" style="width:600px">
<div class="PriorityError">{LN_GEN_ERRORDETAILS}</div>
<p align="left">{ERROR_MSG}</p>
<p>
<a href="http://kb.monitorware.com/kbeventdb-list-12-Adiscon-phpLogCon-{detailederror_code}.html" target="_blank">
<img src="{MENU_HELP_ORANGE}" width="16" height="16" title="{LN_GEN_MOREINFORMATION}">
{LN_GEN_MOREINFORMATION}
</a>
</p>
</div>
<br><br>
</center>
<br><br>
<!-- ENDIF ISERROR="true" -->
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center" class="with_border_alternative">
<tr>
<td colspan="3" class="title" nowrap><B>{LN_ORACLE_HELP_FOR}</B></td>
</tr>
<td colspan="3">
<table width="100%" align="center" border="0" cellpadding="1" cellspacing="1" class="with_border">
<tr>
<td width="100%" class="line2" align="left">
<a href="index.php?uid={uid_current}{additional_url_sourceonly}" target="_top"><img src="{MENU_HOMEPAGE}" align="middle" width="16" height="16" alt="{LN_DETAIL_BACKTOLIST}" title="{LN_DETAIL_BACKTOLIST}">&nbsp;{LN_DETAIL_BACKTOLIST}</a>
</td>
</tr>
</table>
</td>
<tr>
<td colspan="3" class="titleSecond"><br><blockquote>{LN_ORACLE_HELP_TEXT}</blockquote><br></td>
</tr>
<!-- IF helplinksenabled="true" -->
<tr>
<td class="tableBackground">
<br><br>
<table cellpadding="0" cellspacing="0" border="0" align="center" valign="top" width="800" class="table_with_border">
<tr><td class="cellmenu1" align="center" colspan="3"><B>{ORACLE_HELP_DETAIL}</B></td></tr>
<!-- BEGIN HelpLinks -->
<tr>
<td class="cellmenu2" nowrap>{SourceName}</td>
<td class="{cssclass}" width="50%">
<a href="{MsgUrl}" target="_top">
&nbsp;<img src="{MENU_EARTH_FIND}" align="middle" width="16" height="16">
{MsgDisplayName}
</a>
</td>
<td class="{cssclass}" width="50%">
<a href="{SourceUrl}" target="_top">
&nbsp;<img src="{MENU_EARTH_FIND}" align="middle" width="16" height="16">
{SourceDisplayName}
</a>
</td>
</tr>
<!-- END HelpLinks -->
</table>
<br><br>
</td>
</tr>
<!-- ENDIF helplinksenabled="true" -->
</table>
<!-- INCLUDE include_footer.html -->

View File

@ -5,7 +5,13 @@
<center>
<div class="table_with_border_second ErrorMsg" style="width:600px">
<div class="PriorityError">{LN_GEN_ERRORDETAILS}</div>
<p>{ERROR_MSG}</p>
<p align="left">{ERROR_MSG}</p>
<p>
<a href="http://kb.monitorware.com/kbeventdb-list-12-Adiscon-phpLogCon-{detailederror_code}.html" target="_blank">
<img src="{MENU_HELP_ORANGE}" width="16" height="16" title="{LN_GEN_MOREINFORMATION}">
{LN_GEN_MOREINFORMATION}
</a>
</p>
</div>
<br><br>
</center>