Imported Upstream version 3.4.0

This commit is contained in:
Mario Fetka
2019-04-17 11:40:50 +02:00
parent 8b51dbf723
commit 8948a800bb
236 changed files with 48199 additions and 37546 deletions

View File

@@ -2,517 +2,539 @@
///////////////////////////////////////////////////////////////////////////////
//
// NagiosQL
//
///////////////////////////////////////////////////////////////////////////////
//
// (c) 2005-2017 by Martin Willisegger
// (c) 2005-2018 by Martin Willisegger
//
// Project : NagiosQL
// Component : Preprocessing script for content pages
// Website : http://www.nagiosql.org
// Date : $LastChangedDate: 2017-06-22 09:53:38 +0200 (Thu, 22 Jun 2017) $
// Author : $LastChangedBy: martin $
// Version : 3.3.0
// Revision : $LastChangedRevision: 5 $
// Website : https://sourceforge.net/projects/nagiosql/
// Version : 3.4.0
// GIT Repo : https://gitlab.com/wizonet/NagiosQL
//
///////////////////////////////////////////////////////////////////////////////
//
// Define common variables
// =======================
$intLineCount = 0; // Database line count
$intWriteAccessId = 0; // Write access to data id ($chkDataId)
$intReadAccessId = 0; // Read access to data id ($chkListId)
$intDataWarning = 0; // Missing data indicator
$intNoTime = 0; // Show modified time list (0=show)
$strSearchWhere = ""; // SQL WHERE addon for searching
$strSearchWhere2 = ""; // SQL WHERE addon for configuration selection list
$intLineCount = 0; // Database line count
$intWriteAccessId = 0; // Write access to data id ($chkDataId)
$intReadAccessId = 0; // Read access to data id ($chkListId)
$intDataWarning = 0; // Missing data indicator
$intNoTime = 0; // Show modified time list (0=show)
$strSearchWhere = ''; // SQL WHERE addon for searching
$strSearchWhere2 = ''; // SQL WHERE addon for configuration selection list
$chkTfValue3 = '';
$chkTfValue5 = '';
//
// Define missing variables used in this prepend file
// ==================================================
if (!isset($preTableName)) $preTableName = ""; // Predefined variable table name
if (!isset($preSearchSession)) $preSearchSession = ""; // Predefined variable search session
if (!isset($preTableName)) {
$preTableName = '';
} // Predefined variable table name
if (!isset($preSearchSession)) {
$preSearchSession = '';
} // Predefined variable search session
//
// Store some variables to content class
// =====================================
$myContentClass->intLimit = $chkLimit;
$myContentClass->intVersion = $intVersion;
$myContentClass->strBrowser = $preBrowser;
$myContentClass->intGroupAdm = $chkGroupAdm;
$myContentClass->strTableName = $preTableName;
$myContentClass->strSearchSession = $preSearchSession;
$myContentClass->intSortBy = $hidSortBy;
$myContentClass->strSortDir = $hidSortDir;
$myContentClass->intLimit = $chkLimit;
/** @var int $intVersion - defined in prepend_adm.php */
$myContentClass->intVersion = $intVersion;
$myContentClass->strBrowser = $preBrowser;
$myContentClass->intGroupAdm = $chkGroupAdm;
$myContentClass->strTableName = $preTableName;
$myContentClass->strSearchSession = $preSearchSession;
$myContentClass->intSortBy = $hidSortBy;
$myContentClass->strSortDir = $hidSortDir;
//
// Process get parameters
// ======================
$chkFromLine = isset($_GET['from_line']) ? filter_var($_GET['from_line'], FILTER_SANITIZE_NUMBER_INT) : 0;
$chkFromLine = filter_input(INPUT_GET, 'from_line', FILTER_VALIDATE_INT, array('options' => array('default' => 0)));
//
// Process post parameters
// =======================
$chkTfSearch = isset($_POST['txtSearch']) ? $_POST['txtSearch'] : ""; // Search field
$chkSelAccGr = isset($_POST['selAccGr']) ? $_POST['selAccGr']+0 : 0; // Access group
$chkSelCnfName = isset($_POST['selCnfName']) ? $_POST['selCnfName'] : ""; // Config name selection field
$chkTfSearchRaw = filter_input(INPUT_POST, 'txtSearch', FILTER_SANITIZE_STRING);
$chkSelAccGr = filter_input(INPUT_POST, 'selAccGr', FILTER_VALIDATE_INT, array('options' => array('default' => 0)));
$chkSelCnfName = filter_input(INPUT_POST, 'selCnfName', FILTER_SANITIZE_STRING);
//
$chkTfValue1 = isset($_POST['tfValue1']) ? $_POST['tfValue1'] : ""; // Common text field value
$chkTfValue2 = isset($_POST['tfValue2']) ? $_POST['tfValue2'] : ""; // Common text field value
$chkTfValue3 = isset($_POST['tfValue3']) ? $_POST['tfValue3'] : ""; // Common text field value
$chkTfValue4 = isset($_POST['tfValue4']) ? $_POST['tfValue4'] : ""; // Common text field value
$chkTfValue5 = isset($_POST['tfValue5']) ? $_POST['tfValue5'] : ""; // Common text field value
$chkTfValue6 = isset($_POST['tfValue6']) ? $_POST['tfValue6'] : ""; // Common text field value
$chkTfValue7 = isset($_POST['tfValue7']) ? $_POST['tfValue7'] : ""; // Common text field value
$chkTfValue8 = isset($_POST['tfValue8']) ? $_POST['tfValue8'] : ""; // Common text field value
$chkTfValue9 = isset($_POST['tfValue9']) ? $_POST['tfValue9'] : ""; // Common text field value
$chkTfValue10 = isset($_POST['tfValue10']) ? $_POST['tfValue10'] : ""; // Common text field value
$chkTfValue11 = isset($_POST['tfValue11']) ? $_POST['tfValue11'] : ""; // Common text field value
$chkTfValue12 = isset($_POST['tfValue12']) ? $_POST['tfValue12'] : ""; // Common text field value
$chkTfValue13 = isset($_POST['tfValue13']) ? $_POST['tfValue13'] : ""; // Common text field value
$chkTfValue14 = isset($_POST['tfValue14']) ? $_POST['tfValue14'] : ""; // Common text field value
$chkTfValue15 = isset($_POST['tfValue15']) ? $_POST['tfValue15'] : ""; // Common text field value
$chkTfValue16 = isset($_POST['tfValue16']) ? $_POST['tfValue16'] : ""; // Common text field value
$chkTfValue17 = isset($_POST['tfValue17']) ? $_POST['tfValue17'] : ""; // Common text field value
$chkTfValue18 = isset($_POST['tfValue18']) ? $_POST['tfValue18'] : ""; // Common text field value
$chkTfValue19 = isset($_POST['tfValue19']) ? $_POST['tfValue19'] : ""; // Common text field value
$chkTfValue20 = isset($_POST['tfValue20']) ? $_POST['tfValue20'] : ""; // Common text field value
$chkTfArg1 = isset($_POST['tfArg1']) ? $_POST['tfArg1'] : ""; // Common argument text field value
$chkTfArg2 = isset($_POST['tfArg2']) ? $_POST['tfArg2'] : ""; // Common argument text field value
$chkTfArg3 = isset($_POST['tfArg3']) ? $_POST['tfArg3'] : ""; // Common argument text field value
$chkTfArg4 = isset($_POST['tfArg4']) ? $_POST['tfArg4'] : ""; // Common argument text field value
$chkTfArg5 = isset($_POST['tfArg5']) ? $_POST['tfArg5'] : ""; // Common argument text field value
$chkTfArg6 = isset($_POST['tfArg6']) ? $_POST['tfArg6'] : ""; // Common argument text field value
$chkTfArg7 = isset($_POST['tfArg7']) ? $_POST['tfArg7'] : ""; // Common argument text field value
$chkTfArg8 = isset($_POST['tfArg8']) ? $_POST['tfArg8'] : ""; // Common argument text field value
$chkMselValue1 = isset($_POST['mselValue1']) ? $_POST['mselValue1'] : array(""); // Common multi select field value
$chkMselValue2 = isset($_POST['mselValue2']) ? $_POST['mselValue2'] : array(""); // Common multi select field value
$chkMselValue3 = isset($_POST['mselValue3']) ? $_POST['mselValue3'] : array(""); // Common multi select field value
$chkMselValue4 = isset($_POST['mselValue4']) ? $_POST['mselValue4'] : array(""); // Common multi select field value
$chkMselValue5 = isset($_POST['mselValue5']) ? $_POST['mselValue5'] : array(""); // Common multi select field value
$chkMselValue6 = isset($_POST['mselValue6']) ? $_POST['mselValue6'] : array(""); // Common multi select field value
$chkMselValue7 = isset($_POST['mselValue7']) ? $_POST['mselValue7'] : array(""); // Common multi select field value
$chkMselValue8 = isset($_POST['mselValue8']) ? $_POST['mselValue8'] : array(""); // Common multi select field value
$chkChbValue1 = isset($_POST['chbValue1']) ? $_POST['chbValue1']+0 : 0; // Common checkbox field value
$chkChbValue2 = isset($_POST['chbValue2']) ? $_POST['chbValue2']+0 : 0; // Common checkbox field value
$chkDatValue1 = isset($_POST['datValue1']) ? $_POST['datValue1'] : ""; // Common file selection field
$chkTaValue1 = isset($_POST['taValue1']) ? $_POST['taValue1'] : ""; // Common text area value
$chkTaFileText = isset($_POST['taFileText']) ? $_POST['taFileText'] : ""; // Common text area value for file import (not SQL)
$chkSelValue1 = isset($_POST['selValue1']) ? $_POST['selValue1']+0 : 0; // Common select field value
$chkSelValue2 = isset($_POST['selValue2']) ? $_POST['selValue2']+0 : 0; // Common select field value
$chkSelValue3 = isset($_POST['selValue3']) ? $_POST['selValue3']+0 : 0; // Common select field value
$chkSelValue4 = isset($_POST['selValue4']) ? $_POST['selValue4']+0 : 0; // Common select field value
$chkSelValue5 = isset($_POST['selValue5']) ? $_POST['selValue5']+0 : 0; // Common select field value
$chkRadValue1 = isset($_POST['radValue1']) ? $_POST['radValue1']+0 : 2; // Common radio field value
$chkRadValue2 = isset($_POST['radValue2']) ? $_POST['radValue2']+0 : 2; // Common radio field value
$chkRadValue3 = isset($_POST['radValue3']) ? $_POST['radValue3']+0 : 2; // Common radio field value
$chkRadValue4 = isset($_POST['radValue4']) ? $_POST['radValue4']+0 : 2; // Common radio field value
$chkRadValue5 = isset($_POST['radValue5']) ? $_POST['radValue5']+0 : 2; // Common radio field value
$chkRadValue6 = isset($_POST['radValue6']) ? $_POST['radValue6']+0 : 2; // Common radio field value
$chkRadValue7 = isset($_POST['radValue7']) ? $_POST['radValue7']+0 : 2; // Common radio field value
$chkRadValue8 = isset($_POST['radValue8']) ? $_POST['radValue8']+0 : 2; // Common radio field value
$chkRadValue9 = isset($_POST['radValue9']) ? $_POST['radValue9']+0 : 2; // Common radio field value
$chkRadValue10 = isset($_POST['radValue10']) ? $_POST['radValue10']+0 : 2; // Common radio field value
$chkRadValue11 = isset($_POST['radValue11']) ? $_POST['radValue11']+0 : 2; // Common radio field value
$chkRadValue12 = isset($_POST['radValue12']) ? $_POST['radValue12']+0 : 2; // Common radio field value
$chkRadValue13 = isset($_POST['radValue13']) ? $_POST['radValue13']+0 : 2; // Common radio field value
$chkRadValue14 = isset($_POST['radValue14']) ? $_POST['radValue14']+0 : 2; // Common radio field value
$chkRadValue15 = isset($_POST['radValue15']) ? $_POST['radValue15']+0 : 2; // Common radio field value
$chkRadValue16 = isset($_POST['radValue16']) ? $_POST['radValue16']+0 : 2; // Common radio field value
$chkRadValue17 = isset($_POST['radValue17']) ? $_POST['radValue17']+0 : 2; // Common radio field value
$chkChbGr1a = isset($_POST['chbGr1a']) ? $_POST['chbGr1a']."," : ""; // Common checkbox group
$chkChbGr1b = isset($_POST['chbGr1b']) ? $_POST['chbGr1b']."," : ""; // Common checkbox group
$chkChbGr1c = isset($_POST['chbGr1c']) ? $_POST['chbGr1c']."," : ""; // Common checkbox group
$chkChbGr1d = isset($_POST['chbGr1d']) ? $_POST['chbGr1d']."," : ""; // Common checkbox group
$chkChbGr1e = isset($_POST['chbGr1e']) ? $_POST['chbGr1e']."," : ""; // Common checkbox group
$chkChbGr1f = isset($_POST['chbGr1f']) ? $_POST['chbGr1f']."," : ""; // Common checkbox group
$chkChbGr1g = isset($_POST['chbGr1g']) ? $_POST['chbGr1g']."," : ""; // Common checkbox group
$chkChbGr1h = isset($_POST['chbGr1h']) ? $_POST['chbGr1h']."," : ""; // Common checkbox group
$chkChbGr2a = isset($_POST['chbGr2a']) ? $_POST['chbGr2a']."," : ""; // Common checkbox group
$chkChbGr2b = isset($_POST['chbGr2b']) ? $_POST['chbGr2b']."," : ""; // Common checkbox group
$chkChbGr2c = isset($_POST['chbGr2c']) ? $_POST['chbGr2c']."," : ""; // Common checkbox group
$chkChbGr2d = isset($_POST['chbGr2d']) ? $_POST['chbGr2d']."," : ""; // Common checkbox group
$chkChbGr2e = isset($_POST['chbGr2e']) ? $_POST['chbGr2e']."," : ""; // Common checkbox group
$chkChbGr2f = isset($_POST['chbGr2f']) ? $_POST['chbGr2f']."," : ""; // Common checkbox group
$chkChbGr2g = isset($_POST['chbGr2g']) ? $_POST['chbGr2g']."," : ""; // Common checkbox group
$chkChbGr2h = isset($_POST['chbGr2h']) ? $_POST['chbGr2h']."," : ""; // Common checkbox group
$chkChbGr3a = isset($_POST['chbGr3a']) ? $_POST['chbGr3a']."," : ""; // Common checkbox group
$chkChbGr3b = isset($_POST['chbGr3b']) ? $_POST['chbGr3b']."," : ""; // Common checkbox group
$chkChbGr3c = isset($_POST['chbGr3c']) ? $_POST['chbGr3c']."," : ""; // Common checkbox group
$chkChbGr3d = isset($_POST['chbGr3d']) ? $_POST['chbGr3d']."," : ""; // Common checkbox group
$chkChbGr4a = isset($_POST['chbGr4a']) ? $_POST['chbGr4a']."," : ""; // Common checkbox group
$chkChbGr4b = isset($_POST['chbGr4b']) ? $_POST['chbGr4b']."," : ""; // Common checkbox group
$chkChbGr4c = isset($_POST['chbGr4c']) ? $_POST['chbGr4c']."," : ""; // Common checkbox group
$chkChbGr4d = isset($_POST['chbGr4d']) ? $_POST['chbGr4d']."," : ""; // Common checkbox group
$chkButValue1 = isset($_POST['butValue1']) ? $_POST['butValue1'] : ""; // Common button value
$chkButValue2 = isset($_POST['butValue2']) ? $_POST['butValue2'] : ""; // Common button value
$chkButValue3 = isset($_POST['butValue3']) ? $_POST['butValue3'] : ""; // Common button value
$chkButValue4 = isset($_POST['butValue4']) ? $_POST['butValue4'] : ""; // Common button value
$chkButValue5 = isset($_POST['butValue5']) ? $_POST['butValue5'] : ""; // Common button value
$chkTfNullVal1 = (isset($_POST['tfNullVal1']) && ($_POST['tfNullVal1'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal1'])+0 : "NULL"; // Common text NULL field value
$chkTfNullVal2 = (isset($_POST['tfNullVal2']) && ($_POST['tfNullVal2'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal2'])+0 : "NULL"; // Common text NULL field value
$chkTfNullVal3 = (isset($_POST['tfNullVal3']) && ($_POST['tfNullVal3'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal3'])+0 : "NULL"; // Common text NULL field value
$chkTfNullVal4 = (isset($_POST['tfNullVal4']) && ($_POST['tfNullVal4'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal4'])+0 : "NULL"; // Common text NULL field value
$chkTfNullVal5 = (isset($_POST['tfNullVal5']) && ($_POST['tfNullVal5'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal5'])+0 : "NULL"; // Common text NULL field value
$chkTfNullVal6 = (isset($_POST['tfNullVal6']) && ($_POST['tfNullVal6'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal6'])+0 : "NULL"; // Common text NULL field value
$chkTfNullVal7 = (isset($_POST['tfNullVal7']) && ($_POST['tfNullVal7'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal7'])+0 : "NULL"; // Common text NULL field value
$chkTfNullVal8 = (isset($_POST['tfNullVal8']) && ($_POST['tfNullVal8'] != "")) ? $myVisClass->checkNull($_POST['tfNullVal8'])+0 : "NULL"; // Common text NULL field value
// Common text field value
for ($i = 1; $i <= 22; $i++) {
$tmpVar = 'chkTfValue'.$i;
$$tmpVar = filter_input(INPUT_POST, 'tfValue'.$i, FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES);
if (get_magic_quotes_gpc() == 0) {
$$tmpVar = addslashes($$tmpVar);
}
if (isset($$tmpVar)) {
$$tmpVar = $myVisClass->tfSecure($$tmpVar);
}
}
// Common argument text field value
for ($i = 1; $i <= 8; $i++) {
$tmpVar = 'chkTfArg'.$i;
$$tmpVar = filter_input(INPUT_POST, 'tfArg'.$i, FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES);
if (get_magic_quotes_gpc() == 0) {
$$tmpVar = addslashes($$tmpVar);
}
if (isset($$tmpVar)) {
$$tmpVar = $myVisClass->tfSecure($$tmpVar);
}
}
// Common multi select field value
for ($i = 1; $i <= 8; $i++) {
$tmpVar = 'chkMselValue'.$i;
$tmpVar2 = 'intMselValue'.$i;
$$tmpVar = filter_input(INPUT_POST, 'mselValue'.$i, FILTER_SANITIZE_STRING, FILTER_FORCE_ARRAY);
// Multiselect data processing
if ((${$tmpVar}[0] == '') || (${$tmpVar}[0] == '0')) {
$$tmpVar2 = 0;
} elseif (${$tmpVar}[0] == '*') {
$$tmpVar2 = 2;
} else {
$$tmpVar2 = 1;
}
}
// Common select field value
for ($i = 1; $i <= 5; $i++) {
$tmpVar = 'chkSelValue'.$i;
$$tmpVar = filter_input(INPUT_POST, 'selValue'.$i, FILTER_VALIDATE_INT, array('options' => array('default' => 0)));
}
//Common radio field value
for ($i = 1; $i <= 18; $i++) {
$tmpVar = 'chkRadValue'.$i;
$$tmpVar = filter_input(INPUT_POST, 'radValue'.$i, FILTER_VALIDATE_INT, array('options' => array('default' => 2)));
}
// Common checkbox group
$arrChar = explode(';', 'a;b;c;d;e;f;g;h');
for ($i = 1; $i <= 4; $i++) {
foreach ($arrChar as $elem) {
$tmpVar = 'chkChbGr'.$i.$elem;
$$tmpVar = filter_input(INPUT_POST, 'chbGr'.$i.$elem, FILTER_SANITIZE_STRING);
if ($$tmpVar != '') {
$$tmpVar .= ',';
}
}
}
// Common button value
for ($i = 1; $i <= 5; $i++) {
$tmpVar = 'chkButValue'.$i;
$$tmpVar = filter_input(INPUT_POST, 'butValue'.$i, FILTER_SANITIZE_STRING);
}
// Common text NULL field value
for ($i = 1; $i <= 9; $i++) {
$tmpVar = 'chkTfNullVal'.$i;
$$tmpVar = filter_input(INPUT_POST, 'tfNullVal'.$i, FILTER_SANITIZE_STRING);
if (isset($$tmpVar) && ($$tmpVar != '')) {
$myVisClass->checkNull($$tmpVar);
} else {
$$tmpVar = 'NULL';
}
}
// Common checkbox field value
$chkChbValue1 = filter_input(INPUT_POST, 'chbValue1', FILTER_VALIDATE_INT, array('options' => array('default' => 0)));
$chkChbValue2 = filter_input(INPUT_POST, 'chbValue2', FILTER_VALIDATE_INT, array('options' => array('default' => 0)));
// Common file selection field
$chkDatValue1 = filter_input(INPUT_POST, 'datValue1', FILTER_SANITIZE_STRING);
// Common text area value
$chkTaValue1Raw = filter_input(INPUT_POST, 'taValue1', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
// Common text area value for file import (not SQL)
$chkTaFileTextRaw = filter_input(INPUT_POST, 'taFileText', FILTER_UNSAFE_RAW);
//
// Quote special characters
// ==========================
if (get_magic_quotes_gpc() == 0) {
$chkTfSearch = addslashes($chkTfSearch);
$chkTfValue1 = addslashes($chkTfValue1);
$chkTfValue2 = addslashes($chkTfValue2);
$chkTfValue3 = addslashes($chkTfValue3);
$chkTfValue4 = addslashes($chkTfValue4);
$chkTfValue5 = addslashes($chkTfValue5);
$chkTfValue6 = addslashes($chkTfValue6);
$chkTfValue7 = addslashes($chkTfValue7);
$chkTfValue8 = addslashes($chkTfValue8);
$chkTfValue9 = addslashes($chkTfValue9);
$chkTfValue10 = addslashes($chkTfValue10);
$chkTfValue11 = addslashes($chkTfValue11);
$chkTfValue12 = addslashes($chkTfValue12);
$chkTfValue13 = addslashes($chkTfValue13);
$chkTfValue14 = addslashes($chkTfValue14);
$chkTfValue15 = addslashes($chkTfValue15);
$chkTfValue16 = addslashes($chkTfValue16);
$chkTfValue17 = addslashes($chkTfValue17);
$chkTfValue18 = addslashes($chkTfValue18);
$chkTfValue19 = addslashes($chkTfValue19);
$chkTfValue20 = addslashes($chkTfValue20);
$chkTaValue1 = addslashes($chkTaValue1);
$chkTfArg1 = addslashes($chkTfArg1);
$chkTfArg2 = addslashes($chkTfArg2);
$chkTfArg3 = addslashes($chkTfArg3);
$chkTfArg4 = addslashes($chkTfArg4);
$chkTfArg5 = addslashes($chkTfArg5);
$chkTfArg6 = addslashes($chkTfArg6);
$chkTfArg7 = addslashes($chkTfArg7);
$chkTfArg8 = addslashes($chkTfArg8);
$chkTaFileText = addslashes($chkTaFileText);
$chkTfSearchRaw = addslashes($chkTfSearchRaw);
$chkTaValue1Raw = addslashes($chkTaValue1Raw);
$chkTaFileTextRaw = addslashes($chkTaFileTextRaw);
}
//
// Security function for text fields
// =================================
$chkTfSearch = $myVisClass->tfSecure($chkTfSearch);
$chkTfValue1 = $myVisClass->tfSecure($chkTfValue1);
$chkTfValue2 = $myVisClass->tfSecure($chkTfValue2);
$chkTfValue3 = $myVisClass->tfSecure($chkTfValue3);
$chkTfValue4 = $myVisClass->tfSecure($chkTfValue4);
$chkTfValue5 = $myVisClass->tfSecure($chkTfValue5);
$chkTfValue6 = $myVisClass->tfSecure($chkTfValue6);
$chkTfValue7 = $myVisClass->tfSecure($chkTfValue7);
$chkTfValue8 = $myVisClass->tfSecure($chkTfValue8);
$chkTfValue9 = $myVisClass->tfSecure($chkTfValue9);
$chkTfValue10 = $myVisClass->tfSecure($chkTfValue10);
$chkTfValue11 = $myVisClass->tfSecure($chkTfValue11);
$chkTfValue12 = $myVisClass->tfSecure($chkTfValue12);
$chkTfValue13 = $myVisClass->tfSecure($chkTfValue13);
$chkTfValue14 = $myVisClass->tfSecure($chkTfValue14);
$chkTfValue15 = $myVisClass->tfSecure($chkTfValue15);
$chkTfValue16 = $myVisClass->tfSecure($chkTfValue16);
$chkTfValue17 = $myVisClass->tfSecure($chkTfValue17);
$chkTfValue18 = $myVisClass->tfSecure($chkTfValue18);
$chkTfValue19 = $myVisClass->tfSecure($chkTfValue19);
$chkTfValue20 = $myVisClass->tfSecure($chkTfValue20);
$chkTfArg1 = $myVisClass->tfSecure($chkTfArg1);
$chkTfArg2 = $myVisClass->tfSecure($chkTfArg2);
$chkTfArg3 = $myVisClass->tfSecure($chkTfArg3);
$chkTfArg4 = $myVisClass->tfSecure($chkTfArg4);
$chkTfArg5 = $myVisClass->tfSecure($chkTfArg5);
$chkTfArg6 = $myVisClass->tfSecure($chkTfArg6);
$chkTfArg7 = $myVisClass->tfSecure($chkTfArg7);
$chkTfArg8 = $myVisClass->tfSecure($chkTfArg8);
$chkTaValue1 = $myVisClass->tfSecure($chkTaValue1);
$chkTaFileText = stripslashes($chkTaFileText);
//
// Multiselect data processing
// ===========================
if (($chkMselValue1[0] == "") || ($chkMselValue1[0] == "0")) {$intMselValue1 = 0;} else {$intMselValue1 = 1;}
if ($chkMselValue1[0] == "*") $intMselValue1 = 2;
if (($chkMselValue2[0] == "") || ($chkMselValue2[0] == "0")) {$intMselValue2 = 0;} else {$intMselValue2 = 1;}
if ($chkMselValue2[0] == "*") $intMselValue2 = 2;
if (($chkMselValue3[0] == "") || ($chkMselValue3[0] == "0")) {$intMselValue3 = 0;} else {$intMselValue3 = 1;}
if ($chkMselValue3[0] == "*") $intMselValue3 = 2;
if (($chkMselValue4[0] == "") || ($chkMselValue4[0] == "0")) {$intMselValue4 = 0;} else {$intMselValue4 = 1;}
if ($chkMselValue4[0] == "*") $intMselValue4 = 2;
if (($chkMselValue5[0] == "") || ($chkMselValue5[0] == "0")) {$intMselValue5 = 0;} else {$intMselValue5 = 1;}
if ($chkMselValue5[0] == "*") $intMselValue5 = 2;
if (($chkMselValue6[0] == "") || ($chkMselValue6[0] == "0")) {$intMselValue6 = 0;} else {$intMselValue6 = 1;}
if ($chkMselValue6[0] == "*") $intMselValue6 = 2;
if (($chkMselValue7[0] == "") || ($chkMselValue7[0] == "0")) {$intMselValue7 = 0;} else {$intMselValue7 = 1;}
if ($chkMselValue7[0] == "*") $intMselValue7 = 2;
if (($chkMselValue8[0] == "") || ($chkMselValue8[0] == "0")) {$intMselValue8 = 0;} else {$intMselValue8 = 1;}
if ($chkMselValue8[0] == "*") $intMselValue8 = 2;
$chkTfSearch = $myVisClass->tfSecure($chkTfSearchRaw);
$chkTaValue1 = $myVisClass->tfSecure($chkTaValue1Raw);
$chkTaFileText = stripslashes($chkTaFileTextRaw);
//
// Search/sort/filter - session data
// =================================
if (!isset($_SESSION['search']) || !isset($_SESSION['search'][$preSearchSession])) $_SESSION['search'][$preSearchSession] = "";
if (!isset($_SESSION['search']) || !isset($_SESSION['search']['config_selection'])) $_SESSION['search']['config_selection'] = "";
if (($chkModus == "checkform") || ($chkModus == "filter")) {
$_SESSION['search'][$preSearchSession] = $chkTfSearch;
$_SESSION['search']['config_selection'] = $chkSelCnfName;
if (!isset($_SESSION['search']) || !isset($_SESSION['search'][$preSearchSession])) {
$_SESSION['search'][$preSearchSession] = '';
}
if (!isset($_SESSION['search']) || !isset($_SESSION['search']['config_selection'])) {
$_SESSION['search']['config_selection'] = '';
}
if (($chkModus == 'checkform') || ($chkModus == 'filter')) {
$_SESSION['search'][$preSearchSession] = $chkTfSearch;
$_SESSION['search']['config_selection'] = $chkSelCnfName;
$myContentClass->arrSession = $_SESSION;
}
//
// Process additional templates/variables
// ======================================
if (isset($_SESSION['templatedefinition']) && is_array($_SESSION['templatedefinition']) && (count($_SESSION['templatedefinition']) != 0)) {
$intTemplates = 1;
if (isset($_SESSION['templatedefinition']) && is_array($_SESSION['templatedefinition']) &&
(count($_SESSION['templatedefinition']) != 0)) {
$intTemplates = 1;
} else {
$intTemplates = 0;
$intTemplates = 0;
}
if (isset($_SESSION['variabledefinition']) && is_array($_SESSION['variabledefinition']) && (count($_SESSION['variabledefinition']) != 0)) {
$intVariables = 1;
if (isset($_SESSION['variabledefinition']) && is_array($_SESSION['variabledefinition']) &&
(count($_SESSION['variabledefinition']) != 0)) {
$intVariables = 1;
} else {
$intVariables = 0;
$intVariables = 0;
}
//
// Common SQL parts
// ================
if ($hidActive == 1) $chkActive = 1;
if ($chkGroupAdm == 1) {$strGroupSQL = "`access_group`=$chkSelAccGr, ";} else {$strGroupSQL = "";}
$preSQLCommon1 = "$strGroupSQL `active`='$chkActive', `register`='$chkRegister', `config_id`=$chkDomainId, `last_modified`=NOW()";
if ($hidActive == 1) {
$chkActive = 1;
}
if ($chkGroupAdm == 1) {
$strGroupSQL = "`access_group`=$chkSelAccGr, ";
} else {
$strGroupSQL = '';
}
$preSQLCommon1 = "$strGroupSQL `active`='$chkActive', `register`='$chkRegister', `config_id`=$chkDomainId, "
. '`last_modified`=NOW()';
$preSQLCommon2 = "$strGroupSQL `active`='$chkActive', `register`='0', `config_id`=$chkDomainId, `last_modified`=NOW()";
$intRet1=0;$intRet2=0;$intRet3=0;$intRet4=0;$intRet5=0;$intRet6=0;$intRet7=0;$intRet8=0;
$intRet1 = 0;
$intRet2 = 0;
$intRet3 = 0;
$intRet4 = 0;
$intRet5 = 0;
$intRet6 = 0;
$intRet7 = 0;
$intRet8 = 0;
//
// Check read and write access
// ===========================
if (isset($prePageKey)) {
$intGlobalReadAccess = $myVisClass->checkAccGroup($prePageKey,'read'); // Global read access (0 = access granted)
$intGlobalWriteAccess = $myVisClass->checkAccGroup($prePageKey,'write'); // Global write access (0 = access granted)
$myContentClass->intGlobalWriteAccess = $intGlobalWriteAccess;
// Global read access (0 = access granted)
$intGlobalReadAccess = $myVisClass->checkAccountGroup($prePageKey, 'read');
// Global write access (0 = access granted)
$intGlobalWriteAccess = $myVisClass->checkAccountGroup($prePageKey, 'write');
$myContentClass->intGlobalWriteAccess = $intGlobalWriteAccess;
}
if (!isset($preNoAccessGrp) || ($preNoAccessGrp == 0)) {
if ($chkDataId != 0) {
$strSQLWrite = "SELECT `access_group` FROM `$preTableName` WHERE id=$chkDataId";
$intWriteAccessId = $myVisClass->checkAccGroup(($myDBClass->getFieldData($strSQLWrite)+0),'write');
$myContentClass->intWriteAccessId = $intWriteAccessId;
}
if ($chkListId != 0) {
$strSQLWrite = "SELECT `access_group` FROM `$preTableName` WHERE id=$chkListId";
$intReadAccessId = $myVisClass->checkAccGroup(($myDBClass->getFieldData($strSQLWrite)+0),'read');
$intWriteAccessId = $myVisClass->checkAccGroup(($myDBClass->getFieldData($strSQLWrite)+0),'write');
$myContentClass->intWriteAccessId = $intWriteAccessId;
}
if ($chkDataId != 0) {
$strSQLWrite = "SELECT `access_group` FROM `$preTableName` WHERE `id`=".$chkDataId;
$intWriteAccessId = $myVisClass->checkAccountGroup((int)$myDBClass->getFieldData($strSQLWrite), 'write');
$myContentClass->intWriteAccessId = $intWriteAccessId;
}
if ($chkListId != 0) {
$strSQLWrite = "SELECT `access_group` FROM `$preTableName` WHERE `id`=".$chkListId;
$intReadAccessId = $myVisClass->checkAccountGroup((int)$myDBClass->getFieldData($strSQLWrite), 'read');
$intWriteAccessId = $myVisClass->checkAccountGroup((int)$myDBClass->getFieldData($strSQLWrite), 'write');
$myContentClass->intWriteAccessId = $intWriteAccessId;
}
}
//
// Data processing
// ===============
if (($chkModus == "make") && ($intGlobalWriteAccess == 0)) {
$intError = 0;
$intSuccess = 0;
// Get write access groups
$strAccess = $myVisClass->getAccGroups('write');
// Write configuration file
if ($preTableName == 'tbl_host') {
$strSQL = "SELECT `id` FROM `$preTableName` WHERE $strDomainWhere AND `access_group` IN ($strAccess) AND `active`='1'";
$booReturn = $myDBClass->getDataArray($strSQL,$arrData,$intDataCount);
if ($booReturn == false) $myVisClass->processMessage($myDBClass->strErrorMessage,$strErrorMessage);
if ($booReturn && ($intDataCount != 0)) {
foreach ($arrData AS $data) {
$intReturn = $myConfigClass->createConfigSingle("$preTableName",$data['id']);
if ($intReturn == 1){
$intError++;
$myVisClass->processMessage($myConfigClass->strErrorMessage,$strErrorMessage);
} else {
$intSuccess++;
}
}
} else {
$myVisClass->processMessage(translate('Some configuration files were not written. Dataset not activated, not found or you do not have write permission!'),$strErrorMessage);
}
if ($intSuccess != 0) $myVisClass->processMessage(translate('Configuration files successfully written!'),$strInfoMessage);
if ($intError != 0) $myVisClass->processMessage(translate('Some configuration files were not written. Dataset not activated, not found or you do not have write permission!'),$strErrorMessage);
} else if ($preTableName == 'tbl_service') {
$strSQL = "SELECT `id`, `$preKeyField` FROM `$preTableName` WHERE $strDomainWhere AND `access_group` IN ($strAccess) AND `active`='1' GROUP BY `$preKeyField`, `id`";
$myDBClass->getDataArray($strSQL,$arrData,$intDataCount);
if ($booReturn == false) $myVisClass->processMessage($myDBClass->strErrorMessage,$strErrorMessage);
if ($booReturn && ($intDataCount != 0)) {
foreach ($arrData AS $data) {
$intReturn = $myConfigClass->createConfigSingle("$preTableName",$data['id']);
if ($intReturn == 1){
$intError++;
$myVisClass->processMessage($myConfigClass->strErrorMessage,$strErrorMessage);
} else {
$intSuccess++;
}
}
} else {
$myVisClass->processMessage(translate('Some configuration files were not written. Dataset not activated, not found or you do not have write permission!'),$strErrorMessage);
}
if ($intSuccess != 0) $myVisClass->processMessage(translate('Configuration files successfully written!'),$strInfoMessage);
if ($intError != 0) $myVisClass->processMessage(translate('Some configuration files were not written. Dataset not activated, not found or you do not have write permission!'),$strErrorMessage);
} else {
$intReturn = $myConfigClass->createConfig($preTableName,0);
if ($intReturn == 1) $myVisClass->processMessage($myConfigClass->strErrorMessage,$strErrorMessage);
if ($intReturn == 0) $myVisClass->processMessage($myConfigClass->strInfoMessage,$strInfoMessage);
}
$chkModus = "display";
} else if (($chkModus == "checkform") && ($chkSelModify == "info")) {
// Display additional relation information
if ($preTableName == 'tbl_service') {
$intReturn = $myDataClass->infoRelation($preTableName,$chkListId,"$preKeyField,service_description");
} else {
$intReturn = $myDataClass->infoRelation($preTableName,$chkListId,$preKeyField);
}
$myVisClass->processMessage($myDataClass->strInfoMessage,$strConsistMessage);
$chkModus = "display";
} else if (($chkModus == "checkform") && ($chkSelModify == "delete") && ($intGlobalWriteAccess == 0)) {
// Delete selected datasets
if (($preTableName == 'tbl_user') && ($chkTfValue5 == "Admin")) {
$myVisClass->processMessage(translate("Admin can't be deleted"),$strErrorMessage);
$intReturn = 0;
} else if ((($preTableName == 'tbl_datadomain') || ($preTableName == 'tbl_configtarget')) && ($chkTfValue3 == "localhost")) {
$myVisClass->processMessage(translate("Localhost can't be deleted"),$strErrorMessage);
$intReturn = 0;
} else if (($preTableName == 'tbl_user') || ($preTableName == 'tbl_datadomain') || ($preTableName == 'tbl_configtarget')) {
$intReturn = $myDataClass->dataDeleteEasy($preTableName,$chkListId);
} else {
$intReturn = $myDataClass->dataDeleteFull($preTableName,$chkListId);
}
if ($intReturn == 1) $myVisClass->processMessage($myDataClass->strErrorMessage,$strErrorMessage);
if ($intReturn == 0) $myVisClass->processMessage($myDataClass->strInfoMessage,$strInfoMessage);
$chkModus = "display";
} else if (($chkModus == "checkform") && ($chkSelModify == "copy") && ($intGlobalWriteAccess == 0)) {
// Copy selected datasets
$intReturn = $myDataClass->dataCopyEasy($preTableName,$preKeyField,$chkListId,$chkSelTargetDomain);
if ($intReturn == 1) $myVisClass->processMessage($myDataClass->strErrorMessage,$strErrorMessage);
if ($intReturn == 0) $myVisClass->processMessage($myDataClass->strInfoMessage,$strInfoMessage);
$chkModus = "display";
} else if (($chkModus == "checkform") && ($chkSelModify == "activate") && ($intGlobalWriteAccess == 0)) {
// Activate selected datasets
$intReturn = $myDataClass->dataActivate($preTableName,$chkListId);
if ($intReturn == 1) $myVisClass->processMessage($myDataClass->strErrorMessage,$strErrorMessage);
if ($intReturn == 0) $myVisClass->processMessage($myDataClass->strInfoMessage,$strInfoMessage);
$chkModus = "display";
} else if (($chkModus == "checkform") && ($chkSelModify == "deactivate") && ($intGlobalWriteAccess == 0)) {
// Deactivate selected datasets
$intReturn = $myDataClass->dataDeactivate($preTableName,$chkListId);
if ($intReturn == 1) $myVisClass->processMessage($myDataClass->strErrorMessage,$strErrorMessage);
if ($intReturn == 0) $myVisClass->processMessage($myDataClass->strInfoMessage,$strInfoMessage);
// Remove deactivated files
if ($preTableName == 'tbl_host') {
if ($chkListId != 0) {
$strChbName = "chbId_".$chkListId;
$_POST[$strChbName] = "on";
}
// Get write access groups
$strAccess = $myVisClass->getAccGroups('write');
// Getting data sets
$strSQL = "SELECT `id`, `host_name` FROM `".$preTableName."` WHERE `active`='0' AND `access_group` IN ($strAccess) AND `config_id`=".$chkDomainId;
$booReturn = $myDBClass->getDataArray($strSQL,$arrData,$intDataCount);
if ($booReturn && ($intDataCount != 0) && ($chkDomainId != 0)) {
$arrConfigID = $myConfigClass->getConfigSets();
$intError = 0;
$intSuccess = 0;
if (($arrConfigID != 1) && is_array($arrConfigID)) {
foreach ($arrData AS $elem) {
$strChbName = "chbId_".$elem['id'];
// was the current record is marked for deactivate?
if (isset($_POST[$strChbName]) && ($_POST[$strChbName] == "on")) {
$intCount = 0;
$intReturn = 0;
foreach($arrConfigID AS $intConfigID) {
$intReturn += $myConfigClass->moveFile("host",$elem['host_name'].".cfg",$intConfigID);
if ($intReturn == 0) {
$myDataClass->writeLog(translate('Host file deleted:')." ".$elem['host_name'].".cfg");
$intCount++;
}
}
if ($intReturn == 0) $intSuccess++;
if ($intReturn != 0) $intError++;
}
}
if (($intSuccess != 0) && ($intCount != 0)) {
$myVisClass->processMessage(translate('The assigned, no longer used configuration files were deleted successfully!').$intCount,$strInfoMessage);
}
if ($intError != 0) {
$myVisClass->processMessage(translate('Errors while deleting the old configuration file - please check!:'),$strErrorMessage);
}
}
} else if ($chkDomainId == 0) {
$myVisClass->processMessage(translate('Common files cannot be removed from target systems - please check manually'),$strErrorMessage);
}
} else if ($preTableName == 'tbl_service') {
if ($chkListId != 0) {
$strChbName = "chbId_".$chkListId;
$_POST[$strChbName] = "on";
}
// Get write access groups
$strAccess = $myVisClass->getAccGroups('write');
// Getting data sets
$strSQL = "SELECT `id`, `config_name` FROM `".$preTableName."` WHERE `active`='0' AND `access_group` IN ($strAccess) AND `config_id`=".$chkDomainId;
$booReturn = $myDBClass->getDataArray($strSQL,$arrData,$intDataCount);
if ($booReturn && ($intDataCount != 0) && ($chkDomainId != 0)) {
$arrConfigID = $myConfigClass->getConfigSets();
$intError = 0;
$intSuccess = 0;
if (($arrConfigID != 1) && is_array($arrConfigID)) {
$intCount = 0;
foreach ($arrData AS $elem) {
$strChbName = "chbId_".$elem['id'];
// was the current record is marked for deactivate?
if (isset($_POST[$strChbName]) && ($_POST[$strChbName] == "on")) {
$intServiceCount = $myDBClass->countRows("SELECT * FROM `$preTableName` WHERE `$preKeyField`='".$elem['config_name']."'
AND `config_id`=$chkDomainId AND `active`='1'");
if ($intServiceCount == 0) {
$intReturn = 0;
foreach($arrConfigID AS $intConfigID) {
$intReturn += $myConfigClass->moveFile("service",$elem['config_name'].".cfg",$intConfigID);
if ($intReturn == 0) $myDataClass->writeLog(translate('Service file deleted:')." ".$elem['config_name'].".cfg");
$intCount++;
}
if ($intReturn == 0) $intSuccess++;
if ($intReturn != 0) $intError++;
}
}
}
if (($intSuccess != 0) && ($intCount != 0)) {
$myVisClass->processMessage(translate('The assigned, no longer used configuration files were deleted successfully!'),$strInfoMessage);
}
if ($intError != 0) {
$myVisClass->processMessage(translate('Errors while deleting the old configuration file - please check!:'),$strErrorMessage);
}
}
} else if ($chkDomainId == 0) {
$myVisClass->processMessage(translate('Common files cannot be removed from target systems - please check manually'),$strErrorMessage);
}
}
$chkModus = "display";
} else if (($chkModus == "checkform") && ($chkSelModify == "modify")) {
// Open the dataset to modify
if ($intReadAccessId == 0) {
$booReturn = $myDBClass->getSingleDataset("SELECT * FROM `$preTableName` WHERE `id`=".$chkListId,$arrModifyData);
if ($booReturn == false) {
$myVisClass->processMessage(translate('Error while selecting data from database:'),$strErrorMessage);
$myVisClass->processMessage($myDBClass->strErrorMessage,$strErrorMessage);
$chkModus = "display";
} else {
$chkModus = "add";
}
} else {
$myVisClass->processMessage(translate('No permission to open configuration!'),$strErrorMessage);
$chkModus = "display";
}
} else if (($chkModus == "checkform") && ($chkSelModify == "config") && ($intGlobalWriteAccess == 0)) {
// Write configuration file (hosts and services)
$intDSId = (int)substr(array_search("on",$_POST),6);
if (isset($chkListId) && ($chkListId != 0)) $intDSId = $chkListId;
$intValCount = 0;
foreach($_POST AS $key => $elem) {
if ($elem == "on") $intValCount++;
}
if ($intValCount > 1) $intDSId = 0;
$intReturn = $myConfigClass->createConfigSingle($preTableName,$intDSId);
if ($intReturn == 1) $myVisClass->processMessage($myConfigClass->strErrorMessage,$strErrorMessage);
if ($intReturn == 0) $myVisClass->processMessage($myConfigClass->strInfoMessage,$strInfoMessage);
$chkModus = "display";
if (($chkModus == 'make') && ($intGlobalWriteAccess == 0)) {
$intError = 0;
$intSuccess = 0;
// Get write access groups
$strAccess = $myVisClass->getAccessGroups('write');
// Write configuration file
if ($preTableName == 'tbl_host') {
/** @var string $strDomainWhere - defined in prepend_adm.php */
$strSQL = "SELECT `id` FROM `$preTableName` "
. "WHERE $strDomainWhere AND `access_group` IN ($strAccess) AND `active`='1'";
$booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDataCount);
if ($booReturn == false) {
$myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage);
}
if ($booReturn && ($intDataCount != 0)) {
foreach ($arrData as $data) {
$intReturn = $myConfigClass->createConfigSingle($preTableName, $data['id']);
if ($intReturn == 1) {
$intError++;
$myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage);
} else {
$intSuccess++;
}
}
} else {
$myVisClass->processMessage(translate('Some configuration files were not written. Dataset not activated, '
. 'not found or you do not have write permission!'), $strErrorMessage);
}
if ($intSuccess != 0) {
$myVisClass->processMessage(translate('Configuration files successfully written!'), $strInfoMessage);
}
if ($intError != 0) {
$myVisClass->processMessage(translate('Some configuration files were not written. Dataset not activated, '
. 'not found or you do not have write permission!'), $strErrorMessage);
}
} elseif ($preTableName == 'tbl_service') {
/** @var string $strDomainWhere - defined in prepend_adm.php */
$strSQL = "SELECT `id`, `$preKeyField` FROM `$preTableName` "
. "WHERE $strDomainWhere AND `access_group` IN ($strAccess) AND `active`='1' "
. "GROUP BY `$preKeyField`, `id`";
$myDBClass->hasDataArray($strSQL, $arrData, $intDataCount);
if ($booReturn == false) {
$myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage);
}
if ($booReturn && ($intDataCount != 0)) {
foreach ($arrData as $data) {
$intReturn = $myConfigClass->createConfigSingle($preTableName, $data['id']);
if ($intReturn == 1) {
$intError++;
$myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage);
} else {
$intSuccess++;
}
}
} else {
$myVisClass->processMessage(translate('Some configuration files were not written. Dataset not activated, '
. 'not found or you do not have write permission!'), $strErrorMessage);
}
if ($intSuccess != 0) {
$myVisClass->processMessage(translate('Configuration files successfully written!'), $strInfoMessage);
}
if ($intError != 0) {
$myVisClass->processMessage(translate('Some configuration files were not written. Dataset not activated, '
. 'not found or you do not have write permission!'), $strErrorMessage);
}
} else {
$intReturn = $myConfigClass->createConfig($preTableName, 0);
if ($intReturn == 1) {
$myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage);
}
if ($intReturn == 0) {
$myVisClass->processMessage($myConfigClass->strInfoMessage, $strInfoMessage);
}
}
$chkModus = 'display';
} elseif (($chkModus == 'checkform') && ($chkSelModify == 'info')) {
// Display additional relation information
if ($preTableName == 'tbl_service') {
$intReturn = $myDataClass->infoRelation($preTableName, $chkListId, "$preKeyField,service_description");
} else {
$intReturn = $myDataClass->infoRelation($preTableName, $chkListId, $preKeyField);
}
$myVisClass->processMessage($myDataClass->strInfoMessage, $strConsistMessage);
$chkModus = 'display';
} elseif (($chkModus == 'checkform') && ($chkSelModify == 'delete') && ($intGlobalWriteAccess == 0)) {
$intReturn = 1;
// Delete selected datasets
if (($preTableName == 'tbl_user') && ($chkTfValue5 == 'Admin')) {
$myVisClass->processMessage(translate('Admin cannot be deleted'), $strErrorMessage);
$intReturn = 0;
} elseif ((($preTableName == 'tbl_datadomain') || ($preTableName == 'tbl_configtarget')) &&
($chkTfValue3 == 'localhost')) {
$myVisClass->processMessage(translate("Localhost can't be deleted"), $strErrorMessage);
$intReturn = 0;
} elseif (($preTableName == 'tbl_user') || ($preTableName == 'tbl_datadomain') ||
($preTableName == 'tbl_configtarget')) {
$intReturn = $myDataClass->dataDeleteEasy($preTableName, $chkListId);
} else {
$strInfoMessageTmp = $strInfoMessage;
if ($preTableName == 'tbl_service') {
$intRetVal = $myDataClass->infoRelation($preTableName, $chkListId, "$preKeyField,service_description");
} else {
$intRetVal = $myDataClass->infoRelation($preTableName, $chkListId, $preKeyField);
}
if ($intRetVal == 0) {
$strInfoMessage = $strInfoMessageTmp;
$intReturn = $myDataClass->dataDeleteFull($preTableName, $chkListId);
}
}
$myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage);
$myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage);
$chkModus = 'display';
} elseif (($chkModus == 'checkform') && ($chkSelModify == 'copy') && ($intGlobalWriteAccess == 0)) {
// Copy selected datasets
$intReturn = $myDataClass->dataCopyEasy($preTableName, $preKeyField, $chkListId, $chkSelTarDom);
if ($intReturn == 1) {
$myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage);
}
if ($intReturn == 0) {
$myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage);
}
$chkModus = 'display';
} elseif (($chkModus == 'checkform') && ($chkSelModify == 'activate') && ($intGlobalWriteAccess == 0)) {
// Activate selected datasets
$intReturn = $myDataClass->dataActivate($preTableName, $chkListId);
if ($intReturn == 1) {
$myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage);
}
if ($intReturn == 0) {
$myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage);
}
$chkModus = 'display';
} elseif (($chkModus == 'checkform') && ($chkSelModify == 'deactivate') && ($intGlobalWriteAccess == 0)) {
// Deactivate selected datasets
$intReturn = $myDataClass->dataDeactivate($preTableName, $chkListId);
if ($intReturn == 1) {
$myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage);
}
if ($intReturn == 0) {
$myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage);
}
// Remove deactivated files
if ($preTableName == 'tbl_host') {
if ($chkListId != 0) {
$strChbName = 'chbId_' .$chkListId;
$_POST[$strChbName] = 'on';
}
// Get write access groups
$strAccess = $myVisClass->getAccessGroups('write');
// Getting data sets
$strSQL = 'SELECT `id`, `host_name` FROM `' .$preTableName. '` '
. "WHERE `active`='0' AND `access_group` IN ($strAccess) AND `config_id`=".$chkDomainId;
$booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDataCount);
if ($booReturn && ($intDataCount != 0) && ($chkDomainId != 0)) {
$intReturn = $myConfigClass->getConfigTargets($arrConfigID);
$intError = 0;
$intSuccess = 0;
if (($arrConfigID != 1) && is_array($arrConfigID)) {
foreach ($arrData as $elem) {
$strChbName = 'chbId_' .$elem['id'];
// was the current record is marked for deactivate?
if ((filter_input(INPUT_POST, $strChbName) != null) &&
(filter_input(INPUT_POST, $strChbName, FILTER_SANITIZE_STRING) == 'on')) {
$intCount = 0;
$intReturn = 0;
foreach ($arrConfigID as $intConfigID) {
$intReturn += $myConfigClass->moveFile('host', $elem['host_name']. '.cfg', $intConfigID);
if ($intReturn == 0) {
$myDataClass->writeLog(translate('Host file deleted:'). ' ' .$elem['host_name']
. '.cfg');
$intCount++;
}
}
if ($intReturn == 0) {
$intSuccess++;
}
if ($intReturn != 0) {
$intError++;
}
}
}
if (($intSuccess != 0) && ($intCount != 0)) {
$myVisClass->processMessage(translate('The assigned, no longer used configuration files were '
. 'deleted successfully!').$intCount, $strInfoMessage);
}
if ($intError != 0) {
$myVisClass->processMessage(translate('Errors while deleting the old configuration file - please '
. 'check!:'), $strErrorMessage);
}
}
} elseif ($chkDomainId == 0) {
$myVisClass->processMessage(translate('Common files cannot be removed from target systems - please check '
. 'manually'), $strErrorMessage);
}
} elseif ($preTableName == 'tbl_service') {
if ($chkListId != 0) {
$strChbName = 'chbId_' .$chkListId;
$_POST[$strChbName] = 'on';
}
// Get write access groups
$strAccess = $myVisClass->getAccessGroups('write');
// Getting data sets
$strSQL = 'SELECT `id`, `config_name` FROM `' .$preTableName. '` '
. "WHERE `active`='0' AND `access_group` IN ($strAccess) AND `config_id`=".$chkDomainId;
$booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDataCount);
if ($booReturn && ($intDataCount != 0) && ($chkDomainId != 0)) {
$intReturn = $myConfigClass->getConfigTargets($arrConfigID);
$intError = 0;
$intSuccess = 0;
if (($arrConfigID != 1) && is_array($arrConfigID)) {
$intCount = 0;
foreach ($arrData as $elem) {
$strChbName = 'chbId_' .$elem['id'];
// was the current record is marked for deactivate?
if (filter_input(INPUT_POST, $strChbName) && (filter_input(INPUT_POST, $strChbName) == 'on')) {
$intServiceCount = $myDBClass->countRows("SELECT * FROM `$preTableName` "
. "WHERE `$preKeyField`='".$elem['config_name']."' "
. "AND `config_id`=$chkDomainId AND `active`='1'");
if ($intServiceCount == 0) {
$intReturn = 0;
foreach ($arrConfigID as $intConfigID) {
$intReturn += $myConfigClass->moveFile(
'service',
$elem['config_name']. '.cfg',
$intConfigID
);
if ($intReturn == 0) {
$myDataClass->writeLog(translate('Service file deleted:'). ' ' .
$elem['config_name']. '.cfg');
}
$intCount++;
}
if ($intReturn == 0) {
$intSuccess++;
}
if ($intReturn != 0) {
$intError++;
}
}
}
}
if (($intSuccess != 0) && ($intCount != 0)) {
$myVisClass->processMessage(translate('The assigned, no longer used configuration files were '
. 'deleted successfully!'), $strInfoMessage);
}
if ($intError != 0) {
$myVisClass->processMessage(translate('Errors while deleting the old configuration file - please '
. 'check!:'), $strErrorMessage);
}
}
} elseif ($chkDomainId == 0) {
$myVisClass->processMessage(translate('Common files cannot be removed from target systems - please check '
. 'manually'), $strErrorMessage);
}
}
$chkModus = 'display';
} elseif (($chkModus == 'checkform') && ($chkSelModify == 'modify')) {
// Open the dataset to modify
if ($intReadAccessId == 0) {
$booReturn = $myDBClass->hasSingleDataset("SELECT * FROM `$preTableName` "
. 'WHERE `id`=' .$chkListId, $arrModifyData);
if ($booReturn == false) {
$myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage);
$myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage);
$chkModus = 'display';
} else {
$chkModus = 'add';
}
} else {
$myVisClass->processMessage(translate('No permission to open configuration!'), $strErrorMessage);
$chkModus = 'display';
}
} elseif (($chkModus == 'checkform') && ($chkSelModify == 'config') && ($intGlobalWriteAccess == 0)) {
// Write configuration file (hosts and services)
$intDSId = (int)substr(array_search('on', filter_input_array(INPUT_POST), true), 6);
if (isset($chkListId) && ($chkListId != 0)) {
$intDSId = $chkListId;
}
$intValCount = 0;
foreach (filter_input_array(INPUT_POST) as $key => $elem) {
if ($elem == 'on') {
$intValCount++;
}
}
if ($intValCount > 1) {
$intDSId = 0;
}
$intReturn = $myConfigClass->createConfigSingle($preTableName, $intDSId);
if ($intReturn == 1) {
$myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage);
}
if ($intReturn == 0) {
$myVisClass->processMessage($myConfigClass->strInfoMessage, $strInfoMessage);
}
$chkModus = 'display';
}
//
//
// Some common list view functions
// ===============================
if ($chkModus != "add") {
// Get Group id's with READ
$strAccess = $myVisClass->getAccGroups('read');
// Include domain list
$myVisClass->insertDomainList($mastertp);
// Process filter string
if ($chkModus != 'add') {
// Get Group id's with READ
$strAccess = $myVisClass->getAccessGroups('read');
// Include domain list
/** @var HTML_Template_IT $mastertp */
$myVisClass->insertDomainList($mastertp);
// Process filter string
}
?>