From 01d1874b9db1a56915ed4609b0af28f5ba7a1491 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Tue, 7 Oct 2008 16:30:11 +0200 Subject: [PATCH 01/14] Removed FieldCaptions from language files, and merged them into constants $fields array This change is necessary for future changes --- src/admin/views.php | 20 ++++---- src/asktheoracle.php | 28 ----------- src/chartgenerator.php | 10 ++-- .../msgparsers/msgparser.apache2.class.php | 6 +-- .../msgparser.apache2common.class.php | 6 +-- .../msgparsers/msgparser.eventlog.class.php | 6 +-- .../msgparsers/msgparser.iis.class.php | 6 +-- src/details.php | 2 +- src/export.php | 9 +--- src/include/constants_logstream.php | 46 ++++++++--------- src/include/functions_common.php | 4 +- src/index.php | 50 +++++++++++-------- src/lang/de/main.php | 25 ---------- src/lang/en/main.php | 25 ---------- src/lang/pt_BR/main.php | 25 ---------- src/statistics.php | 4 +- 16 files changed, 85 insertions(+), 187 deletions(-) diff --git a/src/admin/views.php b/src/admin/views.php index 1c51fc4..98be141 100644 --- a/src/admin/views.php +++ b/src/admin/views.php @@ -223,8 +223,8 @@ 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; @@ -256,8 +256,8 @@ 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; } @@ -311,8 +311,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 +338,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,8 +543,8 @@ 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; 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/msgparsers/msgparser.apache2.class.php b/src/classes/msgparsers/msgparser.apache2.class.php index fc0222b..dae215a 100644 --- a/src/classes/msgparsers/msgparser.apache2.class.php +++ b/src/classes/msgparsers/msgparser.apache2.class.php @@ -121,10 +121,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..a8670d5 100644 --- a/src/classes/msgparsers/msgparser.apache2common.class.php +++ b/src/classes/msgparsers/msgparser.apache2common.class.php @@ -119,10 +119,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..82e8fd9 100644 --- a/src/classes/msgparsers/msgparser.eventlog.class.php +++ b/src/classes/msgparsers/msgparser.eventlog.class.php @@ -90,10 +90,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..db93956 100644 --- a/src/classes/msgparsers/msgparser.iis.class.php +++ b/src/classes/msgparsers/msgparser.iis.class.php @@ -128,10 +128,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/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/include/constants_logstream.php b/src/include/constants_logstream.php index cd454ea..6d934be 100644 --- a/src/include/constants_logstream.php +++ b/src/include/constants_logstream.php @@ -79,26 +79,26 @@ define('FILTER_TYPE_UNKNOWN', 99); // --- Predefine fields array! $fields[SYSLOG_UID]['FieldID'] = SYSLOG_UID; -$fields[SYSLOG_UID]['FieldCaptionID'] = 'LN_FIELDS_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_DATE]['FieldID'] = SYSLOG_DATE; -$fields[SYSLOG_DATE]['FieldCaptionID'] = 'LN_FIELDS_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_HOST]['FieldID'] = SYSLOG_HOST; -$fields[SYSLOG_HOST]['FieldCaptionID'] = 'LN_FIELDS_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_MESSAGETYPE]['FieldID'] = SYSLOG_MESSAGETYPE; -$fields[SYSLOG_MESSAGETYPE]['FieldCaptionID'] = 'LN_FIELDS_MESSAGETYPE'; +$fields[SYSLOG_MESSAGETYPE]['FieldCaption'] = 'Messagetype'; $fields[SYSLOG_MESSAGETYPE]['FieldType'] = FILTER_TYPE_NUMBER; $fields[SYSLOG_MESSAGETYPE]['Sortable'] = true; $fields[SYSLOG_MESSAGETYPE]['DefaultWidth'] = "90"; @@ -107,28 +107,28 @@ $fields[SYSLOG_MESSAGETYPE]['SearchField'] = "messagetype"; // Syslog specific $fields[SYSLOG_FACILITY]['FieldID'] = SYSLOG_FACILITY; -$fields[SYSLOG_FACILITY]['FieldCaptionID'] = 'LN_FIELDS_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_SEVERITY]['FieldID'] = SYSLOG_SEVERITY; -$fields[SYSLOG_SEVERITY]['FieldCaptionID'] = 'LN_FIELDS_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_SYSLOGTAG]['FieldID'] = SYSLOG_SYSLOGTAG; -$fields[SYSLOG_SYSLOGTAG]['FieldCaptionID'] = 'LN_FIELDS_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_PROCESSID]['FieldID'] = SYSLOG_PROCESSID; -$fields[SYSLOG_PROCESSID]['FieldCaptionID'] = 'LN_FIELDS_PROCESSID'; +$fields[SYSLOG_PROCESSID]['FieldCaption'] = 'ProcessID'; $fields[SYSLOG_PROCESSID]['FieldType'] = FILTER_TYPE_NUMBER; $fields[SYSLOG_PROCESSID]['Sortable'] = true; $fields[SYSLOG_PROCESSID]['DefaultWidth'] = "65"; @@ -137,35 +137,35 @@ $fields[SYSLOG_PROCESSID]['SearchField'] = "processid"; // EventLog specific $fields[SYSLOG_EVENT_ID]['FieldID'] = SYSLOG_EVENT_ID; -$fields[SYSLOG_EVENT_ID]['FieldCaptionID'] = 'LN_FIELDS_EVENTID'; +$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_LOGTYPE]['FieldID'] = SYSLOG_EVENT_LOGTYPE; -$fields[SYSLOG_EVENT_LOGTYPE]['FieldCaptionID'] = 'LN_FIELDS_EVENTLOGTYPE'; +$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_SOURCE]['FieldID'] = SYSLOG_EVENT_SOURCE; -$fields[SYSLOG_EVENT_SOURCE]['FieldCaptionID'] = 'LN_FIELDS_EVENTSOURCE'; +$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_CATEGORY]['FieldID'] = SYSLOG_EVENT_CATEGORY; -$fields[SYSLOG_EVENT_CATEGORY]['FieldCaptionID'] = 'LN_FIELDS_EVENTCATEGORY'; +$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_USER]['FieldID'] = SYSLOG_EVENT_USER; -$fields[SYSLOG_EVENT_USER]['FieldCaptionID'] = 'LN_FIELDS_EVENTUSER'; +$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"; @@ -174,63 +174,63 @@ $fields[SYSLOG_EVENT_USER]['SearchField'] = "eventuser"; // Weblogfile specific $fields[SYSLOG_WEBLOG_USER]['FieldID'] = SYSLOG_WEBLOG_USER; -$fields[SYSLOG_WEBLOG_USER]['FieldCaptionID'] = 'LN_FIELDS_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_METHOD]['FieldID'] = SYSLOG_WEBLOG_METHOD; -$fields[SYSLOG_WEBLOG_METHOD]['FieldCaptionID'] = 'LN_FIELDS_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_URL]['FieldID'] = SYSLOG_WEBLOG_URL; -$fields[SYSLOG_WEBLOG_URL]['FieldCaptionID'] = 'LN_FIELDS_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_QUERYSTRING]['FieldID'] = SYSLOG_WEBLOG_QUERYSTRING; -$fields[SYSLOG_WEBLOG_QUERYSTRING]['FieldCaptionID'] = 'LN_FIELDS_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_PVER]['FieldID'] = SYSLOG_WEBLOG_PVER; -$fields[SYSLOG_WEBLOG_PVER]['FieldCaptionID'] = 'LN_FIELDS_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_STATUS]['FieldID'] = SYSLOG_WEBLOG_STATUS; -$fields[SYSLOG_WEBLOG_STATUS]['FieldCaptionID'] = 'LN_FIELDS_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_BYTESSEND]['FieldID'] = SYSLOG_WEBLOG_BYTESSEND; -$fields[SYSLOG_WEBLOG_BYTESSEND]['FieldCaptionID'] = 'LN_FIELDS_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_REFERER]['FieldID'] = SYSLOG_WEBLOG_REFERER; -$fields[SYSLOG_WEBLOG_REFERER]['FieldCaptionID'] = 'LN_FIELDS_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_USERAGENT]['FieldID'] = SYSLOG_WEBLOG_USERAGENT; -$fields[SYSLOG_WEBLOG_USERAGENT]['FieldCaptionID'] = 'LN_FIELDS_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"; @@ -239,7 +239,7 @@ $fields[SYSLOG_WEBLOG_USERAGENT]['SearchField'] = SYSLOG_WEBLOG_USERAGENT; // 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]['FieldCaption'] = 'Message'; $fields[SYSLOG_MESSAGE]['FieldType'] = FILTER_TYPE_STRING; $fields[SYSLOG_MESSAGE]['Sortable'] = false; $fields[SYSLOG_MESSAGE]['DefaultWidth'] = "100%"; diff --git a/src/include/functions_common.php b/src/include/functions_common.php index e082461..e1c07f1 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -266,8 +266,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; diff --git a/src/index.php b/src/index.php index 635c6b1..c9d6f71 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, true); } 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, true); } else if ( $mycolkey == SYSLOG_MESSAGETYPE ) { @@ -422,29 +422,29 @@ 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, false); } 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, false); } /* 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, true); } 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, false); } // 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, false); } } else if ( $content['fields'][$mycolkey]['FieldType'] == FILTER_TYPE_STRING ) @@ -549,64 +549,64 @@ 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, true); } 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, false); } /* 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, true); } 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, true); } 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, false); } // 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, false); } 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, false); } 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, false); } 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, false); } 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, false); } 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, true); } 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, true); } } @@ -777,13 +777,19 @@ function PrepareStringForSearch($myString) return str_replace($searchArray, $replaceArray, $myString); } -function AddOnClickMenu(&$fieldGridItem, $fieldType, $FieldID, $szFieldDisplayNameID, $searchOnline = false) +function AddOnClickMenu(&$fieldGridItem, $fieldType, $FieldID, $searchOnline = false) { 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']); @@ -838,7 +844,7 @@ function AddOnClickMenu(&$fieldGridItem, $fieldType, $FieldID, $szFieldDisplayN '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/main.php b/src/lang/de/main.php index f810d27..6c3a662 100644 --- a/src/lang/de/main.php +++ b/src/lang/de/main.php @@ -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/main.php b/src/lang/en/main.php index eff8d8d..0ad0aee 100644 --- a/src/lang/en/main.php +++ b/src/lang/en/main.php @@ -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/main.php b/src/lang/pt_BR/main.php index 1864b00..97ab3d9 100644 --- a/src/lang/pt_BR/main.php +++ b/src/lang/pt_BR/main.php @@ -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']; // --- From 1956bbe7409c60113bed0e49be02c871ec482450 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Wed, 8 Oct 2008 18:02:01 +0200 Subject: [PATCH 02/14] Added admin page for Fields, added database table for fields, made several adjustments to support dynamic fields --- src/admin/fields.php | 298 ++++++++++++++++++++++ src/images/icons/data_delete.png | Bin 0 -> 831 bytes src/images/icons/data_delete_disabled.png | Bin 0 -> 756 bytes src/images/icons/tables.png | Bin 0 -> 612 bytes src/include/constants_logstream.php | 30 ++- src/include/db_template.txt | 19 ++ src/include/db_update_v5.txt | 19 ++ src/include/functions_common.php | 46 ++++ src/include/functions_config.php | 86 +++++++ src/include/functions_db.php | 2 +- src/lang/de/admin.php | 9 +- src/lang/en/admin.php | 39 ++- src/lang/pt_BR/admin.php | 9 +- src/templates/admin/admin_menu.html | 9 +- src/templates/admin/admin_searches.html | 2 +- 15 files changed, 549 insertions(+), 19 deletions(-) create mode 100644 src/admin/fields.php create mode 100644 src/images/icons/data_delete.png create mode 100644 src/images/icons/data_delete_disabled.png create mode 100644 src/images/icons/tables.png create mode 100644 src/include/db_update_v5.txt diff --git a/src/admin/fields.php b/src/admin/fields.php new file mode 100644 index 0000000..f388e50 --- /dev/null +++ b/src/admin/fields.php @@ -0,0 +1,298 @@ + 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 +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'] = 0; // 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'] = ""; } + } + 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['SEARCHID'] = DB_RemoveBadChars($_GET['id']); + + // Get UserInfo + $result = DB_Query("SELECT DisplayName FROM " . DB_SEARCHES . " WHERE ID = " . $content['SEARCHID'] ); + $myrow = DB_GetSingleRow($result, true); + if ( !isset($myrow['DisplayName']) ) + { + $content['ISERROR'] = true; + $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_SEARCH_ERROR_IDNOTFOUND'], $content['SEARCHID'] ); + } + + // --- 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_SEARCH_WARNDELETESEARCH'], $myrow['DisplayName'] ), $content['LN_DELETEYES'], $content['LN_DELETENO'] ); + } + // --- + + // do the delete! + $result = DB_Query( "DELETE FROM " . DB_SEARCHES . " WHERE ID = " . $content['SEARCHID'] ); + if ($result == FALSE) + { + $content['ISERROR'] = true; + $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_SEARCH_ERROR_DELSEARCH'], $content['SEARCHID'] ); + } + else + DB_FreeQuery($result); + + // Do the final redirect + RedirectResult( GetAndReplaceLangStr( $content['LN_SEARCH_ERROR_HASBEENDEL'], $myrow['DisplayName'] ) , "searches.php" ); + } + else + { + $content['ISERROR'] = true; + $content['ERROR_MSG'] = $content['LN_SEARCH_ERROR_INVALIDID']; + } + } +} + +if ( isset($_POST['op']) ) +{ + if ( isset ($_POST['id']) ) { $content['SEARCHID'] = intval(DB_RemoveBadChars($_POST['id'])); } else {$content['SEARCHID'] = -1; } + if ( isset ($_POST['DisplayName']) ) { $content['DisplayName'] = DB_RemoveBadChars($_POST['DisplayName']); } else {$content['DisplayName'] = ""; } + if ( isset ($_POST['SearchQuery']) ) { $content['SearchQuery'] = DB_RemoveBadChars($_POST['SearchQuery']); } else {$content['SearchQuery'] = ""; } + + // User & Group handeled specially + if ( isset ($_POST['isuseronly']) ) + { + $content['userid'] = $content['SESSION_USERID']; + $content['groupid'] = "null"; // Either user or group not both! + } + else + { + $content['userid'] = "null"; + if ( isset ($_POST['groupid']) && $_POST['groupid'] != -1 ) + $content['groupid'] = intval($_POST['groupid']); + else + $content['groupid'] = "null"; + } + + // --- Check mandotary values + if ( $content['DisplayName'] == "" ) + { + $content['ISERROR'] = true; + $content['ERROR_MSG'] = $content['LN_SEARCH_ERROR_DISPLAYNAMEEMPTY']; + } + else if ( $content['SearchQuery'] == "" ) + { + $content['ISERROR'] = true; + $content['ERROR_MSG'] = $content['LN_SEARCH_ERROR_SEARCHQUERYEMPTY']; + } + // --- + + if ( !isset($content['ISERROR']) ) + { + // Everything was alright, so we go to the next step! + if ( $_POST['op'] == "addnewsearch" ) + { + // Add custom search now! + $sqlquery = "INSERT INTO " . DB_SEARCHES . " (DisplayName, SearchQuery, userid, groupid) + VALUES ('" . $content['DisplayName'] . "', + '" . $content['SearchQuery'] . "', + " . $content['userid'] . ", + " . $content['groupid'] . " + )"; + $result = DB_Query($sqlquery); + DB_FreeQuery($result); + + // Do the final redirect + RedirectResult( GetAndReplaceLangStr( $content['LN_SEARCH_HASBEENADDED'], $content['DisplayName'] ) , "searches.php" ); + } + else if ( $_POST['op'] == "editsearch" ) + { + $result = DB_Query("SELECT ID FROM " . DB_SEARCHES . " WHERE ID = " . $content['SEARCHID']); + $myrow = DB_GetSingleRow($result, true); + if ( !isset($myrow['ID']) ) + { + $content['ISERROR'] = true; + $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_SEARCH_ERROR_IDNOTFOUND'], $content['SEARCHID'] ); + } + else + { + // Edit the Search Entry now! + $result = DB_Query("UPDATE " . DB_SEARCHES . " SET + DisplayName = '" . $content['DisplayName'] . "', + SearchQuery = '" . $content['SearchQuery'] . "', + userid = " . $content['userid'] . ", + groupid = " . $content['groupid'] . " + WHERE ID = " . $content['SEARCHID']); + DB_FreeQuery($result); + + // Done redirect! + RedirectResult( GetAndReplaceLangStr( $content['LN_SEARCH_HASBEENEDIT'], $content['DisplayName']) , "searches.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['FieldFromDB'] ) + { + $myField['AllowDelete'] = true; + $myField['DELETEIMG'] = $content['MENU_DELETE']; + } + + if ( !$myField['IsInternalField'] && $myField['FieldFromDB'] ) + { + $myField['AllowDelete'] = true; + $myField['DELETEIMG'] = $content['MENU_DELETE_FROMDB']; + } + + // --- 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/images/icons/data_delete.png b/src/images/icons/data_delete.png new file mode 100644 index 0000000000000000000000000000000000000000..800d48ca0df6fba2e447dc5a9ed628dc3f48e6f3 GIT binary patch literal 831 zcmV-F1Hk-=P)WdKcSAT=OOa(W;#FfcP9F*iCeF*-0cAS*C2Fffdk6>0zg00(qQO+^RR z1s4r5G~%q)kN^Mx32;bRa{vGe@Bjb`@Bu=sG?)MY00d`2O+f$vv5yPle zK~#9!eUm$E(@+$K|2VdjI%z`E7wU_K4vnA-EG($1N{hq*69XM#<{`0kU`Ogy7(k*! z%Yp=A03nbNNTn5x5Q3#5R3O?s+CWU2+HTS~iQ@;ym0hV1ai!1K@;&Fj=l=KDgM-6^ z{}1cX;K|7kXUb*eb|exU8Ms!wNlwG2d8{kY z)fJi>A0HOBw`rA@Yc(C3W}?wB{jyw&ilP*sp58o5p_hnnM0t+@!|?u83XtV3Y;Kle z80OAulD7i+hIc)ZegBm(_TwWkBHy^ex3(GxtG|#NAH}h)ABe>w=kH4g%=~Ibx-QS6w-HYVr;06m5J-c&wW`sD?n4h5GU__|gUh!AIA}Q8P8j#0;6a zI`4F$;R<=4dzs|rTPIE?7eq@knv9`djYY`B+;X?oxI3%O%)BlnlV3CWd@>`;D<#TF z5bufNj=(#Pc~uga^HW>;(@&&&kHM(`<7t}Et+cktF^Qy8APA5a) z000W>0fLJSS^xk7rb$FWRCt_y(@#i~aTo{i?;>`I2xbrzB#gQQDjr_Kxq~zW|A7OU z@J^?uw^1EDwBS{cHK(j?&aoH7d?{ow$LnEu^WVWh=VfD1Ee8%^c+rZ=DUM`*ySQP@ zIy~?ke$R*J_xte$Nn9=fn*UYB`BD=I1Rgt`&S)?g{5&%=^HrAR)2XScQ@7jwU6Q0P z0|NuGrlzJg05wbStS}mlQkG@9TrOHH7B)6E{sQn4Ky?KW4u=c5T#lQYn_OI6 zq^hc%o13H8>!l<~v|6n+8jU{ycmO>33jm-|RrUA5!2x%7cbQJ7nM@|Ryu8dvB*H)- zz>$#=noOo+0B-<1EInu$NTpJRTrS5%BEd{1!>z3?DvDCxKoms^g7EW7z+f<#1_uYv z^Z7jE@i;|M5}&O{=?SS-fb*;$T_jj^k%i+a6&3BYRr`tmmlg77I63bDVx|6CNsv(eE}x?C>y z^z@vsuC5k(dwX+rb#))As;cGzgaC*DZkGXr!LVdB8Vfp|?!88%c~?_Yld7+;&uF#U zc>r$#_yITpJO|JQ;68xsm%@iT0IUFB0k8lt0k8vj0pJOMM*#Ey?gF@VdAI~n&wO!KV09fXJg0000WdKBJATl)|MrC3kGB7YRATlyKF*7#Y%Ef4Yb=bTEIvBBq)|Z# z7NV&XtOO&v?#% zH(}^dky$L}dS8oTQDDTKERTpmi*>*j%{)0000 0 ) + { +// // Overwrite existing Charts array +// unset($CFG['Search']);$fields + + // 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) ) + { + defined($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]['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/lang/de/admin.php b/src/lang/de/admin.php index e7fb571..f611788 100644 --- a/src/lang/de/admin.php +++ b/src/lang/de/admin.php @@ -30,12 +30,13 @@ 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_SOURCEOPT'] = "Sources"; +$content['LN_ADMINMENU_VIEWSOPT'] = "Views"; +$content['LN_ADMINMENU_SEARCHOPT'] = "Searches"; $content['LN_ADMINMENU_USEROPT'] = "User Options"; $content['LN_ADMINMENU_GROUPOPT'] = "Group Options"; -$content['LN_ADMINMENU_CHARTOPT'] = "Chart Options"; +$content['LN_ADMINMENU_CHARTOPT'] = "Charts"; +$content['LN_ADMINMENU_FIELDOPT'] = "Fields"; $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."; diff --git a/src/lang/en/admin.php b/src/lang/en/admin.php index f575009..462712a 100644 --- a/src/lang/en/admin.php +++ b/src/lang/en/admin.php @@ -30,12 +30,13 @@ 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_SOURCEOPT'] = "Sources"; +$content['LN_ADMINMENU_VIEWSOPT'] = "Views"; +$content['LN_ADMINMENU_SEARCHOPT'] = "Searches"; $content['LN_ADMINMENU_USEROPT'] = "User Options"; $content['LN_ADMINMENU_GROUPOPT'] = "Group Options"; -$content['LN_ADMINMENU_CHARTOPT'] = "Chart Options"; +$content['LN_ADMINMENU_CHARTOPT'] = "Charts"; +$content['LN_ADMINMENU_FIELDOPT'] = "Fields"; $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 +261,35 @@ $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'] = "Rowwidth 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'] = "Used filtername"; +$content['LN_FIELDS_'] = ""; +$content['LN_FIELDS_'] = ""; +$content['LN_FIELDS_'] = ""; +$content['LN_FIELDS_'] = ""; +$content['LN_FIELDS_'] = ""; +$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"; ?> \ No newline at end of file diff --git a/src/lang/pt_BR/admin.php b/src/lang/pt_BR/admin.php index e7fb571..f611788 100644 --- a/src/lang/pt_BR/admin.php +++ b/src/lang/pt_BR/admin.php @@ -30,12 +30,13 @@ 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_SOURCEOPT'] = "Sources"; +$content['LN_ADMINMENU_VIEWSOPT'] = "Views"; +$content['LN_ADMINMENU_SEARCHOPT'] = "Searches"; $content['LN_ADMINMENU_USEROPT'] = "User Options"; $content['LN_ADMINMENU_GROUPOPT'] = "Group Options"; -$content['LN_ADMINMENU_CHARTOPT'] = "Chart Options"; +$content['LN_ADMINMENU_CHARTOPT'] = "Charts"; +$content['LN_ADMINMENU_FIELDOPT'] = "Fields"; $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."; diff --git a/src/templates/admin/admin_menu.html b/src/templates/admin/admin_menu.html index 51a9af5..fb33459 100644 --- a/src/templates/admin/admin_menu.html +++ b/src/templates/admin/admin_menu.html @@ -4,10 +4,11 @@ {LN_ADMINMENU_GENOPT} - {LN_ADMINMENU_SOURCEOPT} - {LN_ADMINMENU_VIEWSOPT} - {LN_ADMINMENU_SEARCHOPT} - {LN_ADMINMENU_CHARTOPT} + {LN_ADMINMENU_SOURCEOPT} + {LN_ADMINMENU_FIELDOPT} + {LN_ADMINMENU_VIEWSOPT} + {LN_ADMINMENU_SEARCHOPT} + {LN_ADMINMENU_CHARTOPT} {LN_ADMINMENU_USEROPT} 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} + + + {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 From 7a1f09726217b463a5775153fb7f709a4cb6e0f6 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Thu, 9 Oct 2008 16:53:25 +0200 Subject: [PATCH 04/14] Added custom parser for wireless logs, and made further adjustments to the new custom field code --- src/admin/fields.php | 53 ++---- .../msgparsers/msgparser.wireless.class.php | 166 ++++++++++++++++++ 2 files changed, 185 insertions(+), 34 deletions(-) create mode 100644 src/classes/msgparsers/msgparser.wireless.class.php diff --git a/src/admin/fields.php b/src/admin/fields.php index a362538..1a14ee6 100644 --- a/src/admin/fields.php +++ b/src/admin/fields.php @@ -195,7 +195,7 @@ if ( isset($_POST['op']) ) 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; } + 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 @@ -228,40 +228,25 @@ if ( isset($_POST['op']) ) $myrow = DB_GetSingleRow($result, true); if ( !isset($myrow['FieldID']) ) { -/* - if ( $_POST['op'] == "editfield" ) - { - // Show error in this case - $content['ISERROR'] = true; - $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_FIELDS_ERROR_IDNOTFOUND'], $content['FieldID'] ); - } - else -*/ - { - // 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" ); - } + // 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" ); } -/* if ( $_POST['op'] == "addnewfield" ) - { - } - else if ( $_POST['op'] == "editfield" ) -*/ + else { // Edit the Search Entry now! diff --git a/src/classes/msgparsers/msgparser.wireless.class.php b/src/classes/msgparsers/msgparser.wireless.class.php new file mode 100644 index 0000000..40947a7 --- /dev/null +++ b/src/classes/msgparsers/msgparser.wireless.class.php @@ -0,0 +1,166 @@ + 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. + * + * 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. + ********************************************************************* +*/ + +/* +* NEEDED FIELDS! + +INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_interface', 'SYSLOG_NET_INTERFACE', 'Interface', 0, 0, 100, 'center', 'net_interface', 0, 0); +INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_mac_address', 'SYSLOG_NET_MAC_ADDRESS', 'Mac Address', 0, 0, 100, 'left', 'net_mac_address', 0, 0); +INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_lastip', 'SYSLOG_NET_LASTIP', 'Last IP Address', 0, 0, 85, 'center', 'net_lastip', 1, 0); +INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_rxrate', 'SYSLOG_NET_RXRATE', 'RX Rate', 0, 0, 50, 'center', 'net_rxrate', 0, 0); +INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_txrate', 'SYSLOG_NET_TXRATE', 'TX Rate', 0, 0, 50, 'center', 'net_txrate', 0, 0); +INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_uptime', 'SYSLOG_NET_UPTIME', 'System Uptime', 0, 0, 85, 'center', 'net_uptime', 0, 0); +INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_lastactivity', 'SYSLOG_NET_LASTACTIVITY', 'Last Activity', 0, 0, 80, 'center', 'net_lastactivity', 0, 0); +INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_signalstrength', 'SYSLOG_NET_SIGNALSTRENGTH', 'Signal strength', 0, 0, 50, 'center', 'net_signalstrength', 0, 0); +INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_signaltonoise', 'SYSLOG_NET_SIGNALTONOISE', 'Signal to noise', 1, 0, 50, 'center', 'net_signaltonoise', 0, 0); +INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_txccq', 'SYSLOG_NET_TXCCQ', 'TX CCQ', 1, 0, 50, 'center', 'net_txccq', 0, 0); +INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_bytesrecieved', 'SYSLOG_NET_BYTESRECIEVED', 'Bytes recieved', 1, 0, 50, 'left', 'net_bytesrecieved', 0, 0); +INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_bytessend', 'SYSLOG_NET_BYTESSEND', 'Bytes send', 1, 0, 50, 'left', 'net_bytessend', 0, 0); +INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_packetsrecieved', 'SYSLOG_NET_PACKETSRECIEVED', 'Packets recieved', 1, 0, 50, 'left', 'net_packetsrecieved', 0, 0); +INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_packetssend', 'SYSLOG_NET_PACKETSSEND', 'Packets send', 1, 0, 50, 'left', 'net_packetssend', 0, 0); + + +*/ + +// --- 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 { +// protected $_arrProperties = null; + + // 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_SOURCE, SYSLOG_NET_INTERFACE, SYSLOG_NET_MAC_ADDRESS, SYSLOG_NET_LASTIP, SYSLOG_NET_RXRATE, SYSLOG_NET_TXRATE, SYSLOG_NET_UPTIME, SYSLOG_NET_LASTACTIVITY, SYSLOG_NET_SIGNALSTRENGTH, SYSLOG_NET_SIGNALTONOISE, SYSLOG_NET_TXCCQ, SYSLOG_NET_BYTESRECIEVED, SYSLOG_NET_BYTESSEND, SYSLOG_NET_PACKETSRECIEVED, SYSLOG_NET_PACKETSSEND ); + + 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 From 65fa6d624cc18cb58c83963bbcadcbb65c8b2662 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Thu, 9 Oct 2008 17:10:39 +0200 Subject: [PATCH 05/14] Made fields admin available to admins only --- src/admin/fields.php | 5 +++ .../msgparsers/msgparser.wireless.class.php | 12 +++---- src/lang/de/admin.php | 34 +++++++++++++++++++ src/lang/en/admin.php | 5 --- src/lang/pt_BR/admin.php | 34 +++++++++++++++++++ 5 files changed, 79 insertions(+), 11 deletions(-) diff --git a/src/admin/fields.php b/src/admin/fields.php index 1a14ee6..db91fc3 100644 --- a/src/admin/fields.php +++ b/src/admin/fields.php @@ -53,6 +53,11 @@ 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") diff --git a/src/classes/msgparsers/msgparser.wireless.class.php b/src/classes/msgparsers/msgparser.wireless.class.php index 40947a7..d88361c 100644 --- a/src/classes/msgparsers/msgparser.wireless.class.php +++ b/src/classes/msgparsers/msgparser.wireless.class.php @@ -34,15 +34,14 @@ /* * NEEDED FIELDS! - INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_interface', 'SYSLOG_NET_INTERFACE', 'Interface', 0, 0, 100, 'center', 'net_interface', 0, 0); -INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_mac_address', 'SYSLOG_NET_MAC_ADDRESS', 'Mac Address', 0, 0, 100, 'left', 'net_mac_address', 0, 0); -INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_lastip', 'SYSLOG_NET_LASTIP', 'Last IP Address', 0, 0, 85, 'center', 'net_lastip', 1, 0); -INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_rxrate', 'SYSLOG_NET_RXRATE', 'RX Rate', 0, 0, 50, 'center', 'net_rxrate', 0, 0); -INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_txrate', 'SYSLOG_NET_TXRATE', 'TX Rate', 0, 0, 50, 'center', 'net_txrate', 0, 0); +INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_mac_address', 'SYSLOG_NET_MAC_ADDRESS', 'Mac Address', 0, 0, 125, 'left', 'net_mac_address', 0, 0); +INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_lastip', 'SYSLOG_NET_LASTIP', 'Last IP Address', 0, 0, 100, 'left', 'net_lastip', 1, 0); +INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_rxrate', 'SYSLOG_NET_RXRATE', 'RX Rate', 0, 0, 65, 'center', 'net_rxrate', 0, 0); +INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_txrate', 'SYSLOG_NET_TXRATE', 'TX Rate', 0, 0, 65, 'center', 'net_txrate', 0, 0); INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_uptime', 'SYSLOG_NET_UPTIME', 'System Uptime', 0, 0, 85, 'center', 'net_uptime', 0, 0); INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_lastactivity', 'SYSLOG_NET_LASTACTIVITY', 'Last Activity', 0, 0, 80, 'center', 'net_lastactivity', 0, 0); -INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_signalstrength', 'SYSLOG_NET_SIGNALSTRENGTH', 'Signal strength', 0, 0, 50, 'center', 'net_signalstrength', 0, 0); +INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_signalstrength', 'SYSLOG_NET_SIGNALSTRENGTH', 'Signal strength', 0, 0, 100, 'center', 'net_signalstrength', 0, 0); INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_signaltonoise', 'SYSLOG_NET_SIGNALTONOISE', 'Signal to noise', 1, 0, 50, 'center', 'net_signaltonoise', 0, 0); INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_txccq', 'SYSLOG_NET_TXCCQ', 'TX CCQ', 1, 0, 50, 'center', 'net_txccq', 0, 0); INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_bytesrecieved', 'SYSLOG_NET_BYTESRECIEVED', 'Bytes recieved', 1, 0, 50, 'left', 'net_bytesrecieved', 0, 0); @@ -51,6 +50,7 @@ INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldTyp INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_packetssend', 'SYSLOG_NET_PACKETSSEND', 'Packets send', 1, 0, 50, 'left', 'net_packetssend', 0, 0); + */ // --- Avoid directly accessing this file! diff --git a/src/lang/de/admin.php b/src/lang/de/admin.php index f611788..e25f76d 100644 --- a/src/lang/de/admin.php +++ b/src/lang/de/admin.php @@ -252,4 +252,38 @@ $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"; + ?> \ No newline at end of file diff --git a/src/lang/en/admin.php b/src/lang/en/admin.php index c0dbfae..7828ac0 100644 --- a/src/lang/en/admin.php +++ b/src/lang/en/admin.php @@ -288,11 +288,6 @@ $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_FIELDS_'] = ""; -$content['LN_FIELDS_'] = ""; -$content['LN_FIELDS_'] = ""; -$content['LN_FIELDS_'] = ""; - $content['LN_ALIGN_CENTER'] = "center"; $content['LN_ALIGN_LEFT'] = "left"; $content['LN_ALIGN_RIGHT'] = "right"; diff --git a/src/lang/pt_BR/admin.php b/src/lang/pt_BR/admin.php index f611788..e25f76d 100644 --- a/src/lang/pt_BR/admin.php +++ b/src/lang/pt_BR/admin.php @@ -252,4 +252,38 @@ $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"; + ?> \ No newline at end of file From 5ccc5d83b384b926b65486807bb9ab4bcf95625d Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Thu, 9 Oct 2008 17:15:23 +0200 Subject: [PATCH 06/14] Fixed minor bugs --- src/classes/msgparsers/msgparser.wireless.class.php | 2 +- src/include/functions_config.php | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/classes/msgparsers/msgparser.wireless.class.php b/src/classes/msgparsers/msgparser.wireless.class.php index d88361c..1a3a8b2 100644 --- a/src/classes/msgparsers/msgparser.wireless.class.php +++ b/src/classes/msgparsers/msgparser.wireless.class.php @@ -131,7 +131,7 @@ class MsgParser_wireless extends MsgParser { $szTmpMsg = ""; // Create Field Array to prepend into msg! Reverse Order here - $myFields = array( SYSLOG_SOURCE, SYSLOG_NET_INTERFACE, SYSLOG_NET_MAC_ADDRESS, SYSLOG_NET_LASTIP, SYSLOG_NET_RXRATE, SYSLOG_NET_TXRATE, SYSLOG_NET_UPTIME, SYSLOG_NET_LASTACTIVITY, SYSLOG_NET_SIGNALSTRENGTH, SYSLOG_NET_SIGNALTONOISE, SYSLOG_NET_TXCCQ, SYSLOG_NET_BYTESRECIEVED, SYSLOG_NET_BYTESSEND, SYSLOG_NET_PACKETSRECIEVED, SYSLOG_NET_PACKETSSEND ); + $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 ) { diff --git a/src/include/functions_config.php b/src/include/functions_config.php index 0bdc1ef..1a23d18 100644 --- a/src/include/functions_config.php +++ b/src/include/functions_config.php @@ -424,9 +424,6 @@ function LoadFieldsFromDatabase() $myrows = DB_GetAllRows($result, true); if ( isset($myrows ) && count($myrows) > 0 ) { -// // Overwrite existing Charts array -// unset($CFG['Search']);$fields - // Loop through all data rows foreach ($myrows as &$myField ) { From 033120334fa75a935e3669f53aaf8c3af4e10923 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Thu, 9 Oct 2008 17:33:11 +0200 Subject: [PATCH 07/14] Added gernal filter support for custom fields. The view editor shows the internal ID now as well, to avoid confusions. --- src/admin/views.php | 8 +++++- src/classes/logstream.class.php | 43 ++++++++++++++++++++++++++-- src/templates/admin/admin_views.html | 12 +++++--- 3 files changed, 55 insertions(+), 8 deletions(-) diff --git a/src/admin/views.php b/src/admin/views.php index 98be141..2f1cffd 100644 --- a/src/admin/views.php +++ b/src/admin/views.php @@ -228,6 +228,9 @@ if ( isset($content['ISEDITORNEWVIEW']) && $content['ISEDITORNEWVIEW'] ) else $myColumn['ColCaption'] = $key; + // Append Internal FieldID + $myColumn['ColInternalID'] = $fields[$key]['FieldDefine']; + // --- Set CSS Class if ( $i % 2 == 0 ) $myColumn['colcssclass'] = "line1"; @@ -260,6 +263,9 @@ if ( isset($content['ISEDITORNEWVIEW']) && $content['ISEDITORNEWVIEW'] ) $myField['FieldCaption'] = $myField['FieldCaption']; else $myField['FieldCaption'] = $key; + + // Append Internal FieldID + $myField['FieldCaption'] .= " (" . $fields[$key]['FieldDefine'] . ")"; } // --- } @@ -547,7 +553,7 @@ if ( !isset($_POST['op']) && !isset($_GET['op']) ) $myView['COLUMNS'][$myCol]['FieldCaption'] = $fields[$myCol]['FieldCaption']; else $myView['COLUMNS'][$myCol]['FieldCaption'] = $myCol; - + if ( $iBegin ) { $myView['COLUMNS'][$myCol]['FieldCaptionSeperator'] = ""; 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/templates/admin/admin_views.html b/src/templates/admin/admin_views.html index 3c0ba98..7e2914c 100644 --- a/src/templates/admin/admin_views.html +++ b/src/templates/admin/admin_views.html @@ -65,7 +65,7 @@
- +
@@ -93,16 +93,20 @@
{LN_VIEWS_ADDEDIT}
- + - + + - - + + - - + + diff --git a/src/templates/admin/admin_parsers.html b/src/templates/admin/admin_parsers.html new file mode 100644 index 0000000..bf1ad51 --- /dev/null +++ b/src/templates/admin/admin_parsers.html @@ -0,0 +1,99 @@ + + + +

+
+
+
{LN_GEN_ERRORDETAILS}
+

{ERROR_MSG}

+
+

+ {LN_GEN_ERRORRETURNPREV} +
+

+ + +
{LN_VIEWS_COLUMNLIST}{LN_VIEWS_COLUMNLIST}
{LN_VIEWS_COLUMN} {ZAEHLER}: + {ColCaption} + {ColInternalID} + @@ -115,7 +119,7 @@
+ {LN_ADMINMENU_GENOPT}{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}
+ + + + + + +
{LN_SEARCH_CENTER}
+

+ + + + + + + + + + + + + + + + + + + +
{LN_PARSERS_ID}{LN_PARSERS_NAME}{LN_PARSERS_DESCRIPTION}{LN_PARSERS_HELP}{LN_GEN_ACTIONS}
{ID}{DisplayName}{Description} + + + + +   +   +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{LN_SEARCH_ADDEDIT}
{LN_SEARCH_NAME}
{LN_GEN_USERONLY}
{LN_GEN_USERONLY}
{LN_GEN_GROUPONLY} + +
+ + + +
+ + + +

+ +
+ + \ No newline at end of file From f13031c0911d98e043e15f39cb62c6e06789d9bf Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 10 Oct 2008 17:02:50 +0200 Subject: [PATCH 09/14] Added some icons for parser admin and made some fixes to it. --- src/admin/parsers.php | 10 +++++ .../msgparsers/msgparser.wireless.class.php | 17 ++++++- src/images/icons/gear_delete.png | Bin 0 -> 1055 bytes src/images/icons/gear_new.png | Bin 0 -> 1052 bytes src/images/icons/information2.png | Bin 0 -> 884 bytes src/include/functions_common.php | 3 ++ src/include/functions_config.php | 7 +-- src/lang/en/admin.php | 6 +-- src/templates/admin/admin_parsers.html | 42 +++++++----------- 9 files changed, 52 insertions(+), 33 deletions(-) create mode 100644 src/images/icons/gear_delete.png create mode 100644 src/images/icons/gear_new.png create mode 100644 src/images/icons/information2.png diff --git a/src/admin/parsers.php b/src/admin/parsers.php index 17d4bb9..610b276 100644 --- a/src/admin/parsers.php +++ b/src/admin/parsers.php @@ -288,6 +288,16 @@ if ( !isset($_POST['op']) && !isset($_GET['op']) ) $myParsers['ParserHelpEnabled'] = true; else $myParsers['ParserHelpEnabled'] = false; + + // Find out if we need to INIT something! + if ( isset($myParsers['CustomFieldsList']) && count($myParsers['CustomFieldsList']) > 0 ) + { + // $myParsers['CustomFieldsList']; + + $myParsers['ParserInitEnabled'] = true; + + } + // --- Set CSS Class if ( $i % 2 == 0 ) diff --git a/src/classes/msgparsers/msgparser.wireless.class.php b/src/classes/msgparsers/msgparser.wireless.class.php index 188adbd..6099847 100644 --- a/src/classes/msgparsers/msgparser.wireless.class.php +++ b/src/classes/msgparsers/msgparser.wireless.class.php @@ -73,8 +73,23 @@ class MsgParser_wireless extends MsgParser { // Public Information properties public $_ClassName = 'Custom Wireless Logfiles'; public $_ClassDescription = 'Custom logfile parser for wireless access points.'; - public $_ClassRequiredFields = null; 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" => false, "Trunscate" => false, "Sortable" => false), + "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() { diff --git a/src/images/icons/gear_delete.png b/src/images/icons/gear_delete.png new file mode 100644 index 0000000000000000000000000000000000000000..2a0f87eb9a64ab3e15c9acf36d93570e32527079 GIT binary patch literal 1055 zcmV+)1mOFLP)WdKueAT%IKVQwHYFfcSAF*!OgI65>iAS*C2FfbHbcz*x@00(qQO+^RR z1s4r65*v&It^fc432;bRa{vGe@Bjb`@Bu=sG?)MY00d`2O+f$vv5yPym6+QC{J9li|YCxwV^!EC~G|f^C4K71C99SqQA(ZUE>wOkKdGej&bb13` zzKlaABZ0x7$&asJi;&F{2nJ{J>zSEFp{wiqk@@+tCuka%6;M@GjtZ95?#tyUP%3HA z>sbheRw0+8L8nup0|`n?4X|yS2?Qal92pr-Mx!&+Xd7cLT<|*9*8VC=rP8>m1+%#r zIy-&D@Bify%TlRx=UNWe*IPM?BItA;`uh443kzeia5FNk*s?|2*WP~S%)x^@fe?~U zOkG_?)ND>h1_ys0o0@vz7sc#938QJeB(b7YYUKFW5Xx}=qM+ba-ht2O`x5i8r=z1|WoT$9 z=J9w;f*@$zZg(mci^;EV6d6E-Lg^C78j^1gSw=as2QeUWcH;$!szSVrh1)Wl9wGU6 Z@;7H;c9fF+v=jgU002ovPDHLkV1np(-je_T literal 0 HcmV?d00001 diff --git a/src/images/icons/gear_new.png b/src/images/icons/gear_new.png new file mode 100644 index 0000000000000000000000000000000000000000..8935ae669b7fa93915b59c508e0c390480a97008 GIT binary patch literal 1052 zcmV+%1mpXOP)WdKueAT%IKVQwHYFfcSAF*!OgI65>iAS*C2FfbHbcz*x@00(qQO+^RR z1s4r65*v&It^fc432;bRa{vGf5dZ)S5dnW>Uy%R+00d`2O+f$vv5yP_fMk2&T(arj%)}TIqS=gH;6dQ^y&?6_-PHWz6I$;QfyPDp2oA;QVZ)q)uI=x=^8K1AIBOH$H;kbK$qb7%x zUKj+~YVy>Vnbl_Y(<5J)K4wWWa*ZIXbc8gu4Ww*?QbRlBM9i6>z~QKAI(V?BU#n%0 zJ$VwjpUtkN(V#%*B@px@^XsMF_6n-Xg`U+wbyJW|8DS$=0#k(na=C4AyAJ?OYd}#b z)@ZaILvadOpsIV$dmL{bIKs}y%Sf>iAe4udKc2%_UeA4d<+q^OT;p;&E3~pKLnN{a zH*SpPW@m4O3x%yX8pP>*i+|ACU#B5L4p|5_h*%}s4o%;GG%!nyr-jY-VtyTjhsbJ9v zOuGn)L)r1CWdKBPATcu_Piu4_GB7YTATc;PFfuwbG9W83F)%O`hZ|)8000McNliru z)&&<0G8v3s+9m)1010qNS#tmY3lRVS3lRZ-WM7d0000DMK}|sb0I`n?{9y$E00PWO zL_t(|+FesgXcJ)=eVI-&GfCPkBu(jJ5lgMbgIHARf+${uLXYZA@z}E{2;Mw<5xhuC z?*)Y(qpe%kT)h^4V4OgDWySs&_r!Ncz9%X=B1sFFzVc|v(uAhqF>|h6`-xAl*fk1$R z;Xj7;*B@Y(Hpzj`LDwcmP8^8Nuh~#_D$R1>jYR-aBD(}Zq$F*6cL=r(#JZyBJvT)K2tI@#qOznE$*(PIXtzAP7{>;iJSHBFMbtmj>i~6{woj z5w70XM0yd|!amq)5V5F;*%D=8SuScc1Tof6M1~-5Sq2JadNjy^;bxHNjpFvDE;w8p zCQ}?{zvbw?#eq|wVwm9L%DH03(n+c7u94tKe(-_>pV$sQME$6d-DCk8ydC*hbNZZ~ z+nCdGMVG{k1Wpj)5&hI65xkemG8+ywjfO`PQRdU6EwZKJu=aAYkjfN1R7yQURfjhq zum;y7)c>;g3e8tlfkHNqt!HI=Wm%{^GSjjV>c0u_576Di!!oh-a~Hn5St{G2a%ows zB-BW=T{Mus|Af|aoy1?61Gb4aHj}Hc{97=kkXp^A_0r;*k1IB5`I6;o%WToqhGWYwI$Ug*238nIdlx?-k)aL1DrF9g}+( z9gPheYRoy@uoW9Mv$TJ=9#gA>=C_aajxEVvC*2L9MnL=joc{u!8%UV3R8k=T0000< KMNUMnLSTX?YJ>{_ literal 0 HcmV?d00001 diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 5a5c9c9..9481060 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -621,6 +621,9 @@ function InitFrontEndVariables() $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"; diff --git a/src/include/functions_config.php b/src/include/functions_config.php index 3758348..e57f543 100644 --- a/src/include/functions_config.php +++ b/src/include/functions_config.php @@ -238,12 +238,13 @@ function InitMessageParsers() if ( $tmpParser->_ClassRequiredFields != null && count($tmpParser->_ClassRequiredFields) > 0 ) { $bCustomFields = true; - $bCustomFieldList = $tmpParser->_ClassRequiredFields; + $aCustomFieldList = $tmpParser->_ClassRequiredFields; +// print_r ( $aCustomFieldList ); } else { $bCustomFields = false; - $bCustomFieldList = null; + $aCustomFieldList = null; } // Add entry to msg parser list! @@ -252,7 +253,7 @@ function InitMessageParsers() "DisplayName" => $szParserName, "Description" => $szParserDescription, "CustomFields" => $bCustomFields, - "CustomFieldsList" => $bCustomFieldList, + "CustomFieldsList" => $aCustomFieldList, "ParserHelpArticle" => $szParserHelpArticle, ); } diff --git a/src/lang/en/admin.php b/src/lang/en/admin.php index df19bd2..bad0540 100644 --- a/src/lang/en/admin.php +++ b/src/lang/en/admin.php @@ -304,9 +304,9 @@ $content['LN_PARSERS_NAME'] = "Parser Name"; $content['LN_PARSERS_DESCRIPTION'] = "Short Description"; $content['LN_PARSERS_ERROR_NOPARSERS'] = "There were no valid message parsers found in your installation. "; $content['LN_PARSERS_HELP'] = "Help"; -$content['LN_PARSERS_'] = ""; -$content['LN_PARSERS_'] = ""; -$content['LN_PARSERS_'] = ""; +$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_'] = ""; $content['LN_PARSERS_'] = ""; $content['LN_PARSERS_'] = ""; diff --git a/src/templates/admin/admin_parsers.html b/src/templates/admin/admin_parsers.html index bf1ad51..dcfce79 100644 --- a/src/templates/admin/admin_parsers.html +++ b/src/templates/admin/admin_parsers.html @@ -27,29 +27,35 @@ {LN_PARSERS_ID} {LN_PARSERS_NAME} {LN_PARSERS_DESCRIPTION} - {LN_PARSERS_HELP} - {LN_GEN_ACTIONS} + {LN_GEN_ACTIONS} {ID} {DisplayName} {Description} - - - - + + + + -   -   + + + + +   + + +   + - +
@@ -63,22 +69,6 @@ - - - - - - - - - -
{LN_GEN_USERONLY}
{LN_GEN_USERONLY}
{LN_GEN_GROUPONLY} - -
@@ -88,7 +78,7 @@
- +

From 9cb82feb19051b704e9ef7a2dc060fe0771227f5 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 10 Oct 2008 17:50:00 +0200 Subject: [PATCH 10/14] Added support to add and remove custom fields from the message parsers --- src/admin/parsers.php | 370 +++++++++--------- .../msgparsers/msgparser.wireless.class.php | 23 +- src/include/functions_config.php | 16 +- src/lang/en/admin.php | 25 +- src/templates/admin/admin_parsers.html | 68 ++-- 5 files changed, 242 insertions(+), 260 deletions(-) diff --git a/src/admin/parsers.php b/src/admin/parsers.php index 610b276..10f8317 100644 --- a/src/admin/parsers.php +++ b/src/admin/parsers.php @@ -53,257 +53,237 @@ 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'] == "add") - { - // Set Mode to add - $content['ISEDITORNEWSEARCH'] = "true"; - $content['SEARCH_FORMACTION'] = "addnewsearch"; - $content['SEARCH_SENDBUTTON'] = $content['LN_SEARCH_ADD']; - - //PreInit these values - $content['DisplayName'] = ""; - $content['SearchQuery'] = ""; - - // General stuff - $content['userid'] = null; - $content['CHECKED_ISUSERONLY'] = ""; - $content['SEARCHID'] = ""; - - // --- Check if groups are available - $content['SUBGROUPS'] = GetGroupsForSelectfield(); - if ( is_array($content['SUBGROUPS']) ) - $content['ISGROUPSAVAILABLE'] = true; - else - $content['ISGROUPSAVAILABLE'] = false; - } - else if ($_GET['op'] == "edit") + if ($_GET['op'] == "details") { // Set Mode to edit - $content['ISEDITORNEWSEARCH'] = "true"; - $content['SEARCH_FORMACTION'] = "editsearch"; - $content['SEARCH_SENDBUTTON'] = $content['LN_SEARCH_EDIT']; + $content['ISSHOWDETAILS'] = "true"; +// $content['SEARCH_FORMACTION'] = "editsearch"; +// $content['SEARCH_SENDBUTTON'] = $content['LN_SEARCH_EDIT']; if ( isset($_GET['id']) ) { //PreInit these values - $content['SEARCHID'] = DB_RemoveBadChars($_GET['id']); - - $sqlquery = "SELECT * " . - " FROM " . DB_SEARCHES . - " WHERE ID = " . $content['SEARCHID']; - - $result = DB_Query($sqlquery); - $mysearch = DB_GetSingleRow($result, true); - if ( isset($mysearch['DisplayName']) ) + $content['ParserID'] = DB_RemoveBadChars($_GET['id']); + if ( isset($content['PARSERS'][ $content['ParserID'] ]) ) { - $content['SEARCHID'] = $mysearch['ID']; - $content['DisplayName'] = $mysearch['DisplayName']; - $content['SearchQuery'] = $mysearch['SearchQuery']; - if ( $mysearch['userid'] != null ) - $content['CHECKED_ISUSERONLY'] = "checked"; - else - $content['CHECKED_ISUSERONLY'] = ""; + // Get Reference to parser! + $myParser = $content['PARSERS'][ $content['ParserID'] ]; + + $content['DisplayName'] = $myParser['DisplayName']; + $content['Description'] = $myParser['Description']; - // --- Check if groups are available - $content['SUBGROUPS'] = GetGroupsForSelectfield(); - if ( is_array($content['SUBGROUPS']) ) + if ( strlen($myParser['ParserHelpArticle']) > 0 ) { - // Process All Groups - for($i = 0; $i < count($content['SUBGROUPS']); $i++) + $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 ) { - if ( $mysearch['groupid'] != null && $content['SUBGROUPS'][$i]['mygroupid'] == $mysearch['groupid'] ) - $content['SUBGROUPS'][$i]['group_selected'] = "selected"; + // check if field is in define list! + if ( !array_key_exists($myField['FieldID'], $fields) ) + { + $content['ParserInitEnabled'] = true; + break; + } else - $content['SUBGROUPS'][$i]['group_selected'] = ""; + { + $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++; + } } - // Enable Group Selection - $content['ISGROUPSAVAILABLE'] = true; + // Do the final redirect + RedirectResult( GetAndReplaceLangStr( $content['LN_PARSERS_ERROR_HASBEENREMOVED'], $myParser['DisplayName'], $deletedFields ) , "parsers.php" ); } else - $content['ISGROUPSAVAILABLE'] = false; - // --- - } - else - { - $content['ISEDITORNEWSEARCH'] = false; - $content['ISERROR'] = true; - $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_SEARCH_ERROR_IDNOTFOUND'], $content['SEARCHID'] ); + { + $content['ISERROR'] = true; + $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_PARSERS_ERROR_NOFIELDS'], $content['ParserID'] ); + } } } else { - $content['ISEDITORNEWSEARCH'] = false; $content['ISERROR'] = true; - $content['ERROR_MSG'] = $content['LN_SEARCH_ERROR_INVALIDID']; + $content['ERROR_MSG'] = $content['LN_PARSERS_ERROR_INVALIDID']; } } - else if ($_GET['op'] == "delete") + else if ($_GET['op'] == "initparser") { if ( isset($_GET['id']) ) { //PreInit these values - $content['SEARCHID'] = DB_RemoveBadChars($_GET['id']); - - // Get UserInfo - $result = DB_Query("SELECT DisplayName FROM " . DB_SEARCHES . " WHERE ID = " . $content['SEARCHID'] ); - $myrow = DB_GetSingleRow($result, true); - if ( !isset($myrow['DisplayName']) ) + $content['ParserID'] = DB_RemoveBadChars($_GET['id']); + if ( isset($content['PARSERS'][ $content['ParserID'] ]) ) { - $content['ISERROR'] = true; - $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_SEARCH_ERROR_IDNOTFOUND'], $content['SEARCHID'] ); - } + // 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_SEARCH_WARNDELETESEARCH'], $myrow['DisplayName'] ), $content['LN_DELETEYES'], $content['LN_DELETENO'] ); - } - // --- + // check for custom fields + if ( isset($myParser['CustomFieldsList']) && count($myParser['CustomFieldsList']) > 0 ) + { + // Helper counter + $addedFields = 0; - // do the delete! - $result = DB_Query( "DELETE FROM " . DB_SEARCHES . " WHERE ID = " . $content['SEARCHID'] ); - if ($result == FALSE) - { - $content['ISERROR'] = true; - $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_SEARCH_ERROR_DELSEARCH'], $content['SEARCHID'] ); + // 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 - DB_FreeQuery($result); - - // Do the final redirect - RedirectResult( GetAndReplaceLangStr( $content['LN_SEARCH_ERROR_HASBEENDEL'], $myrow['DisplayName'] ) , "searches.php" ); + { + $content['ISERROR'] = true; + $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_PARSERS_ERROR_IDNOTFOUND'], $content['ParserID'] ); + } } else { $content['ISERROR'] = true; - $content['ERROR_MSG'] = $content['LN_SEARCH_ERROR_INVALIDID']; - } - } -} - -if ( isset($_POST['op']) ) -{ - if ( isset ($_POST['id']) ) { $content['SEARCHID'] = intval(DB_RemoveBadChars($_POST['id'])); } else {$content['SEARCHID'] = -1; } - if ( isset ($_POST['DisplayName']) ) { $content['DisplayName'] = DB_RemoveBadChars($_POST['DisplayName']); } else {$content['DisplayName'] = ""; } - if ( isset ($_POST['SearchQuery']) ) { $content['SearchQuery'] = DB_RemoveBadChars($_POST['SearchQuery']); } else {$content['SearchQuery'] = ""; } - - // User & Group handeled specially - if ( isset ($_POST['isuseronly']) ) - { - $content['userid'] = $content['SESSION_USERID']; - $content['groupid'] = "null"; // Either user or group not both! - } - else - { - $content['userid'] = "null"; - if ( isset ($_POST['groupid']) && $_POST['groupid'] != -1 ) - $content['groupid'] = intval($_POST['groupid']); - else - $content['groupid'] = "null"; - } - - // --- Check mandotary values - if ( $content['DisplayName'] == "" ) - { - $content['ISERROR'] = true; - $content['ERROR_MSG'] = $content['LN_SEARCH_ERROR_DISPLAYNAMEEMPTY']; - } - else if ( $content['SearchQuery'] == "" ) - { - $content['ISERROR'] = true; - $content['ERROR_MSG'] = $content['LN_SEARCH_ERROR_SEARCHQUERYEMPTY']; - } - // --- - - if ( !isset($content['ISERROR']) ) - { - // Everything was alright, so we go to the next step! - if ( $_POST['op'] == "addnewsearch" ) - { - // Add custom search now! - $sqlquery = "INSERT INTO " . DB_SEARCHES . " (DisplayName, SearchQuery, userid, groupid) - VALUES ('" . $content['DisplayName'] . "', - '" . $content['SearchQuery'] . "', - " . $content['userid'] . ", - " . $content['groupid'] . " - )"; - $result = DB_Query($sqlquery); - DB_FreeQuery($result); - - // Do the final redirect - RedirectResult( GetAndReplaceLangStr( $content['LN_SEARCH_HASBEENADDED'], $content['DisplayName'] ) , "searches.php" ); - } - else if ( $_POST['op'] == "editsearch" ) - { - $result = DB_Query("SELECT ID FROM " . DB_SEARCHES . " WHERE ID = " . $content['SEARCHID']); - $myrow = DB_GetSingleRow($result, true); - if ( !isset($myrow['ID']) ) - { - $content['ISERROR'] = true; - $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_SEARCH_ERROR_IDNOTFOUND'], $content['SEARCHID'] ); - } - else - { - // Edit the Search Entry now! - $result = DB_Query("UPDATE " . DB_SEARCHES . " SET - DisplayName = '" . $content['DisplayName'] . "', - SearchQuery = '" . $content['SearchQuery'] . "', - userid = " . $content['userid'] . ", - groupid = " . $content['groupid'] . " - WHERE ID = " . $content['SEARCHID']); - DB_FreeQuery($result); - - // Done redirect! - RedirectResult( GetAndReplaceLangStr( $content['LN_SEARCH_HASBEENEDIT'], $content['DisplayName']) , "searches.php" ); - } + $content['ERROR_MSG'] = $content['LN_PARSERS_ERROR_INVALIDID']; } } } +// Default mode! if ( !isset($_POST['op']) && !isset($_GET['op']) ) { - // Default Mode = List Searches - $content['LISTPARSERS'] = "true"; - - // Init List of Parsers - InitMessageParsers(); -// $content['PARSERS'] = $content['Search']; - if ( isset($content['PARSERS']) ) { - $i = 0; // Help counter! - foreach ($content['PARSERS'] as &$myParsers ) - { - // $mySearch['SearchQuery_Display'] = strlen($mySearch['SearchQuery']) > 25 ? substr($mySearch['SearchQuery'], 0, 25) . " ..." : $mySearch['SearchQuery']; + // Default Mode = List Searches + $content['LISTPARSERS'] = "true"; - // Allow EDIT - // $mySearch['ActionsAllowed'] = true; - + $i = 0; // Help counter! + foreach ($content['PARSERS'] as &$myParser ) + { // Set if help link is enabled - if ( strlen($myParsers['ParserHelpArticle']) > 0 ) - $myParsers['ParserHelpEnabled'] = true; + if ( strlen($myParser['ParserHelpArticle']) > 0 ) + $myParser['ParserHelpEnabled'] = true; else - $myParsers['ParserHelpEnabled'] = false; + $myParser['ParserHelpEnabled'] = false; // Find out if we need to INIT something! - if ( isset($myParsers['CustomFieldsList']) && count($myParsers['CustomFieldsList']) > 0 ) + if ( isset($myParser['CustomFieldsList']) && count($myParser['CustomFieldsList']) > 0 ) { - // $myParsers['CustomFieldsList']; - - $myParsers['ParserInitEnabled'] = true; - + 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 ) - $myParsers['cssclass'] = "line1"; + $myParser['cssclass'] = "line1"; else - $myParsers['cssclass'] = "line2"; + $myParser['cssclass'] = "line2"; $i++; // --- } diff --git a/src/classes/msgparsers/msgparser.wireless.class.php b/src/classes/msgparsers/msgparser.wireless.class.php index 6099847..3895c25 100644 --- a/src/classes/msgparsers/msgparser.wireless.class.php +++ b/src/classes/msgparsers/msgparser.wireless.class.php @@ -30,27 +30,6 @@ * A copy of the GPL can be found in the file "COPYING" in this * distribution. ********************************************************************* -*/ - -/* -* NEEDED FIELDS! -INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_interface', 'SYSLOG_NET_INTERFACE', 'Interface', 0, 0, 100, 'center', 'net_interface', 0, 0); -INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_mac_address', 'SYSLOG_NET_MAC_ADDRESS', 'Mac Address', 0, 0, 125, 'left', 'net_mac_address', 0, 0); -INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_lastip', 'SYSLOG_NET_LASTIP', 'Last IP Address', 0, 0, 100, 'left', 'net_lastip', 1, 0); -INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_rxrate', 'SYSLOG_NET_RXRATE', 'RX Rate', 0, 0, 65, 'center', 'net_rxrate', 0, 0); -INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_txrate', 'SYSLOG_NET_TXRATE', 'TX Rate', 0, 0, 65, 'center', 'net_txrate', 0, 0); -INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_uptime', 'SYSLOG_NET_UPTIME', 'System Uptime', 0, 0, 85, 'center', 'net_uptime', 0, 0); -INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_lastactivity', 'SYSLOG_NET_LASTACTIVITY', 'Last Activity', 0, 0, 80, 'center', 'net_lastactivity', 0, 0); -INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_signalstrength', 'SYSLOG_NET_SIGNALSTRENGTH', 'Signal strength', 0, 0, 100, 'center', 'net_signalstrength', 0, 0); -INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_signaltonoise', 'SYSLOG_NET_SIGNALTONOISE', 'Signal to noise', 1, 0, 50, 'center', 'net_signaltonoise', 0, 0); -INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_txccq', 'SYSLOG_NET_TXCCQ', 'TX CCQ', 1, 0, 50, 'center', 'net_txccq', 0, 0); -INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_bytesrecieved', 'SYSLOG_NET_BYTESRECIEVED', 'Bytes recieved', 1, 0, 50, 'left', 'net_bytesrecieved', 0, 0); -INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_bytessend', 'SYSLOG_NET_BYTESSEND', 'Bytes send', 1, 0, 50, 'left', 'net_bytessend', 0, 0); -INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_packetsrecieved', 'SYSLOG_NET_PACKETSRECIEVED', 'Packets recieved', 1, 0, 50, 'left', 'net_packetsrecieved', 0, 0); -INSERT INTO `logcon_fields` (`FieldID`, `FieldDefine`, `FieldCaption`, `FieldType`, `Sortable`, `DefaultWidth`, `FieldAlign`, `SearchField`, `SearchOnline`, `Trunscate`) VALUES ('net_packetssend', 'SYSLOG_NET_PACKETSSEND', 'Packets send', 1, 0, 50, 'left', 'net_packetssend', 0, 0); - - - */ // --- Avoid directly accessing this file! @@ -75,7 +54,7 @@ class MsgParser_wireless extends MsgParser { 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" => false, "Trunscate" => false, "Sortable" => false), + "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), diff --git a/src/include/functions_config.php b/src/include/functions_config.php index e57f543..4c74d6c 100644 --- a/src/include/functions_config.php +++ b/src/include/functions_config.php @@ -248,14 +248,14 @@ function InitMessageParsers() } // Add entry to msg parser list! - $content['PARSERS'][] = array ( - "ID" => $myParserID, - "DisplayName" => $szParserName, - "Description" => $szParserDescription, - "CustomFields" => $bCustomFields, - "CustomFieldsList" => $aCustomFieldList, - "ParserHelpArticle" => $szParserHelpArticle, - ); + $content['PARSERS'][$myParserID] = array ( + "ID" => $myParserID, + "DisplayName" => $szParserName, + "Description" => $szParserDescription, + "CustomFields" => $bCustomFields, + "CustomFieldsList" => $aCustomFieldList, + "ParserHelpArticle" => $szParserHelpArticle, + ); } else { diff --git a/src/lang/en/admin.php b/src/lang/en/admin.php index bad0540..b292ca3 100644 --- a/src/lang/en/admin.php +++ b/src/lang/en/admin.php @@ -299,24 +299,23 @@ $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'] = "Parser ID"; -$content['LN_PARSERS_NAME'] = "Parser Name"; -$content['LN_PARSERS_DESCRIPTION'] = "Short Description"; +$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_'] = ""; -$content['LN_PARSERS_'] = ""; -$content['LN_PARSERS_'] = ""; -$content['LN_PARSERS_'] = ""; -$content['LN_PARSERS_'] = ""; -$content['LN_PARSERS_'] = ""; -$content['LN_PARSERS_'] = ""; -$content['LN_PARSERS_'] = ""; -$content['LN_PARSERS_'] = ""; -$content['LN_PARSERS_'] = ""; +$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_'] = ""; $content['LN_PARSERS_'] = ""; $content['LN_PARSERS_'] = ""; diff --git a/src/templates/admin/admin_parsers.html b/src/templates/admin/admin_parsers.html index dcfce79..aa5a983 100644 --- a/src/templates/admin/admin_parsers.html +++ b/src/templates/admin/admin_parsers.html @@ -56,30 +56,54 @@ -
- - - - - - - - - - - - - - - -
{LN_SEARCH_ADDEDIT}
{LN_SEARCH_NAME}
{LN_GEN_USERONLY}
- - - -
-
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{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}

From dfb2e2b7b8ae9957f5276ad290157f64e419a263 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 10 Oct 2008 17:56:39 +0200 Subject: [PATCH 11/14] Fixed typo in language file --- src/lang/de/main.php | 2 +- src/lang/en/main.php | 2 +- src/lang/pt_BR/main.php | 2 +- src/templates/admin/admin_parsers.html | 5 +++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lang/de/main.php b/src/lang/de/main.php index 6c3a662..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'"; diff --git a/src/lang/en/main.php b/src/lang/en/main.php index 0ad0aee..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"; diff --git a/src/lang/pt_BR/main.php b/src/lang/pt_BR/main.php index 97ab3d9..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'"; diff --git a/src/templates/admin/admin_parsers.html b/src/templates/admin/admin_parsers.html index aa5a983..a37f06f 100644 --- a/src/templates/admin/admin_parsers.html +++ b/src/templates/admin/admin_parsers.html @@ -100,10 +100,11 @@ -

- {LN_GEN_ERRORRETURNPREV} + {LN_GEN_ERRORRETURNPREV} + +

From a43370e38f016ab187feb6b46fbbb60e50dca4f4 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 10 Oct 2008 17:57:29 +0200 Subject: [PATCH 12/14] Fixed another typo --- src/templates/admin/admin_parsers.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/templates/admin/admin_parsers.html b/src/templates/admin/admin_parsers.html index a37f06f..95d709a 100644 --- a/src/templates/admin/admin_parsers.html +++ b/src/templates/admin/admin_parsers.html @@ -15,7 +15,7 @@ - + - +
{LN_SEARCH_CENTER}{LN_ADMINMENU_MSGPARSERSOPT}
From 86f31171823682ce8e2568d82ac05b46d3752b9c Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 10 Oct 2008 18:00:09 +0200 Subject: [PATCH 13/14] Fixed link in parser admin template --- src/lang/de/admin.php | 22 ++++++++++++++++++++++ src/lang/en/admin.php | 3 --- src/lang/pt_BR/admin.php | 22 ++++++++++++++++++++++ src/templates/admin/admin_parsers.html | 2 +- 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/lang/de/admin.php b/src/lang/de/admin.php index de4dbe1..4905f71 100644 --- a/src/lang/de/admin.php +++ b/src/lang/de/admin.php @@ -287,4 +287,26 @@ $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/admin.php b/src/lang/en/admin.php index b292ca3..2a488f6 100644 --- a/src/lang/en/admin.php +++ b/src/lang/en/admin.php @@ -317,9 +317,6 @@ $content['LN_PARSERS_ERROR_HASBEENREMOVED'] = "All settings ('%2' custom fields) $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_'] = ""; -$content['LN_PARSERS_'] = ""; -$content['LN_PARSERS_'] = ""; -$content['LN_PARSERS_'] = ""; ?> \ No newline at end of file diff --git a/src/lang/pt_BR/admin.php b/src/lang/pt_BR/admin.php index de4dbe1..4905f71 100644 --- a/src/lang/pt_BR/admin.php +++ b/src/lang/pt_BR/admin.php @@ -287,4 +287,26 @@ $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/templates/admin/admin_parsers.html b/src/templates/admin/admin_parsers.html index 95d709a..c24195e 100644 --- a/src/templates/admin/admin_parsers.html +++ b/src/templates/admin/admin_parsers.html @@ -32,7 +32,7 @@
{ID}{DisplayName}{DisplayName} {Description} From 9c766f7c9c57f2ee25067f8acf178605751671f5 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 10 Oct 2008 18:06:47 +0200 Subject: [PATCH 14/14] Added changelog entry --- ChangeLog | 11 ++++++++++ .../msgparsers/msgparser.wireless.class.php | 20 +------------------ src/include/functions_common.php | 2 +- 3 files changed, 13 insertions(+), 20 deletions(-) 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/classes/msgparsers/msgparser.wireless.class.php b/src/classes/msgparsers/msgparser.wireless.class.php index 3895c25..87a05bb 100644 --- a/src/classes/msgparsers/msgparser.wireless.class.php +++ b/src/classes/msgparsers/msgparser.wireless.class.php @@ -10,25 +10,7 @@ * * * 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. + * Copyright (C) 2008 Adiscon GmbH ********************************************************************* */ diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 9481060..ebc287a 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -66,7 +66,7 @@ $LANG_EN = "en"; // Used for fallback $LANG = "en"; // Default language // Default Template vars -$content['BUILDNUMBER'] = "2.5.13"; +$content['BUILDNUMBER'] = "2.5.14"; $content['TITLE'] = "phpLogCon :: Release " . $content['BUILDNUMBER']; // Default page title $content['BASEPATH'] = $gl_root_path; $content['SHOW_DONATEBUTTON'] = true; // Default = true!