// Everything was alright, go and check if the entry exists! $result = DB_Query("SELECT FieldID FROM " . DB_FIELDS . " WHERE FieldID = '" . $content['FieldID'] . "'"); $myrow = DB_GetSingleRow($result, true); if (!isset($myrow['FieldID'])) { // Add custom Field now! $sqlquery = "INSERT INTO " . DB_FIELDS . " (FieldID, FieldCaption, FieldDefine, SearchField, FieldAlign, DefaultWidth, FieldType, SearchOnline) \n\t\t\tVALUES (\n\t\t\t\t\t'" . $content['FieldID'] . "', \n\t\t\t\t\t'" . $content['FieldCaption'] . "',\n\t\t\t\t\t'" . $content['FieldDefine'] . "',\n\t\t\t\t\t'" . $content['SearchField'] . "',\n\t\t\t\t\t'" . $content['FieldAlign'] . "', \n\t\t\t\t\t" . $content['DefaultWidth'] . ", \n\t\t\t\t\t" . $content['FieldType'] . ", \n\t\t\t\t\t" . $content['SearchOnline'] . " \n\t\t\t\t\t)"; $result = DB_Query($sqlquery); DB_FreeQuery($result); // Do the final redirect RedirectResult(GetAndReplaceLangStr($content['LN_FIELDS_HASBEENADDED'], DB_StripSlahes($content['FieldCaption'])), "fields.php"); } else { // Edit the Search Entry now! $result = DB_Query("UPDATE " . DB_FIELDS . " SET \n\t\t\t\tFieldCaption = '" . $content['FieldCaption'] . "', \n\t\t\t\tFieldDefine = '" . $content['FieldDefine'] . "', \n\t\t\t\tSearchField = '" . $content['SearchField'] . "', \n\t\t\t\tFieldAlign = '" . $content['FieldAlign'] . "', \n\t\t\t\tDefaultWidth = " . $content['DefaultWidth'] . ", \n\t\t\t\tFieldType = " . $content['FieldType'] . ", \n\t\t\t\tSearchOnline = " . $content['SearchOnline'] . "\n\t\t\t\tWHERE FieldID = '" . $content['FieldID'] . "'"); DB_FreeQuery($result); // Done redirect! RedirectResult(GetAndReplaceLangStr($content['LN_FIELDS_HASBEENEDIT'], DB_StripSlahes($content['FieldCaption'])), "fields.php"); } } } if (!isset($_POST['op']) && !isset($_GET['op'])) { // Default Mode = List Searches $content['LISTFIELDS'] = "true"; // Copy Search array for further modifications $content['FIELDS'] = $fields; $i = 0; // Help counter! foreach ($content['FIELDS'] as &$myField) { // Allow Delete Operation if ($myField['IsInternalField'] && $myField['FieldFromDB']) { $myField['AllowDelete'] = true; $myField['DELETEIMG'] = $content['MENU_DELETE_FROMDB'];
InitPhpLogCon(); InitSourceConfigs(); InitFrontEndDefaults(); // Only in WebFrontEnd InitFilterHelpers(); // Helpers for frontend filtering! // Init admin langauge file now! IncludeLanguageFile($gl_root_path . '/lang/' . $LANG . '/admin.php'); // Configureable now! $content['REDIRSECONDS'] = GetConfigSetting("AdminChangeWaitTime", 2, CFGLEVEL_USER); // *** *** // // --- CONTENT Vars if (isset($_GET['redir'])) { $content['EXTRA_METATAGS'] = '<meta HTTP-EQUIV="REFRESH" CONTENT="' . $content['REDIRSECONDS'] . '; URL=' . urldecode($_GET['redir']) . '">'; $content['SZREDIR'] = urldecode($_GET['redir']); } else { $_GET['redir'] = "index.php"; } if (isset($_GET['msg'])) { $content['SZMSG'] = DB_StripSlahes($_GET['msg']); } else { $content['SZMSG'] = $content["LN_ADMIN_UNKNOWNSTATE"]; } $content['TITLE'] = "LogAnalyzer - Redirecting to '" . $content['SZREDIR'] . "' in " . $content['REDIRSECONDS'] . " seconds"; // Title of the Page // --- // --- Parsen and Output InitTemplateParser(); $page->parser($content, "admin/result.html"); $page->output(); // ---
DB_FreeQuery($result); // Do the final redirect RedirectResult(GetAndReplaceLangStr($content['LN_SEARCH_HASBEENADDED'], DB_StripSlahes($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 \n\t\t\t\t\tDisplayName = '" . $content['DisplayName'] . "', \n\t\t\t\t\tSearchQuery = '" . $content['SearchQuery'] . "', \n\t\t\t\t\tuserid = " . $content['userid'] . ", \n\t\t\t\t\tgroupid = " . $content['groupid'] . "\n\t\t\t\t\tWHERE ID = " . $content['SEARCHID']); DB_FreeQuery($result); // Done redirect! RedirectResult(GetAndReplaceLangStr($content['LN_SEARCH_HASBEENEDIT'], DB_StripSlahes($content['DisplayName'])), "searches.php"); } } } } } if (!isset($_POST['op']) && !isset($_GET['op'])) { // Default Mode = List Searches $content['LISTSEARCHES'] = "true"; // Copy Search array for further modifications $content['SEARCHES'] = $content['Search']; $i = 0; // Help counter! foreach ($content['SEARCHES'] as &$mySearch) { $mySearch['SearchQuery_Display'] = strlen($mySearch['SearchQuery']) > 25 ? substr($mySearch['SearchQuery'], 0, 25) . " ..." : $mySearch['SearchQuery']; // Allow EDIT
} else { if (strpos($_POST['op'], "editsavedreport") !== false) { $result = DB_Query("SELECT ID FROM " . DB_SAVEDREPORTS . " WHERE ID = " . $content['SavedReportID']); $myrow = DB_GetSingleRow($result, true); if (!isset($myrow['ID'])) { $content['ISERROR'] = true; $content['ERROR_MSG'] = GetAndReplaceLangStr($content['LN_REPORTS_ERROR_SAVEDREPORTIDNOTFOUND'], $content['SavedReportID']); } else { $sqlquery = "UPDATE " . DB_SAVEDREPORTS . " SET \n\t\t\t\t\t\t\t\t\tsourceid = " . $content['SourceID'] . ", \n\t\t\t\t\t\t\t\t\tcustomTitle = '" . $content['customTitle'] . "', \n\t\t\t\t\t\t\t\t\tcustomComment = '" . $content['customComment'] . "', \n\t\t\t\t\t\t\t\t\tfilterString = '" . $content['filterString'] . "', \n\t\t\t\t\t\t\t\t\tcustomFilters = '" . $content['customFilters'] . "', \n\t\t\t\t\t\t\t\t\toutputFormat = '" . $content['outputFormat'] . "', \n\t\t\t\t\t\t\t\t\toutputTarget = '" . $content['outputTarget'] . "', \n\t\t\t\t\t\t\t\t\toutputTargetDetails = '" . $content['outputTargetDetails'] . "', \n\t\t\t\t\t\t\t\t\tscheduleSettings = '" . $content['scheduleSettings'] . "' \n\t\t\t\t\t\t\t\t\tWHERE ID = " . $content['SavedReportID']; $result = DB_Query($sqlquery); DB_FreeQuery($result); // Done redirect! if (strpos($_POST['op'], "_return") !== false) { RedirectResult(GetAndReplaceLangStr($content['LN_REPORTS_HASBEENEDIT'], DB_StripSlahes($content['customTitle'])), "reports.php"); } else { RedirectResult(GetAndReplaceLangStr($content['LN_REPORTS_HASBEENEDIT'], DB_StripSlahes($content['customTitle'])), "reports.php" . $content['FormUrlAddOP']); } } } } } } else { $content['ISERROR'] = true; $content['ERROR_MSG'] = GetAndReplaceLangStr($content['LN_REPORTS_ERROR_IDNOTFOUND'], $content['ReportID']); } } // Default mode! if (!isset($_POST['op']) && !isset($_GET['op'])) { if (isset($content['REPORTS'])) { // Default Mode = List Searches $content['LISTREPORTS'] = "true";
// Do the final redirect RedirectResult(GetAndReplaceLangStr($content['LN_GROUP_HASBEENADDED'], DB_StripSlahes($content['groupname'])), "groups.php"); } } else { if ($_POST['op'] == "editgroup") { $result = DB_Query("SELECT ID FROM " . DB_GROUPS . " WHERE ID = " . $content['GROUPID']); $myrow = DB_GetSingleRow($result, true); if (!isset($myrow['ID'])) { $content['ISERROR'] = true; $content['ERROR_MSG'] = GetAndReplaceLangStr($content['LN_GROUP_ERROR_IDNOTFOUND'], $content['GROUPID']); } else { // Edit the User now! $result = DB_Query("UPDATE " . DB_GROUPS . " SET \n\t\t\t\t\tgroupname = '" . $content['groupname'] . "', \n\t\t\t\t\tgroupdescription = '" . $content['groupdescription'] . "'\n\t\t\t\t\tWHERE ID = " . $content['GROUPID']); DB_FreeQuery($result); // Done redirect! RedirectResult(GetAndReplaceLangStr($content['LN_GROUP_ERROR_HASBEENEDIT'], DB_StripSlahes($content['groupname'])), "groups.php"); } } else { if ($_POST['op'] == "adduser") { if (isset($_POST['userid'])) { // Copy UserID $content['USERID'] = intval(DB_RemoveBadChars($_POST['userid'])); $result = DB_Query("SELECT username FROM " . DB_USERS . " WHERE id = " . $content['USERID']); $myrow = DB_GetSingleRow($result, true); if (isset($myrow['username'])) { // Add Groupmembership now! $result = DB_Query("INSERT INTO " . DB_GROUPMEMBERS . " (groupid, userid, is_member) \n\t\t\t\t\tVALUES ( " . $content['GROUPID'] . ", \n\t\t\t\t\t\t\t " . $content['USERID'] . ", \n\t\t\t\t\t\t\t 1 )"); DB_FreeQuery($result); // Do the final redirect RedirectResult(GetAndReplaceLangStr($content['LN_GROUP_USERHASBEENADDEDGROUP'], $myrow['username'], $content['groupname']), "groups.php"); } else {
if (isset($_SESSION['SourceDBEnableRowCounting'])) { $content['SourceDBEnableRowCounting'] = $_SESSION['SourceDBEnableRowCounting']; } else { $content['SourceDBEnableRowCounting'] = "false"; } if ($content['SourceDBEnableRowCounting'] == "true") { $content['SourceDBEnableRowCounting_true'] = "checked"; $content['SourceDBEnableRowCounting_false'] = ""; } else { $content['SourceDBEnableRowCounting_true'] = ""; $content['SourceDBEnableRowCounting_false'] = "checked"; } // Check for Error Msg if (isset($_GET['errormsg'])) { $content['iserror'] = "true"; $content['errormsg'] = urldecode(DB_StripSlahes($_GET['errormsg'])); } } else { if ($content['INSTALL_STEP'] == 8) { // --- Write Config File! // Read vars if (isset($_POST['SourceType'])) { $_SESSION['SourceType'] = DB_RemoveBadChars($_POST['SourceType']); } else { RevertOneStep($content['INSTALL_STEP'] - 1, $content['LN_CFG_PARAMMISSING'] . $content['LN_CFG_SOURCETYPE']); } if (isset($_POST['SourceName'])) { $_SESSION['SourceName'] = DB_RemoveBadChars($_POST['SourceName']); } else { RevertOneStep($content['INSTALL_STEP'] - 1, $content['LN_CFG_PARAMMISSING'] . $content['LN_CFG_NAMEOFTHESOURCE']); }
$content['ERROR_MSG'] = $content['LN_USER_ERROR_PASSSHORT']; } if (!isset($content['ISERROR'])) { // Create passwordhash now :)! $content['PASSWORDHASH'] = md5($content['PASSWORD1']); // Edit the User now! $result = DB_Query("UPDATE " . DB_USERS . " SET \n\t\t\t\t\t\t\tusername = '******'USERNAME'] . "', \n\t\t\t\t\t\t\tpassword = '******'PASSWORDHASH'] . "', \n\t\t\t\t\t\t\tis_admin = " . $content['ISADMIN'] . ", \n\t\t\t\t\t\t\tis_readonly = " . $content['ISREADONLY'] . "\n\t\t\t\t\t\t\tWHERE ID = " . $content['USERID']); DB_FreeQuery($result); } } else { // Edit the User now! $result = DB_Query("UPDATE " . DB_USERS . " SET \n\t\t\t\t\t\tusername = '******'USERNAME'] . "', \n\t\t\t\t\t\tis_admin = " . $content['ISADMIN'] . ", \n\t\t\t\t\t\tis_readonly = " . $content['ISREADONLY'] . "\n\t\t\t\t\t\tWHERE ID = " . $content['USERID']); DB_FreeQuery($result); } // Done redirect! RedirectResult(GetAndReplaceLangStr($content['LN_USER_ERROR_HASBEENEDIT'], DB_StripSlahes($content['USERNAME'])), "users.php"); } } } } } if (!isset($_POST['op']) && !isset($_GET['op'])) { // Default Mode = List Users $content['LISTUSERS'] = "true"; // Set AddUsers TAB! if ($content['UserDBAuthMode'] == USERDB_AUTH_LDAP) { $content["ALLOWADDUSERS"] = "false"; } else { $content["ALLOWADDUSERS"] = "true"; } // Read all Serverentries
} else { // Report error! $content['ISEDITORNEWDBMP'] = false; $content['ISERROR'] = true; $content['ERROR_MSG'] = GetAndReplaceLangStr($content['LN_DBMP_ERROR_MISSINGFIELDNAME'], $myColKey); // Abort loop break; } } // Only perform if no error occured if (!isset($content['ISERROR'])) { // Edit the Search Entry now! $result = DB_Query("UPDATE " . DB_MAPPINGS . " SET \n\t\t\t\t\t\t\t\tDisplayName = '" . $content['DisplayName'] . "', \n\t\t\t\t\t\t\t\tMappings = '" . $content['SUBMAPPINGS'] . "' \n\t\t\t\t\t\t\t\tWHERE ID = " . $content['DBMPID']); DB_FreeQuery($result); // Done redirect! RedirectResult(GetAndReplaceLangStr($content['LN_DBMP_HASBEENEDIT'], DB_StripSlahes($content['DisplayName'])), "dbmappings.php"); } } else { $content['ISERROR'] = true; $content['ERROR_MSG'] = $content['LN_DBMP_ERROR_NOCOLUMNS']; } } } } } } } } } } }
DB_FreeQuery($result); // Do the final redirect RedirectResult(GetAndReplaceLangStr($content['LN_CHARTS_HASBEENADDED'], DB_StripSlahes($content['Name'])), "charts.php"); } else { if ($_POST['op'] == "editchart") { $result = DB_Query("SELECT ID FROM " . DB_CHARTS . " WHERE ID = " . $content['CHARTID']); $myrow = DB_GetSingleRow($result, true); if (!isset($myrow['ID'])) { $content['ISERROR'] = true; $content['ERROR_MSG'] = GetAndReplaceLangStr($content['LN_CHARTS_ERROR_IDNOTFOUND'], $content['CHARTID']); } else { $sqlquery = "UPDATE " . DB_CHARTS . " SET \n\t\t\t\t\t\t\t\tDisplayName = '" . $content['Name'] . "', \n\t\t\t\t\t\t\t\tchart_enabled = " . $content['chart_enabled'] . ", \n\t\t\t\t\t\t\t\tchart_type = " . $content['chart_type'] . ", \n\t\t\t\t\t\t\t\tchart_width = " . $content['chart_width'] . ", \n\t\t\t\t\t\t\t\tchart_field = '" . $content['chart_field'] . "',\n\t\t\t\t\t\t\t\tchart_defaultfilter = '" . $content['chart_defaultfilter'] . "',\n\t\t\t\t\t\t\t\tmaxrecords = " . $content['maxrecords'] . ", \n\t\t\t\t\t\t\t\tshowpercent = " . $content['showpercent'] . ", \n\t\t\t\t\t\t\t\tuserid = " . $content['userid'] . ", \n\t\t\t\t\t\t\t\tgroupid = " . $content['groupid'] . "\n\t\t\t\t\t\t\t\tWHERE ID = " . $content['CHARTID']; $result = DB_Query($sqlquery); DB_FreeQuery($result); // Done redirect! RedirectResult(GetAndReplaceLangStr($content['LN_CHARTS_HASBEENEDIT'], DB_StripSlahes($content['Name'])), "charts.php"); } } } } } if (!isset($_POST['op']) && !isset($_GET['op'])) { // Default Mode = List Searches $content['LISTCHARTS'] = "true"; // Copy Sources array for further modifications $content['CHARTS'] = $content['Charts']; // --- Process Sources $i = 0; // Help counter! foreach ($content['CHARTS'] as &$myChart) { // --- Set Image for Type
// Create Columnlist comma seperated! if (isset($_POST['Columns']) && is_array($_POST['Columns'])) { // Copy columns ID's unset($content['COLUMNS']); foreach ($_POST['Columns'] as $myColKey) { if (isset($content['COLUMNS'])) { $content['COLUMNS'] .= ", " . DB_RemoveBadChars($myColKey); } else { $content['COLUMNS'] = DB_RemoveBadChars($myColKey); } } // Edit the Search Entry now! $result = DB_Query("UPDATE " . DB_VIEWS . " SET \n\t\t\t\t\t\t\tDisplayName = '" . $content['DisplayName'] . "', \n\t\t\t\t\t\t\tColumns = '" . $content['COLUMNS'] . "', \n\t\t\t\t\t\t\tuserid = " . $content['userid'] . ", \n\t\t\t\t\t\t\tgroupid = " . $content['groupid'] . "\n\t\t\t\t\t\t\tWHERE ID = " . $content['VIEWID']); DB_FreeQuery($result); // Done redirect! RedirectResult(GetAndReplaceLangStr($content['LN_VIEWS_HASBEENEDIT'], DB_StripSlahes($content['DisplayName'])), "views.php"); } else { $content['ISERROR'] = true; $content['ERROR_MSG'] = $content['LN_VIEWS_ERROR_NOCOLUMNS']; } } } } } } } } } } if (!isset($_POST['op']) && !isset($_GET['op'])) { // Default Mode = List Searches
if (!isset($myrow['ID'])) { $content['ISERROR'] = true; $content['ERROR_MSG'] = GetAndReplaceLangStr($content['LN_SOURCES_ERROR_IDNOTFOUND'], $content['SOURCEID']); } else { // Edit the Search Entry now! if ($content['SourceType'] == SOURCE_DISK) { $sqlquery = "UPDATE " . DB_SOURCES . " SET \n\t\t\t\t\t\t\t\t\tName = '" . $content['Name'] . "', \n\t\t\t\t\t\t\t\t\tDescription = '" . $content['Description'] . "', \n\t\t\t\t\t\t\t\t\tSourceType = " . $content['SourceType'] . ", \n\t\t\t\t\t\t\t\t\tMsgParserList = '" . $content['MsgParserList'] . "', \n\t\t\t\t\t\t\t\t\tMsgNormalize = " . $content['MsgNormalize'] . ", \n\t\t\t\t\t\t\t\t\tMsgSkipUnparseable = " . $content['MsgSkipUnparseable'] . ", \n\t\t\t\t\t\t\t\t\tdefaultfilter = '" . $content['defaultfilter'] . "', \n\t\t\t\t\t\t\t\t\tViewID = '" . $content['SourceViewID'] . "', \n\t\t\t\t\t\t\t\t\tLogLineType = '" . $content['SourceLogLineType'] . "', \n\t\t\t\t\t\t\t\t\tDiskFile = '" . $content['SourceDiskFile'] . "', \n\t\t\t\t\t\t\t\t\tuserid = " . $content['userid'] . ", \n\t\t\t\t\t\t\t\t\tgroupid = " . $content['groupid'] . "\n\t\t\t\t\t\t\t\t\tWHERE ID = " . $content['SOURCEID']; } else { if ($content['SourceType'] == SOURCE_DB || $content['SourceType'] == SOURCE_PDO || $content['SourceType'] == SOURCE_MONGODB) { $sqlquery = "UPDATE " . DB_SOURCES . " SET \n\t\t\t\t\t\t\t\t\tName = '" . $content['Name'] . "', \n\t\t\t\t\t\t\t\t\tDescription = '" . $content['Description'] . "', \n\t\t\t\t\t\t\t\t\tSourceType = " . $content['SourceType'] . ", \n\t\t\t\t\t\t\t\t\tMsgParserList = '" . $content['MsgParserList'] . "', \n\t\t\t\t\t\t\t\t\tMsgNormalize = " . $content['MsgNormalize'] . ", \n\t\t\t\t\t\t\t\t\tMsgSkipUnparseable = " . $content['MsgSkipUnparseable'] . ", \n\t\t\t\t\t\t\t\t\tdefaultfilter = '" . $content['defaultfilter'] . "', \n\t\t\t\t\t\t\t\t\tViewID = '" . $content['SourceViewID'] . "', \n\t\t\t\t\t\t\t\t\tDBTableType = '" . $content['SourceDBTableType'] . "', \n\t\t\t\t\t\t\t\t\tDBType = " . $content['SourceDBType'] . ", \n\t\t\t\t\t\t\t\t\tDBServer = '" . $content['SourceDBServer'] . "', \n\t\t\t\t\t\t\t\t\tDBName = '" . $content['SourceDBName'] . "', \n\t\t\t\t\t\t\t\t\tDBUser = '******'SourceDBUser'] . "', \n\t\t\t\t\t\t\t\t\tDBPassword = '******'SourceDBPassword'] . "', \n\t\t\t\t\t\t\t\t\tDBTableName = '" . $content['SourceDBTableName'] . "', \n\t\t\t\t\t\t\t\t\tDBEnableRowCounting = " . $content['SourceDBEnableRowCounting'] . ", \n\t\t\t\t\t\t\t\t\tDBRecordsPerQuery = " . $content['SourceDBRecordsPerQuery'] . ", \n\t\t\t\t\t\t\t\t\tuserid = " . $content['userid'] . ", \n\t\t\t\t\t\t\t\t\tgroupid = " . $content['groupid'] . "\n\t\t\t\t\t\t\t\t\tWHERE ID = " . $content['SOURCEID']; } } $result = DB_Query($sqlquery); DB_FreeQuery($result); // Done redirect! RedirectResult(GetAndReplaceLangStr($content['LN_SOURCES_HASBEENEDIT'], DB_StripSlahes($content['Name'])), "sources.php"); } } } } } if (!isset($_POST['op']) && !isset($_GET['op'])) { // Default Mode = List Searches $content['LISTSOURCES'] = "true"; // Copy Sources array for further modifications $content['SOURCES'] = $content['Sources']; // --- Process Sources $i = 0; // Help counter! foreach ($content['SOURCES'] as &$mySource) { // --- Set Image for Type