diff --git a/src/admin/sources.php b/src/admin/sources.php index 43d7231..335da6c 100644 --- a/src/admin/sources.php +++ b/src/admin/sources.php @@ -65,6 +65,7 @@ if ( isset($_GET['op']) ) //PreInit these values $content['Name'] = ""; + $content['Description'] = ""; $content['SourceType'] = SOURCE_DISK; CreateSourceTypesList($content['SourceType']); $content['MsgParserList'] = ""; @@ -132,6 +133,7 @@ if ( isset($_GET['op']) ) // Copy basic properties $content['Name'] = $mysource['Name']; + $content['Description'] = $mysource['Description']; $content['SourceType'] = $mysource['SourceType']; CreateSourceTypesList($content['SourceType']); $content['MsgParserList'] = $mysource['MsgParserList']; @@ -267,6 +269,7 @@ if ( isset($_POST['op']) ) // Read parameters first! if ( isset($_POST['id']) ) { $content['SOURCEID'] = intval(DB_RemoveBadChars($_POST['id'])); } else {$content['SOURCEID'] = -1; } if ( isset($_POST['Name']) ) { $content['Name'] = DB_RemoveBadChars($_POST['Name']); } else {$content['Name'] = ""; } + if ( isset($_POST['Description']) ) { $content['Description'] = DB_RemoveBadChars($_POST['Description']); } else {$content['Description'] = ""; } if ( isset($_POST['SourceType']) ) { $content['SourceType'] = DB_RemoveBadChars($_POST['SourceType']); } if ( isset($_POST['MsgParserList']) ) { $content['MsgParserList'] = DB_RemoveBadChars($_POST['MsgParserList']); } if ( isset($_POST['MsgNormalize']) ) { $content['MsgNormalize'] = intval(DB_RemoveBadChars($_POST['MsgNormalize'])); } else {$content['MsgNormalize'] = 0; } @@ -419,6 +422,7 @@ if ( isset($_POST['op']) ) // First create a tmp source array $tmpSource['ID'] = $content['SOURCEID']; $tmpSource['Name'] = $content['Name']; + $tmpSource['Description'] = $content['Description']; $tmpSource['SourceType'] = $content['SourceType']; $tmpSource['MsgParserList'] = $content['MsgParserList']; $tmpSource['MsgNormalize'] = $content['MsgNormalize']; @@ -469,8 +473,9 @@ if ( isset($_POST['op']) ) // Add custom search now! if ( $content['SourceType'] == SOURCE_DISK ) { - $sqlquery = "INSERT INTO " . DB_SOURCES . " (Name, SourceType, MsgParserList, MsgNormalize, ViewID, LogLineType, DiskFile, userid, groupid) + $sqlquery = "INSERT INTO " . DB_SOURCES . " (Name, Description, SourceType, MsgParserList, MsgNormalize, ViewID, LogLineType, DiskFile, userid, groupid) VALUES ('" . $content['Name'] . "', + '" . $content['Description'] . "', " . $content['SourceType'] . ", '" . $content['MsgParserList'] . "', " . $content['MsgNormalize'] . ", @@ -483,8 +488,9 @@ if ( isset($_POST['op']) ) } else if ( $content['SourceType'] == SOURCE_DB || $content['SourceType'] == SOURCE_PDO ) { - $sqlquery = "INSERT INTO " . DB_SOURCES . " (Name, SourceType, MsgParserList, MsgNormalize, ViewID, DBTableType, DBType, DBServer, DBName, DBUser, DBPassword, DBTableName, DBEnableRowCounting, userid, groupid) + $sqlquery = "INSERT INTO " . DB_SOURCES . " (Name, Description, SourceType, MsgParserList, MsgNormalize, ViewID, DBTableType, DBType, DBServer, DBName, DBUser, DBPassword, DBTableName, DBEnableRowCounting, userid, groupid) VALUES ('" . $content['Name'] . "', + '" . $content['Description'] . "', " . $content['SourceType'] . ", '" . $content['MsgParserList'] . "', " . $content['MsgNormalize'] . ", @@ -524,6 +530,7 @@ if ( isset($_POST['op']) ) { $sqlquery = "UPDATE " . DB_SOURCES . " SET Name = '" . $content['Name'] . "', + Description = '" . $content['Description'] . "', SourceType = " . $content['SourceType'] . ", MsgParserList = '" . $content['MsgParserList'] . "', MsgNormalize = " . $content['MsgNormalize'] . ", @@ -538,6 +545,7 @@ if ( isset($_POST['op']) ) { $sqlquery = "UPDATE " . DB_SOURCES . " SET Name = '" . $content['Name'] . "', + Description = '" . $content['Description'] . "', SourceType = " . $content['SourceType'] . ", MsgParserList = '" . $content['MsgParserList'] . "', MsgNormalize = " . $content['MsgNormalize'] . ", diff --git a/src/include/config.sample.php b/src/include/config.sample.php index a453468..b7a606c 100644 --- a/src/include/config.sample.php +++ b/src/include/config.sample.php @@ -114,6 +114,7 @@ $CFG['Charts'][] = array ( "DisplayName" => "Usage by Day", "chart_type" => CHAR /* Example for DiskType Source: $CFG['Sources']['Source1']['ID'] = "Source1"; $CFG['Sources']['Source1']['Name'] = "Syslog Disk File"; + $CFG['Sources']['Source1']['Description'] = "More details you want to see about this source"; $CFG['Sources']['Source1']['SourceType'] = SOURCE_DISK; $CFG['Sources']['Source1']['LogLineType'] = "syslog"; $CFG['Sources']['Source1']['MsgParserList'] = ""; @@ -123,6 +124,7 @@ $CFG['Charts'][] = array ( "DisplayName" => "Usage by Day", "chart_type" => CHAR $CFG['Sources']['Source2']['ID'] = "Source5"; $CFG['Sources']['Source2']['Name'] = "WinSyslog DB"; + $CFG['Sources']['Source1']['Description'] = ""; $CFG['Sources']['Source2']['SourceType'] = SOURCE_DB; $CFG['Sources']['Source1']['MsgParserList'] = ""; $CFG['Sources']['Source2']['DBTableType'] = "winsyslog"; diff --git a/src/include/db_update_v4.txt b/src/include/db_update_v4.txt new file mode 100644 index 0000000..797faf5 --- /dev/null +++ b/src/include/db_update_v4.txt @@ -0,0 +1,6 @@ +-- New Database Structure Updates +ALTER TABLE `logcon_sources` ADD `Description` TEXT NOT NULL AFTER `Name` ; + +-- Insert data + +-- Updated Data diff --git a/src/include/functions_config.php b/src/include/functions_config.php index b7b8e90..aba48a5 100644 --- a/src/include/functions_config.php +++ b/src/include/functions_config.php @@ -79,6 +79,12 @@ function InitSource(&$mysource) $CFG['Sources'][$iSourceID]['MsgNormalize'] = 0; $content['Sources'][$iSourceID]['MsgNormalize'] = 0; } + + if ( !isset($mysource['Description']) ) + { + $CFG['Sources'][$iSourceID]['Description'] = ""; + $content['Sources'][$iSourceID]['Description'] = ""; + } // --- // Set default view id to source @@ -230,6 +236,14 @@ function InitSourceConfigs() // Set for the selection box in the header $content['Sources'][$currentSourceID]['selected'] = "selected"; + // Set Description properties! + if ( isset($content['Sources'][$currentSourceID]['Description']) && strlen($content['Sources'][$currentSourceID]['Description']) > 0 ) + { + $content['SourceDescriptionEnabled'] = true; + $content['SourceDescription'] = $content['Sources'][$currentSourceID]['Description']; + } + + // --- Additional handling needed for the current view! global $currentViewID; $currentViewID = $content['Sources'][$currentSourceID]['ViewID']; diff --git a/src/include/functions_db.php b/src/include/functions_db.php index 97ab4d1..00938c7 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'] = "3"; // Whenever incremented, a database upgrade is needed +$content['database_internalversion'] = "4"; // Whenever incremented, a database upgrade is needed $content['database_installedversion'] = "0"; // 0 is default which means Prior Versioning Database // --- diff --git a/src/include/functions_installhelpers.php b/src/include/functions_installhelpers.php index 5a0882c..52353ae 100644 --- a/src/include/functions_installhelpers.php +++ b/src/include/functions_installhelpers.php @@ -192,8 +192,9 @@ function ConvertCustomSources() // Add New Entry if ( $mySource['SourceType'] == SOURCE_DISK ) { - $result = DB_Query("INSERT INTO " . DB_SOURCES . " (Name, SourceType, MsgParserList, MsgNormalize, ViewID, LogLineType, DiskFile) VALUES ( " . + $result = DB_Query("INSERT INTO " . DB_SOURCES . " (Name, Description, SourceType, MsgParserList, MsgNormalize, ViewID, LogLineType, DiskFile) VALUES ( " . "'" . PrepareValueForDB($mySource['Name']) . "', " . + "'" . PrepareValueForDB($mySource['Description']) . "', " . " " . PrepareValueForDB($mySource['SourceType']) . " , " . "'" . PrepareValueForDB($mySource['MsgParserList']) . "', " . " " . PrepareValueForDB($mySource['MsgNormalize']) . " , " . @@ -213,8 +214,9 @@ function ConvertCustomSources() $mySource['DBType'] = DB_MYSQL; // Perform the insert - $result = DB_Query("INSERT INTO " . DB_SOURCES . " (Name, SourceType, MsgParserList, MsgNormalize, ViewID, DBTableType, DBType, DBServer, DBName, DBUser, DBPassword, DBTableName, DBEnableRowCounting) VALUES ( " . + $result = DB_Query("INSERT INTO " . DB_SOURCES . " (Name, Description, SourceType, MsgParserList, MsgNormalize, ViewID, DBTableType, DBType, DBServer, DBName, DBUser, DBPassword, DBTableName, DBEnableRowCounting) VALUES ( " . "'" . PrepareValueForDB($mySource['Name']) . "', " . + "'" . PrepareValueForDB($mySource['Description']) . "', " . " " . PrepareValueForDB($mySource['SourceType']) . " , " . "'" . PrepareValueForDB($mySource['MsgParserList']) . "', " . " " . PrepareValueForDB($mySource['MsgNormalize']) . " , " . diff --git a/src/lang/de/admin.php b/src/lang/de/admin.php index f548d4b..e7fb571 100644 --- a/src/lang/de/admin.php +++ b/src/lang/de/admin.php @@ -220,7 +220,7 @@ $content['LN_SOURCES_HASBEENEDIT'] = "The Source '%1' has been successfully edit $content['LN_SOURCES_WARNDELETESEARCH'] = "Are you sure that you want to delete the Source '%1'? This cannot be undone!"; $content['LN_SOURCES_ERROR_DELSOURCE'] = "Deleting of the Source with id '%1' failed!"; $content['LN_SOURCES_ERROR_HASBEENDEL'] = "The Source '%1' has been successfully deleted!"; -$content['LN_SOURCES_'] = ""; +$content['LN_SOURCES_DESCRIPTION'] = "Source Description (Optional)"; // Database Upgrade $content['LN_DBUPGRADE_TITLE'] = "phpLogCon Database Update"; diff --git a/src/lang/en/admin.php b/src/lang/en/admin.php index 2235ada..f575009 100644 --- a/src/lang/en/admin.php +++ b/src/lang/en/admin.php @@ -221,7 +221,7 @@ $content['LN_SOURCES_HASBEENEDIT'] = "The Source '%1' has been successfully edit $content['LN_SOURCES_WARNDELETESEARCH'] = "Are you sure that you want to delete the Source '%1'? This cannot be undone!"; $content['LN_SOURCES_ERROR_DELSOURCE'] = "Deleting of the Source with id '%1' failed!"; $content['LN_SOURCES_ERROR_HASBEENDEL'] = "The Source '%1' has been successfully deleted!"; -$content['LN_SOURCES_'] = ""; +$content['LN_SOURCES_DESCRIPTION'] = "Source Description (Optional)"; // Database Upgrade $content['LN_DBUPGRADE_TITLE'] = "phpLogCon Database Update"; diff --git a/src/lang/pt_BR/admin.php b/src/lang/pt_BR/admin.php index f548d4b..e7fb571 100644 --- a/src/lang/pt_BR/admin.php +++ b/src/lang/pt_BR/admin.php @@ -220,7 +220,7 @@ $content['LN_SOURCES_HASBEENEDIT'] = "The Source '%1' has been successfully edit $content['LN_SOURCES_WARNDELETESEARCH'] = "Are you sure that you want to delete the Source '%1'? This cannot be undone!"; $content['LN_SOURCES_ERROR_DELSOURCE'] = "Deleting of the Source with id '%1' failed!"; $content['LN_SOURCES_ERROR_HASBEENDEL'] = "The Source '%1' has been successfully deleted!"; -$content['LN_SOURCES_'] = ""; +$content['LN_SOURCES_DESCRIPTION'] = "Source Description (Optional)"; // Database Upgrade $content['LN_DBUPGRADE_TITLE'] = "phpLogCon Database Update"; diff --git a/src/templates/admin/admin_sources.html b/src/templates/admin/admin_sources.html index e115955..f297449 100644 --- a/src/templates/admin/admin_sources.html +++ b/src/templates/admin/admin_sources.html @@ -102,6 +102,11 @@ {LN_SOURCES_NAME} + + {LN_SOURCES_DESCRIPTION} + + + {LN_SOURCES_TYPE} diff --git a/src/templates/index.html b/src/templates/index.html index 1e05ac3..35d7cd9 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -122,7 +122,6 @@ -
{LN_GEN_PAGE} {main_currentpagenumber} @@ -218,6 +217,14 @@
+ + + + + +
{SourceDescription}
+ +