Prepared phpLogCon to support export formats

This commit is contained in:
Andre Lorbach 2008-08-04 15:19:32 +02:00
parent 47124f1c81
commit f57b612e33
6 changed files with 102 additions and 9 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 B

View File

@ -69,6 +69,14 @@ define('SOURCE_DB', '2');
define('SOURCE_PDO', '3');
// ---
// --- Exportformat defines
define('EXPORT_CVS', 'CVS');
define('EXPORT_XML', 'XML');
define('EXPORT_EXCEL', 'EXCEL');
define('EXPORT_PDF', 'PDF');
define('EXPORT_HTML', 'HTML');
// ---
// ---
define('UID_UNKNOWN', -1);
// ---

View File

@ -175,6 +175,9 @@ function InitPhpLogCon()
// Init predefined reload times
CreateReloadTimesList();
// Init predefined reload times
CreateExportFormatList();
// --- Enable PHP Debug Mode
InitPhpDebugMode();
// ---
@ -325,6 +328,23 @@ function CreateReloadTimesList()
}
function CreateExportFormatList()
{
global $content;
// Add basic formats!
$content['EXPORTTYPES'][EXPORT_CVS] = array( "ID" => EXPORT_CVS, "Selected" => "", "DisplayName" => $content['LN_GEN_EXPORT_CVS'] );
$content['EXPORTTYPES'][EXPORT_HTML] = array( "ID" => EXPORT_HTML, "Selected" => "", "DisplayName" => $content['LN_GEN_EXPORT_HTML'] );
$content['EXPORTTYPES'][EXPORT_EXCEL] = array( "ID" => EXPORT_EXCEL, "Selected" => "", "DisplayName" => $content['LN_GEN_EXPORT_EXCEL'] );
// Add formats by loaded extensions
if ( $content['XML_IS_ENABLED'] )
$content['EXPORTTYPES'][EXPORT_XML] = array( "ID" => EXPORT_XML, "Selected" => "", "DisplayName" => $content['LN_GEN_EXPORT_XML'] );
if ( $content['PDF_IS_ENABLED'] )
$content['EXPORTTYPES'][EXPORT_PDF] = array( "ID" => EXPORT_PDF, "Selected" => "", "DisplayName" => $content['LN_GEN_EXPORT_PDF'] );
}
function CreatePredefinedSearches()
{
global $CFG, $content;
@ -367,13 +387,49 @@ function InitPhpDebugMode()
function CheckAndSetRunMode()
{
global $RUNMODE, $MaxExecutionTime;
global $content, $RUNMODE, $MaxExecutionTime;
// Set to command line mode if argv is set!
if ( !isset($_SERVER["GATEWAY_INTERFACE"]) )
$RUNMODE = RUNMODE_COMMANDLINE;
// Obtain max_execution_time
$MaxExecutionTime = ini_get("max_execution_time");
// --- Check necessary PHP Extensions!
$loadedExtensions = get_loaded_extensions();
// Check for GD libary
if ( in_array("gd", $loadedExtensions) )
$content['GD_IS_ENABLED'] = true;
else
$content['GD_IS_ENABLED'] = false;
// Check MYSQL Extension
if ( in_array("mysql", $loadedExtensions) )
$content['MYSQL_IS_ENABLED'] = true;
else
$content['MYSQL_IS_ENABLED'] = false;
// Check PDO Extension
if ( in_array("PDO", $loadedExtensions) )
$content['PDO_IS_ENABLED'] = true;
else
$content['PDO_IS_ENABLED'] = false;
// ---
// Check XML Extension
if ( in_array("xml", $loadedExtensions) )
$content['XML_IS_ENABLED'] = true;
else
$content['XML_IS_ENABLED'] = false;
// ---
// Check PDF Extension
if ( in_array("pdf", $loadedExtensions) )
$content['PDF_IS_ENABLED'] = true;
else
$content['PDF_IS_ENABLED'] = false;
// ---
}
function InitRuntimeInformations()
@ -448,7 +504,8 @@ function InitFrontEndVariables()
$content['MENU_MAXIMIZE'] = $content['BASEPATH'] . "images/icons/table_selection_all.png";
$content['MENU_NORMAL'] = $content['BASEPATH'] . "images/icons/table_selection_block.png";
$content['MENU_USEROPTIONS'] = $content['BASEPATH'] . "images/icons/businessman_preferences.png";
$content['MENU_EXPORT'] = $content['BASEPATH'] . "images/icons/export1.png";
$content['MENU_PAGER_BEGIN'] = $content['BASEPATH'] . "images/icons/media_beginning.png";
$content['MENU_PAGER_PREVIOUS'] = $content['BASEPATH'] . "images/icons/media_rewind.png";
$content['MENU_PAGER_NEXT'] = $content['BASEPATH'] . "images/icons/media_fast_forward.png";

View File

@ -86,6 +86,8 @@ else
$content['skipone'] = false;
// ---
// Init Export Stuff!
$content['EXPORT_ENABLED'] = true;
// Init Pager variables
// $content['uid_previous'] = UID_UNKNOWN;

View File

@ -60,7 +60,6 @@ $content['LN_GEN_SELECTVIEW'] = "Select View";
$content['LN_GEN_CRITERROR_UNKNOWNTYPE'] = "The source type '%1' is not supported by phpLogCon yet. This is a critical error, please fix your configuration.";
$content['LN_GEN_ERRORRETURNPREV'] = "Click here to return to the previous site.";
$content['LN_GEN_ERRORDETAILS'] = "Error Details:";
$content['LN_SOURCES_ERROR_WITHINSOURCE'] = "The source '%1' checking returned with an error:<br>%2";
$content['LN_SOURCES_ERROR_EXTRAMSG'] = "Extra Error Details:<br>%1";
$content['LN_ERROR_NORECORDS'] = "No syslog records found";
@ -80,6 +79,13 @@ $content['LN_ERROR_DB_NOPROPERTIES'] = "No database properties found";
$content['LN_ERROR_DB_INVALIDDBMAPPING'] = "Invalid datafield mappings";
$content['LN_ERROR_DB_INVALIDDBDRIVER'] = "Invalid database driver selected";
$content['LN_ERROR_DB_TABLENOTFOUND'] = "Could not find the configured table, maybe misspelled or the tablenames are case sensitive";
$content['LN_GEN_SELECTEXPORT'] = "Select to Export";
$content['LN_GEN_EXPORT_CVS'] = "CVS (Comma separated)";
$content['LN_GEN_EXPORT_HTML'] = "HTML";
$content['LN_GEN_EXPORT_XML'] = "XML";
$content['LN_GEN_EXPORT_PDF'] = "PDF";
$content['LN_GEN_EXPORT_EXCEL'] = "Excel";
// Topmenu Entries
$content['LN_MENU_SEARCH'] = "Search";

View File

@ -89,12 +89,34 @@
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center" class="with_border">
<tr>
<td class="title" nowrap><B>Recent syslog messages</B></td>
<td class="title" width="100%" nowrap><B>Recent syslog messages</B></td>
<!-- IF EXPORT_ENABLED="true" -->
<td class="line2" align="left" nowrap>
<form action="{BASEPATH}export.php" method="get" name="exportform">
<table border="0" cellspacing="0" cellpadding="0" align="left">
<tr>
<td align="right">
<input type="hidden" name="op" value="export">
<input type="hidden" name="uid" value="{uid_current}">
<select name="exporttype" size="1" OnChange="document.exportform.submit();" STYLE="width: 125px">
<option {selected} value="">{LN_GEN_SELECTEXPORT}</option>
<!-- BEGIN EXPORTTYPES -->
<option {selected} value="{ID}">{DisplayName}</option>
<!-- END EXPORTTYPES -->
</select>
</td>
<td nowrap width="16"><input type="image" src="{MENU_EXPORT}" width="16" hight="16" alt="{LN_GEN_EXPORT}" class="borderless"></td>
</tr>
</table>
</form>
</td>
<!-- ENDIF EXPORT_ENABLED="true" -->
</tr>
</table>
<table width="100%" align="center" border="0" cellpadding="1" cellspacing="1" class="with_border">
<tr>
<td nowrap width="100%" class="line2" align="left">
<!-- IF main_currentpagenumber_found="true" -->
{LN_GEN_PAGE} {main_currentpagenumber}
@ -109,8 +131,7 @@
<table border="0" cellspacing="0" cellpadding="0" align="right">
<tr>
<td>
<!-- <input type="checkbox" {autoreload_checked} name="autoreload">-->
<select name="autoreloadtime" size="1" OnChange="document.autoreload.submit();">
<select name="autoreloadtime" size="1" OnChange="document.autoreload.submit();" STYLE="width: 100px">
<!-- BEGIN reloadtimes -->
<option {Selected} value="{ID}">{DisplayName}</option>
<!-- END reloadtimes -->
@ -126,16 +147,16 @@
<td nowrap width="125" class="cellmenu2">{LN_GEN_RECORDCOUNT}:</td>
<td nowrap width="50" class="line2"><B>{main_recordcount}</B></td>
<!-- ENDIF main_recordcount_found="true" -->
<!-- IF main_pagerenabled="true" -->
<td nowrap width="115" class="cellmenu2">{LN_GEN_PAGERSIZE}:</td>
<td nowrap width="50" class="line2">
<form action="userchange.php" method="get" name="pageingsize">
<input type="hidden" name="op" value="changepagesize">
<table border="0" cellspacing="0" cellpadding="0" align="right">
<tr>
<td>
<select name="pagesizeid" size="1" OnChange="document.pageingsize.submit();">
<select name="pagesizeid" size="1" OnChange="document.pageingsize.submit();" STYLE="width: 100px">
<!-- BEGIN pagesizes -->
<option {Selected} value="{ID}">{DisplayName}</option>
<!-- END pagesizes -->
@ -144,7 +165,6 @@
</tr>
</table>
</form>
</td>
<td class="cellmenu2" nowrap><B>Pager: &nbsp; </B></td>