diff --git a/ChangeLog b/ChangeLog index 3ca2048..ef5517d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,15 @@ --------------------------------------------------------------------------- +Version 2.5.14 (beta), 2008-10-10 +- Added support for fully customizeable fields. This includes a fields + admin with possibility to customize width and alignment of fields, + and add new custom ones. +- Added new table into user database to support the custom fields. This + requires a database upgrade. +- Add admin panel for message parsers. This includes further information + on the parsers as well as the option to import necessary custom fields + for the message parsers. +- Overall simplified code related to field definitions and types. +--------------------------------------------------------------------------- Version 2.5.13 (beta), 2008-10-07 - Improved documentation, added general and search description. - The conversion script does convert the charts now as well. diff --git a/src/admin/fields.php b/src/admin/fields.php new file mode 100644 index 0000000..db91fc3 --- /dev/null +++ b/src/admin/fields.php @@ -0,0 +1,321 @@ + Helps administrating fields + * + * 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'); + +// Set PAGE to be ADMINPAGE! +define('IS_ADMINPAGE', true); +$content['IS_ADMINPAGE'] = true; +InitPhpLogCon(); +InitSourceConfigs(); +InitFrontEndDefaults(); // Only in WebFrontEnd +InitFilterHelpers(); // Helpers for frontend filtering! + +// Init admin langauge file now! +IncludeLanguageFile( $gl_root_path . '/lang/' . $LANG . '/admin.php' ); +// --- + +// --- BEGIN Custom Code + +// Only if the user is an admin! +if ( !isset($_SESSION['SESSION_ISADMIN']) || $_SESSION['SESSION_ISADMIN'] == 0 ) + DieWithFriendlyErrorMsg( $content['LN_ADMIN_ERROR_NOTALLOWED'] ); + +if ( isset($_GET['op']) ) +{ + if ($_GET['op'] == "add") + { + // Set Mode to add + $content['ISEDITORNEWFIELD'] = "true"; + $content['FIELD_FORMACTION'] = "addnewfield"; + $content['FIELD_SENDBUTTON'] = $content['LN_FIELDS_ADD']; + + //PreInit these values + $content['FieldID'] = ""; + $content['FieldDefine'] = "SYSLOG_"; + $content['FieldCaption'] = ""; // Field Caption + $content['SearchField'] = ""; // Should be set to FieldID for now! + $content['SearchOnline'] = false; // If we want to be able to search online + $content['CHECKED_SEARCHONLINE'] = ""; + + $content['FieldType'] = FILTER_TYPE_STRING; + CreateFieldTypesList($content['FieldType']); + $content['FieldAlign'] = ALIGN_CENTER; + CreateFieldAlignmentList($content['FieldAlign']); + $content['DefaultWidth'] = "50"; + + $content['Trunscate'] = "30"; // Not supported yet! + $content['Sortable'] = false; // Not supported yet! + } + else if ($_GET['op'] == "edit") + { + // Set Mode to edit + $content['ISEDITORNEWFIELD'] = "true"; + $content['FIELD_FORMACTION'] = "editfield"; + $content['FIELD_SENDBUTTON'] = $content['LN_FIELDS_EDIT']; + + if ( isset($_GET['id']) ) + { + //PreInit these values + $content['FieldID'] = DB_RemoveBadChars($_GET['id']); + + if ( isset($fields[$content['FieldID']]['FieldID']) ) + { + $content['FieldDefine'] = $fields[$content['FieldID']]['FieldDefine']; + $content['FieldCaption'] = $fields[$content['FieldID']]['FieldCaption']; + $content['SearchField'] = $fields[$content['FieldID']]['SearchField']; + $content['SearchOnline'] = $fields[$content['FieldID']]['SearchOnline']; + if ( $content['SearchOnline'] ) { $content['CHECKED_SEARCHONLINE'] = "checked"; } else { $content['CHECKED_SEARCHONLINE'] = ""; } + + $content['FieldType'] = $fields[$content['FieldID']]['FieldType']; + CreateFieldTypesList($content['FieldType']); + $content['FieldAlign'] = $fields[$content['FieldID']]['FieldAlign']; + CreateFieldAlignmentList($content['FieldAlign']); + $content['DefaultWidth'] = $fields[$content['FieldID']]['DefaultWidth']; + + // Unused fields yet + $content['Trunscate'] = $fields[$content['FieldID']]['Trunscate']; + $content['Sortable'] = $fields[$content['FieldID']]['Sortable']; + if ( $content['Sortable'] ) { $content['CHECKED_SORTABLE'] = "checked"; } else { $content['CHECKED_SORTABLE'] = ""; } + + // Some fields cannot be edited, if this is an internal field! + if ( $fields[$content['FieldID']]['IsInternalField'] ) + $content['DisableInternalFields'] = "disabled"; + else + $content['DisableInternalFields'] = ""; + } + else + { + $content['ISEDITORNEWFIELD'] = false; + $content['ISERROR'] = true; + $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_FIELDS_ERROR_IDNOTFOUND'], $content['FieldID'] ); + } + } + else + { + $content['ISEDITORNEWFIELD'] = false; + $content['ISERROR'] = true; + $content['ERROR_MSG'] = $content['LN_FIELDS_ERROR_INVALIDID']; + } + } + else if ($_GET['op'] == "delete") + { + if ( isset($_GET['id']) ) + { + //PreInit these values + $content['FieldID'] = DB_RemoveBadChars($_GET['id']); + + // Get UserInfo + $result = DB_Query("SELECT FieldCaption FROM " . DB_FIELDS . " WHERE FieldID = '" . $content['FieldID'] . "'"); + $myrow = DB_GetSingleRow($result, true); + if ( !isset($myrow['FieldCaption']) ) + { + $content['ISERROR'] = true; + $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_FIELDS_ERROR_IDNOTFOUND'], $content['FieldID'] ); + } + + // --- Ask for deletion first! + if ( (!isset($_GET['verify']) || $_GET['verify'] != "yes") ) + { + // This will print an additional secure check which the user needs to confirm and exit the script execution. + PrintSecureUserCheck( GetAndReplaceLangStr( $content['LN_FIELDS_WARNDELETESEARCH'], $myrow['FieldCaption'] ), $content['LN_DELETEYES'], $content['LN_DELETENO'] ); + } + // --- + + // do the delete! + $result = DB_Query( "DELETE FROM " . DB_FIELDS . " WHERE FieldID = '" . $content['FieldID'] . "'" ); + if ($result == FALSE) + { + $content['ISERROR'] = true; + $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_FIELDS_ERROR_DELSEARCH'], $content['FieldID'] ); + } + else + DB_FreeQuery($result); + + // Do the final redirect + RedirectResult( GetAndReplaceLangStr( $content['LN_FIELDS_ERROR_HASBEENDEL'], $myrow['FieldCaption'] ) , "fields.php" ); + } + else + { + $content['ISERROR'] = true; + $content['ERROR_MSG'] = $content['LN_FIELDS_ERROR_INVALIDID']; + } + } +} + +if ( isset($_POST['op']) ) +{ +//print_r ( $_POST ); + // Get FieldID + if ( isset($_POST['Newid']) ) { $content['FieldID'] = DB_RemoveBadChars($_POST['Newid']); } else if ( isset($_POST['id']) ) { $content['FieldID'] = DB_RemoveBadChars($_POST['id']); } else { $content['FieldID'] = ""; } + + // textfields + if ( isset($_POST['FieldCaption']) ) { $content['FieldCaption'] = DB_RemoveBadChars($_POST['FieldCaption']); } else {$content['FieldCaption'] = ""; } + if ( isset($_POST['SearchField']) ) { $content['SearchField'] = DB_RemoveBadChars($_POST['SearchField']); } else {$content['SearchField'] = ""; } + if ( isset($_POST['NewFieldDefine']) ) { $content['FieldDefine'] = DB_RemoveBadChars($_POST['NewFieldDefine']); } else if ( isset($_POST['FieldDefine']) ) { $content['FieldDefine'] = DB_RemoveBadChars($_POST['FieldDefine']); } else { $content['FieldDefine'] = ""; } + CreateFieldAlignmentList(0); + if ( isset($_POST['FieldAlign']) && isset($content['ALIGMENTS'][$_POST['FieldAlign']]) ) { $content['FieldAlign'] = $_POST['FieldAlign']; } else {$content['FieldAlign'] = ALIGN_CENTER; } + + // number fields + if ( isset($_POST['DefaultWidth']) ) { $content['DefaultWidth'] = intval(DB_RemoveBadChars($_POST['DefaultWidth'])); } else {$content['DefaultWidth'] = 50; } +// NOT USED YET if ( isset ($_POST['Trunscate']) ) { $content['Trunscate'] = intval(DB_RemoveBadChars($_POST['Trunscate'])); } else {$content['Trunscate'] = 30; } + CreateFieldTypesList(0); + if ( isset($_POST['NewFieldType']) && isset($content['FILTERTYPES'][$_POST['NewFieldType']]) ) { $content['FieldType'] = intval($_POST['NewFieldType']); } else if ( isset($_POST['FieldType']) && isset($content['FILTERTYPES'][$_POST['FieldType']]) ) { $content['FieldType'] = intval($_POST['FieldType']); } else { $content['FieldType'] = FILTER_TYPE_STRING; } + + // Checkbox fields + if ( isset($_POST['SearchOnline']) ) { $content['SearchOnline'] = "true"; } else { $content['SearchOnline'] = "false"; } +// NOT USED YET if ( isset ($_POST['Sortable']) ) { $content['Sortable'] = true; } else {$content['Sortable'] = false; } + + // --- Check mandotary values + if ( $content['FieldID'] == "" ) + { + $content['ISERROR'] = true; + $content['ERROR_MSG'] = $content['LN_FIELDS_ERROR_FIELDIDEMPTY']; + } + else if ( $content['FieldCaption'] == "" ) + { + $content['ISERROR'] = true; + $content['ERROR_MSG'] = $content['LN_FIELDS_ERROR_FIELDCAPTIONEMPTY']; + } + else if ( $content['SearchField'] == "" ) + { + $content['ISERROR'] = true; + $content['ERROR_MSG'] = $content['LN_FIELDS_ERROR_SEARCHFIELDEMPTY']; + } + else if ( $content['FieldDefine'] == "" ) + { + $content['ISERROR'] = true; + $content['ERROR_MSG'] = $content['LN_FIELDS_ERROR_FIELDDEFINEEMPTY']; + } + // --- + + if ( !isset($content['ISERROR']) ) + { + // Everything was alright, go and check if the entry exists! + $result = DB_Query("SELECT FieldID FROM " . DB_FIELDS . " WHERE FieldID = '" . $content['FieldID'] . "'"); + $myrow = DB_GetSingleRow($result, true); + if ( !isset($myrow['FieldID']) ) + { + // Add custom Field now! + $sqlquery = "INSERT INTO " . DB_FIELDS . " (FieldID, FieldCaption, FieldDefine, SearchField, FieldAlign, DefaultWidth, FieldType, SearchOnline) + VALUES ( + '" . $content['FieldID'] . "', + '" . $content['FieldCaption'] . "', + '" . $content['FieldDefine'] . "', + '" . $content['SearchField'] . "', + '" . $content['FieldAlign'] . "', + " . $content['DefaultWidth'] . ", + " . $content['FieldType'] . ", + " . $content['SearchOnline'] . " + )"; + $result = DB_Query($sqlquery); + DB_FreeQuery($result); + + // Do the final redirect + RedirectResult( GetAndReplaceLangStr( $content['LN_FIELDS_HASBEENADDED'], $content['FieldCaption'] ) , "fields.php" ); + } + else + { + + // Edit the Search Entry now! + $result = DB_Query("UPDATE " . DB_FIELDS . " SET + FieldCaption = '" . $content['FieldCaption'] . "', + FieldDefine = '" . $content['FieldDefine'] . "', + SearchField = '" . $content['SearchField'] . "', + FieldAlign = '" . $content['FieldAlign'] . "', + DefaultWidth = " . $content['DefaultWidth'] . ", + FieldType = " . $content['FieldType'] . ", + SearchOnline = " . $content['SearchOnline'] . " + WHERE FieldID = '" . $content['FieldID'] . "'"); + DB_FreeQuery($result); + + // Done redirect! + RedirectResult( GetAndReplaceLangStr( $content['LN_FIELDS_HASBEENEDIT'], $content['FieldCaption']) , "fields.php" ); + } + } +} + +if ( !isset($_POST['op']) && !isset($_GET['op']) ) +{ + // Default Mode = List Searches + $content['LISTFIELDS'] = "true"; + + // Copy Search array for further modifications + $content['FIELDS'] = $fields; + + $i = 0; // Help counter! + foreach ($content['FIELDS'] as &$myField ) + { + // Allow Delete Operation + if ( $myField['IsInternalField'] && $myField['FieldFromDB'] ) + { + $myField['AllowDelete'] = true; + $myField['DELETEIMG'] = $content['MENU_DELETE_FROMDB']; + } + else if ( $myField['FieldFromDB'] ) + { + $myField['AllowDelete'] = true; + $myField['DELETEIMG'] = $content['MENU_DELETE']; + } + + // --- Set CSS Class + if ( $i % 2 == 0 ) + $myField['cssclass'] = "line1"; + else + $myField['cssclass'] = "line2"; + $i++; + // --- + } + // --- +} +// --- END Custom Code + +// --- BEGIN CREATE TITLE +$content['TITLE'] = InitPageTitle(); +$content['TITLE'] .= $content['LN_ADMINMENU_FIELDOPT']; +// --- END CREATE TITLE + +// --- Parsen and Output +InitTemplateParser(); +$page -> parser($content, "admin/admin_fields.html"); +$page -> output(); +// --- + +?> \ No newline at end of file diff --git a/src/admin/parsers.php b/src/admin/parsers.php new file mode 100644 index 0000000..10f8317 --- /dev/null +++ b/src/admin/parsers.php @@ -0,0 +1,311 @@ + Helps administrating message parsers + * + * 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'); + +// Set PAGE to be ADMINPAGE! +define('IS_ADMINPAGE', true); +$content['IS_ADMINPAGE'] = true; +InitPhpLogCon(); +InitSourceConfigs(); +InitFrontEndDefaults(); // Only in WebFrontEnd +InitFilterHelpers(); // Helpers for frontend filtering! + +// Init admin langauge file now! +IncludeLanguageFile( $gl_root_path . '/lang/' . $LANG . '/admin.php' ); +// --- + +// --- BEGIN Custom Code + +// Firts of all init List of Parsers! +InitMessageParsers(); + +if ( isset($_GET['op']) ) +{ + if ($_GET['op'] == "details") + { + // Set Mode to edit + $content['ISSHOWDETAILS'] = "true"; +// $content['SEARCH_FORMACTION'] = "editsearch"; +// $content['SEARCH_SENDBUTTON'] = $content['LN_SEARCH_EDIT']; + + if ( isset($_GET['id']) ) + { + //PreInit these values + $content['ParserID'] = DB_RemoveBadChars($_GET['id']); + if ( isset($content['PARSERS'][ $content['ParserID'] ]) ) + { + // Get Reference to parser! + $myParser = $content['PARSERS'][ $content['ParserID'] ]; + + $content['DisplayName'] = $myParser['DisplayName']; + $content['Description'] = $myParser['Description']; + + if ( strlen($myParser['ParserHelpArticle']) > 0 ) + { + $content['EnableHelpArticle'] = true; + $content['ParserHelpArticle'] = $myParser['ParserHelpArticle']; + } + + // check for custom fields + if ( isset($myParser['CustomFieldsList']) && count($myParser['CustomFieldsList']) > 0 ) + { + // Needs custom fields! + $content['EnableCustomField'] = true; + $content['CustomFieldsList'] = $myParser['CustomFieldsList']; + + foreach( $myParser['CustomFieldsList'] as $myField ) + { + // check if field is in define list! + if ( !array_key_exists($myField['FieldID'], $fields) ) + { + $content['ParserInitEnabled'] = true; + break; + } + else + { + $content['ParserDeleteEnabled'] = true; + break; + } + } + } + + } + else + { + $content['ISSHOWDETAILS'] = false; + $content['ISERROR'] = true; + $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_PARSERS_ERROR_IDNOTFOUND'], $content['ParserID'] ); + } + } + else + { + $content['ISSHOWDETAILS'] = false; + $content['ISERROR'] = true; + $content['ERROR_MSG'] = $content['LN_PARSERS_ERROR_INVALIDID']; + } + } + else if ($_GET['op'] == "removeparser") + { + if ( isset($_GET['id']) ) + { + //PreInit these values + $content['ParserID'] = DB_RemoveBadChars($_GET['id']); + if ( isset($content['PARSERS'][ $content['ParserID'] ]) ) + { + // Get Reference to parser! + $myParser = $content['PARSERS'][ $content['ParserID'] ]; + + // --- Ask for deletion first! + if ( (!isset($_GET['verify']) || $_GET['verify'] != "yes") ) + { + // This will print an additional secure check which the user needs to confirm and exit the script execution. + PrintSecureUserCheck( GetAndReplaceLangStr( $content['LN_PARSERS_WARNREMOVE'], $myParser['DisplayName'] ), $content['LN_DELETEYES'], $content['LN_DELETENO'] ); + } + // --- + + // Check if we have fields to delete + if ( isset($myParser['CustomFieldsList']) && count($myParser['CustomFieldsList']) > 0 ) + { + // Helper counter + $deletedFields = 0; + + // Loop through all custom fields! + foreach( $myParser['CustomFieldsList'] as $myField ) + { + // check if field is in define list! + if ( array_key_exists($myField['FieldID'], $fields) ) + { + $result = DB_Query( "DELETE FROM " . DB_FIELDS . " WHERE FieldID = '" . $myField['FieldID'] . "'"); + DB_FreeQuery($result); + + // increment counter + $deletedFields++; + } + } + + // Do the final redirect + RedirectResult( GetAndReplaceLangStr( $content['LN_PARSERS_ERROR_HASBEENREMOVED'], $myParser['DisplayName'], $deletedFields ) , "parsers.php" ); + } + else + { + $content['ISERROR'] = true; + $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_PARSERS_ERROR_NOFIELDS'], $content['ParserID'] ); + } + } + } + else + { + $content['ISERROR'] = true; + $content['ERROR_MSG'] = $content['LN_PARSERS_ERROR_INVALIDID']; + } + } + else if ($_GET['op'] == "initparser") + { + if ( isset($_GET['id']) ) + { + //PreInit these values + $content['ParserID'] = DB_RemoveBadChars($_GET['id']); + if ( isset($content['PARSERS'][ $content['ParserID'] ]) ) + { + // Get Reference to parser! + $myParser = $content['PARSERS'][ $content['ParserID'] ]; + + // check for custom fields + if ( isset($myParser['CustomFieldsList']) && count($myParser['CustomFieldsList']) > 0 ) + { + // Helper counter + $addedFields = 0; + + // Loop through all custom fields! + foreach( $myParser['CustomFieldsList'] as $myField ) + { + // check if field is in define list! + if ( !array_key_exists($myField['FieldID'], $fields) ) + { + // Add field into DB! + $sqlquery = "INSERT INTO " . DB_FIELDS . " (FieldID, FieldCaption, FieldDefine, SearchField, FieldAlign, DefaultWidth, FieldType, SearchOnline) + VALUES ( + '" . $myField['FieldID'] . "', + '" . $myField['FieldCaption'] . "', + '" . $myField['FieldDefine'] . "', + '" . $myField['SearchField'] . "', + '" . $myField['FieldAlign'] . "', + " . $myField['DefaultWidth'] . ", + " . $myField['FieldType'] . ", + " . $myField['SearchOnline'] . " + )"; + $result = DB_Query($sqlquery); + DB_FreeQuery($result); + + // increment counter + $addedFields++; + } + } + + // Do the final redirect + RedirectResult( GetAndReplaceLangStr( $content['LN_PARSERS_ERROR_HASBEENADDED'], $myParser['DisplayName'], $addedFields ) , "parsers.php" ); + } + else + { + $content['ISERROR'] = true; + $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_PARSERS_ERROR_NOFIELDS'], $content['ParserID'] ); + } + } + else + { + $content['ISERROR'] = true; + $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_PARSERS_ERROR_IDNOTFOUND'], $content['ParserID'] ); + } + } + else + { + $content['ISERROR'] = true; + $content['ERROR_MSG'] = $content['LN_PARSERS_ERROR_INVALIDID']; + } + } +} + +// Default mode! +if ( !isset($_POST['op']) && !isset($_GET['op']) ) +{ + if ( isset($content['PARSERS']) ) + { + // Default Mode = List Searches + $content['LISTPARSERS'] = "true"; + + $i = 0; // Help counter! + foreach ($content['PARSERS'] as &$myParser ) + { + // Set if help link is enabled + if ( strlen($myParser['ParserHelpArticle']) > 0 ) + $myParser['ParserHelpEnabled'] = true; + else + $myParser['ParserHelpEnabled'] = false; + + // Find out if we need to INIT something! + if ( isset($myParser['CustomFieldsList']) && count($myParser['CustomFieldsList']) > 0 ) + { + foreach( $myParser['CustomFieldsList'] as $myField ) + { + // check if field is in define list! + if ( !array_key_exists($myField['FieldID'], $fields) ) + { + $myParser['ParserInitEnabled'] = true; + break; + } + else + { + $myParser['ParserDeleteEnabled'] = true; + break; + } + } + } + + // --- Set CSS Class + if ( $i % 2 == 0 ) + $myParser['cssclass'] = "line1"; + else + $myParser['cssclass'] = "line2"; + $i++; + // --- + } + } + else + { + $content['LISTPARSERS'] = "false"; + $content['ISERROR'] = true; + $content['ERROR_MSG'] = $content['LN_PARSERS_ERROR_NOPARSERS']; + } +} +// --- END Custom Code + +// --- BEGIN CREATE TITLE +$content['TITLE'] = InitPageTitle(); +$content['TITLE'] .= " :: " . $content['LN_ADMINMENU_MSGPARSERSOPT']; +// --- END CREATE TITLE + +// --- Parsen and Output +InitTemplateParser(); +$page -> parser($content, "admin/admin_parsers.html"); +$page -> output(); +// --- + +?> \ No newline at end of file diff --git a/src/admin/views.php b/src/admin/views.php index 1c51fc4..2f1cffd 100644 --- a/src/admin/views.php +++ b/src/admin/views.php @@ -223,11 +223,14 @@ if ( isset($content['ISEDITORNEWVIEW']) && $content['ISEDITORNEWVIEW'] ) foreach ($content['SUBCOLUMNS'] as $key => &$myColumn ) { // Set Fieldcaption - if ( isset($fields[$key]) && isset($content[ $fields[$key]['FieldCaptionID'] ]) ) - $myColumn['ColCaption'] = $content[ $fields[$key]['FieldCaptionID'] ]; + if ( isset($fields[$key]) && isset($fields[$key]['FieldCaption']) ) + $myColumn['ColCaption'] = $fields[$key]['FieldCaption']; else $myColumn['ColCaption'] = $key; + // Append Internal FieldID + $myColumn['ColInternalID'] = $fields[$key]['FieldDefine']; + // --- Set CSS Class if ( $i % 2 == 0 ) $myColumn['colcssclass'] = "line1"; @@ -256,10 +259,13 @@ if ( isset($content['ISEDITORNEWVIEW']) && $content['ISEDITORNEWVIEW'] ) foreach ($content['FIELDS'] as $key => &$myField ) { // Set Fieldcaption - if ( isset($content[ $myField['FieldCaptionID'] ]) ) - $myField['FieldCaption'] = $content[ $myField['FieldCaptionID'] ]; + if ( isset($myField['FieldCaption']) ) + $myField['FieldCaption'] = $myField['FieldCaption']; else $myField['FieldCaption'] = $key; + + // Append Internal FieldID + $myField['FieldCaption'] .= " (" . $fields[$key]['FieldDefine'] . ")"; } // --- } @@ -311,8 +317,8 @@ if ( isset($_POST['op']) ) $content['SUBCOLUMNS'][$szColId]['ColFieldID'] = $szColId; // Set Fieldcaption - if ( isset($content[ $fields[$szColId]['FieldCaptionID'] ]) ) - $content['SUBCOLUMNS'][$szColId]['ColCaption'] = $content[ $fields[$szColId]['FieldCaptionID'] ]; + if ( isset($fields[$szColId]['FieldCaption']) ) + $content['SUBCOLUMNS'][$szColId]['ColCaption'] = $fields[$szColId]['FieldCaption']; else $content['SUBCOLUMNS'][$szColId]['ColCaption'] = $szColId; @@ -338,8 +344,8 @@ if ( isset($_POST['op']) ) $content['FIELDS'][$szColId] = $szColId; // Set Fieldcaption - if ( isset($fields[$szColId]) && isset($content[ $fields[$szColId]['FieldCaptionID'] ]) ) - $content['FIELDS'][$szColId]['FieldCaption'] = $content[ $fields[$szColId]['FieldCaptionID'] ]; + if ( isset($fields[$szColId]) && isset($fields[$szColId]['FieldCaption']) ) + $content['FIELDS'][$szColId]['FieldCaption'] = $fields[$szColId]['FieldCaption']; else $content['FIELDS'][$szColId]['FieldCaption'] = $szColId; } @@ -543,11 +549,11 @@ if ( !isset($_POST['op']) && !isset($_GET['op']) ) foreach ($myView['Columns'] as $myCol ) { // Get Fieldcaption - if ( isset($fields[$myCol]) && isset($content[ $fields[$myCol]['FieldCaptionID'] ]) ) - $myView['COLUMNS'][$myCol]['FieldCaption'] = $content[ $fields[$myCol]['FieldCaptionID'] ]; + if ( isset($fields[$myCol]) && isset($fields[$myCol]['FieldCaption']) ) + $myView['COLUMNS'][$myCol]['FieldCaption'] = $fields[$myCol]['FieldCaption']; else $myView['COLUMNS'][$myCol]['FieldCaption'] = $myCol; - + if ( $iBegin ) { $myView['COLUMNS'][$myCol]['FieldCaptionSeperator'] = ""; diff --git a/src/asktheoracle.php b/src/asktheoracle.php index 4c5d94a..93d8185 100644 --- a/src/asktheoracle.php +++ b/src/asktheoracle.php @@ -131,34 +131,6 @@ foreach( $content['Sources'] as $mySource ) // 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 diff --git a/src/chartgenerator.php b/src/chartgenerator.php index 453ce2c..c1058f0 100644 --- a/src/chartgenerator.php +++ b/src/chartgenerator.php @@ -156,7 +156,7 @@ if ( !$content['error_occured'] ) else $chartImageMapLinks[] = ""; - $chartImageMapAlts[] = $content[ $fields[$content['chart_field']]['FieldCaptionID'] ] . ": " . $myKey; + $chartImageMapAlts[] = $fields[$content['chart_field']]['FieldCaption'] . ": " . $myKey; $chartImageMapTargets[] ="_top"; } @@ -174,12 +174,12 @@ if ( !$content['error_occured'] ) $graph->SetBox(); // Box around plotarea // Set up the title for the graph -// $graph->title->Set('Messagecount sorted by "' . $content[ $fields[$content['chart_field']]['FieldCaptionID'] ] . '"'); +// $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'], $content[ $fields[$content['chart_field']]['FieldCaptionID'] ]) ); + $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'); @@ -273,7 +273,7 @@ if ( !$content['error_occured'] ) $graph->yaxis->SetFont(FF_VERA,FS_NORMAL,8); // Setup the tab title - $graph->tabtitle->Set( GetAndReplaceLangStr($content['LN_STATS_CHARTTITLE'], $content['maxrecords'], $content[ $fields[$content['chart_field']]['FieldCaptionID'] ]) ); + $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'); @@ -363,7 +363,7 @@ if ( !$content['error_occured'] ) $graph->yaxis->SetFont(FF_VERA,FS_NORMAL,8); // Setup the tab title - $graph->tabtitle->Set( GetAndReplaceLangStr($content['LN_STATS_CHARTTITLE'], $content['maxrecords'], $content[ $fields[$content['chart_field']]['FieldCaptionID'] ]) ); + $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'); diff --git a/src/classes/logstream.class.php b/src/classes/logstream.class.php index 4b4399f..e7efde4 100644 --- a/src/classes/logstream.class.php +++ b/src/classes/logstream.class.php @@ -264,6 +264,8 @@ abstract class LogStream { */ private function ParseFilters($szFilters) { + global $fields; + if ( isset($szFilters) && strlen($szFilters) > 0 ) { $tmpEntries = explode(" ", $szFilters); @@ -589,9 +591,44 @@ abstract class LogStream { break; /* END WebLog based fields */ default: - $tmpFilterType = FILTER_TYPE_UNKNOWN; - break; - // Unknown filter + // Custom Field, try to guess field! + + if ( isset($fields[$tmpArray[FILTER_TMP_KEY]]) && isset($fields[$tmpArray[FILTER_TMP_KEY]]['SearchField']) ) + { + $tmpKeyName = $tmpArray[FILTER_TMP_KEY]; + $tmpFilterType = $fields[$tmpKeyName]['FieldType']; + + // Handle numeric fields! + if ( $tmpFilterType == FILTER_TYPE_NUMBER ) + { + // --- Extra numeric Check + if ( isset($tmpValues) ) + { + foreach( $tmpValues as $mykey => $szValue ) + { + if ( is_numeric($szValue[FILTER_TMP_VALUE]) ) + $tmpValues[$mykey][FILTER_TMP_VALUE] = $szValue[FILTER_TMP_VALUE]; + else + $tmpValues[$mykey][FILTER_TMP_VALUE] = ""; + } + } + else + { + // First set Filter Mode + $tmpArray[FILTER_TMP_MODE] = $this->SetFilterIncludeMode($tmpArray[FILTER_TMP_VALUE]); + + if ( !is_numeric($tmpArray[FILTER_TMP_VALUE]) ) + $tmpArray[FILTER_TMP_VALUE] = ""; + } + // --- + } + // Nothing to do actually! +// else if ( $tmpFilterType == FILTER_TYPE_STRING ) + } + else + // Unknown filter + $tmpFilterType = FILTER_TYPE_UNKNOWN; + //done! } // Ignore if unknown filter! diff --git a/src/classes/msgparser.class.php b/src/classes/msgparser.class.php index f20c78e..a4a7226 100644 --- a/src/classes/msgparser.class.php +++ b/src/classes/msgparser.class.php @@ -45,7 +45,14 @@ require_once($gl_root_path . 'include/constants_logstream.php'); abstract class MsgParser{ + // Public configuration properties public $_MsgNormalize = 0; // If set to one, the msg will be reconstructed if successfully parsed before + + // Public Information properties + public $_ClassName = 'Default Messageparser'; + public $_ClassDescription = 'This is a placeholder for the message parser description!'; + public $_ClassRequiredFields = null; + public $_ClassHelpArticle = "http://www.monitorware.com/en/Articles/"; /** * ParseLine diff --git a/src/classes/msgparsers/msgparser.apache2.class.php b/src/classes/msgparsers/msgparser.apache2.class.php index fc0222b..13810e7 100644 --- a/src/classes/msgparsers/msgparser.apache2.class.php +++ b/src/classes/msgparsers/msgparser.apache2.class.php @@ -48,7 +48,12 @@ require_once($gl_root_path . 'include/constants_logstream.php'); // --- class MsgParser_apache2 extends MsgParser { -// protected $_arrProperties = null; + + // Public Information properties + public $_ClassName = 'Apache 2 Combined Format'; + public $_ClassDescription = 'Parses the combined logfile format from Apache2 webservers.'; + public $_ClassRequiredFields = null; + public $_ClassHelpArticle = "http://www.monitorware.com/Common/en/Articles/setup_mwagent_webserverlogging_phplogcon_mysql.php"; // Constructor public function MsgParser_apache2() { @@ -121,10 +126,10 @@ class MsgParser_apache2 extends MsgParser { foreach ( $myFields as $myField ) { // Set Field Caption - if ( isset($content[ $fields[$myField]['FieldCaptionID'] ]) ) - $szFieldName = $content[ $fields[$myField]['FieldCaptionID'] ]; + if ( isset($fields[$myField]['FieldCaption']) ) + $szFieldName = $fields[$myField]['FieldCaption']; else - $szFieldName = $fields[$myField]['FieldCaptionID']; + $szFieldName = $myField; // Append Field into msg $szTmpMsg = $szFieldName . ": '" . $arrArguments[$myField] . "'\n" . $szTmpMsg; diff --git a/src/classes/msgparsers/msgparser.apache2common.class.php b/src/classes/msgparsers/msgparser.apache2common.class.php index 78697ef..ad5823b 100644 --- a/src/classes/msgparsers/msgparser.apache2common.class.php +++ b/src/classes/msgparsers/msgparser.apache2common.class.php @@ -48,7 +48,12 @@ require_once($gl_root_path . 'include/constants_logstream.php'); // --- class MsgParser_apache2common extends MsgParser { -// protected $_arrProperties = null; + + // Public Information properties + public $_ClassName = 'Apache 2 Common Format'; + public $_ClassDescription = 'Parses the common logfile format from Apache2 webservers.'; + public $_ClassRequiredFields = null; + public $_ClassHelpArticle = "http://www.monitorware.com/Common/en/Articles/setup_mwagent_webserverlogging_phplogcon_mysql.php"; // Constructor public function MsgParser_apache2common() { @@ -119,10 +124,10 @@ class MsgParser_apache2common extends MsgParser { foreach ( $myFields as $myField ) { // Set Field Caption - if ( isset($content[ $fields[$myField]['FieldCaptionID'] ]) ) - $szFieldName = $content[ $fields[$myField]['FieldCaptionID'] ]; + if ( isset($fields[$myField]['FieldCaption']) ) + $szFieldName = $fields[$myField]['FieldCaption']; else - $szFieldName = $fields[$myField]['FieldCaptionID']; + $szFieldName = $myField; // Append Field into msg $szTmpMsg = $szFieldName . ": '" . $arrArguments[$myField] . "'\n" . $szTmpMsg; diff --git a/src/classes/msgparsers/msgparser.eventlog.class.php b/src/classes/msgparsers/msgparser.eventlog.class.php index 2ce4970..f6f45c0 100644 --- a/src/classes/msgparsers/msgparser.eventlog.class.php +++ b/src/classes/msgparsers/msgparser.eventlog.class.php @@ -46,7 +46,12 @@ require_once($gl_root_path . 'include/constants_logstream.php'); // --- class MsgParser_eventlog extends MsgParser { -// protected $_arrProperties = null; + + // Public Information properties + public $_ClassName = 'Adiscon Eventlog Format'; + public $_ClassDescription = 'This is a parser for a special format which can be created with Adiscon Eventreporter or MonitorWare Agent.'; + public $_ClassRequiredFields = null; + public $_ClassHelpArticle = "http://www.monitorware.com/en/Articles/"; // Constructor public function MsgParser_eventlog() { @@ -90,10 +95,10 @@ class MsgParser_eventlog extends MsgParser { foreach ( $myFields as $myField ) { // Set Field Caption - if ( isset($content[ $fields[$myField]['FieldCaptionID'] ]) ) - $szFieldName = $content[ $fields[$myField]['FieldCaptionID'] ]; + if ( isset($fields[$myField]['FieldCaption']) ) + $szFieldName = $fields[$myField]['FieldCaption']; else - $szFieldName = $fields[$myField]['FieldCaptionID']; + $szFieldName = $myField; // Append Field into msg $szTmpMsg = $szFieldName . ": '" . $arrArguments[$myField] . "'\n" . $szTmpMsg; diff --git a/src/classes/msgparsers/msgparser.iis.class.php b/src/classes/msgparsers/msgparser.iis.class.php index b778e80..e01dca8 100644 --- a/src/classes/msgparsers/msgparser.iis.class.php +++ b/src/classes/msgparsers/msgparser.iis.class.php @@ -46,7 +46,12 @@ require_once($gl_root_path . 'include/constants_logstream.php'); // --- class MsgParser_iis extends MsgParser { -// protected $_arrProperties = null; + + // Public Information properties + public $_ClassName = 'Microsoft IIS Weblogs'; + public $_ClassDescription = 'Parses the common weblog format used by the Microsoft IIS webserver.'; + public $_ClassRequiredFields = null; + public $_ClassHelpArticle = "http://www.monitorware.com/en/Articles/"; // Constructor public function MsgParser_iis() { @@ -128,10 +133,10 @@ class MsgParser_iis extends MsgParser { foreach ( $myFields as $myField ) { // Set Field Caption - if ( isset($content[ $fields[$myField]['FieldCaptionID'] ]) ) - $szFieldName = $content[ $fields[$myField]['FieldCaptionID'] ]; + if ( isset($fields[$myField]['FieldCaption']) ) + $szFieldName = $fields[$myField]['FieldCaption']; else - $szFieldName = $fields[$myField]['FieldCaptionID']; + $szFieldName = $myField; // Append Field into msg $szTmpMsg = $szFieldName . ": '" . $arrArguments[$myField] . "'\n" . $szTmpMsg; diff --git a/src/classes/msgparsers/msgparser.wireless.class.php b/src/classes/msgparsers/msgparser.wireless.class.php new file mode 100644 index 0000000..87a05bb --- /dev/null +++ b/src/classes/msgparsers/msgparser.wireless.class.php @@ -0,0 +1,147 @@ + www.phplogcon.org <- * + * ----------------------------------------------------------------- * + * Apache Logfile Parser used to split WebLog fields if + * found in the msg. + * + * This Parser is for custom wireless access point logformat + * * + * All directives are explained within this file * + * + * Copyright (C) 2008 Adiscon GmbH + ********************************************************************* +*/ + +// --- Avoid directly accessing this file! +if ( !defined('IN_PHPLOGCON') ) +{ + die('Hacking attempt'); + exit; +} +// --- + +// --- Basic Includes +require_once($gl_root_path . 'classes/enums.class.php'); +require_once($gl_root_path . 'classes/msgparser.class.php'); +require_once($gl_root_path . 'include/constants_errors.php'); +require_once($gl_root_path . 'include/constants_logstream.php'); +// --- + +class MsgParser_wireless extends MsgParser { + + // Public Information properties + public $_ClassName = 'Custom Wireless Logfiles'; + public $_ClassDescription = 'Custom logfile parser for wireless access points.'; + public $_ClassHelpArticle = ""; + public $_ClassRequiredFields = array ( + "net_bytesrecieved" => array ( "FieldID" => "net_bytesrecieved", "FieldDefine" => "SYSLOG_NET_BYTESRECIEVED", "FieldCaption" => "Bytes recieved", "FieldType" => 1, "FieldAlign" => "left", "SearchField" => "net_bytesrecieved", "DefaultWidth" => 50, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0), + "net_bytessend" => array (", ", "FieldID" => "net_bytessend", "FieldDefine" => "SYSLOG_NET_BYTESSEND", "FieldCaption" => "Bytes send", "FieldType" => 1, "FieldAlign" => "left", "SearchField" => "net_bytessend", "DefaultWidth" => 50, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0 ), + "net_interface" => array (", ", "FieldID" => "net_interface", "FieldDefine" => "SYSLOG_NET_INTERFACE", "FieldCaption" => "Interface", "FieldType" => 0, "FieldAlign" => "center", "SearchField" => "net_interface", "DefaultWidth" => 100, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0), + "net_lastactivity" => array (", ", "FieldID" => "net_lastactivity", "FieldDefine" => "SYSLOG_NET_LASTACTIVITY", "FieldCaption" => "Last Activity", "FieldType" => 0, "FieldAlign" => "center", "SearchField" => "net_lastactivity", "DefaultWidth" => 80, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0), + "net_lastip" => array (", ", "FieldID" => "net_lastip", "FieldDefine" => "SYSLOG_NET_LASTIP", "FieldCaption" => "Last IP Address", "FieldType" => 0, "FieldAlign" => "left", "SearchField" => "net_lastip", "DefaultWidth" => 100, "SearchOnline" => 1, "Trunscate" => 0, "Sortable" => 0), + "net_mac_address" => array (", ", "FieldID" => "net_mac_address", "FieldDefine" => "SYSLOG_NET_MAC_ADDRESS", "FieldCaption" => "Mac Address", "FieldType" => 0, "FieldAlign" => "left", "SearchField" => "net_mac_address", "DefaultWidth" => 125, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0), + "net_packetsrecieved" => array (", ", "FieldID" => "net_packetsrecieved", "FieldDefine" => "SYSLOG_NET_PACKETSRECIEVED", "FieldCaption" => "Packets recieved", "FieldType" => 1, "FieldAlign" => "left", "SearchField" => "net_packetsrecieved", "DefaultWidth" => 50, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0), + "net_packetssend" => array (", ", "FieldID" => "net_packetssend", "FieldDefine" => "SYSLOG_NET_PACKETSSEND", "FieldCaption" => "Packets send", "FieldType" => 1, "FieldAlign" => "left", "SearchField" => "net_packetssend", "DefaultWidth" => 50, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0), + "net_rxrate" => array (", ", "FieldID" => "net_rxrate", "FieldDefine" => "SYSLOG_NET_RXRATE", "FieldCaption" => "RX Rate", "FieldType" => 0, "FieldAlign" => "center", "SearchField" => "net_rxrate", "DefaultWidth" => 65, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0), + "net_signalstrength" => array (", ", "FieldID" => "net_signalstrength", "FieldDefine" => "SYSLOG_NET_SIGNALSTRENGTH", "FieldCaption" => "Signal strength", "FieldType" => 0, "FieldAlign" => "center", "SearchField" => "net_signalstrength", "DefaultWidth" => 100, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0), + "net_signaltonoise" => array (", ", "FieldID" => "net_signaltonoise", "FieldDefine" => "SYSLOG_NET_SIGNALTONOISE", "FieldCaption" => "Signal to noise", "FieldType" => 1, "FieldAlign" => "center", "SearchField" => "net_signaltonoise", "DefaultWidth" => 50, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0), + "net_uptime" => array (", ", "FieldID" => "net_uptime", "FieldDefine" => "SYSLOG_NET_UPTIME", "FieldCaption" => "System Uptime", "FieldType" => 0, "FieldAlign" => "center", "SearchField" => "net_uptime", "DefaultWidth" => 85, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0), + "net_txccq" => array (", ", "FieldID" => "net_txccq", "FieldDefine" => "SYSLOG_NET_TXCCQ", "FieldCaption" => "TX CCQ", "FieldType" => 1, "FieldAlign" => "center", "SearchField" => "net_txccq", "DefaultWidth" => 50, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0), + "net_txrate" => array (", ", "FieldID" => "net_txrate", "FieldDefine" => "SYSLOG_NET_TXRATE", "FieldCaption" => "TX Rate", "FieldType" => 0, "FieldAlign" => "center", "SearchField" => "net_txrate", "DefaultWidth" => 65, "SearchOnline" => 0, "Trunscate" => 0, "Sortable" => 0) + ); + + // Constructor + public function MsgParser_wireless() { + +// TODO AUTOMATICALLY PERFORM FIELD INSERTS! + + return; // Nothing + } + + /** + * ParseLine + * + * @param arrArguments array in&out: properties of interest. There can be no guarantee the logstream can actually deliver them. + * @return integer Error stat + */ + public function ParseMsg($szMsg, &$arrArguments) + { + global $content, $fields; + + //trim the msg first to remove spaces from begin and end + $szMsg = trim($szMsg); +//return ERROR_MSG_NOMATCH; + + // Sample: script,info INICIO; Madrid-penalver ;wlan1 ;00:15:AF:9E:02:94 ;192.168.10.30 ;36Mbps ;24Mbps ;01:21:39 ;00:00:00.030 ;82dBm@1Mbps ;15 ;66 ;16852066,2147105 ;17288,12903 + if ( preg_match('/(.*?),(.*?) (.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.[0-9]{1,12}.);(.[0-9]{1,12}.);(.[0-9]{1,12}.),(.[0-9]{1,12}.);(.[0-9]{1,12}.),(.[0-9]{1,12}.)$/', $szMsg, $out ) ) + { + +//print_r ( $out ); +//exit; + + // Set generic properties + $arrArguments[SYSLOG_HOST] = $out[4]; +// $arrArguments[SYSLOG_DATE] = GetEventTime($out[4]); + + // Set wlan log specific properties! + $arrArguments[SYSLOG_NET_INTERFACE] = trim($out[5]); + $arrArguments[SYSLOG_NET_MAC_ADDRESS] = trim($out[6]); + $arrArguments[SYSLOG_NET_LASTIP] = trim($out[7]); + $arrArguments[SYSLOG_NET_RXRATE] = trim($out[8]); + $arrArguments[SYSLOG_NET_TXRATE] = trim($out[9]); + $arrArguments[SYSLOG_NET_UPTIME] = trim($out[10]); + $arrArguments[SYSLOG_NET_LASTACTIVITY] = trim($out[11]); + $arrArguments[SYSLOG_NET_SIGNALSTRENGTH] = trim($out[12]); + + // Number based fields + $arrArguments[SYSLOG_NET_SIGNALTONOISE] = $out[13]; + $arrArguments[SYSLOG_NET_TXCCQ] = $out[14]; + $arrArguments[SYSLOG_NET_BYTESRECIEVED] = $out[15]; + $arrArguments[SYSLOG_NET_BYTESSEND] = $out[16]; + $arrArguments[SYSLOG_NET_PACKETSRECIEVED] = $out[17]; + $arrArguments[SYSLOG_NET_PACKETSSEND] = $out[18]; + + // Set msg to whole logline + $arrArguments[SYSLOG_MESSAGE] = $out[0]; + + if ( $this->_MsgNormalize == 1 ) + { + //Init tmp msg + $szTmpMsg = ""; + + // Create Field Array to prepend into msg! Reverse Order here + $myFields = array( SYSLOG_NET_PACKETSSEND, SYSLOG_NET_PACKETSRECIEVED, SYSLOG_NET_BYTESSEND, SYSLOG_NET_BYTESRECIEVED, SYSLOG_NET_TXCCQ, SYSLOG_NET_SIGNALTONOISE, SYSLOG_NET_UPTIME, SYSLOG_NET_SIGNALSTRENGTH, SYSLOG_NET_LASTACTIVITY, SYSLOG_NET_TXRATE, SYSLOG_NET_RXRATE, SYSLOG_NET_LASTIP, SYSLOG_NET_MAC_ADDRESS, SYSLOG_NET_INTERFACE, SYSLOG_HOST ); + + foreach ( $myFields as $myField ) + { + // Set Field Caption + if ( isset($fields[$myField]['FieldCaption']) ) + $szFieldName = $fields[$myField]['FieldCaption']; + else + $szFieldName = $myField; + + // Append Field into msg + $szTmpMsg = $szFieldName . ": '" . $arrArguments[$myField] . "'\n" . $szTmpMsg; + } + + // copy finished MSG back! + $arrArguments[SYSLOG_MESSAGE] = $szTmpMsg; + } + } + else + { + // return no match in this case! + return ERROR_MSG_NOMATCH; + } + + // Set IUT Property if success! + $arrArguments[SYSLOG_MESSAGETYPE] = IUT_Syslog; + + // If we reached this position, return success! + return SUCCESS; + } +} + +?> \ No newline at end of file diff --git a/src/details.php b/src/details.php index aca7f12..93a9842 100644 --- a/src/details.php +++ b/src/details.php @@ -110,7 +110,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['uid_current' foreach($fields as $mycolkey => $myfield) { $content['fields'][$mycolkey]['FieldID'] = $mycolkey; - $content['fields'][$mycolkey]['FieldCaption'] = $content[ $myfield['FieldCaptionID'] ]; + $content['fields'][$mycolkey]['FieldCaption'] = $myfield['FieldCaption']; $content['fields'][$mycolkey]['FieldType'] = $myfield['FieldType']; $content['fields'][$mycolkey]['DefaultWidth'] = $myfield['DefaultWidth']; diff --git a/src/export.php b/src/export.php index 452fcd3..2c43404 100644 --- a/src/export.php +++ b/src/export.php @@ -146,7 +146,7 @@ if ( !$content['error_occured'] ) if ( isset($fields[$mycolkey]) ) { $content['fields'][$mycolkey]['FieldID'] = $mycolkey; - $content['fields'][$mycolkey]['FieldCaption'] = $content[ $fields[$mycolkey]['FieldCaptionID'] ]; + $content['fields'][$mycolkey]['FieldCaption'] = $fields[$mycolkey]['FieldCaption']; $content['fields'][$mycolkey]['FieldType'] = $fields[$mycolkey]['FieldType']; $content['fields'][$mycolkey]['DefaultWidth'] = $fields[$mycolkey]['DefaultWidth']; } @@ -344,7 +344,7 @@ else $szOutputContent .= ","; // Append column name - $szOutputContent .= $content[ $fields[$mycolkey]['FieldCaptionID'] ]; + $szOutputContent .= $fields[$mycolkey]['FieldCaption']; } } @@ -392,11 +392,6 @@ else // --- Process columns foreach($mySyslogMessage as $myColkey => $mySyslogField) { - -// if ( isset($content[ $fields[$mycolkey]['FieldCaptionID'] ]) ) -// $szNodeTitle = $content[ $fields[$mycolkey]['FieldCaptionID'] ]; -// else - // Append field content | first run htmlentities,tnen utf8 encoding!! $szXmlLine .= "\t\t<" . $myColkey . ">" . utf8_encode( htmlentities($mySyslogField['fieldvalue']) ) . "\n"; } diff --git a/src/images/icons/data_delete.png b/src/images/icons/data_delete.png new file mode 100644 index 0000000..800d48c Binary files /dev/null and b/src/images/icons/data_delete.png differ diff --git a/src/images/icons/data_delete_disabled.png b/src/images/icons/data_delete_disabled.png new file mode 100644 index 0000000..81b81a7 Binary files /dev/null and b/src/images/icons/data_delete_disabled.png differ diff --git a/src/images/icons/gear_delete.png b/src/images/icons/gear_delete.png new file mode 100644 index 0000000..2a0f87e Binary files /dev/null and b/src/images/icons/gear_delete.png differ diff --git a/src/images/icons/gear_new.png b/src/images/icons/gear_new.png new file mode 100644 index 0000000..8935ae6 Binary files /dev/null and b/src/images/icons/gear_new.png differ diff --git a/src/images/icons/information2.png b/src/images/icons/information2.png new file mode 100644 index 0000000..2a26f1e Binary files /dev/null and b/src/images/icons/information2.png differ diff --git a/src/images/icons/tables.png b/src/images/icons/tables.png new file mode 100644 index 0000000..7466ac0 Binary files /dev/null and b/src/images/icons/tables.png differ diff --git a/src/include/constants_logstream.php b/src/include/constants_logstream.php index cd454ea..9b811b7 100644 --- a/src/include/constants_logstream.php +++ b/src/include/constants_logstream.php @@ -71,179 +71,231 @@ define('SYSLOG_WEBLOG_REFERER', 'http_referer'); define('SYSLOG_WEBLOG_USERAGENT', 'http_useragent'); // --- -// Defines which kind of field types we have +// Define possible FIELD Types define('FILTER_TYPE_STRING', 0); define('FILTER_TYPE_NUMBER', 1); define('FILTER_TYPE_DATE', 2); define('FILTER_TYPE_UNKNOWN', 99); +// Define possible alignments +define('ALIGN_CENTER', 'center'); +define('ALIGN_LEFT', 'left'); +define('ALIGN_RIGHT', 'right'); + // --- Predefine fields array! $fields[SYSLOG_UID]['FieldID'] = SYSLOG_UID; -$fields[SYSLOG_UID]['FieldCaptionID'] = 'LN_FIELDS_UID'; +$fields[SYSLOG_UID]['FieldDefine'] = 'SYSLOG_UID'; +$fields[SYSLOG_UID]['FieldCaption'] = 'uID'; $fields[SYSLOG_UID]['FieldType'] = FILTER_TYPE_NUMBER; $fields[SYSLOG_UID]['Sortable'] = false; $fields[SYSLOG_UID]['DefaultWidth'] = "50"; $fields[SYSLOG_UID]['FieldAlign'] = "center"; +$fields[SYSLOG_UID]['SearchOnline'] = false; $fields[SYSLOG_DATE]['FieldID'] = SYSLOG_DATE; -$fields[SYSLOG_DATE]['FieldCaptionID'] = 'LN_FIELDS_DATE'; +$fields[SYSLOG_DATE]['FieldDefine'] = 'SYSLOG_DATE'; +$fields[SYSLOG_DATE]['FieldCaption'] = 'Date'; $fields[SYSLOG_DATE]['FieldType'] = FILTER_TYPE_DATE; $fields[SYSLOG_DATE]['Sortable'] = true; $fields[SYSLOG_DATE]['DefaultWidth'] = "115"; $fields[SYSLOG_DATE]['FieldAlign'] = "center"; +$fields[SYSLOG_DATE]['SearchOnline'] = false; $fields[SYSLOG_HOST]['FieldID'] = SYSLOG_HOST; -$fields[SYSLOG_HOST]['FieldCaptionID'] = 'LN_FIELDS_HOST'; +$fields[SYSLOG_HOST]['FieldDefine'] = 'SYSLOG_HOST'; +$fields[SYSLOG_HOST]['FieldCaption'] = 'Host'; $fields[SYSLOG_HOST]['FieldType'] = FILTER_TYPE_STRING; $fields[SYSLOG_HOST]['Sortable'] = true; $fields[SYSLOG_HOST]['DefaultWidth'] = "80"; $fields[SYSLOG_HOST]['FieldAlign'] = "left"; $fields[SYSLOG_HOST]['SearchField'] = "source"; +$fields[SYSLOG_HOST]['SearchOnline'] = false; $fields[SYSLOG_MESSAGETYPE]['FieldID'] = SYSLOG_MESSAGETYPE; -$fields[SYSLOG_MESSAGETYPE]['FieldCaptionID'] = 'LN_FIELDS_MESSAGETYPE'; +$fields[SYSLOG_MESSAGETYPE]['FieldDefine'] = 'SYSLOG_MESSAGETYPE'; +$fields[SYSLOG_MESSAGETYPE]['FieldCaption'] = 'Messagetype'; $fields[SYSLOG_MESSAGETYPE]['FieldType'] = FILTER_TYPE_NUMBER; $fields[SYSLOG_MESSAGETYPE]['Sortable'] = true; $fields[SYSLOG_MESSAGETYPE]['DefaultWidth'] = "90"; $fields[SYSLOG_MESSAGETYPE]['FieldAlign'] = "center"; $fields[SYSLOG_MESSAGETYPE]['SearchField'] = "messagetype"; +$fields[SYSLOG_MESSAGETYPE]['SearchOnline'] = false; // Syslog specific $fields[SYSLOG_FACILITY]['FieldID'] = SYSLOG_FACILITY; -$fields[SYSLOG_FACILITY]['FieldCaptionID'] = 'LN_FIELDS_FACILITY'; +$fields[SYSLOG_FACILITY]['FieldDefine'] = 'SYSLOG_FACILITY'; +$fields[SYSLOG_FACILITY]['FieldCaption'] = 'Facility'; $fields[SYSLOG_FACILITY]['FieldType'] = FILTER_TYPE_NUMBER; $fields[SYSLOG_FACILITY]['Sortable'] = true; $fields[SYSLOG_FACILITY]['DefaultWidth'] = "50"; $fields[SYSLOG_FACILITY]['FieldAlign'] = "center"; $fields[SYSLOG_FACILITY]['SearchField'] = "facility"; +$fields[SYSLOG_FACILITY]['SearchOnline'] = true; $fields[SYSLOG_SEVERITY]['FieldID'] = SYSLOG_SEVERITY; -$fields[SYSLOG_SEVERITY]['FieldCaptionID'] = 'LN_FIELDS_SEVERITY'; +$fields[SYSLOG_SEVERITY]['FieldDefine'] = 'SYSLOG_SEVERITY'; +$fields[SYSLOG_SEVERITY]['FieldCaption'] = 'Severity'; $fields[SYSLOG_SEVERITY]['FieldType'] = FILTER_TYPE_NUMBER; $fields[SYSLOG_SEVERITY]['Sortable'] = true; $fields[SYSLOG_SEVERITY]['DefaultWidth'] = "50"; $fields[SYSLOG_SEVERITY]['FieldAlign'] = "center"; $fields[SYSLOG_SEVERITY]['SearchField'] = "severity"; +$fields[SYSLOG_SEVERITY]['SearchOnline'] = true; $fields[SYSLOG_SYSLOGTAG]['FieldID'] = SYSLOG_SYSLOGTAG; -$fields[SYSLOG_SYSLOGTAG]['FieldCaptionID'] = 'LN_FIELDS_SYSLOGTAG'; +$fields[SYSLOG_SYSLOGTAG]['FieldDefine'] = 'SYSLOG_SYSLOGTAG'; +$fields[SYSLOG_SYSLOGTAG]['FieldCaption'] = 'Syslogtag'; $fields[SYSLOG_SYSLOGTAG]['FieldType'] = FILTER_TYPE_STRING; $fields[SYSLOG_SYSLOGTAG]['Sortable'] = true; $fields[SYSLOG_SYSLOGTAG]['DefaultWidth'] = "85"; $fields[SYSLOG_SYSLOGTAG]['FieldAlign'] = "left"; $fields[SYSLOG_SYSLOGTAG]['SearchField'] = "syslogtag"; +$fields[SYSLOG_SYSLOGTAG]['SearchOnline'] = true; $fields[SYSLOG_PROCESSID]['FieldID'] = SYSLOG_PROCESSID; -$fields[SYSLOG_PROCESSID]['FieldCaptionID'] = 'LN_FIELDS_PROCESSID'; +$fields[SYSLOG_PROCESSID]['FieldDefine'] = 'SYSLOG_PROCESSID'; +$fields[SYSLOG_PROCESSID]['FieldCaption'] = 'ProcessID'; $fields[SYSLOG_PROCESSID]['FieldType'] = FILTER_TYPE_NUMBER; $fields[SYSLOG_PROCESSID]['Sortable'] = true; $fields[SYSLOG_PROCESSID]['DefaultWidth'] = "65"; $fields[SYSLOG_PROCESSID]['FieldAlign'] = "center"; $fields[SYSLOG_PROCESSID]['SearchField'] = "processid"; +$fields[SYSLOG_PROCESSID]['SearchOnline'] = false; // EventLog specific $fields[SYSLOG_EVENT_ID]['FieldID'] = SYSLOG_EVENT_ID; -$fields[SYSLOG_EVENT_ID]['FieldCaptionID'] = 'LN_FIELDS_EVENTID'; +$fields[SYSLOG_EVENT_ID]['FieldDefine'] = 'SYSLOG_EVENT_ID'; +$fields[SYSLOG_EVENT_ID]['FieldCaption'] = 'Event ID'; $fields[SYSLOG_EVENT_ID]['FieldType'] = FILTER_TYPE_NUMBER; $fields[SYSLOG_EVENT_ID]['Sortable'] = true; $fields[SYSLOG_EVENT_ID]['DefaultWidth'] = "65"; $fields[SYSLOG_EVENT_ID]['FieldAlign'] = "center"; $fields[SYSLOG_EVENT_ID]['SearchField'] = "eventid"; +$fields[SYSLOG_EVENT_ID]['SearchOnline'] = true; $fields[SYSLOG_EVENT_LOGTYPE]['FieldID'] = SYSLOG_EVENT_LOGTYPE; -$fields[SYSLOG_EVENT_LOGTYPE]['FieldCaptionID'] = 'LN_FIELDS_EVENTLOGTYPE'; +$fields[SYSLOG_EVENT_LOGTYPE]['FieldDefine'] = 'SYSLOG_EVENT_LOGTYPE'; +$fields[SYSLOG_EVENT_LOGTYPE]['FieldCaption'] = 'Eventlog Type'; $fields[SYSLOG_EVENT_LOGTYPE]['FieldType'] = FILTER_TYPE_STRING; $fields[SYSLOG_EVENT_LOGTYPE]['Sortable'] = true; $fields[SYSLOG_EVENT_LOGTYPE]['DefaultWidth'] = "100"; $fields[SYSLOG_EVENT_LOGTYPE]['FieldAlign'] = "left"; $fields[SYSLOG_EVENT_LOGTYPE]['SearchField'] = "eventlogtype"; +$fields[SYSLOG_EVENT_LOGTYPE]['SearchOnline'] = true; $fields[SYSLOG_EVENT_SOURCE]['FieldID'] = SYSLOG_EVENT_SOURCE; -$fields[SYSLOG_EVENT_SOURCE]['FieldCaptionID'] = 'LN_FIELDS_EVENTSOURCE'; +$fields[SYSLOG_EVENT_SOURCE]['FieldDefine'] = 'SYSLOG_EVENT_SOURCE'; +$fields[SYSLOG_EVENT_SOURCE]['FieldCaption'] = 'Event Source'; $fields[SYSLOG_EVENT_SOURCE]['FieldType'] = FILTER_TYPE_STRING; $fields[SYSLOG_EVENT_SOURCE]['Sortable'] = true; $fields[SYSLOG_EVENT_SOURCE]['DefaultWidth'] = "100"; $fields[SYSLOG_EVENT_SOURCE]['FieldAlign'] = "left"; $fields[SYSLOG_EVENT_SOURCE]['SearchField'] = "eventlogsource"; +$fields[SYSLOG_EVENT_SOURCE]['SearchOnline'] = true; $fields[SYSLOG_EVENT_CATEGORY]['FieldID'] = SYSLOG_EVENT_CATEGORY; -$fields[SYSLOG_EVENT_CATEGORY]['FieldCaptionID'] = 'LN_FIELDS_EVENTCATEGORY'; +$fields[SYSLOG_EVENT_CATEGORY]['FieldDefine'] = 'SYSLOG_EVENT_CATEGORY'; +$fields[SYSLOG_EVENT_CATEGORY]['FieldCaption'] = 'Event Category'; $fields[SYSLOG_EVENT_CATEGORY]['FieldType'] = FILTER_TYPE_NUMBER; $fields[SYSLOG_EVENT_CATEGORY]['Sortable'] = true; $fields[SYSLOG_EVENT_CATEGORY]['DefaultWidth'] = "50"; $fields[SYSLOG_EVENT_CATEGORY]['FieldAlign'] = "center"; $fields[SYSLOG_EVENT_CATEGORY]['SearchField'] = "eventcategory"; +$fields[SYSLOG_EVENT_CATEGORY]['SearchOnline'] = false; $fields[SYSLOG_EVENT_USER]['FieldID'] = SYSLOG_EVENT_USER; -$fields[SYSLOG_EVENT_USER]['FieldCaptionID'] = 'LN_FIELDS_EVENTUSER'; +$fields[SYSLOG_EVENT_USER]['FieldDefine'] = 'SYSLOG_EVENT_USER'; +$fields[SYSLOG_EVENT_USER]['FieldCaption'] = 'Event User'; $fields[SYSLOG_EVENT_USER]['FieldType'] = FILTER_TYPE_STRING; $fields[SYSLOG_EVENT_USER]['Sortable'] = true; $fields[SYSLOG_EVENT_USER]['DefaultWidth'] = "85"; $fields[SYSLOG_EVENT_USER]['FieldAlign'] = "left"; $fields[SYSLOG_EVENT_USER]['SearchField'] = "eventuser"; +$fields[SYSLOG_EVENT_USER]['SearchOnline'] = false; // Weblogfile specific $fields[SYSLOG_WEBLOG_USER]['FieldID'] = SYSLOG_WEBLOG_USER; -$fields[SYSLOG_WEBLOG_USER]['FieldCaptionID'] = 'LN_FIELDS_WEBLOG_USER'; +$fields[SYSLOG_WEBLOG_USER]['FieldDefine'] = 'SYSLOG_WEBLOG_USER'; +$fields[SYSLOG_WEBLOG_USER]['FieldCaption'] = 'HTTP User'; $fields[SYSLOG_WEBLOG_USER]['FieldType'] = FILTER_TYPE_STRING; $fields[SYSLOG_WEBLOG_USER]['Sortable'] = false; $fields[SYSLOG_WEBLOG_USER]['DefaultWidth'] = "75"; $fields[SYSLOG_WEBLOG_USER]['FieldAlign'] = "left"; $fields[SYSLOG_WEBLOG_USER]['SearchField'] = SYSLOG_WEBLOG_USER; +$fields[SYSLOG_WEBLOG_USER]['SearchOnline'] = false; $fields[SYSLOG_WEBLOG_METHOD]['FieldID'] = SYSLOG_WEBLOG_METHOD; -$fields[SYSLOG_WEBLOG_METHOD]['FieldCaptionID'] = 'LN_FIELDS_WEBLOG_METHOD'; +$fields[SYSLOG_WEBLOG_METHOD]['FieldDefine'] = 'SYSLOG_WEBLOG_METHOD'; +$fields[SYSLOG_WEBLOG_METHOD]['FieldCaption'] = 'Method'; $fields[SYSLOG_WEBLOG_METHOD]['FieldType'] = FILTER_TYPE_STRING; $fields[SYSLOG_WEBLOG_METHOD]['Sortable'] = false; $fields[SYSLOG_WEBLOG_METHOD]['DefaultWidth'] = "50"; $fields[SYSLOG_WEBLOG_METHOD]['FieldAlign'] = "center"; $fields[SYSLOG_WEBLOG_METHOD]['SearchField'] = SYSLOG_WEBLOG_METHOD; +$fields[SYSLOG_WEBLOG_METHOD]['SearchOnline'] = false; $fields[SYSLOG_WEBLOG_URL]['FieldID'] = SYSLOG_WEBLOG_URL; -$fields[SYSLOG_WEBLOG_URL]['FieldCaptionID'] = 'LN_FIELDS_WEBLOG_URL'; +$fields[SYSLOG_WEBLOG_URL]['FieldDefine'] = 'SYSLOG_WEBLOG_URL'; +$fields[SYSLOG_WEBLOG_URL]['FieldCaption'] = 'URL'; $fields[SYSLOG_WEBLOG_URL]['FieldType'] = FILTER_TYPE_STRING; $fields[SYSLOG_WEBLOG_URL]['Sortable'] = false; $fields[SYSLOG_WEBLOG_URL]['DefaultWidth'] = "200"; $fields[SYSLOG_WEBLOG_URL]['FieldAlign'] = "left"; $fields[SYSLOG_WEBLOG_URL]['SearchField'] = SYSLOG_WEBLOG_URL; +$fields[SYSLOG_WEBLOG_URL]['SearchOnline'] = false; $fields[SYSLOG_WEBLOG_QUERYSTRING]['FieldID'] = SYSLOG_WEBLOG_QUERYSTRING; -$fields[SYSLOG_WEBLOG_QUERYSTRING]['FieldCaptionID'] = 'LN_FIELDS_WEBLOG_QUERYSTRING'; +$fields[SYSLOG_WEBLOG_QUERYSTRING]['FieldDefine'] = 'SYSLOG_WEBLOG_QUERYSTRING'; +$fields[SYSLOG_WEBLOG_QUERYSTRING]['FieldCaption'] = 'Querystring'; $fields[SYSLOG_WEBLOG_QUERYSTRING]['FieldType'] = FILTER_TYPE_STRING; $fields[SYSLOG_WEBLOG_QUERYSTRING]['Sortable'] = false; $fields[SYSLOG_WEBLOG_QUERYSTRING]['DefaultWidth'] = "200"; $fields[SYSLOG_WEBLOG_QUERYSTRING]['FieldAlign'] = "left"; $fields[SYSLOG_WEBLOG_QUERYSTRING]['SearchField'] = SYSLOG_WEBLOG_QUERYSTRING; +$fields[SYSLOG_WEBLOG_QUERYSTRING]['SearchOnline'] = false; $fields[SYSLOG_WEBLOG_PVER]['FieldID'] = SYSLOG_WEBLOG_PVER; -$fields[SYSLOG_WEBLOG_PVER]['FieldCaptionID'] = 'LN_FIELDS_WEBLOG_PVER'; +$fields[SYSLOG_WEBLOG_PVER]['FieldDefine'] = 'SYSLOG_WEBLOG_PVER'; +$fields[SYSLOG_WEBLOG_PVER]['FieldCaption'] = 'Version'; $fields[SYSLOG_WEBLOG_PVER]['FieldType'] = FILTER_TYPE_STRING; $fields[SYSLOG_WEBLOG_PVER]['Sortable'] = false; $fields[SYSLOG_WEBLOG_PVER]['DefaultWidth'] = "50"; $fields[SYSLOG_WEBLOG_PVER]['FieldAlign'] = "center"; $fields[SYSLOG_WEBLOG_PVER]['SearchField'] = SYSLOG_WEBLOG_PVER; +$fields[SYSLOG_WEBLOG_PVER]['SearchOnline'] = false; $fields[SYSLOG_WEBLOG_STATUS]['FieldID'] = SYSLOG_WEBLOG_STATUS; -$fields[SYSLOG_WEBLOG_STATUS]['FieldCaptionID'] = 'LN_FIELDS_WEBLOG_STATUS'; +$fields[SYSLOG_WEBLOG_STATUS]['FieldDefine'] = 'SYSLOG_WEBLOG_STATUS'; +$fields[SYSLOG_WEBLOG_STATUS]['FieldCaption'] = 'Status'; $fields[SYSLOG_WEBLOG_STATUS]['FieldType'] = FILTER_TYPE_NUMBER; $fields[SYSLOG_WEBLOG_STATUS]['Sortable'] = false; $fields[SYSLOG_WEBLOG_STATUS]['DefaultWidth'] = "50"; $fields[SYSLOG_WEBLOG_STATUS]['FieldAlign'] = "center"; $fields[SYSLOG_WEBLOG_STATUS]['SearchField'] = SYSLOG_WEBLOG_STATUS; +$fields[SYSLOG_WEBLOG_STATUS]['SearchOnline'] = false; $fields[SYSLOG_WEBLOG_BYTESSEND]['FieldID'] = SYSLOG_WEBLOG_BYTESSEND; -$fields[SYSLOG_WEBLOG_BYTESSEND]['FieldCaptionID'] = 'LN_FIELDS_WEBLOG_BYTESSEND'; +$fields[SYSLOG_WEBLOG_BYTESSEND]['FieldDefine'] = 'SYSLOG_WEBLOG_BYTESSEND'; +$fields[SYSLOG_WEBLOG_BYTESSEND]['FieldCaption'] = 'Bytes Send'; $fields[SYSLOG_WEBLOG_BYTESSEND]['FieldType'] = FILTER_TYPE_NUMBER; $fields[SYSLOG_WEBLOG_BYTESSEND]['Sortable'] = false; $fields[SYSLOG_WEBLOG_BYTESSEND]['DefaultWidth'] = "75"; $fields[SYSLOG_WEBLOG_BYTESSEND]['FieldAlign'] = "left"; $fields[SYSLOG_WEBLOG_BYTESSEND]['SearchField'] = SYSLOG_WEBLOG_BYTESSEND; +$fields[SYSLOG_WEBLOG_BYTESSEND]['SearchOnline'] = false; $fields[SYSLOG_WEBLOG_REFERER]['FieldID'] = SYSLOG_WEBLOG_REFERER; -$fields[SYSLOG_WEBLOG_REFERER]['FieldCaptionID'] = 'LN_FIELDS_WEBLOG_REFERER'; +$fields[SYSLOG_WEBLOG_REFERER]['FieldDefine'] = 'SYSLOG_WEBLOG_REFERER'; +$fields[SYSLOG_WEBLOG_REFERER]['FieldCaption'] = 'Referer'; $fields[SYSLOG_WEBLOG_REFERER]['FieldType'] = FILTER_TYPE_STRING; $fields[SYSLOG_WEBLOG_REFERER]['Sortable'] = false; $fields[SYSLOG_WEBLOG_REFERER]['DefaultWidth'] = "200"; $fields[SYSLOG_WEBLOG_REFERER]['FieldAlign'] = "left"; $fields[SYSLOG_WEBLOG_REFERER]['SearchField'] = SYSLOG_WEBLOG_REFERER; +$fields[SYSLOG_WEBLOG_REFERER]['SearchOnline'] = true; $fields[SYSLOG_WEBLOG_USERAGENT]['FieldID'] = SYSLOG_WEBLOG_USERAGENT; -$fields[SYSLOG_WEBLOG_USERAGENT]['FieldCaptionID'] = 'LN_FIELDS_WEBLOG_USERAGENT'; +$fields[SYSLOG_WEBLOG_USERAGENT]['FieldDefine'] = 'SYSLOG_WEBLOG_USERAGENT'; +$fields[SYSLOG_WEBLOG_USERAGENT]['FieldCaption'] = 'User Agent'; $fields[SYSLOG_WEBLOG_USERAGENT]['FieldType'] = FILTER_TYPE_STRING; $fields[SYSLOG_WEBLOG_USERAGENT]['Sortable'] = false; $fields[SYSLOG_WEBLOG_USERAGENT]['DefaultWidth'] = "100"; $fields[SYSLOG_WEBLOG_USERAGENT]['FieldAlign'] = "left"; $fields[SYSLOG_WEBLOG_USERAGENT]['SearchField'] = SYSLOG_WEBLOG_USERAGENT; +$fields[SYSLOG_WEBLOG_USERAGENT]['SearchOnline'] = true; // Message is the last element, this order is important for the Detail page for now! $fields[SYSLOG_MESSAGE]['FieldID'] = SYSLOG_MESSAGE; -$fields[SYSLOG_MESSAGE]['FieldCaptionID'] = 'LN_FIELDS_MESSAGE'; +$fields[SYSLOG_MESSAGE]['FieldDefine'] = 'SYSLOG_MESSAGE'; +$fields[SYSLOG_MESSAGE]['FieldCaption'] = 'Message'; $fields[SYSLOG_MESSAGE]['FieldType'] = FILTER_TYPE_STRING; $fields[SYSLOG_MESSAGE]['Sortable'] = false; $fields[SYSLOG_MESSAGE]['DefaultWidth'] = "100%"; $fields[SYSLOG_MESSAGE]['FieldAlign'] = "left"; +$fields[SYSLOG_MESSAGE]['SearchField'] = ""; +$fields[SYSLOG_MESSAGE]['SearchOnline'] = false; // --- // --- Define default Database field mappings! diff --git a/src/include/db_template.txt b/src/include/db_template.txt index 3ee65e6..490e4ea 100644 --- a/src/include/db_template.txt +++ b/src/include/db_template.txt @@ -115,6 +115,7 @@ CREATE TABLE IF NOT EXISTS `logcon_views` ( -- Table structure for table `logcon_charts` -- +DROP TABLE IF EXISTS `logcon_charts`; CREATE TABLE IF NOT EXISTS `logcon_charts` ( `ID` int(11) NOT NULL auto_increment, `DisplayName` varchar(255) NOT NULL, @@ -129,3 +130,21 @@ CREATE TABLE IF NOT EXISTS `logcon_charts` ( PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='This table contains all configured charts' AUTO_INCREMENT=1 ; +-- +-- Table structure for table `logcon_fields` +-- + +DROP TABLE IF EXISTS `logcon_fields`; +CREATE TABLE `logcon_fields` ( + `FieldID` varchar(64) NOT NULL, + `FieldDefine` varchar(64) NOT NULL, + `FieldCaption` varchar(255) NOT NULL, + `FieldType` int(11) NOT NULL, + `Sortable` tinyint(1) NOT NULL, + `DefaultWidth` int(11) NOT NULL, + `FieldAlign` varchar(32) NOT NULL, + `SearchField` varchar(64) NOT NULL, + `SearchOnline` tinyint(1) NOT NULL, + `Trunscate` int(11) NOT NULL, + PRIMARY KEY (`FieldID`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='This table stores custom fields'; diff --git a/src/include/db_update_v5.txt b/src/include/db_update_v5.txt new file mode 100644 index 0000000..7416415 --- /dev/null +++ b/src/include/db_update_v5.txt @@ -0,0 +1,19 @@ +-- New Database Structure Updates + +CREATE TABLE `logcon_fields` ( + `FieldID` varchar(64) NOT NULL, + `FieldDefine` varchar(64) NOT NULL, + `FieldCaption` varchar(255) NOT NULL, + `FieldType` int(11) NOT NULL, + `Sortable` tinyint(1) NOT NULL, + `DefaultWidth` int(11) NOT NULL, + `FieldAlign` varchar(32) NOT NULL, + `SearchField` varchar(64) NOT NULL, + `SearchOnline` tinyint(1) NOT NULL, + `Trunscate` int(11) NOT NULL, + PRIMARY KEY (`FieldID`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='This table stores custom fields'; + +-- Insert data + +-- Updated Data diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 14838e5..056b73a 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -235,6 +235,46 @@ function CreateSourceTypesList( $selectedSource ) if ( $selectedSource == $content['SOURCETYPES'][SOURCE_PDO]['type'] ) { $content['SOURCETYPES'][SOURCE_PDO]['selected'] = "selected"; } else { $content['SOURCETYPES'][SOURCE_PDO]['selected'] = ""; } } +function CreateFieldAlignmentList( $selectedAlignment ) +{ + global $content; + + // ALIGN_CENTER + $content['ALIGMENTS'][ALIGN_CENTER]['type'] = ALIGN_CENTER; + $content['ALIGMENTS'][ALIGN_CENTER]['DisplayName'] = $content['LN_ALIGN_CENTER']; + if ( $selectedAlignment == $content['ALIGMENTS'][ALIGN_CENTER]['type'] ) { $content['ALIGMENTS'][ALIGN_CENTER]['selected'] = "selected"; } else { $content['ALIGMENTS'][ALIGN_CENTER]['selected'] = ""; } + + // ALIGN_LEFT + $content['ALIGMENTS'][ALIGN_LEFT]['type'] = ALIGN_LEFT; + $content['ALIGMENTS'][ALIGN_LEFT]['DisplayName'] = $content['LN_ALIGN_LEFT']; + if ( $selectedAlignment == $content['ALIGMENTS'][ALIGN_LEFT]['type'] ) { $content['ALIGMENTS'][ALIGN_LEFT]['selected'] = "selected"; } else { $content['ALIGMENTS'][ALIGN_LEFT]['selected'] = ""; } + + // ALIGN_RIGHT + $content['ALIGMENTS'][ALIGN_RIGHT]['type'] = ALIGN_RIGHT; + $content['ALIGMENTS'][ALIGN_RIGHT]['DisplayName'] = $content['LN_ALIGN_RIGHT']; + if ( $selectedAlignment == $content['ALIGMENTS'][ALIGN_RIGHT]['type'] ) { $content['ALIGMENTS'][ALIGN_RIGHT]['selected'] = "selected"; } else { $content['ALIGMENTS'][ALIGN_RIGHT]['selected'] = ""; } +} + +function CreateFieldTypesList( $selectedType ) +{ + global $content; + + // FILTER_TYPE_STRING + $content['FILTERTYPES'][FILTER_TYPE_STRING]['type'] = FILTER_TYPE_STRING; + $content['FILTERTYPES'][FILTER_TYPE_STRING]['DisplayName'] = $content['LN_FILTER_TYPE_STRING']; + if ( $selectedType == $content['FILTERTYPES'][FILTER_TYPE_STRING]['type'] ) { $content['FILTERTYPES'][FILTER_TYPE_STRING]['selected'] = "selected"; } else { $content['FILTERTYPES'][FILTER_TYPE_STRING]['selected'] = ""; } + + // FILTER_TYPE_NUMBER + $content['FILTERTYPES'][FILTER_TYPE_NUMBER]['type'] = FILTER_TYPE_NUMBER; + $content['FILTERTYPES'][FILTER_TYPE_NUMBER]['DisplayName'] = $content['LN_FILTER_TYPE_NUMBER']; + if ( $selectedType == $content['FILTERTYPES'][FILTER_TYPE_NUMBER]['type'] ) { $content['FILTERTYPES'][FILTER_TYPE_NUMBER]['selected'] = "selected"; } else { $content['FILTERTYPES'][FILTER_TYPE_NUMBER]['selected'] = ""; } + + // FILTER_TYPE_DATE + $content['FILTERTYPES'][FILTER_TYPE_DATE]['type'] = FILTER_TYPE_DATE; + $content['FILTERTYPES'][FILTER_TYPE_DATE]['DisplayName'] = $content['LN_FILTER_TYPE_DATE']; + if ( $selectedType == $content['FILTERTYPES'][FILTER_TYPE_DATE]['type'] ) { $content['FILTERTYPES'][FILTER_TYPE_DATE]['selected'] = "selected"; } else { $content['FILTERTYPES'][FILTER_TYPE_DATE]['selected'] = ""; } +} + function CreateChartTypesList( $selectedChart ) { global $content; @@ -266,8 +306,8 @@ function CreateChartFields( $selectedChartField) // Add new entry to array $content['CHARTFIELDS'][$myFieldID]['ID'] = $myFieldID; - if ( isset($content[ $myField['FieldCaptionID'] ]) ) - $content['CHARTFIELDS'][$myFieldID]['DisplayName'] = $content[ $myField['FieldCaptionID'] ]; + if ( isset($myField['FieldCaption']) ) + $content['CHARTFIELDS'][$myFieldID]['DisplayName'] = $myField['FieldCaption']; else $content['CHARTFIELDS'][$myFieldID]['DisplayName'] = $myFieldID; @@ -578,6 +618,12 @@ function InitFrontEndVariables() $content['MENU_CHART_BARSVERT'] = $content['BASEPATH'] . "images/icons/column-chart.png"; $content['MENU_CHART_BARSHORI'] = $content['BASEPATH'] . "images/icons/column-chart-hori.png"; $content['MENU_CHART_PREVIEW'] = $content['BASEPATH'] . "images/icons/pie-chart_view.png"; + $content['MENU_FIELDS'] = $content['BASEPATH'] . "images/icons/tables.png"; + $content['MENU_DELETE_FROMDB'] = $content['BASEPATH'] . "images/icons/data_delete.png"; + $content['MENU_DELETE_FROMDB_DISABLED'] = $content['BASEPATH'] . "images/icons/data_delete_disabled.png"; + $content['MENU_INFORMATION'] = $content['BASEPATH'] . "images/icons/information2.png"; + $content['MENU_PARSER_DELETE'] = $content['BASEPATH'] . "images/icons/gear_delete.png"; + $content['MENU_PARSER_INIT'] = $content['BASEPATH'] . "images/icons/gear_new.png"; $content['MENU_PAGER_BEGIN'] = $content['BASEPATH'] . "images/icons/media_beginning.png"; $content['MENU_PAGER_PREVIOUS'] = $content['BASEPATH'] . "images/icons/media_rewind.png"; @@ -674,6 +720,9 @@ function InitConfigurationValues() } } + // Load field definitions from DB, very first thing todo! + LoadFieldsFromDatabase(); + // Load Configured Searches LoadSearchesFromDatabase(); @@ -1360,6 +1409,74 @@ function GetConfigSetting($szSettingName, $szDefaultValue = "", $DesiredConfigLe return $szDefaultValue; } +/* +* Helper function to get all directory from a folder +*/ +function list_directories($directory, $failOnError = true) +{ + $result = array(); + if ( !$directoryHandler = @opendir ($directory) ) + { + if ( $failOnError ) + DieWithFriendlyErrorMsg( "list_directories: directory \"$directory\" doesn't exist!"); + else + return null; + } + + while (false !== ($fileName = @readdir ($directoryHandler))) + { + if ( is_dir( $directory . $fileName ) && ( $fileName != "." && $fileName != ".." )) + @array_push ($result, $fileName); + } + + if ( @count ($result) === 0 ) + { + if ( $failOnError ) + DieWithFriendlyErrorMsg( "list_directories: no directories in \"$directory\" found!"); + else + return null; + } + else + { + sort ($result); + return $result; + } +} + +/* +* Helper function to get all files from a directory +*/ +function list_files($directory, $failOnError = true) +{ + $result = array(); + if ( !$directoryHandler = @opendir ($directory) ) + { + if ( $failOnError ) + DieWithFriendlyErrorMsg( "list_directories: directory \"$directory\" doesn't exist!"); + else + return null; + } + + while (false !== ($fileName = @readdir ($directoryHandler))) + { + if ( is_file( $directory . $fileName ) && ( $fileName != "." && $fileName != ".." )) + @array_push ($result, $fileName); + } + + if ( @count ($result) === 0 ) + { + if ( $failOnError ) + DieWithFriendlyErrorMsg( "list_directories: no files in \"$directory\" found!"); + else + return null; + } + else + { + sort ($result); + return $result; + } +} + /* * Helper function to get the errorCode */ diff --git a/src/include/functions_config.php b/src/include/functions_config.php index 22bdcb8..4c74d6c 100644 --- a/src/include/functions_config.php +++ b/src/include/functions_config.php @@ -196,6 +196,84 @@ function InitSource(&$mysource) } } + +/* +* This function reads and generates a list of available message parsers +*/ +function InitMessageParsers() +{ + global $content, $gl_root_path; + + $szDirectory = $gl_root_path . 'classes/msgparsers/'; // msgparser.' . $szParser . '.class.php'; + $aFiles = list_files($szDirectory, true); + if ( isset($aFiles) && count($aFiles) > 0 ) + { + foreach( $aFiles as $myFile ) + { + // Check if file is valid msg parser! + if ( preg_match("/msgparser\.(.*?)\.class\.php$/", $myFile, $out ) ) + { + // Set ParserID! + $myParserID = $out[1]; + + // Check if parser file include exists + $szIncludeFile = $szDirectory . $myFile; + if ( file_exists($szIncludeFile) ) + { + // Try to include + if ( @include_once($szIncludeFile) ) + { + // Set ParserClassName + $szParserClass = "MsgParser_" . $myParserID; +/// echo $szParserClass . "
"; + + // Create Instance and get properties + $tmpParser = new $szParserClass(); // Create an instance + $szParserName = $tmpParser->_ClassName; + $szParserDescription = $tmpParser->_ClassDescription; + $szParserHelpArticle = $tmpParser->_ClassHelpArticle; + + + // check for required fields! + if ( $tmpParser->_ClassRequiredFields != null && count($tmpParser->_ClassRequiredFields) > 0 ) + { + $bCustomFields = true; + $aCustomFieldList = $tmpParser->_ClassRequiredFields; +// print_r ( $aCustomFieldList ); + } + else + { + $bCustomFields = false; + $aCustomFieldList = null; + } + + // Add entry to msg parser list! + $content['PARSERS'][$myParserID] = array ( + "ID" => $myParserID, + "DisplayName" => $szParserName, + "Description" => $szParserDescription, + "CustomFields" => $bCustomFields, + "CustomFieldsList" => $aCustomFieldList, + "ParserHelpArticle" => $szParserHelpArticle, + ); + } + else + { + // DEBUG ERROR + } + } + else + { + // DEBUG ERROR + } + } + } + } +} + +/* +* Init Source configs +*/ function InitSourceConfigs() { global $CFG, $content, $currentSourceID; @@ -334,6 +412,7 @@ function InitPhpLogConConfigFile($bHandleMissing = true) define('DB_CONFIG', $tblPref . "config"); define('DB_GROUPS', $tblPref . "groups"); define('DB_GROUPMEMBERS', $tblPref . "groupmembers"); + define('DB_FIELDS', $tblPref . "fields"); define('DB_SEARCHES', $tblPref . "searches"); define('DB_SOURCES', $tblPref . "sources"); define('DB_USERS', $tblPref . "users"); @@ -372,6 +451,91 @@ function InitPhpLogConConfigFile($bHandleMissing = true) } } +/* +* Helper function to load configured fields from the database +*/ +function LoadFieldsFromDatabase() +{ + // Needed to make global + global $fields, $content; + + // Abort reading fields if the database version is below version 5!, because prior v5, there were no fields table + if ( $content['database_installedversion'] < 5 ) + return; + + // --- Preprocess fields in loop + foreach ($fields as &$myField ) + { + // Set Field to be internal! + $myField['IsInternalField'] = true; + $myField['FieldFromDB'] = false; + + // Set some other defaults! + if ( !isset($myField['Trunscate']) ) + $myField['Trunscate'] = 30; + if ( !isset($myField['SearchOnline']) ) + $myField['SearchOnline'] = false; + if ( !isset($myField['SearchField']) ) + $myField['SearchField'] = $myField['FieldID']; + + } + // --- + + // --- Create SQL Query + $sqlquery = " SELECT " . + DB_FIELDS . ".FieldID, " . + DB_FIELDS . ".FieldDefine, " . + DB_FIELDS . ".FieldCaption, " . + DB_FIELDS . ".FieldType, " . + DB_FIELDS . ".FieldAlign, " . + DB_FIELDS . ".SearchField, " . + DB_FIELDS . ".DefaultWidth, " . + DB_FIELDS . ".SearchOnline, " . + DB_FIELDS . ".Trunscate, " . + DB_FIELDS . ".Sortable " . + " FROM " . DB_FIELDS . + " ORDER BY " . DB_FIELDS . ".FieldCaption"; + // --- + + // Get Searches from DB now! + $result = DB_Query($sqlquery); + $myrows = DB_GetAllRows($result, true); + if ( isset($myrows ) && count($myrows) > 0 ) + { + // Loop through all data rows + foreach ($myrows as &$myField ) + { + // Read and Set from db! + $fieldId = $myField['FieldID']; + $fieldDefine = $myField['FieldDefine']; + + // Set define needed in certain code places! + if ( !defined($fieldDefine) ) + { + define($fieldDefine, $fieldId); + $fields[$fieldId]['IsInternalField'] = false; + } + + // Copy values + $fields[$fieldId]['FieldID'] = $myField['FieldID']; + $fields[$fieldId]['FieldDefine'] = $myField['FieldDefine']; + $fields[$fieldId]['FieldCaption'] = $myField['FieldCaption']; + $fields[$fieldId]['FieldType'] = $myField['FieldType']; + $fields[$fieldId]['FieldAlign'] = $myField['FieldAlign']; + $fields[$fieldId]['SearchField'] = $myField['SearchField']; + $fields[$fieldId]['DefaultWidth'] = $myField['DefaultWidth']; + $fields[$fieldId]['SearchOnline'] = $myField['SearchOnline']; + $fields[$fieldId]['Trunscate'] = $myField['Trunscate']; + $fields[$fieldId]['Sortable'] = $myField['Sortable']; + + // Set FromDB to true + $fields[$fieldId]['FieldFromDB'] = true; + } + +// print_r ( $fields ); + } +} + /* * Helper function to load configured Searches from the database */ diff --git a/src/include/functions_db.php b/src/include/functions_db.php index 5f167d9..52a981c 100644 --- a/src/include/functions_db.php +++ b/src/include/functions_db.php @@ -45,7 +45,7 @@ $errdesc = ""; $errno = 0; // --- Current Database Version, this is important for automated database Updates! -$content['database_internalversion'] = "4"; // Whenever incremented, a database upgrade is needed +$content['database_internalversion'] = "5"; // Whenever incremented, a database upgrade is needed $content['database_installedversion'] = "0"; // 0 is default which means Prior Versioning Database // --- diff --git a/src/include/functions_themes.php b/src/include/functions_themes.php index c87a107..998be99 100644 --- a/src/include/functions_themes.php +++ b/src/include/functions_themes.php @@ -93,27 +93,6 @@ function CreateThemesList() } } -function list_directories($directory) -{ - $result = array(); - if (! $directoryHandler = @opendir ($directory)) - DieWithFriendlyErrorMsg( "list_directories: directory \"$directory\" doesn't exist!"); - - while (false !== ($fileName = @readdir ($directoryHandler))) - { - if ( is_dir( $directory . $fileName ) && ( $fileName != "." && $fileName != ".." )) - @array_push ($result, $fileName); - } - - if ( @count ($result) === 0 ) - DieWithFriendlyErrorMsg( "list_directories: no directories in \"$directory\" found!"); - else - { - sort ($result); - return $result; - } -} - function VerifyTheme( $newtheme ) { global $gl_root_path; diff --git a/src/index.php b/src/index.php index 635c6b1..362ed33 100644 --- a/src/index.php +++ b/src/index.php @@ -219,7 +219,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) if ( isset($fields[$mycolkey]) ) { $content['fields'][$mycolkey]['FieldID'] = $mycolkey; - $content['fields'][$mycolkey]['FieldCaption'] = $content[ $fields[$mycolkey]['FieldCaptionID'] ]; + $content['fields'][$mycolkey]['FieldCaption'] = $fields[$mycolkey]['FieldCaption']; $content['fields'][$mycolkey]['FieldType'] = $fields[$mycolkey]['FieldType']; $content['fields'][$mycolkey]['FieldSortable'] = $stream->IsPropertySortable($mycolkey); // $fields[$mycolkey]['Sortable']; $content['fields'][$mycolkey]['DefaultWidth'] = $fields[$mycolkey]['DefaultWidth']; @@ -384,7 +384,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) } // Add context menu - AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_NUMBER, SYSLOG_FACILITY, 'LN_FIELDS_FACILITY', true); + AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_NUMBER, SYSLOG_FACILITY); } else if ( $mycolkey == SYSLOG_SEVERITY ) { @@ -403,7 +403,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) } // Add context menu - AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_NUMBER, SYSLOG_SEVERITY, 'LN_FIELDS_SEVERITY', true); + AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_NUMBER, SYSLOG_SEVERITY); } else if ( $mycolkey == SYSLOG_MESSAGETYPE ) { @@ -422,29 +422,34 @@ if ( isset($content['Sources'][$currentSourceID]) ) } // Add context menu - AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_NUMBER, SYSLOG_MESSAGETYPE, 'LN_FIELDS_MESSAGETYPE', false); + AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_NUMBER, SYSLOG_MESSAGETYPE); } else if ( $mycolkey == SYSLOG_PROCESSID ) { // Add context menu - AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_NUMBER, SYSLOG_PROCESSID, 'LN_FIELDS_PROCESSID', false); + AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_NUMBER, SYSLOG_PROCESSID); } /* Eventlog based fields */ else if ( $mycolkey == SYSLOG_EVENT_ID ) { // Add context menu - AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_NUMBER, SYSLOG_EVENT_ID, 'LN_FIELDS_EVENTID', true); + AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_NUMBER, SYSLOG_EVENT_ID); } else if ( $mycolkey == SYSLOG_EVENT_CATEGORY ) { // Add context menu - AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_NUMBER, SYSLOG_EVENT_CATEGORY, 'LN_FIELDS_EVENTCATEGORY', false); + AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_NUMBER, SYSLOG_EVENT_CATEGORY); } // WebServer Type fields else if ( $mycolkey == SYSLOG_WEBLOG_STATUS ) { // Add context menu - AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_NUMBER, SYSLOG_WEBLOG_STATUS, 'LN_FIELDS_WEBLOG_STATUS', false); + AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_NUMBER, SYSLOG_WEBLOG_STATUS); + } + else + { + // Add context menu + AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_NUMBER, $mycolkey); } } else if ( $content['fields'][$mycolkey]['FieldType'] == FILTER_TYPE_STRING ) @@ -549,66 +554,70 @@ if ( isset($content['Sources'][$currentSourceID]) ) else if ( $mycolkey == SYSLOG_SYSLOGTAG ) { // Add context menu - AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_SYSLOGTAG, 'LN_FIELDS_SYSLOGTAG', true); + AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_SYSLOGTAG); } else if ( $mycolkey == SYSLOG_HOST ) { // Add context menu - AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_HOST, 'LN_FIELDS_HOST', false); + AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_HOST); } /* Eventlog based fields */ else if ( $mycolkey == SYSLOG_EVENT_LOGTYPE ) { // Add context menu - AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_EVENT_LOGTYPE, 'LN_FIELDS_EVENTLOGTYPE', true); + AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_EVENT_LOGTYPE); } else if ( $mycolkey == SYSLOG_EVENT_SOURCE ) { // Add context menu - AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_EVENT_SOURCE, 'LN_FIELDS_EVENTSOURCE', true); + AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_EVENT_SOURCE); } else if ( $mycolkey == SYSLOG_EVENT_USER ) { // Add context menu - AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_EVENT_USER, 'LN_FIELDS_EVENTUSER', false); + AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_EVENT_USER); } // WebServer Type fields else if ( $mycolkey == SYSLOG_WEBLOG_USER ) { // Add context menu - AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_WEBLOG_USER, 'LN_FIELDS_WEBLOG_USER', false); + AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_WEBLOG_USER); } else if ( $mycolkey == SYSLOG_WEBLOG_METHOD ) { // Add context menu - AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_WEBLOG_METHOD, 'LN_FIELDS_WEBLOG_USERAGENT', false); + AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_WEBLOG_METHOD); } else if ( $mycolkey == SYSLOG_WEBLOG_URL ) { // Add context menu - AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_WEBLOG_URL, 'LN_FIELDS_WEBLOG_URL', false); + AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_WEBLOG_URL); } else if ( $mycolkey == SYSLOG_WEBLOG_QUERYSTRING ) { // Add context menu - AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_WEBLOG_QUERYSTRING, 'LN_FIELDS_WEBLOG_QUERYSTRING', false); + AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_WEBLOG_QUERYSTRING); } else if ( $mycolkey == SYSLOG_WEBLOG_PVER ) { // Add context menu - AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_WEBLOG_PVER, 'LN_FIELDS_WEBLOG_PVER', false); + AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_WEBLOG_PVER); } else if ( $mycolkey == SYSLOG_WEBLOG_REFERER ) { // Add context menu - AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_WEBLOG_REFERER, 'LN_FIELDS_WEBLOG_REFERER', true); + AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_WEBLOG_REFERER); } else if ( $mycolkey == SYSLOG_WEBLOG_USERAGENT ) { // Add context menu - AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_WEBLOG_USERAGENT, 'LN_FIELDS_WEBLOG_USERAGENT', true); + AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, SYSLOG_WEBLOG_USERAGENT); + } + else + { + // Add context menu + AddOnClickMenu( $content['syslogmessages'][$counter]['values'][$mycolkey], FILTER_TYPE_STRING, $mycolkey); } - } } } @@ -777,13 +786,19 @@ function PrepareStringForSearch($myString) return str_replace($searchArray, $replaceArray, $myString); } -function AddOnClickMenu(&$fieldGridItem, $fieldType, $FieldID, $szFieldDisplayNameID, $searchOnline = false) +function AddOnClickMenu(&$fieldGridItem, $fieldType, $FieldID) { global $content, $fields, $myStrCharLimit; // Set OnClick Menu for SYSLOG_SYSLOGTAG $fieldGridItem['hasbuttons'] = true; + // Set Field Caption + if ( isset($content['fields'][$FieldID]['FieldCaption']) && strlen( $content['fields'][$FieldID]['FieldCaption']) > 0 ) + $szFieldDisplayName = $content['fields'][$FieldID]['FieldCaption']; + else + $szFieldDisplayName = $FieldID; + // Set FieldSearch Value if ( $fieldType == FILTER_TYPE_STRING) $szEncodedFieldValue = urlencode($fieldGridItem['encodedfieldvalue']); @@ -832,13 +847,13 @@ function AddOnClickMenu(&$fieldGridItem, $fieldType, $FieldID, $szFieldDisplayN ); // Add Online Search Button - if ( $searchOnline ) + if ( isset($fields[$FieldID]['SearchOnline']) && $fields[$FieldID]['SearchOnline'] ) { $fieldGridItem['buttons'][] = array( 'ButtonUrl' => 'http://kb.monitorware.com/kbsearch.php?sa=Search&origin=phplogcon&oid=' . $FieldID . '&q=' . $szEncodedFieldValue, 'ButtonTarget' => '_top', 'ButtonAppendUrl' => true, - 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $content[$szFieldDisplayNameID] . " '" . $fieldGridItem['fieldvalue'] . "'", + 'DisplayName' => $content['LN_VIEW_SEARCHFOR'] . " " . $szFieldDisplayName . " '" . $fieldGridItem['fieldvalue'] . "'", 'IconSource' => $content['MENU_NETWORK'] ); } diff --git a/src/lang/de/admin.php b/src/lang/de/admin.php index e7fb571..4905f71 100644 --- a/src/lang/de/admin.php +++ b/src/lang/de/admin.php @@ -29,13 +29,15 @@ global $content; // Global Stuff $content['LN_ADMINMENU_HOMEPAGE'] = "Back to Show Events"; -$content['LN_ADMINMENU_GENOPT'] = "General Options"; -$content['LN_ADMINMENU_SOURCEOPT'] = "Sources Options"; -$content['LN_ADMINMENU_VIEWSOPT'] = "Views Options"; -$content['LN_ADMINMENU_SEARCHOPT'] = "Search Options"; -$content['LN_ADMINMENU_USEROPT'] = "User Options"; -$content['LN_ADMINMENU_GROUPOPT'] = "Group Options"; -$content['LN_ADMINMENU_CHARTOPT'] = "Chart Options"; +$content['LN_ADMINMENU_GENOPT'] = "Preferences"; +$content['LN_ADMINMENU_SOURCEOPT'] = "Sources"; +$content['LN_ADMINMENU_VIEWSOPT'] = "Views"; +$content['LN_ADMINMENU_SEARCHOPT'] = "Searches"; +$content['LN_ADMINMENU_USEROPT'] = "Users"; +$content['LN_ADMINMENU_GROUPOPT'] = "Groups"; +$content['LN_ADMINMENU_CHARTOPT'] = "Charts"; +$content['LN_ADMINMENU_FIELDOPT'] = "Fields"; +$content['LN_ADMINMENU_MSGPARSERSOPT'] = "Message Parsers"; $content['LN_ADMIN_CENTER'] = "Admin center"; $content['LN_ADMIN_UNKNOWNSTATE'] = "Unknown State"; $content['LN_ADMIN_ERROR_NOTALLOWED'] = "You are not allowed to access this page with your user level."; @@ -251,4 +253,60 @@ $content['LN_CHARTS_WARNDELETESEARCH'] = "Are you sure that you want to delete t $content['LN_CHARTS_ERROR_DELCHART'] = "Deleting of the Chart with id '%1' failed!"; $content['LN_CHARTS_ERROR_HASBEENDEL'] = "The Chart '%1' has been successfully deleted!"; +// Fields Options +$content['LN_FIELDS_CENTER'] = "Fields Options"; +$content['LN_FIELDS_EDIT'] = "Edit Field"; +$content['LN_FIELDS_DELETE'] = "Delete Field"; +$content['LN_FIELDS_ADD'] = "Add new Field"; +$content['LN_FIELDS_ID'] = "FieldID"; +$content['LN_FIELDS_NAME'] = "Display Name"; +$content['LN_FIELDS_DEFINE'] = "Internal FieldID"; +$content['LN_FIELDS_DELETE_FROMDB'] = "Delete Field from DB"; +$content['LN_FIELDS_ADDEDIT'] = "Add / Edit a Field"; +$content['LN_FIELDS_TYPE'] = "Field Type"; +$content['LN_FIELDS_ALIGN'] = "Listview Alignment"; +$content['LN_FIELDS_SEARCHONLINE'] = "Enable online search"; +$content['LN_FIELDS_DEFAULTWIDTH'] = "Row width in Listview"; +$content['LN_FIELDS_ERROR_IDNOTFOUND'] = "The Field-ID could not be found in the database, or in the default constants."; +$content['LN_FIELDS_ERROR_INVALIDID'] = "The Field with ID '%1' is not a valid Field."; +$content['LN_FIELDS_SEARCHFIELD'] = "Name of Searchfilter"; +$content['LN_FIELDS_WARNDELETESEARCH'] = "Are you sure that you want to delete the Field '%1'? This cannot be undone!"; +$content['LN_FIELDS_ERROR_DELSEARCH'] = "The Field-ID could not be found in the database."; +$content['LN_FIELDS_ERROR_HASBEENDEL'] = "The Field '%1' has been successfully deleted!"; +$content['LN_FIELDS_ERROR_FIELDCAPTIONEMPTY'] = "The field caption was empty. "; +$content['LN_FIELDS_ERROR_FIELDIDEMPTY'] = "The field id was empty. "; +$content['LN_FIELDS_ERROR_SEARCHFIELDEMPTY'] = "The searchfilter was empty. "; +$content['LN_FIELDS_ERROR_FIELDDEFINEEMPTY'] = "The internal FieldID was empty. "; +$content['LN_FIELDS_HASBEENEDIT'] = "The configuration for the field '%1' has been successfully edited."; +$content['LN_FIELDS_HASBEENADDED'] = "The configuration for the field '%1' has been successfully added."; +$content['LN_FIELDS_'] = ""; +$content['LN_ALIGN_CENTER'] = "center"; +$content['LN_ALIGN_LEFT'] = "left"; +$content['LN_ALIGN_RIGHT'] = "right"; +$content['LN_FILTER_TYPE_STRING'] = "String"; +$content['LN_FILTER_TYPE_NUMBER'] = "Number"; +$content['LN_FILTER_TYPE_DATE'] = "Date"; + +// Parser Options +$content['LN_PARSERS_EDIT'] = "Edit Message Parser"; +$content['LN_PARSERS_DELETE'] = "Delete Message Parser"; +$content['LN_PARSERS_ID'] = "Message Parser ID"; +$content['LN_PARSERS_NAME'] = "Message Parser Name"; +$content['LN_PARSERS_DESCRIPTION'] = "Message Parser Description"; +$content['LN_PARSERS_ERROR_NOPARSERS'] = "There were no valid message parsers found in your installation. "; +$content['LN_PARSERS_HELP'] = "Help"; +$content['LN_PARSERS_HELP_CLICK'] = "Click here for more help"; +$content['LN_PARSERS_INFO'] = "Show more Information for this message parser."; +$content['LN_PARSERS_INIT'] = "Initialize settings for this message parser."; +$content['LN_PARSERS_REMOVE'] = "Remove settings for this message parser."; +$content['LN_PARSERS_ERROR_IDNOTFOUND'] = "There was no message parser with ID '%1' found."; +$content['LN_PARSERS_ERROR_INVALIDID'] = "Invalid message parser id."; +$content['LN_PARSERS_DETAILS'] = "Details for this Parser"; +$content['LN_PARSERS_CUSTOMFIELDS'] = "The following Custom fields are needed by this Message Parser."; +$content['LN_PARSERS_WARNREMOVE'] = "You are about to remove the custom fields needed by the '%1' Message Parser. However you can add these fields again if you change your mind."; +$content['LN_PARSERS_ERROR_HASBEENREMOVED'] = "All settings ('%2' custom fields) for the Message Parser '%1' have been removed. "; +$content['LN_PARSERS_ERROR_HASBEENADDED'] = "All required settings ('%2' custom fields) for the Message Parser '%1' have been added. "; +$content['LN_PARSERS_ERROR_NOFIELDS'] = "The Message Parser '%1' does not have any custom fields to add."; +$content['LN_PARSERS_'] = ""; + ?> \ No newline at end of file diff --git a/src/lang/de/main.php b/src/lang/de/main.php index f810d27..de2b657 100644 --- a/src/lang/de/main.php +++ b/src/lang/de/main.php @@ -57,7 +57,7 @@ $content['LN_GEN_SOURCE_DB'] = "Datenbank"; $content['LN_GEN_DB_SQLITE'] = "SQLite 2"; $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_ERRORRETURNPREV'] = "Click here to return to the previous page."; $content['LN_GEN_ERRORDETAILS'] = "Error Details:"; $content['LN_SOURCES_ERROR_WITHINSOURCE'] = "The source '%1' checking returned with an error: '%2'"; @@ -169,31 +169,6 @@ $content['LN_FILTER_SYSLOGTAG'] = "Syslogtag"; $content['LN_FILTER_SOURCE'] = "Quelle (Hostname)"; $content['LN_FILTER_MESSAGETYPE'] = "Message Type"; -// Field Captions -$content['LN_FIELDS_DATE'] = "Datum"; -$content['LN_FIELDS_FACILITY'] = "Kategorie/Facility"; -$content['LN_FIELDS_SEVERITY'] = "Dringlichkeit/Severity"; -$content['LN_FIELDS_HOST'] = "Host"; -$content['LN_FIELDS_SYSLOGTAG'] = "Syslogtag"; -$content['LN_FIELDS_PROCESSID'] = "Prozess ID"; -$content['LN_FIELDS_MESSAGETYPE'] = "Meldungstyp"; -$content['LN_FIELDS_UID'] = "uID"; -$content['LN_FIELDS_MESSAGE'] = "Meldung"; - $content['LN_FIELDS_EVENTID'] = "Event ID"; - $content['LN_FIELDS_EVENTLOGTYPE'] = "Eventlogtype"; - $content['LN_FIELDS_EVENTSOURCE'] = "Event Source"; - $content['LN_FIELDS_EVENTCATEGORY'] = "Event Category"; - $content['LN_FIELDS_EVENTUSER'] = "Event User"; - $content['LN_FIELDS_WEBLOG_USER'] = "HTTP User"; - $content['LN_FIELDS_WEBLOG_METHOD'] = "Method"; - $content['LN_FIELDS_WEBLOG_URL'] = "URL"; - $content['LN_FIELDS_WEBLOG_QUERYSTRING'] = "Querystring"; - $content['LN_FIELDS_WEBLOG_PVER'] = "Version"; - $content['LN_FIELDS_WEBLOG_STATUS'] = "Status"; - $content['LN_FIELDS_WEBLOG_BYTESSEND'] = "Bytes Send"; - $content['LN_FIELDS_WEBLOG_REFERER'] = "Referer"; - $content['LN_FIELDS_WEBLOG_USERAGENT'] = "User Agent"; - // Install Page $content['LN_CFG_DBSERVER'] = "Datenbank Host"; $content['LN_CFG_DBPORT'] = "Datenbank Port"; diff --git a/src/lang/en/admin.php b/src/lang/en/admin.php index f575009..2a488f6 100644 --- a/src/lang/en/admin.php +++ b/src/lang/en/admin.php @@ -29,13 +29,15 @@ global $content; // Global Stuff $content['LN_ADMINMENU_HOMEPAGE'] = "Back to Show Events"; -$content['LN_ADMINMENU_GENOPT'] = "General Options"; -$content['LN_ADMINMENU_SOURCEOPT'] = "Sources Options"; -$content['LN_ADMINMENU_VIEWSOPT'] = "Views Options"; -$content['LN_ADMINMENU_SEARCHOPT'] = "Search Options"; -$content['LN_ADMINMENU_USEROPT'] = "User Options"; -$content['LN_ADMINMENU_GROUPOPT'] = "Group Options"; -$content['LN_ADMINMENU_CHARTOPT'] = "Chart Options"; +$content['LN_ADMINMENU_GENOPT'] = "Preferences"; +$content['LN_ADMINMENU_SOURCEOPT'] = "Sources"; +$content['LN_ADMINMENU_VIEWSOPT'] = "Views"; +$content['LN_ADMINMENU_SEARCHOPT'] = "Searches"; +$content['LN_ADMINMENU_USEROPT'] = "Users"; +$content['LN_ADMINMENU_GROUPOPT'] = "Groups"; +$content['LN_ADMINMENU_CHARTOPT'] = "Charts"; +$content['LN_ADMINMENU_FIELDOPT'] = "Fields"; +$content['LN_ADMINMENU_MSGPARSERSOPT'] = "Message Parsers"; $content['LN_ADMIN_CENTER'] = "Admin center"; $content['LN_ADMIN_UNKNOWNSTATE'] = "Unknown State"; $content['LN_ADMIN_ERROR_NOTALLOWED'] = "You are not allowed to access this page with your user level."; @@ -260,5 +262,61 @@ $content['LN_CHARTS_ID'] = "ID"; $content['LN_CHARTS_ASSIGNTO'] = "Assigned To"; $content['LN_CHARTS_PREVIEW'] = "Preview Chart in a new Window"; +// Fields Options +$content['LN_FIELDS_CENTER'] = "Fields Options"; +$content['LN_FIELDS_EDIT'] = "Edit Field"; +$content['LN_FIELDS_DELETE'] = "Delete Field"; +$content['LN_FIELDS_ADD'] = "Add new Field"; +$content['LN_FIELDS_ID'] = "FieldID"; +$content['LN_FIELDS_NAME'] = "Display Name"; +$content['LN_FIELDS_DEFINE'] = "Internal FieldID"; +$content['LN_FIELDS_DELETE_FROMDB'] = "Delete Field from DB"; +$content['LN_FIELDS_ADDEDIT'] = "Add / Edit a Field"; +$content['LN_FIELDS_TYPE'] = "Field Type"; +$content['LN_FIELDS_ALIGN'] = "Listview Alignment"; +$content['LN_FIELDS_SEARCHONLINE'] = "Enable online search"; +$content['LN_FIELDS_DEFAULTWIDTH'] = "Row width in Listview"; +$content['LN_FIELDS_ERROR_IDNOTFOUND'] = "The Field-ID could not be found in the database, or in the default constants."; +$content['LN_FIELDS_ERROR_INVALIDID'] = "The Field with ID '%1' is not a valid Field."; +$content['LN_FIELDS_SEARCHFIELD'] = "Name of Searchfilter"; +$content['LN_FIELDS_WARNDELETESEARCH'] = "Are you sure that you want to delete the Field '%1'? This cannot be undone!"; +$content['LN_FIELDS_ERROR_DELSEARCH'] = "The Field-ID could not be found in the database."; +$content['LN_FIELDS_ERROR_HASBEENDEL'] = "The Field '%1' has been successfully deleted!"; +$content['LN_FIELDS_ERROR_FIELDCAPTIONEMPTY'] = "The field caption was empty. "; +$content['LN_FIELDS_ERROR_FIELDIDEMPTY'] = "The field id was empty. "; +$content['LN_FIELDS_ERROR_SEARCHFIELDEMPTY'] = "The searchfilter was empty. "; +$content['LN_FIELDS_ERROR_FIELDDEFINEEMPTY'] = "The internal FieldID was empty. "; +$content['LN_FIELDS_HASBEENEDIT'] = "The configuration for the field '%1' has been successfully edited."; +$content['LN_FIELDS_HASBEENADDED'] = "The configuration for the field '%1' has been successfully added."; +$content['LN_FIELDS_'] = ""; +$content['LN_ALIGN_CENTER'] = "center"; +$content['LN_ALIGN_LEFT'] = "left"; +$content['LN_ALIGN_RIGHT'] = "right"; +$content['LN_FILTER_TYPE_STRING'] = "String"; +$content['LN_FILTER_TYPE_NUMBER'] = "Number"; +$content['LN_FILTER_TYPE_DATE'] = "Date"; + +// Parser Options +$content['LN_PARSERS_EDIT'] = "Edit Message Parser"; +$content['LN_PARSERS_DELETE'] = "Delete Message Parser"; +$content['LN_PARSERS_ID'] = "Message Parser ID"; +$content['LN_PARSERS_NAME'] = "Message Parser Name"; +$content['LN_PARSERS_DESCRIPTION'] = "Message Parser Description"; +$content['LN_PARSERS_ERROR_NOPARSERS'] = "There were no valid message parsers found in your installation. "; +$content['LN_PARSERS_HELP'] = "Help"; +$content['LN_PARSERS_HELP_CLICK'] = "Click here for more help"; +$content['LN_PARSERS_INFO'] = "Show more Information for this message parser."; +$content['LN_PARSERS_INIT'] = "Initialize settings for this message parser."; +$content['LN_PARSERS_REMOVE'] = "Remove settings for this message parser."; +$content['LN_PARSERS_ERROR_IDNOTFOUND'] = "There was no message parser with ID '%1' found."; +$content['LN_PARSERS_ERROR_INVALIDID'] = "Invalid message parser id."; +$content['LN_PARSERS_DETAILS'] = "Details for this Parser"; +$content['LN_PARSERS_CUSTOMFIELDS'] = "The following Custom fields are needed by this Message Parser."; +$content['LN_PARSERS_WARNREMOVE'] = "You are about to remove the custom fields needed by the '%1' Message Parser. However you can add these fields again if you change your mind."; +$content['LN_PARSERS_ERROR_HASBEENREMOVED'] = "All settings ('%2' custom fields) for the Message Parser '%1' have been removed. "; +$content['LN_PARSERS_ERROR_HASBEENADDED'] = "All required settings ('%2' custom fields) for the Message Parser '%1' have been added. "; +$content['LN_PARSERS_ERROR_NOFIELDS'] = "The Message Parser '%1' does not have any custom fields to add."; +$content['LN_PARSERS_'] = ""; + ?> \ No newline at end of file diff --git a/src/lang/en/main.php b/src/lang/en/main.php index eff8d8d..9157725 100644 --- a/src/lang/en/main.php +++ b/src/lang/en/main.php @@ -58,7 +58,7 @@ $content['LN_GEN_DB_INFORMIX'] = "IBM Informix Dynamic Server"; $content['LN_GEN_DB_SQLITE'] = "SQLite 2"; $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_ERRORRETURNPREV'] = "Click here to return to the previous page."; $content['LN_GEN_ERRORDETAILS'] = "Error Details:"; $content['LN_SOURCES_ERROR_WITHINSOURCE'] = "The source '%1' checking returned with an error:
%2"; $content['LN_SOURCES_ERROR_EXTRAMSG'] = "Extra Error Details:
%1"; @@ -170,31 +170,6 @@ $content['LN_FILTER_SYSLOGTAG'] = "Syslogtag"; $content['LN_FILTER_SOURCE'] = "Source (Hostname)"; $content['LN_FILTER_MESSAGETYPE'] = "Message Type"; -// Field Captions -$content['LN_FIELDS_DATE'] = "Date"; -$content['LN_FIELDS_FACILITY'] = "Facility"; -$content['LN_FIELDS_SEVERITY'] = "Severity"; -$content['LN_FIELDS_HOST'] = "Host"; -$content['LN_FIELDS_SYSLOGTAG'] = "Syslogtag"; -$content['LN_FIELDS_PROCESSID'] = "ProcessID"; -$content['LN_FIELDS_MESSAGETYPE'] = "Messagetype"; -$content['LN_FIELDS_UID'] = "uID"; -$content['LN_FIELDS_MESSAGE'] = "Message"; -$content['LN_FIELDS_EVENTID'] = "Event ID"; -$content['LN_FIELDS_EVENTLOGTYPE'] = "Eventlog Type"; -$content['LN_FIELDS_EVENTSOURCE'] = "Event Source"; -$content['LN_FIELDS_EVENTCATEGORY'] = "Event Category"; -$content['LN_FIELDS_EVENTUSER'] = "Event User"; -$content['LN_FIELDS_WEBLOG_USER'] = "HTTP User"; -$content['LN_FIELDS_WEBLOG_METHOD'] = "Method"; -$content['LN_FIELDS_WEBLOG_URL'] = "URL"; -$content['LN_FIELDS_WEBLOG_QUERYSTRING'] = "Querystring"; -$content['LN_FIELDS_WEBLOG_PVER'] = "Version"; -$content['LN_FIELDS_WEBLOG_STATUS'] = "Status"; -$content['LN_FIELDS_WEBLOG_BYTESSEND'] = "Bytes Send"; -$content['LN_FIELDS_WEBLOG_REFERER'] = "Referer"; -$content['LN_FIELDS_WEBLOG_USERAGENT'] = "User Agent"; - // Install Page $content['LN_CFG_DBSERVER'] = "Database Host"; $content['LN_CFG_DBPORT'] = "Database Port"; diff --git a/src/lang/pt_BR/admin.php b/src/lang/pt_BR/admin.php index e7fb571..4905f71 100644 --- a/src/lang/pt_BR/admin.php +++ b/src/lang/pt_BR/admin.php @@ -29,13 +29,15 @@ global $content; // Global Stuff $content['LN_ADMINMENU_HOMEPAGE'] = "Back to Show Events"; -$content['LN_ADMINMENU_GENOPT'] = "General Options"; -$content['LN_ADMINMENU_SOURCEOPT'] = "Sources Options"; -$content['LN_ADMINMENU_VIEWSOPT'] = "Views Options"; -$content['LN_ADMINMENU_SEARCHOPT'] = "Search Options"; -$content['LN_ADMINMENU_USEROPT'] = "User Options"; -$content['LN_ADMINMENU_GROUPOPT'] = "Group Options"; -$content['LN_ADMINMENU_CHARTOPT'] = "Chart Options"; +$content['LN_ADMINMENU_GENOPT'] = "Preferences"; +$content['LN_ADMINMENU_SOURCEOPT'] = "Sources"; +$content['LN_ADMINMENU_VIEWSOPT'] = "Views"; +$content['LN_ADMINMENU_SEARCHOPT'] = "Searches"; +$content['LN_ADMINMENU_USEROPT'] = "Users"; +$content['LN_ADMINMENU_GROUPOPT'] = "Groups"; +$content['LN_ADMINMENU_CHARTOPT'] = "Charts"; +$content['LN_ADMINMENU_FIELDOPT'] = "Fields"; +$content['LN_ADMINMENU_MSGPARSERSOPT'] = "Message Parsers"; $content['LN_ADMIN_CENTER'] = "Admin center"; $content['LN_ADMIN_UNKNOWNSTATE'] = "Unknown State"; $content['LN_ADMIN_ERROR_NOTALLOWED'] = "You are not allowed to access this page with your user level."; @@ -251,4 +253,60 @@ $content['LN_CHARTS_WARNDELETESEARCH'] = "Are you sure that you want to delete t $content['LN_CHARTS_ERROR_DELCHART'] = "Deleting of the Chart with id '%1' failed!"; $content['LN_CHARTS_ERROR_HASBEENDEL'] = "The Chart '%1' has been successfully deleted!"; +// Fields Options +$content['LN_FIELDS_CENTER'] = "Fields Options"; +$content['LN_FIELDS_EDIT'] = "Edit Field"; +$content['LN_FIELDS_DELETE'] = "Delete Field"; +$content['LN_FIELDS_ADD'] = "Add new Field"; +$content['LN_FIELDS_ID'] = "FieldID"; +$content['LN_FIELDS_NAME'] = "Display Name"; +$content['LN_FIELDS_DEFINE'] = "Internal FieldID"; +$content['LN_FIELDS_DELETE_FROMDB'] = "Delete Field from DB"; +$content['LN_FIELDS_ADDEDIT'] = "Add / Edit a Field"; +$content['LN_FIELDS_TYPE'] = "Field Type"; +$content['LN_FIELDS_ALIGN'] = "Listview Alignment"; +$content['LN_FIELDS_SEARCHONLINE'] = "Enable online search"; +$content['LN_FIELDS_DEFAULTWIDTH'] = "Row width in Listview"; +$content['LN_FIELDS_ERROR_IDNOTFOUND'] = "The Field-ID could not be found in the database, or in the default constants."; +$content['LN_FIELDS_ERROR_INVALIDID'] = "The Field with ID '%1' is not a valid Field."; +$content['LN_FIELDS_SEARCHFIELD'] = "Name of Searchfilter"; +$content['LN_FIELDS_WARNDELETESEARCH'] = "Are you sure that you want to delete the Field '%1'? This cannot be undone!"; +$content['LN_FIELDS_ERROR_DELSEARCH'] = "The Field-ID could not be found in the database."; +$content['LN_FIELDS_ERROR_HASBEENDEL'] = "The Field '%1' has been successfully deleted!"; +$content['LN_FIELDS_ERROR_FIELDCAPTIONEMPTY'] = "The field caption was empty. "; +$content['LN_FIELDS_ERROR_FIELDIDEMPTY'] = "The field id was empty. "; +$content['LN_FIELDS_ERROR_SEARCHFIELDEMPTY'] = "The searchfilter was empty. "; +$content['LN_FIELDS_ERROR_FIELDDEFINEEMPTY'] = "The internal FieldID was empty. "; +$content['LN_FIELDS_HASBEENEDIT'] = "The configuration for the field '%1' has been successfully edited."; +$content['LN_FIELDS_HASBEENADDED'] = "The configuration for the field '%1' has been successfully added."; +$content['LN_FIELDS_'] = ""; +$content['LN_ALIGN_CENTER'] = "center"; +$content['LN_ALIGN_LEFT'] = "left"; +$content['LN_ALIGN_RIGHT'] = "right"; +$content['LN_FILTER_TYPE_STRING'] = "String"; +$content['LN_FILTER_TYPE_NUMBER'] = "Number"; +$content['LN_FILTER_TYPE_DATE'] = "Date"; + +// Parser Options +$content['LN_PARSERS_EDIT'] = "Edit Message Parser"; +$content['LN_PARSERS_DELETE'] = "Delete Message Parser"; +$content['LN_PARSERS_ID'] = "Message Parser ID"; +$content['LN_PARSERS_NAME'] = "Message Parser Name"; +$content['LN_PARSERS_DESCRIPTION'] = "Message Parser Description"; +$content['LN_PARSERS_ERROR_NOPARSERS'] = "There were no valid message parsers found in your installation. "; +$content['LN_PARSERS_HELP'] = "Help"; +$content['LN_PARSERS_HELP_CLICK'] = "Click here for more help"; +$content['LN_PARSERS_INFO'] = "Show more Information for this message parser."; +$content['LN_PARSERS_INIT'] = "Initialize settings for this message parser."; +$content['LN_PARSERS_REMOVE'] = "Remove settings for this message parser."; +$content['LN_PARSERS_ERROR_IDNOTFOUND'] = "There was no message parser with ID '%1' found."; +$content['LN_PARSERS_ERROR_INVALIDID'] = "Invalid message parser id."; +$content['LN_PARSERS_DETAILS'] = "Details for this Parser"; +$content['LN_PARSERS_CUSTOMFIELDS'] = "The following Custom fields are needed by this Message Parser."; +$content['LN_PARSERS_WARNREMOVE'] = "You are about to remove the custom fields needed by the '%1' Message Parser. However you can add these fields again if you change your mind."; +$content['LN_PARSERS_ERROR_HASBEENREMOVED'] = "All settings ('%2' custom fields) for the Message Parser '%1' have been removed. "; +$content['LN_PARSERS_ERROR_HASBEENADDED'] = "All required settings ('%2' custom fields) for the Message Parser '%1' have been added. "; +$content['LN_PARSERS_ERROR_NOFIELDS'] = "The Message Parser '%1' does not have any custom fields to add."; +$content['LN_PARSERS_'] = ""; + ?> \ No newline at end of file diff --git a/src/lang/pt_BR/main.php b/src/lang/pt_BR/main.php index 1864b00..6ef5ad4 100644 --- a/src/lang/pt_BR/main.php +++ b/src/lang/pt_BR/main.php @@ -61,7 +61,7 @@ $content['LN_GEN_DB_INFORMIX'] = "IBM Informix Dynamic Server"; $content['LN_GEN_DB_SQLITE'] = "SQLite 2"; $content['LN_GEN_SELECTVIEW'] = "Visão"; $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_ERRORRETURNPREV'] = "Click here to return to the previous page."; $content['LN_GEN_ERRORDETAILS'] = "Error Details:"; $content['LN_SOURCES_ERROR_WITHINSOURCE'] = "The source '%1' checking returned with an error: '%2'"; @@ -172,31 +172,6 @@ $content['LN_FILTER_SYSLOGTAG'] = "Syslogtag"; $content['LN_FILTER_SOURCE'] = "Origem (Hostname)"; $content['LN_FILTER_MESSAGETYPE'] = "Tipo de mensagem"; -// Field Captions -$content['LN_FIELDS_DATE'] = "Data"; -$content['LN_FIELDS_FACILITY'] = "Facility"; -$content['LN_FIELDS_SEVERITY'] = "Severidade"; -$content['LN_FIELDS_HOST'] = "Host"; -$content['LN_FIELDS_SYSLOGTAG'] = "Syslogtag"; -$content['LN_FIELDS_PROCESSID'] = "PID"; -$content['LN_FIELDS_MESSAGETYPE'] = "Tipo"; -$content['LN_FIELDS_UID'] = "uID"; -$content['LN_FIELDS_MESSAGE'] = "Mensagem"; -$content['LN_FIELDS_EVENTID'] = "ID do Evento"; -$content['LN_FIELDS_EVENTLOGTYPE'] = "Tipo do Evento"; -$content['LN_FIELDS_EVENTSOURCE'] = "Origem do Evento"; -$content['LN_FIELDS_EVENTCATEGORY'] = "Categoria do Evento"; -$content['LN_FIELDS_EVENTUSER'] = "Evento de Usu´rio"; - $content['LN_FIELDS_WEBLOG_USER'] = "HTTP User"; - $content['LN_FIELDS_WEBLOG_METHOD'] = "Method"; - $content['LN_FIELDS_WEBLOG_URL'] = "URL"; - $content['LN_FIELDS_WEBLOG_QUERYSTRING'] = "Querystring"; - $content['LN_FIELDS_WEBLOG_PVER'] = "Version"; - $content['LN_FIELDS_WEBLOG_STATUS'] = "Status"; - $content['LN_FIELDS_WEBLOG_BYTESSEND'] = "Bytes Send"; - $content['LN_FIELDS_WEBLOG_REFERER'] = "Referer"; - $content['LN_FIELDS_WEBLOG_USERAGENT'] = "User Agent"; - // Install Page $content['LN_CFG_DBSERVER'] = "Servidor BD"; $content['LN_CFG_DBPORT'] = "Porta BD"; diff --git a/src/statistics.php b/src/statistics.php index 5763c8d..ecf75c3 100644 --- a/src/statistics.php +++ b/src/statistics.php @@ -88,8 +88,8 @@ if ( isset($content['Charts']) ) // --- // --- Set display name for chart field - if ( isset($myChart['chart_field']) && isset($fields[$myChart['chart_field']]) && isset($content[ $fields[$myChart['chart_field']]['FieldCaptionID'] ]) ) - $myChart['CHART_FIELD_DISPLAYNAME'] = $content[ $fields[$myChart['chart_field']]['FieldCaptionID'] ]; + if ( isset($myChart['chart_field']) && isset($fields[$myChart['chart_field']]) && isset($fields[$myChart['chart_field']]['FieldCaption']) ) + $myChart['CHART_FIELD_DISPLAYNAME'] = $fields[$myChart['chart_field']]['FieldCaption']; else $myChart['CHART_FIELD_DISPLAYNAME'] = $myChart['chart_field']; // --- diff --git a/src/templates/admin/admin_fields.html b/src/templates/admin/admin_fields.html new file mode 100644 index 0000000..1c7db79 --- /dev/null +++ b/src/templates/admin/admin_fields.html @@ -0,0 +1,127 @@ + + + +

+
+
+
{LN_GEN_ERRORDETAILS}
+

{ERROR_MSG}

+
+

+ {LN_GEN_ERRORRETURNPREV} +
+

+ + + + + + + + + +
{LN_FIELDS_CENTER}
+

+ + + + + + + + + + + + + + + + + + + + +
{LN_FIELDS_NAME}{LN_FIELDS_ID}{LN_FIELDS_DEFINE}{LN_GEN_ACTIONS}
{FieldCaption}{FieldID}{FieldDefine} +   + + +   + + +   + +
 {LN_FIELDS_ADD}
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{LN_FIELDS_ADDEDIT}
{LN_FIELDS_ID}
{LN_FIELDS_DEFINE}
{LN_FIELDS_NAME}
{LN_FIELDS_SEARCHFIELD}
{LN_FIELDS_SEARCHONLINE}
{LN_FIELDS_TYPE} + +
{LN_FIELDS_ALIGN} + +
{LN_FIELDS_DEFAULTWIDTH}
+ + + + + + +
+
+ + +

+ +
+ + \ No newline at end of file diff --git a/src/templates/admin/admin_menu.html b/src/templates/admin/admin_menu.html index 51a9af5..bb69b32 100644 --- a/src/templates/admin/admin_menu.html +++ b/src/templates/admin/admin_menu.html @@ -3,15 +3,17 @@ - {LN_ADMINMENU_GENOPT} - {LN_ADMINMENU_SOURCEOPT} - {LN_ADMINMENU_VIEWSOPT} - {LN_ADMINMENU_SEARCHOPT} - {LN_ADMINMENU_CHARTOPT} + {LN_ADMINMENU_GENOPT} + {LN_ADMINMENU_SOURCEOPT} + {LN_ADMINMENU_FIELDOPT} + {LN_ADMINMENU_VIEWSOPT} + {LN_ADMINMENU_SEARCHOPT} + {LN_ADMINMENU_CHARTOPT} + {LN_ADMINMENU_MSGPARSERSOPT} - {LN_ADMINMENU_USEROPT} - {LN_ADMINMENU_GROUPOPT} + {LN_ADMINMENU_USEROPT} + {LN_ADMINMENU_GROUPOPT} diff --git a/src/templates/admin/admin_parsers.html b/src/templates/admin/admin_parsers.html new file mode 100644 index 0000000..c24195e --- /dev/null +++ b/src/templates/admin/admin_parsers.html @@ -0,0 +1,114 @@ + + + +

+
+
+
{LN_GEN_ERRORDETAILS}
+

{ERROR_MSG}

+
+

+ {LN_GEN_ERRORRETURNPREV} +
+

+ + + + + + + + + +
{LN_ADMINMENU_MSGPARSERSOPT}
+

+ + + + + + + + + + + + + + + + + + + +
{LN_PARSERS_ID}{LN_PARSERS_NAME}{LN_PARSERS_DESCRIPTION}{LN_GEN_ACTIONS}
{ID}{DisplayName}{Description} + + + + + + + +   + + +   + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{LN_PARSERS_DETAILS}
{LN_PARSERS_ID}{ParserID}
{LN_PARSERS_NAME}{DisplayName}
{LN_PARSERS_DESCRIPTION}{Description}
{LN_PARSERS_CUSTOMFIELDS} + +
{FieldCaption} ({FieldDefine}) + +

+
{LN_PARSERS_HELP}{LN_PARSERS_HELP_CLICK}
+ + {LN_PARSERS_INIT} + + + {LN_PARSERS_REMOVE} + +
+ +

+ {LN_GEN_ERRORRETURNPREV} + + +

+ +
+ + \ No newline at end of file diff --git a/src/templates/admin/admin_searches.html b/src/templates/admin/admin_searches.html index 5476310..f16db4d 100644 --- a/src/templates/admin/admin_searches.html +++ b/src/templates/admin/admin_searches.html @@ -82,7 +82,7 @@ - {LN_SEARCH_GROUPONLY} + {LN_GEN_GROUPONLY} {ColCaption} + + {ColInternalID} + + @@ -115,7 +119,7 @@ - +