diff --git a/doc/LICENSE b/LICENSE similarity index 99% rename from doc/LICENSE rename to LICENSE index 67ed4d3..e30465d 100644 --- a/doc/LICENSE +++ b/LICENSE @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - NagiosQL Copyright (C) 2018 Martin Willisegger + NagiosQL Copyright (C) 2018 Martin This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/admin.php b/admin.php index 7ff5f2d..12fa519 100644 --- a/admin.php +++ b/admin.php @@ -1,39 +1,42 @@ Application version string + * @var string $setGITVersion from prepend_adm.php -> Application GIT subversion string + */ +/* +Path settings +*/ +$preRelPath = strstr(filter_input(INPUT_SERVER, 'PHP_SELF'), 'admin.php', true); +$preBasePath = strstr(filter_input(INPUT_SERVER, 'SCRIPT_FILENAME'), 'admin.php', true); +/* +Define common variables +*/ +$prePageId = 1; +$preContent = 'admin/mainpages.htm.tpl'; +$preAccess = 1; $preFieldvars = 1; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Include Content -// =============== +/* +Include preprocessing files +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Include Content +*/ $conttp->setVariable('TITLE', translate('NagiosQL Administration')); $conttp->parse('header'); $conttp->show('header'); @@ -42,10 +45,10 @@ $conttp->setVariable('DESC', translate('Welcome to NagiosQL, the administration . 'and can be written directly to the standard files at any time you want.')); $conttp->parse('main'); $conttp->show('main'); -// -// Include footer -// ============== +/* +Include footer +*/ $maintp->setVariable('VERSION_INFO', "NagiosQL $setFileVersion"); + . "target='_blank'>NagiosQL $setFileVersion - GIT Version: $setGITVersion"); $maintp->parse('footer'); -$maintp->show('footer'); +$maintp->show('footer'); \ No newline at end of file diff --git a/admin/administration.php b/admin/administration.php index 12f35c6..d5b7594 100644 --- a/admin/administration.php +++ b/admin/administration.php @@ -1,47 +1,49 @@ Application version string + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 7; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 7; $preContent = 'admin/mainpages.htm.tpl'; -// -// Include preprocessing file -// ========================== -require $preBasePath. 'functions/prepend_adm.php'; -// -// Include content -// =============== +/* +Include preprocessing file +*/ +require $preBasePath . 'functions/prepend_adm.php'; +/* +Include content +*/ $conttp->setVariable('TITLE', translate('Administration')); $conttp->parse('header'); $conttp->show('header'); $conttp->setVariable('DESC', translate('Functions to administrate NagiosQL V3')); $conttp->parse('main'); $conttp->show('main'); -// -// Include Footer -// ============== +/* +Include Footer +*/ $maintp->setVariable('VERSION_INFO', "NagiosQL $setFileVersion"); + . "target='_blank'>NagiosQL $setFileVersion"); $maintp->parse('footer'); -$maintp->show('footer'); +$maintp->show('footer'); \ No newline at end of file diff --git a/admin/alarming.php b/admin/alarming.php index f35dda0..74a38fc 100644 --- a/admin/alarming.php +++ b/admin/alarming.php @@ -1,92 +1,101 @@ setVariable('TITLE', translate('Alarming')); $conttp->setVariable('DESC', translate('To define contact data, contact templates and contact groups and time ' - . 'periods.')); + . 'periods.')); $conttp->setVariable('STATISTICS', translate('Statistical datas')); $conttp->setVariable('TYPE', translate('Group')); $conttp->setVariable('ACTIVE', translate('Active')); $conttp->setVariable('INACTIVE', translate('Inactive')); -// -// Include statistical data -// ======================== -// Get read access groups -$strAccess = $myVisClass->getAccessGroups('read'); +/* +Include statistical data +*/ +/* Get read access groups */ +$strAccess = $myVisClass->getAccessGroups('read'); $intGroupId14 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=14'); $intGroupId15 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=15'); $intGroupId16 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=16'); $intGroupId17 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=17'); -if ($myVisClass->checkAccountGroup($intGroupId14, 'read') == 0) { +if ($myVisClass->checkAccountGroup($intGroupId14, 'read') === 0) { $conttp->setVariable('NAME', translate('Contact data')); $conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_contact` ' - . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); + . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->setVariable('INACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_contact` ' - . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); + . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->parse('statisticrow'); } -if ($myVisClass->checkAccountGroup($intGroupId15, 'read') == 0) { +if ($myVisClass->checkAccountGroup($intGroupId15, 'read') === 0) { $conttp->setVariable('NAME', translate('Contact groups')); $conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_contactgroup` ' - . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); + . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->setVariable('INACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_contactgroup` ' - . "WHERE active='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); + . "WHERE active='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->parse('statisticrow'); } -if ($myVisClass->checkAccountGroup($intGroupId16, 'read') == 0) { +if ($myVisClass->checkAccountGroup($intGroupId16, 'read') === 0) { $conttp->setVariable('NAME', translate('Time periods')); $conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_timeperiod` ' - . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); + . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->setVariable('INACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_timeperiod` ' - . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); + . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->parse('statisticrow'); } -if ($myVisClass->checkAccountGroup($intGroupId17, 'read') == 0) { +if ($myVisClass->checkAccountGroup($intGroupId17, 'read') === 0) { $conttp->setVariable('NAME', translate('Contact templates')); $conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_contacttemplate` ' - . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); + . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->setVariable('INACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_contacttemplate` ' - . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); + . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->parse('statisticrow'); } $conttp->parse('statistics'); $conttp->parse('main'); $conttp->show('main'); -// -// Include Footer -// ============== +/* +Include Footer +*/ $maintp->setVariable('VERSION_INFO', "NagiosQL $setFileVersion"); + . "target='_blank'>NagiosQL $setFileVersion"); $maintp->parse('footer'); -$maintp->show('footer'); +$maintp->show('footer'); \ No newline at end of file diff --git a/admin/cgicfg.php b/admin/cgicfg.php index ff6b214..253c870 100644 --- a/admin/cgicfg.php +++ b/admin/cgicfg.php @@ -1,117 +1,136 @@ Application version string + * @var string $prePageKey from prepend_adm.php -> Menu group id + * @var string $chkTaFileText from prepend_content.php -> Text area + * @var array $arrDescription from fieldvars.php -> Translated common strings + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 29; -$preContent = 'admin/nagioscfg.htm.tpl'; -$preAccess = 1; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 29; +$preContent = 'admin/nagioscfg.htm.tpl'; +$preAccess = 1; $preFieldvars = 1; $intRemoveTmp = 0; -$strConfig = ''; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Get configuration set ID -// ======================== +$intMethod = 0; +$strConfig = ''; +$strErrorMessage = ''; +$strInfoMessage = ''; +/* +Include preprocessing file +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Get configuration set ID +*/ +$intMethod = 0; +$strMethod = ''; $myConfigClass->getConfigTargets($arrConfigSet); -$intConfigId = $arrConfigSet[0]; -$myConfigClass->getConfigValues($intConfigId, 'method', $intMethod); +$intConfigId = (int)$arrConfigSet[0]; +if ($myConfigClass->getConfigValues($intConfigId, 'method', $strMethod) === 0) { + $intMethod = (int)$strMethod; +} $myConfigClass->getConfigValues($intConfigId, 'nagiosbasedir', $strBaseDir); -$strConfigfile = str_replace('//', '/', $strBaseDir. '/cgi.cfg'); -$strLocalBackup = str_replace('//', '/', $strBaseDir. '/cgi.cfg_old_').date('YmdHis'); -// -// Convert Windows to UNIX -// ======================= +$strConfigfile = str_replace('//', '/', $strBaseDir . '/cgi.cfg'); +$strLocalBackup = str_replace('//', '/', $strBaseDir . '/cgi.cfg_old_') . date('YmdHis'); +/* +Convert Windows LF to UNIX LF +*/ $chkTaFileText = str_replace("\r\n", "\n", $chkTaFileText); -// -// Process data -// ============ -if (($chkTaFileText != '') && ($arrConfigSet[0] != 0)) { - if ($intMethod == 1) { +/* +Process data +*/ +if (($chkTaFileText !== '') && ($arrConfigSet[0] !== 0)) { + if ($intMethod === 1) { if (file_exists($strBaseDir) && (is_writable($strBaseDir) && is_writable($strConfigfile))) { - // Backup config file + /* Backup config file */ $intReturn = $myConfigClass->moveFile('nagiosbasic', 'cgi.cfg', $intConfigId); - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } - // Write configuration + /* Write configuration */ $resFile = fopen($strConfigfile, 'wb'); fwrite($resFile, $chkTaFileText); fclose($resFile); - $myVisClass->processMessage('' .translate('Configuration file successfully ' - . 'written!'). '', $strInfoMessage); - $myDataClass->writeLog(translate('Configuration successfully written:'). ' ' .$strConfigfile); + $myVisClass->processMessage('' . translate('Configuration file successfully ' + . 'written!') . '', $strInfoMessage); + $myDataClass->writeLog(translate('Configuration successfully written:') . ' ' . $strConfigfile); } else { $myVisClass->processMessage(translate('Cannot open/overwrite the configuration file (check the ' - . 'permissions)!'), $strErrorMessage); - $myDataClass->writeLog(translate('Configuration write failed:'). ' ' .$strConfigfile); + . 'permissions)!'), $strErrorMessage); + $myDataClass->writeLog(translate('Configuration write failed:') . ' ' . $strConfigfile); } - } elseif (($intMethod == 2) || ($intMethod == 3)) { - // Backup config file + } elseif (($intMethod === 2) || ($intMethod === 3)) { + /* Backup config file */ $intReturn1 = $myConfigClass->moveFile('nagiosbasic', 'cgi.cfg', $intConfigId); - if ($intReturn1 == 1) { + if ($intReturn1 === 1) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } - // Write file to temporary + /* Write file to temporary */ $strFileName = tempnam($_SESSION['SETS']['path']['tempdir'], 'nagiosql_cgi'); $resFile = fopen($strFileName, 'wb'); fwrite($resFile, $chkTaFileText); fclose($resFile); - // Copy configuration to remoty system + /* Copy configuration to remoty system */ $intReturn2 = $myConfigClass->remoteFileCopy($strConfigfile, $intConfigId, $strFileName, 1); - if ($intReturn2 == 0) { - $myVisClass->processMessage('' .translate('Configuration file successfully ' - . 'written!'). '', $strInfoMessage); - $myDataClass->writeLog(translate('Configuration successfully written:'). ' ' .$strConfigfile); - unlink($strFileName); + if ($intReturn2 === 0) { + $myVisClass->processMessage('' . translate('Configuration file successfully ' + . 'written!') . '', $strInfoMessage); + $myDataClass->writeLog(translate('Configuration successfully written:') . ' ' . $strConfigfile); } else { $myVisClass->processMessage(translate('Cannot open/overwrite the configuration file (check the permissions ' - . 'on remote system)!'), $strErrorMessage); - $myDataClass->writeLog(translate('Configuration write failed (remote):'). ' ' .$strConfigfile); - unlink($strFileName); + . 'on remote system)!'), $strErrorMessage); + $myDataClass->writeLog(translate('Configuration write failed (remote):') . ' ' . $strConfigfile); } + unlink($strFileName); } -} elseif ($arrConfigSet[0] == 0) { - $myVisClass->processMessage(translate('There are no nagios configuration files in common domain, please select a '. +} elseif ($arrConfigSet[0] === 0) { + $myVisClass->processMessage(translate('There are no nagios configuration files in common domain, please select a ' . 'valid domain to edit this files!'), $strErrorMessage); } -// -// Include content -// =============== +/* +Include content +*/ $conttp->setVariable('TITLE', translate('CGI configuration file')); -$conttp->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$conttp->setVariable('MAINSITE', $_SESSION['SETS']['path']['base_url']. 'admin.php'); +$conttp->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF')); +$conttp->setVariable('MAINSITE', $_SESSION['SETS']['path']['base_url'] . 'admin.php'); foreach ($arrDescription as $elem) { $conttp->setVariable($elem['name'], $elem['string']); } -// -// Open configuration -// ================== -if ($intMethod == 1) { +/* +Open configuration +*/ +if ($intMethod === 1) { if (file_exists($strConfigfile) && is_readable($strConfigfile)) { $resFile = fopen($strConfigfile, 'rb'); if ($resFile) { @@ -122,13 +141,13 @@ if ($intMethod == 1) { } else { $myVisClass->processMessage(translate('Cannot open the data file (check the permissions)!'), $strErrorMessage); } -} elseif (($intMethod == 2) || ($intMethod == 3)) { - // Write file to temporary +} elseif (($intMethod === 2) || ($intMethod === 3)) { + /* Write file to temporary */ $strFileName = tempnam($_SESSION['SETS']['path']['tempdir'], 'nagiosql_cgi'); - // Copy configuration from remoty system + /* Copy configuration from remoty system */ $myConfigClass->strErrorMessage = ''; - $intReturn = $myConfigClass->remoteFileCopy($strConfigfile, $intConfigId, $strFileName, 0); - if ($intReturn == 0) { + $intReturn = $myConfigClass->remoteFileCopy($strConfigfile, $intConfigId, $strFileName); + if ($intReturn === 0) { $resFile = fopen($strFileName, 'rb'); if (is_resource($resFile)) { while (!feof($resFile)) { @@ -140,27 +159,27 @@ if ($intMethod == 1) { } } else { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); - $myDataClass->writeLog(translate('Configuration read failed (remote):'). ' ' .$strErrorMessage); + $myDataClass->writeLog(translate('Configuration read failed (remote):') . ' ' . $strErrorMessage); if (file_exists($strFileName)) { unlink($strFileName); } } } $conttp->setVariable('DAT_NAGIOS_CONFIG', $strConfig); -if ($strErrorMessage != '') { +if ($strErrorMessage !== '') { $conttp->setVariable('ERRORMESSAGE', $strErrorMessage); } $conttp->setVariable('INFOMESSAGE', $strInfoMessage); -// Check access rights for adding new objects -if ($myVisClass->checkAccountGroup($prePageKey, 'write') != 0) { +/* Check access rights for adding new objects */ +if ($myVisClass->checkAccountGroup($prePageKey, 'write') !== 0) { $conttp->setVariable('ADD_CONTROL', 'disabled="disabled"'); } $conttp->parse('naginsert'); $conttp->show('naginsert'); -// -// Process footer -// ============== +/* +Process footer +*/ $maintp->setVariable('VERSION_INFO', "NagiosQL $setFileVersion"); + . "target='_blank'>NagiosQL $setFileVersion"); $maintp->parse('footer'); -$maintp->show('footer'); +$maintp->show('footer'); \ No newline at end of file diff --git a/admin/checkcommands.php b/admin/checkcommands.php index 69ca44a..2db5233 100644 --- a/admin/checkcommands.php +++ b/admin/checkcommands.php @@ -1,68 +1,115 @@ Application version string + * @var string $chkModus from prepend_adm.php -> Form work mode + * @var int $chkDataId from prepend_adm.php -> Actual dataset id + * @var string $chkSelModify from prepend_adm.php -> Modification selection value + * @var int $hidSortBy from prepend_adm.php -> Sort data by + * @var string $hidSortDir from prepend_adm.php -> Sort data direction (ASC, DESC) + * @var int $chkLimit from prepend_adm.php / settings -> Data set count per page + * @var int $intVersion from prepend_adm.php -> Nagios version + * @var array $SETS Settings array + * @var int $intGlobalWriteAccess from prepend_content.php -> Global admin write access + * @var int $intWriteAccessId from prepend_content.php -> Admin write access to actual dataset id + * @var string $strAccess from prepend_content.php -> List of read access group id's for actual user + * @var string $preSQLCommon1 from prepend_content.php -> Common SQL part 1 + * @var string $strDomainWhere from prepend_adm.php -> Domain selection SQL part with table name + * @var string $chkTfValue1 from prepend_content.php -> Command name + * @var string $chkTfSpValue1 from prepend_content.php -> Command definition + * @var int $chkSelValue1 from prepend_content.php -> Command type + * @var string $chkTaArg1Info from prepend_content.php -> Command argument 1 information + * @var string $chkTaArg2Info from prepend_content.php -> Command argument 2 information + * @var string $chkTaArg3Info from prepend_content.php -> Command argument 3 information + * @var string $chkTaArg4Info from prepend_content.php -> Command argument 4 information + * @var string $chkTaArg5Info from prepend_content.php -> Command argument 5 information + * @var string $chkTaArg6Info from prepend_content.php -> Command argument 6 information + * @var string $chkTaArg7Info from prepend_content.php -> Command argument 7 information + * @var string $chkTaArg8Info from prepend_content.php -> Command argument 8 information + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 18; -$preContent = 'admin/checkcommands.htm.tpl'; -$preListTpl = 'admin/datalist.htm.tpl'; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 18; +$preContent = 'admin/checkcommands.htm.tpl'; +$preListTpl = 'admin/datalist.htm.tpl'; $preSearchSession = 'checkcommand'; -$preTableName = 'tbl_command'; -$preKeyField = 'command_name'; -$preAccess = 1; -$preFieldvars = 1; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Add or modify data -// ================== -if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAccess == 0)) { - $strSQLx = "`$preTableName` SET `$preKeyField`='$chkTfValue1', `command_line`='$chkTfValue2', " - . "`command_type`=$chkSelValue1, $preSQLCommon1"; - if ($chkModus == 'insert') { - $strSQL = 'INSERT INTO ' .$strSQLx; +$preTableName = 'tbl_command'; +$preKeyField = 'command_name'; +$preAccess = 1; +$preFieldvars = 1; +$intDataWarning = 0; +$strErrorMessage = ''; +$strInfoMessage = ''; +$strConsistMessage = ''; +$strDBWarning = ''; +/* +Include preprocessing file +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Add or modify data +*/ +if ((($chkModus === 'insert') || ($chkModus === 'modify')) && ($intGlobalWriteAccess === 0)) { + $strSQLx = "`$preTableName` SET `$preKeyField`='$chkTfValue1', `command_line`='$chkTfSpValue1', " + . "`command_type`=$chkSelValue1, $preSQLCommon1, `arg1_info`='$chkTaArg1Info', " + . "`arg2_info`='$chkTaArg2Info', `arg3_info`='$chkTaArg3Info', `arg4_info`='$chkTaArg4Info', " + . "`arg5_info`='$chkTaArg5Info', `arg6_info`='$chkTaArg6Info', `arg7_info`='$chkTaArg7Info', " + . "`arg8_info`='$chkTaArg8Info'"; + if ($chkModus === 'insert') { + $strSQL = 'INSERT INTO ' . $strSQLx; } else { - $strSQL = 'UPDATE ' .$strSQLx. ' WHERE `id`=' .$chkDataId; + $strSQL = 'UPDATE ' . $strSQLx . ' WHERE `id`=' . $chkDataId; } - if ($intWriteAccessId == 0) { - if (($chkTfValue1 != '') && ($chkTfValue2 != '')) { + if ($intWriteAccessId === 0) { + if (($chkTfValue1 !== '') && ($chkTfSpValue1 !== '')) { $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($chkModus == 'insert') { + if ($chkModus === 'insert') { $chkDataId = $intInsertId; } - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); $myDataClass->updateStatusTable($preTableName); - if ($chkModus == 'insert') { - $myDataClass->writeLog(translate('New command inserted:'). ' ' .$chkTfValue1); + if ($chkModus === 'insert') { + $myDataClass->writeLog(translate('New command inserted:') . ' ' . $chkTfValue1); } - if ($chkModus == 'modify') { - $myDataClass->writeLog(translate('Command modified:'). ' ' .$chkTfValue1); + if ($chkModus === 'modify') { + $myDataClass->writeLog(translate('Command modified:') . ' ' . $chkTfValue1); } } } else { @@ -76,36 +123,33 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } $chkModus = 'display'; } -if ($chkModus != 'add') { +if ($chkModus !== 'add') { $chkModus = 'display'; } -// -// Get date/time of last database and config file manipulation -// =========================================================== +/* +Get date/time of last database and config file manipulation +*/ $intReturn = $myConfigClass->lastModifiedFile($preTableName, $arrTimeData, $strTimeInfoString); -if ($intReturn != 0) { +if ($intReturn !== 0) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } -// -// Singe data form -// =============== -if ($chkModus == 'add') { - // Do not show modified time list +/* +Singe data form +*/ +$intNoTime = 0; +if ($chkModus === 'add') { + /* Do not show modified time list */ $intNoTime = 1; - // Process access group selection field - if (isset($arrModifyData['access_group'])) { - $intFieldId = $arrModifyData['access_group']; - } else { - $intFieldId = 0; - } + /* Process access group selection field */ + $intFieldId = $arrModifyData['access_group'] ?? 0; $intReturn = $myVisClass->parseSelectSimple('tbl_group', 'groupname', 'acc_group', 0, $intFieldId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Initial add/modify form definitions + /* Initial add/modify form definitions */ $myContentClass->addFormInit($conttp); - if ($intDataWarning == 1) { - $conttp->setVariable('WARNING', $strDBWarning. '
' .translate('Saving not possible!')); + if ($intDataWarning === 1) { + $conttp->setVariable('WARNING', $strDBWarning . '
' . translate('Saving not possible!')); } if ($intVersion < 3) { $conttp->setVariable('VERSION_20_VALUE_MUST', 'mselValue1,'); @@ -114,52 +158,56 @@ if ($chkModus == 'add') { $conttp->setVariable('NO_TYPE', translate('unclassified')); $conttp->setVariable('CHECK_TYPE', translate('check command')); $conttp->setVariable('MISC_TYPE', translate('misc command')); - // Insert data from database in "modify" mode - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - // Check relation information to find out locked configuration datasets + /* Insert data from database in "modify" mode */ + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + /* Check relation information to find out locked configuration datasets */ $intLocked = $myDataClass->infoRelation($preTableName, $arrModifyData['id'], $preKeyField); $myVisClass->processMessage($myDataClass->strInfoMessage, $strRelMessage); - $strInfo = '
' .translate('Entry cannot be activated because it is used by ' - . 'another configuration'). ':'; - $strInfo .= '
' .$strRelMessage. ''; - // Process data + $strInfo = '
' . translate('Entry cannot be activated because it is used by ' + . 'another configuration') . ':'; + $strInfo .= '
' . $strRelMessage . ''; + /* Process data */ $myContentClass->addInsertData($conttp, $arrModifyData, $intLocked, $strInfo); - // Insert command type - if ($arrModifyData['command_type'] == 1) { + /* Insert command type */ + if ((int)$arrModifyData['command_type'] === 1) { $conttp->setVariable('CHECK_TYPE_SELECTED', 'selected'); } - if ($arrModifyData['command_type'] == 2) { + if ((int)$arrModifyData['command_type'] === 2) { $conttp->setVariable('MISC_TYPE_SELECTED', 'selected'); } } $conttp->parse('datainsert'); $conttp->show('datainsert'); } -// -// List view -// ========== -if ($chkModus == 'display') { - // Initial list view definitions +/* +List view +*/ +if ($chkModus === 'display') { + /* Initial list view definitions */ $myContentClass->listViewInit($mastertp); $mastertp->setVariable('TITLE', translate('Command definitions')); $mastertp->setVariable('FIELD_1', translate('Command name')); $mastertp->setVariable('FIELD_2', translate('Command line')); - // Process search string - if ($_SESSION['search'][$preSearchSession] != '') { - $strSearchTxt = $_SESSION['search'][$preSearchSession]; - $strSearchWhere = "AND (`$preKeyField` LIKE '%".$strSearchTxt."%' " - . "OR `command_line` LIKE '%".$strSearchTxt."%')"; + $mastertp->setVariable('FILTER_VISIBLE', 'visibility: hidden'); + /* Process search string */ + $strSearchWhere = ''; + if ($_SESSION['search'][$preSearchSession] !== '') { + $strSearchTxt = $_SESSION['search'][$preSearchSession]; + $strSearchWhere = "AND (`$preKeyField` LIKE '%" . $strSearchTxt . "%' " + . "OR `command_line` LIKE '%" . $strSearchTxt . "%')"; } - // Row sorting + /* Row sorting */ $strOrderString = "ORDER BY `config_id`, `$preKeyField` $hidSortDir"; - if ($hidSortBy == 2) { + if ($hidSortBy === 2) { $strOrderString = "ORDER BY `config_id`, `command_line` $hidSortDir"; } - // Count datasets - $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` " - . "WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess)"; + /* Count datasets */ + $intLineCount = 0; + /** @noinspection SqlResolve */ + $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` " + . "WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess)"; $booReturn1 = $myDBClass->hasSingleDataset($strSQL, $arrDataLinesCount); - if ($booReturn1 == false) { + if ($booReturn1 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { @@ -168,19 +216,19 @@ if ($chkModus == 'display') { $chkLimit = 0; } } - // Get datasets - $strSQL = "SELECT `id`, `$preKeyField`, `command_line`, `register`, `active`, `config_id`, `access_group` " - . "FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere " - . "AND `access_group` IN ($strAccess) $strOrderString LIMIT $chkLimit,".$SETS['common']['pagelines']; + /* Get datasets */ + $strSQL = "SELECT `id`, `$preKeyField`, `command_line`, `register`, `active`, `config_id`, `access_group` " + . "FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere " + . "AND `access_group` IN ($strAccess) $strOrderString LIMIT $chkLimit," . $SETS['common']['pagelines']; $booReturn2 = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - if ($booReturn2 == false) { + if ($booReturn2 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - // Process data + /* Process data */ $myContentClass->listData($mastertp, $arrDataLines, $intDataCount, $intLineCount, $preKeyField, 'command_line', 40); } -// Show messages +/* Show messages */ $myContentClass->showMessages( $mastertp, $strErrorMessage, @@ -190,7 +238,7 @@ $myContentClass->showMessages( $strTimeInfoString, $intNoTime ); -// -// Process footer -// ============== -$myContentClass->showFooter($maintp, $setFileVersion); +/* +Process footer + */ +$myContentClass->showFooter($maintp, $setFileVersion); \ No newline at end of file diff --git a/admin/commandline.php b/admin/commandline.php index 2ea41f0..182d5d4 100644 --- a/admin/commandline.php +++ b/admin/commandline.php @@ -1,59 +1,62 @@ getFieldData("SELECT command_line FROM tbl_command WHERE id='". - filter_var($_GET['cname'], FILTER_SANITIZE_NUMBER_INT)."'"); - if (($strResult != false) && ($strResult != '')) { +$intCount = 0; +/* +Get database values +*/ +if (isset($_GET['cname']) && ($_GET['cname'] !== '')) { + $strResult = $myDBClass->getFieldData("SELECT command_line FROM tbl_command WHERE id='" . + filter_var($_GET['cname'], FILTER_SANITIZE_NUMBER_INT) . "'"); + if ($strResult !== '') { $strCommandLine = $strResult; $intCount = substr_count($strCommandLine, 'ARG'); - if (substr_count($strCommandLine, 'ARG8') != 0) { + if (substr_count($strCommandLine, 'ARG8') !== 0) { $intCount = 8; - } elseif (substr_count($strCommandLine, 'ARG7') != 0) { + } elseif (substr_count($strCommandLine, 'ARG7') !== 0) { $intCount = 7; - } elseif (substr_count($strCommandLine, 'ARG6') != 0) { + } elseif (substr_count($strCommandLine, 'ARG6') !== 0) { $intCount = 6; - } elseif (substr_count($strCommandLine, 'ARG5') != 0) { + } elseif (substr_count($strCommandLine, 'ARG5') !== 0) { $intCount = 5; - } elseif (substr_count($strCommandLine, 'ARG4') != 0) { + } elseif (substr_count($strCommandLine, 'ARG4') !== 0) { $intCount = 4; - } elseif (substr_count($strCommandLine, 'ARG3') != 0) { + } elseif (substr_count($strCommandLine, 'ARG3') !== 0) { $intCount = 3; - } elseif (substr_count($strCommandLine, 'ARG2') != 0) { + } elseif (substr_count($strCommandLine, 'ARG2') !== 0) { $intCount = 2; - } elseif (substr_count($strCommandLine, 'ARG1') != 0) { + } elseif (substr_count($strCommandLine, 'ARG1') !== 0) { $intCount = 1; } else { $intCount = 0; @@ -61,30 +64,31 @@ if (isset($_GET['cname']) && ($_GET['cname'] != '')) { } } ?> - - - - Commandline - - - - - - - + + + + Commandline + + + + + + + \ No newline at end of file diff --git a/admin/commands.php b/admin/commands.php index e5a1702..2f627c1 100644 --- a/admin/commands.php +++ b/admin/commands.php @@ -1,65 +1,74 @@ setVariable('TITLE', translate('Check commands')); $conttp->setVariable('DESC', translate('To define check and misc commands, notification commands and special ' - . 'commands.')); + . 'commands.')); $conttp->setVariable('STATISTICS', translate('Statistical datas')); $conttp->setVariable('TYPE', translate('Group')); $conttp->setVariable('ACTIVE', translate('Active')); $conttp->setVariable('INACTIVE', translate('Inactive')); -// -// Include statistical data -// ======================== -// Get read access groups -$strAccess = $myVisClass->getAccessGroups('read'); +/* +Include statistical data +*/ +/* Get read access groups */ +$strAccess = $myVisClass->getAccessGroups('read'); $intGroupId = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=18'); -if ($myVisClass->checkAccountGroup($intGroupId, 'read') == 0) { +if ($myVisClass->checkAccountGroup($intGroupId, 'read') === 0) { $conttp->setVariable('NAME', translate('Check commands')); $conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_command` ' - . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); + . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->setVariable('INACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_command` ' - . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); + . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->parse('statisticrow'); } $conttp->parse('statistics'); $conttp->parse('main'); $conttp->show('main'); -// -// Include Footer -// ============== +/* +Include Footer +*/ $maintp->setVariable('VERSION_INFO', "NagiosQL $setFileVersion"); + . "target='_blank'>NagiosQL $setFileVersion"); $maintp->parse('footer'); -$maintp->show('footer'); +$maintp->show('footer'); \ No newline at end of file diff --git a/admin/configtargets.php b/admin/configtargets.php index 409e069..914151d 100644 --- a/admin/configtargets.php +++ b/admin/configtargets.php @@ -1,47 +1,101 @@ Application version string + * @var int $chkActive from prepend_adm.php -> Active checkbox + * @var string $chkModus from prepend_adm.php -> Form work mode + * @var int $chkDataId from prepend_adm.php -> Actual dataset id + * @var string $chkSelModify from prepend_adm.php -> Modification selection value + * @var int $hidSortBy from prepend_adm.php -> Sort data by + * @var string $hidSortDir from prepend_adm.php -> Sort data direction (ASC, DESC) + * @var int $chkLimit from prepend_adm.php / settings -> Data set count per page + * @var array $SETS Settings array + * @var int $intGlobalWriteAccess from prepend_content.php -> Global admin write access + * @var int $intWriteAccessId from prepend_content.php -> Admin write access to actual dataset id + * @var string $strAccess from prepend_content.php -> List of read access group id's for actual user + * @var string $chkTfValue1 from prepend_content.php -> Configuration target name + * @var string $chkTfValue2 from prepend_content.php -> Configuration target description + * @var string $chkTfValue4 from prepend_content.php -> Server name + * @var string $chkTfValue5 from prepend_content.php -> User name + * @var string $chkTfValue6 from prepend_content.php -> Password + * @var string $chkTfValue7 from prepend_content.php -> ssh key file path + * @var string $chkTfValue8 from prepend_content.php -> Base directory + * @var string $chkTfValue9 from prepend_content.php -> Host configuration directory + * @var string $chkTfValue10 from prepend_content.php -> Service configuration directory + * @var string $chkTfValue11 from prepend_content.php -> Backup directory + * @var string $chkTfValue12 from prepend_content.php -> Host backup directory + * @var string $chkTfValue13 from prepend_content.php -> Service backup directory + * @var string $chkTfValue14 from prepend_content.php -> Nagios base directory + * @var string $chkTfValue15 from prepend_content.php -> Import directory + * @var string $chkTfValue16 from prepend_content.php -> Picture directory + * @var string $chkTfValue17 from prepend_content.php -> Command file + * @var string $chkTfValue18 from prepend_content.php -> Binary file + * @var string $chkTfValue19 from prepend_content.php -> Nagios PID file + * @var string $chkTfValue20 from prepend_content.php -> Nagios configuration file + * @var string $chkTfValue21 from prepend_content.php -> CGI configuration file + * @var string $chkTfValue22 from prepend_content.php -> Ressource file + * @var string $chkTfValue23 from prepend_content.php -> ssh port + * @var int $chkSelValue1 from prepend_content.php -> Configuration access method (file based, ssh, ftp) + * @var int $chkSelValue2 from prepend_content.php -> Nagios version + * @var int $chkChbValue1 from prepend_content.php -> Use secure ftp + * @var int $chkSelAccGr from prepend_content.php -> Access group selector + */ + + $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 36; -$preContent = 'admin/configtargets.htm.tpl'; -$preListTpl = 'admin/datalist_common.htm.tpl'; -$preTableName = 'tbl_configtarget'; -$preKeyField = 'target'; -$preAccess = 1; -$preFieldvars = 1; -$intIsError = 0; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 36; +$preContent = 'admin/configtargets.htm.tpl'; +$preListTpl = 'admin/datalist_common.htm.tpl'; +$preTableName = 'tbl_configtarget'; +$preKeyField = 'target'; +$preAccess = 1; +$preFieldvars = 1; +$intIsError = 0; $strPathMessage = ''; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Process path values (add slashes) -// ================================= -$chkTfValue8 = $myVisClass->addSlash($chkTfValue8); -$chkTfValue9 = $myVisClass->addSlash($chkTfValue9); +$strErrorMessage = ''; +$strInfoMessage = ''; +$strConsistMessage = ''; +/* +Include preprocessing file +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Process path values (add slashes) +*/ +$chkTfValue8 = $myVisClass->addSlash($chkTfValue8); +$chkTfValue9 = $myVisClass->addSlash($chkTfValue9); $chkTfValue10 = $myVisClass->addSlash($chkTfValue10); $chkTfValue11 = $myVisClass->addSlash($chkTfValue11); $chkTfValue12 = $myVisClass->addSlash($chkTfValue12); @@ -49,22 +103,28 @@ $chkTfValue13 = $myVisClass->addSlash($chkTfValue13); $chkTfValue14 = $myVisClass->addSlash($chkTfValue14); $chkTfValue15 = $myVisClass->addSlash($chkTfValue15); $chkTfValue16 = $myVisClass->addSlash($chkTfValue16); -// -// Check if the permissions and other parameters -// ============================================= -if (($chkModus == 'modify' || $chkModus == 'insert') && $chkDataId != 0) { - if ($chkSelValue1 == 1) { - $arrPaths = array($chkTfValue8,$chkTfValue9,$chkTfValue10,$chkTfValue11,$chkTfValue12,$chkTfValue13); +/* +Check Port Value +*/ +if ((int)$chkTfValue23 === 0) { + $chkTfValue23 = 22; +} +/* +Check the permissions and other parameters +*/ +if (($chkModus === 'modify' || $chkModus === 'insert') && $chkDataId !== 0) { + if ($chkSelValue1 === 1) { + $arrPaths = array($chkTfValue8, $chkTfValue9, $chkTfValue10, $chkTfValue11, $chkTfValue12, $chkTfValue13); foreach ($arrPaths as $elem) { - if ($myConfigClass->isDirWriteable($elem) == 1) { - $myVisClass->processMessage($elem. ' ' .translate('is not writeable'), $strPathMessage); + if ($myConfigClass->isDirWriteable($elem) === 1) { + $myVisClass->processMessage($elem . ' ' . translate('is not writeable'), $strPathMessage); $intIsError = 1; } } - // Nagios base configuration files + /* Nagios base configuration files */ if (!is_writable($chkTfValue20)) { - $myVisClass->processMessage(str_replace(' ', ' ', translate('Nagios config file'). ' ' .$chkTfValue20 - . ' ' .translate('is not writeable')), $strPathMessage); + $myVisClass->processMessage(str_replace(' ', ' ', translate('Nagios config file') . ' ' . $chkTfValue20 + . ' ' . translate('is not writeable')), $strPathMessage); $intIsError = 1; } else { $intCheck = 0; @@ -72,79 +132,79 @@ if (($chkModus == 'modify' || $chkModus == 'insert') && $chkDataId != 0) { $resFile = fopen($chkTfValue20, 'rb'); while (!feof($resFile)) { $strLine = trim(fgets($resFile)); - if ((substr_count($strLine, 'cfg_dir') != 0) || (substr_count($strLine, 'cfg_file') != 0)) { + if ((substr_count($strLine, 'cfg_dir') !== 0) || (substr_count($strLine, 'cfg_file') !== 0)) { $intCheck = 1; } } fclose($resFile); } - if ($intCheck == 0) { - $myVisClass->processMessage(str_replace(' ', ' ', translate('Nagios config file'). ' ' . - $chkTfValue20. ' ' .translate('is not a valid configuration file!')), $strPathMessage); + if ($intCheck === 0) { + $myVisClass->processMessage(str_replace(' ', ' ', translate('Nagios config file') . ' ' . + $chkTfValue20 . ' ' . translate('is not a valid configuration file!')), $strPathMessage); $intIsError = 1; } } if (!is_writable($chkTfValue14)) { - $myVisClass->processMessage(str_replace(' ', ' ', translate('Nagios base directory'). ' ' . - $chkTfValue14. ' ' .translate('is not writeable')), $strPathMessage); + $myVisClass->processMessage(str_replace(' ', ' ', translate('Nagios base directory') . ' ' . + $chkTfValue14 . ' ' . translate('is not writeable')), $strPathMessage); $intIsError = 1; } if (!is_writable($chkTfValue21)) { - $myVisClass->processMessage(str_replace(' ', ' ', translate('Nagios cgi config file'). ' ' . - $chkTfValue21. ' ' .translate('is not writeable')), $strPathMessage); + $myVisClass->processMessage(str_replace(' ', ' ', translate('Nagios cgi config file') . ' ' . + $chkTfValue21 . ' ' . translate('is not writeable')), $strPathMessage); $intIsError = 1; } if (!is_readable($chkTfValue22)) { - $myVisClass->processMessage(str_replace(' ', ' ', translate('Nagios resource config file'). ' ' . - $chkTfValue22. ' ' .translate('is not readable')), $strPathMessage); + $myVisClass->processMessage(str_replace(' ', ' ', translate('Nagios resource config file') . ' ' . + $chkTfValue22 . ' ' . translate('is not readable')), $strPathMessage); $intIsError = 1; } } - // Check SSH Method - if (($chkSelValue1 == 3) && !function_exists('ssh2_connect')) { + /* Check SSH Method */ + if (($chkSelValue1 === 3) && !function_exists('ssh2_connect')) { $myVisClass->processMessage(translate('SSH module not loaded!'), $strPathMessage); $intIsError = 1; } - // Check FTP Method - if (($chkSelValue1 == 2) && !function_exists('ftp_connect')) { + /* Check FTP Method */ + if (($chkSelValue1 === 2) && !function_exists('ftp_connect')) { $myVisClass->processMessage(translate('FTP module not loaded!'), $strPathMessage); $intIsError = 1; } - if ($intIsError == 1) { - $chkModus = 'add'; + if ($intIsError === 1) { + $chkModus = 'add'; $chkSelModify = 'errormodify'; } } -// -// Add or modify data -// ================== -if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAccess == 0)) { +/* +Add or modify data +*/ +if ((($chkModus === 'insert') || ($chkModus === 'modify')) && ($intGlobalWriteAccess === 0)) { $strSQLx = "`$preTableName` SET `$preKeyField`='$chkTfValue1', `alias`='$chkTfValue2', `server`='$chkTfValue4', " - . "`method`='$chkSelValue1', `user`='$chkTfValue5', `password`='$chkTfValue6', " - . "`ssh_key_path`='$chkTfValue7', `ftp_secure`=$chkChbValue1, `basedir`='$chkTfValue8', " - . "`hostconfig`='$chkTfValue9', `serviceconfig`='$chkTfValue10', `backupdir`='$chkTfValue11', " - . "`hostbackup`='$chkTfValue12', `servicebackup`='$chkTfValue13', `nagiosbasedir`='$chkTfValue14', " - . "`importdir`='$chkTfValue15', `picturedir`='$chkTfValue16', `commandfile`='$chkTfValue17', " - . "`binaryfile`='$chkTfValue18', `pidfile`='$chkTfValue19', `conffile`='$chkTfValue20', " - . "`cgifile`='$chkTfValue21', `resourcefile`='$chkTfValue22',`version`=$chkSelValue2, " - . "`access_group`=$chkSelAccGr, `active`='$chkActive',`last_modified`=NOW()"; - if ($chkModus == 'insert') { - $strSQL = 'INSERT INTO ' .$strSQLx; + . "`port`='$chkTfValue23', `method`='$chkSelValue1', `user`='$chkTfValue5', `password`='$chkTfValue6', " + . "`ssh_key_path`='$chkTfValue7', `ftp_secure`=$chkChbValue1, `basedir`='$chkTfValue8', " + . "`hostconfig`='$chkTfValue9', `serviceconfig`='$chkTfValue10', `backupdir`='$chkTfValue11', " + . "`hostbackup`='$chkTfValue12', `servicebackup`='$chkTfValue13', `nagiosbasedir`='$chkTfValue14', " + . "`importdir`='$chkTfValue15', `picturedir`='$chkTfValue16', `commandfile`='$chkTfValue17', " + . "`binaryfile`='$chkTfValue18', `pidfile`='$chkTfValue19', `conffile`='$chkTfValue20', " + . "`cgifile`='$chkTfValue21', `resourcefile`='$chkTfValue22',`version`=$chkSelValue2, " + . "`access_group`=$chkSelAccGr, `active`='$chkActive',`last_modified`=NOW()"; + if ($chkModus === 'insert') { + $strSQL = 'INSERT INTO ' . $strSQLx; } else { - $strSQL = 'UPDATE ' .$strSQLx. ' WHERE `id`=' .$chkDataId; + $strSQL = 'UPDATE ' . $strSQLx . ' WHERE `id`=' . $chkDataId; } - if ($intWriteAccessId == 0) { - if (($chkTfValue1 != '') && ($chkTfValue2 != '') && (($chkTfValue4 != '') || ($chkDataId == 0))) { + if ($intWriteAccessId === 0) { + if (($chkTfValue1 !== '') && ($chkTfValue2 !== '') && (($chkTfValue4 !== '') || ($chkDataId === 0))) { $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); - if ($chkModus == 'insert') { - $myDataClass->writeLog(translate('New Domain inserted:'). ' ' .$chkTfValue1); + if ($chkModus === 'insert') { + $myDataClass->writeLog(translate('New Domain inserted:') . ' ' . $chkTfValue1); } - if ($chkModus == 'modify') { - $myDataClass->writeLog(translate('Domain modified:'). ' ' .$chkTfValue1); + if ($chkModus === 'modify') { + $myDataClass->writeLog(translate('Domain modified:') . ' ' . $chkTfValue1); } } } else { @@ -158,77 +218,73 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } $chkModus = 'display'; } -if ($chkModus != 'add') { +if ($chkModus !== 'add') { $chkModus = 'display'; } -// -// Single view -// =========== -if ($chkModus == 'add') { - // Process acces group selection field - if (isset($arrModifyData['access_group'])) { - $intFieldId = $arrModifyData['access_group']; - } else { - $intFieldId = 0; - } +/* +Single view +*/ +if ($chkModus === 'add') { + /* Process acces group selection field */ + $intFieldId = $arrModifyData['access_group'] ?? 0; $intReturn = $myVisClass->parseSelectSimple('tbl_group', 'groupname', 'acc_group', 0, $intFieldId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Initial add/modify form definitions + /* Initial add/modify form definitions */ $myContentClass->addFormInit($conttp); $conttp->setVariable('TITLE', translate('Configuration domain administration')); - if ($intIsError == 1) { - $conttp->setVariable('PATHMESSAGE', '

' .translate('Warning, at least one ' . - 'error occured, please check!'). '

' .$strPathMessage); + if ($intIsError === 1) { + $conttp->setVariable('PATHMESSAGE', '

' . translate('Warning, at least one ' . + 'error occured, please check!') . '

' . $strPathMessage); } $conttp->setVariable('CLASS_NAME_1', 'elementHide'); $conttp->setVariable('CLASS_NAME_2', 'elementHide'); $conttp->setVariable('CLASS_NAME_3', 'elementHide'); $conttp->setVariable('FILL_ALLFIELDS', translate('Please fill in all fields marked with an *')); $conttp->setVariable('FILL_ILLEGALCHARS', translate('The following field contains illegal characters:')); - // Insert data from database in "modify" mode - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - // Process data + /* Insert data from database in "modify" mode */ + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + /* Process data */ $myContentClass->addInsertData($conttp, $arrModifyData, 0, ''); - // Connection method - if ($arrModifyData['method'] == 1) { + /* Connection method */ + if ((int)$arrModifyData['method'] === 1) { $conttp->setVariable('FILE_SELECTED', 'selected'); } - if ($arrModifyData['method'] == 2) { + if ((int)$arrModifyData['method'] === 2) { $conttp->setVariable('FTP_SELECTED', 'selected'); $conttp->setVariable('CLASS_NAME_1', 'elementShow'); $conttp->setVariable('CLASS_NAME_2', 'elementHide'); $conttp->setVariable('CLASS_NAME_3', 'elementShow'); } - if ($arrModifyData['method'] == 3) { + if ((int)$arrModifyData['method'] === 3) { $conttp->setVariable('SFTP_SELECTED', 'selected'); $conttp->setVariable('CLASS_NAME_1', 'elementShow'); $conttp->setVariable('CLASS_NAME_2', 'elementShow'); $conttp->setVariable('CLASS_NAME_3', 'elementHide'); } - if ($arrModifyData['ftp_secure'] == 1) { + if ((int)$arrModifyData['ftp_secure'] === 1) { $conttp->setVariable('FTPS_CHECKED', 'checked'); } - // Nagios version - $conttp->setVariable('VER_SELECTED_' .$arrModifyData['version'], 'selected'); - // Domain localhost cant' be renamed - if ($arrModifyData[$preKeyField] == 'localhost') { + /* Nagios version */ + $conttp->setVariable('VER_SELECTED_' . $arrModifyData['version'], 'selected'); + /* Domain localhost can't be renamed */ + if ($arrModifyData[$preKeyField] === 'localhost') { $conttp->setVariable('DOMAIN_DISABLE', 'readonly'); $conttp->setVariable('LOCKCLASS', 'inputlock'); - } elseif ($arrModifyData[$preKeyField] == 'common') { + } elseif ($arrModifyData[$preKeyField] === 'common') { $conttp->setVariable('DOMAIN_DISABLE', 'readonly'); $conttp->setVariable('COMMON_INVISIBLE', 'class="elementHide"'); $conttp->setVariable('LOCKCLASS', 'inputlock'); } } - if ($chkSelModify == 'errormodify') { + if ($chkSelModify === 'errormodify') { $conttp->setVariable('DAT_TARGET', $chkTfValue1); - // Domain localhost cant' be renamed - if ($chkTfValue1 == 'localhost') { + /* Domain localhost can't be renamed */ + if ($chkTfValue1 === 'localhost') { $conttp->setVariable('DOMAIN_DISABLE', 'readonly'); $conttp->setVariable('LOCKCLASS', 'inputlock'); - } elseif ($chkTfValue1 == 'common') { + } elseif ($chkTfValue1 === 'common') { $conttp->setVariable('DOMAIN_DISABLE', 'readonly'); $conttp->setVariable('COMMON_INVISIBLE', 'class="elementHide"'); $conttp->setVariable('LOCKCLASS', 'inputlock'); @@ -237,20 +293,20 @@ if ($chkModus == 'add') { } $conttp->setVariable('DAT_ALIAS', $chkTfValue2); $conttp->setVariable('DAT_SERVER', $chkTfValue4); - // Connection method - if ($chkSelValue1 == 1) { + /* Connection method */ + if ($chkSelValue1 === 1) { $conttp->setVariable('FILE_SELECTED', 'selected'); $conttp->setVariable('CLASS_NAME_1', 'elementHide'); $conttp->setVariable('CLASS_NAME_2', 'elementHide'); $conttp->setVariable('CLASS_NAME_3', 'elementHide'); } - if ($chkSelValue1 == 2) { + if ($chkSelValue1 === 2) { $conttp->setVariable('FTP_SELECTED', 'selected'); $conttp->setVariable('CLASS_NAME_1', 'elementShow'); $conttp->setVariable('CLASS_NAME_2', 'elementHide'); $conttp->setVariable('CLASS_NAME_3', 'elementShow'); } - if ($chkSelValue1 == 3) { + if ($chkSelValue1 === 3) { $conttp->setVariable('SFTP_SELECTED', 'selected'); $conttp->setVariable('CLASS_NAME_1', 'elementShow'); $conttp->setVariable('CLASS_NAME_2', 'elementShow'); @@ -258,7 +314,7 @@ if ($chkModus == 'add') { } $conttp->setVariable('DAT_USER', $chkTfValue5); $conttp->setVariable('DAT_SSH_KEY_PATH', $chkTfValue7); - if ($chkChbValue1== 1) { + if ($chkChbValue1 === 1) { $conttp->setVariable('FTPS_CHECKED', 'checked'); } $conttp->setVariable('DAT_BASEDIR', $chkTfValue8); @@ -276,48 +332,50 @@ if ($chkModus == 'add') { $conttp->setVariable('DAT_CGIFILE', $chkTfValue21); $conttp->setVariable('DAT_RESOURCEFILE', $chkTfValue22); $conttp->setVariable('DAT_PICTUREDIR', $chkTfValue16); - // NagiosQL version - if ($chkSelValue2 == 1) { + /* NagiosQL version */ + if ($chkSelValue2 === 1) { $conttp->setVariable('VER_SELECTED_1', 'selected'); } - if ($chkSelValue2 == 2) { + if ($chkSelValue2 === 2) { $conttp->setVariable('VER_SELECTED_2', 'selected'); } - if ($chkSelValue2 == 3) { + if ($chkSelValue2 === 3) { $conttp->setVariable('VER_SELECTED_3', 'selected'); } - // Hidden variables - $conttp->setVariable('MODUS', filter_input(INPUT_POST, 'modus', FILTER_SANITIZE_STRING)); + /* Hidden variables */ + $conttp->setVariable('MODUS', filter_input(INPUT_POST, 'modus')); $conttp->setVariable('DAT_ID', filter_input(INPUT_POST, 'hidId', FILTER_VALIDATE_INT)); $conttp->setVariable('LIMIT', filter_input(INPUT_POST, 'hidLimit', FILTER_VALIDATE_INT)); - // Active + /* Active */ if (filter_input(INPUT_POST, 'chbActive')) { $conttp->setVariable('ACT_CHECKED', 'checked'); } else { - $conttp->setVariable('ACT_CHECKED', ''); + $conttp->setVariable('ACT_CHECKED'); } } $conttp->parse('datainsert'); $conttp->show('datainsert'); } -// -// List view -// ========== -if ($chkModus == 'display') { - // Initial list view definitions +/* +List view +*/ +if ($chkModus === 'display') { + /* Initial list view definitions */ $myContentClass->listViewInit($mastertp); $mastertp->setVariable('TITLE', translate('Configuration domain administration')); $mastertp->setVariable('FIELD_1', translate('Configuration target')); $mastertp->setVariable('FIELD_2', translate('Description')); - // Row sorting + /* Row sorting */ $strOrderString = "ORDER BY `$preKeyField` $hidSortDir"; - if ($hidSortBy == 2) { + if ($hidSortBy === 2) { $strOrderString = "ORDER BY `alias` $hidSortDir"; } - // Count datasets - $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` WHERE `access_group` IN ($strAccess)"; + /* Count datasets */ + $intLineCount = 0; + /** @noinspection SqlResolve */ + $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` WHERE `access_group` IN ($strAccess)"; $booReturn1 = $myDBClass->hasSingleDataset($strSQL, $arrDataLinesCount); - if ($booReturn1 == false) { + if ($booReturn1 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { @@ -326,21 +384,21 @@ if ($chkModus == 'display') { $chkLimit = 0; } } - // Get datasets - $strSQL = "SELECT `id`, `$preKeyField`, `alias`, `active`, `nodelete`, `access_group` " - . "FROM `$preTableName` WHERE `access_group` IN ($strAccess) $strOrderString " - . "LIMIT $chkLimit,".$SETS['common']['pagelines']; + /* Get datasets */ + $strSQL = "SELECT `id`, `$preKeyField`, `alias`, `active`, `nodelete`, `access_group` " + . "FROM `$preTableName` WHERE `access_group` IN ($strAccess) $strOrderString " + . "LIMIT $chkLimit," . $SETS['common']['pagelines']; $booReturn2 = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - if ($booReturn2 == false) { + if ($booReturn2 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - // Process data + /* Process data */ $myContentClass->listData($mastertp, $arrDataLines, $intDataCount, $intLineCount, $preKeyField, 'alias'); } -// Show messages +/* Show messages */ $myContentClass->showMessages($mastertp, $strErrorMessage, $strInfoMessage, $strConsistMessage, array(), '', 1); -// -// Process footer -// ============== -$myContentClass->showFooter($maintp, $setFileVersion); +/* +Process footer +*/ +$myContentClass->showFooter($maintp, $setFileVersion); \ No newline at end of file diff --git a/admin/contactgroups.php b/admin/contactgroups.php index 033e7e5..f7e300b 100644 --- a/admin/contactgroups.php +++ b/admin/contactgroups.php @@ -1,95 +1,146 @@ Application version string + * @var string $chkModus from prepend_adm.php -> Form work mode + * @var int $chkDataId from prepend_adm.php -> Actual dataset id + * @var int $chkListId from prepend_adm.php -> Actual dataset id (list view) + * @var string $chkSelModify from prepend_adm.php -> Modification selection value + * @var int $hidSortBy from prepend_adm.php -> Sort data by + * @var string $hidSortDir from prepend_adm.php -> Sort data direction (ASC, DESC) + * @var int $chkLimit from prepend_adm.php / settings -> Data set count per page + * @var int $intVersion from prepend_adm.php -> Nagios version + * @var array $SETS Settings array + * @var int $intGlobalWriteAccess from prepend_content.php -> Global admin write access + * @var int $intWriteAccessId from prepend_content.php -> Admin write access to actual dataset id + * @var string $strAccess from prepend_content.php -> List of read access group id's for actual user + * @var string $preSQLCommon1 from prepend_content.php -> Common SQL part 1 + * @var string $strDomainWhere from prepend_adm.php -> Domain selection SQL part with table name + * @var string $chkTfValue1 from prepend_content.php -> Contactgroup name + * @var string $chkTfValue2 from prepend_content.php -> Contactgroup description + * @var array $chkMselValue1 from prepend_content.php -> Contact members + * @var array $chkMselValue2 from prepend_content.php -> Contactgroup members + * @var int $intMselValue1 from prepend_content.php -> Contact members multiselect status value + * @var int $intMselValue2 from prepend_content.php -> Contactgroup members multiselect status value + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 15; -$preContent = 'admin/contactgroups.htm.tpl'; -$preListTpl = 'admin/datalist.htm.tpl'; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 15; +$preContent = 'admin/contactgroups.htm.tpl'; +$preListTpl = 'admin/datalist.htm.tpl'; $preSearchSession = 'contactgroup'; -$preTableName = 'tbl_contactgroup'; -$preKeyField = 'contactgroup_name'; -$preAccess = 1; -$preFieldvars = 1; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Add or modify data -// ================== -if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAccess == 0)) { +$preTableName = 'tbl_contactgroup'; +$preKeyField = 'contactgroup_name'; +$preAccess = 1; +$preFieldvars = 1; +$strErrorMessage = ''; +$strInfoMessage = ''; +$strConsistMessage = ''; +$strDBWarning = ''; +$intRet1 = 0; +$intRet2 = 0; +$intNoTime = 0; +/* + * Default values for form variables +*/ +if (!isset($intMselValue1)) { + $intMselValue1 = 0; +} +if (!isset($intMselValue2)) { + $intMselValue2 = 0; +} +/* +Include preprocessing file +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Add or modify data +*/ +if ((($chkModus === 'insert') || ($chkModus === 'modify')) && ($intGlobalWriteAccess === 0)) { $strSQLx = "`$preTableName` SET `$preKeyField`='$chkTfValue1', `alias`='$chkTfValue2', `members`=$intMselValue1, " - . "`contactgroup_members`=$intMselValue2, $preSQLCommon1"; - if ($chkModus == 'insert') { - $strSQL = 'INSERT INTO ' .$strSQLx; + . "`contactgroup_members`=$intMselValue2, $preSQLCommon1"; + if ($chkModus === 'insert') { + $strSQL = 'INSERT INTO ' . $strSQLx; } else { - $strSQL = 'UPDATE ' .$strSQLx. ' WHERE `id`=' .$chkDataId; + $strSQL = 'UPDATE ' . $strSQLx . ' WHERE `id`=' . $chkDataId; } - if ($intWriteAccessId == 0) { - if (($chkTfValue1 != '') && ($chkTfValue2 != '') && ($intMselValue1 != 0)) { + if ($intWriteAccessId === 0) { + if (($chkTfValue1 !== '') && ($chkTfValue2 !== '') && ($intMselValue1 !== 0)) { $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($chkModus == 'insert') { + if ($chkModus === 'insert') { $chkDataId = $intInsertId; } - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); $myDataClass->updateStatusTable($preTableName); - if ($chkModus == 'insert') { - $myDataClass->writeLog(translate('New contact group inserted:'). ' ' .$chkTfValue1); + if ($chkModus === 'insert') { + $myDataClass->writeLog(translate('New contact group inserted:') . ' ' . $chkTfValue1); } - if ($chkModus == 'modify') { - $myDataClass->writeLog(translate('Contact group modified:'). ' ' .$chkTfValue1); + if ($chkModus === 'modify') { + $myDataClass->writeLog(translate('Contact group modified:') . ' ' . $chkTfValue1); } - // - // Insert/update relations - // ======================= - if ($chkModus == 'insert') { - if ($intMselValue1 != 0) { + /* + Insert/update relations + */ + if ($chkModus === 'insert') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataInsertRelation( 'tbl_lnkContactgroupToContact', $chkDataId, $chkMselValue1 ); } - if (isset($intRet1) && ($intRet1 != 0)) { + if (isset($intRet1) && ($intRet1 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataInsertRelation( 'tbl_lnkContactgroupToContactgroup', $chkDataId, $chkMselValue2 ); } - if (isset($intRet2) && ($intRet2 != 0)) { + if (isset($intRet2) && ($intRet2 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - } elseif ($chkModus == 'modify') { - if ($intMselValue1 != 0) { + } elseif ($chkModus === 'modify') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataUpdateRelation( 'tbl_lnkContactgroupToContact', $chkDataId, @@ -98,10 +149,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet1 = $myDataClass->dataDeleteRelation('tbl_lnkContactgroupToContact', $chkDataId); } - if ($intRet1 != 0) { + if ($intRet1 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataUpdateRelation( 'tbl_lnkContactgroupToContactgroup', $chkDataId, @@ -110,11 +161,11 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet2 = $myDataClass->dataDeleteRelation('tbl_lnkContactgroupToContactgroup', $chkDataId); } - if ($intRet2 != 0) { + if ($intRet2 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } - if (($intRet1 + $intRet2) != 0) { + if (($intRet1 + $intRet2) !== 0) { $strInfoMessage = ''; } } @@ -129,29 +180,26 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } $chkModus = 'display'; } -if ($chkModus != 'add') { - $chkModus = 'display'; +if ($chkModus !== 'add') { + $chkModus = 'display'; } -// -// Get date/time of last database and config file manipulation -// =========================================================== +/* +Get date/time of last database and config file manipulation +*/ $intReturn = $myConfigClass->lastModifiedFile($preTableName, $arrTimeData, $strTimeInfoString); -if ($intReturn != 0) { +if ($intReturn !== 0) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } -// -// Singe data form -// =============== -if ($chkModus == 'add') { +/* +Singe data form +*/ +if ($chkModus === 'add') { + $intDataWarning = 0; $conttp->setVariable('TITLE', translate('Define contact groups (contactgroups.cfg)')); - // Do not show modified time list + /* Do not show modified time list */ $intNoTime = 1; - // Process contact member selection fields - if (isset($arrModifyData['members'])) { - $intFieldId = $arrModifyData['members']; - } else { - $intFieldId = 0; - } + /* Process access group selection field */ + $intFieldId = $arrModifyData['members'] ?? 0; $intReturn1 = $myVisClass->parseSelectMulti( 'tbl_contact', 'contact_name', @@ -160,17 +208,13 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); $myVisClass->processMessage(translate('Attention, no contacts defined!'), $strDBWarning); $intDataWarning = 1; } - // Process contactgroup member selection fields - if (isset($arrModifyData['contactgroup_members'])) { - $intFieldId = $arrModifyData['contactgroup_members']; - } else { - $intFieldId = 0; - } + /* Process contactgroup member selection fields */ + $intFieldId = $arrModifyData['contactgroup_members'] ?? 0; $intReturn2 = $myVisClass->parseSelectMulti( $preTableName, $preKeyField, @@ -180,65 +224,65 @@ if ($chkModus == 'add') { $intFieldId, $chkListId ); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process acces group selection field - if (isset($arrModifyData['access_group'])) { - $intFieldId = $arrModifyData['access_group']; - } else { - $intFieldId = 0; - } + /* Process acces group selection field */ + $intFieldId = $arrModifyData['access_group'] ?? 0; $intReturn3 = $myVisClass->parseSelectSimple('tbl_group', 'groupname', 'acc_group', 0, $intFieldId); - if ($intReturn3 != 0) { + if ($intReturn3 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Initial add/modify form definitions + /* Initial add/modify form definitions */ $myContentClass->addFormInit($conttp); - if ($intDataWarning == 1) { - $conttp->setVariable('WARNING', $strDBWarning. '
' .translate('Saving not possible!')); + if ($intDataWarning === 1) { + $conttp->setVariable('WARNING', $strDBWarning . '
' . translate('Saving not possible!')); } if ($intVersion < 3) { $conttp->setVariable('VERSION_20_VALUE_MUST', 'mselValue1,'); } - // Insert data from database in "modify" mode - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - // Check relation information to find out locked configuration datasets + /* Insert data from database in "modify" mode */ + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + /* Check relation information to find out locked configuration datasets */ $intLocked = $myDataClass->infoRelation($preTableName, $arrModifyData['id'], $preKeyField); $myVisClass->processMessage($myDataClass->strInfoMessage, $strRelMessage); - $strInfo = '
' .translate('Entry cannot be activated because it is used by ' - . 'another configuration'). ':'; - $strInfo .= '
' .$strRelMessage. ''; - // Process data + $strInfo = '
' . translate('Entry cannot be activated because it is used by ' + . 'another configuration') . ':'; + $strInfo .= '
' . $strRelMessage . ''; + /* Process data */ $myContentClass->addInsertData($conttp, $arrModifyData, $intLocked, $strInfo); } $conttp->parse('datainsert'); $conttp->show('datainsert'); } -// -// List view -// ========== -if ($chkModus == 'display') { - // Initial list view definitions +/* +List view +*/ +if ($chkModus === 'display') { + /* Initial list view definitions */ + $strSearchWhere = ''; $myContentClass->listViewInit($mastertp); $mastertp->setVariable('TITLE', translate('Define contact groups (contactgroups.cfg)')); $mastertp->setVariable('FIELD_1', translate('Contact group')); $mastertp->setVariable('FIELD_2', translate('Description')); - // Process filter string - if ($_SESSION['search'][$preSearchSession] != '') { - $strSearchTxt = $_SESSION['search'][$preSearchSession]; - $strSearchWhere = "AND (`$preKeyField` LIKE '%".$strSearchTxt."%' OR `alias` LIKE '%".$strSearchTxt."%')"; + $mastertp->setVariable('FILTER_VISIBLE', 'visibility: hidden'); + /* Process filter string */ + if ($_SESSION['search'][$preSearchSession] !== '') { + $strSearchTxt = $_SESSION['search'][$preSearchSession]; + $strSearchWhere = "AND (`$preKeyField` LIKE '%" . $strSearchTxt . "%' OR `alias` LIKE '%" . $strSearchTxt . "%')"; } - // Row sorting + /* Row sorting */ $strOrderString = "ORDER BY `config_id`, `$preKeyField` $hidSortDir"; - if ($hidSortBy == 2) { + if ($hidSortBy === 2) { $strOrderString = "ORDER BY `config_id`, `alias` $hidSortDir"; } - // Count datasets - $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` " - . "WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess)"; + /* Count datasets */ + $intLineCount = 0; + /** @noinspection SqlResolve */ + $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` " + . "WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess)"; $booReturn1 = $myDBClass->hasSingleDataset($strSQL, $arrDataLinesCount); - if ($booReturn1 == false) { + if ($booReturn1 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { @@ -247,19 +291,19 @@ if ($chkModus == 'display') { $chkLimit = 0; } } - // Get datasets - $strSQL = "SELECT `id`, `$preKeyField`, `alias`, `register`, `active`, `config_id`, `access_group` " - . "FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess) " - . "$strOrderString LIMIT $chkLimit,".$SETS['common']['pagelines']; + /* Get datasets */ + $strSQL = "SELECT `id`, `$preKeyField`, `alias`, `register`, `active`, `config_id`, `access_group` " + . "FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess) " + . "$strOrderString LIMIT $chkLimit," . $SETS['common']['pagelines']; $booReturn2 = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - if ($booReturn2 == false) { + if ($booReturn2 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - // Process data + /* Process data */ $myContentClass->listData($mastertp, $arrDataLines, $intDataCount, $intLineCount, $preKeyField, 'alias'); } -// Show messages +/* Show messages */ $myContentClass->showMessages( $mastertp, $strErrorMessage, @@ -269,7 +313,7 @@ $myContentClass->showMessages( $strTimeInfoString, $intNoTime ); -// -// Process footer -// ============== -$myContentClass->showFooter($maintp, $setFileVersion); +/* +Process footer + */ +$myContentClass->showFooter($maintp, $setFileVersion); \ No newline at end of file diff --git a/admin/contacts.php b/admin/contacts.php index 4244079..bbe8c0f 100644 --- a/admin/contacts.php +++ b/admin/contacts.php @@ -1,127 +1,218 @@ Application version string + * @var string $chkModus from prepend_adm.php -> Form work mode + * @var int $chkDataId from prepend_adm.php -> Actual dataset id + * @var string $chkSelModify from prepend_adm.php -> Modification selection value + * @var int $hidSortBy from prepend_adm.php -> Sort data by + * @var string $hidSortDir from prepend_adm.php -> Sort data direction (ASC, DESC) + * @var int $chkLimit from prepend_adm.php / settings -> Data set count per page + * @var int $intVersion from prepend_adm.php -> Nagios version + * @var array $SETS Settings array + * @var int $intGlobalWriteAccess from prepend_content.php -> Global admin write access + * @var int $intWriteAccessId from prepend_content.php -> Admin write access to actual dataset id + * @var string $strAccess from prepend_content.php -> List of read access group id's for actual user + * @var string $preSQLCommon1 from prepend_content.php -> Common SQL part 1 + * @var string $strDomainWhere from prepend_adm.php -> Domain selection SQL part with table name + * @var string $strDomainWhere2 from prepend_adm.php -> Domain selection SQL part without table name + * @var string $chkTfValue1 from prepend_content.php -> Contact name + * @var string $chkTfValue2 from prepend_content.php -> Contact description + * @var string $chkTfValue3 from prepend_content.php -> Email address + * @var string $chkTfValue4 from prepend_content.php -> Pager number + * @var string $chkTfValue5 from prepend_content.php -> Additional address 1 + * @var string $chkTfValue6 from prepend_content.php -> Additional address 2 + * @var string $chkTfValue7 from prepend_content.php -> Additional address 3 + * @var string $chkTfValue8 from prepend_content.php -> Additional address 4 + * @var string $chkTfValue9 from prepend_content.php -> Additional address 5 + * @var string $chkTfValue10 from prepend_content.php -> Additional address 6 + * @var string $chkTfValue11 from prepend_content.php -> Name value if used as contact template + * @var int $chkSelValue1 from prepend_content.php -> Time period hosts + * @var int $chkSelValue2 from prepend_content.php -> Time period services + * @var array $chkMselValue1 from prepend_content.php -> Contact groups + * @var array $chkMselValue2 from prepend_content.php -> Host command + * @var array $chkMselValue3 from prepend_content.php -> Service command + * @var int $intMselValue1 from prepend_content.php -> Contact groups multiselect status value + * @var int $intMselValue2 from prepend_content.php -> Host command multiselect status value + * @var int $intMselValue3 from prepend_content.php -> Service command multiselect status value + * @var string $chkChbGr1a from prepend_content.php -> Host options (d) + * @var string $chkChbGr1b from prepend_content.php -> Host options (u) + * @var string $chkChbGr1c from prepend_content.php -> Host options (r) + * @var string $chkChbGr1d from prepend_content.php -> Host options (f) + * @var string $chkChbGr1e from prepend_content.php -> Host options (s) + * @var string $chkChbGr1f from prepend_content.php -> Host options (n) + * @var string $chkChbGr2a from prepend_content.php -> Service options (w) + * @var string $chkChbGr2b from prepend_content.php -> Service options (u) + * @var string $chkChbGr2c from prepend_content.php -> Service options (c) + * @var string $chkChbGr2d from prepend_content.php -> Service options (r) + * @var string $chkChbGr2e from prepend_content.php -> Service options (f) + * @var string $chkChbGr2f from prepend_content.php -> Service options (s) + * @var string $chkChbGr2g from prepend_content.php -> Service options (n) + * @var int $chkRadValue1 from prepend_content.php -> Contact groups multiselect options + * @var int $chkRadValue2 from prepend_content.php -> Host alarming + * @var int $chkRadValue3 from prepend_content.php -> Service alarming + * @var int $chkRadValue4 from prepend_content.php -> Host command multiselect options + * @var int $chkRadValue5 from prepend_content.php -> Service command multiselect options + * @var int $chkRadValue6 from prepend_content.php -> Retain status information + * @var int $chkRadValue7 from prepend_content.php -> Retain non-status information + * @var int $chkRadValue8 from prepend_content.php -> Can submit command + * @var string $chkTfNullVal1 from prepend_content.php -> Minimum importance + * @var int $intVariables from prepend_content.php -> Form uses variable definitions + * @var int $intTemplates from prepend_content.php -> Form uses template definitions + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 14; -$preContent = 'admin/contacts.htm.tpl'; -$preListTpl = 'admin/datalist.htm.tpl'; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 14; +$preContent = 'admin/contacts.htm.tpl'; +$preListTpl = 'admin/datalist.htm.tpl'; $preSearchSession = 'contact'; -$preTableName = 'tbl_contact'; -$preKeyField = 'contact_name'; -$preAccess = 1; -$preFieldvars = 1; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Checkbox data processing -// ======================== -if (($intVersion == 3) || ($intVersion == 4)) { - $strHO = substr($chkChbGr1a.$chkChbGr1b.$chkChbGr1c.$chkChbGr1d.$chkChbGr1e.$chkChbGr1f, 0, -1); - $strSO = substr($chkChbGr2a.$chkChbGr2b.$chkChbGr2c.$chkChbGr2d.$chkChbGr2e.$chkChbGr2f.$chkChbGr2g, 0, -1); -} else { - $strHO = substr($chkChbGr1a.$chkChbGr1b.$chkChbGr1c.$chkChbGr1d.$chkChbGr1f, 0, -1); - $strSO = substr($chkChbGr2a.$chkChbGr2b.$chkChbGr2c.$chkChbGr2d.$chkChbGr2e.$chkChbGr2g, 0, -1); +$preTableName = 'tbl_contact'; +$preKeyField = 'contact_name'; +$preAccess = 1; +$preFieldvars = 1; +$strErrorMessage = ''; +$strInfoMessage = ''; +$strConsistMessage = ''; +$strDBWarning = ''; +$intRet1 = 0; +$intRet2 = 0; +$intNoTime = 0; +/* + * Default values for form variables +*/ +if (!isset($intMselValue1)) { + $intMselValue1 = 0; } -// -// Add or modify data -// ================== -if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAccess == 0)) { +if (!isset($intMselValue2)) { + $intMselValue2 = 0; +} +if (!isset($intMselValue3)) { + $intMselValue3 = 0; +} +/* +Include preprocessing file +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Checkbox data processing +*/ +if (($intVersion === 3) || ($intVersion === 4)) { + $strHO = substr($chkChbGr1a . $chkChbGr1b . $chkChbGr1c . $chkChbGr1d . $chkChbGr1e . $chkChbGr1f, 0, -1); + $strSO = substr($chkChbGr2a . $chkChbGr2b . $chkChbGr2c . $chkChbGr2d . $chkChbGr2e . $chkChbGr2f . $chkChbGr2g, 0, -1); +} else { + $strHO = substr($chkChbGr1a . $chkChbGr1b . $chkChbGr1c . $chkChbGr1d . $chkChbGr1f, 0, -1); + $strSO = substr($chkChbGr2a . $chkChbGr2b . $chkChbGr2c . $chkChbGr2d . $chkChbGr2e . $chkChbGr2g, 0, -1); +} +/* +Add or modify data +*/ +if ((($chkModus === 'insert') || ($chkModus === 'modify')) && ($intGlobalWriteAccess === 0)) { $strSQLx = "`$preTableName` SET `$preKeyField`='$chkTfValue1', `alias`='$chkTfValue2', " - . "`contactgroups`=$intMselValue1, `contactgroups_tploptions`=$chkRadValue1, " - . "`minimum_importance`=$chkTfNullVal1, " - . "`host_notifications_enabled`='$chkRadValue2', `service_notifications_enabled`='$chkRadValue3', " - . "`host_notification_period`='$chkSelValue1', `service_notification_period`='$chkSelValue2', " - . "`host_notification_options`='$strHO', `host_notification_commands_tploptions`=$chkRadValue4, " - . "`service_notification_options`='$strSO', `host_notification_commands`=$intMselValue2, " - . "`service_notification_commands`=$intMselValue3, " - . "`service_notification_commands_tploptions`=$chkRadValue5, `can_submit_commands`='$chkRadValue8', " - . "`retain_status_information`='$chkRadValue6', `retain_nonstatus_information`='$chkRadValue7', " - . "`email`='$chkTfValue3', `pager`='$chkTfValue4', `address1`='$chkTfValue5', `address2`='$chkTfValue6', " - . "`address3`='$chkTfValue7', `address4`='$chkTfValue8', `address5`='$chkTfValue9', " - . "`address6`='$chkTfValue10', `name`='$chkTfValue11', `use_variables`='$intVariables', " - . "`use_template`=$intTemplates, $preSQLCommon1"; - if ($chkModus == 'insert') { - $strSQL = 'INSERT INTO ' .$strSQLx; + . "`contactgroups`=$intMselValue1, `contactgroups_tploptions`=$chkRadValue1, " + . "`minimum_importance`=$chkTfNullVal1, " + . "`host_notifications_enabled`='$chkRadValue2', `service_notifications_enabled`='$chkRadValue3', " + . "`host_notification_period`='$chkSelValue1', `service_notification_period`='$chkSelValue2', " + . "`host_notification_options`='$strHO', `host_notification_commands_tploptions`=$chkRadValue4, " + . "`service_notification_options`='$strSO', `host_notification_commands`=$intMselValue2, " + . "`service_notification_commands`=$intMselValue3, " + . "`service_notification_commands_tploptions`=$chkRadValue5, `can_submit_commands`='$chkRadValue8', " + . "`retain_status_information`='$chkRadValue6', `retain_nonstatus_information`='$chkRadValue7', " + . "`email`='$chkTfValue3', `pager`='$chkTfValue4', `address1`='$chkTfValue5', `address2`='$chkTfValue6', " + . "`address3`='$chkTfValue7', `address4`='$chkTfValue8', `address5`='$chkTfValue9', " + . "`address6`='$chkTfValue10', `name`='$chkTfValue11', `use_variables`='$intVariables', " + . "`use_template`=$intTemplates, $preSQLCommon1"; + if ($chkModus === 'insert') { + $strSQL = 'INSERT INTO ' . $strSQLx; } else { - $strSQL = 'UPDATE ' .$strSQLx. ' WHERE `id`=' .$chkDataId; + $strSQL = 'UPDATE ' . $strSQLx . ' WHERE `id`=' . $chkDataId; } - if ($intWriteAccessId == 0) { - if ($chkTfValue1 != '') { + if ($intWriteAccessId === 0) { + if ($chkTfValue1 !== '') { $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($chkModus == 'insert') { + if ($chkModus === 'insert') { $chkDataId = $intInsertId; } - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); $myDataClass->updateStatusTable($preTableName); - if ($chkModus == 'insert') { - $myDataClass->writeLog(translate('New contact inserted:'). ' ' .$chkTfValue1); + if ($chkModus === 'insert') { + $myDataClass->writeLog(translate('New contact inserted:') . ' ' . $chkTfValue1); } - if ($chkModus == 'modify') { - $myDataClass->writeLog(translate('Contact modified:'). ' ' .$chkTfValue1); + if ($chkModus === 'modify') { + $myDataClass->writeLog(translate('Contact modified:') . ' ' . $chkTfValue1); } - // - // Insert/update relations - // ======================= - if ($chkModus == 'insert') { - if ($intMselValue1 != 0) { + /* + Insert/update relations + */ + if ($chkModus === 'insert') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataInsertRelation( 'tbl_lnkContactToContactgroup', $chkDataId, $chkMselValue1 ); } - if (isset($intRet1) && ($intRet1 != 0)) { + if (isset($intRet1) && ($intRet1 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataInsertRelation( 'tbl_lnkContactToCommandHost', $chkDataId, $chkMselValue2 ); } - if (isset($intRet2) && ($intRet2 != 0)) { + if (isset($intRet2) && ($intRet2 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue3 != 0) { + if ($intMselValue3 !== 0) { $intRet3 = $myDataClass->dataInsertRelation( 'tbl_lnkContactToCommandService', $chkDataId, $chkMselValue3 ); } - if (isset($intRet3) && ($intRet3 != 0)) { + if (isset($intRet3) && ($intRet3 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - } elseif ($chkModus == 'modify') { - if ($intMselValue1 != 0) { + } elseif ($chkModus === 'modify') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataUpdateRelation( 'tbl_lnkContactToContactgroup', $chkDataId, @@ -130,10 +221,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet1 = $myDataClass->dataDeleteRelation('tbl_lnkContactToContactgroup', $chkDataId); } - if ($intRet1 != 0) { + if ($intRet1 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataUpdateRelation( 'tbl_lnkContactToCommandHost', $chkDataId, @@ -142,10 +233,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet2 = $myDataClass->dataDeleteRelation('tbl_lnkContactToCommandHost', $chkDataId); } - if ($intRet2 != 0) { + if ($intRet2 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue3 != 0) { + if ($intMselValue3 !== 0) { $intRet3 = $myDataClass->dataUpdateRelation( 'tbl_lnkContactToCommandService', $chkDataId, @@ -154,78 +245,74 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet3 = $myDataClass->dataDeleteRelation('tbl_lnkContactToCommandService', $chkDataId); } - if ($intRet3 != 0) { + if ($intRet3 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } - //if (($intRet1 + $intRet2 + $intRet3) != 0) { - //$strInfoMessage = ""; - //} - // - // Insert/update templates from session data - // ========================================= - if ($chkModus == 'modify') { - $strSQL = "DELETE FROM `tbl_lnkContactToContacttemplate` WHERE `idMaster`=$chkDataId"; - $booReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($booReturn == false) { + /* + Insert/update templates from session data + */ + if ($chkModus === 'modify') { + $strSQL = "DELETE FROM `tbl_lnkContactToContacttemplate` WHERE `idMaster`=$chkDataId"; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } if (isset($_SESSION['templatedefinition']) && is_array($_SESSION['templatedefinition']) && - (count($_SESSION['templatedefinition']) != 0)) { + (count($_SESSION['templatedefinition']) !== 0)) { $intSortId = 1; - /** @noinspection ForeachSourceInspection */ foreach ($_SESSION['templatedefinition'] as $elem) { - if ($elem['status'] == 0) { - $strSQL = 'INSERT INTO `tbl_lnkContactToContacttemplate` (`idMaster`,`idSlave`,' - . "`idTable`,`idSort`) VALUES ($chkDataId,".$elem['idSlave']. ', ' - . $elem['idTable']. ',' .$intSortId. ')'; - $booReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($booReturn == false) { + if ((int)$elem['status'] === 0) { + $strSQL = 'INSERT INTO `tbl_lnkContactToContacttemplate` (`idMaster`,`idSlave`,' + . "`idTable`,`idSort`) VALUES ($chkDataId," . $elem['idSlave'] . ', ' + . $elem['idTable'] . ',' . $intSortId . ')'; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } $intSortId++; } } - // - // Insert/update variables from session data - // ========================================= - if ($chkModus == 'modify') { - $strSQL1 = "SELECT * FROM `tbl_lnkContactToVariabledefinition` WHERE `idMaster`=$chkDataId"; + /* + Insert/update variables from session data + */ + if ($chkModus === 'modify') { + $strSQL1 = "SELECT * FROM `tbl_lnkContactToVariabledefinition` WHERE `idMaster`=$chkDataId"; $booReturn = $myDBClass->hasDataArray($strSQL1, $arrData, $intDataCount); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intDataCount != 0) { + if ($intDataCount !== 0) { foreach ($arrData as $elem) { - $strSQL = 'DELETE FROM `tbl_variabledefinition` WHERE `id`=' .$elem['idSlave']; - $booReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($booReturn == false) { + $strSQL = 'DELETE FROM `tbl_variabledefinition` WHERE `id`=' . $elem['idSlave']; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } } - $strSQL = "DELETE FROM `tbl_lnkContactToVariabledefinition` WHERE `idMaster`=$chkDataId"; - $booReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($booReturn == false) { + $strSQL = "DELETE FROM `tbl_lnkContactToVariabledefinition` WHERE `idMaster`=$chkDataId"; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } if (isset($_SESSION['variabledefinition']) && is_array($_SESSION['variabledefinition']) && - (count($_SESSION['variabledefinition']) != 0)) { + (count($_SESSION['variabledefinition']) !== 0)) { foreach ($_SESSION['variabledefinition'] as $elem) { - if ($elem['status'] == 0) { - $strSQL = 'INSERT INTO `tbl_variabledefinition` (`name`,`value`,`last_modified`) ' - . "VALUES ('".$elem['definition']."','".$elem['range']."',now())"; - $booReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($booReturn == false) { + if ((int)$elem['status'] === 0) { + $strSQL = 'INSERT INTO `tbl_variabledefinition` (`name`,`value`,`last_modified`) ' + . "VALUES ('" . $elem['definition'] . "','" . $elem['range'] . "',now())"; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - $strSQL = 'INSERT INTO `tbl_lnkContactToVariabledefinition` (`idMaster`,`idSlave`) ' - . "VALUES ($chkDataId,$intInsertId)"; - $booReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($booReturn == false) { + $strSQL = 'INSERT INTO `tbl_lnkContactToVariabledefinition` (`idMaster`,`idSlave`) ' + . "VALUES ($chkDataId,$intInsertId)"; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } @@ -243,98 +330,92 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } $chkModus = 'display'; } -if ($chkModus != 'add') { - $chkModus = 'display'; +if ($chkModus !== 'add') { + $chkModus = 'display'; } -// -// Get date/time of last database and config file manipulation -// =========================================================== +/* +Get date/time of last database and config file manipulation +*/ $intReturn = $myConfigClass->lastModifiedFile($preTableName, $arrTimeData, $strTimeInfoString); -if ($intReturn != 0) { +if ($intReturn !== 0) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } -// -// Singe data form -// =============== -if ($chkModus == 'add') { +/* +Singe data form +*/ +if ($chkModus === 'add') { + $intDataWarning = 0; $conttp->setVariable('TITLE', translate('Define contacts (contacts.cfg)')); - // Do not show modified time list + /* Do not show modified time list */ $intNoTime = 1; - // Process template selection fields (Spezial) + /* Process access group selection field */ $strWhere = ''; - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - $strWhere = 'AND `id` <> ' .$arrModifyData['id']; + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + $strWhere = 'AND `id` <> ' . $arrModifyData['id']; } - $strSQL5 = 'SELECT `id`,`template_name`, `active` ' - . "FROM `tbl_contacttemplate` WHERE $strDomainWhere2 ORDER BY `template_name`"; + $strSQL5 = 'SELECT `id`,`template_name`, `active`, `config_id` ' + . "FROM `tbl_contacttemplate` WHERE $strDomainWhere2 ORDER BY `template_name`"; $booReturn5 = $myDBClass->hasDataArray($strSQL5, $arrDataTpl, $intDataCountTpl); - if ($booReturn5 == false) { + if ($booReturn5 === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($intDataCountTpl != 0) { + if ($intDataCountTpl !== 0) { /** @var array $arrDataTpl */ foreach ($arrDataTpl as $elem) { - if ($elem['active'] == 0) { + if ((int)$elem['active'] === 0) { $strActive = ' [inactive]'; $conttp->setVariable('SPECIAL_STYLE', 'inactive_option'); } else { $strActive = ''; - $conttp->setVariable('SPECIAL_STYLE', ''); + $conttp->setVariable('SPECIAL_STYLE'); } - $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem['template_name'], ENT_QUOTES, 'UTF-8'). - $strActive); - $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id']. '::1'); - $conttp->parse('template'); + if ((int)$elem['config_id'] === 0) { + $strCommon = ' [common]'; + } else { + $strCommon = ''; + } + $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem['template_name'], ENT_QUOTES, 'UTF-8') . + $strActive . $strCommon); + $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id'] . '::1'); } + $conttp->parse('template'); } - $strSQL6 = 'SELECT `id`, `name`, `active` ' - . "FROM `$preTableName` WHERE `name` <> '' $strWhere AND $strDomainWhere ORDER BY `name`"; + $strSQL6 = 'SELECT `id`, `name`, `active` ' + . "FROM `$preTableName` WHERE `name` <> '' $strWhere AND $strDomainWhere ORDER BY `name`"; $booReturn6 = $myDBClass->hasDataArray($strSQL6, $arrDataHpl, $intDataCount); - if ($booReturn6 == false) { + if ($booReturn6 === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($intDataCount != 0) { + if ($intDataCount !== 0) { /** @var array $arrDataHpl */ foreach ($arrDataHpl as $elem) { - if ($elem['active'] == 0) { + if ((int)$elem['active'] === 0) { $strActive = ' [inactive]'; $conttp->setVariable('SPECIAL_STYLE', 'inactive_option'); } else { $strActive = ''; - $conttp->setVariable('SPECIAL_STYLE', ''); + $conttp->setVariable('SPECIAL_STYLE'); } - $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem['name'], ENT_QUOTES, 'UTF-8').$strActive); - $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id']. '::2'); - $conttp->parse('template'); + $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem['name'], ENT_QUOTES, 'UTF-8') . $strActive); + $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id'] . '::2'); } + $conttp->parse('template'); } - // Process timeperiod selection fields - if (isset($arrModifyData['host_notification_period'])) { - $intFieldId = $arrModifyData['host_notification_period']; - } else { - $intFieldId = 0; - } + /* Process timeperiod selection fields */ + $intFieldId = $arrModifyData['host_notification_period'] ?? 0; $intReturn1 = $myVisClass->parseSelectSimple('tbl_timeperiod', 'timeperiod_name', 'host_time', 1, $intFieldId); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['service_notification_period'])) { - $intFieldId = $arrModifyData['service_notification_period']; - } else { - $intFieldId = 0; - } + $intFieldId = $arrModifyData['service_notification_period'] ?? 0; $intReturn2 = $myVisClass->parseSelectSimple('tbl_timeperiod', 'timeperiod_name', 'service_time', 1, $intFieldId); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); $myVisClass->processMessage(translate('Attention, no time periods defined!'), $strDBWarning); $intDataWarning = 1; } - // Process command selection fields - if (isset($arrModifyData['host_notification_commands'])) { - $intFieldId = $arrModifyData['host_notification_commands']; - } else { - $intFieldId = 0; - } + /* Process command selection fields */ + $intFieldId = $arrModifyData['host_notification_commands'] ?? 0; $intReturn3 = $myVisClass->parseSelectMulti( 'tbl_command', 'command_name', @@ -343,14 +424,10 @@ if ($chkModus == 'add') { 0, $intFieldId ); - if ($intReturn3 != 0) { + if ($intReturn3 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['service_notification_commands'])) { - $intFieldId = $arrModifyData['service_notification_commands']; - } else { - $intFieldId = 0; - } + $intFieldId = $arrModifyData['service_notification_commands'] ?? 0; $intReturn4 = $myVisClass->parseSelectMulti( 'tbl_command', 'command_name', @@ -359,17 +436,13 @@ if ($chkModus == 'add') { 0, $intFieldId ); - if ($intReturn4 != 0) { + if ($intReturn4 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); $myVisClass->processMessage(translate('Attention, no commands defined!'), $strDBWarning); $intDataWarning = 1; } - // Process contactgroup selection field - if (isset($arrModifyData['contactgroups'])) { - $intFieldId = $arrModifyData['contactgroups']; - } else { - $intFieldId = 0; - } + /* Process contactgroup selection field */ + $intFieldId = $arrModifyData['contactgroups'] ?? 0; $intReturn5 = $myVisClass->parseSelectMulti( 'tbl_contactgroup', 'contactgroup_name', @@ -378,31 +451,27 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn5 != 0) { + if ($intReturn5 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process access group selection field - if (isset($arrModifyData['access_group'])) { - $intFieldId = $arrModifyData['access_group']; - } else { - $intFieldId = 0; - } + /* Process access group selection field */ + $intFieldId = $arrModifyData['access_group'] ?? 0; $intReturn6 = $myVisClass->parseSelectSimple('tbl_group', 'groupname', 'acc_group', 0, $intFieldId); - if ($intReturn6 != 0) { + if ($intReturn6 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Initial add/modify form definitions + /* Initial add/modify form definitions */ $strChbFields = 'HNE,SNE,RSI,CSC,RNS,TPL,SEC,HOC,COG'; $myContentClass->addFormInit($conttp, $strChbFields); - if ($intDataWarning == 1) { - $conttp->setVariable('WARNING', $strDBWarning. '
' .translate('Saving not possible!')); + if ($intDataWarning === 1) { + $conttp->setVariable('WARNING', $strDBWarning . '
' . translate('Saving not possible!')); $conttp->setVariable('DISABLE_SAVE', 'disabled'); } - if ($intVersion == 4) { + if ($intVersion === 4) { $conttp->setVariable('HOST_OPTION_FIELDS', 'chbGr1a,chbGr1b,chbGr1c,chbGr1d,chbGr1e,chbGr1f'); $conttp->setVariable('SERVICE_OPTION_FIELDS', 'chbGr2a,chbGr2b,chbGr2c,chbGr2d,chbGr2e,chbGr2f,chbGr2g'); } - if ($intVersion == 3) { + if ($intVersion === 3) { $conttp->setVariable('HOST_OPTION_FIELDS', 'chbGr1a,chbGr1b,chbGr1c,chbGr1d,chbGr1e,chbGr1f'); $conttp->setVariable('SERVICE_OPTION_FIELDS', 'chbGr2a,chbGr2b,chbGr2c,chbGr2d,chbGr2e,chbGr2f,chbGr2g'); } @@ -411,69 +480,72 @@ if ($chkModus == 'add') { $conttp->setVariable('SERVICE_OPTION_FIELDS', 'chbGr2a,chbGr2b,chbGr2c,chbGr2d,chbGr2e,chbGr2g'); $conttp->setVariable('VERSION_20_VALUE_MUST', ',tfValue2'); } - // Insert data from database in "modify" mode - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - // Check relation information to find out locked configuration datasets + /* Insert data from database in "modify" mode */ + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + /* Check relation information to find out locked configuration datasets */ $intLocked = $myDataClass->infoRelation($preTableName, $arrModifyData['id'], $preKeyField); $myVisClass->processMessage($myDataClass->strInfoMessage, $strRelMessage); - $strInfo = '
' .translate('Entry cannot be activated because it is used by ' - . 'another configuration'). ':'; - $strInfo .= '
' .$strRelMessage. ''; - // Process data + $strInfo = '
' . translate('Entry cannot be activated because it is used by ' + . 'another configuration') . ':'; + $strInfo .= '
' . $strRelMessage . ''; + /* Process data */ $myContentClass->addInsertData($conttp, $arrModifyData, $intLocked, $strInfo, $strChbFields); - // Process radio fields - $conttp->setVariable('DAT_HNE' .$arrModifyData['host_notifications_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_SNE' .$arrModifyData['service_notifications_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_RSI' .$arrModifyData['retain_status_information']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_CSC' .$arrModifyData['can_submit_commands']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_RNS' .$arrModifyData['retain_nonstatus_information']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_TPL' .$arrModifyData['use_template_tploptions']. '_CHECKED', 'checked'); + /* Process radio fields */ + $conttp->setVariable('DAT_HNE' . $arrModifyData['host_notifications_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_SNE' . $arrModifyData['service_notifications_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_RSI' . $arrModifyData['retain_status_information'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_CSC' . $arrModifyData['can_submit_commands'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_RNS' . $arrModifyData['retain_nonstatus_information'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_TPL' . $arrModifyData['use_template_tploptions'] . '_CHECKED', 'checked'); $conttp->setVariable( - 'DAT_SEC' .$arrModifyData['service_notification_commands_tploptions']. '_CHECKED', + 'DAT_SEC' . $arrModifyData['service_notification_commands_tploptions'] . '_CHECKED', 'checked' ); - $conttp->setVariable('DAT_HOC' .$arrModifyData['host_notification_commands_tploptions']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_COG' .$arrModifyData['contactgroups_tploptions']. '_CHECKED', 'checked'); - // Process option fields + $conttp->setVariable('DAT_HOC' . $arrModifyData['host_notification_commands_tploptions'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_COG' . $arrModifyData['contactgroups_tploptions'] . '_CHECKED', 'checked'); + /* Process option fields */ foreach (explode(',', $arrModifyData['host_notification_options']) as $elem) { - $conttp->setVariable('DAT_HO' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_HO' . strtoupper($elem) . '_CHECKED', 'checked'); } foreach (explode(',', $arrModifyData['service_notification_options']) as $elem) { - $conttp->setVariable('DAT_SO' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_SO' . strtoupper($elem) . '_CHECKED', 'checked'); } } $conttp->parse('datainsert'); $conttp->show('datainsert'); } -// -// List view -// ========== -if ($chkModus == 'display') { - // Initial list view definitions +/* +List view +*/ +if ($chkModus === 'display') { + $strSearchWhere = ''; + $intLineCount = 0; + /* Initial list view definitions */ $myContentClass->listViewInit($mastertp); $mastertp->setVariable('TITLE', translate('Define contacts (contacts.cfg)')); $mastertp->setVariable('FIELD_1', translate('Contact name')); $mastertp->setVariable('FIELD_2', translate('Description')); - // Process search string - if ($_SESSION['search'][$preSearchSession] != '') { - $strSearchTxt = $_SESSION['search'][$preSearchSession]; - $strSearchWhere = "AND (`$preKeyField` LIKE '%".$strSearchTxt."%' OR `alias` LIKE '%".$strSearchTxt."%' OR " - . "`email` LIKE '%".$strSearchTxt."%' OR `pager` LIKE '%".$strSearchTxt."%' OR " - . "`address1` LIKE '%".$strSearchTxt."%' OR `address2` LIKE '%".$strSearchTxt."%' OR " - . "`address3` LIKE '%".$strSearchTxt."%' OR `address4` LIKE '%".$strSearchTxt."%' OR " - . "`address5` LIKE '%".$strSearchTxt."%' OR `address6` LIKE '%".$strSearchTxt."%' OR " - . "`name` LIKE '%".$strSearchTxt."%')"; + $mastertp->setVariable('FILTER_VISIBLE', 'visibility: hidden'); + /* Process search string */ + if ($_SESSION['search'][$preSearchSession] !== '') { + $strSearchTxt = $_SESSION['search'][$preSearchSession]; + $strSearchWhere = "AND (`$preKeyField` LIKE '%" . $strSearchTxt . "%' OR `alias` LIKE '%" . $strSearchTxt . "%' OR " + . "`email` LIKE '%" . $strSearchTxt . "%' OR `pager` LIKE '%" . $strSearchTxt . "%' OR " + . "`address1` LIKE '%" . $strSearchTxt . "%' OR `address2` LIKE '%" . $strSearchTxt . "%' OR " + . "`address3` LIKE '%" . $strSearchTxt . "%' OR `address4` LIKE '%" . $strSearchTxt . "%' OR " + . "`address5` LIKE '%" . $strSearchTxt . "%' OR `address6` LIKE '%" . $strSearchTxt . "%' OR " + . "`name` LIKE '%" . $strSearchTxt . "%')"; } - // Row sorting + /* Row sorting */ $strOrderString = "ORDER BY `config_id`, `$preKeyField` $hidSortDir"; - if ($hidSortBy == 2) { + if ($hidSortBy === 2) { $strOrderString = "ORDER BY `config_id`, `alias` $hidSortDir"; } - // Count datasets - $strSQL7 = 'SELECT count(*) AS `number` ' - . "FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess)"; + /* Count datasets */ + $strSQL7 = 'SELECT count(*) AS `number` ' + . "FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess)"; $booReturn7 = $myDBClass->hasSingleDataset($strSQL7, $arrDataLinesCount); - if ($booReturn7 == false) { + if ($booReturn7 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { @@ -482,19 +554,19 @@ if ($chkModus == 'display') { $chkLimit = 0; } } - // Get datasets - $strSQL8 = "SELECT `id`, `$preKeyField`, `alias`, `active`, `register`, `config_id`, `access_group` " - . "FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND `access_group` " - . "IN ($strAccess) $strOrderString LIMIT $chkLimit,".$SETS['common']['pagelines']; + /* Get datasets */ + $strSQL8 = "SELECT `id`, `$preKeyField`, `alias`, `active`, `register`, `config_id`, `access_group` " + . "FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND `access_group` " + . "IN ($strAccess) $strOrderString LIMIT $chkLimit," . $SETS['common']['pagelines']; $booReturn8 = $myDBClass->hasDataArray($strSQL8, $arrDataLines, $intDataCount); - if ($booReturn8 == false) { + if ($booReturn8 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - // Process data + /* Process data */ $myContentClass->listData($mastertp, $arrDataLines, $intDataCount, $intLineCount, $preKeyField, 'alias'); } -// Show messages +/* Show messages */ $myContentClass->showMessages( $mastertp, $strErrorMessage, @@ -504,7 +576,7 @@ $myContentClass->showMessages( $strTimeInfoString, $intNoTime ); -// -// Process footer -// ============== -$myContentClass->showFooter($maintp, $setFileVersion); +/* +Process footer + */ +$myContentClass->showFooter($maintp, $setFileVersion); \ No newline at end of file diff --git a/admin/contacttemplates.php b/admin/contacttemplates.php index 81b3117..3120b25 100644 --- a/admin/contacttemplates.php +++ b/admin/contacttemplates.php @@ -1,127 +1,217 @@ Application version string + * @var string $chkModus from prepend_adm.php -> Form work mode + * @var int $chkDataId from prepend_adm.php -> Actual dataset id + * @var string $chkSelModify from prepend_adm.php -> Modification selection value + * @var int $hidSortBy from prepend_adm.php -> Sort data by + * @var string $hidSortDir from prepend_adm.php -> Sort data direction (ASC, DESC) + * @var int $chkLimit from prepend_adm.php / settings -> Data set count per page + * @var int $intVersion from prepend_adm.php -> Nagios version + * @var array $SETS Settings array + * @var int $intGlobalWriteAccess from prepend_content.php -> Global admin write access + * @var int $intWriteAccessId from prepend_content.php -> Admin write access to actual dataset id + * @var string $strAccess from prepend_content.php -> List of read access group id's for actual user + * @var string $preSQLCommon2 from prepend_content.php -> Common SQL part 2 + * @var string $strDomainWhere from prepend_adm.php -> Domain selection SQL part with table name + * @var string $strDomainWhere2 from prepend_adm.php -> Domain selection SQL part without table name + * @var string $chkTfValue1 from prepend_content.php -> Contact template name + * @var string $chkTfValue2 from prepend_content.php -> Contact template description + * @var string $chkTfValue3 from prepend_content.php -> Email address + * @var string $chkTfValue4 from prepend_content.php -> Pager number + * @var string $chkTfValue5 from prepend_content.php -> Additional address 1 + * @var string $chkTfValue6 from prepend_content.php -> Additional address 2 + * @var string $chkTfValue7 from prepend_content.php -> Additional address 3 + * @var string $chkTfValue8 from prepend_content.php -> Additional address 4 + * @var string $chkTfValue9 from prepend_content.php -> Additional address 5 + * @var string $chkTfValue10 from prepend_content.php -> Additional address 6 + * @var int $chkSelValue1 from prepend_content.php -> Time period hosts + * @var int $chkSelValue2 from prepend_content.php -> Time period services + * @var array $chkMselValue1 from prepend_content.php -> Contact groups + * @var array $chkMselValue2 from prepend_content.php -> Host command + * @var array $chkMselValue3 from prepend_content.php -> Service command + * @var int $intMselValue1 from prepend_content.php -> Contact groups multiselect status value + * @var int $intMselValue2 from prepend_content.php -> Host command multiselect status value + * @var int $intMselValue3 from prepend_content.php -> Service command multiselect status value + * @var string $chkChbGr1a from prepend_content.php -> Host options (d) + * @var string $chkChbGr1b from prepend_content.php -> Host options (u) + * @var string $chkChbGr1c from prepend_content.php -> Host options (r) + * @var string $chkChbGr1d from prepend_content.php -> Host options (f) + * @var string $chkChbGr1e from prepend_content.php -> Host options (s) + * @var string $chkChbGr1f from prepend_content.php -> Host options (n) + * @var string $chkChbGr2a from prepend_content.php -> Service options (w) + * @var string $chkChbGr2b from prepend_content.php -> Service options (u) + * @var string $chkChbGr2c from prepend_content.php -> Service options (c) + * @var string $chkChbGr2d from prepend_content.php -> Service options (r) + * @var string $chkChbGr2e from prepend_content.php -> Service options (f) + * @var string $chkChbGr2f from prepend_content.php -> Service options (s) + * @var string $chkChbGr2g from prepend_content.php -> Service options (n) + * @var int $chkRadValue1 from prepend_content.php -> Contact groups multiselect options + * @var int $chkRadValue2 from prepend_content.php -> Host alarming + * @var int $chkRadValue3 from prepend_content.php -> Service alarming + * @var int $chkRadValue4 from prepend_content.php -> Host command multiselect options + * @var int $chkRadValue5 from prepend_content.php -> Service command multiselect options + * @var int $chkRadValue6 from prepend_content.php -> Retain status information + * @var int $chkRadValue7 from prepend_content.php -> Retain non-status information + * @var int $chkRadValue8 from prepend_content.php -> Can submit command + * @var string $chkTfNullVal1 from prepend_content.php -> Minimum importance + * @var int $intVariables from prepend_content.php -> Form uses variable definitions + * @var int $intTemplates from prepend_content.php -> Form uses template definitions + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 17; -$preContent = 'admin/contacttemplates.htm.tpl'; -$preListTpl = 'admin/datalist.htm.tpl'; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 17; +$preContent = 'admin/contacttemplates.htm.tpl'; +$preListTpl = 'admin/datalist.htm.tpl'; $preSearchSession = 'contacttemplate'; -$preTableName = 'tbl_contacttemplate'; -$preKeyField = 'template_name'; -$preAccess = 1; -$preFieldvars = 1; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Checkbox data processing -// ======================== -if (($intVersion == 3) || ($intVersion == 4)) { - $strHO = substr($chkChbGr1a.$chkChbGr1b.$chkChbGr1c.$chkChbGr1d.$chkChbGr1e.$chkChbGr1f, 0, -1); - $strSO = substr($chkChbGr2a.$chkChbGr2b.$chkChbGr2c.$chkChbGr2d.$chkChbGr2e.$chkChbGr2f.$chkChbGr2g, 0, -1); -} else { - $strHO = substr($chkChbGr1a.$chkChbGr1b.$chkChbGr1c.$chkChbGr1d.$chkChbGr1f, 0, -1); - $strSO = substr($chkChbGr2a.$chkChbGr2b.$chkChbGr2c.$chkChbGr2d.$chkChbGr2e.$chkChbGr2g, 0, -1); +$preTableName = 'tbl_contacttemplate'; +$preKeyField = 'template_name'; +$preAccess = 1; +$preFieldvars = 1; +$strErrorMessage = ''; +$strInfoMessage = ''; +$strConsistMessage = ''; +$strDBWarning = ''; +$intRet1 = 0; +$intRet2 = 0; +$intNoTime = 0; +/* + * Default values for form variables +*/ +if (!isset($intMselValue1)) { + $intMselValue1 = 0; } -// -// Add or modify data -// ================== -if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAccess == 0)) { +if (!isset($intMselValue2)) { + $intMselValue2 = 0; +} +if (!isset($intMselValue3)) { + $intMselValue3 = 0; +} +/* +Include preprocessing file +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Checkbox data processing +*/ +if (($intVersion === 3) || ($intVersion === 4)) { + $strHO = substr($chkChbGr1a . $chkChbGr1b . $chkChbGr1c . $chkChbGr1d . $chkChbGr1e . $chkChbGr1f, 0, -1); + $strSO = substr($chkChbGr2a . $chkChbGr2b . $chkChbGr2c . $chkChbGr2d . $chkChbGr2e . $chkChbGr2f . $chkChbGr2g, 0, -1); +} else { + $strHO = substr($chkChbGr1a . $chkChbGr1b . $chkChbGr1c . $chkChbGr1d . $chkChbGr1f, 0, -1); + $strSO = substr($chkChbGr2a . $chkChbGr2b . $chkChbGr2c . $chkChbGr2d . $chkChbGr2e . $chkChbGr2g, 0, -1); +} +/* +Add or modify data +*/ +if ((($chkModus === 'insert') || ($chkModus === 'modify')) && ($intGlobalWriteAccess === 0)) { $strSQLx = "`$preTableName` SET `$preKeyField`='$chkTfValue1', `alias`='$chkTfValue2', " - . "`contactgroups`=$intMselValue1, `contactgroups_tploptions`=$chkRadValue1, " - . "`minimum_importance`=$chkTfNullVal1, " - . "`host_notifications_enabled`='$chkRadValue2', `service_notifications_enabled`='$chkRadValue3', " - . "`host_notification_period`='$chkSelValue1', `service_notification_period`='$chkSelValue2', " - . "`host_notification_options`='$strHO', `host_notification_commands_tploptions`=$chkRadValue4, " - . "`service_notification_options`='$strSO', `host_notification_commands`=$intMselValue2, " - . "`service_notification_commands`=$intMselValue3, " - . "`service_notification_commands_tploptions`=$chkRadValue5, `can_submit_commands`='$chkRadValue8', " - . "`retain_status_information`='$chkRadValue6', `retain_nonstatus_information`='$chkRadValue7', " - . "`email`='$chkTfValue3', `pager`='$chkTfValue4', `address1`='$chkTfValue5', `address2`='$chkTfValue6', " - . "`address3`='$chkTfValue7', `address4`='$chkTfValue8', `address5`='$chkTfValue9', " - . "`address6`='$chkTfValue10', `use_variables`='$intVariables', `use_template`=$intTemplates, " - . $preSQLCommon2; - if ($chkModus == 'insert') { - $strSQL = 'INSERT INTO ' .$strSQLx; + . "`contactgroups`=$intMselValue1, `contactgroups_tploptions`=$chkRadValue1, " + . "`minimum_importance`=$chkTfNullVal1, " + . "`host_notifications_enabled`='$chkRadValue2', `service_notifications_enabled`='$chkRadValue3', " + . "`host_notification_period`='$chkSelValue1', `service_notification_period`='$chkSelValue2', " + . "`host_notification_options`='$strHO', `host_notification_commands_tploptions`=$chkRadValue4, " + . "`service_notification_options`='$strSO', `host_notification_commands`=$intMselValue2, " + . "`service_notification_commands`=$intMselValue3, " + . "`service_notification_commands_tploptions`=$chkRadValue5, `can_submit_commands`='$chkRadValue8', " + . "`retain_status_information`='$chkRadValue6', `retain_nonstatus_information`='$chkRadValue7', " + . "`email`='$chkTfValue3', `pager`='$chkTfValue4', `address1`='$chkTfValue5', `address2`='$chkTfValue6', " + . "`address3`='$chkTfValue7', `address4`='$chkTfValue8', `address5`='$chkTfValue9', " + . "`address6`='$chkTfValue10', `use_variables`='$intVariables', `use_template`=$intTemplates, " + . $preSQLCommon2; + if ($chkModus === 'insert') { + $strSQL = 'INSERT INTO ' . $strSQLx; } else { - $strSQL = 'UPDATE ' .$strSQLx. ' WHERE `id`=' .$chkDataId; + $strSQL = 'UPDATE ' . $strSQLx . ' WHERE `id`=' . $chkDataId; } - if ($intWriteAccessId == 0) { - if ($chkTfValue1 != '') { + if ($intWriteAccessId === 0) { + if ($chkTfValue1 !== '') { $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($chkModus == 'insert') { + if ($chkModus === 'insert') { $chkDataId = $intInsertId; } - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); $myDataClass->updateStatusTable($preTableName); - if ($chkModus == 'insert') { - $myDataClass->writeLog(translate('New contact template inserted:'). ' ' .$chkTfValue1); + if ($chkModus === 'insert') { + $myDataClass->writeLog(translate('New contact template inserted:') . ' ' . $chkTfValue1); } - if ($chkModus == 'modify') { - $myDataClass->writeLog(translate('Contact template modified:'). ' ' .$chkTfValue1); + if ($chkModus === 'modify') { + $myDataClass->writeLog(translate('Contact template modified:') . ' ' . $chkTfValue1); } - // - // Insert/update relations - // ======================= - if ($chkModus == 'insert') { - if ($intMselValue1 != 0) { + /* + Insert/update relations + */ + if ($chkModus === 'insert') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataInsertRelation( 'tbl_lnkContacttemplateToContactgroup', $chkDataId, $chkMselValue1 ); } - if (isset($intRet1) && ($intRet1 != 0)) { + if (isset($intRet1) && ($intRet1 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataInsertRelation( 'tbl_lnkContacttemplateToCommandHost', $chkDataId, $chkMselValue2 ); } - if (isset($intRet2) && ($intRet2 != 0)) { + if (isset($intRet2) && ($intRet2 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue3 != 0) { + if ($intMselValue3 !== 0) { $intRet3 = $myDataClass->dataInsertRelation( 'tbl_lnkContacttemplateToCommandService', $chkDataId, $chkMselValue3 ); } - if (isset($intRet3) && ($intRet3 != 0)) { + if (isset($intRet3) && ($intRet3 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - } elseif ($chkModus == 'modify') { - if ($intMselValue1 != 0) { + } elseif ($chkModus === 'modify') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataUpdateRelation( 'tbl_lnkContacttemplateToContactgroup', $chkDataId, @@ -130,10 +220,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet1 = $myDataClass->dataDeleteRelation('tbl_lnkContacttemplateToContactgroup', $chkDataId); } - if ($intRet1 != 0) { + if ($intRet1 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataUpdateRelation( 'tbl_lnkContacttemplateToCommandHost', $chkDataId, @@ -142,10 +232,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet2 = $myDataClass->dataDeleteRelation('tbl_lnkContacttemplateToCommandHost', $chkDataId); } - if ($intRet2 != 0) { + if ($intRet2 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue3 != 0) { + if ($intMselValue3 !== 0) { $intRet3 = $myDataClass->dataUpdateRelation( 'tbl_lnkContacttemplateToCommandService', $chkDataId, @@ -157,80 +247,76 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce $chkDataId ); } - if ($intRet3 != 0) { + if ($intRet3 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } - //if (($intRet1 + $intRet2 + $intRet3) != 0) { - //$strInfoMessage = ""; - //} - // - // Insert/update templates from session data - // ========================================= - if ($chkModus == 'modify') { - $strSQL = 'DELETE FROM `tbl_lnkContacttemplateToContacttemplate` WHERE `idMaster`=' .$chkDataId; - $booReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($booReturn == false) { + /* + Insert/update templates from session data + */ + if ($chkModus === 'modify') { + $strSQL = 'DELETE FROM `tbl_lnkContacttemplateToContacttemplate` WHERE `idMaster`=' . $chkDataId; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } if (isset($_SESSION['templatedefinition']) && is_array($_SESSION['templatedefinition']) && - (count($_SESSION['templatedefinition']) != 0)) { + (count($_SESSION['templatedefinition']) !== 0)) { $intSortId = 1; - /** @noinspection ForeachSourceInspection */ foreach ($_SESSION['templatedefinition'] as $elem) { - if ($elem['status'] == 0) { - $strSQL = 'INSERT INTO `tbl_lnkContacttemplateToContacttemplate` (`idMaster`, ' - . "`idSlave`,`idTable`,`idSort`) VALUES ($chkDataId,".$elem['idSlave']. ', ' - . $elem['idTable']. ',' .$intSortId. ')'; - $booReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($booReturn == false) { + if ((int)$elem['status'] === 0) { + $strSQL = 'INSERT INTO `tbl_lnkContacttemplateToContacttemplate` (`idMaster`, ' + . "`idSlave`,`idTable`,`idSort`) VALUES ($chkDataId," . $elem['idSlave'] . ', ' + . $elem['idTable'] . ',' . $intSortId . ')'; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } $intSortId++; } } - // - // Insert/update variables from session data - // ========================================= - if ($chkModus == 'modify') { - $strSQL = 'SELECT * ' - . 'FROM `tbl_lnkContacttemplateToVariabledefinition` WHERE `idMaster`=' .$chkDataId; + /* + Insert/update variables from session data + */ + if ($chkModus === 'modify') { + $strSQL = 'SELECT * ' + . 'FROM `tbl_lnkContacttemplateToVariabledefinition` WHERE `idMaster`=' . $chkDataId; $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intDataCount != 0) { + if ($intDataCount !== 0) { foreach ($arrData as $elem) { - $strSQL = 'DELETE FROM `tbl_variabledefinition` WHERE `id`=' .$elem['idSlave']; - $booReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($booReturn == false) { + $strSQL = 'DELETE FROM `tbl_variabledefinition` WHERE `id`=' . $elem['idSlave']; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } } - $strSQL = 'DELETE FROM `tbl_lnkContacttemplateToVariabledefinition` ' - . 'WHERE `idMaster`=' .$chkDataId; - $booReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($booReturn == false) { + $strSQL = 'DELETE FROM `tbl_lnkContacttemplateToVariabledefinition` ' + . 'WHERE `idMaster`=' . $chkDataId; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } if (isset($_SESSION['variabledefinition']) && is_array($_SESSION['variabledefinition']) && - (count($_SESSION['variabledefinition']) != 0)) { + (count($_SESSION['variabledefinition']) !== 0)) { foreach ($_SESSION['variabledefinition'] as $elem) { - if ($elem['status'] == 0) { - $strSQL = 'INSERT INTO `tbl_variabledefinition` (`name`,`value`,`last_modified`) ' - . "VALUES ('".$elem['definition']."','".$elem['range']."',now())"; - $booReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($booReturn == false) { + if ((int)$elem['status'] === 0) { + $strSQL = 'INSERT INTO `tbl_variabledefinition` (`name`,`value`,`last_modified`) ' + . "VALUES ('" . $elem['definition'] . "','" . $elem['range'] . "',now())"; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - $strSQL = 'INSERT INTO `tbl_lnkContacttemplateToVariabledefinition` (`idMaster`, ' - . "`idSlave`) VALUES ($chkDataId,$intInsertId)"; - $booReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($booReturn == false) { + $strSQL = 'INSERT INTO `tbl_lnkContacttemplateToVariabledefinition` (`idMaster`, ' + . "`idSlave`) VALUES ($chkDataId,$intInsertId)"; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } @@ -248,95 +334,85 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } $chkModus = 'display'; } -if ($chkModus != 'add') { +if ($chkModus !== 'add') { $chkModus = 'display'; } -// -// Get date/time of last database and config file manipulation -// =========================================================== +/* +Get date/time of last database and config file manipulation +*/ $intReturn = $myConfigClass->lastModifiedFile($preTableName, $arrTimeData, $strTimeInfoString); -if ($intReturn != 0) { +if ($intReturn !== 0) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } -// -// Singe data form -// =============== -if ($chkModus == 'add') { +/* +Singe data form +*/ +if ($chkModus === 'add') { + $intDataWarning = 0; $conttp->setVariable('TITLE', translate('Define contact templates (contacttemplates.cfg)')); - // Do not show modified time list + /* Do not show modified time list */ $intNoTime = 1; - // Process template selection fields (Spezial) + /* Process template selection fields (Spezial) */ $strWhere = ''; - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - $strWhere = 'AND `id` <> ' .$arrModifyData['id']; + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + $strWhere = 'AND `id` <> ' . $arrModifyData['id']; } - $strSQL1 = "SELECT `id`,`$preKeyField`, `active` FROM `$preTableName` " - . "WHERE $strDomainWhere $strWhere ORDER BY `$preKeyField`"; + /** @noinspection SqlResolve */ + $strSQL1 = "SELECT `id`,`$preKeyField`, `active` FROM `$preTableName` " + . "WHERE $strDomainWhere $strWhere ORDER BY `$preKeyField`"; $booReturn1 = $myDBClass->hasDataArray($strSQL1, $arrDataTpl, $intDataCountTpl); - if ($booReturn1 == false) { + if ($booReturn1 === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($intDataCountTpl != 0) { + if ($intDataCountTpl !== 0) { /** @var array $arrDataTpl */ foreach ($arrDataTpl as $elem) { - if ($elem['active'] == 0) { + if ($elem['active'] === 0) { $strActive = ' [inactive]'; $conttp->setVariable('SPECIAL_STYLE', 'inactive_option'); } else { $strActive = ''; - $conttp->setVariable('SPECIAL_STYLE', ''); + $conttp->setVariable('SPECIAL_STYLE'); } - $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem[$preKeyField], ENT_QUOTES, 'UTF-8').$strActive); - $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id']. '::1'); - $conttp->parse('template'); + $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem[$preKeyField], ENT_QUOTES, 'UTF-8') . $strActive); + $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id'] . '::1'); } + $conttp->parse('template'); } - $strSQL2 = 'SELECT `id`, `name`, `active` FROM `tbl_contact` ' - . "WHERE `name` <> '' AND $strDomainWhere2 ORDER BY name"; + $strSQL2 = 'SELECT `id`, `name`, `active` FROM `tbl_contact` ' + . "WHERE `name` <> '' AND $strDomainWhere2 ORDER BY name"; $booReturn2 = $myDBClass->hasDataArray($strSQL2, $arrDataHpl, $intDataCountHpl); - if ($booReturn2 == false) { + if ($booReturn2 === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($intDataCountHpl != 0) { + if ($intDataCountHpl !== 0) { /** @var array $arrDataHpl */ foreach ($arrDataHpl as $elem) { - if ($elem['active'] == 0) { + if ($elem['active'] === 0) { $strActive = ' [inactive]'; $conttp->setVariable('SPECIAL_STYLE', 'inactive_option'); } else { $strActive = ''; - $conttp->setVariable('SPECIAL_STYLE', ''); + $conttp->setVariable('SPECIAL_STYLE'); } - $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem['name'], ENT_QUOTES, 'UTF-8').$strActive); - $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id']. '::2'); - $conttp->parse('template'); + $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem['name'], ENT_QUOTES, 'UTF-8') . $strActive); + $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id'] . '::2'); } + $conttp->parse('template'); } - // Process timeperiod selection fields - if (isset($arrModifyData['host_notification_period'])) { - $intFieldId = $arrModifyData['host_notification_period']; - } else { - $intFieldId = 0; - } + /* Process timeperiod selection fields */ + $intFieldId = $arrModifyData['host_notification_period'] ?? 0; $intReturn1 = $myVisClass->parseSelectSimple('tbl_timeperiod', 'timeperiod_name', 'host_time', 1, $intFieldId); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['service_notification_period'])) { - $intFieldId = $arrModifyData['service_notification_period']; - } else { - $intFieldId = 0; - } + $intFieldId = $arrModifyData['service_notification_period'] ?? 0; $intReturn2 = $myVisClass->parseSelectSimple('tbl_timeperiod', 'timeperiod_name', 'service_time', 1, $intFieldId); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process command selection fields - if (isset($arrModifyData['host_notification_commands'])) { - $intFieldId = $arrModifyData['host_notification_commands']; - } else { - $intFieldId = 0; - } + /* Process command selection fields */ + $intFieldId = $arrModifyData['host_notification_commands'] ?? 0; $intReturn3 = $myVisClass->parseSelectMulti( 'tbl_command', 'command_name', @@ -345,14 +421,10 @@ if ($chkModus == 'add') { 0, $intFieldId ); - if ($intReturn3 != 0) { + if ($intReturn3 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['service_notification_commands'])) { - $intFieldId = $arrModifyData['service_notification_commands']; - } else { - $intFieldId = 0; - } + $intFieldId = $arrModifyData['service_notification_commands'] ?? 0; $intReturn4 = $myVisClass->parseSelectMulti( 'tbl_command', 'command_name', @@ -361,15 +433,11 @@ if ($chkModus == 'add') { 0, $intFieldId ); - if ($intReturn4 != 0) { + if ($intReturn4 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process contactgroup selection field - if (isset($arrModifyData['contactgroups'])) { - $intFieldId = $arrModifyData['contactgroups']; - } else { - $intFieldId = 0; - } + /* Process contactgroup selection field */ + $intFieldId = $arrModifyData['contactgroups'] ?? 0; $intReturn5 = $myVisClass->parseSelectMulti( 'tbl_contactgroup', 'contactgroup_name', @@ -378,30 +446,26 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn5 != 0) { + if ($intReturn5 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process acces group selection field - if (isset($arrModifyData['access_group'])) { - $intFieldId = $arrModifyData['access_group']; - } else { - $intFieldId = 0; - } + /* Process acces group selection field */ + $intFieldId = $arrModifyData['access_group'] ?? 0; $intReturn6 = $myVisClass->parseSelectSimple('tbl_group', 'groupname', 'acc_group', 0, $intFieldId); - if ($intReturn6 != 0) { + if ($intReturn6 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Initial add/modify form definitions + /* Initial add/modify form definitions */ $strChbFields = 'HNE,SNE,RSI,CSC,RNS,TPL,SEC,HOC,COG'; $myContentClass->addFormInit($conttp, $strChbFields); - if ($intDataWarning == 1) { - $conttp->setVariable('WARNING', $strDBWarning. '
' .translate('Saving not possible!')); + if ($intDataWarning === 1) { + $conttp->setVariable('WARNING', $strDBWarning . '
' . translate('Saving not possible!')); } - if ($intVersion == 4) { + if ($intVersion === 4) { $conttp->setVariable('HOST_OPTION_FIELDS', 'chbGr1a,chbGr1b,chbGr1c,chbGr1d,chbGr1e,chbGr1f'); $conttp->setVariable('SERVICE_OPTION_FIELDS', 'chbGr2a,chbGr2b,chbGr2c,chbGr2d,chbGr2e,chbGr2f,chbGr2g'); } - if ($intVersion == 3) { + if ($intVersion === 3) { $conttp->setVariable('HOST_OPTION_FIELDS', 'chbGr1a,chbGr1b,chbGr1c,chbGr1d,chbGr1e,chbGr1f'); $conttp->setVariable('SERVICE_OPTION_FIELDS', 'chbGr2a,chbGr2b,chbGr2c,chbGr2d,chbGr2e,chbGr2f,chbGr2g'); } @@ -410,68 +474,71 @@ if ($chkModus == 'add') { $conttp->setVariable('SERVICE_OPTION_FIELDS', 'chbGr2a,chbGr2b,chbGr2c,chbGr2d,chbGr2e,chbGr2g'); $conttp->setVariable('VERSION_20_VALUE_MUST', ',tfValue2'); } - // Insert data from database in "modify" mode - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - // Check relation information to find out locked configuration datasets + /* Insert data from database in "modify" mode */ + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + /* Check relation information to find out locked configuration datasets */ $intLocked = $myDataClass->infoRelation($preTableName, $arrModifyData['id'], $preKeyField); $myVisClass->processMessage($myDataClass->strInfoMessage, $strRelMessage); - $strInfo = '
' .translate('Entry cannot be activated because it is used by ' - . 'another configuration'). ':'; - $strInfo .= '
' .$strRelMessage. ''; - // Process data + $strInfo = '
' . translate('Entry cannot be activated because it is used by ' + . 'another configuration') . ':'; + $strInfo .= '
' . $strRelMessage . ''; + /* Process data */ $myContentClass->addInsertData($conttp, $arrModifyData, $intLocked, $strInfo, $strChbFields); - // Process radio fields - $conttp->setVariable('DAT_HNE' .$arrModifyData['host_notifications_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_SNE' .$arrModifyData['service_notifications_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_RSI' .$arrModifyData['retain_status_information']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_CSC' .$arrModifyData['can_submit_commands']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_RNS' .$arrModifyData['retain_nonstatus_information']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_TPL' .$arrModifyData['use_template_tploptions']. '_CHECKED', 'checked'); + /* Process radio fields */ + $conttp->setVariable('DAT_HNE' . $arrModifyData['host_notifications_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_SNE' . $arrModifyData['service_notifications_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_RSI' . $arrModifyData['retain_status_information'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_CSC' . $arrModifyData['can_submit_commands'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_RNS' . $arrModifyData['retain_nonstatus_information'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_TPL' . $arrModifyData['use_template_tploptions'] . '_CHECKED', 'checked'); $conttp->setVariable( - 'DAT_SEC' .$arrModifyData['service_notification_commands_tploptions']. '_CHECKED', + 'DAT_SEC' . $arrModifyData['service_notification_commands_tploptions'] . '_CHECKED', 'checked' ); - $conttp->setVariable('DAT_HOC' .$arrModifyData['host_notification_commands_tploptions']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_COG' .$arrModifyData['contactgroups_tploptions']. '_CHECKED', 'checked'); - // Process option fields + $conttp->setVariable('DAT_HOC' . $arrModifyData['host_notification_commands_tploptions'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_COG' . $arrModifyData['contactgroups_tploptions'] . '_CHECKED', 'checked'); + /* Process option fields */ foreach (explode(',', $arrModifyData['host_notification_options']) as $elem) { - $conttp->setVariable('DAT_HO' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_HO' . strtoupper($elem) . '_CHECKED', 'checked'); } foreach (explode(',', $arrModifyData['service_notification_options']) as $elem) { - $conttp->setVariable('DAT_SO' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_SO' . strtoupper($elem) . '_CHECKED', 'checked'); } } $conttp->parse('datainsert'); $conttp->show('datainsert'); } -// -// List view -// ========== -if ($chkModus == 'display') { - // Initial list view definitions +/* +List view +*/ +if ($chkModus === 'display') { + $strSearchWhere = ''; + $intLineCount = 0; + /* Initial list view definitions */ $myContentClass->listViewInit($mastertp); $mastertp->setVariable('TITLE', translate('Define contact templates (contacttemplates.cfg)')); $mastertp->setVariable('FIELD_1', translate('Contact name')); $mastertp->setVariable('FIELD_2', translate('Description')); - // Process filter string - if ($_SESSION['search'][$preSearchSession] != '') { - $strSearchTxt = $_SESSION['search'][$preSearchSession]; - $strSearchWhere = "AND (`$preKeyField` LIKE '%".$strSearchTxt."%' OR `alias` LIKE '%".$strSearchTxt."%' OR " - . "`email` LIKE '%".$strSearchTxt."%' OR `pager` LIKE '%".$strSearchTxt."%' OR " - . "`address1` LIKE '%".$strSearchTxt."%' OR `address2` LIKE '%".$strSearchTxt."%' OR " - . "`address3` LIKE '%".$strSearchTxt."%' OR `address4` LIKE '%".$strSearchTxt."%' OR " - . "`address5` LIKE '%".$strSearchTxt."%' OR `address6` LIKE '%".$strSearchTxt."%')"; + $mastertp->setVariable('FILTER_VISIBLE', 'visibility: hidden'); + /* Process filter string */ + if ($_SESSION['search'][$preSearchSession] !== '') { + $strSearchTxt = $_SESSION['search'][$preSearchSession]; + $strSearchWhere = "AND (`$preKeyField` LIKE '%" . $strSearchTxt . "%' OR `alias` LIKE '%" . $strSearchTxt . "%' OR " + . "`email` LIKE '%" . $strSearchTxt . "%' OR `pager` LIKE '%" . $strSearchTxt . "%' OR " + . "`address1` LIKE '%" . $strSearchTxt . "%' OR `address2` LIKE '%" . $strSearchTxt . "%' OR " + . "`address3` LIKE '%" . $strSearchTxt . "%' OR `address4` LIKE '%" . $strSearchTxt . "%' OR " + . "`address5` LIKE '%" . $strSearchTxt . "%' OR `address6` LIKE '%" . $strSearchTxt . "%')"; } - // Row sorting + /* Row sorting */ $strOrderString = "ORDER BY `config_id`, `$preKeyField` $hidSortDir"; - if ($hidSortBy == 2) { + if ($hidSortBy === 2) { $strOrderString = "ORDER BY `config_id`, `alias` $hidSortDir"; } - // Count datasets - $strSQL = 'SELECT count(*) AS `number` ' - . "FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess)"; + /* Count datasets */ + $strSQL = 'SELECT count(*) AS `number` ' + . "FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess)"; $booReturn1 = $myDBClass->hasSingleDataset($strSQL, $arrDataLinesCount); - if ($booReturn1 == false) { + if ($booReturn1 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { @@ -480,19 +547,19 @@ if ($chkModus == 'display') { $chkLimit = 0; } } - // Get datasets - $strSQL = "SELECT `id`, `$preKeyField`, `alias`, `active`, `register`, `config_id`, `access_group` " - . "FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess) " - . "$strOrderString LIMIT $chkLimit,".$SETS['common']['pagelines']; + /* Get datasets */ + $strSQL = "SELECT `id`, `$preKeyField`, `alias`, `active`, `register`, `config_id`, `access_group` " + . "FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess) " + . "$strOrderString LIMIT $chkLimit," . $SETS['common']['pagelines']; $booReturn2 = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - if ($booReturn2 == false) { + if ($booReturn2 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - // Process data + /* Process data */ $myContentClass->listData($mastertp, $arrDataLines, $intDataCount, $intLineCount, $preKeyField, 'alias'); } -// Show messages +/* Show messages */ $myContentClass->showMessages( $mastertp, $strErrorMessage, @@ -502,7 +569,7 @@ $myContentClass->showMessages( $strTimeInfoString, $intNoTime ); -// -// Process footer -// ============== -$myContentClass->showFooter($maintp, $setFileVersion); +/* +Process footer + */ +$myContentClass->showFooter($maintp, $setFileVersion); \ No newline at end of file diff --git a/admin/datadomain.php b/admin/datadomain.php index da1a485..ee44f83 100644 --- a/admin/datadomain.php +++ b/admin/datadomain.php @@ -1,70 +1,103 @@ Application version string + * @var int $chkActive from prepend_adm.php -> Active checkbox + * @var string $chkModus from prepend_adm.php -> Form work mode + * @var int $chkDataId from prepend_adm.php -> Actual dataset id + * @var string $chkSelModify from prepend_adm.php -> Modification selection value + * @var int $hidSortBy from prepend_adm.php -> Sort data by + * @var string $hidSortDir from prepend_adm.php -> Sort data direction (ASC, DESC) + * @var int $chkLimit from prepend_adm.php / settings -> Data set count per page + * @var array $SETS Settings array + * @var int $intGlobalWriteAccess from prepend_content.php -> Global admin write access + * @var int $intWriteAccessId from prepend_content.php -> Admin write access to actual dataset id + * @var string $strAccess from prepend_content.php -> List of read access group id's for actual user + * @var string $chkTfValue1 from prepend_content.php -> Domain name + * @var string $chkTfValue2 from prepend_content.php -> Domain description + * @var int $chkSelValue1 from prepend_content.php -> Configuration target domain + * @var string $chkSelValue2 from prepend_content.php -> Nagios version + * @var string $chkSelValue3 from prepend_content.php -> Use common domain selection + * @var string $chkSelAccGr from prepend_content.php -> Access group selector + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 35; -$preContent = 'admin/datadomain.htm.tpl'; -$preListTpl = 'admin/datalist_common.htm.tpl'; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 35; +$preContent = 'admin/datadomain.htm.tpl'; +$preListTpl = 'admin/datalist_common.htm.tpl'; $preTableName = 'tbl_datadomain'; -$preKeyField = 'domain'; -$preAccess = 1; +$preKeyField = 'domain'; +$preAccess = 1; $preFieldvars = 1; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Add or modify data -// ================== -if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAccess == 0)) { - if ($chkTfValue1 == 'common') { +$strErrorMessage = ''; +$strInfoMessage = ''; +$strConsistMessage = ''; +/* +Include preprocessing file +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Add or modify data +*/ +if ((($chkModus === 'insert') || ($chkModus === 'modify')) && ($intGlobalWriteAccess === 0)) { + if ($chkTfValue1 === 'common') { $chkSelValue1 = 0; } $strSQLx = "`$preTableName` SET `$preKeyField`='$chkTfValue1', `alias`='$chkTfValue2', `targets`=$chkSelValue1, " - . "`version`=$chkSelValue2, `access_group`=$chkSelAccGr, `enable_common`=$chkSelValue3, " - . "`active`='$chkActive', `last_modified`=NOW()"; - if ($chkModus == 'insert') { - $strSQL = 'INSERT INTO ' .$strSQLx; + . "`version`=$chkSelValue2, `access_group`=$chkSelAccGr, `enable_common`=$chkSelValue3, " + . "`active`='$chkActive', `last_modified`=NOW()"; + if ($chkModus === 'insert') { + $strSQL = 'INSERT INTO ' . $strSQLx; } else { - $strSQL = 'UPDATE ' .$strSQLx. ' WHERE `id`=' .$chkDataId; + $strSQL = 'UPDATE ' . $strSQLx . ' WHERE `id`=' . $chkDataId; } - if ($intWriteAccessId == 0) { - if (($chkTfValue1 != '') && ($chkTfValue2 != '') && (($chkTfValue1 == 'common') || ($chkSelValue1 != 0))) { + if ($intWriteAccessId === 0) { + if (($chkTfValue1 !== '') && ($chkTfValue2 !== '') && (($chkTfValue1 === 'common') || ($chkSelValue1 !== 0))) { $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($chkModus == 'insert') { + if ($chkModus === 'insert') { $chkDataId = $intInsertId; } - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); - if ($chkModus == 'insert') { - $myDataClass->writeLog(translate('New Domain inserted:'). ' ' .$chkTfValue1); + if ($chkModus === 'insert') { + $myDataClass->writeLog(translate('New Domain inserted:') . ' ' . $chkTfValue1); } - if ($chkModus == 'modify') { - $myDataClass->writeLog(translate('Domain modified:'). ' ' .$chkTfValue1); + if ($chkModus === 'modify') { + $myDataClass->writeLog(translate('Domain modified:') . ' ' . $chkTfValue1); } } } else { @@ -78,59 +111,52 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } $chkModus = 'display'; } -if ($chkModus != 'add') { +if ($chkModus !== 'add') { $chkModus = 'display'; } -// -// Single view -// =========== -if ($chkModus == 'add') { - // Process configuration target selection fields - - if (isset($arrModifyData['targets'])) { - $intFieldId = $arrModifyData['targets']; - } else { - $intFieldId = 0; - } +/* +Single view +*/ +if ($chkModus === 'add') { + $intDataWarning = 0; + $strDBWarning = ''; + /* Process configuration target selection fields */ + $intFieldId = $arrModifyData['targets'] ?? 0; $intReturn1 = $myVisClass->parseSelectSimple('tbl_configtarget', 'target', 'target', 0, $intFieldId); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); $myVisClass->processMessage(translate('Attention, no configuration targets defined!'), $strDBWarning); $intDataWarning = 1; } - // Process acces group selection field - if (isset($arrModifyData['access_group'])) { - $intFieldId = $arrModifyData['access_group']; - } else { - $intFieldId = 0; - } + /* Process acces group selection field */ + $intFieldId = $arrModifyData['access_group'] ?? 0; $intReturn2 = $myVisClass->parseSelectSimple('tbl_group', 'groupname', 'acc_group', 0, $intFieldId); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Initial add/modify form definitions + /* Initial add/modify form definitions */ $myContentClass->addFormInit($conttp); - if ($intDataWarning == 1) { - $conttp->setVariable('WARNING', $strDBWarning. '
' .translate('Saving not possible!')); + if ($intDataWarning === 1) { + $conttp->setVariable('WARNING', $strDBWarning . '
' . translate('Saving not possible!')); } $conttp->setVariable('TITLE', translate('Data domain administration')); $conttp->setVariable('FILL_ALLFIELDS', translate('Please fill in all fields marked with an *')); $conttp->setVariable('FILL_ILLEGALCHARS', translate('The following field contains illegal characters:')); $conttp->setVariable('ENABLE', translate('Enable')); $conttp->setVariable('DISABLE', translate('Disable')); - // Insert data from database in "modify" mode - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - // Process data + /* Insert data from database in "modify" mode */ + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + /* Process data */ $myContentClass->addInsertData($conttp, $arrModifyData, 0, ''); - // Nagios version - $conttp->setVariable('VER_SELECTED_' .$arrModifyData['version'], 'selected'); - // Enable common domain - $conttp->setVariable('ENA_COMMON_SELECTED_' .$arrModifyData['enable_common'], 'selected'); - // Domain localhost cant' be renamed - if ($arrModifyData['domain'] == 'localhost') { + /* Nagios version */ + $conttp->setVariable('VER_SELECTED_' . $arrModifyData['version'], 'selected'); + /* Enable common domain */ + $conttp->setVariable('ENA_COMMON_SELECTED_' . $arrModifyData['enable_common'], 'selected'); + /* Domain localhost cannot be renamed */ + if ($arrModifyData['domain'] === 'localhost') { $conttp->setVariable('DOMAIN_DISABLE', 'readonly'); $conttp->setVariable('LOCKCLASS', 'inputlock'); - } elseif ($arrModifyData['domain'] == 'common') { + } elseif ($arrModifyData['domain'] === 'common') { $conttp->setVariable('DOMAIN_DISABLE', 'readonly'); $conttp->setVariable('COMMON_INVISIBLE', 'class="elementHide"'); $conttp->setVariable('LOCKCLASS', 'inputlock'); @@ -141,24 +167,26 @@ if ($chkModus == 'add') { $conttp->parse('datainsert'); $conttp->show('datainsert'); } -// -// List view -// ========== -if ($chkModus == 'display') { - // Initial list view definitions +/* +List view +*/ +if ($chkModus === 'display') { + $intLineCount = 0; + /* Initial list view definitions */ $myContentClass->listViewInit($mastertp); $mastertp->setVariable('TITLE', translate('Data domain administration')); $mastertp->setVariable('FIELD_1', translate('Data domain')); $mastertp->setVariable('FIELD_2', translate('Description')); - // Row sorting + /* Row sorting */ $strOrderString = "ORDER BY `domain` $hidSortDir"; - if ($hidSortBy == 2) { + if ($hidSortBy === 2) { $strOrderString = "ORDER BY `alias` $hidSortDir"; } - // Count datasets - $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` WHERE `access_group` IN ($strAccess)"; + /* Count datasets */ + /** @noinspection SqlResolve */ + $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` WHERE `access_group` IN ($strAccess)"; $booReturn1 = $myDBClass->hasSingleDataset($strSQL, $arrDataLinesCount); - if ($booReturn1 == false) { + if ($booReturn1 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { @@ -167,21 +195,21 @@ if ($chkModus == 'display') { $chkLimit = 0; } } - // Get datasets - $strSQL = 'SELECT `id`, `domain`, `alias`, `active`, `nodelete`, `access_group` ' - . "FROM `$preTableName` WHERE `access_group` IN ($strAccess) $strOrderString " - . "LIMIT $chkLimit,".$SETS['common']['pagelines']; + /* Get datasets */ + $strSQL = 'SELECT `id`, `domain`, `alias`, `active`, `nodelete`, `access_group` ' + . "FROM `$preTableName` WHERE `access_group` IN ($strAccess) $strOrderString " + . "LIMIT $chkLimit," . $SETS['common']['pagelines']; $booReturn2 = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - if ($booReturn2 == false) { + if ($booReturn2 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - // Process data + /* Process data */ $myContentClass->listData($mastertp, $arrDataLines, $intDataCount, $intLineCount, $preKeyField, 'alias'); } -// Show messages +/* Show messages */ $myContentClass->showMessages($mastertp, $strErrorMessage, $strInfoMessage, $strConsistMessage, array(), '', 1); -// -// Process footer -// ============== -$myContentClass->showFooter($maintp, $setFileVersion); +/* +Process footer +*/ +$myContentClass->showFooter($maintp, $setFileVersion); \ No newline at end of file diff --git a/admin/delbackup.php b/admin/delbackup.php index 4e6cd26..4f9089c 100644 --- a/admin/delbackup.php +++ b/admin/delbackup.php @@ -1,67 +1,87 @@ Application version string + * @var string $prePageKey from prepend_adm.php -> Menu group id + * @var int $chkStatus from prepend_adm.php -> (hidden) Status field + * @var string $chkTfSearch from prepend_content.php -> Text search string + * @var mixed $chkMselValue1 from prepend_content.php -> Backup file list + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 26; -$preContent = 'admin/delbackup.htm.tpl'; -$preAccess = 1; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 26; +$preContent = 'admin/delbackup.htm.tpl'; +$preAccess = 1; $preFieldvars = 1; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Get configuration set ID -// ======================== +$strErrorMessage = ''; +$strInfoMessage = ''; +/* +Include preprocessing files +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Get configuration set ID +*/ +$intMethod = 0; +$strMethod = ''; $myConfigClass->getConfigTargets($arrConfigSet); -$intConfigId = $arrConfigSet[0]; -$myConfigClass->getConfigValues($intConfigId, 'method', $intMethod); +$intConfigId = (int)$arrConfigSet[0]; +if ($myConfigClass->getConfigValues($intConfigId, 'method', $strMethod) === 0) { + $intMethod = (int)$strMethod; +} $myConfigClass->getConfigValues($intConfigId, 'backupdir', $strBackupDir); $myConfigClass->getConfigValues($intConfigId, 'hostbackup', $strHostBackupDir); $myConfigClass->getConfigValues($intConfigId, 'servicebackup', $strServiceBackupDir); -// -// Process form inputs -// =================== -if (($chkMselValue1[0] != '') && ($chkStatus == 1)) { +/* +Process form inputs +*/ +if (isset($chkMselValue1[0]) && ($chkMselValue1[0] !== '') && ($chkStatus === 1)) { /** @var array $chkMselValue1 */ foreach ($chkMselValue1 as $elem) { $intCheck = $myConfigClass->removeFile(trim($elem), $intConfigId); $strFileTmp1 = str_replace($strServiceBackupDir, '', $elem); $strFileTmp2 = str_replace($strHostBackupDir, '', $strFileTmp1); - $strFile = str_replace($strBackupDir, '', $strFileTmp2); - if ($intCheck == 0) { - $myDataClass->writeLog(translate('File deleted'). ': ' .trim($strFile)); - $myVisClass->processMessage($strFile. ' ' .translate('successfully deleted'). '!', $strInfoMessage); + $strFile = str_replace($strBackupDir, '', $strFileTmp2); + if ($intCheck === 0) { + $myDataClass->writeLog(translate('File deleted') . ': ' . trim($strFile)); + $myVisClass->processMessage($strFile . ' ' . translate('successfully deleted') . '!', $strInfoMessage); } else { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } } } -// -// Include content -// =============== +/* +Include content +*/ $conttp->setVariable('TITLE', translate('Delete backup files')); $conttp->parse('header'); $conttp->show('header'); @@ -75,42 +95,42 @@ $conttp->setVariable('LANG_REQUIRED', translate('required')); $conttp->setVariable('MAKE', translate('Delete')); $conttp->setVariable('ABORT', translate('Abort')); $conttp->setVariable('CTRL_INFO', translate('Hold CTRL to select
more than one entry')); -$conttp->setVariable('IMAGE_PATH', $_SESSION['SETS']['path']['base_url']. 'images/'); -$conttp->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -// Build a local file list -if ($intMethod == 1) { +$conttp->setVariable('IMAGE_PATH', $_SESSION['SETS']['path']['base_url'] . 'images/'); +$conttp->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF')); +/* Build a local file list */ +if ($intMethod === 1) { $output = array(); $myConfigClass->storeDirToArray($strBackupDir, "\.cfg_old", '', $output, $strErrorMessage); - if (is_array($output) && (count($output) != 0)) { + if (is_array($output) && (count($output) !== 0)) { foreach ($output as $elem) { - if (($chkTfSearch == '') || (substr_count($elem, $chkTfSearch) != 0)) { + if (($chkTfSearch === '') || (substr_count($elem, $chkTfSearch) !== 0)) { $conttp->setVariable('DAT_BACKUPFILE', $elem); $conttp->parse('filelist'); } } } -} elseif ($intMethod == 2) { - // Set up basic connection - if ($myConfigClass->getFTPConnection($intConfigId) == '0') { - $arrFiles = array(); - $arrFiles1 = ftp_nlist($myConfigClass->resConnectId, $strBackupDir); +} elseif ($intMethod === 2) { + /* Set up basic connection */ + if ($myConfigClass->getFTPConnection($intConfigId) === 0) { + $arrFiles = array(); + $arrFiles1 = ftp_nlist($myConfigClass->conFTPConId, $strBackupDir); if (is_array($arrFiles1)) { $arrFiles = array_merge($arrFiles, $arrFiles1); } - $arrFiles2 = ftp_nlist($myConfigClass->resConnectId, $strHostBackupDir); + $arrFiles2 = ftp_nlist($myConfigClass->conFTPConId, $strHostBackupDir); if (is_array($arrFiles2)) { $arrFiles = array_merge($arrFiles, $arrFiles2); } - $arrFiles3 = ftp_nlist($myConfigClass->resConnectId, $strServiceBackupDir); + $arrFiles3 = ftp_nlist($myConfigClass->conFTPConId, $strServiceBackupDir); if (is_array($arrFiles3)) { $arrFiles = array_merge($arrFiles, $arrFiles3); } - if (is_array($arrFiles) && (count($arrFiles) != 0)) { + if (is_array($arrFiles) && (count($arrFiles) !== 0)) { foreach ($arrFiles as $elem) { if (!substr_count($elem, 'cfg')) { continue; } - if (($chkTfSearch == '') || (substr_count($elem, $chkTfSearch) != 0)) { + if (($chkTfSearch === '') || (substr_count($elem, $chkTfSearch) !== 0)) { $conttp->setVariable('DAT_BACKUPFILE', $elem); $conttp->parse('filelist'); } @@ -121,32 +141,32 @@ if ($intMethod == 1) { $strErrorMessage ); } - ftp_close($myConfigClass->resConnectId); + ftp_close($myConfigClass->conFTPConId); } else { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } -} elseif ($intMethod == 3) { - // Set up basic connection - if ($myConfigClass->getSSHConnection($intConfigId) == '0') { - $arrFiles = array(); - $intReturn = $myConfigClass->sendSSHCommand('ls ' .$strBackupDir. '*.cfg_old*', $arrFiles1); - if (($intReturn == 0) && is_array($arrFiles1)) { +} elseif ($intMethod === 3) { + /* Set up basic connection */ + if ($myConfigClass->getSSHConnection($intConfigId) === 0) { + $arrFiles = array(); + $intReturn = $myConfigClass->sendSSHCommand('ls ' . $strBackupDir . '*.cfg_old*', $arrFiles1); + if (($intReturn === 0) && is_array($arrFiles1)) { $arrFiles = array_merge($arrFiles, $arrFiles1); } - $intReturn = $myConfigClass->sendSSHCommand('ls ' .$strHostBackupDir. '*.cfg_old*', $arrFiles2); - if (($intReturn == 0) && is_array($arrFiles2)) { + $intReturn = $myConfigClass->sendSSHCommand('ls ' . $strHostBackupDir . '*.cfg_old*', $arrFiles2); + if (($intReturn === 0) && is_array($arrFiles2)) { $arrFiles = array_merge($arrFiles, $arrFiles2); } - $intReturn = $myConfigClass->sendSSHCommand('ls ' .$strServiceBackupDir. '*.cfg_old*', $arrFiles3); - if (($intReturn == 0) && is_array($arrFiles3)) { + $intReturn = $myConfigClass->sendSSHCommand('ls ' . $strServiceBackupDir . '*.cfg_old*', $arrFiles3); + if (($intReturn === 0) && is_array($arrFiles3)) { $arrFiles = array_merge($arrFiles, $arrFiles3); } - if (is_array($arrFiles) && (count($arrFiles) != 0)) { + if (is_array($arrFiles) && (count($arrFiles) !== 0)) { foreach ($arrFiles as $elem) { if (!substr_count($elem, 'cfg_old')) { continue; } - if (($chkTfSearch == '') || (substr_count($elem, $chkTfSearch) != 0)) { + if (($chkTfSearch === '') || (substr_count($elem, $chkTfSearch) !== 0)) { $conttp->setVariable('DAT_BACKUPFILE', str_replace('//', '/', $elem)); $conttp->parse('filelist'); } @@ -161,20 +181,20 @@ if ($intMethod == 1) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } } -if ($strErrorMessage != '') { +if ($strErrorMessage !== '') { $conttp->setVariable('ERRORMESSAGE', $strErrorMessage); } $conttp->setVariable('INFOMESSAGE', $strInfoMessage); -// Check access rights for adding new objects -if ($myVisClass->checkAccountGroup($prePageKey, 'write') != 0) { +/* Check access rights for adding new objects */ +if ($myVisClass->checkAccountGroup($prePageKey, 'write') !== 0) { $conttp->setVariable('ADD_CONTROL', 'disabled="disabled"'); } $conttp->parse('main'); $conttp->show('main'); -// -// Footer ausgeben -// =============== +/* +Footer ausgeben +*/ $maintp->setVariable('VERSION_INFO', "NagiosQL $setFileVersion"); + . "target='_blank'>NagiosQL $setFileVersion"); $maintp->parse('footer'); -$maintp->show('footer'); +$maintp->show('footer'); \ No newline at end of file diff --git a/admin/delconfig.php b/admin/delconfig.php index f724bd1..c05fdd8 100644 --- a/admin/delconfig.php +++ b/admin/delconfig.php @@ -1,67 +1,86 @@ Application version string + * @var string $prePageKey from prepend_adm.php -> Menu group id + * @var int $chkStatus from prepend_adm.php -> (hidden) Status field + * @var string $chkTfSearch from prepend_content.php -> Text search string + * @var mixed $chkMselValue1 from prepend_content.php -> Backup file list + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 27; -$preContent = 'admin/delbackup.htm.tpl'; -$preAccess = 1; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 27; +$preContent = 'admin/delbackup.htm.tpl'; +$preAccess = 1; $preFieldvars = 1; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Get configuration set ID -// ======================== - $myConfigClass->getConfigTargets($arrConfigSet); -$intConfigId = $arrConfigSet[0]; -$myConfigClass->getConfigValues($intConfigId, 'method', $intMethod); +$strErrorMessage = ''; +$strInfoMessage = ''; +/* +Include preprocessing files +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Get configuration set ID +*/ +$intMethod = 0; +$strMethod = ''; +$myConfigClass->getConfigTargets($arrConfigSet); +$intConfigId = (int)$arrConfigSet[0]; +if ($myConfigClass->getConfigValues($intConfigId, 'method', $strMethod) === 0) { + $intMethod = (int)$strMethod; +} $myConfigClass->getConfigValues($intConfigId, 'basedir', $strBaseDir); $myConfigClass->getConfigValues($intConfigId, 'hostconfig', $strHostDir); $myConfigClass->getConfigValues($intConfigId, 'serviceconfig', $strServiceDir); -// -// Process form inputs -// =================== -/** @var array $chkMselValue1 */ -if (($chkMselValue1[0] != '') && ($chkStatus == 1)) { +/* +Process form inputs +*/ +if (isset($chkMselValue1[0]) && ($chkMselValue1[0] !== '') && ($chkStatus === 1)) { foreach ($chkMselValue1 as $elem) { $intCheck = $myConfigClass->removeFile(trim($elem), $intConfigId); $strFileTmp1 = str_replace($strServiceDir, '', $elem); $strFileTmp2 = str_replace($strHostDir, '', $strFileTmp1); - $strFile = str_replace($strBaseDir, '', $strFileTmp2); - if ($intCheck == 0) { - $myDataClass->writeLog(translate('File deleted'). ': ' .trim($strFile)); - $myVisClass->processMessage($strFile. ' ' .translate('successfully deleted'). '!', $strInfoMessage); + $strFile = str_replace($strBaseDir, '', $strFileTmp2); + if ($intCheck === 0) { + $myDataClass->writeLog(translate('File deleted') . ': ' . trim($strFile)); + $myVisClass->processMessage($strFile . ' ' . translate('successfully deleted') . '!', $strInfoMessage); } else { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } } } -// -// Include content -// =============== +/* +Include content +*/ $conttp->setVariable('TITLE', translate('Delete config files')); $conttp->parse('header'); $conttp->show('header'); @@ -75,95 +94,95 @@ $conttp->setVariable('LANG_REQUIRED', translate('required')); $conttp->setVariable('MAKE', translate('Delete')); $conttp->setVariable('ABORT', translate('Abort')); $conttp->setVariable('CTRL_INFO', translate('Hold CTRL to select
more than one entry')); -$conttp->setVariable('IMAGE_PATH', $_SESSION['SETS']['path']['base_url']. 'images/'); -$conttp->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -// Build a local file list -if ($intMethod == 1) { +$conttp->setVariable('IMAGE_PATH', $_SESSION['SETS']['path']['base_url'] . 'images/'); +$conttp->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF')); +/* Build a local file list */ +if ($intMethod === 1) { $output = array(); $myConfigClass->storeDirToArray($strBaseDir, "\.cfg", '\.cfg_old', $output, $strErrorMessage); - if (is_array($output) && (count($output) != 0)) { + if (is_array($output) && (count($output) !== 0)) { foreach ($output as $elem2) { - if (($chkTfSearch == '') || (substr_count($elem2, $chkTfSearch) != 0)) { + if (($chkTfSearch === '') || (substr_count($elem2, $chkTfSearch) !== 0)) { $conttp->setVariable('DAT_BACKUPFILE', $elem2); $conttp->parse('filelist'); } } } -} elseif ($intMethod == 2) { - // Open ftp connection - if ($myConfigClass->getFTPConnection($intConfigId) == '0') { - $arrFiles = array(); - $arrFiles1 = ftp_nlist($myConfigClass->resConnectId, $strBaseDir); +} elseif ($intMethod === 2) { + /* Open ftp connection */ + if ($myConfigClass->getFTPConnection($intConfigId) === 0) { + $arrFiles = array(); + $arrFiles1 = ftp_nlist($myConfigClass->conFTPConId, $strBaseDir); if (is_array($arrFiles1)) { $arrFiles = array_merge($arrFiles, $arrFiles1); } - $arrFiles2 = ftp_nlist($myConfigClass->resConnectId, $strHostDir); + $arrFiles2 = ftp_nlist($myConfigClass->conFTPConId, $strHostDir); if (is_array($arrFiles2)) { $arrFiles = array_merge($arrFiles, $arrFiles2); } - $arrFiles3 = ftp_nlist($myConfigClass->resConnectId, $strServiceDir); + $arrFiles3 = ftp_nlist($myConfigClass->conFTPConId, $strServiceDir); if (is_array($arrFiles3)) { $arrFiles = array_merge($arrFiles, $arrFiles3); } - if (is_array($arrFiles) && (count($arrFiles) != 0)) { + if (is_array($arrFiles) && (count($arrFiles) !== 0)) { foreach ($arrFiles as $elem) { if (!substr_count($elem, 'cfg')) { continue; } - if (($chkTfSearch == '') || (substr_count($elem, $chkTfSearch) != 0)) { + if (($chkTfSearch === '') || (substr_count($elem, $chkTfSearch) !== 0)) { $conttp->setVariable('DAT_BACKUPFILE', str_replace('//', '/', $elem)); $conttp->parse('filelist'); } } } - ftp_close($myConfigClass->resConnectId); + ftp_close($myConfigClass->conFTPConId); } else { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } -} elseif ($intMethod == 3) { - // Open ssh connection - if ($myConfigClass->getSSHConnection($intConfigId) == '0') { - $intReturn = $myConfigClass->sendSSHCommand('ls '.$strBaseDir, $arrFiles1); - if (($intReturn == 0) && is_array($arrFiles1) && (count($arrFiles1) != 0)) { +} elseif ($intMethod === 3) { + /* Open ssh connection */ + if ($myConfigClass->getSSHConnection($intConfigId) === 0) { + $intReturn = $myConfigClass->sendSSHCommand('ls ' . $strBaseDir, $arrFiles1); + if (($intReturn === 0) && is_array($arrFiles1) && (count($arrFiles1) !== 0)) { foreach ($arrFiles1 as $elem) { if (!substr_count($elem, 'cfg')) { continue; } - if (substr_count($elem, 'cgi.cfg') != 0) { + if (substr_count($elem, 'cgi.cfg') !== 0) { continue; } - if (substr_count($elem, 'nagios.cfg') != 0) { + if (substr_count($elem, 'nagios.cfg') !== 0) { continue; } - if (($chkTfSearch == '') || (substr_count($elem, $chkTfSearch) != 0)) { - $conttp->setVariable('DAT_BACKUPFILE', str_replace('//', '/', $strBaseDir. '/' .$elem)); - $conttp->setVariable('DAT_BACKUPFILE_FULL', str_replace('//', '/', $strBaseDir. '/' .$elem)); + if (($chkTfSearch === '') || (substr_count($elem, $chkTfSearch) !== 0)) { + $conttp->setVariable('DAT_BACKUPFILE', str_replace('//', '/', $strBaseDir . '/' . $elem)); + $conttp->setVariable('DAT_BACKUPFILE_FULL', str_replace('//', '/', $strBaseDir . '/' . $elem)); $conttp->parse('filelist'); } } } - $intReturn = $myConfigClass->sendSSHCommand('ls '.$strHostDir, $arrFiles2); - if (($intReturn == 0) && is_array($arrFiles2) && (count($arrFiles2) != 0)) { + $intReturn = $myConfigClass->sendSSHCommand('ls ' . $strHostDir, $arrFiles2); + if (($intReturn === 0) && is_array($arrFiles2) && (count($arrFiles2) !== 0)) { foreach ($arrFiles2 as $elem) { if (!substr_count($elem, 'cfg')) { continue; } - if (($chkTfSearch == '') || (substr_count($elem, $chkTfSearch) != 0)) { - $conttp->setVariable('DAT_BACKUPFILE', str_replace('//', '/', $strHostDir. '/' .$elem)); - $conttp->setVariable('DAT_BACKUPFILE_FULL', str_replace('//', '/', $strHostDir. '/' .$elem)); + if (($chkTfSearch === '') || (substr_count($elem, $chkTfSearch) !== 0)) { + $conttp->setVariable('DAT_BACKUPFILE', str_replace('//', '/', $strHostDir . '/' . $elem)); + $conttp->setVariable('DAT_BACKUPFILE_FULL', str_replace('//', '/', $strHostDir . '/' . $elem)); $conttp->parse('filelist'); } } } - $intReturn = $myConfigClass->sendSSHCommand('ls '.$strServiceDir, $arrFiles3); - if (($intReturn == 0) && is_array($arrFiles3) && (count($arrFiles3) != 0)) { + $intReturn = $myConfigClass->sendSSHCommand('ls ' . $strServiceDir, $arrFiles3); + if (($intReturn === 0) && is_array($arrFiles3) && (count($arrFiles3) !== 0)) { foreach ($arrFiles3 as $elem) { if (!substr_count($elem, 'cfg')) { continue; } - if (($chkTfSearch == '') || (substr_count($elem, $chkTfSearch) != 0)) { - $conttp->setVariable('DAT_BACKUPFILE', str_replace('//', '/', $strServiceDir. '/' .$elem)); - $conttp->setVariable('DAT_BACKUPFILE_FULL', str_replace('//', '/', $strServiceDir. '/' .$elem)); + if (($chkTfSearch === '') || (substr_count($elem, $chkTfSearch) !== 0)) { + $conttp->setVariable('DAT_BACKUPFILE', str_replace('//', '/', $strServiceDir . '/' . $elem)); + $conttp->setVariable('DAT_BACKUPFILE_FULL', str_replace('//', '/', $strServiceDir . '/' . $elem)); $conttp->parse('filelist'); } } @@ -172,20 +191,20 @@ if ($intMethod == 1) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } } -if ($strErrorMessage != '') { +if ($strErrorMessage !== '') { $conttp->setVariable('ERRORMESSAGE', $strErrorMessage); } $conttp->setVariable('INFOMESSAGE', $strInfoMessage); -// Check access rights for adding new objects -if ($myVisClass->checkAccountGroup($prePageKey, 'write') != 0) { +/* Check access rights for adding new objects */ +if ($myVisClass->checkAccountGroup($prePageKey, 'write') !== 0) { $conttp->setVariable('ADD_CONTROL', 'disabled="disabled"'); } $conttp->parse('main'); $conttp->show('main'); -// -// Footer ausgeben -// =============== +/* +Footer ausgeben +*/ $maintp->setVariable('VERSION_INFO', "NagiosQL $setFileVersion"); + . "target='_blank'>NagiosQL $setFileVersion"); $maintp->parse('footer'); -$maintp->show('footer'); +$maintp->show('footer'); \ No newline at end of file diff --git a/admin/download.php b/admin/download.php index 1677275..35b2774 100644 --- a/admin/download.php +++ b/admin/download.php @@ -1,61 +1,66 @@ array('default' => 0))); -// -// Header output -// =============== +/* +Include preprocessing file +*/ +$preNoMain = 1; +$preNoLogin = 1; +require $preBasePath . 'functions/prepend_adm.php'; +/* +Process post parameters +*/ +$chkTable = filter_input(INPUT_GET, 'table'); +$chkConfig = filter_input(INPUT_GET, 'config'); +$chkLine = filter_input(INPUT_GET, 'line', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); +/* +Header output +*/ $arrConfig = $myConfigClass->getConfData(); if (isset($arrConfig[$chkTable])) { $strFile = $arrConfig[$chkTable]['filename']; } else { - $strFile = $chkConfig. '.cfg'; + $strFile = $chkConfig . '.cfg'; } -if ($strFile == '.cfg') { +if ($strFile === '.cfg') { exit; } -header('Content-Disposition: attachment; filename=' .$strFile); +header('Content-Disposition: attachment; filename=' . $strFile); header('Content-Type: text/plain'); -// -// Get data -// ======== -if ($chkLine == 0) { +/* +Get data +*/ +if ($chkLine === 0) { $myConfigClass->createConfig($chkTable, 1); } else { $myConfigClass->createConfigSingle($chkTable, $chkLine, 1); } -$myDataClass->writeLog(translate('Download'). ' ' .$strFile); +$myDataClass->writeLog(translate('Download') . ' ' . $strFile); \ No newline at end of file diff --git a/admin/group.php b/admin/group.php index 14ecf77..7add477 100644 --- a/admin/group.php +++ b/admin/group.php @@ -1,109 +1,137 @@ Application version string + * @var int $chkActive from prepend_adm.php -> Active checkbox + * @var string $chkModus from prepend_adm.php -> Form work mode + * @var int $chkDataId from prepend_adm.php -> Actual dataset id + * @var int $chkListId from prepend_adm.php -> Actual dataset id (list view) + * @var string $chkSelModify from prepend_adm.php -> Modification selection value + * @var int $hidSortBy from prepend_adm.php -> Sort data by + * @var string $hidSortDir from prepend_adm.php -> Sort data direction (ASC, DESC) + * @var int $chkLimit from prepend_adm.php / settings -> Data set count per page + * @var array $SETS Settings array + * @var int $intWriteAccessId from prepend_content.php -> Admin write access to actual dataset id + * @var string $chkTfValue1 from prepend_content.php -> Group name + * @var string $chkTfValue2 from prepend_content.php -> Group description + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 33; -$preContent = 'admin/group.htm.tpl'; -$preListTpl = 'admin/datalist_common.htm.tpl'; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 33; +$preContent = 'admin/group.htm.tpl'; +$preListTpl = 'admin/datalist_common.htm.tpl'; $preSearchSession = 'group'; -$preTableName = 'tbl_group'; -$preKeyField = 'groupname'; -$preAccess = 1; -$preFieldvars = 1; -$preNoAccessGrp = 1; -$arrDataLines = array(); -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Add or modify data -// ================== -if (($chkModus == 'insert') || ($chkModus == 'modify')) { +$preTableName = 'tbl_group'; +$preKeyField = 'groupname'; +$preAccess = 1; +$preFieldvars = 1; +$preNoAccessGrp = 1; +$arrDataLines = array(); +$strErrorMessage = ''; +$strInfoMessage = ''; +$strConsistMessage = ''; +/* +Include preprocessing file +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Add or modify data +*/ +if (($chkModus === 'insert') || ($chkModus === 'modify')) { $strSQLx = "`$preTableName` SET `groupname`='$chkTfValue1', `description`='$chkTfValue2', `active`='$chkActive', " - . '`last_modified`=NOW()'; - if ($chkModus == 'insert') { - $strSQL = 'INSERT INTO ' .$strSQLx; + . '`last_modified`=NOW()'; + if ($chkModus === 'insert') { + $strSQL = 'INSERT INTO ' . $strSQLx; } else { - $strSQL = 'UPDATE ' .$strSQLx. ' WHERE `id`=' .$chkDataId; + $strSQL = 'UPDATE ' . $strSQLx . ' WHERE `id`=' . $chkDataId; } - if ($intWriteAccessId == 0) { - if (($chkTfValue1 != '') && ($chkTfValue2 != '')) { + if ($intWriteAccessId === 0) { + if (($chkTfValue1 !== '') && ($chkTfValue2 !== '')) { $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($chkModus == 'insert') { + if ($chkModus === 'insert') { $chkDataId = $intInsertId; } - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); - if ($chkModus == 'insert') { - $myDataClass->writeLog(translate('A new group added:'). ' ' .$chkTfValue1); + if ($chkModus === 'insert') { + $myDataClass->writeLog(translate('A new group added:') . ' ' . $chkTfValue1); } - if ($chkModus == 'modify') { - $myDataClass->writeLog(translate('User modified:'). ' ' .$chkTfValue1); + if ($chkModus === 'modify') { + $myDataClass->writeLog(translate('User modified:') . ' ' . $chkTfValue1); } - // - // Insert/update user/group data from session data - // =============================================== - if ($chkModus == 'modify') { - $strSQL = "DELETE FROM `tbl_lnkGroupToUser` WHERE `idMaster`=$chkDataId"; - $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn != 0) { + /* + Insert/update user/group data from session data + */ + if ($chkModus === 'modify') { + $strSQL = "DELETE FROM `tbl_lnkGroupToUser` WHERE `idMaster`=$chkDataId"; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } if (isset($_SESSION['groupuser']) && is_array($_SESSION['groupuser']) && - (count($_SESSION['groupuser']) != 0)) { + (count($_SESSION['groupuser']) !== 0)) { foreach ($_SESSION['groupuser'] as $elem) { - if ($elem['status'] == 0) { - $intRead = 0; + if ((int)$elem['status'] === 0) { + $intRead = 0; $intWrite = 0; - $intLink = 0; - if (substr_count($elem['rights'], 'READ') != 0) { - $intRead = 1; + $intLink = 0; + if (substr_count($elem['rights'], 'READ') !== 0) { + $intRead = 1; } - if (substr_count($elem['rights'], 'WRITE') != 0) { + if (substr_count($elem['rights'], 'WRITE') !== 0) { $intWrite = 1; } - if (substr_count($elem['rights'], 'LINK') != 0) { - $intLink = 1; + if (substr_count($elem['rights'], 'LINK') !== 0) { + $intLink = 1; } - if ($intWrite == 1) { + if ($intWrite === 1) { $intRead = 1; $intLink = 1; } - if ($intRead == 1) { + if ($intRead === 1) { $intLink = 1; } - // if ($intLink == 1) $intRead = 1; - $strSQL = 'INSERT INTO `tbl_lnkGroupToUser` (`idMaster`,`idSlave`,`read`,`write`,' - . "`link`) VALUES ($chkDataId,".$elem['user'].",'$intRead','$intWrite'," - . "'$intLink')"; + /* if ($intLink === 1) $intRead = 1; */ + $strSQL = 'INSERT INTO `tbl_lnkGroupToUser` (`idMaster`,`idSlave`,`read`,`write`,' + . "`link`) VALUES ($chkDataId," . $elem['user'] . ",'$intRead','$intWrite'," + . "'$intLink')"; $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } @@ -121,25 +149,26 @@ if (($chkModus == 'insert') || ($chkModus == 'modify')) { } $chkModus = 'display'; } -if ($chkModus != 'add') { - $chkModus = 'display'; +if ($chkModus !== 'add') { + $chkModus = 'display'; } -// -// Singe data form -// =============== -if ($chkModus == 'add') { - // Process data fields - $strSQL = 'SELECT * FROM `tbl_user` WHERE `id`<>1 ORDER BY `username`'; +/* +Singe data form +*/ +if ($chkModus === 'add') { + /* Process data fields */ + $strSQL = 'SELECT * FROM `tbl_user` WHERE `id`<>1 ORDER BY `username`'; $booReturn = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); - if ($booReturn && ($intDataCount != 0)) { + if ($booReturn && ($intDataCount !== 0)) { foreach ($arrDataLines as $elem) { $conttp->setVariable('DAT_USER_ID', $elem['id']); $conttp->setVariable('DAT_USER', $elem['username']); + /** @noinspection DisconnectedForeachInstructionInspection */ $conttp->parse('users'); } } - // Initial add/modify form definitions + /* Initial add/modify form definitions */ $myContentClass->addFormInit($conttp); $conttp->setVariable('TITLE', translate('Group administration')); $conttp->setVariable('LANG_READ', translate('Read')); @@ -148,32 +177,34 @@ if ($chkModus == 'add') { $conttp->setVariable('DAT_ID', $chkListId); $conttp->setVariable('FILL_ALLFIELDS', translate('Please fill in all fields marked with an *')); $conttp->setVariable('FILL_ILLEGALCHARS', translate('The following field contains illegal characters:')); - // Insert data from database in "modify" mode - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - // Process data + /* Insert data from database in "modify" mode */ + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + /* Process data */ $myContentClass->addInsertData($conttp, $arrModifyData, 0, ''); } $conttp->parse('datainsert'); $conttp->show('datainsert'); } -// -// List view -// ========== -if ($chkModus == 'display') { - // Initial list view definitions +/* +List view +*/ +if ($chkModus === 'display') { + /* Initial list view definitions */ $myContentClass->listViewInit($mastertp); $mastertp->setVariable('TITLE', translate('Group administration')); $mastertp->setVariable('FIELD_1', translate('Groupname')); $mastertp->setVariable('FIELD_2', translate('Description')); - // Row sorting + /* Row sorting */ $strOrderString = "ORDER BY `groupname` $hidSortDir"; - if ($hidSortBy == 2) { + if ($hidSortBy === 2) { $strOrderString = "ORDER BY `description` $hidSortDir"; } - // Count datasets - $strSQL = "SELECT count(*) AS `number` FROM `$preTableName`"; + /* Count datasets */ + $intLineCount = 0; + /** @noinspection SqlResolve */ + $strSQL = "SELECT count(*) AS `number` FROM `$preTableName`"; $booReturn1 = $myDBClass->hasSingleDataset($strSQL, $arrDataLinesCount); - if ($booReturn1 == false) { + if ($booReturn1 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { @@ -182,20 +213,20 @@ if ($chkModus == 'display') { $chkLimit = 0; } } - // Get datasets - $strSQL = 'SELECT `id`, `groupname`, `description`, `active` ' - . "FROM `$preTableName` $strOrderString LIMIT $chkLimit,".$SETS['common']['pagelines']; + /* Get datasets */ + $strSQL = 'SELECT `id`, `groupname`, `description`, `active` ' + . "FROM `$preTableName` $strOrderString LIMIT $chkLimit," . $SETS['common']['pagelines']; $booReturn2 = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - if ($booReturn2 == false) { + if ($booReturn2 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - // Process data + /* Process data */ $myContentClass->listData($mastertp, $arrDataLines, $intDataCount, $intLineCount, $preKeyField, 'description'); } -// Show messages +/* Show messages */ $myContentClass->showMessages($mastertp, $strErrorMessage, $strInfoMessage, $strConsistMessage, array(), '', 1); -// -// Process footer -// ============== -$myContentClass->showFooter($maintp, $setFileVersion); +/* +Process footer +*/ +$myContentClass->showFooter($maintp, $setFileVersion); \ No newline at end of file diff --git a/admin/groupusers.php b/admin/groupusers.php index a4896ad..7839bcd 100644 --- a/admin/groupusers.php +++ b/admin/groupusers.php @@ -1,112 +1,113 @@ Actual dataset id + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$preAccess = 1; -$preNoMain = 1; -require $preBasePath.'functions/prepend_adm.php'; -// -// Process get parameters -// ====================== -$chkDataId = filter_input(INPUT_GET, 'dataId', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$preAccess = 1; +$preNoMain = 1; +require $preBasePath . 'functions/prepend_adm.php'; +/* +Process get parameters +*/ +$chkDataId = filter_input(INPUT_GET, 'dataId', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); $chkVersion = filter_input(INPUT_GET, 'version', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); -$chkMode = filter_input(INPUT_GET, 'mode', FILTER_SANITIZE_STRING); -$chkUser = filter_input(INPUT_GET, 'user', FILTER_SANITIZE_STRING); -$chkRights = filter_input(INPUT_GET, 'rights', FILTER_SANITIZE_STRING); -$chkId = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING); -$chkLinkTab = filter_input(INPUT_GET, 'linktab', FILTER_SANITIZE_STRING); +$chkMode = (string)filter_input(INPUT_GET, 'mode'); +$chkUser = (string)filter_input(INPUT_GET, 'user'); +$chkRights = (string)filter_input(INPUT_GET, 'rights'); +$chkId = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT); +$chkLinkTab = (string)filter_input(INPUT_GET, 'linktab'); if (substr_count($chkRights, '-')) { $arrRights = explode('-', $chkRights); $strRights = ''; - if ($arrRights[0] == 1) { + if ((int)$arrRights[0] === 1) { $strRights .= 'READ,'; } - if ($arrRights[1] == 1) { + if ((int)$arrRights[1] === 1) { $strRights .= 'WRITE,'; } - if ($arrRights[2] == 1) { + if ((int)$arrRights[2] === 1) { $strRights .= 'LINK,'; } - if ($strRights != '') { + if ($strRights !== '') { $strRights = substr($strRights, 0, -1); } $chkRights = $strRights; } -if (get_magic_quotes_gpc() == 0) { - $chkUser = addslashes($chkUser); - $chkRights = addslashes($chkRights); -} -// -// Get datasets -// ============ -if ($chkLinkTab != '') { - $strSQL = 'SELECT * FROM `tbl_user` LEFT JOIN `' .$chkLinkTab. '` ON `id`=`idSlave` ' - . "WHERE `idMaster`=$chkDataId ORDER BY `username`"; +/* +Get datasets +*/ +if ($chkLinkTab !== '') { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `tbl_user` LEFT JOIN `' . $chkLinkTab . '` ON `id`=`idSlave` ' + . "WHERE `idMaster`=$chkDataId ORDER BY `username`"; $booReturn = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - // - // Write data to session - // ===================== - if ($chkMode == '') { + /* + Write data to session + */ + if (($chkMode === null) || ($chkMode === '')) { $_SESSION['groupuser'] = array(); - if ($intDataCount != 0) { + if ($intDataCount !== 0) { foreach ($arrDataLines as $elem) { - $arrTemp['id'] = $elem['id']; - $arrTemp['user'] = $elem['id']; + $arrTemp['id'] = (int)$elem['id']; + $arrTemp['user'] = (int)$elem['id']; $strRights = ''; - if ($elem['read'] == 1) { + if ((int)$elem['read'] === 1) { $strRights .= 'READ,'; } - if ($elem['write'] == 1) { + if ((int)$elem['write'] === 1) { $strRights .= 'WRITE,'; } - if ($elem['link'] == 1) { + if ((int)$elem['link'] === 1) { $strRights .= 'LINK,'; } - if ($strRights != '') { + if ($strRights !== '') { $strRights = substr($strRights, 0, -1); } - $arrTemp['rights'] = $strRights; - $arrTemp['status'] = 0; - $_SESSION['groupuser'][] = $arrTemp; + $arrTemp['rights'] = $strRights; + $arrTemp['status'] = 0; + $_SESSION['groupuser'][] = $arrTemp; } } } } -// -// Add mode -// ======== -if ($chkMode == 'add') { +/* +Add mode +*/ +if ($chkMode === 'add') { if (isset($_SESSION['groupuser']) && is_array($_SESSION['groupuser'])) { $intCheck = 0; foreach ($_SESSION['groupuser'] as $key => $elem) { - if (($elem['user'] == $chkUser) && ($elem['status'] == 0)) { + if (((int)$elem['user'] === (int)$chkUser) && ((int)$elem['status'] === 0)) { $_SESSION['groupuser'][$key]['user'] = $chkUser; $_SESSION['groupuser'][$key]['rights'] = $chkRights; $intCheck = 1; } } - if ($intCheck == 0) { + if ($intCheck === 0) { $arrTemp['id'] = 0; $arrTemp['user'] = $chkUser; $arrTemp['rights'] = $chkRights; @@ -122,63 +123,68 @@ if ($chkMode == 'add') { $_SESSION['groupuser'][] = $arrTemp; } } -// -// Deletion mode -// ============= -if ($chkMode == 'del' && isset($_SESSION['groupuser']) && is_array($_SESSION['groupuser'])) { +/* +Deletion mode +*/ +if ($chkMode === 'del' && isset($_SESSION['groupuser']) && is_array($_SESSION['groupuser'])) { foreach ($_SESSION['groupuser'] as $key => $elem) { - if (($elem['user'] == $chkUser) && ($elem['status'] == 0)) { + if (((int)$elem['user'] === (int)$chkUser) && ((int)$elem['status'] === 0)) { $_SESSION['groupuser'][$key]['status'] = 1; } } } ?> - - - - None - - - - - -getFieldData('SELECT `username` FROM `tbl_user` WHERE `id`=' .$elem['user']); ?> - - - - - -&mode=del&user=" + key; } + + //--> + + + +
<?php
-                    echo translate('Delete'); ?>
+ getFieldData('SELECT `username` FROM `tbl_user` WHERE `id`=' . $elem['user']); ?> + + + + + + + + + + + + - - - - - - -
<?php
+                                                                               echo translate('Delete'); ?>
  
  
- + ?> + + \ No newline at end of file diff --git a/admin/helpedit.php b/admin/helpedit.php index 40b7cc1..aa4e41c 100644 --- a/admin/helpedit.php +++ b/admin/helpedit.php @@ -1,88 +1,99 @@ Application version string + * @var string $prePageKey from prepend_adm.php -> Menu group id + * @var array $SETS Settings array + * @var string $chkTfValue1 from prepend_content.php -> (hidden) Stored key value 1 + * @var string $chkTfValue2 from prepend_content.php -> (hidden) Stored key value 2 + * @var string $chkTfValue3 from prepend_content.php -> (hidden) Stored Nagios version + * @var int $chkChbValue1 from prepend_content.php -> Load standard text + * @var string $chkTaFileTextRaw from prepend_content.php -> Help text area + * @var array $arrDescription from fieldvars.php -> Translated common strings + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 39; -$preContent = 'admin/helpedit.htm.tpl'; -$preAccess = 1; -$preFieldvars = 1; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 39; +$preContent = 'admin/helpedit.htm.tpl'; +$preAccess = 1; +$preFieldvars = 1; $setSaveLangId = 'private'; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Process post parameters -// ======================= +$strErrorMessage = ''; +$strInfoMessage = ''; +/* +Include preprocessing file +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Process post parameters +*/ $chkHidVersion = filter_input(INPUT_POST, 'hidVersion', 513, array('options' => array('default' => 'all'))); -$chkKey1 = filter_input(INPUT_POST, 'selInfoKey1', FILTER_SANITIZE_STRING); -$chkKey2 = filter_input(INPUT_POST, 'selInfoKey2', FILTER_SANITIZE_STRING); -$chkVersion = filter_input(INPUT_POST, 'selInfoVersion', FILTER_SANITIZE_STRING); -// -// Quote special characters -// ========================== -if (get_magic_quotes_gpc() == 0) { - $chkHidVersion = addslashes($chkHidVersion); - $chkKey1 = addslashes($chkKey1); - $chkKey2 = addslashes($chkKey2); - $chkVersion = addslashes($chkVersion); -} -// -// Security function for text fields -// ================================= +$chkKey1 = filter_input(INPUT_POST, 'selInfoKey1', FILTER_DEFAULT, array('options' => array('default' => ''))); +$chkKey2 = filter_input(INPUT_POST, 'selInfoKey2', FILTER_DEFAULT, array('options' => array('default' => ''))); +$chkVersion = filter_input(INPUT_POST, 'selInfoVersion', FILTER_DEFAULT, array('options' => array('default' => ''))); +/* +Security function for text fields +*/ $chkHidVersion = $myVisClass->tfSecure($chkHidVersion); -$chkKey1 = $myVisClass->tfSecure($chkKey1); -$chkKey2 = $myVisClass->tfSecure($chkKey2); -$chkVersion = $myVisClass->tfSecure($chkVersion); -// -// Add or modify data -// ================== -if (($chkTaFileTextRaw != '') && ($chkTfValue3 == '1')) { - $strSQL = "SELECT `infotext` FROM `tbl_info` WHERE `key1`='$chkTfValue1' AND `key2`='$chkTfValue2' " - . "AND `version`='$chkHidVersion' AND `language`='$setSaveLangId'"; +$chkKey1 = $myVisClass->tfSecure($chkKey1); +$chkKey2 = $myVisClass->tfSecure($chkKey2); +$chkVersion = $myVisClass->tfSecure($chkVersion); +/* +Add or modify data +*/ +if (($chkTaFileTextRaw !== '') && ($chkTfValue3 === '1')) { + $strSQL = "SELECT `infotext` FROM `tbl_info` WHERE `key1`='$chkTfValue1' AND `key2`='$chkTfValue2' " + . "AND `version`='$chkHidVersion' AND `language`='$setSaveLangId'"; $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($intDataCount == 0) { + if ($intDataCount === 0) { $strSQL = 'INSERT INTO `tbl_info` (`key1`,`key2`,`version`,`language`,`infotext`) ' - . "VALUES ('$chkTfValue1','$chkTfValue2','$chkHidVersion','$setSaveLangId','$chkTaFileTextRaw')"; + . "VALUES ('$chkTfValue1','$chkTfValue2','$chkHidVersion','$setSaveLangId','$chkTaFileTextRaw')"; } else { $strSQL = "UPDATE `tbl_info` SET `infotext` = '$chkTaFileTextRaw' WHERE `key1` = '$chkTfValue1' " - . "AND `key2` = '$chkTfValue2' AND `version` = '$chkHidVersion' AND `language` = '$setSaveLangId'"; + . "AND `key2` = '$chkTfValue2' AND `version` = '$chkHidVersion' AND `language` = '$setSaveLangId'"; } $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); } } -// -// Singe data form -// =============== +/* +Singe data form +*/ $conttp->setVariable('TITLE', translate('Help text editor')); -$conttp->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$conttp->setVariable('MAINSITE', $_SESSION['SETS']['path']['base_url']. 'admin.php'); +$conttp->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF')); +$conttp->setVariable('MAINSITE', $_SESSION['SETS']['path']['base_url'] . 'admin.php'); foreach ($arrDescription as $elem) { $conttp->setVariable($elem['name'], $elem['string']); } @@ -91,88 +102,91 @@ $conttp->setVariable('INFOKEY_2', translate('Sub key')); $conttp->setVariable('INFO_LANG', translate('Language')); $conttp->setVariable('INFO_VERSION', translate('Nagios version')); $conttp->setVariable('LOAD_DEFAULT', translate('Load default text')); -if ($chkChbValue1 == '1') { +if ($chkChbValue1 === 1) { $conttp->setVariable('DEFAULT_CHECKED', 'checked'); } -// -// Get Key -// ======= -$arrData = array(); -$strSQL = 'SELECT DISTINCT `key1` FROM `tbl_info` ORDER BY `key1`'; +/* +Get Key +*/ +$arrData = array(); +$strSQL = 'SELECT DISTINCT `key1` FROM `tbl_info` ORDER BY `key1`'; $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); -if ($intDataCount != 0) { +if ($intDataCount !== 0) { foreach ($arrData as $elem) { $conttp->setVariable('INFOKEY_1_VAL', $elem['key1']); - if ($chkKey1 == $elem['key1']) { + if ($chkKey1 === $elem['key1']) { $conttp->setVariable('INFOKEY_1_SEL', 'selected'); $conttp->setVariable('INFOKEY_1_SEL_VAL', $elem['key1']); } + /** @noinspection DisconnectedForeachInstructionInspection */ $conttp->parse('infokey1'); } } -if ($chkKey1 != '') { - $strSQL = "SELECT DISTINCT `key2` FROM `tbl_info` WHERE `key1` = '$chkKey1' ORDER BY `key1`"; +if ($chkKey1 !== '') { + $strSQL = "SELECT DISTINCT `key2` FROM `tbl_info` WHERE `key1` = '$chkKey1' ORDER BY `key1`"; $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($intDataCount != 0) { + if ($intDataCount !== 0) { foreach ($arrData as $elem) { $conttp->setVariable('INFOKEY_2_VAL', $elem['key2']); - if ($chkKey2 == $elem['key2']) { + if ($chkKey2 === $elem['key2']) { $conttp->setVariable('INFOKEY_2_SEL', 'selected'); $conttp->setVariable('INFOKEY_2_SEL_VAL', $elem['key2']); } + /** @noinspection DisconnectedForeachInstructionInspection */ $conttp->parse('infokey2'); } } } -if (($chkKey1 != '') && ($chkKey2 != '')) { - $strSQL = 'SELECT DISTINCT `version` FROM `tbl_info` ' - . "WHERE `key1` = '$chkKey1' AND `key2` = '$chkKey2' ORDER BY `version`"; +if (($chkKey1 !== '') && ($chkKey2 !== '')) { + $strSQL = 'SELECT DISTINCT `version` FROM `tbl_info` ' + . "WHERE `key1` = '$chkKey1' AND `key2` = '$chkKey2' ORDER BY `version`"; $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($intDataCount != 0) { - if (($intDataCount == 1) && ($chkVersion == '')) { + if ($intDataCount !== 0) { + if (($intDataCount === 1) && ($chkVersion === '')) { $chkVersion = $arrData[0]['version']; } foreach ($arrData as $elem) { $conttp->setVariable('INFOVERSION_2_VAL', $elem['version']); - if ($chkVersion == $elem['version']) { + if ($chkVersion === $elem['version']) { $conttp->setVariable('INFOVERSION_2_SEL', 'selected'); $conttp->setVariable('INFOVERSION_2_SEL_VAL', $elem['version']); } + /** @noinspection DisconnectedForeachInstructionInspection */ $conttp->parse('infoversion'); } } } -// -// Insert content -// ============== -if (($chkKey1 != '') && ($chkKey2 != '') && ($chkVersion != '')) { - $strSQL = "SELECT `infotext` FROM `tbl_info` WHERE `key1`='$chkKey1' AND `key2`='$chkKey2' " - . "AND `version`='$chkVersion' AND `language`='$setSaveLangId'"; +/* +Insert content +*/ +if (($chkKey1 !== '') && ($chkKey2 !== '') && ($chkVersion !== '')) { + $strSQL = "SELECT `infotext` FROM `tbl_info` WHERE `key1`='$chkKey1' AND `key2`='$chkKey2' " + . "AND `version`='$chkVersion' AND `language`='$setSaveLangId'"; $strContentDB = $myDBClass->getFieldData($strSQL); - if (($chkChbValue1 == 1) || ($strContentDB == '')) { - $strSQL = "SELECT `infotext` FROM `tbl_info` WHERE `key1`='$chkKey1' AND `key2`='$chkKey2' " - . "AND `version`='$chkVersion' AND `language`='default'"; + if (($chkChbValue1 === 1) || ($strContentDB === '')) { + $strSQL = "SELECT `infotext` FROM `tbl_info` WHERE `key1`='$chkKey1' AND `key2`='$chkKey2' " + . "AND `version`='$chkVersion' AND `language`='default'"; $strContentDB = $myDBClass->getFieldData($strSQL); } $conttp->setVariable('DAT_HELPTEXT', $strContentDB); } -// Messages -if ($strErrorMessage != '') { +/* Messages */ +if ($strErrorMessage !== '') { $conttp->setVariable('ERRORMESSAGE', $strErrorMessage); } -if ($strInfoMessage != '') { +if ($strInfoMessage !== '') { $conttp->setVariable('INFOMESSAGE', $strInfoMessage); } -// Check access rights for adding new objects -if ($myVisClass->checkAccountGroup($prePageKey, 'write') != 0) { +/* Check access rights for adding new objects */ +if ($myVisClass->checkAccountGroup($prePageKey, 'write') !== 0) { $conttp->setVariable('ADD_CONTROL', 'disabled="disabled"'); } $conttp->parse('helpedit'); $conttp->show('helpedit'); -// -// Process footer -// ============== +/* +Process footer +*/ $maintp->setVariable('VERSION_INFO', "NagiosQL $setFileVersion"); + . "target='_blank'>NagiosQL $setFileVersion"); $maintp->parse('footer'); -$maintp->show('footer'); +$maintp->show('footer'); \ No newline at end of file diff --git a/admin/hostdependencies.php b/admin/hostdependencies.php index 63d8df4..ec3c138 100644 --- a/admin/hostdependencies.php +++ b/admin/hostdependencies.php @@ -1,123 +1,197 @@ Application version string + * @var string $chkModus from prepend_adm.php -> Form work mode + * @var int $chkDataId from prepend_adm.php -> Actual dataset id + * @var string $chkSelModify from prepend_adm.php -> Modification selection value + * @var int $hidSortBy from prepend_adm.php -> Sort data by + * @var string $hidSortDir from prepend_adm.php -> Sort data direction (ASC, DESC) + * @var int $chkLimit from prepend_adm.php / settings -> Data set count per page + * @var array $SETS Settings array + * @var int $intGlobalWriteAccess from prepend_content.php -> Global admin write access + * @var int $intWriteAccessId from prepend_content.php -> Admin write access to actual dataset id + * @var string $strAccess from prepend_content.php -> List of read access group id's for actual user + * @var string $preSQLCommon1 from prepend_content.php -> Common SQL part 1 + * @var string $strSearchWhere from prepend_content.php -> SQL WHERE addon for data search + * @var string $strDomainWhere from prepend_adm.php -> Domain selection SQL part with table name + * @var string $chkTfValue1 from prepend_content.php -> Configuration name + * @var int $chkSelValue1 from prepend_content.php -> Dependency period + * @var array $chkMselValue1 from prepend_content.php -> Dependent hosts + * @var array $chkMselValue2 from prepend_content.php -> Hosts + * @var array $chkMselValue3 from prepend_content.php -> Dependent hostgroups + * @var array $chkMselValue4 from prepend_content.php -> Hostgroups + * @var int $intMselValue1 from prepend_content.php -> Dependent hosts multiselect status value + * @var int $intMselValue2 from prepend_content.php -> Hosts multiselect status value + * @var int $intMselValue3 from prepend_content.php -> Dependent hostgroups multiselect status value + * @var int $intMselValue4 from prepend_content.php -> Hostgroups multiselect status value + * @var string $chkChbGr1a from prepend_content.php -> Execution failure criteria (o) + * @var string $chkChbGr1b from prepend_content.php -> Execution failure criteria (d) + * @var string $chkChbGr1c from prepend_content.php -> Execution failure criteria (u) + * @var string $chkChbGr1d from prepend_content.php -> Execution failure criteria (p) + * @var string $chkChbGr1e from prepend_content.php -> Execution failure criteria (n) + * @var string $chkChbGr2a from prepend_content.php -> Notification failure criteria (o) + * @var string $chkChbGr2b from prepend_content.php -> Notification failure criteria (d) + * @var string $chkChbGr2c from prepend_content.php -> Notification failure criteria (u) + * @var string $chkChbGr2d from prepend_content.php -> Notification failure criteria (p) + * @var string $chkChbGr2e from prepend_content.php -> Notification failure criteria (n) + * @var int $chkChbValue1 from prepend_content.php -> Inherit parents + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 19; -$preContent = 'admin/hostdependencies.htm.tpl'; -$preListTpl = 'admin/datalist.htm.tpl'; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 19; +$preContent = 'admin/hostdependencies.htm.tpl'; +$preListTpl = 'admin/datalist.htm.tpl'; $preSearchSession = 'hostdependencies'; -$preTableName = 'tbl_hostdependency'; -$preKeyField = 'config_name'; -$preAccess = 1; -$preFieldvars = 1; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Data processing -// =============== -$strEO = substr($chkChbGr1a.$chkChbGr1b.$chkChbGr1c.$chkChbGr1d.$chkChbGr1e, 0, -1); -$strNO = substr($chkChbGr2a.$chkChbGr2b.$chkChbGr2c.$chkChbGr2d.$chkChbGr2e, 0, -1); -// -// Add or modify data -// ================== -if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAccess == 0)) { +$preTableName = 'tbl_hostdependency'; +$preKeyField = 'config_name'; +$preAccess = 1; +$preFieldvars = 1; +$strErrorMessage = ''; +$strInfoMessage = ''; +$strConsistMessage = ''; +$strDBWarning = ''; +$intDataWarning = 0; +$intRet1 = 0; +$intRet2 = 0; +$intRet3 = 0; +$intRet4 = 0; +$intNoTime = 0; +/* +Default values for form variables +*/ +if (!isset($intMselValue1)) { + $intMselValue1 = 0; +} +if (!isset($intMselValue2)) { + $intMselValue2 = 0; +} +if (!isset($intMselValue3)) { + $intMselValue3 = 0; +} +if (!isset($intMselValue4)) { + $intMselValue4 = 0; +} +/* +Include preprocessing files +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Data processing +*/ +$strEO = substr($chkChbGr1a . $chkChbGr1b . $chkChbGr1c . $chkChbGr1d . $chkChbGr1e, 0, -1); +$strNO = substr($chkChbGr2a . $chkChbGr2b . $chkChbGr2c . $chkChbGr2d . $chkChbGr2e, 0, -1); +/* +Add or modify data +*/ +if ((($chkModus === 'insert') || ($chkModus === 'modify')) && ($intGlobalWriteAccess === 0)) { $strSQLx = "`$preTableName` SET `$preKeyField`='$chkTfValue1', `dependent_host_name`=$intMselValue1, " . "`host_name`=$intMselValue2, `dependent_hostgroup_name`=$intMselValue3, `hostgroup_name`=$intMselValue4, " . "`inherits_parent`='$chkChbValue1', `execution_failure_criteria`='$strEO', " . "`notification_failure_criteria`='$strNO', `dependency_period`=$chkSelValue1, $preSQLCommon1"; - if ($chkModus == 'insert') { - $strSQL = 'INSERT INTO ' .$strSQLx; + if ($chkModus === 'insert') { + $strSQL = 'INSERT INTO ' . $strSQLx; } else { - $strSQL = 'UPDATE ' .$strSQLx. ' WHERE `id`=' .$chkDataId; + $strSQL = 'UPDATE ' . $strSQLx . ' WHERE `id`=' . $chkDataId; } - if ($intWriteAccessId == 0) { - if ((($intMselValue1 != 0) && ($intMselValue2 != 0)) || (($intMselValue3 != 0) && ($intMselValue4 != 0)) || - (($intMselValue1 != 0) && ($intMselValue4 != 0)) || (($intMselValue3 != 0) && ($intMselValue2 != 0))) { + if ($intWriteAccessId === 0) { + if ((($intMselValue1 !== 0) && ($intMselValue2 !== 0)) || (($intMselValue3 !== 0) && ($intMselValue4 !== 0)) || + (($intMselValue1 !== 0) && ($intMselValue4 !== 0)) || (($intMselValue3 !== 0) && ($intMselValue2 !== 0))) { $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($chkModus == 'insert') { + if ($chkModus === 'insert') { $chkDataId = $intInsertId; } - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); $myDataClass->updateStatusTable($preTableName); - if ($chkModus == 'insert') { - $myDataClass->writeLog(translate('New host dependency inserted:'). ' ' .$chkTfValue1); + if ($chkModus === 'insert') { + $myDataClass->writeLog(translate('New host dependency inserted:') . ' ' . $chkTfValue1); } - if ($chkModus == 'modify') { - $myDataClass->writeLog(translate('Host dependency modified:'). ' ' .$chkTfValue1); + if ($chkModus === 'modify') { + $myDataClass->writeLog(translate('Host dependency modified:') . ' ' . $chkTfValue1); } - // - // Insert/update relations - // ======================= - if ($chkModus == 'insert') { - if ($intMselValue1 != 0) { + /* + Insert/update relations + */ + if ($chkModus === 'insert') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataInsertRelation( 'tbl_lnkHostdependencyToHost_DH', $chkDataId, $chkMselValue1 ); } - if (isset($intRet1) && ($intRet1 != 0)) { + if (isset($intRet1) && ($intRet1 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataInsertRelation( 'tbl_lnkHostdependencyToHost_H', $chkDataId, $chkMselValue2 ); } - if (isset($intRet2) && ($intRet2 != 0)) { + if (isset($intRet2) && ($intRet2 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue3 != 0) { + if ($intMselValue3 !== 0) { $intRet3 = $myDataClass->dataInsertRelation( 'tbl_lnkHostdependencyToHostgroup_DH', $chkDataId, $chkMselValue3 ); } - if (isset($intRet3) && ($intRet3 != 0)) { + if (isset($intRet3) && ($intRet3 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue4 != 0) { + if ($intMselValue4 !== 0) { $intRet4 = $myDataClass->dataInsertRelation( 'tbl_lnkHostdependencyToHostgroup_H', $chkDataId, $chkMselValue4 ); } - if (isset($intRet4) && ($intRet4 != 0)) { + if (isset($intRet4) && ($intRet4 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - } elseif ($chkModus == 'modify') { - if ($intMselValue1 != 0) { + } elseif ($chkModus === 'modify') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataUpdateRelation( 'tbl_lnkHostdependencyToHost_DH', $chkDataId, @@ -126,10 +200,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet1 = $myDataClass->dataDeleteRelation('tbl_lnkHostdependencyToHost_DH', $chkDataId); } - if ($intRet1 != 0) { + if ($intRet1 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataUpdateRelation( 'tbl_lnkHostdependencyToHost_H', $chkDataId, @@ -138,10 +212,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet2 = $myDataClass->dataDeleteRelation('tbl_lnkHostdependencyToHost_H', $chkDataId); } - if ($intRet2 != 0) { + if ($intRet2 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue3 != 0) { + if ($intMselValue3 !== 0) { $intRet3 = $myDataClass->dataUpdateRelation( 'tbl_lnkHostdependencyToHostgroup_DH', $chkDataId, @@ -150,10 +224,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet3 = $myDataClass->dataDeleteRelation('tbl_lnkHostdependencyToHostgroup_DH', $chkDataId); } - if ($intRet3 != 0) { + if ($intRet3 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue4 != 0) { + if ($intMselValue4 !== 0) { $intRet4 = $myDataClass->dataUpdateRelation( 'tbl_lnkHostdependencyToHostgroup_H', $chkDataId, @@ -162,18 +236,18 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet4 = $myDataClass->dataDeleteRelation('tbl_lnkHostdependencyToHostgroup_H', $chkDataId); } - if ($intRet4 != 0) { + if ($intRet4 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } - if (($intRet1 + $intRet2 + $intRet3 + $intRet4) != 0) { + if (($intRet1 + $intRet2 + $intRet3 + $intRet4) !== 0) { $strInfoMessage = ''; } - // - // Update Import HASH - // ================== + /* + Update Import HASH + */ $booReturn = $myDataClass->updateHash($preTableName, $chkDataId); - if ($booReturn != 0) { + if ($booReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } @@ -188,29 +262,25 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } $chkModus = 'display'; } -if ($chkModus != 'add') { - $chkModus = 'display'; +if ($chkModus !== 'add') { + $chkModus = 'display'; } -// -// Get date/time of last database and config file manipulation -// =========================================================== +/* +Get date/time of last database and config file manipulation +*/ $intReturn = $myConfigClass->lastModifiedFile($preTableName, $arrTimeData, $strTimeInfoString); -if ($intReturn != 0) { +if ($intReturn !== 0) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } -// -// Singe data form -// =============== -if ($chkModus == 'add') { +/* +Singe data form +*/ +if ($chkModus === 'add') { $conttp->setVariable('TITLE', translate('Define host dependencies (hostdependencies.cfg)')); - // Do not show modified time list + /* Do not show modified time list */ $intNoTime = 1; - // Process host selection field - if (isset($arrModifyData['dependent_host_name'])) { - $intFieldId = $arrModifyData['dependent_host_name']; - } else { - $intFieldId = 0; - } + /* Process host selection field */ + $intFieldId = $arrModifyData['dependent_host_name'] ?? 0; $intReturn = $myVisClass->parseSelectMulti( 'tbl_host', 'host_name', @@ -219,14 +289,10 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['host_name'])) { - $intFieldId = $arrModifyData['host_name']; - } else { - $intFieldId = 0; - } + $intFieldId = $arrModifyData['host_name'] ?? 0; $intReturn1 = $myVisClass->parseSelectMulti( 'tbl_host', 'host_name', @@ -235,25 +301,17 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process time period selection field - if (isset($arrModifyData['dependency_period'])) { - $intFieldId = $arrModifyData['dependency_period']; - } else { - $intFieldId = 0; - } + /* Process time period selection field */ + $intFieldId = $arrModifyData['dependency_period'] ?? 0; $intReturn = $myVisClass->parseSelectSimple('tbl_timeperiod', 'timeperiod_name', 'timeperiod', 1, $intFieldId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process host group selection field - if (isset($arrModifyData['dependent_hostgroup_name'])) { - $intFieldId = $arrModifyData['dependent_hostgroup_name']; - } else { - $intFieldId = 0; - } + /* Process host group selection field */ + $intFieldId = $arrModifyData['dependent_hostgroup_name'] ?? 0; $intReturn = $myVisClass->parseSelectMulti( 'tbl_hostgroup', 'hostgroup_name', @@ -262,14 +320,10 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['hostgroup_name'])) { - $intFieldId = $arrModifyData['hostgroup_name']; - } else { - $intFieldId = 0; - } + $intFieldId = $arrModifyData['hostgroup_name'] ?? 0; $intReturn2 = $myVisClass->parseSelectMulti( 'tbl_hostgroup', 'hostgroup_name', @@ -278,77 +332,76 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (($intReturn1 != 0) && ($intReturn2 != 0)) { + if (($intReturn1 !== 0) && ($intReturn2 !== 0)) { $myVisClass->processMessage(translate('Attention, no hosts and hostgroups defined!'), $strDBWarning); $intDataWarning = 1; } - // Process access group selection field - if (isset($arrModifyData['access_group'])) { - $intFieldId = $arrModifyData['access_group']; - } else { - $intFieldId = 0; - } + /* Process access group selection field */ + $intFieldId = $arrModifyData['access_group'] ?? 0; $intReturn = $myVisClass->parseSelectSimple('tbl_group', 'groupname', 'acc_group', 0, $intFieldId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Initial add/modify form definitions + /* Initial add/modify form definitions */ $myContentClass->addFormInit($conttp); - if ($intDataWarning == 1) { - $conttp->setVariable('WARNING', $strDBWarning. '
' .translate('Saving not possible!')); + if ($intDataWarning === 1) { + $conttp->setVariable('WARNING', $strDBWarning . '
' . translate('Saving not possible!')); } - // Insert data from database in "modify" mode - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - // Check relation information to find out locked configuration datasets + /* Insert data from database in "modify" mode */ + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + /* Check relation information to find out locked configuration datasets */ $intLocked = $myDataClass->infoRelation($preTableName, $arrModifyData['id'], $preKeyField); $myVisClass->processMessage($myDataClass->strInfoMessage, $strRelMessage); - $strInfo = '
' .translate('Entry cannot be activated because it is used by ' - . 'another configuration'). ':'; - $strInfo .= '
' .$strRelMessage. ''; - // Process data + $strInfo = '
' . translate('Entry cannot be activated because it is used by ' + . 'another configuration') . ':'; + $strInfo .= '
' . $strRelMessage . ''; + /* Process data */ $myContentClass->addInsertData($conttp, $arrModifyData, $intLocked, $strInfo); - if ($arrModifyData['inherits_parent'] == 1) { + if ((int)$arrModifyData['inherits_parent'] === 1) { $conttp->setVariable('ACT_INHERIT', 'checked'); } foreach (explode(',', $arrModifyData['execution_failure_criteria']) as $elem) { - $conttp->setVariable('DAT_EO' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_EO' . strtoupper($elem) . '_CHECKED', 'checked'); } foreach (explode(',', $arrModifyData['notification_failure_criteria']) as $elem) { - $conttp->setVariable('DAT_NO' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_NO' . strtoupper($elem) . '_CHECKED', 'checked'); } } $conttp->parse('datainsert'); $conttp->show('datainsert'); } -// -// List view -// ========== -if ($chkModus == 'display') { - // Initial list view definitions +/* +List view +*/ +if ($chkModus === 'display') { + /* Initial list view definitions */ $myContentClass->listViewInit($mastertp); $mastertp->setVariable('TITLE', translate('Define host dependencies (hostdependencies.cfg)')); $mastertp->setVariable('FIELD_1', translate('Config name')); - $mastertp->setVariable('FIELD_2', translate('Dependent hosts'). ' / ' .translate('Dependent hostgroups')); + $mastertp->setVariable('FIELD_2', translate('Dependent hosts') . ' / ' . translate('Dependent hostgroups')); $mastertp->setVariable('DISABLE_SORT_2', 'disable'); - // Process search string - if ($_SESSION['search'][$preSearchSession] != '') { - $strSearchTxt = $_SESSION['search'][$preSearchSession]; - $strSearchWhere = "AND (`$preKeyField` LIKE '%".$strSearchTxt."%')"; + $mastertp->setVariable('FILTER_VISIBLE', 'visibility: hidden'); + /* Process search string */ + if ($_SESSION['search'][$preSearchSession] !== '') { + $strSearchTxt = $_SESSION['search'][$preSearchSession]; + $strSearchWhere = "AND (`$preKeyField` LIKE '%" . $strSearchTxt . "%')"; } - // Row sorting + /* Row sorting */ $strOrderString = "ORDER BY `config_id`, `$preKeyField` $hidSortDir"; - if ($hidSortBy == 2) { + if ($hidSortBy === 2) { $strOrderString = "ORDER BY `config_id`, `$preKeyField` $hidSortDir"; } $mastertp->setVariable('DISABLE_SORT_2', 'disable'); - // Count datasets - $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` " + /* Count datasets */ + $intLineCount = 0; + /** @noinspection SqlResolve */ + $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` " . "WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess)"; $booReturn = $myDBClass->hasSingleDataset($strSQL, $arrDataLinesCount); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { @@ -357,16 +410,16 @@ if ($chkModus == 'display') { $chkLimit = 0; } } - // Get datasets - $strSQL = "SELECT `id`, `$preKeyField`, `dependent_host_name`, `dependent_hostgroup_name`, `register`, " + /* Get datasets */ + $strSQL = "SELECT `id`, `$preKeyField`, `dependent_host_name`, `dependent_hostgroup_name`, `register`, " . "`active`, `config_id`, `access_group` FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND " - . "`access_group` IN ($strAccess) $strOrderString LIMIT $chkLimit,".$SETS['common']['pagelines']; + . "`access_group` IN ($strAccess) $strOrderString LIMIT $chkLimit," . $SETS['common']['pagelines']; $booReturn = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - // Process data + /* Process data */ $myContentClass->listData( $mastertp, $arrDataLines, @@ -377,7 +430,7 @@ if ($chkModus == 'display') { 40 ); } -// Show messages +/* Show messages */ $myContentClass->showMessages( $mastertp, $strErrorMessage, @@ -387,7 +440,7 @@ $myContentClass->showMessages( $strTimeInfoString, $intNoTime ); -// -// Process footer -// ============== -$myContentClass->showFooter($maintp, $setFileVersion); +/* +Process footer +*/ +$myContentClass->showFooter($maintp, $setFileVersion); \ No newline at end of file diff --git a/admin/hostescalations.php b/admin/hostescalations.php index 1b2d063..93816cb 100644 --- a/admin/hostescalations.php +++ b/admin/hostescalations.php @@ -1,123 +1,192 @@ Application version string + * @var string $chkModus from prepend_adm.php -> Form work mode + * @var int $chkDataId from prepend_adm.php -> Actual dataset id + * @var string $chkSelModify from prepend_adm.php -> Modification selection value + * @var int $hidSortBy from prepend_adm.php -> Sort data by + * @var string $hidSortDir from prepend_adm.php -> Sort data direction (ASC, DESC) + * @var int $chkLimit from prepend_adm.php / settings -> Data set count per page + * @var array $SETS Settings array + * @var int $intGlobalWriteAccess from prepend_content.php -> Global admin write access + * @var int $intWriteAccessId from prepend_content.php -> Admin write access to actual dataset id + * @var string $strAccess from prepend_content.php -> List of read access group id's for actual user + * @var string $preSQLCommon1 from prepend_content.php -> Common SQL part 1 + * @var string $strSearchWhere from prepend_content.php -> SQL WHERE addon for data search + * @var string $strDomainWhere from prepend_adm.php -> Domain selection SQL part with table name + * @var string $chkTfValue1 from prepend_content.php -> Configuration name + * @var int $chkSelValue1 from prepend_content.php -> Escalation period + * @var array $chkMselValue1 from prepend_content.php -> Contacts + * @var array $chkMselValue2 from prepend_content.php -> Contact groups + * @var array $chkMselValue3 from prepend_content.php -> Hosts + * @var array $chkMselValue4 from prepend_content.php -> Hostgroups + * @var int $intMselValue1 from prepend_content.php -> Contacts multiselect status value + * @var int $intMselValue2 from prepend_content.php -> Contact groups multiselect status value + * @var int $intMselValue3 from prepend_content.php -> Hosts multiselect status value + * @var int $intMselValue4 from prepend_content.php -> Hostgroups multiselect status value + * @var string $chkChbGr1a from prepend_content.php -> Escalation options (d) + * @var string $chkChbGr1b from prepend_content.php -> Escalation options (u) + * @var string $chkChbGr1c from prepend_content.php -> Escalation options (r) + * @var string $chkTfNullVal1 from prepend_content.php -> First notification + * @var string $chkTfNullVal2 from prepend_content.php -> Last notification + * @var string $chkTfNullVal3 from prepend_content.php -> Notification interval + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 20; -$preContent = 'admin/hostescalations.htm.tpl'; -$preListTpl = 'admin/datalist.htm.tpl'; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 20; +$preContent = 'admin/hostescalations.htm.tpl'; +$preListTpl = 'admin/datalist.htm.tpl'; $preSearchSession = 'hostescalation'; -$preTableName = 'tbl_hostescalation'; -$preKeyField = 'config_name'; -$preAccess = 1; -$preFieldvars = 1; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Data processing -// =============== -$strEO = substr($chkChbGr1a.$chkChbGr1b.$chkChbGr1c, 0, -1); -// -// Add or modify data -// ================== -if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAccess == 0)) { +$preTableName = 'tbl_hostescalation'; +$preKeyField = 'config_name'; +$preAccess = 1; +$preFieldvars = 1; +$strErrorMessage = ''; +$strInfoMessage = ''; +$strConsistMessage = ''; +$strDBWarning = ''; +$intDataWarning = 0; +$intRet1 = 0; +$intRet2 = 0; +$intRet3 = 0; +$intRet4 = 0; +$intNoTime = 0; +/* +Default values for form variables +*/ +if (!isset($intMselValue1)) { + $intMselValue1 = 0; +} +if (!isset($intMselValue2)) { + $intMselValue2 = 0; +} +if (!isset($intMselValue3)) { + $intMselValue3 = 0; +} +if (!isset($intMselValue4)) { + $intMselValue4 = 0; +} +/* +Include preprocessing files +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Data processing +*/ +$strEO = substr($chkChbGr1a . $chkChbGr1b . $chkChbGr1c, 0, -1); +/* +Add or modify data +*/ +if ((($chkModus === 'insert') || ($chkModus === 'modify')) && ($intGlobalWriteAccess === 0)) { $strSQLx = "`$preTableName` SET `$preKeyField`='$chkTfValue1', `host_name`=$intMselValue3, " . "`hostgroup_name`=$intMselValue4, `contacts`=$intMselValue1, `contact_groups`=$intMselValue2, " . "`first_notification`=$chkTfNullVal1, `last_notification`=$chkTfNullVal2, " . "`notification_interval`=$chkTfNullVal3, `escalation_period`='$chkSelValue1', " . "`escalation_options`='$strEO', $preSQLCommon1"; - if ($chkModus == 'insert') { - $strSQL = 'INSERT INTO ' .$strSQLx; + if ($chkModus === 'insert') { + $strSQL = 'INSERT INTO ' . $strSQLx; } else { - $strSQL = 'UPDATE ' .$strSQLx. ' WHERE `id`=' .$chkDataId; + $strSQL = 'UPDATE ' . $strSQLx . ' WHERE `id`=' . $chkDataId; } - if ($intWriteAccessId == 0) { - if ((($intMselValue3 != 0) || ($chkMselValue4 != 0)) && (($intMselValue1 != 0) || ($intMselValue2 != 0)) && - ($chkTfNullVal1 != 'NULL') && ($chkTfNullVal2 != 'NULL') && ($chkTfNullVal3 != 'NULL')) { + if ($intWriteAccessId === 0) { + if ((($intMselValue3 !== 0) || ($chkMselValue4 !== 0)) && (($intMselValue1 !== 0) || ($intMselValue2 !== 0)) && + ($chkTfNullVal1 !== 'NULL') && ($chkTfNullVal2 !== 'NULL') && ($chkTfNullVal3 !== 'NULL')) { $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($chkModus == 'insert') { + if ($chkModus === 'insert') { $chkDataId = $intInsertId; } - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); $myDataClass->updateStatusTable($preTableName); - if ($chkModus == 'insert') { - $myDataClass->writeLog(translate('New host escalation inserted:'). ' ' .$chkTfValue1); + if ($chkModus === 'insert') { + $myDataClass->writeLog(translate('New host escalation inserted:') . ' ' . $chkTfValue1); } - if ($chkModus == 'modify') { - $myDataClass->writeLog(translate('Host escalation modified:'). ' ' .$chkTfValue1); + if ($chkModus === 'modify') { + $myDataClass->writeLog(translate('Host escalation modified:') . ' ' . $chkTfValue1); } - // - // Insert/update relations - // ======================= - if ($chkModus == 'insert') { - if ($intMselValue1 != 0) { + /* + Insert/update relations + */ + if ($chkModus === 'insert') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataInsertRelation( 'tbl_lnkHostescalationToContact', $chkDataId, $chkMselValue1 ); } - if (isset($intRet1) && ($intRet1 != 0)) { + if (isset($intRet1) && ($intRet1 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataInsertRelation( 'tbl_lnkHostescalationToContactgroup', $chkDataId, $chkMselValue2 ); } - if (isset($intRet2) && ($intRet2 != 0)) { + if (isset($intRet2) && ($intRet2 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue3 != 0) { + if ($intMselValue3 !== 0) { $intRet3 = $myDataClass->dataInsertRelation( 'tbl_lnkHostescalationToHost', $chkDataId, $chkMselValue3 ); } - if (isset($intRet3) && ($intRet3 != 0)) { + if (isset($intRet3) && ($intRet3 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue4 != 0) { + if ($intMselValue4 !== 0) { $intRet4 = $myDataClass->dataInsertRelation( 'tbl_lnkHostescalationToHostgroup', $chkDataId, $chkMselValue4 ); } - if (isset($intRet4) && ($intRet4 != 0)) { + if (isset($intRet4) && ($intRet4 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - } elseif ($chkModus == 'modify') { - if ($intMselValue1 != 0) { + } elseif ($chkModus === 'modify') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataUpdateRelation( 'tbl_lnkHostescalationToContact', $chkDataId, @@ -126,10 +195,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet1 = $myDataClass->dataDeleteRelation('tbl_lnkHostescalationToContact', $chkDataId); } - if ($intRet1 != 0) { + if ($intRet1 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataUpdateRelation( 'tbl_lnkHostescalationToContactgroup', $chkDataId, @@ -138,10 +207,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet2 = $myDataClass->dataDeleteRelation('tbl_lnkHostescalationToContactgroup', $chkDataId); } - if ($intRet2 != 0) { + if ($intRet2 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue3 != 0) { + if ($intMselValue3 !== 0) { $intRet3 = $myDataClass->dataUpdateRelation( 'tbl_lnkHostescalationToHost', $chkDataId, @@ -150,10 +219,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet3 = $myDataClass->dataDeleteRelation('tbl_lnkHostescalationToHost', $chkDataId); } - if ($intRet3 != 0) { + if ($intRet3 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue4 != 0) { + if ($intMselValue4 !== 0) { $intRet4 = $myDataClass->dataUpdateRelation( 'tbl_lnkHostescalationToHostgroup', $chkDataId, @@ -162,18 +231,18 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet4 = $myDataClass->dataDeleteRelation('tbl_lnkHostescalationToHostgroup', $chkDataId); } - if ($intRet4 != 0) { + if ($intRet4 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } - if (($intRet1 + $intRet2 + $intRet3 + $intRet4) != 0) { + if (($intRet1 + $intRet2 + $intRet3 + $intRet4) !== 0) { $strInfoMessage = ''; } - // - // Update Import HASH - // ================== + /* + Update Import HASH + */ $booReturn = $myDataClass->updateHash($preTableName, $chkDataId); - if ($booReturn != 0) { + if ($booReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } @@ -188,29 +257,25 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } $chkModus = 'display'; } -if ($chkModus != 'add') { - $chkModus = 'display'; +if ($chkModus !== 'add') { + $chkModus = 'display'; } -// -// Get date/time of last database and config file manipulation -// =========================================================== +/* +Get date/time of last database and config file manipulation +*/ $intReturn = $myConfigClass->lastModifiedFile($preTableName, $arrTimeData, $strTimeInfoString); -if ($intReturn != 0) { +if ($intReturn !== 0) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } -// -// Singe data form -// =============== -if ($chkModus == 'add') { +/* +Singe data form +*/ +if ($chkModus === 'add') { $conttp->setVariable('TITLE', translate('Define host escalation (hostescalations.cfg)')); - // Do not show modified time list + /* Do not show modified time list */ $intNoTime = 1; - // Process host and host group selection field - if (isset($arrModifyData['host_name'])) { - $intFieldId = $arrModifyData['host_name']; - } else { - $intFieldId = 0; - } + /* Process host and host group selection field */ + $intFieldId = $arrModifyData['host_name'] ?? 0; $intReturn1 = $myVisClass->parseSelectMulti( 'tbl_host', 'host_name', @@ -219,14 +284,10 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['hostgroup_name'])) { - $intFieldId = $arrModifyData['hostgroup_name']; - } else { - $intFieldId = 0; - } + $intFieldId = $arrModifyData['hostgroup_name'] ?? 0; $intReturn2 = $myVisClass->parseSelectMulti( 'tbl_hostgroup', 'hostgroup_name', @@ -235,29 +296,21 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (($intReturn1 != 0) && ($intReturn2 != 0)) { + if (($intReturn1 !== 0) && ($intReturn2 !== 0)) { $myVisClass->processMessage(translate('Attention, no hosts and hostgroups defined!'), $strDBWarning); $intDataWarning = 1; } - // Process timeperiod selection field - if (isset($arrModifyData['escalation_period'])) { - $intFieldId = $arrModifyData['escalation_period']; - } else { - $intFieldId = 0; - } + /* Process timeperiod selection field */ + $intFieldId = $arrModifyData['escalation_period'] ?? 0; $intReturn = $myVisClass->parseSelectSimple('tbl_timeperiod', 'timeperiod_name', 'escperiod', 1, $intFieldId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process contact and contact group selection field - if (isset($arrModifyData['contacts'])) { - $intFieldId = $arrModifyData['contacts']; - } else { - $intFieldId = 0; - } + /* Process contact and contact group selection field */ + $intFieldId = $arrModifyData['contacts'] ?? 0; $intReturn1 = $myVisClass->parseSelectMulti( 'tbl_contact', 'contact_name', @@ -266,14 +319,10 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['contact_groups'])) { - $intFieldId = $arrModifyData['contact_groups']; - } else { - $intFieldId = 0; - } + $intFieldId = $arrModifyData['contact_groups'] ?? 0; $intReturn2 = $myVisClass->parseSelectMulti( 'tbl_contactgroup', 'contactgroup_name', @@ -282,70 +331,69 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (($intReturn1 != 0) && ($intReturn2 != 0)) { + if (($intReturn1 !== 0) && ($intReturn2 !== 0)) { $myVisClass->processMessage(translate('Attention, no contacts and contactgroups defined!'), $strDBWarning); $intDataWarning = 1; } - // Process access group selection field - if (isset($arrModifyData['access_group'])) { - $intFieldId = $arrModifyData['access_group']; - } else { - $intFieldId = 0; - } + /* Process access group selection field */ + $intFieldId = $arrModifyData['access_group'] ?? 0; $intReturn = $myVisClass->parseSelectSimple('tbl_group', 'groupname', 'acc_group', 0, $intFieldId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Initial add/modify form definitions + /* Initial add/modify form definitions */ $myContentClass->addFormInit($conttp); - if ($intDataWarning == 1) { - $conttp->setVariable('WARNING', $strDBWarning. '
' .translate('Saving not possible!')); + if ($intDataWarning === 1) { + $conttp->setVariable('WARNING', $strDBWarning . '
' . translate('Saving not possible!')); } - // Insert data from database in "modify" mode - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - // Check relation information to find out locked configuration datasets + /* Insert data from database in "modify" mode */ + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + // Check relation information to find out locked configuration datasets */ $intLocked = $myDataClass->infoRelation($preTableName, $arrModifyData['id'], $preKeyField); $myVisClass->processMessage($myDataClass->strInfoMessage, $strRelMessage); - $strInfo = '
' .translate('Entry cannot be activated because it is used by ' - . 'another configuration'). ':'; - $strInfo .= '
' .$strRelMessage. ''; - // Process data + $strInfo = '
' . translate('Entry cannot be activated because it is used by ' + . 'another configuration') . ':'; + $strInfo .= '
' . $strRelMessage . ''; + // Process data */ $myContentClass->addInsertData($conttp, $arrModifyData, $intLocked, $strInfo); foreach (explode(',', $arrModifyData['escalation_options']) as $elem) { - $conttp->setVariable('DAT_EO' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_EO' . strtoupper($elem) . '_CHECKED', 'checked'); } } $conttp->parse('datainsert'); $conttp->show('datainsert'); } -// -// List view -// ========== -if ($chkModus == 'display') { - // Initial list view definitions +/* +List view +*/ +if ($chkModus === 'display') { + /* Initial list view definitions */ $myContentClass->listViewInit($mastertp); $mastertp->setVariable('TITLE', translate('Define host escalation (hostescalations.cfg)')); $mastertp->setVariable('FIELD_1', translate('Config name')); - $mastertp->setVariable('FIELD_2', translate('Hosts'). ' / ' .translate('Host groups')); - // Process search string - if ($_SESSION['search'][$preSearchSession] != '') { - $strSearchTxt = $_SESSION['search'][$preSearchSession]; - $strSearchWhere = "AND (`$preKeyField` LIKE '%".$strSearchTxt."%')"; + $mastertp->setVariable('FIELD_2', translate('Hosts') . ' / ' . translate('Host groups')); + $mastertp->setVariable('FILTER_VISIBLE', 'visibility: hidden'); + /* Process search string */ + if ($_SESSION['search'][$preSearchSession] !== '') { + $strSearchTxt = $_SESSION['search'][$preSearchSession]; + $strSearchWhere = "AND (`$preKeyField` LIKE '%" . $strSearchTxt . "%')"; } - // Row sorting + /* Row sorting */ $strOrderString = "ORDER BY `config_id`, `$preKeyField` $hidSortDir"; - if ($hidSortBy == 2) { + if ($hidSortBy === 2) { $strOrderString = "ORDER BY `config_id`, `$preKeyField` $hidSortDir"; } $mastertp->setVariable('DISABLE_SORT_2', 'disable'); - // Count datasets - $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` " + /* Count datasets */ + $intLineCount = 0; + /** @noinspection SqlResolve */ + $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` " . "WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess)"; $booReturn = $myDBClass->hasSingleDataset($strSQL, $arrDataLinesCount); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { @@ -354,16 +402,16 @@ if ($chkModus == 'display') { $chkLimit = 0; } } - // Get datasets - $strSQL = "SELECT `id`, `$preKeyField`, `host_name`, `hostgroup_name`, `register`, `active`, `config_id`, " + /* Get datasets */ + $strSQL = "SELECT `id`, `$preKeyField`, `host_name`, `hostgroup_name`, `register`, `active`, `config_id`, " . "`access_group` FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND `access_group` " - . "IN ($strAccess) $strOrderString LIMIT $chkLimit,".$SETS['common']['pagelines']; + . "IN ($strAccess) $strOrderString LIMIT $chkLimit," . $SETS['common']['pagelines']; $booReturn = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - // Process data + /* Process data */ $myContentClass->listData( $mastertp, $arrDataLines, @@ -374,7 +422,7 @@ if ($chkModus == 'display') { 40 ); } -// Show messages +/* Show messages */ $myContentClass->showMessages( $mastertp, $strErrorMessage, @@ -384,7 +432,7 @@ $myContentClass->showMessages( $strTimeInfoString, $intNoTime ); -// -// Process footer -// ============== +/* +Process footer +*/ $myContentClass->showFooter($maintp, $setFileVersion); diff --git a/admin/hostextinfo.php b/admin/hostextinfo.php index b98aca3..671e6c9 100644 --- a/admin/hostextinfo.php +++ b/admin/hostextinfo.php @@ -1,70 +1,115 @@ Application version string + * @var string $chkModus from prepend_adm.php -> Form work mode + * @var int $chkDataId from prepend_adm.php -> Actual dataset id + * @var string $chkSelModify from prepend_adm.php -> Modification selection value + * @var int $hidSortBy from prepend_adm.php -> Sort data by + * @var string $hidSortDir from prepend_adm.php -> Sort data direction (ASC, DESC) + * @var int $chkLimit from prepend_adm.php / settings -> Data set count per page + * @var int $intVersion from prepend_adm.php -> Nagios version + * @var array $SETS Settings array + * @var int $intGlobalWriteAccess from prepend_content.php -> Global admin write access + * @var int $intWriteAccessId from prepend_content.php -> Admin write access to actual dataset id + * @var string $strAccess from prepend_content.php -> List of read access group id's for actual user + * @var string $preSQLCommon1 from prepend_content.php -> Common SQL part 1 + * @var string $strSearchWhere from prepend_content.php -> SQL WHERE addon for data search + * @var string $strDomainWhere from prepend_adm.php -> Domain selection SQL part with table name + * @var string $chkTfValue1 from prepend_content.php -> Notes + * @var string $chkTfValue2 from prepend_content.php -> Notes URL + * @var string $chkTfValue3 from prepend_content.php -> Action URL + * @var string $chkTfValue4 from prepend_content.php -> Icon image + * @var string $chkTfValue5 from prepend_content.php -> Icon image alt text + * @var string $chkTfValue6 from prepend_content.php -> VRML image + * @var string $chkTfValue7 from prepend_content.php -> Status image + * @var string $chkTfValue8 from prepend_content.php -> 2D coords + * @var string $chkTfValue9 from prepend_content.php -> 3D coords + * @var int $chkSelValue1 from prepend_content.php -> Host + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 21; -$preContent = 'admin/hostextinfo.htm.tpl'; -$preListTpl = 'admin/datalist.htm.tpl'; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 21; +$preContent = 'admin/hostextinfo.htm.tpl'; +$preListTpl = 'admin/datalist.htm.tpl'; $preSearchSession = 'hostextinfo'; -$preTableName = 'tbl_hostextinfo'; -$preKeyField = 'host_name'; -$preAccess = 1; -$preFieldvars = 1; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Add or modify data -// ================== -if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAccess == 0)) { +$preTableName = 'tbl_hostextinfo'; +$preKeyField = 'host_name'; +$preAccess = 1; +$preFieldvars = 1; +$strErrorMessage = ''; +$strInfoMessage = ''; +$strConsistMessage = ''; +$strDBWarning = ''; +$intDataWarning = 0; +$intNoTime = 0; +/* +Include preprocessing files +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Add or modify data +*/ +if ((($chkModus === 'insert') || ($chkModus === 'modify')) && ($intGlobalWriteAccess === 0)) { $strSQLx = "`$preTableName` SET `$preKeyField`=$chkSelValue1, `notes`='$chkTfValue1', `notes_url`='$chkTfValue2', " . "`action_url`='$chkTfValue3', `icon_image`='$chkTfValue4', `icon_image_alt`='$chkTfValue5', " . "`vrml_image`='$chkTfValue6', `statusmap_image`='$chkTfValue7', `2d_coords`='$chkTfValue8', " . "`3d_coords`='$chkTfValue9', $preSQLCommon1"; - if ($chkModus == 'insert') { - $strSQL = 'INSERT INTO ' .$strSQLx; + if ($chkModus === 'insert') { + $strSQL = 'INSERT INTO ' . $strSQLx; } else { - $strSQL = 'UPDATE ' .$strSQLx. ' WHERE `id`=' .$chkDataId; + $strSQL = 'UPDATE ' . $strSQLx . ' WHERE `id`=' . $chkDataId; } - if ($intWriteAccessId == 0) { - if ($chkSelValue1 != 0) { + if ($intWriteAccessId === 0) { + if ($chkSelValue1 !== 0) { $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($chkModus == 'insert') { + if ($chkModus === 'insert') { $chkDataId = $intInsertId; } - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); $myDataClass->updateStatusTable($preTableName); - if ($chkModus == 'insert') { - $myDataClass->writeLog(translate('New host extended information inserted:'). ' ' .$chkSelValue1); + if ($chkModus === 'insert') { + $myDataClass->writeLog(translate('New host extended information inserted:') . ' ' . $chkSelValue1); } - if ($chkModus == 'modify') { - $myDataClass->writeLog(translate('Host extended information modified:'). ' ' .$chkSelValue1); + if ($chkModus === 'modify') { + $myDataClass->writeLog(translate('Host extended information modified:') . ' ' . $chkSelValue1); } } } else { @@ -78,92 +123,87 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } $chkModus = 'display'; } -if ($chkModus != 'add') { - $chkModus = 'display'; +if ($chkModus !== 'add') { + $chkModus = 'display'; } -// -// Get date/time of last database and config file manipulation -// =========================================================== +/* +Get date/time of last database and config file manipulation +*/ $intReturn = $myConfigClass->lastModifiedFile($preTableName, $arrTimeData, $strTimeInfoString); -if ($intReturn != 0) { +if ($intReturn !== 0) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } -// -// Singe data form -// =============== -if ($chkModus == 'add') { +/* +Singe data form +*/ +if ($chkModus === 'add') { $conttp->setVariable('TITLE', translate('Define host extended information (hostextinfo.cfg)')); - // Do not show modified time list + /* Do not show modified time list */ $intNoTime = 1; - if (isset($arrModifyData[$preKeyField])) { - $intFieldId = $arrModifyData[$preKeyField]; - } else { - $intFieldId = 0; - } + $intFieldId = $arrModifyData[$preKeyField] ?? 0; $intReturn1 = $myVisClass->parseSelectSimple('tbl_host', $preKeyField, 'host', 0, $intFieldId); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); $myVisClass->processMessage(translate('Attention, no hosts defined!'), $strDBWarning); $intDataWarning = 1; } - // Process access group selection field - if (isset($arrModifyData['access_group'])) { - $intFieldId = $arrModifyData['access_group']; - } else { - $intFieldId = 0; - } + /* Process access group selection field */ + $intFieldId = $arrModifyData['access_group'] ?? 0; $intReturn = $myVisClass->parseSelectSimple('tbl_group', 'groupname', 'acc_group', 0, $intFieldId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Initial add/modify form definitions + /* Initial add/modify form definitions */ $myContentClass->addFormInit($conttp); - if ($intDataWarning == 1) { - $conttp->setVariable('WARNING', $strDBWarning. '
' .translate('Saving not possible!')); + if ($intDataWarning === 1) { + $conttp->setVariable('WARNING', $strDBWarning . '
' . translate('Saving not possible!')); } if ($intVersion < 3) { $conttp->setVariable('VERSION_20_VALUE_MUST', 'mselValue1,'); } - // Insert data from database in "modify" mode - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - // Check relation information to find out locked configuration datasets + /* Insert data from database in "modify" mode */ + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + /* Check relation information to find out locked configuration datasets */ $intLocked = $myDataClass->infoRelation($preTableName, $arrModifyData['id'], $preKeyField); $myVisClass->processMessage($myDataClass->strInfoMessage, $strRelMessage); - $strInfo = '
' .translate('Entry cannot be activated because it is used by ' - . 'another configuration'). ':'; - $strInfo .= '
' .$strRelMessage. ''; - // Process data + $strInfo = '
' . translate('Entry cannot be activated because it is used by ' + . 'another configuration') . ':'; + $strInfo .= '
' . $strRelMessage . ''; + /* Process data */ $myContentClass->addInsertData($conttp, $arrModifyData, $intLocked, $strInfo); } $conttp->parse('datainsert'); $conttp->show('datainsert'); } -// -// List view -// ========== -if ($chkModus == 'display') { - // Initial list view definitions +/* +List view +*/ +if ($chkModus === 'display') { + /* Initial list view definitions */ $myContentClass->listViewInit($mastertp); $mastertp->setVariable('TITLE', translate('Define host extended information (hostextinfo.cfg)')); $mastertp->setVariable('FIELD_1', translate('Host name')); $mastertp->setVariable('FIELD_2', translate('Notes')); - // Process search string - if ($_SESSION['search'][$preSearchSession] != '') { - $strSearchTxt = $_SESSION['search'][$preSearchSession]; - $strSearchWhere = "AND (`tbl_host`.`$preKeyField` LIKE '%".$strSearchTxt."%' OR `$preTableName`.`notes` " - . "LIKE '%".$strSearchTxt."%' OR `$preTableName`.`notes_url` LIKE '%".$strSearchTxt."%')"; + $mastertp->setVariable('FILTER_VISIBLE', 'visibility: hidden'); + /* Process search string */ + if ($_SESSION['search'][$preSearchSession] !== '') { + $strSearchTxt = $_SESSION['search'][$preSearchSession]; + $strSearchWhere = "AND (`tbl_host`.`$preKeyField` LIKE '%" . $strSearchTxt . "%' OR `$preTableName`.`notes` " + . "LIKE '%" . $strSearchTxt . "%' OR `$preTableName`.`notes_url` LIKE '%" . $strSearchTxt . "%')"; } - // Row sorting + /* Row sorting */ $strOrderString = "ORDER BY `$preTableName`.`config_id`, `$preKeyField` $hidSortDir"; - if ($hidSortBy == 2) { + if ($hidSortBy === 2) { $strOrderString = "ORDER BY `$preTableName`.`config_id`, `notes` $hidSortDir"; } - // Count datasets - $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` " + /* Count datasets */ + $intLineCount = 0; + /** @noinspection SqlResolve */ + $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` " . "LEFT JOIN `tbl_host` ON `$preTableName`.`$preKeyField`=`tbl_host`.`id` " . "WHERE $strDomainWhere $strSearchWhere AND `$preTableName`.`access_group` IN ($strAccess)"; $booReturn = $myDBClass->hasSingleDataset($strSQL, $arrDataLinesCount); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { @@ -172,21 +212,21 @@ if ($chkModus == 'display') { $chkLimit = 0; } } - // Get datasets - $strSQL = "SELECT `$preTableName`.`id`, `tbl_host`.`$preKeyField`, `$preTableName`.`notes`, " + /* Get datasets */ + $strSQL = "SELECT `$preTableName`.`id`, `tbl_host`.`$preKeyField`, `$preTableName`.`notes`, " . "`$preTableName`.`register`, `$preTableName`.`active`, `$preTableName`.`config_id`, " . "`$preTableName`.`access_group` FROM `$preTableName` " . "LEFT JOIN `tbl_host` ON `$preTableName`.`$preKeyField` = `tbl_host`.`id` " . "WHERE $strDomainWhere $strSearchWhere AND `$preTableName`.`access_group` IN ($strAccess) $strOrderString " - . "LIMIT $chkLimit,".$SETS['common']['pagelines']; + . "LIMIT $chkLimit," . $SETS['common']['pagelines']; $booReturn = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } $myContentClass->listData($mastertp, $arrDataLines, $intDataCount, $intLineCount, $preKeyField, 'notes'); } -// Show messages +/* Show messages */ $myContentClass->showMessages( $mastertp, $strErrorMessage, @@ -196,7 +236,7 @@ $myContentClass->showMessages( $strTimeInfoString, $intNoTime ); -// -// Process footer -// ============== -$myContentClass->showFooter($maintp, $setFileVersion); +/* +Process footer +*/ +$myContentClass->showFooter($maintp, $setFileVersion); \ No newline at end of file diff --git a/admin/hostgroups.php b/admin/hostgroups.php index 6971795..d793693 100644 --- a/admin/hostgroups.php +++ b/admin/hostgroups.php @@ -1,96 +1,151 @@ Application version string + * @var string $chkModus from prepend_adm.php -> Form work mode + * @var int $chkDataId from prepend_adm.php -> Actual dataset id + * @var int $chkListId from prepend_adm.php -> Actual dataset id (list view) + * @var string $chkSelModify from prepend_adm.php -> Modification selection value + * @var int $hidSortBy from prepend_adm.php -> Sort data by + * @var string $hidSortDir from prepend_adm.php -> Sort data direction (ASC, DESC) + * @var int $chkLimit from prepend_adm.php / settings -> Data set count per page + * @var int $intVersion from prepend_adm.php -> Nagios version + * @var array $SETS Settings array + * @var int $intGlobalWriteAccess from prepend_content.php -> Global admin write access + * @var int $intWriteAccessId from prepend_content.php -> Admin write access to actual dataset id + * @var string $strAccess from prepend_content.php -> List of read access group id's for actual user + * @var string $preSQLCommon1 from prepend_content.php -> Common SQL part 1 + * @var string $strDomainWhere from prepend_adm.php -> Domain selection SQL part with table name + * @var string $chkTfValue1 from prepend_content.php -> Hostgroup name + * @var string $chkTfValue2 from prepend_content.php -> Hostgroup description + * @var string $chkTfValue3 from prepend_content.php -> Notes + * @var string $chkTfValue4 from prepend_content.php -> Notes URL + * @var string $chkTfValue5 from prepend_content.php -> Action URL + * @var array $chkMselValue1 from prepend_content.php -> Members + * @var array $chkMselValue2 from prepend_content.php -> Hostgroup members + * @var int $intMselValue1 from prepend_content.php -> Members multiselect status value + * @var int $intMselValue2 from prepend_content.php -> Hostgroup members multiselect status value + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 10; -$preContent = 'admin/hostgroups.htm.tpl'; -$preListTpl = 'admin/datalist.htm.tpl'; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 10; +$preContent = 'admin/hostgroups.htm.tpl'; +$preListTpl = 'admin/datalist.htm.tpl'; $preSearchSession = 'hostgroup'; -$preTableName = 'tbl_hostgroup'; -$preKeyField = 'hostgroup_name'; -$preAccess = 1; -$preFieldvars = 1; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Add or modify data -// ================== -if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAccess == 0)) { +$preTableName = 'tbl_hostgroup'; +$preKeyField = 'hostgroup_name'; +$preAccess = 1; +$preFieldvars = 1; +$strErrorMessage = ''; +$strInfoMessage = ''; +$strConsistMessage = ''; +$strDBWarning = ''; +$intDataWarning = 0; +$intRet1 = 0; +$intRet2 = 0; +$intNoTime = 0; +/* +Default values for form variables +*/ +if (!isset($intMselValue1)) { + $intMselValue1 = 0; +} +if (!isset($intMselValue2)) { + $intMselValue2 = 0; +} +/* +Include preprocessing files +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Add or modify data +*/ +if ((($chkModus === 'insert') || ($chkModus === 'modify')) && ($intGlobalWriteAccess === 0)) { $strSQLx = "`$preTableName` SET `$preKeyField`='$chkTfValue1', `alias`='$chkTfValue2', `members`=$intMselValue1, " - . "`hostgroup_members`=$intMselValue2, `notes`='$chkTfValue3', `notes_url`='$chkTfValue4', " - . "`action_url`='$chkTfValue5', $preSQLCommon1"; - if ($chkModus == 'insert') { - $strSQL = 'INSERT INTO ' .$strSQLx; + . "`hostgroup_members`=$intMselValue2, `notes`='$chkTfValue3', `notes_url`='$chkTfValue4', " + . "`action_url`='$chkTfValue5', $preSQLCommon1"; + if ($chkModus === 'insert') { + $strSQL = 'INSERT INTO ' . $strSQLx; } else { - $strSQL = 'UPDATE ' .$strSQLx. ' WHERE `id`=' .$chkDataId; + $strSQL = 'UPDATE ' . $strSQLx . ' WHERE `id`=' . $chkDataId; } - if ($intWriteAccessId == 0) { - if (($chkTfValue1 != '') && ($chkTfValue2 != '') && (($intMselValue1 != 0) || ($intVersion >= 3))) { + if ($intWriteAccessId === 0) { + if (($chkTfValue1 !== '') && ($chkTfValue2 !== '') && (($intMselValue1 !== 0) || ($intVersion >= 3))) { $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($chkModus == 'insert') { + if ($chkModus === 'insert') { $chkDataId = $intInsertId; } - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); $myDataClass->updateStatusTable($preTableName); - if ($chkModus == 'insert') { - $myDataClass->writeLog(translate('New host group inserted:'). ' ' .$chkTfValue1); + if ($chkModus === 'insert') { + $myDataClass->writeLog(translate('New host group inserted:') . ' ' . $chkTfValue1); } - if ($chkModus == 'modify') { - $myDataClass->writeLog(translate('Host group modified:'). ' ' .$chkTfValue1); + if ($chkModus === 'modify') { + $myDataClass->writeLog(translate('Host group modified:') . ' ' . $chkTfValue1); } - // - // Insert/update relations - // ======================= - if ($chkModus == 'insert') { - if ($intMselValue1 != 0) { + /* + Insert/update relations + */ + if ($chkModus === 'insert') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataInsertRelation( 'tbl_lnkHostgroupToHost', $chkDataId, $chkMselValue1 ); } - if (isset($intRet1) && ($intRet1 != 0)) { + if (isset($intRet1) && ($intRet1 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataInsertRelation( 'tbl_lnkHostgroupToHostgroup', $chkDataId, $chkMselValue2 ); } - if (isset($intRet2) && ($intRet2 != 0)) { + if (isset($intRet2) && ($intRet2 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - } elseif ($chkModus == 'modify') { - if ($intMselValue1 != 0) { + } elseif ($chkModus === 'modify') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataUpdateRelation( 'tbl_lnkHostgroupToHost', $chkDataId, @@ -99,10 +154,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet1 = $myDataClass->dataDeleteRelation('tbl_lnkHostgroupToHost', $chkDataId); } - if ($intRet1 != 0) { + if ($intRet1 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataUpdateRelation( 'tbl_lnkHostgroupToHostgroup', $chkDataId, @@ -111,11 +166,11 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet2 = $myDataClass->dataDeleteRelation('tbl_lnkHostgroupToHostgroup', $chkDataId); } - if ($intRet2 != 0) { + if ($intRet2 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } - if (($intRet1 + $intRet2) != 0) { + if (($intRet1 + $intRet2) !== 0) { $strInfoMessage = ''; } } @@ -130,29 +185,25 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } $chkModus = 'display'; } -if ($chkModus != 'add') { - $chkModus = 'display'; +if ($chkModus !== 'add') { + $chkModus = 'display'; } -// -// Get date/time of last database and config file manipulation -// =========================================================== +/* +Get date/time of last database and config file manipulation +*/ $intReturn = $myConfigClass->lastModifiedFile($preTableName, $arrTimeData, $strTimeInfoString); -if ($intReturn != 0) { +if ($intReturn !== 0) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } -// -// Singe data form -// =============== -if ($chkModus == 'add') { +/* +Singe data form +*/ +if ($chkModus === 'add') { $conttp->setVariable('TITLE', translate('Define host groups (hostgroups.cfg)')); - // Do not show modified time list + /* Do not show modified time list */ $intNoTime = 1; - // Process host selection field - if (isset($arrModifyData['members'])) { - $intFieldId = $arrModifyData['members']; - } else { - $intFieldId = 0; - } + /* Process host selection field */ + $intFieldId = $arrModifyData['members'] ?? 0; $intReturn1 = $myVisClass->parseSelectMulti( 'tbl_host', 'host_name', @@ -161,19 +212,15 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (($intReturn1 != 0) && ($intVersion < 3)) { + if (($intReturn1 !== 0) && ($intVersion < 3)) { $myVisClass->processMessage(translate('Attention, no hosts defined!'), $strDBWarning); $intDataWarning = 1; } - // Process host group selection field - if (isset($arrModifyData['hostgroup_members'])) { - $intFieldId = $arrModifyData['hostgroup_members']; - } else { - $intFieldId = 0; - } + /* Process host group selection field */ + $intFieldId = $arrModifyData['hostgroup_members'] ?? 0; $intReturn2 = $myVisClass->parseSelectMulti( $preTableName, $preKeyField, @@ -183,66 +230,85 @@ if ($chkModus == 'add') { $intFieldId, $chkListId ); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process access group selection field - if (isset($arrModifyData['access_group'])) { - $intFieldId = $arrModifyData['access_group']; - } else { - $intFieldId = 0; - } + /* Process access group selection field */ + $intFieldId = $arrModifyData['access_group'] ?? 0; $intReturn3 = $myVisClass->parseSelectSimple('tbl_group', 'groupname', 'acc_group', 0, $intFieldId); - if ($intReturn3 != 0) { + if ($intReturn3 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Initial add/modify form definitions + /* Initial add/modify form definitions */ $myContentClass->addFormInit($conttp); - if ($intDataWarning == 1) { - $conttp->setVariable('WARNING', $strDBWarning. '
' .translate('Saving not possible!')); + if ($intDataWarning === 1) { + $conttp->setVariable('WARNING', $strDBWarning . '
' . translate('Saving not possible!')); } if ($intVersion < 3) { $conttp->setVariable('VERSION_20_VALUE_MUST', 'mselValue1,'); } - // Insert data from database in "modify" mode - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - // Check relation information to find out locked configuration datasets + /* Insert data from database in "modify" mode */ + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + /* Check relation information to find out locked configuration datasets */ $intLocked = $myDataClass->infoRelation($preTableName, $arrModifyData['id'], $preKeyField); $myVisClass->processMessage($myDataClass->strInfoMessage, $strRelMessage); - $strInfo = '
' .translate('Entry cannot be activated because it is used by ' - . 'another configuration'). ':'; - $strInfo .= '
' .$strRelMessage. ''; - // Process data + $strInfo = '
' . translate('Entry cannot be activated because it is used by ' + . 'another configuration') . ':'; + $strInfo .= '
' . $strRelMessage . ''; + /* Process data */ $myContentClass->addInsertData($conttp, $arrModifyData, $intLocked, $strInfo); } $conttp->parse('datainsert'); $conttp->show('datainsert'); } -// -// List view -// ========== -if ($chkModus == 'display') { - // Initial list view definitions +/* +List view +*/ +if ($chkModus === 'display') { + /* Initial list view definitions */ $myContentClass->listViewInit($mastertp); $mastertp->setVariable('TITLE', translate('Define host groups (hostgroups.cfg)')); $mastertp->setVariable('FIELD_1', translate('Host group')); $mastertp->setVariable('FIELD_2', translate('Description')); - // Process search string - if ($_SESSION['search'][$preSearchSession] != '') { - $strSearchTxt = $_SESSION['search'][$preSearchSession]; - $strSearchWhere = "AND (`$preKeyField` LIKE '%".$strSearchTxt."%' OR `alias` LIKE '%".$strSearchTxt."%' " - . "OR `notes` LIKE '%".$strSearchTxt."%')"; + /* Process search string and filter */ + $strSearchWhere = ''; + if ($_SESSION['search'][$preSearchSession] !== '') { + $strSearchTxt = $_SESSION['search'][$preSearchSession]; + $strSearchWhere .= "AND (`$preKeyField` LIKE '%" . $strSearchTxt . "%' OR `alias` LIKE '%" . $strSearchTxt . "%' " + . "OR `notes` LIKE '%" . $strSearchTxt . "%') "; } - // Row sorting + if ($_SESSION['filter'][$preSearchSession]['registered'] !== '') { + $intRegistered = (int)$_SESSION['filter'][$preSearchSession]['registered']; + if ($intRegistered === 1) { + $strSearchWhere .= "AND `register` = '1' "; + } + if ($intRegistered === 2) { + $strSearchWhere .= "AND `register` = '0' "; + } + $mastertp->setVariable('SEL_REGFILTER_' . $intRegistered . '_SELECTED', 'selected'); + } + if ($_SESSION['filter'][$preSearchSession]['active'] !== '') { + $intActivated = (int)$_SESSION['filter'][$preSearchSession]['active']; + if ($intActivated === 1) { + $strSearchWhere .= "AND `active` = '1' "; + } + if ($intActivated === 2) { + $strSearchWhere .= "AND `active` = '0' "; + } + $mastertp->setVariable('SEL_ACTIVEFILTER_' . $intActivated . '_SELECTED', 'selected'); + } + /* Row sorting */ $strOrderString = "ORDER BY `config_id`, `$preKeyField` $hidSortDir"; - if ($hidSortBy == 2) { + if ($hidSortBy === 2) { $strOrderString = "ORDER BY `config_id`, `alias` $hidSortDir"; } - // Count datasets - $strSQL1 = "SELECT count(*) AS `number` FROM `$preTableName` " - . "WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess)"; + /* Count datasets */ + $intLineCount = 0; + /** @noinspection SqlResolve */ + $strSQL1 = "SELECT count(*) AS `number` FROM `$preTableName` " + . "WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess)"; $booReturn1 = $myDBClass->hasSingleDataset($strSQL1, $arrDataLinesCount); - if ($booReturn1 == false) { + if ($booReturn1 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { @@ -251,19 +317,19 @@ if ($chkModus == 'display') { $chkLimit = 0; } } - // Get datasets - $strSQL2 = "SELECT `id`, `$preKeyField`, `alias`, `register`, `active`, `config_id`, `access_group` " - . "FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND `access_group` " - . "IN ($strAccess) $strOrderString LIMIT $chkLimit,".$SETS['common']['pagelines']; + /* Get datasets */ + $strSQL2 = "SELECT `id`, `$preKeyField`, `alias`, `register`, `active`, `config_id`, `access_group` " + . "FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND `access_group` " + . "IN ($strAccess) $strOrderString LIMIT $chkLimit," . $SETS['common']['pagelines']; $booReturn2 = $myDBClass->hasDataArray($strSQL2, $arrDataLines, $intDataCount); - if ($booReturn2 == false) { + if ($booReturn2 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - // Process data + /* Process data */ $myContentClass->listData($mastertp, $arrDataLines, $intDataCount, $intLineCount, $preKeyField, 'alias'); } -// Show messages +/* Show messages */ $myContentClass->showMessages( $mastertp, $strErrorMessage, @@ -273,7 +339,7 @@ $myContentClass->showMessages( $strTimeInfoString, $intNoTime ); -// -// Process footer -// ============== -$myContentClass->showFooter($maintp, $setFileVersion); +/* +Process footer +*/ +$myContentClass->showFooter($maintp, $setFileVersion); \ No newline at end of file diff --git a/admin/hosts.php b/admin/hosts.php index 9a4d9b1..c571019 100644 --- a/admin/hosts.php +++ b/admin/hosts.php @@ -1,150 +1,284 @@ Application version string + * @var int $chkActive from prepend_adm.php -> Active checkbox + * @var string $chkModus from prepend_adm.php -> Form work mode + * @var int $chkDataId from prepend_adm.php -> Actual dataset id + * @var string $chkSelModify from prepend_adm.php -> Modification selection value + * @var int $hidSortBy from prepend_adm.php -> Sort data by + * @var string $hidSortDir from prepend_adm.php -> Sort data direction (ASC, DESC) + * @var int $chkLimit from prepend_adm.php / settings -> Data set count per page + * @var int $chkDomainId from prepend_adm.php -> Configuration domain id + * @var int $intVersion from prepend_adm.php -> Nagios version + * @var array $SETS Settings array + * @var int $intGlobalWriteAccess from prepend_content.php -> Global admin write access + * @var int $intWriteAccessId from prepend_content.php -> Admin write access to actual dataset id + * @var string $strAccess from prepend_content.php -> List of read access group id's for actual user + * @var string $preSQLCommon1 from prepend_content.php -> Common SQL part 1 + * @var string $strDomainWhere from prepend_adm.php -> Domain selection SQL part with table name + * @var string $strDomainWhere2 from prepend_adm.php -> Domain selection SQL part without table name + * @var string $chkTfValue1 from prepend_content.php -> Host name + * @var string $chkTfValue2 from prepend_content.php -> (Hidden) Host name + * @var string $chkTfValue3 from prepend_content.php -> Host description + * @var string $chkTfValue4 from prepend_content.php -> Display name + * @var string $chkTfValue5 from prepend_content.php -> Address + * @var string $chkTfValue6 from prepend_content.php -> Generic name + * @var string $chkTfValue7 from prepend_content.php -> Notes + * @var string $chkTfValue8 from prepend_content.php -> VRML image + * @var string $chkTfValue9 from prepend_content.php -> Notes URL + * @var string $chkTfValue10 from prepend_content.php -> Status image + * @var string $chkTfValue11 from prepend_content.php -> Action URL + * @var string $chkTfValue12 from prepend_content.php -> Icon image + * @var string $chkTfValue13 from prepend_content.php -> Icon image alt text + * @var string $chkTfValue14 from prepend_content.php -> 2D coords + * @var string $chkTfValue15 from prepend_content.php -> 3D coords + * @var int $chkSelValue1 from prepend_content.php -> Check command + * @var int $chkSelValue2 from prepend_content.php -> Check period + * @var int $chkSelValue3 from prepend_content.php -> Event handler + * @var int $chkSelValue4 from prepend_content.php -> Notification period + * @var array $chkMselValue1 from prepend_content.php -> Parents + * @var array $chkMselValue2 from prepend_content.php -> Host groups + * @var array $chkMselValue3 from prepend_content.php -> Contacts + * @var array $chkMselValue4 from prepend_content.php -> Contact groups + * @var array $chkMselValue5 from prepend_content.php -> Services + * @var int $intMselValue1 from prepend_content.php -> Parents multiselect status value + * @var int $intMselValue2 from prepend_content.php -> Host groups multiselect status value + * @var int $intMselValue3 from prepend_content.php -> Contacts multiselect status value + * @var int $intMselValue4 from prepend_content.php -> Contact groups multiselect status value + * @var int $intMselValue5 from prepend_content.php -> Services multiselect status value + * @var string $chkChbGr1a from prepend_content.php -> Notification options (d) + * @var string $chkChbGr1b from prepend_content.php -> Notification options (u) + * @var string $chkChbGr1c from prepend_content.php -> Notification options (r) + * @var string $chkChbGr1d from prepend_content.php -> Notification options (f) + * @var string $chkChbGr1e from prepend_content.php -> Notification options (s) + * @var string $chkChbGr2a from prepend_content.php -> Initial state (o) + * @var string $chkChbGr2b from prepend_content.php -> Initial state (d) + * @var string $chkChbGr2c from prepend_content.php -> Initial state (u) + * @var string $chkChbGr3a from prepend_content.php -> Flap detection options (o) + * @var string $chkChbGr3b from prepend_content.php -> Flap detection options (d) + * @var string $chkChbGr3c from prepend_content.php -> Flap detection options (u) + * @var string $chkChbGr4a from prepend_content.php -> Stalking options (o) + * @var string $chkChbGr4b from prepend_content.php -> Stalking options (d) + * @var string $chkChbGr4c from prepend_content.php -> Stalking options (u) + * @var int $chkRadValue1 from prepend_content.php -> Parents multiselect options + * @var int $chkRadValue2 from prepend_content.php -> Hosts groups multiselect options + * @var int $chkRadValue3 from prepend_content.php -> Contacts multiselect options + * @var int $chkRadValue4 from prepend_content.php -> Contact groups multiselect options + * @var int $chkRadValue5 from prepend_content.php -> Active checks + * @var int $chkRadValue6 from prepend_content.php -> Passive checks + * @var int $chkRadValue7 from prepend_content.php -> Freshness checks + * @var int $chkRadValue8 from prepend_content.php -> Obsess over service + * @var int $chkRadValue9 from prepend_content.php -> Event handler + * @var int $chkRadValue10 from prepend_content.php -> Flap detection + * @var int $chkRadValue11 from prepend_content.php -> Retain status information + * @var int $chkRadValue12 from prepend_content.php -> Retain non-status information + * @var int $chkRadValue13 from prepend_content.php -> Process performance data + * @var int $chkRadValue14 from prepend_content.php -> Notification + * @var string $chkTfNullVal1 from prepend_content.php -> Retry interval + * @var string $chkTfNullVal2 from prepend_content.php -> Max check attempts + * @var string $chkTfNullVal3 from prepend_content.php -> Check interval + * @var string $chkTfNullVal4 from prepend_content.php -> Freshness threshold + * @var string $chkTfNullVal5 from prepend_content.php -> Low flap threshold + * @var string $chkTfNullVal6 from prepend_content.php -> High flap threshold + * @var string $chkTfNullVal7 from prepend_content.php -> Notification interval + * @var string $chkTfNullVal8 from prepend_content.php -> First notification delay + * @var string $chkTfNullVal9 from prepend_content.php -> Importance + * @var int $intVariables from prepend_content.php -> Form uses variable definitions + * @var int $intTemplates from prepend_content.php -> Form uses template definitions + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 8; -$preContent = 'admin/hosts.htm.tpl'; -$preListTpl = 'admin/datalist_hosts.htm.tpl'; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 8; +$preContent = 'admin/hosts.htm.tpl'; +$preListTpl = 'admin/datalist_hosts.htm.tpl'; $preSearchSession = 'host'; -$preTableName = 'tbl_host'; -$preKeyField = 'host_name'; -$preAccess = 1; -$preFieldvars = 1; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Data processing -// =============== -$strNO = substr($chkChbGr1a.$chkChbGr1b.$chkChbGr1c.$chkChbGr1d.$chkChbGr1e, 0, -1); -$strIS = substr($chkChbGr2a.$chkChbGr2b.$chkChbGr2c, 0, -1); -$strFL = substr($chkChbGr3a.$chkChbGr3b.$chkChbGr3c, 0, -1); -$strST = substr($chkChbGr4a.$chkChbGr4b.$chkChbGr4c, 0, -1); -if ($chkSelValue1 != '') { +$preTableName = 'tbl_host'; +$preKeyField = 'host_name'; +$preAccess = 1; +$preFieldvars = 1; +$strSqlParents = ''; +$strErrorMessage = ''; +$strInfoMessage = ''; +$strConsistMessage = ''; +$strDBWarning = ''; +$intDataWarning = 0; +$intRet1 = 0; +$intRet2 = 0; +$intRet3 = 0; +$intRet4 = 0; +$intNoTime = 0; +/* +Default values for form variables +*/ +if (!isset($intMselValue1)) { + $intMselValue1 = 0; +} +if (!isset($intMselValue2)) { + $intMselValue2 = 0; +} +if (!isset($intMselValue3)) { + $intMselValue3 = 0; +} +if (!isset($intMselValue4)) { + $intMselValue4 = 0; +} +if (!isset($intMselValue5)) { + $intMselValue5 = 0; +} +/* +Include preprocessing file +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Data processing +*/ +$strNO = substr($chkChbGr1a . $chkChbGr1b . $chkChbGr1c . $chkChbGr1d . $chkChbGr1e, 0, -1); +$strIS = substr($chkChbGr2a . $chkChbGr2b . $chkChbGr2c, 0, -1); +$strFL = substr($chkChbGr3a . $chkChbGr3b . $chkChbGr3c, 0, -1); +$strST = substr($chkChbGr4a . $chkChbGr4b . $chkChbGr4c, 0, -1); +if ($chkSelValue1 !== 0) { for ($i = 1; $i <= 8; $i++) { - $tmpVar = 'chkTfArg'.$i; + $tmpVar = 'chkTfArg' . $i; $$tmpVar = str_replace('!', '::bang::', $$tmpVar); - if ($$tmpVar != '') { - $chkSelValue1 .= '!' .$$tmpVar; + if ($$tmpVar !== '') { + $chkSelValue1 .= '!' . $$tmpVar; } } } -// -// Add or modify data -// ================== -if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAccess == 0)) { - $strSQLx = "`$preTableName` SET `$preKeyField`='$chkTfValue1', `alias`='$chkTfValue3', " - . "`display_name`='$chkTfValue4', `address`='$chkTfValue5', `name`='$chkTfValue6', " - . "`parents`=$intMselValue1, `importance`=$chkTfNullVal9, `parents_tploptions`=$chkRadValue1, " - . "`hostgroups`=$intMselValue2, " - . "`hostgroups_tploptions`=$chkRadValue2, `check_command`='$chkSelValue1', `use_template`=$intTemplates, " - . "`initial_state`='$strIS', `max_check_attempts`=$chkTfNullVal2, `check_interval`=$chkTfNullVal3, " - . "`retry_interval`=$chkTfNullVal1, `active_checks_enabled`=$chkRadValue5, " - . "`passive_checks_enabled`=$chkRadValue6, `check_period`=$chkSelValue2, " - . "`obsess_over_host`=$chkRadValue8, `check_freshness`=$chkRadValue7, " - . "`freshness_threshold`=$chkTfNullVal4, `event_handler`=$chkSelValue3, " - . "`event_handler_enabled`=$chkRadValue9, `low_flap_threshold`=$chkTfNullVal5, " - . "`high_flap_threshold`=$chkTfNullVal6, `flap_detection_enabled`=$chkRadValue10, " - . "`flap_detection_options`='$strFL', `process_perf_data`=$chkRadValue13, " - . "`retain_status_information`=$chkRadValue11, `retain_nonstatus_information`=$chkRadValue12, " - . "`contacts`=$intMselValue3, `contacts_tploptions`=$chkRadValue3, `contact_groups`=$intMselValue4, " - . "`contact_groups_tploptions`=$chkRadValue4, `notification_interval`=$chkTfNullVal7, " - . "`notification_period`=$chkSelValue4, `first_notification_delay`=$chkTfNullVal8, " - . "`notification_options`='$strNO', `notifications_enabled`=$chkRadValue14, `stalking_options`='$strST', " - . "`notes`='$chkTfValue7', `notes_url`='$chkTfValue9', `action_url`='$chkTfValue11', " - . "`icon_image`='$chkTfValue12', `icon_image_alt`='$chkTfValue13', `vrml_image`='$chkTfValue8', " - . "`statusmap_image`='$chkTfValue10', `2d_coords`='$chkTfValue14', `3d_coords`='$chkTfValue15', " - . $preSQLCommon1; - if ($chkModus == 'insert') { - $strSQL = 'INSERT INTO ' .$strSQLx; - } else { - $strSQL = 'UPDATE ' .$strSQLx. ' WHERE `id`=' .$chkDataId; +/* +Add or modify data +*/ +if ((($chkModus === 'insert') || ($chkModus === 'modify')) && ($intGlobalWriteAccess === 0)) { + if ((int)$SETS['performance']['parents'] === 1) { + $strSqlParents = "`parents`=$intMselValue1, `parents_tploptions`=$chkRadValue1,"; } - if ($intWriteAccessId == 0) { - if (($chkTfValue1 != '') && ($chkTfValue5 != '')) { + $strSQLx = "`$preTableName` SET `$preKeyField`='$chkTfValue1', `alias`='$chkTfValue3', " + . "`display_name`='$chkTfValue4', `address`='$chkTfValue5', `name`='$chkTfValue6', " + . "$strSqlParents `importance`=$chkTfNullVal9, `hostgroups`=$intMselValue2, " + . "`hostgroups_tploptions`=$chkRadValue2, `check_command`='$chkSelValue1', `use_template`=$intTemplates, " + . "`initial_state`='$strIS', `max_check_attempts`=$chkTfNullVal2, `check_interval`=$chkTfNullVal3, " + . "`retry_interval`=$chkTfNullVal1, `active_checks_enabled`=$chkRadValue5, " + . "`passive_checks_enabled`=$chkRadValue6, `check_period`=$chkSelValue2, " + . "`obsess_over_host`=$chkRadValue8, `check_freshness`=$chkRadValue7, " + . "`freshness_threshold`=$chkTfNullVal4, `event_handler`=$chkSelValue3, " + . "`event_handler_enabled`=$chkRadValue9, `low_flap_threshold`=$chkTfNullVal5, " + . "`high_flap_threshold`=$chkTfNullVal6, `flap_detection_enabled`=$chkRadValue10, " + . "`flap_detection_options`='$strFL', `process_perf_data`=$chkRadValue13, " + . "`retain_status_information`=$chkRadValue11, `retain_nonstatus_information`=$chkRadValue12, " + . "`contacts`=$intMselValue3, `contacts_tploptions`=$chkRadValue3, `contact_groups`=$intMselValue4, " + . "`contact_groups_tploptions`=$chkRadValue4, `notification_interval`=$chkTfNullVal7, " + . "`notification_period`=$chkSelValue4, `first_notification_delay`=$chkTfNullVal8, " + . "`notification_options`='$strNO', `notifications_enabled`=$chkRadValue14, `stalking_options`='$strST', " + . "`notes`='$chkTfValue7', `notes_url`='$chkTfValue9', `action_url`='$chkTfValue11', " + . "`icon_image`='$chkTfValue12', `icon_image_alt`='$chkTfValue13', `vrml_image`='$chkTfValue8', " + . "`statusmap_image`='$chkTfValue10', `2d_coords`='$chkTfValue14', `3d_coords`='$chkTfValue15', " + . $preSQLCommon1; + if ($chkModus === 'insert') { + $strSQL = 'INSERT INTO ' . $strSQLx; + } else { + $strSQL = 'UPDATE ' . $strSQLx . ' WHERE `id`=' . $chkDataId; + } + if ($intWriteAccessId === 0) { + if (($chkTfValue1 !== '') && ($chkTfValue5 !== '')) { $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($chkModus == 'insert') { + if ($chkModus === 'insert') { $chkDataId = $intInsertId; } - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); - if ($chkModus == 'insert') { - $myDataClass->writeLog(translate('New host inserted:'). ' ' .$chkTfValue1); + if ($chkModus === 'insert') { + $myDataClass->writeLog(translate('New host inserted:') . ' ' . $chkTfValue1); } - if ($chkModus == 'modify') { - $myDataClass->writeLog(translate('Host modified:'). ' ' .$chkTfValue1); + if ($chkModus === 'modify') { + $myDataClass->writeLog(translate('Host modified:') . ' ' . $chkTfValue1); } - // - // Insert/update relations - // ======================= - if ($chkModus == 'insert') { - if ($intMselValue1 != 0) { - $intRet1 = $myDataClass->dataInsertRelation('tbl_lnkHostToHost', $chkDataId, $chkMselValue1); + /* + Insert/update relations + */ + if ($chkModus === 'insert') { + if ((int)$SETS['performance']['parents'] === 1) { + if ($intMselValue1 !== 0) { + $intRet1 = $myDataClass->dataInsertRelation('tbl_lnkHostToHost', $chkDataId, $chkMselValue1); + } + if (isset($intRet1) && ($intRet1 !== 0)) { + $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); + } } - if (isset($intRet1) && ($intRet1 != 0)) { - $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); - } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataInsertRelation( 'tbl_lnkHostToHostgroup', $chkDataId, $chkMselValue2 ); } - if (isset($intRet2) && ($intRet2 != 0)) { + if (isset($intRet2) && ($intRet2 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue3 != 0) { + if ($intMselValue3 !== 0) { $intRet3 = $myDataClass->dataInsertRelation('tbl_lnkHostToContact', $chkDataId, $chkMselValue3); } - if (isset($intRet3) && ($intRet3 != 0)) { + if (isset($intRet3) && ($intRet3 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue4 != 0) { + if ($intMselValue4 !== 0) { $intRet4 = $myDataClass->dataInsertRelation( 'tbl_lnkHostToContactgroup', $chkDataId, $chkMselValue4 ); } - if (isset($intRet4) && ($intRet4 != 0)) { + if (isset($intRet4) && ($intRet4 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - } elseif ($chkModus == 'modify') { - if ($intMselValue1 != 0) { - $intRet1 = $myDataClass->dataUpdateRelation('tbl_lnkHostToHost', $chkDataId, $chkMselValue1); - } else { - $intRet1 = $myDataClass->dataDeleteRelation('tbl_lnkHostToHost', $chkDataId); + } elseif ($chkModus === 'modify') { + if ((int)$SETS['performance']['parents'] === 1) { + if ($intMselValue1 !== 0) { + $intRet1 = $myDataClass->dataUpdateRelation('tbl_lnkHostToHost', $chkDataId, $chkMselValue1); + } else { + $intRet1 = $myDataClass->dataDeleteRelation('tbl_lnkHostToHost', $chkDataId); + } + if ($intRet1 !== 0) { + $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); + } } - if ($intRet1 != 0) { - $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); - } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataUpdateRelation( 'tbl_lnkHostToHostgroup', $chkDataId, @@ -153,18 +287,18 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet2 = $myDataClass->dataDeleteRelation('tbl_lnkHostToHostgroup', $chkDataId); } - if ($intRet2 != 0) { + if ($intRet2 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue3 != 0) { + if ($intMselValue3 !== 0) { $intRet3 = $myDataClass->dataUpdateRelation('tbl_lnkHostToContact', $chkDataId, $chkMselValue3); } else { $intRet3 = $myDataClass->dataDeleteRelation('tbl_lnkHostToContact', $chkDataId); } - if ($intRet3 != 0) { + if ($intRet3 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue4 != 0) { + if ($intMselValue4 !== 0) { $intRet4 = $myDataClass->dataUpdateRelation( 'tbl_lnkHostToContactgroup', $chkDataId, @@ -173,179 +307,173 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet4 = $myDataClass->dataDeleteRelation('tbl_lnkHostToContactgroup', $chkDataId); } - if ($intRet4 != 0) { + if ($intRet4 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } - if (($intRet1 + $intRet2 + $intRet3 + $intRet4) != 0) { + if (($intRet1 + $intRet2 + $intRet3 + $intRet4) !== 0) { $strInfoMessage = ''; } - // - // Removing the config file if an entry was deleted or renamed - // =========================================================== - if (($chkModus == 'modify') && ($chkTfValue2 != $chkTfValue1) && ($chkDomainId != 0)) { + /* + Removing the config file if an entry was deleted or renamed + */ + if (($chkModus === 'modify') && ($chkTfValue2 !== $chkTfValue1) && ($chkDomainId !== 0)) { $myConfigClass->getConfigTargets($arrConfigID); - if (($arrConfigID != 1) && is_array($arrConfigID)) { + if (($arrConfigID !== 1) && is_array($arrConfigID)) { $intReturn = 0; foreach ($arrConfigID as $intConfigID) { - $intReturn += $myConfigClass->moveFile('host', $chkTfValue2. '.cfg', $intConfigID); + $intReturn += $myConfigClass->moveFile('host', $chkTfValue2 . '.cfg', $intConfigID); } - if ($intReturn == 0) { + if ($intReturn === 0) { $myVisClass->processMessage(translate('The assigned, no longer used configuration files ' - . 'were deleted successfully!'), $strInfoMessage); - $myDataClass->writeLog(translate('Host file deleted:'). ' ' .$chkTfValue2. '.cfg'); + . 'were deleted successfully!'), $strInfoMessage); + $myDataClass->writeLog(translate('Host file deleted:') . ' ' . $chkTfValue2 . '.cfg'); + } else if ($chkDomainId === 0) { + $myVisClass->processMessage(translate('Common files cannot be removed from target ' + . 'systems - please check manually'), $strErrorMessage); } else { - if ($chkDomainId == 0) { - $myVisClass->processMessage(translate('Common files cannot be removed from target ' - . 'systems - please check manually'), $strErrorMessage); - } else { - $myVisClass->processMessage(translate('Errors while deleting the old configuration ' - . 'file - please check!:'), $strErrorMessage); - $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); - } + $myVisClass->processMessage(translate('Errors while deleting the old configuration ' + . 'file - please check!:'), $strErrorMessage); + $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } } } - // - // Removing the config file if an entry was dectivated - // =================================================== - if (($chkModus == 'modify') && ($chkActive == 0)) { + /* + Removing the config file if an entry was dectivated + */ + if (($chkModus === 'modify') && ($chkActive === 0)) { $myConfigClass->getConfigTargets($arrConfigID); - if (($arrConfigID != 1) && is_array($arrConfigID)) { + if (($arrConfigID !== 1) && is_array($arrConfigID)) { $intReturn = 0; foreach ($arrConfigID as $intConfigID) { - $intReturn += $myConfigClass->moveFile('host', $chkTfValue2. '.cfg', $intConfigID); + $intReturn += $myConfigClass->moveFile('host', $chkTfValue2 . '.cfg', $intConfigID); } - if ($intReturn == 0) { + if ($intReturn === 0) { $myVisClass->processMessage(translate('The assigned, no longer used configuration files ' - . 'were deleted successfully!'), $strInfoMessage); - $myDataClass->writeLog(translate('Host file deleted:'). ' ' .$chkTfValue1. '.cfg'); + . 'were deleted successfully!'), $strInfoMessage); + $myDataClass->writeLog(translate('Host file deleted:') . ' ' . $chkTfValue1 . '.cfg'); + } else if ($chkDomainId === 0) { + $myVisClass->processMessage(translate('Common files cannot be removed from target ' + . 'systems - please check manually'), $strErrorMessage); } else { - if ($chkDomainId == 0) { - $myVisClass->processMessage(translate('Common files cannot be removed from target ' - . 'systems - please check manually'), $strErrorMessage); - } else { - $myVisClass->processMessage(translate('Errors while deleting the old configuration ' - . 'file - please check!:'), $strErrorMessage); - $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); - } + $myVisClass->processMessage(translate('Errors while deleting the old configuration ' + . 'file - please check!:'), $strErrorMessage); + $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } } } - // - // Insert/update session data for templates - // ======================================== - if ($chkModus == 'modify') { - $strSQL = 'DELETE FROM `tbl_lnkHostToHosttemplate` WHERE `idMaster`=' .$chkDataId; - $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn != 0) { + /* + Insert/update session data for templates + */ + if ($chkModus === 'modify') { + $strSQL = 'DELETE FROM `tbl_lnkHostToHosttemplate` WHERE `idMaster`=' . $chkDataId; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } if (isset($_SESSION['templatedefinition']) && is_array($_SESSION['templatedefinition']) && - (count($_SESSION['templatedefinition']) != 0)) { + (count($_SESSION['templatedefinition']) !== 0)) { $intSortId = 1; - /** @noinspection ForeachSourceInspection */ foreach ($_SESSION['templatedefinition'] as $elem) { - if ($elem['status'] == 0) { - $strSQL = 'INSERT INTO `tbl_lnkHostToHosttemplate` (`idMaster`,`idSlave`,`idTable`, ' - . "`idSort`) VALUES ($chkDataId,".$elem['idSlave']. ',' .$elem['idTable']. ', ' - . $intSortId. ')'; - $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn != 0) { + if ((int)$elem['status'] === 0) { + $strSQL = 'INSERT INTO `tbl_lnkHostToHosttemplate` (`idMaster`,`idSlave`,`idTable`, ' + . "`idSort`) VALUES ($chkDataId," . $elem['idSlave'] . ',' . $elem['idTable'] . ', ' + . $intSortId . ')'; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } $intSortId++; } } - // - // Insert/update session data for free variables - // ============================================= - if ($chkModus == 'modify') { - $strSQL = 'SELECT * FROM `tbl_lnkHostToVariabledefinition` WHERE `idMaster`=' .$chkDataId; - $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($booReturn == false) { + /* + Insert/update session data for free variables + */ + if ($chkModus === 'modify') { + $strSQL = 'SELECT * FROM `tbl_lnkHostToVariabledefinition` WHERE `idMaster`=' . $chkDataId; + $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); + if ($booReturn === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($intDataCount != 0) { + if ($intDataCount !== 0) { foreach ($arrData as $elem) { - $strSQL = 'DELETE FROM `tbl_variabledefinition` WHERE `id`=' .$elem['idSlave']; - $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn != 0) { + $strSQL = 'DELETE FROM `tbl_variabledefinition` WHERE `id`=' . $elem['idSlave']; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } } - $strSQL = 'DELETE FROM `tbl_lnkHostToVariabledefinition` WHERE `idMaster`=' .$chkDataId; + $strSQL = 'DELETE FROM `tbl_lnkHostToVariabledefinition` WHERE `idMaster`=' . $chkDataId; $intReturn1 = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - $strSQL = 'UPDATE `tbl_host` SET `use_variables`=0 WHERE `id`=' .$chkDataId; + $strSQL = 'UPDATE `tbl_host` SET `use_variables`=0 WHERE `id`=' . $chkDataId; $intReturn2 = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } if (isset($_SESSION['variabledefinition']) && is_array($_SESSION['variabledefinition']) && - (count($_SESSION['variabledefinition']) != 0)) { + (count($_SESSION['variabledefinition']) !== 0)) { $intCountVariable = 0; - /** @noinspection ForeachSourceInspection */ foreach ($_SESSION['variabledefinition'] as $elem) { - if ($elem['status'] == 0) { - $strSQL = 'INSERT INTO `tbl_variabledefinition` (`name`,`value`,`last_modified`) ' - . "VALUES ('".$elem['definition']."','".$elem['range']."',now())"; + if ((int)$elem['status'] === 0) { + $strSQL = 'INSERT INTO `tbl_variabledefinition` (`name`,`value`,`last_modified`) ' + . "VALUES ('" . $elem['definition'] . "','" . $elem['range'] . "',now())"; $intReturn1 = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - $strSQL = 'INSERT INTO `tbl_lnkHostToVariabledefinition` (`idMaster`,`idSlave`) ' - . "VALUES ($chkDataId,$intInsertId)"; + $strSQL = 'INSERT INTO `tbl_lnkHostToVariabledefinition` (`idMaster`,`idSlave`) ' + . "VALUES ($chkDataId,$intInsertId)"; $intReturn2 = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if (($intReturn1 == 0) && ($intReturn2 == 0)) { + if (($intReturn1 === 0) && ($intReturn2 === 0)) { $intCountVariable++; } } } - if ($intCountVariable != 0) { - $strSQL = 'UPDATE `tbl_host` SET `use_variables`=1 WHERE `id`=' .$chkDataId; + if ($intCountVariable !== 0) { + $strSQL = 'UPDATE `tbl_host` SET `use_variables`=1 WHERE `id`=' . $chkDataId; $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } } - // - // Insert/Update service <-> host relations - // ======================================== - // Update service table last modified date - $strSQL = 'SELECT `idMaster` FROM `tbl_lnkServiceToHost` WHERE `idSlave`=' .$chkDataId; + /* + Insert/Update service <-> host relations + */ + /* Update service table last modified date */ + $strSQL = 'SELECT `idMaster` FROM `tbl_lnkServiceToHost` WHERE `idSlave`=' . $chkDataId; $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($intDataCount != 0) { + if ($intDataCount !== 0) { foreach ($arrData as $elem) { - $strSQL = 'UPDATE `tbl_service` SET `last_modified` = NOW() WHERE `id`=' .$elem['idMaster']; + $strSQL = 'UPDATE `tbl_service` SET `last_modified` = NOW() WHERE `id`=' . $elem['idMaster']; $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } } - // Remove any link data from host to service - $strSQL = 'DELETE FROM `tbl_lnkServiceToHost` WHERE `idSlave`=' .$chkDataId; + /* Remove any link data from host to service */ + $strSQL = 'DELETE FROM `tbl_lnkServiceToHost` WHERE `idSlave`=' . $chkDataId; $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } if (is_array($chkMselValue5)) { foreach ($chkMselValue5 as $elem) { - if ($elem != '') { + if ($elem !== '') { $intExclude = 0; if (0 === strpos($elem, 'e')) { $intExclude = 1; @@ -354,22 +482,22 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce $strSQL1 = 'INSERT INTO `tbl_lnkServiceToHost` (`idMaster`,`idSlave`,`exclude`) ' . "VALUES ($elem,$chkDataId,$intExclude)"; $intReturn1 = $myDataClass->dataInsert($strSQL1, $intInsertId); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - // Update service table last modified date + /* Update service table last modified date */ $strSQL2 = 'UPDATE `tbl_service` SET `last_modified` = NOW() WHERE `id`=' . $elem; $intReturn2 = $myDataClass->dataInsert($strSQL2, $intInsertId); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - // Check if Service ID is not 0 - $strSQL3 = "SELECT `$preKeyField` FROM `tbl_service` WHERE `id`=$elem"; + /* Check if Service ID is not 0 */ + $strSQL3 = "SELECT `" . $preKeyField . "` FROM `tbl_service` WHERE `id`=$elem"; $strResult3 = $myDBClass->getFieldData($strSQL3); - if ($strResult3 == 0) { - $strSQL = "UPDATE `tbl_service` SET `$preKeyField`=1 WHERE `id`=$elem"; + if ((int)$strResult3 === 0) { + $strSQL = "UPDATE `tbl_service` SET ` `" . $preKeyField . "`=1 WHERE `id`=$elem"; $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } @@ -388,93 +516,91 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } $chkModus = 'display'; } -if ($chkModus != 'add') { +if ($chkModus !== 'add') { $chkModus = 'display'; } -// -// Singe data form -// =============== -if ($chkModus == 'add') { +/* +Singe data form +*/ +if ($chkModus === 'add') { $conttp->setVariable('TITLE', translate('Define hosts (hosts.cfg)')); - // Do not show modified time list + /* Do not show modified time list */ $intNoTime = 1; - // Process template fields + /* Process template fields */ $strWhere = ''; - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - $strWhere = 'AND `id` <> ' .$arrModifyData['id']; + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + $strWhere = 'AND `id` <> ' . $arrModifyData['id']; } - $strSQL1 = 'SELECT `id`,`template_name`, `active` ' . - "FROM `tbl_hosttemplate` WHERE $strDomainWhere2 ORDER BY `template_name`"; + $strSQL1 = 'SELECT `id`,`template_name`, `active`, `config_id` ' . + "FROM `tbl_hosttemplate` WHERE $strDomainWhere2 ORDER BY `template_name`"; $booReturn1 = $myDBClass->hasDataArray($strSQL1, $arrDataTpl, $intDataCountTpl); - if ($booReturn == false) { + if ($booReturn1 === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($intDataCountTpl != 0) { - /** @var array $arrDataTpl */ + if ($intDataCountTpl !== 0) { foreach ($arrDataTpl as $elem) { - if ($elem['active'] == 0) { + if ($elem['active'] === 0) { $strActive = ' [inactive]'; $conttp->setVariable('SPECIAL_STYLE', 'inactive_option'); } else { $strActive = ''; - $conttp->setVariable('SPECIAL_STYLE', ''); + $conttp->setVariable('SPECIAL_STYLE'); } - $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem['template_name'], ENT_QUOTES, 'UTF-8'). - $strActive); - $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id']. '::1'); + if ((int)$elem['config_id'] === 0) { + $strCommon = ' [common]'; + } else { + $strCommon = ''; + } + $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem['template_name'], ENT_QUOTES) . + $strActive . $strCommon); + $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id'] . '::1'); + /** @noinspection DisconnectedForeachInstructionInspection */ $conttp->parse('template'); } } - $strSQL2 = 'SELECT `id`, `name`, `active` ' - . "FROM `$preTableName` WHERE `name` <> '' $strWhere AND $strDomainWhere ORDER BY `name`"; + $strSQL2 = 'SELECT `id`, `name`, `active` ' + . "FROM `$preTableName` WHERE `name` <> '' $strWhere AND $strDomainWhere ORDER BY `name`"; $booReturn2 = $myDBClass->hasDataArray($strSQL2, $arrDataHpl, $intDataCountHpl); - if ($booReturn == false) { + if ($booReturn2 === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($intDataCountHpl != 0) { - /** @var array $arrDataHpl */ + if ($intDataCountHpl !== 0) { foreach ($arrDataHpl as $elem) { - if ($elem['active'] == 0) { + if ($elem['active'] === 0) { $strActive = ' [inactive]'; $conttp->setVariable('SPECIAL_STYLE', 'inactive_option'); } else { $strActive = ''; - $conttp->setVariable('SPECIAL_STYLE', ''); + $conttp->setVariable('SPECIAL_STYLE'); } - $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem['name'], ENT_QUOTES, 'UTF-8').$strActive); - $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id']. '::2'); + $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem['name'], ENT_QUOTES) . $strActive); + $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id'] . '::2'); + /** @noinspection DisconnectedForeachInstructionInspection */ $conttp->parse('template'); } } - // Process host selection field - if (isset($arrModifyData['parents'])) { - $intFieldId = $arrModifyData['parents']; + if ((int)$SETS['performance']['parents'] === 1) { + /* Process host selection field */ + $intFieldId = $arrModifyData['parents'] ?? 0; + $intKeyId = $arrModifyData['id'] ?? 0; + $intReturn3 = $myVisClass->parseSelectMulti( + $preTableName, + $preKeyField, + 'host_parents', + 'tbl_lnkHostToHost', + 0, + $intFieldId, + $intKeyId + ); + if ($intReturn3 !== 0) { + $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); + } + $conttp->setVariable('PARENTS_VISIBLE', 'elementShow'); } else { - $intFieldId = 0; - } - if (isset($arrModifyData['id'])) { - $intKeyId = $arrModifyData['id']; - } else { - $intKeyId = 0; - } - $intReturn3 = $myVisClass->parseSelectMulti( - $preTableName, - $preKeyField, - 'host_parents', - 'tbl_lnkHostToHost', - 0, - $intFieldId, - $intKeyId - ); - if ($intReturn3 != 0) { - $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); - } - // Process hostgroup selection field - if (isset($arrModifyData['hostgroups'])) { - $intFieldId = $arrModifyData['hostgroups']; - } else { - $intFieldId = 0; + $conttp->setVariable('PARENTS_VISIBLE', 'elementHide'); } + /* Process hostgroup selection field */ + $intFieldId = $arrModifyData['hostgroups'] ?? 0; $intReturn4 = $myVisClass->parseSelectMulti( 'tbl_hostgroup', 'hostgroup_name', @@ -483,56 +609,40 @@ if ($chkModus == 'add') { 0, $intFieldId ); - if ($intReturn4 != 0) { + if ($intReturn4 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process check command selection field - if (isset($arrModifyData['check_command']) && ($arrModifyData['check_command'] != '')) { + /* Process check command selection field */ + if (isset($arrModifyData['check_command']) && ($arrModifyData['check_command'] !== '')) { $arrCommand = explode('!', $arrModifyData['check_command']); $intFieldId = $arrCommand[0]; } else { $intFieldId = 0; } $intReturn5 = $myVisClass->parseSelectSimple('tbl_command', 'command_name', 'hostcommand', 2, $intFieldId); - if ($intReturn5 != 0) { + if ($intReturn5 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process check period selection field - if (isset($arrModifyData['check_period'])) { - $intFieldId = $arrModifyData['check_period']; - } else { - $intFieldId = 0; - } + /* Process check period selection field */ + $intFieldId = $arrModifyData['check_period'] ?? 0; $intReturn6 = $myVisClass->parseSelectSimple('tbl_timeperiod', 'timeperiod_name', 'checkperiod', 1, $intFieldId); - if ($intReturn6 != 0) { + if ($intReturn6 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['notification_period'])) { - $intFieldId = $arrModifyData['notification_period']; - } else { - $intFieldId = 0; - } + $intFieldId = $arrModifyData['notification_period'] ?? 0; $intReturn7 = $myVisClass->parseSelectSimple('tbl_timeperiod', 'timeperiod_name', 'notifyperiod', 1, $intFieldId); - if ($intReturn7 != 0) { + if ($intReturn7 !== 0) { $myVisClass->processMessage(translate('Attention, no time periods defined!'), $strDBWarning); $intDataWarning = 1; } - // Process event handler selection field - if (isset($arrModifyData['event_handler'])) { - $intFieldId = $arrModifyData['event_handler']; - } else { - $intFieldId = 0; - } + /* Process event handler selection field */ + $intFieldId = $arrModifyData['event_handler'] ?? 0; $intReturn8 = $myVisClass->parseSelectSimple('tbl_command', 'command_name', 'eventhandler', 1, $intFieldId); - if ($intReturn8 != 0) { + if ($intReturn8 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process contact and contact group selection field - if (isset($arrModifyData['contacts'])) { - $intFieldId = $arrModifyData['contacts']; - } else { - $intFieldId = 0; - } + /* Process contact and contact group selection field */ + $intFieldId = $arrModifyData['contacts'] ?? 0; $intReturn9 = $myVisClass->parseSelectMulti( 'tbl_contact', 'contact_name', @@ -541,14 +651,10 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn9 != 0) { + if ($intReturn9 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['contact_groups'])) { - $intFieldId = $arrModifyData['contact_groups']; - } else { - $intFieldId = 0; - } + $intFieldId = $arrModifyData['contact_groups'] ?? 0; $intReturn10 = $myVisClass->parseSelectMulti( 'tbl_contactgroup', 'contactgroup_name', @@ -557,24 +663,20 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn10 != 0) { + if ($intReturn10 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (($intReturn8 != 0) && ($intReturn10 != 0)) { + if (($intReturn8 !== 0) && ($intReturn10 !== 0)) { $myVisClass->processMessage(translate('Attention, no contact groups defined!'), $strDBWarning); $intDataWarning = 1; } - // Process access group selection field - if (isset($arrModifyData['access_group'])) { - $intFieldId = $arrModifyData['access_group']; - } else { - $intFieldId = 0; - } + /* Process access group selection field */ + $intFieldId = $arrModifyData['access_group'] ?? 0; $intReturn11 = $myVisClass->parseSelectSimple('tbl_group', 'groupname', 'acc_group', 0, $intFieldId); - if ($intReturn11 != 0) { + if ($intReturn11 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process service selection field + /* Process service selection field */ if (isset($arrModifyData['contacts'])) { $intFieldId = $arrModifyData['id']; } else { @@ -588,107 +690,130 @@ if ($chkModus == 'add') { 0, $intFieldId ); - if ($intReturn12 != 0) { + if ($intReturn12 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Initial add/modify form definitions + /* Initial add/modify form definitions */ $strChbFields = 'ACE,PCE,FRE,OBS,EVH,FLE,STI,NSI,PED,NOE,PAR,HOG,COT,COG,TPL'; $myContentClass->addFormInit($conttp, $strChbFields); - if ($intDataWarning == 1) { - $conttp->setVariable('WARNING', $strDBWarning. '
' .translate('Saving not possible!')); + if ($intDataWarning === 1) { + $conttp->setVariable('WARNING', $strDBWarning . '
' . translate('Saving not possible!')); } if ($intVersion < 3) { $conttp->setVariable('VERSION_20_VALUE_MUST', 'mselValue1,'); } - // Insert data from database in "modify" mode - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - // Check relation information to find out locked configuration datasets + /* Insert data from database in "modify" mode */ + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + /* Check relation information to find out locked configuration datasets */ $intLocked = $myDataClass->infoRelation($preTableName, $arrModifyData['id'], $preKeyField); $myVisClass->processMessage($myDataClass->strInfoMessage, $strRelMessage); - $strInfo = '
' .translate('Entry cannot be activated because it is used by ' - . 'another configuration'). ':'; - $strInfo .= '
' .$strRelMessage. ''; - // Process data + $strInfo = '
' . translate('Entry cannot be activated because it is used by ' + . 'another configuration') . ':'; + $strInfo .= '
' . $strRelMessage . ''; + /* Process data */ $myContentClass->addInsertData($conttp, $arrModifyData, $intLocked, $strInfo, $strChbFields); - $conttp->setVariable('DAT_ACE' .$arrModifyData['active_checks_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_PCE' .$arrModifyData['passive_checks_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_FRE' .$arrModifyData['check_freshness']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_OBS' .$arrModifyData['obsess_over_host']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_EVH' .$arrModifyData['event_handler_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_FLE' .$arrModifyData['flap_detection_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_STI' .$arrModifyData['retain_status_information']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_NSI' .$arrModifyData['retain_nonstatus_information']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_PED' .$arrModifyData['process_perf_data']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_NOE' .$arrModifyData['notifications_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_PAR' .$arrModifyData['parents_tploptions']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_HOG' .$arrModifyData['hostgroups_tploptions']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_COT' .$arrModifyData['contacts_tploptions']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_COG' .$arrModifyData['contact_groups_tploptions']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_TPL' .$arrModifyData['use_template_tploptions']. '_CHECKED', 'checked'); - // Special processing for -1 values - write 'null' to integer fields - $strIntegerfelder = 'max_check_attempts,check_interval,retry_interval,freshness_threshold,low_flap_threshold,' - . 'high_flap_threshold,'; + $conttp->setVariable('DAT_ACE' . $arrModifyData['active_checks_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_PCE' . $arrModifyData['passive_checks_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_FRE' . $arrModifyData['check_freshness'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_OBS' . $arrModifyData['obsess_over_host'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_EVH' . $arrModifyData['event_handler_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_FLE' . $arrModifyData['flap_detection_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_STI' . $arrModifyData['retain_status_information'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_NSI' . $arrModifyData['retain_nonstatus_information'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_PED' . $arrModifyData['process_perf_data'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_NOE' . $arrModifyData['notifications_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_PAR' . $arrModifyData['parents_tploptions'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_HOG' . $arrModifyData['hostgroups_tploptions'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_COT' . $arrModifyData['contacts_tploptions'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_COG' . $arrModifyData['contact_groups_tploptions'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_TPL' . $arrModifyData['use_template_tploptions'] . '_CHECKED', 'checked'); + /* Special processing for -1 values - write 'null' to integer fields */ + $strIntegerfelder = 'max_check_attempts,check_interval,retry_interval,freshness_threshold,low_flap_threshold,' + . 'high_flap_threshold,'; $strIntegerfelder .= 'notification_interval,first_notification_delay'; foreach (explode(',', $strIntegerfelder) as $elem) { - if ($arrModifyData[$elem] == -1) { - $conttp->setVariable('DAT_' .strtoupper($elem), 'null'); + if ($arrModifyData[$elem] === -1) { + $conttp->setVariable('DAT_' . strtoupper($elem), 'null'); } } - if ($arrModifyData['check_command'] != '') { + if ($arrModifyData['check_command'] !== '') { $arrArgument = explode('!', $arrModifyData['check_command']); foreach ($arrArgument as $key => $value) { - if ($key == 0) { - $conttp->setVariable('IFRAME_SRC', $_SESSION['SETS']['path']['base_url']. - 'admin/commandline.php?cname=' .$value); + if ($key === 0) { + $conttp->setVariable('IFRAME_SRC', $_SESSION['SETS']['path']['base_url'] . + 'admin/commandline.php?cname=' . $value); } else { $value1 = str_replace('::bang::', '!', $value); $value2 = str_replace('::back::', "\\", $value1); - $conttp->setVariable('DAT_ARG' .$key, htmlentities($value2, ENT_QUOTES, 'UTF-8')); + $conttp->setVariable('DAT_ARG' . $key, htmlentities($value2, ENT_QUOTES, 'UTF-8')); } } } - // Process option fields + /* Process option fields */ foreach (explode(',', $arrModifyData['initial_state']) as $elem) { - $conttp->setVariable('DAT_IS' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_IS' . strtoupper($elem) . '_CHECKED', 'checked'); } foreach (explode(',', $arrModifyData['flap_detection_options']) as $elem) { - $conttp->setVariable('DAT_FL' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_FL' . strtoupper($elem) . '_CHECKED', 'checked'); } foreach (explode(',', $arrModifyData['notification_options']) as $elem) { - $conttp->setVariable('DAT_NO' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_NO' . strtoupper($elem) . '_CHECKED', 'checked'); } foreach (explode(',', $arrModifyData['stalking_options']) as $elem) { - $conttp->setVariable('DAT_ST' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_ST' . strtoupper($elem) . '_CHECKED', 'checked'); } } $conttp->parse('datainsert'); $conttp->show('datainsert'); } -// -// List view -// ========== -if ($chkModus == 'display') { - // Initial list view definitions +/* +List view +*/ +if ($chkModus === 'display') { + /* Initial list view definitions */ $myContentClass->listViewInit($mastertp); $mastertp->setVariable('TITLE', translate('Define hosts (hosts.cfg)')); $mastertp->setVariable('FIELD_1', translate('Host name')); $mastertp->setVariable('FIELD_2', translate('Description')); - // Process filter string - if ($_SESSION['search'][$preSearchSession] != '') { - $strSearchTxt = $_SESSION['search'][$preSearchSession]; - $strSearchWhere = "AND (`$preKeyField` LIKE '%".$strSearchTxt."%' OR `alias` LIKE '%".$strSearchTxt."%' OR " - . "`display_name` LIKE '%".$strSearchTxt."%' OR `address` LIKE '%".$strSearchTxt."%')"; + /* Process filter string and filter */ + $strSearchWhere = ''; + if ($_SESSION['search'][$preSearchSession] !== '') { + $strSearchTxt = $_SESSION['search'][$preSearchSession]; + $strSearchWhere .= "AND (`$preKeyField` LIKE '%" . $strSearchTxt . "%' OR `alias` LIKE '%" . $strSearchTxt . "%' OR " + . "`display_name` LIKE '%" . $strSearchTxt . "%' OR `address` LIKE '%" . $strSearchTxt . "%') "; } - // Row sorting + if ($_SESSION['filter'][$preSearchSession]['registered'] !== '') { + $intRegistered = (int)$_SESSION['filter'][$preSearchSession]['registered']; + if ($intRegistered === 1) { + $strSearchWhere .= "AND `register` = '1' "; + } + if ($intRegistered === 2) { + $strSearchWhere .= "AND `register` = '0' "; + } + $mastertp->setVariable('SEL_REGFILTER_' . $intRegistered . '_SELECTED', 'selected'); + } + if ($_SESSION['filter'][$preSearchSession]['active'] !== '') { + $intActivated = (int)$_SESSION['filter'][$preSearchSession]['active']; + if ($intActivated === 1) { + $strSearchWhere .= "AND `active` = '1' "; + } + if ($intActivated === 2) { + $strSearchWhere .= "AND `active` = '0' "; + } + $mastertp->setVariable('SEL_ACTIVEFILTER_' . $intActivated . '_SELECTED', 'selected'); + } + /* Row sorting */ $strOrderString = "ORDER BY `config_id`, `$preKeyField` $hidSortDir"; - if ($hidSortBy == 2) { + if ($hidSortBy === 2) { $strOrderString = "ORDER BY `config_id`, `alias` $hidSortDir"; } - // Count datasets - $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere " - . "AND `access_group` IN ($strAccess)"; + /* Count datasets */ + $intLineCount = 0; + /** @noinspection SqlResolve */ + $strSQL = "SELECT count(*) AS `number` FROM `" . $preTableName . "` WHERE $strDomainWhere $strSearchWhere " + . "AND `access_group` IN ($strAccess)"; $booReturn1 = $myDBClass->hasSingleDataset($strSQL, $arrDataLinesCount); - if ($booReturn1 == false) { + if ($booReturn1 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { @@ -697,23 +822,23 @@ if ($chkModus == 'display') { $chkLimit = 0; } } - // Get datasets - $strSQL = "SELECT `id`, `$preKeyField`, `alias`, `register`, `active`, `last_modified`, `config_id`, " - . "`access_group` FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND `access_group` " - . "IN ($strAccess) $strOrderString LIMIT $chkLimit,".$SETS['common']['pagelines']; + /* Get datasets */ + $strSQL = "SELECT `id`, `$preKeyField`, `alias`, `register`, `active`, `last_modified`, `config_id`, " + . "`access_group` FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND `access_group` " + . "IN ($strAccess) $strOrderString LIMIT $chkLimit," . $SETS['common']['pagelines']; $booReturn2 = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - if ($booReturn2 == false) { + if ($booReturn2 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - // Process data - $myContentClass->listData($mastertp, $arrDataLines, $intDataCount, $intLineCount, $preKeyField, 'alias', 0); - if ($myContentClass->strErrorMessage != '') { + /* Process data */ + $myContentClass->listData($mastertp, $arrDataLines, $intDataCount, $intLineCount, $preKeyField, 'alias'); + if ($myContentClass->strErrorMessage !== '') { $myVisClass->processMessage($myContentClass->strErrorMessage, $strErrorMessage); } } -// Show messages -$arrTimeData = array(); +/* Show messages */ +$arrTimeData = array(); $strTimeInfoString = ''; $myContentClass->showMessages( $mastertp, @@ -724,7 +849,7 @@ $myContentClass->showMessages( $strTimeInfoString, $intNoTime ); -// -// Process footer -// ============== -$myContentClass->showFooter($maintp, $setFileVersion); +/* +Process footer +*/ +$myContentClass->showFooter($maintp, $setFileVersion); \ No newline at end of file diff --git a/admin/hosttemplates.php b/admin/hosttemplates.php index 82dd6bd..0b2fc62 100644 --- a/admin/hosttemplates.php +++ b/admin/hosttemplates.php @@ -1,149 +1,265 @@ Application version string + * @var string $chkModus from prepend_adm.php -> Form work mode + * @var int $chkDataId from prepend_adm.php -> Actual dataset id + * @var string $chkSelModify from prepend_adm.php -> Modification selection value + * @var int $hidSortBy from prepend_adm.php -> Sort data by + * @var string $hidSortDir from prepend_adm.php -> Sort data direction (ASC, DESC) + * @var int $chkLimit from prepend_adm.php / settings -> Data set count per page + * @var int $chkDomainId from prepend_adm.php -> Configuration domain id + * @var int $intVersion from prepend_adm.php -> Nagios version + * @var array $SETS Settings array + * @var int $intGlobalWriteAccess from prepend_content.php -> Global admin write access + * @var int $intWriteAccessId from prepend_content.php -> Admin write access to actual dataset id + * @var string $strAccess from prepend_content.php -> List of read access group id's for actual user + * @var string $preSQLCommon2 from prepend_content.php -> Common SQL part 2 + * @var string $strDomainWhere from prepend_adm.php -> Domain selection SQL part with table name + * @var string $chkTfValue1 from prepend_content.php -> Host template name + * @var string $chkTfValue2 from prepend_content.php -> Host template description + * @var string $chkTfValue3 from prepend_content.php -> Notes + * @var string $chkTfValue4 from prepend_content.php -> VRML image + * @var string $chkTfValue5 from prepend_content.php -> Notes URL + * @var string $chkTfValue6 from prepend_content.php -> Status image + * @var string $chkTfValue7 from prepend_content.php -> Action URL + * @var string $chkTfValue8 from prepend_content.php -> Icon image + * @var string $chkTfValue9 from prepend_content.php -> 2D coords + * @var string $chkTfValue10 from prepend_content.php -> Icon image alt text + * @var string $chkTfValue11 from prepend_content.php -> 3D coords + * @var int $chkSelValue1 from prepend_content.php -> Check command + * @var int $chkSelValue2 from prepend_content.php -> Check period + * @var int $chkSelValue3 from prepend_content.php -> Event handler + * @var int $chkSelValue4 from prepend_content.php -> Notification period + * @var array $chkMselValue1 from prepend_content.php -> Parents + * @var array $chkMselValue2 from prepend_content.php -> Host groups + * @var array $chkMselValue3 from prepend_content.php -> Contacts + * @var array $chkMselValue4 from prepend_content.php -> Contact groups + * @var int $intMselValue1 from prepend_content.php -> Parents multiselect status value + * @var int $intMselValue2 from prepend_content.php -> Host groups multiselect status value + * @var int $intMselValue3 from prepend_content.php -> Contacts multiselect status value + * @var int $intMselValue4 from prepend_content.php -> Contact groups multiselect status value + * @var string $chkChbGr1a from prepend_content.php -> Notification options (d) + * @var string $chkChbGr1b from prepend_content.php -> Notification options (u) + * @var string $chkChbGr1c from prepend_content.php -> Notification options (r) + * @var string $chkChbGr1d from prepend_content.php -> Notification options (f) + * @var string $chkChbGr1e from prepend_content.php -> Notification options (w) + * @var string $chkChbGr2a from prepend_content.php -> Initial state (o) + * @var string $chkChbGr2b from prepend_content.php -> Initial state (d) + * @var string $chkChbGr2c from prepend_content.php -> Initial state (u) + * @var string $chkChbGr3a from prepend_content.php -> Flap detection options (o) + * @var string $chkChbGr3b from prepend_content.php -> Flap detection options (d) + * @var string $chkChbGr3c from prepend_content.php -> Flap detection options (u) + * @var string $chkChbGr4a from prepend_content.php -> Stalking options (o) + * @var string $chkChbGr4b from prepend_content.php -> Stalking options (d) + * @var string $chkChbGr4c from prepend_content.php -> Stalking options (u) + * @var int $chkRadValue1 from prepend_content.php -> Parents multiselect options + * @var int $chkRadValue2 from prepend_content.php -> Hosts groups multiselect options + * @var int $chkRadValue3 from prepend_content.php -> Contacts multiselect options + * @var int $chkRadValue4 from prepend_content.php -> Contact groups multiselect options + * @var int $chkRadValue5 from prepend_content.php -> Active checks + * @var int $chkRadValue6 from prepend_content.php -> Passive checks + * @var int $chkRadValue7 from prepend_content.php -> Freshness checks + * @var int $chkRadValue8 from prepend_content.php -> Obsess over service + * @var int $chkRadValue9 from prepend_content.php -> Event handler + * @var int $chkRadValue10 from prepend_content.php -> Flap detection + * @var int $chkRadValue11 from prepend_content.php -> Retain status information + * @var int $chkRadValue12 from prepend_content.php -> Retain non-status information + * @var int $chkRadValue13 from prepend_content.php -> Process performance data + * @var int $chkRadValue14 from prepend_content.php -> Notification + * @var string $chkTfNullVal1 from prepend_content.php -> Retry interval + * @var string $chkTfNullVal2 from prepend_content.php -> Max check attempts + * @var string $chkTfNullVal3 from prepend_content.php -> Check interval + * @var string $chkTfNullVal4 from prepend_content.php -> Freshness threshold + * @var string $chkTfNullVal5 from prepend_content.php -> Low flap threshold + * @var string $chkTfNullVal6 from prepend_content.php -> High flap threshold + * @var string $chkTfNullVal7 from prepend_content.php -> Notification interval + * @var string $chkTfNullVal8 from prepend_content.php -> First notification delay + * @var string $chkTfNullVal9 from prepend_content.php -> Importance + * @var int $intVariables from prepend_content.php -> Form uses variable definitions + * @var int $intTemplates from prepend_content.php -> Form uses template definitions + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 12; -$preContent = 'admin/hosttemplates.htm.tpl'; -$preListTpl = 'admin/datalist.htm.tpl'; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 12; +$preContent = 'admin/hosttemplates.htm.tpl'; +$preListTpl = 'admin/datalist.htm.tpl'; $preSearchSession = 'hosttemplate'; -$preTableName = 'tbl_hosttemplate'; -$preKeyField = 'template_name'; -$preAccess = 1; -$preFieldvars = 1; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Data processing -// =============== -$strNO = substr($chkChbGr1a.$chkChbGr1b.$chkChbGr1c.$chkChbGr1d.$chkChbGr1e, 0, -1); -$strIS = substr($chkChbGr2a.$chkChbGr2b.$chkChbGr2c, 0, -1); -$strFL = substr($chkChbGr3a.$chkChbGr3b.$chkChbGr3c, 0, -1); -$strST = substr($chkChbGr4a.$chkChbGr4b.$chkChbGr4c, 0, -1); -if ($chkSelValue1 != '') { +$preTableName = 'tbl_hosttemplate'; +$preKeyField = 'template_name'; +$preAccess = 1; +$preFieldvars = 1; +$strErrorMessage = ''; +$strInfoMessage = ''; +$strConsistMessage = ''; +$strDBWarning = ''; +$intDataWarning = 0; +$intRet1 = 0; +$intRet2 = 0; +$intRet3 = 0; +$intRet4 = 0; +$intNoTime = 0; +/* +Default values for form variables +*/ +if (!isset($intMselValue1)) { + $intMselValue1 = 0; +} +if (!isset($intMselValue2)) { + $intMselValue2 = 0; +} +if (!isset($intMselValue3)) { + $intMselValue3 = 0; +} +if (!isset($intMselValue4)) { + $intMselValue4 = 0; +} +/* +Include preprocessing files +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Data processing +*/ +$strNO = substr($chkChbGr1a . $chkChbGr1b . $chkChbGr1c . $chkChbGr1d . $chkChbGr1e, 0, -1); +$strIS = substr($chkChbGr2a . $chkChbGr2b . $chkChbGr2c, 0, -1); +$strFL = substr($chkChbGr3a . $chkChbGr3b . $chkChbGr3c, 0, -1); +$strST = substr($chkChbGr4a . $chkChbGr4b . $chkChbGr4c, 0, -1); +if ($chkSelValue1 !== 0) { for ($i = 1; $i <= 8; $i++) { - $tmpVar = 'chkTfArg'.$i; + $tmpVar = 'chkTfArg' . $i; $$tmpVar = str_replace('!', '::bang::', $$tmpVar); - if ($$tmpVar != '') { - $chkSelValue1 .= '!' .$$tmpVar; + if ($$tmpVar !== '') { + $chkSelValue1 .= '!' . $$tmpVar; } } } -// -// Add or modify data -// ================== -if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAccess == 0)) { +/* +Add or modify data +*/ +if ((($chkModus === 'insert') || ($chkModus === 'modify')) && ($intGlobalWriteAccess === 0)) { $strSQLx = "`$preTableName` SET `$preKeyField`='$chkTfValue1', `alias`='$chkTfValue2', `parents`=$intMselValue1, " - . "`parents_tploptions`=$chkRadValue1, `importance`=$chkTfNullVal9, `hostgroups`=$intMselValue2, " - . "`hostgroups_tploptions`=$chkRadValue2, `check_command`='$chkSelValue1', `use_template`=$intTemplates, " - . "`initial_state`='$strIS', `max_check_attempts`=$chkTfNullVal2, `check_interval`=$chkTfNullVal3, " - . "`retry_interval`=$chkTfNullVal1, `active_checks_enabled`=$chkRadValue5, " - . "`passive_checks_enabled`=$chkRadValue6, `check_period`=$chkSelValue2, " - . "`obsess_over_host`=$chkRadValue8, `check_freshness`=$chkRadValue7, " - . "`freshness_threshold`=$chkTfNullVal4, `event_handler`=$chkSelValue3, " - . "`event_handler_enabled`=$chkRadValue9, `low_flap_threshold`=$chkTfNullVal5, " - . "`high_flap_threshold`=$chkTfNullVal6, `flap_detection_enabled`=$chkRadValue10, " - . "`flap_detection_options`='$strFL', `process_perf_data`=$chkRadValue13, " - . "`retain_status_information`=$chkRadValue11, `retain_nonstatus_information`=$chkRadValue12, " - . "`contacts`=$intMselValue3, `contacts_tploptions`=$chkRadValue3, `contact_groups`=$intMselValue4, " - . "`contact_groups_tploptions`=$chkRadValue4, `notification_interval`=$chkTfNullVal7, " - . "`notification_period`=$chkSelValue4, `first_notification_delay`=$chkTfNullVal8, " - . "`notification_options`='$strNO', `notifications_enabled`=$chkRadValue14, `stalking_options`='$strST', " - . "`notes`='$chkTfValue3', `notes_url`='$chkTfValue5', `action_url`='$chkTfValue7', " - . "`icon_image`='$chkTfValue8', `icon_image_alt`='$chkTfValue10', `vrml_image`='$chkTfValue4', " - . "`statusmap_image`='$chkTfValue6', `2d_coords`='$chkTfValue9', `3d_coords`='$chkTfValue11', " - . "`use_variables`=$intVariables, $preSQLCommon2"; - if ($chkModus == 'insert') { - $strSQL = 'INSERT INTO ' .$strSQLx; + . "`parents_tploptions`=$chkRadValue1, `importance`=$chkTfNullVal9, `hostgroups`=$intMselValue2, " + . "`hostgroups_tploptions`=$chkRadValue2, `check_command`='$chkSelValue1', `use_template`=$intTemplates, " + . "`initial_state`='$strIS', `max_check_attempts`=$chkTfNullVal2, `check_interval`=$chkTfNullVal3, " + . "`retry_interval`=$chkTfNullVal1, `active_checks_enabled`=$chkRadValue5, " + . "`passive_checks_enabled`=$chkRadValue6, `check_period`=$chkSelValue2, " + . "`obsess_over_host`=$chkRadValue8, `check_freshness`=$chkRadValue7, " + . "`freshness_threshold`=$chkTfNullVal4, `event_handler`=$chkSelValue3, " + . "`event_handler_enabled`=$chkRadValue9, `low_flap_threshold`=$chkTfNullVal5, " + . "`high_flap_threshold`=$chkTfNullVal6, `flap_detection_enabled`=$chkRadValue10, " + . "`flap_detection_options`='$strFL', `process_perf_data`=$chkRadValue13, " + . "`retain_status_information`=$chkRadValue11, `retain_nonstatus_information`=$chkRadValue12, " + . "`contacts`=$intMselValue3, `contacts_tploptions`=$chkRadValue3, `contact_groups`=$intMselValue4, " + . "`contact_groups_tploptions`=$chkRadValue4, `notification_interval`=$chkTfNullVal7, " + . "`notification_period`=$chkSelValue4, `first_notification_delay`=$chkTfNullVal8, " + . "`notification_options`='$strNO', `notifications_enabled`=$chkRadValue14, `stalking_options`='$strST', " + . "`notes`='$chkTfValue3', `notes_url`='$chkTfValue5', `action_url`='$chkTfValue7', " + . "`icon_image`='$chkTfValue8', `icon_image_alt`='$chkTfValue10', `vrml_image`='$chkTfValue4', " + . "`statusmap_image`='$chkTfValue6', `2d_coords`='$chkTfValue9', `3d_coords`='$chkTfValue11', " + . "`use_variables`=$intVariables, $preSQLCommon2"; + if ($chkModus === 'insert') { + $strSQL = 'INSERT INTO ' . $strSQLx; } else { - $strSQL = 'UPDATE ' .$strSQLx. ' WHERE `id`=' .$chkDataId; + $strSQL = 'UPDATE ' . $strSQLx . ' WHERE `id`=' . $chkDataId; } - if ($intWriteAccessId == 0) { - if ($chkTfValue1 != '') { + if ($intWriteAccessId === 0) { + if ($chkTfValue1 !== '') { $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($chkModus == 'insert') { + if ($chkModus === 'insert') { $chkDataId = $intInsertId; } - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); $myDataClass->updateStatusTable($preTableName); - if ($chkModus == 'insert') { - $myDataClass->writeLog(translate('New host template inserted:'). ' ' .$chkTfValue1); + if ($chkModus === 'insert') { + $myDataClass->writeLog(translate('New host template inserted:') . ' ' . $chkTfValue1); } - if ($chkModus == 'modify') { - $myDataClass->writeLog(translate('Host template modified:'). ' ' .$chkTfValue1); + if ($chkModus === 'modify') { + $myDataClass->writeLog(translate('Host template modified:') . ' ' . $chkTfValue1); } - // - // Insert/update relations - // ======================= - if ($chkModus == 'insert') { - if ($intMselValue1 != 0) { + /* + Insert/update relations + */ + if ($chkModus === 'insert') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataInsertRelation( 'tbl_lnkHosttemplateToHost', $chkDataId, $chkMselValue1 ); } - if (isset($intRet1) && ($intRet1 != 0)) { + if (isset($intRet1) && ($intRet1 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataInsertRelation( 'tbl_lnkHosttemplateToHostgroup', $chkDataId, $chkMselValue2 ); } - if (isset($intRet2) && ($intRet2 != 0)) { + if (isset($intRet2) && ($intRet2 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue3 != 0) { + if ($intMselValue3 !== 0) { $intRet3 = $myDataClass->dataInsertRelation( 'tbl_lnkHosttemplateToContact', $chkDataId, $chkMselValue3 ); } - if (isset($intRet3) && ($intRet3 != 0)) { + if (isset($intRet3) && ($intRet3 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue4 != 0) { + if ($intMselValue4 !== 0) { $intRet4 = $myDataClass->dataInsertRelation( 'tbl_lnkHosttemplateToContactgroup', $chkDataId, $chkMselValue4 ); } - if (isset($intRet4) && ($intRet4 != 0)) { + if (isset($intRet4) && ($intRet4 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - } elseif ($chkModus == 'modify') { - if ($intMselValue1 != 0) { + } elseif ($chkModus === 'modify') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataUpdateRelation( 'tbl_lnkHosttemplateToHost', $chkDataId, @@ -152,10 +268,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet1 = $myDataClass->dataDeleteRelation('tbl_lnkHosttemplateToHost', $chkDataId); } - if ($intRet1 != 0) { + if ($intRet1 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataUpdateRelation( 'tbl_lnkHosttemplateToHostgroup', $chkDataId, @@ -164,10 +280,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet2 = $myDataClass->dataDeleteRelation('tbl_lnkHosttemplateToHostgroup', $chkDataId); } - if ($intRet2 != 0) { + if ($intRet2 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue3 != 0) { + if ($intMselValue3 !== 0) { $intRet3 = $myDataClass->dataUpdateRelation( 'tbl_lnkHosttemplateToContact', $chkDataId, @@ -176,10 +292,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet3 = $myDataClass->dataDeleteRelation('tbl_lnkHosttemplateToContact', $chkDataId); } - if ($intRet3 != 0) { + if ($intRet3 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue4 != 0) { + if ($intMselValue4 !== 0) { $intRet4 = $myDataClass->dataUpdateRelation( 'tbl_lnkHosttemplateToContactgroup', $chkDataId, @@ -188,79 +304,78 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet4 = $myDataClass->dataDeleteRelation('tbl_lnkHosttemplateToContactgroup', $chkDataId); } - if ($intRet4 != 0) { + if ($intRet4 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } - if (($intRet1 + $intRet2 + $intRet3 + $intRet4) != 0) { + if (($intRet1 + $intRet2 + $intRet3 + $intRet4) !== 0) { $strInfoMessage = ''; } - // - // Insert/update session data for templates - // ======================================== - if ($chkModus == 'modify') { - $strSQL = 'DELETE FROM `tbl_lnkHosttemplateToHosttemplate` WHERE `idMaster`=' .$chkDataId; + /* + Insert/update session data for templates + */ + if ($chkModus === 'modify') { + $strSQL = 'DELETE FROM `tbl_lnkHosttemplateToHosttemplate` WHERE `idMaster`=' . $chkDataId; $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } if (isset($_SESSION['templatedefinition']) && is_array($_SESSION['templatedefinition']) && - (count($_SESSION['templatedefinition']) != 0)) { + (count($_SESSION['templatedefinition']) !== 0)) { $intSortId = 1; - /** @noinspection ForeachSourceInspection */ foreach ($_SESSION['templatedefinition'] as $elem) { - if ($elem['status'] == 0) { - $strSQL = 'INSERT INTO `tbl_lnkHosttemplateToHosttemplate` (`idMaster`,`idSlave`, ' - . "`idTable`,`idSort`) VALUES ($chkDataId,".$elem['idSlave']. ', ' - . $elem['idTable']. ',' .$intSortId. ')'; - $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn != 0) { + if ((int)$elem['status'] === 0) { + $strSQL = 'INSERT INTO `tbl_lnkHosttemplateToHosttemplate` (`idMaster`,`idSlave`, ' + . "`idTable`,`idSort`) VALUES ($chkDataId," . $elem['idSlave'] . ', ' + . $elem['idTable'] . ',' . $intSortId . ')'; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } $intSortId++; } } - // - // Insert/update session data for free variables - // ============================================= - if ($chkModus == 'modify') { - $strSQL = 'SELECT * FROM `tbl_lnkHosttemplateToVariabledefinition` WHERE `idMaster`=' - . $chkDataId; + /* + Insert/update session data for free variables + */ + if ($chkModus === 'modify') { + $strSQL = 'SELECT * FROM `tbl_lnkHosttemplateToVariabledefinition` WHERE `idMaster`=' + . $chkDataId; $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($intDataCount != 0) { + if ($intDataCount !== 0) { foreach ($arrData as $elem) { - $strSQL = 'DELETE FROM `tbl_variabledefinition` WHERE `id`=' .$elem['idSlave']; - $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn != 0) { + $strSQL = 'DELETE FROM `tbl_variabledefinition` WHERE `id`=' . $elem['idSlave']; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } } - $strSQL = 'DELETE FROM `tbl_lnkHosttemplateToVariabledefinition` WHERE `idMaster`=' .$chkDataId; + $strSQL = 'DELETE FROM `tbl_lnkHosttemplateToVariabledefinition` WHERE `idMaster`=' . $chkDataId; $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } if (isset($_SESSION['variabledefinition']) && is_array($_SESSION['variabledefinition']) && - (count($_SESSION['variabledefinition']) != 0)) { + (count($_SESSION['variabledefinition']) !== 0)) { foreach ($_SESSION['variabledefinition'] as $elem) { - if ($elem['status'] == 0) { - $strSQL = 'INSERT INTO `tbl_variabledefinition` (`name`,`value`,`last_modified`) ' - . "VALUES ('".$elem['definition']."','".$elem['range']."',now())"; + if ((int)$elem['status'] === 0) { + $strSQL = 'INSERT INTO `tbl_variabledefinition` (`name`,`value`,`last_modified`) ' + . "VALUES ('" . $elem['definition'] . "','" . $elem['range'] . "',now())"; $intReturn1 = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - $strSQL = 'INSERT INTO `tbl_lnkHosttemplateToVariabledefinition` (`idMaster`, ' - . "`idSlave`) VALUES ($chkDataId,$intInsertId)"; + $strSQL = 'INSERT INTO `tbl_lnkHosttemplateToVariabledefinition` (`idMaster`, ' + . "`idSlave`) VALUES ($chkDataId,$intInsertId)"; $intReturn2 = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } @@ -278,76 +393,75 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } $chkModus = 'display'; } -if ($chkModus != 'add') { - $chkModus = 'display'; +if ($chkModus !== 'add') { + $chkModus = 'display'; } -// -// Get date/time of last database and config file manipulation -// =========================================================== +/* +Get date/time of last database and config file manipulation +*/ $intReturn = $myConfigClass->lastModifiedFile($preTableName, $arrTimeData, $strTimeInfoString); -if ($intReturn != 0) { +if ($intReturn !== 0) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } -// -// Singe data form -// =============== -if ($chkModus == 'add') { +/* +Singe data form +*/ +if ($chkModus === 'add') { $conttp->setVariable('TITLE', translate('Host template definition (hosttemplates.cfg)')); - // Do not show modified time list + /* Do not show modified time list */ $intNoTime = 1; - // Process template fields + /* Process template fields */ $strWhere = ''; - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - $strWhere = 'AND `id` <> ' .$arrModifyData['id']; + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + $strWhere = 'AND `id` <> ' . $arrModifyData['id']; } - $strSQL1 = "SELECT `id`,`$preKeyField`, `active` FROM `$preTableName` " - . "WHERE `config_id` = $chkDomainId $strWhere ORDER BY `$preKeyField`"; + /** @noinspection SqlResolve */ + $strSQL1 = "SELECT `id`,`$preKeyField`, `active` FROM `$preTableName` " + . "WHERE `config_id` = $chkDomainId $strWhere ORDER BY `$preKeyField`"; $booReturn1 = $myDBClass->hasDataArray($strSQL1, $arrDataTpl, $intDataCountTpl); - if ($booReturn1 == false) { + if ($booReturn1 === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($intDataCountTpl != 0) { + if ($intDataCountTpl !== 0) { /** @var array $arrDataTpl */ foreach ($arrDataTpl as $elem) { - if ($elem['active'] == 0) { + if ($elem['active'] === 0) { $strActive = ' [inactive]'; $conttp->setVariable('SPECIAL_STYLE', 'inactive_option'); } else { $strActive = ''; - $conttp->setVariable('SPECIAL_STYLE', ''); + $conttp->setVariable('SPECIAL_STYLE'); } - $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem[$preKeyField], ENT_QUOTES, 'UTF-8').$strActive); - $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id']. '::1'); + $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem[$preKeyField], ENT_QUOTES, 'UTF-8') . $strActive); + $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id'] . '::1'); + /** @noinspection DisconnectedForeachInstructionInspection */ $conttp->parse('template'); } } - $strSQL2 = 'SELECT `id`, `name`, `active` FROM `tbl_host` ' - . "WHERE `name` <> '' AND `config_id` = $chkDomainId ORDER BY `name`"; + $strSQL2 = 'SELECT `id`, `name`, `active` FROM `tbl_host` ' + . "WHERE `name` <> '' AND `config_id` = $chkDomainId ORDER BY `name`"; $booReturn2 = $myDBClass->hasDataArray($strSQL2, $arrDataHpl, $intDataCountHpl); - if ($booReturn2 == false) { + if ($booReturn2 === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($intDataCountHpl != 0) { + if ($intDataCountHpl !== 0) { /** @var array $arrDataHpl */ foreach ($arrDataHpl as $elem) { - if ($elem['active'] == 0) { + if ($elem['active'] === 0) { $strActive = ' [inactive]'; $conttp->setVariable('SPECIAL_STYLE', 'inactive_option'); } else { $strActive = ''; - $conttp->setVariable('SPECIAL_STYLE', ''); + $conttp->setVariable('SPECIAL_STYLE'); } - $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem['name'], ENT_QUOTES, 'UTF-8').$strActive); - $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id']. '::2'); + $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem['name'], ENT_QUOTES, 'UTF-8') . $strActive); + $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id'] . '::2'); + /** @noinspection DisconnectedForeachInstructionInspection */ $conttp->parse('template'); } } - // Process host selection field - if (isset($arrModifyData['parents'])) { - $intFieldId = $arrModifyData['parents']; - } else { - $intFieldId = 0; - } + /* Process host selection field */ + $intFieldId = $arrModifyData['parents'] ?? 0; $intReturn1 = $myVisClass->parseSelectMulti( 'tbl_host', 'host_name', @@ -356,15 +470,11 @@ if ($chkModus == 'add') { 0, $intFieldId ); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process hostgroup selection field - if (isset($arrModifyData['hostgroups'])) { - $intFieldId = $arrModifyData['hostgroups']; - } else { - $intFieldId = 0; - } + /* Process hostgroup selection field */ + $intFieldId = $arrModifyData['hostgroups'] ?? 0; $intReturn2 = $myVisClass->parseSelectMulti( 'tbl_hostgroup', 'hostgroup_name', @@ -373,55 +483,39 @@ if ($chkModus == 'add') { 0, $intFieldId ); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process check command selection field - if (isset($arrModifyData['check_command']) && ($arrModifyData['check_command'] != '')) { + /* Process check command selection field */ + if (isset($arrModifyData['check_command']) && ($arrModifyData['check_command'] !== '')) { $arrCommand = explode('!', $arrModifyData['check_command']); $intFieldId = $arrCommand[0]; } else { $intFieldId = 0; } $intReturn3 = $myVisClass->parseSelectSimple('tbl_command', 'command_name', 'hostcommand', 1, $intFieldId); - if ($intReturn3 != 0) { + if ($intReturn3 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process check period selection field - if (isset($arrModifyData['check_period'])) { - $intFieldId = $arrModifyData['check_period']; - } else { - $intFieldId = 0; - } + /* Process check period selection field */ + $intFieldId = $arrModifyData['check_period'] ?? 0; $intReturn4 = $myVisClass->parseSelectSimple('tbl_timeperiod', 'timeperiod_name', 'checkperiod', 1, $intFieldId); - if ($intReturn4 != 0) { + if ($intReturn4 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['notification_period'])) { - $intFieldId = $arrModifyData['notification_period']; - } else { - $intFieldId = 0; - } + $intFieldId = $arrModifyData['notification_period'] ?? 0; $intReturn5 = $myVisClass->parseSelectSimple('tbl_timeperiod', 'timeperiod_name', 'notifyperiod', 1, $intFieldId); - if ($intReturn5 != 0) { + if ($intReturn5 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process event handler selection field - if (isset($arrModifyData['event_handler'])) { - $intFieldId = $arrModifyData['event_handler']; - } else { - $intFieldId = 0; - } + /* Process event handler selection field */ + $intFieldId = $arrModifyData['event_handler'] ?? 0; $intReturn6 = $myVisClass->parseSelectSimple('tbl_command', 'command_name', 'eventhandler', 1, $intFieldId); - if ($intReturn6 != 0) { + if ($intReturn6 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process contact and contact group selection field - if (isset($arrModifyData['contacts'])) { - $intFieldId = $arrModifyData['contacts']; - } else { - $intFieldId = 0; - } + /* Process contact and contact group selection field */ + $intFieldId = $arrModifyData['contacts'] ?? 0; $intReturn7 = $myVisClass->parseSelectMulti( 'tbl_contact', 'contact_name', @@ -430,14 +524,10 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn7 != 0) { + if ($intReturn7 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['contact_groups'])) { - $intFieldId = $arrModifyData['contact_groups']; - } else { - $intFieldId = 0; - } + $intFieldId = $arrModifyData['contact_groups'] ?? 0; $intReturn8 = $myVisClass->parseSelectMulti( 'tbl_contactgroup', 'contactgroup_name', @@ -446,115 +536,125 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn8 != 0) { + if ($intReturn8 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process access group selection field - if (isset($arrModifyData['access_group'])) { - $intFieldId = $arrModifyData['access_group']; - } else { - $intFieldId = 0; - } + /* Process access group selection field */ + $intFieldId = $arrModifyData['access_group'] ?? 0; $intReturn9 = $myVisClass->parseSelectSimple('tbl_group', 'groupname', 'acc_group', 0, $intFieldId); - if ($intReturn9 != 0) { + if ($intReturn9 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Initial add/modify form definitions + /* Initial add/modify form definitions */ $strChbFields = 'ACE,PCE,FRE,OBS,EVH,FLE,STI,NSI,PED,NOE,PAR,HOG,COT,COG,TPL'; $myContentClass->addFormInit($conttp, $strChbFields); - if ($intDataWarning == 1) { - $conttp->setVariable('WARNING', $strDBWarning. '
' .translate('Saving not possible!')); + if ($intDataWarning === 1) { + $conttp->setVariable('WARNING', $strDBWarning . '
' . translate('Saving not possible!')); } if ($intVersion < 3) { $conttp->setVariable('VERSION_20_VALUE_MUST', 'mselValue1,'); } - // Insert data from database in "modify" mode - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - // Check relation information to find out locked configuration datasets + /* Insert data from database in "modify" mode */ + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + /* Check relation information to find out locked configuration datasets */ $intLocked = $myDataClass->infoRelation($preTableName, $arrModifyData['id'], $preKeyField); $myVisClass->processMessage($myDataClass->strInfoMessage, $strRelMessage); - $strInfo = '
' .translate('Entry cannot be activated because it is used by ' - . 'another configuration'). ':'; - $strInfo .= '
' .$strRelMessage. ''; - // Process data + $strInfo = '
' . translate('Entry cannot be activated because it is used by ' + . 'another configuration') . ':'; + $strInfo .= '
' . $strRelMessage . ''; + /* Process data */ $myContentClass->addInsertData($conttp, $arrModifyData, $intLocked, $strInfo, $strChbFields); - $conttp->setVariable('DAT_ACE' .$arrModifyData['active_checks_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_PCE' .$arrModifyData['passive_checks_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_FRE' .$arrModifyData['check_freshness']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_OBS' .$arrModifyData['obsess_over_host']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_EVH' .$arrModifyData['event_handler_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_FLE' .$arrModifyData['flap_detection_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_STI' .$arrModifyData['retain_status_information']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_NSI' .$arrModifyData['retain_nonstatus_information']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_PED' .$arrModifyData['process_perf_data']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_NOE' .$arrModifyData['notifications_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_PAR' .$arrModifyData['parents_tploptions']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_HOG' .$arrModifyData['hostgroups_tploptions']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_COT' .$arrModifyData['contacts_tploptions']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_COG' .$arrModifyData['contact_groups_tploptions']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_TPL' .$arrModifyData['use_template_tploptions']. '_CHECKED', 'checked'); - // Special processing for -1 values - write 'null' to integer fields - $strIntegerfelder = 'max_check_attempts,check_interval,retry_interval,freshness_threshold,low_flap_threshold,'; + $conttp->setVariable('DAT_ACE' . $arrModifyData['active_checks_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_PCE' . $arrModifyData['passive_checks_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_FRE' . $arrModifyData['check_freshness'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_OBS' . $arrModifyData['obsess_over_host'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_EVH' . $arrModifyData['event_handler_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_FLE' . $arrModifyData['flap_detection_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_STI' . $arrModifyData['retain_status_information'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_NSI' . $arrModifyData['retain_nonstatus_information'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_PED' . $arrModifyData['process_perf_data'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_NOE' . $arrModifyData['notifications_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_PAR' . $arrModifyData['parents_tploptions'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_HOG' . $arrModifyData['hostgroups_tploptions'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_COT' . $arrModifyData['contacts_tploptions'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_COG' . $arrModifyData['contact_groups_tploptions'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_TPL' . $arrModifyData['use_template_tploptions'] . '_CHECKED', 'checked'); + /* Special processing for -1 values - write 'null' to integer fields */ + $strIntegerfelder = 'max_check_attempts,check_interval,retry_interval,freshness_threshold,low_flap_threshold,'; $strIntegerfelder .= 'high_flap_threshold,notification_interval,first_notification_delay'; foreach (explode(',', $strIntegerfelder) as $elem) { - if ($arrModifyData[$elem] == -1) { - $conttp->setVariable('DAT_' .strtoupper($elem), 'null'); + if ($arrModifyData[$elem] === -1) { + $conttp->setVariable('DAT_' . strtoupper($elem), 'null'); } } - if ($arrModifyData['check_command'] != '') { + if ($arrModifyData['check_command'] !== '') { $arrArgument = explode('!', $arrModifyData['check_command']); foreach ($arrArgument as $key => $value) { - if ($key == 0) { - $conttp->setVariable('IFRAME_SRC', $_SESSION['SETS']['path']['base_url']. - 'admin/commandline.php?cname=' .$value); + if ($key === 0) { + $conttp->setVariable('IFRAME_SRC', $_SESSION['SETS']['path']['base_url'] . + 'admin/commandline.php?cname=' . $value); } else { $value1 = str_replace('::bang::', '!', $value); $value2 = str_replace('::back::', "\\", $value1); - $conttp->setVariable('DAT_ARG' .$key, htmlentities($value, ENT_QUOTES, 'UTF-8')); + $conttp->setVariable('DAT_ARG' . $key, htmlentities($value, ENT_QUOTES, 'UTF-8')); } } } - // Process option fields + /* Process option fields */ foreach (explode(',', $arrModifyData['initial_state']) as $elem) { - $conttp->setVariable('DAT_IS' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_IS' . strtoupper($elem) . '_CHECKED', 'checked'); } foreach (explode(',', $arrModifyData['flap_detection_options']) as $elem) { - $conttp->setVariable('DAT_FL' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_FL' . strtoupper($elem) . '_CHECKED', 'checked'); } foreach (explode(',', $arrModifyData['notification_options']) as $elem) { - $conttp->setVariable('DAT_NO' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_NO' . strtoupper($elem) . '_CHECKED', 'checked'); } foreach (explode(',', $arrModifyData['stalking_options']) as $elem) { - $conttp->setVariable('DAT_ST' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_ST' . strtoupper($elem) . '_CHECKED', 'checked'); } } $conttp->parse('datainsert'); $conttp->show('datainsert'); } -// -// List view -// ========== -if ($chkModus == 'display') { - // Initial list view definitions +/* +List view +*/ +if ($chkModus === 'display') { + /* Initial list view definitions */ $myContentClass->listViewInit($mastertp); $mastertp->setVariable('TITLE', translate('Host template definition (hosttemplates.cfg)')); $mastertp->setVariable('FIELD_1', translate('Host template name')); $mastertp->setVariable('FIELD_2', translate('Description')); - // Process search string - if ($_SESSION['search'][$preSearchSession] != '') { - $strSearchTxt = $_SESSION['search'][$preSearchSession]; - $strSearchWhere = "AND (`$preKeyField` LIKE '%".$strSearchTxt."%' OR `alias` LIKE '%".$strSearchTxt."%')"; + $mastertp->setVariable('FILTER_REG_VISIBLE', 'visibility: hidden'); + /* Process search string and filter */ + $strSearchWhere = ''; + if ($_SESSION['search'][$preSearchSession] !== '') { + $strSearchTxt = $_SESSION['search'][$preSearchSession]; + $strSearchWhere = "AND (`$preKeyField` LIKE '%" . $strSearchTxt . "%' OR `alias` LIKE '%" . $strSearchTxt . "%') "; } - // Row sorting + if ($_SESSION['filter'][$preSearchSession]['active'] !== '') { + $intActivated = (int)$_SESSION['filter'][$preSearchSession]['active']; + if ($intActivated === 1) { + $strSearchWhere .= "AND `active` = '1' "; + } + if ($intActivated === 2) { + $strSearchWhere .= "AND `active` = '0' "; + } + $mastertp->setVariable('SEL_ACTIVEFILTER_' . $intActivated . '_SELECTED', 'selected'); + } + /* Row sorting */ $strOrderString = "ORDER BY `config_id`, `$preKeyField` $hidSortDir"; - if ($hidSortBy == 2) { + if ($hidSortBy === 2) { $strOrderString = "ORDER BY `config_id`, `alias` $hidSortDir"; } - // Count datasets - $strSQL1 = "SELECT count(*) AS `number` FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere " - . "AND `access_group` IN ($strAccess)"; + /* Count datasets */ + $intLineCount = 0; + /** @noinspection SqlResolve */ + $strSQL1 = "SELECT count(*) AS `number` FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere " + . "AND `access_group` IN ($strAccess)"; $booReturn1 = $myDBClass->hasSingleDataset($strSQL1, $arrDataLinesCount); - if ($booReturn1 == false) { + if ($booReturn1 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { @@ -563,22 +663,22 @@ if ($chkModus == 'display') { $chkLimit = 0; } } - // Get datasets - $strSQL2 = "SELECT `id`, `$preKeyField`, `alias`, `register`, `active`, `last_modified`, `config_id`, " - . "`access_group` FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND `access_group` " - . "IN ($strAccess) $strOrderString LIMIT $chkLimit,".$SETS['common']['pagelines']; + /* Get datasets */ + $strSQL2 = "SELECT `id`, `$preKeyField`, `alias`, `register`, `active`, `last_modified`, `config_id`, " + . "`access_group` FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND `access_group` " + . "IN ($strAccess) $strOrderString LIMIT $chkLimit," . $SETS['common']['pagelines']; $booReturn2 = $myDBClass->hasDataArray($strSQL2, $arrDataLines, $intDataCount); - if ($booReturn2 == false) { + if ($booReturn2 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - // Process data + /* Process data */ $myContentClass->listData($mastertp, $arrDataLines, $intDataCount, $intLineCount, $preKeyField, 'alias'); - if ($myContentClass->strErrorMessage != '') { + if ($myContentClass->strErrorMessage !== '') { $myVisClass->processMessage($myContentClass->strErrorMessage, $strErrorMessage); } } -// Show messages +/* Show messages */ $myContentClass->showMessages( $mastertp, $strErrorMessage, @@ -588,7 +688,7 @@ $myContentClass->showMessages( $strTimeInfoString, $intNoTime ); -// -// Process footer -// ============== -$myContentClass->showFooter($maintp, $setFileVersion); +/* +Process footer +*/ +$myContentClass->showFooter($maintp, $setFileVersion); \ No newline at end of file diff --git a/admin/import.php b/admin/import.php index 9e5ac1f..0889b6f 100644 --- a/admin/import.php +++ b/admin/import.php @@ -1,93 +1,109 @@ Application version string + * @var string $prePageKey from prepend_adm.php -> Menu group id + * @var int $chkStatus from prepend_adm.php -> (hidden) Status field + * @var string $chkTfSearch from prepend_content.php -> Text search string + * @var mixed $chkMselValue1 from prepend_content.php -> Import file list + * @var int $chkChbValue1 from prepend_content.php -> Overwrite checkbox + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 25; -$preContent = 'admin/import.htm.tpl'; -$preAccess = 1; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 25; +$preContent = 'admin/import.htm.tpl'; +$preAccess = 1; $preFieldvars = 1; -$intModus = 0; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Initialize import class -// ======================= +$intModus = 0; +$strErrorMessage = ''; +$strInfoMessage = ''; +/* +Define common variables +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Initialize import class +*/ $myImportClass = new functions\NagImportClass($_SESSION); -$myImportClass->myDBClass =& $myDBClass; -$myImportClass->myDataClass =& $myDataClass; +$myImportClass->myDBClass =& $myDBClass; +$myImportClass->myDataClass =& $myDataClass; $myImportClass->myConfigClass =& $myConfigClass; -// -// Get configuration set ID -// ======================== +/* +Get configuration set ID +*/ $myConfigClass->getConfigTargets($arrConfigSet); -$intConfigId = $arrConfigSet[0]; -// -// Process form variables -// ====================== -if (isset($_FILES['datValue1']) && ($_FILES['datValue1']['name'] != '') && ($chkStatus == 1)) { - // Upload Error +$intConfigId = $arrConfigSet[0]; +/* +Process form variables +*/ +if (isset($_FILES['datValue1']) && ($_FILES['datValue1']['name'] !== '') && ($chkStatus === 1)) { + /* Upload Error */ if ($_FILES['datValue1']['error'] !== UPLOAD_ERR_OK) { $myVisClass->processMessage( - translate('File upload error:'). ' ' .$_FILES['filMedia']['error'], + translate('File upload error:') . ' ' . $_FILES['filMedia']['error'], $strErrorMessage ); } else { $intModus = 1; $strFileName = tempnam($_SESSION['SETS']['path']['tempdir'], 'nagiosql_local_imp'); move_uploaded_file($_FILES['datValue1']['tmp_name'], $strFileName); - $intReturn = $myImportClass->fileImport($strFileName, $intConfigId, $chkChbValue1); - if ($intReturn != 0) { + $intReturn = $myImportClass->fileImport($strFileName, $intConfigId, $chkChbValue1); + if ($intReturn !== 0) { $myVisClass->processMessage($myImportClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myImportClass->strInfoMessage, $strInfoMessage); - $myDataClass->writeLog(translate('File imported - File [overwrite flag]:'). ' ' . - $_FILES['datValue1']['name']. ' [' .$chkChbValue1. ']'); + $myDataClass->writeLog(translate('File imported - File [overwrite flag]:') . ' ' . + $_FILES['datValue1']['name'] . ' [' . $chkChbValue1 . ']'); } } } -if (($chkMselValue1[0] != '') && ($chkStatus == 1)) { - /** @var array $chkMselValue1 */ +if (isset($chkMselValue1[0]) && ($chkMselValue1[0] !== '') && ($chkStatus === 1)) { foreach ($chkMselValue1 as $elem) { - $intModus = 1; + $intModus = 1; $myImportClass->strErrorMessage = ''; - $myImportClass->strInfoMessage = ''; - $intReturn = $myImportClass->fileImport($elem, $intConfigId, $chkChbValue1); - if ($intReturn != 0) { + $myImportClass->strInfoMessage = ''; + $intReturn = $myImportClass->fileImport($elem, $intConfigId, $chkChbValue1); + if ($intReturn !== 0) { $myVisClass->processMessage($myImportClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myImportClass->strInfoMessage, $strInfoMessage); - $myDataClass->writeLog(translate('File imported - File [overwrite flag]:'). ' ' .$elem. ' [' - .$chkChbValue1. ']'); + $myDataClass->writeLog(translate('File imported - File [overwrite flag]:') . ' ' . $elem . ' [' + . $chkChbValue1 . ']'); } } } -// -// Start content -// ============= +/* +Start content +*/ $conttp->setVariable('TITLE', translate('Configuration import')); $conttp->parse('header'); $conttp->show('header'); @@ -103,19 +119,23 @@ $conttp->setVariable('OVERWRITE', translate('Overwrite database')); $conttp->setVariable('MAKE', translate('Import')); $conttp->setVariable('ABORT', translate('Abort')); $conttp->setVariable('CTRL_INFO', translate('Hold CTRL to select
more than one')); -$conttp->setVariable('IMAGE_PATH', $_SESSION['SETS']['path']['base_url']. 'images/'); -$conttp->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$conttp->setVariable('DAT_IMPORTFILE_1', ''); +$conttp->setVariable('IMAGE_PATH', $_SESSION['SETS']['path']['base_url'] . 'images/'); +$conttp->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF')); +$conttp->setVariable('DAT_IMPORTFILE_1'); $conttp->setVariable('IMPORT_INFO_1', translate('To prevent errors or misconfigurations, you should import your ' - . 'configurations in an useful order. We recommend to do it like this:

commands -> ' - . 'timeperiods -> contacttemplates -> contacts -> contactgroups -> hosttemplates -> hosts -> ' - . 'hostgroups -> servicetemplates -> services -> servicegroups

')); -$conttp->setVariable('IMPORT_INFO_2', '' .translate('Check your configuration after ' + . 'configurations in a useful order. We recommend to do it like this:

commands -> ' + . 'timeperiods -> contacttemplates -> contacts -> contactgroups -> hosttemplates -> hosts -> ' + . 'hostgroups -> servicetemplates -> services -> servicegroups

')); +$conttp->setVariable('IMPORT_INFO_2', '' . translate('Check your configuration after ' . 'import!
In cause of an error or an uncomplete configuration, re-importing the wrong configuration ' - . 'can solve the problem.'). '
'); + . 'can solve the problem.') . '
'); $conttp->parse('filelist1'); -// Get settings -$myConfigClass->getConfigValues($intConfigId, 'method', $intMethod); +/* Get settings */ +$intMethod = 0; +$strMethod = ''; +if ($myConfigClass->getConfigValues($intConfigId, 'method', $strMethod) === 0) { + $intMethod = (int)$strMethod; +} $myConfigClass->getConfigValues($intConfigId, 'basedir', $strBaseDir); $myConfigClass->getConfigValues($intConfigId, 'hostconfig', $strHostDir); $myConfigClass->getConfigValues($intConfigId, 'serviceconfig', $strServiceDir); @@ -124,17 +144,19 @@ $myConfigClass->getConfigValues($intConfigId, 'hostbackup', $strHostBackupDir); $myConfigClass->getConfigValues($intConfigId, 'servicebackup', $strServiceBackupDir); $myConfigClass->getConfigValues($intConfigId, 'importdir', $strImportDir); $myConfigClass->getConfigValues($intConfigId, 'nagiosbasedir', $strNagiosBaseDir); -if ($intMethod == 1) { - // Building local file list +if ($intMethod === 1) { + /* Building local file list */ $arrOutput1 = array(); - $myConfigClass->storeDirToArray( - $strBaseDir, - "\.cfg", - 'cgi.cfg|nagios.cfg|nrpe.cfg|nsca.cfg', - $arrOutput1, - $strErrorMessage - ); - if ($strNagiosBaseDir != $strBaseDir) { + if (file_exists($strBaseDir)) { + $myConfigClass->storeDirToArray( + $strBaseDir, + "\.cfg", + 'cgi.cfg|nagios.cfg|nrpe.cfg|nsca.cfg', + $arrOutput1, + $strErrorMessage + ); + } + if (file_exists($strNagiosBaseDir) && $strNagiosBaseDir !== $strBaseDir) { $myConfigClass->storeDirToArray( $strNagiosBaseDir, "\.cfg", @@ -143,53 +165,61 @@ if ($intMethod == 1) { $strErrorMessage ); } - $myConfigClass->storeDirToArray($strHostDir, "\.cfg", '', $arrOutput1, $strErrorMessage); - $myConfigClass->storeDirToArray($strServiceDir, "\.cfg", '', $arrOutput1, $strErrorMessage); - $myConfigClass->storeDirToArray($strHostBackupDir, "\.cfg_", '', $arrOutput1, $strErrorMessage); - $myConfigClass->storeDirToArray($strServiceBackupDir, "\.cfg_", '', $arrOutput1, $strErrorMessage); - if (($strImportDir != '') && ($strImportDir != $strBaseDir) && ($strImportDir != $strNagiosBaseDir)) { + if (file_exists($strHostDir)) { + $myConfigClass->storeDirToArray($strHostDir, "\.cfg", '', $arrOutput1, $strErrorMessage); + } + if (file_exists($strServiceDir)) { + $myConfigClass->storeDirToArray($strServiceDir, "\.cfg", '', $arrOutput1, $strErrorMessage); + } + if (file_exists($strHostBackupDir)) { + $myConfigClass->storeDirToArray($strHostBackupDir, "\.cfg_", '', $arrOutput1, $strErrorMessage); + } + if (file_exists($strServiceBackupDir)) { + $myConfigClass->storeDirToArray($strServiceBackupDir, "\.cfg_", '', $arrOutput1, $strErrorMessage); + } + if (($strImportDir !== '') && ($strImportDir !== $strBaseDir) && ($strImportDir !== $strNagiosBaseDir) && file_exists($strImportDir)) { $myConfigClass->storeDirToArray($strImportDir, "\.cfg", '', $arrOutput1, $strErrorMessage); } - $arrOutput2=array_unique($arrOutput1); - if (is_array($arrOutput2) && (count($arrOutput2) != 0)) { + $arrOutput2 = array_unique($arrOutput1); + if (is_array($arrOutput2) && (count($arrOutput2) !== 0)) { foreach ($arrOutput2 as $elem) { - if (($chkTfSearch == '') || (substr_count($elem, $chkTfSearch) != 0)) { + if (($chkTfSearch === '') || (substr_count($elem, $chkTfSearch) !== 0)) { $conttp->setVariable('DAT_IMPORTFILE_2', $elem); $conttp->parse('filelist2'); } } } -} elseif ($intMethod == 2) { - // Set up basic connection - if ($myConfigClass->getFTPConnection($intConfigId) == '0') { - $arrFiles = array(); - $arrFiles1 = ftp_nlist($myConfigClass->resConnectId, $strBaseDir); +} elseif ($intMethod === 2) { + /* Set up basic connection */ + if ($myConfigClass->getFTPConnection($intConfigId) === 0) { + $arrFiles = array(); + $arrFiles1 = ftp_nlist($myConfigClass->conFTPConId, $strBaseDir); if (is_array($arrFiles1)) { $arrFiles = array_merge($arrFiles, $arrFiles1); } - $arrFiles2 = ftp_nlist($myConfigClass->resConnectId, $strHostDir); + $arrFiles2 = ftp_nlist($myConfigClass->conFTPConId, $strHostDir); if (is_array($arrFiles2)) { $arrFiles = array_merge($arrFiles, $arrFiles2); } - $arrFiles3 = ftp_nlist($myConfigClass->resConnectId, $strServiceDir); + $arrFiles3 = ftp_nlist($myConfigClass->conFTPConId, $strServiceDir); if (is_array($arrFiles3)) { $arrFiles = array_merge($arrFiles, $arrFiles3); } - $arrFiles4 = ftp_nlist($myConfigClass->resConnectId, $strHostBackupDir); + $arrFiles4 = ftp_nlist($myConfigClass->conFTPConId, $strHostBackupDir); if (is_array($arrFiles4)) { $arrFiles = array_merge($arrFiles, $arrFiles4); } - $arrFiles5 = ftp_nlist($myConfigClass->resConnectId, $strServiceBackupDir); + $arrFiles5 = ftp_nlist($myConfigClass->conFTPConId, $strServiceBackupDir); if (is_array($arrFiles5)) { $arrFiles = array_merge($arrFiles, $arrFiles5); } - if ($strImportDir != '') { - $arrFiles6 = ftp_nlist($myConfigClass->resConnectId, $strImportDir); + if ($strImportDir !== '') { + $arrFiles6 = ftp_nlist($myConfigClass->conFTPConId, $strImportDir); if (is_array($arrFiles6)) { $arrFiles = array_merge($arrFiles, $arrFiles6); } } - if (is_array($arrFiles) && (count($arrFiles) != 0)) { + if (is_array($arrFiles) && (count($arrFiles) !== 0)) { foreach ($arrFiles as $elem) { if (!substr_count($elem, 'cfg')) { continue; @@ -209,47 +239,47 @@ if ($intMethod == 1) { if (substr_count($elem, 'nsca.cfg')) { continue; } - if (($chkTfSearch == '') || (substr_count($elem, $chkTfSearch) != 0)) { + if (($chkTfSearch === '') || (substr_count($elem, $chkTfSearch) !== 0)) { $conttp->setVariable('DAT_IMPORTFILE_2', str_replace('//', '/', $elem)); $conttp->parse('filelist2'); } } } - ftp_close($myConfigClass->resConnectId); + ftp_close($myConfigClass->conFTPConId); } else { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } -} elseif ($intMethod == 3) { - // Set up basic connection - if ($myConfigClass->getSSHConnection($intConfigId) == '0') { - $arrFiles = array(); - $intReturn = $myConfigClass->sendSSHCommand('ls ' .$strBaseDir. '*.cfg', $arrFiles1); - if (($intReturn == 0) && is_array($arrFiles1)) { +} elseif ($intMethod === 3) { + /* Set up basic connection */ + if ($myConfigClass->getSSHConnection($intConfigId) === 0) { + $arrFiles = array(); + $intReturn = $myConfigClass->sendSSHCommand('ls ' . $strBaseDir . '*.cfg', $arrFiles1); + if (($intReturn === 0) && is_array($arrFiles1)) { $arrFiles = array_merge($arrFiles, $arrFiles1); } - $intReturn = $myConfigClass->sendSSHCommand('ls ' .$strHostDir. '*.cfg', $arrFiles2); - if (($intReturn == 0) && is_array($arrFiles2)) { + $intReturn = $myConfigClass->sendSSHCommand('ls ' . $strHostDir . '*.cfg', $arrFiles2); + if (($intReturn === 0) && is_array($arrFiles2)) { $arrFiles = array_merge($arrFiles, $arrFiles2); } - $intReturn = $myConfigClass->sendSSHCommand('ls ' .$strServiceDir. '*.cfg', $arrFiles3); - if (($intReturn == 0) && is_array($arrFiles3)) { + $intReturn = $myConfigClass->sendSSHCommand('ls ' . $strServiceDir . '*.cfg', $arrFiles3); + if (($intReturn === 0) && is_array($arrFiles3)) { $arrFiles = array_merge($arrFiles, $arrFiles3); } - $intReturn = $myConfigClass->sendSSHCommand('ls ' .$strHostBackupDir. '*.cfg*', $arrFiles4); - if (($intReturn == 0) && is_array($arrFiles4)) { + $intReturn = $myConfigClass->sendSSHCommand('ls ' . $strHostBackupDir . '*.cfg*', $arrFiles4); + if (($intReturn === 0) && is_array($arrFiles4)) { $arrFiles = array_merge($arrFiles, $arrFiles4); } - $intReturn = $myConfigClass->sendSSHCommand('ls ' .$strServiceBackupDir. '*.cfg*', $arrFiles5); - if (($intReturn == 0) && is_array($arrFiles5)) { + $intReturn = $myConfigClass->sendSSHCommand('ls ' . $strServiceBackupDir . '*.cfg*', $arrFiles5); + if (($intReturn === 0) && is_array($arrFiles5)) { $arrFiles = array_merge($arrFiles, $arrFiles5); } - if ($strImportDir != '') { - $intReturn = $myConfigClass->sendSSHCommand('ls ' .$strImportDir. '*.cfg', $arrFiles6); - if (($intReturn == 0) && is_array($arrFiles6)) { + if ($strImportDir !== '') { + $intReturn = $myConfigClass->sendSSHCommand('ls ' . $strImportDir . '*.cfg', $arrFiles6); + if (($intReturn === 0) && is_array($arrFiles6)) { $arrFiles = array_merge($arrFiles, $arrFiles6); } } - if (is_array($arrFiles) && (count($arrFiles) != 0)) { + if (is_array($arrFiles) && (count($arrFiles) !== 0)) { foreach ($arrFiles as $elem) { if (!substr_count($elem, 'cfg')) { continue; @@ -269,7 +299,7 @@ if ($intMethod == 1) { if (substr_count($elem, 'nsca.cfg')) { continue; } - if (($chkTfSearch == '') || (substr_count($elem, $chkTfSearch) != 0)) { + if (($chkTfSearch === '') || (substr_count($elem, $chkTfSearch) !== 0)) { $conttp->setVariable('DAT_IMPORTFILE_2', str_replace('//', '/', $elem)); $conttp->parse('filelist2'); } @@ -279,20 +309,20 @@ if ($intMethod == 1) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } } -// Check access rights for adding new objects -if ($myVisClass->checkAccountGroup($prePageKey, 'write') != 0) { +/* Check access rights for adding new objects */ +if ($myVisClass->checkAccountGroup($prePageKey, 'write') !== 0) { $conttp->setVariable('ADD_CONTROL', 'disabled="disabled"'); } -if ($strErrorMessage != '') { +if ($strErrorMessage !== '') { $conttp->setVariable('ERRORMESSAGE', $strErrorMessage); } $conttp->setVariable('INFOMESSAGE', $strInfoMessage); $conttp->parse('main'); $conttp->show('main'); -// -// Process footer -// ============== +/* +Process footer +*/ $maintp->setVariable('VERSION_INFO', "NagiosQL $setFileVersion"); + . "target='_blank'>NagiosQL $setFileVersion"); $maintp->parse('footer'); -$maintp->show('footer'); +$maintp->show('footer'); \ No newline at end of file diff --git a/admin/index.html b/admin/index.html index 2c37267..ae9ad47 100644 --- a/admin/index.html +++ b/admin/index.html @@ -1,6 +1,6 @@ - + NagiosQL diff --git a/admin/info.php b/admin/info.php index 6ead80a..60c5945 100644 --- a/admin/info.php +++ b/admin/info.php @@ -1,44 +1,47 @@ translate('This is relative path of your NagiosQL Installation'), 'txtBasePath' => translate('This is the absolut path to your NagiosQL Installation'), @@ -68,42 +71,47 @@ if ($chkKey1 == 'admin' and isset($_SESSION['updInfo'])) { 'txtProxyServer' => translate('Address of your Proxyserver e.g. proxy.yourdomain.com:3128'), 'txtProxyUser' => translate('Username to connect through your proxy (optional)'), 'txtProxyPasswd' => translate('Password to connect through your proxy (optional)'), + 'show_parents' => translate('In environments with a high number of host and service objects, the display of the parent objects can be disabled to improve performance. Existing assignments are preserved during modification.') ); $strContentDB = $arrTrans[$chkKey2]; +} elseif ($chkKey1 === 'cmd_arguments') { + /* Get information from tbl_command */ + $strSQL = 'SELECT `arg' . $chkVersion . '_info` FROM `tbl_command` WHERE `id`=' . $chkKey2; + $strContentDB = nl2br($myDBClass->getFieldData($strSQL)); } else { - // Get information from tbl_info - $strSQL = 'SELECT `infotext` FROM `tbl_info` ' . - "WHERE `key1` = '$chkKey1' AND `key2` = '$chkKey2' AND `version` = '$chkVersion' ". - "AND `language` = 'private'"; + /* Get information from tbl_info */ + $strSQL = 'SELECT `infotext` FROM `tbl_info` ' . + "WHERE `key1` = '$chkKey1' AND `key2` = '$chkKey2' AND `version` = '$chkVersion' " . + "AND `language` = 'private'"; $strContentDB = $myDBClass->getFieldData($strSQL); - if ($strContentDB == '') { - $strSQL = 'SELECT `infotext` FROM `tbl_info` ' . - "WHERE `key1` = '$chkKey1' AND `key2` = '$chkKey2' AND `version` = '$chkVersion' ". - "AND `language` = 'default'"; + if ($strContentDB === '') { + $strSQL = 'SELECT `infotext` FROM `tbl_info` ' . + "WHERE `key1` = '$chkKey1' AND `key2` = '$chkKey2' AND `version` = '$chkVersion' " . + "AND `language` = 'default'"; $strContentDB = $myDBClass->getFieldData($strSQL); } } ?> - - - - <?php echo translate('Information PopUp');?> - - - + + + + <?php echo translate('Information PopUp'); ?> + + + - + \ No newline at end of file diff --git a/admin/logbook.php b/admin/logbook.php index 0c73ce8..5d57d7a 100644 --- a/admin/logbook.php +++ b/admin/logbook.php @@ -1,85 +1,104 @@ Application version string + * @var string $prePageKey from prepend_adm.php -> Menu group id + * @var array $SETS Settings array + * @var string $chkTfValue1 from prepend_content.php -> User name + * @var string $chkTfValue2 from prepend_content.php -> User description + * @var string $chkTfSearch from prepend_content.php -> Text search string + * @var int $chkFromLine from prepend_content.php -> Line number + * @var array $arrDescription from fieldvars.php -> Translated common strings + * + * + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 37; -$preContent = 'admin/logbook.htm.tpl'; -$preAccess = 1; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 37; +$preContent = 'admin/logbook.htm.tpl'; +$preAccess = 1; $preFieldvars = 1; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Delete log entries -// ================== +$strErrorMessage = ''; +$strInfoMessage = ''; +/* +Include preprocessing file +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Delete log entries +*/ $strWhere = ''; -if ($chkTfValue1 != '') { +if ($chkTfValue1 !== '') { $strWhere .= "AND `time` > '$chkTfValue1 00:00:00'"; } -if ($chkTfValue2 != '') { +if ($chkTfValue2 !== '') { $strWhere .= "AND `time` < '$chkTfValue2 23:59:59'"; } -if ($strWhere != '') { - $strSQL = 'DELETE FROM `tbl_logbook` WHERE 1=1 '; - $strSQL .= $strWhere; +if ($strWhere !== '') { + $strSQL = 'DELETE FROM `tbl_logbook` WHERE `id`<>0 '; + $strSQL .= $strWhere; $booReturn = $myDBClass->insertData($strSQL); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { - $myVisClass->processMessage(translate('Dataset successfully deleted. Affected rows:'). ' ' . - $myDBClass->intAffectedRows, $strInfoMessage); + $myVisClass->processMessage(translate('Dataset successfully deleted. Affected rows:') . ' ' . + $myDBClass->intAffectedRows, $strInfoMessage); } } -// -// Search data -// =========== -if ($chkTfSearch != '') { +/* +Search data +*/ +if ($chkTfSearch !== '') { $strWhere = "WHERE `user` LIKE '%$chkTfSearch%' OR `ipadress` LIKE '%$chkTfSearch%' " - . "OR `domain` LIKE '%$chkTfSearch%' OR `entry` LIKE '%$chkTfSearch%'"; + . "OR `domain` LIKE '%$chkTfSearch%' OR `entry` LIKE '%$chkTfSearch%'"; } else { $strWhere = ''; } -// -// Get data -// ======== +/* +Get data +*/ $intNumRows = $myDBClass->getFieldData("SELECT count(*) FROM `tbl_logbook` $strWhere"); if ($intNumRows <= $chkFromLine) { $chkFromLine = 0; } -$strSQL = "SELECT DATE_FORMAT(time,'%Y-%m-%d %H:%i:%s') AS `time`, `user`, `ipadress`, `domain`, `entry` " - . "FROM `tbl_logbook` $strWhere ORDER BY `time` DESC LIMIT $chkFromLine,".$SETS['common']['pagelines']; -$booReturn = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); -if ($booReturn == false) { +$strSQL = "SELECT DATE_FORMAT(time,'%Y-%m-%d %H:%i:%s') AS `time`, `user`, `ipadress`, `domain`, `entry` " + . "FROM `tbl_logbook` $strWhere ORDER BY `time` DESC LIMIT $chkFromLine," . $SETS['common']['pagelines']; +$booReturn = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); +if ($booReturn === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } -// -// Start content -// ============= +/* +Start content +*/ $conttp->setVariable('TITLE', translate('View logbook')); foreach ($arrDescription as $elem) { $conttp->setVariable($elem['name'], $elem['string']); @@ -88,33 +107,33 @@ $conttp->setVariable('LANG_ENTRIES_BEFORE', translate('Delete logentries between $conttp->setVariable('LOCALE', $SETS['data']['locale']); $conttp->setVariable('LANG_SELECT_DATE', translate('Please supply a start or a stop time at least')); $conttp->setVariable('LANG_DELETELOG', translate('Do you really want to delete all log entries between the ' - . 'selected dates?')); + . 'selected dates?')); $conttp->setVariable('DAT_SEARCH', $chkTfSearch); // Legende einblenden if ($chkFromLine > 1) { $intPrevNumber = $chkFromLine - 20; - $conttp->setVariable('LANG_PREVIOUS', '<< ' .translate('previous 20 entries'). ''); + $conttp->setVariable('LANG_PREVIOUS', '<< ' . translate('previous 20 entries') . ''); } else { - $conttp->setVariable('LANG_PREVIOUS', ''); + $conttp->setVariable('LANG_PREVIOUS'); } -if ($chkFromLine < $intNumRows-20) { +if ($chkFromLine < $intNumRows - 20) { $intNextNumber = $chkFromLine + 20; - $conttp->setVariable('LANG_NEXT', '' .translate('next 20 entries'). ' >>'); + $conttp->setVariable('LANG_NEXT', '' . translate('next 20 entries') . ' >>'); } else { - $conttp->setVariable('LANG_NEXT', ''); + $conttp->setVariable('LANG_NEXT'); } -// -// Output log data -// =============== -if ($intDataCount != 0) { +/* +Output log data +*/ +if ($intDataCount !== 0) { for ($i = 0; $i < $intDataCount; $i++) { - // Set default values - if ($arrDataLines[$i]['ipadress'] == '') { + /* Set default values */ + if ($arrDataLines[$i]['ipadress'] === '') { $arrDataLines[$i]['ipadress'] = ' '; } - // Insert data values + /* Insert data values */ $conttp->setVariable('DAT_TIME', $arrDataLines[$i]['time']); $conttp->setVariable('DAT_ACCOUNT', $arrDataLines[$i]['user']); $conttp->setVariable('DAT_ACTION', $arrDataLines[$i]['entry']); @@ -123,18 +142,18 @@ if ($intDataCount != 0) { $conttp->parse('logdatacell'); } } -$conttp->setVariable('ERRORMESSAGE', '
' .$strErrorMessage); -$conttp->setVariable('INFOMESSAGE', '
' .$strInfoMessage); -// Check access rights for adding new objects -if ($myVisClass->checkAccountGroup($prePageKey, 'write') != 0) { +$conttp->setVariable('ERRORMESSAGE', '
' . $strErrorMessage); +$conttp->setVariable('INFOMESSAGE', '
' . $strInfoMessage); +/* Check access rights for adding new objects */ +if ($myVisClass->checkAccountGroup($prePageKey, 'write') !== 0) { $conttp->setVariable('ADD_CONTROL', 'disabled="disabled"'); } $conttp->parse('logbooksite'); $conttp->show('logbooksite'); -// -// Process footer -// ============== +/* +Process footer +*/ $maintp->setVariable('VERSION_INFO', "NagiosQL $setFileVersion"); + . "target='_blank'>NagiosQL $setFileVersion"); $maintp->parse('footer'); -$maintp->show('footer'); +$maintp->show('footer'); \ No newline at end of file diff --git a/admin/menuaccess.php b/admin/menuaccess.php index 3daac5d..851d218 100644 --- a/admin/menuaccess.php +++ b/admin/menuaccess.php @@ -1,71 +1,88 @@ Application version string + * @var array $arrDescription from fieldvars.php -> Translated common strings + * @var int $intGlobalWriteAccess from prepend_content.php -> Global admin write access + * @var int $intWriteAccessId from prepend_content.php -> Admin write access to actual dataset id + * @var int $chkSelValue1 from prepend_content.php -> Language selector + * @var int $chkSelValue2 from prepend_content.php -> Standard domain selector + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 34; -$preContent = 'admin/menuaccess.htm.tpl'; -$preAccess = 1; -$preFieldvars = 1; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 34; +$preContent = 'admin/menuaccess.htm.tpl'; +$preAccess = 1; +$preFieldvars = 1; $preNoAccessGrp = 1; -$intFieldId = 0; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Process data -// ============ -if (filter_input(INPUT_POST, 'subSave') && ($chkSelValue1 != 0)) { +$intFieldId = 0; +$strErrorMessage = ''; +$strInfoMessage = ''; +/* +Include preprocessing file +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Process data +*/ +if (filter_input(INPUT_POST, 'subSave') && ($chkSelValue1 !== 0)) { $strSQL = "UPDATE `tbl_menu` SET `mnuGrpId`='$chkSelValue2' WHERE `mnuId`=$chkSelValue1"; - $booReturn = $myDBClass->insertData($strSQL); - if ($booReturn == false) { + $booReturn = $myDBClass->insertData($strSQL); + if ($booReturn === false) { $myVisClass->processMessage(translate('Error while inserting the data into the database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage(translate('Data were successfully inserted to the data base!'), $strInfoMessage); - $myDataClass->writeLog(translate('Access group set for menu item:'). ' ' . - $myDBClass->getFieldData("SELECT `mnuName` FROM `tbl_menu` WHERE `mnuId`=$chkSelValue1")); + $myDataClass->writeLog(translate('Access group set for menu item:') . ' ' . + $myDBClass->getFieldData("SELECT `mnuName` FROM `tbl_menu` WHERE `mnuId`=$chkSelValue1")); } } -// -// Include content -// =============== +/* +Include content +*/ $conttp->setVariable('TITLE', translate('Define Menu Access Rights')); foreach ($arrDescription as $elem) { $conttp->setVariable($elem['name'], $elem['string']); } $conttp->setVariable('LANG_ACCESSDESCRIPTION', translate('In order for a user to get access, he needs to be member ' - . 'of the group selected here.')); -// -// Auswahlfeld einlesen -// ==================== -$strSQL = 'SELECT A.`mnuId` , B.`mnuName` AS `mainitem`, A.`mnuName` AS `subitem`, A.`mnuGrpId` ' - . 'FROM `tbl_menu` AS A LEFT JOIN `tbl_menu` AS B ON A.`mnuTopId` = B.`mnuId` ' - . 'ORDER BY A.`mnuTopId`, A.`mnuOrderId`'; -$booReturn = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); -if ($booReturn == false) { + . 'of the group selected here.')); +/* +Read menu item +*/ +$strSQL = 'SELECT A.`mnuId` , B.`mnuName` AS `mainitem`, A.`mnuName` AS `subitem`, A.`mnuGrpId` ' + . 'FROM `tbl_menu` AS A LEFT JOIN `tbl_menu` AS B ON A.`mnuTopId` = B.`mnuId` ' + . 'ORDER BY A.`mnuTopId`, A.`mnuOrderId`'; +$booReturn = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); +if ($booReturn === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { @@ -74,35 +91,35 @@ if ($booReturn == false) { $conttp->parse('submenu'); foreach ($arrDataLines as $elem) { $conttp->setVariable('SUBMENU_VALUE', $elem['mnuId']); - if ($elem['mainitem'] != '') { - $conttp->setVariable('SUBMENU_NAME', translate($elem['mainitem']). ' - ' .translate($elem['subitem'])); + if (($elem['mainitem'] !== null) && ($elem['mainitem'] !== '')) { + $conttp->setVariable('SUBMENU_NAME', translate($elem['mainitem']) . ' - ' . translate($elem['subitem'])); } else { $conttp->setVariable('SUBMENU_NAME', translate($elem['subitem'])); } - if ($chkSelValue1 == $elem['mnuId']) { + if ($chkSelValue1 === (int)$elem['mnuId']) { $conttp->setVariable('SUBMENU_SELECTED', 'selected'); $intFieldId = $elem['mnuGrpId']; } - // Bypass main site - if ($elem['mnuId'] != 1) { + /* Bypass main site */ + if ((int)$elem['mnuId'] !== 1) { $conttp->parse('submenu'); } } - // Process access group selection field + /* Process access group selection field */ $intReturn = $myVisClass->parseSelectSimple('tbl_group', 'groupname', 'acc_group', 0, $intFieldId); } $conttp->setVariable('ERRORMESSAGE', $strErrorMessage); $conttp->setVariable('INFOMESSAGE', $strInfoMessage); -// Check access rights for adding new objects -if ($intGlobalWriteAccess == 1) { +/* Check access rights for adding new objects */ +if ($intGlobalWriteAccess === 1) { $conttp->setVariable('DISABLE_SAVE', 'disabled="disabled"'); } $conttp->parse('menuaccesssite'); $conttp->show('menuaccesssite'); -// -// Process footer -// ============== +/* +Process footer +*/ $maintp->setVariable('VERSION_INFO', "NagiosQL $setFileVersion"); + . "target='_blank'>NagiosQL $setFileVersion"); $maintp->parse('footer'); -$maintp->show('footer'); +$maintp->show('footer'); \ No newline at end of file diff --git a/admin/monitoring.php b/admin/monitoring.php index c7b7023..e587486 100644 --- a/admin/monitoring.php +++ b/admin/monitoring.php @@ -1,38 +1,47 @@ setVariable('TITLE', translate('Monitoring')); $conttp->parse('header'); $conttp->show('header'); @@ -41,72 +50,72 @@ $conttp->setVariable('STATISTICS', translate('Statistical datas')); $conttp->setVariable('TYPE', translate('Group')); $conttp->setVariable('ACTIVE', translate('Active')); $conttp->setVariable('INACTIVE', translate('Inactive')); -// -// Include statistical data -// ======================== -// Get read access groups -$strAccess = $myVisClass->getAccessGroups('read'); -$intAccessGrp8 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=8'); -$intAccessGrp9 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=9'); +/* +Include statistical data +*/ +/* Get read access groups */ +$strAccess = $myVisClass->getAccessGroups('read'); +$intAccessGrp8 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=8'); +$intAccessGrp9 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=9'); $intAccessGrp10 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=10'); $intAccessGrp11 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=11'); $intAccessGrp12 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=12'); $intAccessGrp13 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=13'); -if ($myVisClass->checkAccountGroup($intAccessGrp8, 'read') == 0) { +if ($myVisClass->checkAccountGroup($intAccessGrp8, 'read') === 0) { $conttp->setVariable('NAME', translate('Hosts')); $conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_host` ' - . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); + . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->setVariable('INACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_host` ' - . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); + . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->parse('statisticrow'); } -if ($myVisClass->checkAccountGroup($intAccessGrp9, 'read') == 0) { +if ($myVisClass->checkAccountGroup($intAccessGrp9, 'read') === 0) { $conttp->setVariable('NAME', translate('Services')); $conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_service` ' - . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); + . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->setVariable('INACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_service` ' - . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); + . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->parse('statisticrow'); } -if ($myVisClass->checkAccountGroup($intAccessGrp10, 'read') == 0) { +if ($myVisClass->checkAccountGroup($intAccessGrp10, 'read') === 0) { $conttp->setVariable('NAME', translate('Host groups')); $conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_hostgroup` ' - . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); + . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->setVariable('INACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_hostgroup` ' - . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); + . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->parse('statisticrow'); } -if ($myVisClass->checkAccountGroup($intAccessGrp11, 'read') == 0) { +if ($myVisClass->checkAccountGroup($intAccessGrp11, 'read') === 0) { $conttp->setVariable('NAME', translate('Service groups')); $conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_servicegroup` ' - . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); + . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->setVariable('INACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_servicegroup` ' - . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); + . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->parse('statisticrow'); } -if ($myVisClass->checkAccountGroup($intAccessGrp12, 'read') == 0) { +if ($myVisClass->checkAccountGroup($intAccessGrp12, 'read') === 0) { $conttp->setVariable('NAME', translate('Host templates')); $conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_hosttemplate` ' - . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); + . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->setVariable('INACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_hosttemplate` ' - . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); + . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->parse('statisticrow'); } -if ($myVisClass->checkAccountGroup($intAccessGrp13, 'read') == 0) { +if ($myVisClass->checkAccountGroup($intAccessGrp13, 'read') === 0) { $conttp->setVariable('NAME', translate('Service templates')); $conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_servicetemplate` ' - . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); + . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->setVariable('INACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_servicetemplate` ' - . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); + . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->parse('statisticrow'); } $conttp->parse('statistics'); $conttp->parse('main'); $conttp->show('main'); -// -// Include Footer -// ============== +/* +Include Footer +*/ $maintp->setVariable('VERSION_INFO', "NagiosQL $setFileVersion"); + . "target='_blank'>NagiosQL $setFileVersion"); $maintp->parse('footer'); -$maintp->show('footer'); +$maintp->show('footer'); \ No newline at end of file diff --git a/admin/mutdialog.php b/admin/mutdialog.php index c8db35c..2a63251 100644 --- a/admin/mutdialog.php +++ b/admin/mutdialog.php @@ -1,64 +1,65 @@ Translated common strings + * @var int $intVersion from prepend_adm.php -> Nagios version + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$preContent = 'admin/mutdialog.htm.tpl'; -// -// Process post parameters -// ======================= +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$preContent = 'admin/mutdialog.htm.tpl'; +/* +Process post parameters +*/ $intExclude = filter_input(INPUT_GET, 'exclude', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); -$chkObject = filter_input(INPUT_GET, 'object', FILTER_SANITIZE_STRING); -// -// Include preprocessing file -// ========================== -$preAccess = 1; +$chkObject = filter_input(INPUT_GET, 'object'); +/* +Include preprocessing file +*/ +$preAccess = 1; $preFieldvars = 1; -$preNoMain = 1; -require $preBasePath.'functions/prepend_adm.php'; -// -// Include content -// =============== +$preNoMain = 1; +require $preBasePath . 'functions/prepend_adm.php'; +/* +Include content +*/ $conttp->setVariable('BASE_PATH', $_SESSION['SETS']['path']['base_url']); $conttp->setVariable('OPENER_FIELD', $chkObject); $conttp->parse('header'); $conttp->show('header'); -// -// Form -// ==== +/* +Form +*/ foreach ($arrDescription as $elem) { $conttp->setVariable($elem['name'], $elem['string']); } $conttp->setVariable('OPENER_FIELD', $chkObject); -$conttp->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$conttp->setVariable('IMAGE_PATH', $_SESSION['SETS']['path']['base_url']. 'images/'); +$conttp->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF')); +$conttp->setVariable('IMAGE_PATH', $_SESSION['SETS']['path']['base_url'] . 'images/'); $conttp->setVariable('AVAILABLE', translate('Available')); $conttp->setVariable('SELECTED', translate('Selected')); -if (($intExclude == 1) || ($intVersion < 3)) { +if (($intExclude === 1) || ($intVersion < 3)) { $conttp->setVariable('DISABLE_HTML_BEGIN', ''); } $conttp->parse('datainsert'); -$conttp->show('datainsert'); +$conttp->show('datainsert'); \ No newline at end of file diff --git a/admin/nagioscfg.php b/admin/nagioscfg.php index 9603f7c..e5f45d7 100644 --- a/admin/nagioscfg.php +++ b/admin/nagioscfg.php @@ -1,119 +1,135 @@ Application version string + * @var string $prePageKey from prepend_adm.php -> Menu group id + * @var string $chkTaFileText from prepend_content.php -> Text area + * @var array $arrDescription from fieldvars.php -> Translated common strings + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 28; -$preContent = 'admin/nagioscfg.htm.tpl'; -$preAccess = 1; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 28; +$preContent = 'admin/nagioscfg.htm.tpl'; +$preAccess = 1; $preFieldvars = 1; $intRemoveTmp = 0; -$strConfig = ''; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Get configuration set ID -// ======================== +$strConfig = ''; +$strErrorMessage = ''; +$strInfoMessage = ''; +/* +Include preprocessing files +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Get configuration set ID +*/ +$intMethod = 0; +$strMethod = ''; $myConfigClass->getConfigTargets($arrConfigSet); -$intConfigId = $arrConfigSet[0]; -$myConfigClass->getConfigValues($intConfigId, 'method', $intMethod); +$intConfigId = (int)$arrConfigSet[0]; +if ($myConfigClass->getConfigValues($intConfigId, 'method', $strMethod) === 0) { + $intMethod = (int)$strMethod; +} $myConfigClass->getConfigValues($intConfigId, 'nagiosbasedir', $strBaseDir); $myConfigClass->getConfigValues($intConfigId, 'conffile', $strConfigfile); -$strLocalBackup = $strConfigfile. '_old_' .date('YmdHis'); -// -// Convert Windows to UNIX -// ======================= +$strLocalBackup = $strConfigfile . '_old_' . date('YmdHis'); +/* Convert Windows to UNIX */ $chkTaFileText = str_replace("\r\n", "\n", $chkTaFileText); -// -// Process data -// ============ -if (($chkTaFileText != '') && ($arrConfigSet[0] != 0)) { - if ($intMethod == 1) { +/* +Process data +*/ +if (($chkTaFileText !== '') && ($arrConfigSet[0] !== 0)) { + if ($intMethod === 1) { if (file_exists($strBaseDir) && (is_writable($strBaseDir) && is_writable($strConfigfile))) { - // Backup config file + /* Backup config file */ $intReturn = $myConfigClass->moveFile('nagiosbasic', basename($strConfigfile), $intConfigId); - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } - // Write configuration + /* Write configuration */ $resFile = fopen($strConfigfile, 'wb'); fwrite($resFile, $chkTaFileText); fclose($resFile); - $myVisClass->processMessage('' .translate('Configuration file successfully ' - . 'written!'). '', $strInfoMessage); - $myDataClass->writeLog(translate('Configuration successfully written:'). ' ' .$strConfigfile); + $myVisClass->processMessage('' . translate('Configuration file successfully ' + . 'written!') . '', $strInfoMessage); + $myDataClass->writeLog(translate('Configuration successfully written:') . ' ' . $strConfigfile); } else { $myVisClass->processMessage(translate('Cannot open/overwrite the configuration file (check the ' - . 'permissions)!'), $strErrorMessage); - $myDataClass->writeLog(translate('Configuration write failed:'). ' ' .$strConfigfile); + . 'permissions)!'), $strErrorMessage); + $myDataClass->writeLog(translate('Configuration write failed:') . ' ' . $strConfigfile); } - } elseif (($intMethod == 2) || ($intMethod == 3)) { - // Backup config file + } elseif (($intMethod === 2) || ($intMethod === 3)) { + /* Backup config file */ $intReturn1 = $myConfigClass->moveFile('nagiosbasic', basename($strConfigfile), $intConfigId); - if ($intReturn1 == 1) { + if ($intReturn1 === 1) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } - // Write file to temporary + /* Write file to temporary */ $strFileName = tempnam($_SESSION['SETS']['path']['tempdir'], 'nagiosql_conf'); $resFile = fopen($strFileName, 'wb'); fwrite($resFile, $chkTaFileText); fclose($resFile); - // Copy configuration to remoty system + /* Copy configuration to remoty system */ $intReturn2 = $myConfigClass->remoteFileCopy($strConfigfile, $intConfigId, $strFileName, 1); - if ($intReturn2 == 0) { - $myVisClass->processMessage('' .translate('Configuration file successfully ' - . 'written!'). '', $strInfoMessage); - $myDataClass->writeLog(translate('Configuration successfully written:'). ' ' .$strConfigfile); - unlink($strFileName); + if ($intReturn2 === 0) { + $myVisClass->processMessage('' . translate('Configuration file successfully ' + . 'written!') . '', $strInfoMessage); + $myDataClass->writeLog(translate('Configuration successfully written:') . ' ' . $strConfigfile); } else { $myVisClass->processMessage(translate('Cannot open/overwrite the configuration file (check the permissions ' - . 'on remote system)!'), $strErrorMessage); - $myDataClass->writeLog(translate('Configuration write failed (remote):'). ' ' .$strConfigfile); - unlink($strFileName); + . 'on remote system)!'), $strErrorMessage); + $myDataClass->writeLog(translate('Configuration write failed (remote):') . ' ' . $strConfigfile); } + unlink($strFileName); } -} elseif ($arrConfigSet[0] == 0) { - $myVisClass->processMessage(translate('There are no nagios configuration files in common domain, please select a '. +} elseif ($arrConfigSet[0] === 0) { + $myVisClass->processMessage(translate('There are no nagios configuration files in common domain, please select a ' . 'valid domain to edit this files!'), $strErrorMessage); } -// -// Include content -// =============== +/* +Include content +*/ $conttp->setVariable('TITLE', translate('Nagios main configuration file')); -$conttp->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$conttp->setVariable('MAINSITE', $_SESSION['SETS']['path']['base_url']. 'admin.php'); +$conttp->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF')); +$conttp->setVariable('MAINSITE', $_SESSION['SETS']['path']['base_url'] . 'admin.php'); foreach ($arrDescription as $elem) { $conttp->setVariable($elem['name'], $elem['string']); } -// -// Open configuration -// ================== -if ($intMethod == 1) { +/* +Open configuration +*/ +if ($intMethod === 1) { if (file_exists($strConfigfile) && is_readable($strConfigfile)) { - $resFile = fopen($strConfigfile, 'rb'); + $resFile = fopen($strConfigfile, 'rb'); if ($resFile) { while (!feof($resFile)) { $strConfig .= fgets($resFile, 1024); @@ -122,12 +138,12 @@ if ($intMethod == 1) { } else { $myVisClass->processMessage(translate('Cannot open the data file (check the permissions)!'), $strErrorMessage); } -} elseif (($intMethod == 2) || ($intMethod == 3)) { - // Write file to temporary +} elseif (($intMethod === 2) || ($intMethod === 3)) { + /* Write file to temporary */ $strFileName = tempnam($_SESSION['SETS']['path']['tempdir'], 'nagiosql_conf'); - // Copy configuration from remoty system - $intReturn = $myConfigClass->remoteFileCopy($strConfigfile, $intConfigId, $strFileName, 0); - if ($intReturn == 0) { + /* Copy configuration from remoty system */ + $intReturn = $myConfigClass->remoteFileCopy($strConfigfile, $intConfigId, $strFileName); + if ($intReturn === 0) { $resFile = fopen($strFileName, 'rb'); if (is_resource($resFile)) { while (!feof($resFile)) { @@ -139,27 +155,27 @@ if ($intMethod == 1) { } } else { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); - $myDataClass->writeLog(translate('Configuration read failed (remote):'). ' ' .$strErrorMessage); + $myDataClass->writeLog(translate('Configuration read failed (remote):') . ' ' . $strErrorMessage); if (file_exists($strFileName)) { unlink($strFileName); } } } $conttp->setVariable('DAT_NAGIOS_CONFIG', $strConfig); -if ($strErrorMessage != '') { +if ($strErrorMessage !== '') { $conttp->setVariable('ERRORMESSAGE', $strErrorMessage); } $conttp->setVariable('INFOMESSAGE', $strInfoMessage); -// Check access rights for adding new objects -if ($myVisClass->checkAccountGroup($prePageKey, 'write') != 0) { +/* Check access rights for adding new objects */ +if ($myVisClass->checkAccountGroup($prePageKey, 'write') !== 0) { $conttp->setVariable('ADD_CONTROL', 'disabled="disabled"'); } $conttp->parse('naginsert'); $conttp->show('naginsert'); -// -// Process footer -// ============== +/* +Process footer +*/ $maintp->setVariable('VERSION_INFO', "NagiosQL $setFileVersion"); + . "target='_blank'>NagiosQL $setFileVersion"); $maintp->parse('footer'); -$maintp->show('footer'); +$maintp->show('footer'); \ No newline at end of file diff --git a/admin/password.php b/admin/password.php index 06b2805..1d987f8 100644 --- a/admin/password.php +++ b/admin/password.php @@ -1,96 +1,114 @@ Application version string + * @var string $tplHeaderVar from prepend_adm.php -> Header content + * @var int $prePageKey from prepend_adm.php -> Admin access key + * @var array $arrDescription from fieldvars.php -> Translated common strings + * @var array $SETS Settings array + * @var string $chkTfValue1 from prepend_content.php -> Old Password + * @var string $chkTfValue2 from prepend_content.php -> New Password 1 + * @var string $chkTfValue3 from prepend_content.php -> New Password 2 + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 31; -$preContent = 'admin/password.htm.tpl'; -$preAccess = 1; -$preFieldvars = 1; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 31; +$preContent = 'admin/password.htm.tpl'; +$preAccess = 1; +$preFieldvars = 1; $preShowHeader = 0; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Change password -// ======================= -if (($chkTfValue1 != '') && ($chkTfValue2 != '')) { - // Check old password - $strSQL = 'SELECT * FROM `tbl_user` ' - . "WHERE `username`='".$_SESSION['username']."' AND `password`=MD5('$chkTfValue1')"; +$strErrorMessage = ''; +/* +Include preprocessing file +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Change password +*/ +if (($chkTfValue1 !== '') && ($chkTfValue2 !== '')) { + /* Check old password */ + $strSQL = 'SELECT * FROM `tbl_user` ' + . "WHERE `username`='" . $_SESSION['username'] . "' AND `password`=MD5('$chkTfValue1')"; $booReturn = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); - } elseif ($intDataCount == 1) { - // Check equality and password length - if (($chkTfValue2 === $chkTfValue3) && (strlen($chkTfValue2) >=5)) { - // Update database + } elseif ($intDataCount === 1) { + /* Check equality and password length */ + if (($chkTfValue2 === $chkTfValue3) && (strlen($chkTfValue2) >= 5)) { + /* Update database */ $strSQLUpdate = "UPDATE `tbl_user` SET `password`=MD5('$chkTfValue2'), `last_login`=NOW() " - . "WHERE `username`='".$_SESSION['username']."'"; + . "WHERE `username`='" . $_SESSION['username'] . "'"; $booReturn = $myDBClass->insertData($strSQLUpdate); - if ($booReturn == true) { + if ($booReturn === true) { $myDataClass->writeLog(translate('Password successfully modified')); - // Force new login + /* Force new login */ $_SESSION['logged_in'] = 0; - $_SESSION['username'] = ''; - $_SESSION['userid'] = 0; - $_SESSION['groupadm'] = 0; - $_SESSION['domain'] = 0; - header('Location: ' .$SETS['path']['protocol']. '://' . - filter_input(INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_STRING). - $_SESSION['SETS']['path']['base_url']. 'index.php'); + $_SESSION['username'] = ''; + $_SESSION['userid'] = 0; + $_SESSION['groupadm'] = 0; + $_SESSION['domain'] = 0; + header('Location: ' . $SETS['path']['protocol'] . '://' . + filter_input(INPUT_SERVER, 'HTTP_HOST') . + $_SESSION['SETS']['path']['base_url'] . 'index.php'); } else { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } } else { - // New password wrong + /* New password wrong */ $myVisClass->processMessage( translate('Password too short or password fields do not match!'), $strErrorMessage ); } } else { - // Old password wrong + /* Old password wrong */ $myVisClass->processMessage(translate('The old password is invalid'), $strErrorMessage); } } elseif (filter_input(INPUT_POST, 'submit')) { - // Wrong data + /* Wrong data */ $myVisClass->processMessage( translate('Database entry failed! Not all necessary data filled in!'), $strErrorMessage ); } -// -// Output header variable -// ====================== +/* +Output header variable +*/ echo $tplHeaderVar; -// -// Include content -// =============== +/* +Include content +*/ foreach ($arrDescription as $elem) { $conttp->setVariable($elem['name'], $elem['string']); } @@ -99,21 +117,21 @@ $conttp->setVariable('LANG_ABORT', translate('Abort')); $conttp->setVariable('FILL_ALLFIELDS', translate('Please fill in all fields marked with an *')); $conttp->setVariable('FILL_NEW_PASSWD_NOT_EQUAL', translate('The new passwords don not match!')); $conttp->setVariable('FILL_NEW_PWDSHORT', translate('The new password is too short - use at least 6 characters!')); -if ($strErrorMessage != '') { +if ($strErrorMessage !== '') { $conttp->setVariable('ERRORMESSAGE', $strErrorMessage); } -$conttp->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$conttp->setVariable('IMAGE_PATH', $_SESSION['SETS']['path']['base_url']. 'images/'); -// Check access rights for adding new objects -if ($myVisClass->checkAccountGroup($prePageKey, 'write') != 0) { +$conttp->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF')); +$conttp->setVariable('IMAGE_PATH', $_SESSION['SETS']['path']['base_url'] . 'images/'); +/* Check access rights for adding new objects */ +if ($myVisClass->checkAccountGroup($prePageKey, 'write') !== 0) { $conttp->setVariable('ADD_CONTROL', 'disabled="disabled"'); } $conttp->parse('passwordsite'); $conttp->show('passwordsite'); -// -// Include footer -// ============== +/* +Include footer +*/ $maintp->setVariable('VERSION_INFO', "NagiosQL $setFileVersion"); + . "target='_blank'>NagiosQL $setFileVersion"); $maintp->parse('footer'); -$maintp->show('footer'); +$maintp->show('footer'); \ No newline at end of file diff --git a/admin/servicedependencies.php b/admin/servicedependencies.php index 4f5db58..820ecec 100644 --- a/admin/servicedependencies.php +++ b/admin/servicedependencies.php @@ -1,165 +1,269 @@ Application version string + * @var int $chkActive from prepend_adm.php -> Active checkbox + * @var int $chkRegister from prepend_adm.php -> Register checkbox + * @var string $chkModus from prepend_adm.php -> Form work mode + * @var int $chkDataId from prepend_adm.php -> Actual dataset id + * @var string $chkSelModify from prepend_adm.php -> Modification selection value + * @var int $hidSortBy from prepend_adm.php -> Sort data by + * @var string $hidSortDir from prepend_adm.php -> Sort data direction (ASC, DESC) + * @var int $chkLimit from prepend_adm.php / settings -> Data set count per page + * @var int $intVersion from prepend_adm.php -> Nagios version + * @var array $SETS Settings array + * @var int $intGlobalWriteAccess from prepend_content.php -> Global admin write access + * @var int $intWriteAccessId from prepend_content.php -> Admin write access to actual dataset id + * @var string $strAccess from prepend_content.php -> List of read access group id's for actual user + * @var string $preSQLCommon1 from prepend_content.php -> Common SQL part 1 + * @var string $strSearchWhere from prepend_content.php -> SQL WHERE addon for data search + * @var string $strDomainWhere from prepend_adm.php -> Domain selection SQL part with table name + * @var string $chkSelAccGr from prepend_content.php -> Access group selector + * @var string $chkTfValue1 from prepend_content.php -> Configuration name + * @var int $chkSelValue1 from prepend_content.php -> Dependency period + * @var array $chkMselValue1 from prepend_content.php -> Hosts + * @var array $chkMselValue2 from prepend_content.php -> Dependent hosts + * @var array $chkMselValue3 from prepend_content.php -> Hostgroups + * @var array $chkMselValue4 from prepend_content.php -> Dependent hostgroups + * @var array $chkMselValue5 from prepend_content.php -> Services + * @var array $chkMselValue6 from prepend_content.php -> Dependent services + * @var array $chkMselValue7 from prepend_content.php -> Servicegroups + * @var array $chkMselValue8 from prepend_content.php -> Dependent servicegroups + * @var int $intMselValue1 from prepend_content.php -> Hosts multiselect status value + * @var int $intMselValue2 from prepend_content.php -> Dependent hosts multiselect status value + * @var int $intMselValue3 from prepend_content.php -> Hostgroups multiselect status value + * @var int $intMselValue4 from prepend_content.php -> Dependent hostgroups multiselect status value + * @var int $intMselValue5 from prepend_content.php -> Services multiselect status value + * @var int $intMselValue6 from prepend_content.php -> Dependent services multiselect status value + * @var int $intMselValue7 from prepend_content.php -> Dependent servicegroups multiselect status value + * @var int $intMselValue8 from prepend_content.php -> Hostgroups multiselect status value + * @var string $chkChbGr1a from prepend_content.php -> Execution failure criteria (o) + * @var string $chkChbGr1b from prepend_content.php -> Execution failure criteria (w) + * @var string $chkChbGr1c from prepend_content.php -> Execution failure criteria (u) + * @var string $chkChbGr1d from prepend_content.php -> Execution failure criteria (c) + * @var string $chkChbGr1e from prepend_content.php -> Execution failure criteria (p) + * @var string $chkChbGr1f from prepend_content.php -> Execution failure criteria (n) + * @var string $chkChbGr2a from prepend_content.php -> Notification failure criteria (o) + * @var string $chkChbGr2b from prepend_content.php -> Notification failure criteria (w) + * @var string $chkChbGr2c from prepend_content.php -> Notification failure criteria (u) + * @var string $chkChbGr2d from prepend_content.php -> Notification failure criteria (c) + * @var string $chkChbGr2e from prepend_content.php -> Notification failure criteria (p) + * @var string $chkChbGr2f from prepend_content.php -> Notification failure criteria (n) + * @var int $chkChbValue1 from prepend_content.php -> Inherit parents + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 22; -$preContent = 'admin/servicedependencies.htm.tpl'; -$preListTpl = 'admin/datalist.htm.tpl'; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 22; +$preContent = 'admin/servicedependencies.htm.tpl'; +$preListTpl = 'admin/datalist.htm.tpl'; $preSearchSession = 'servicedependencies'; -$preTableName = 'tbl_servicedependency'; -$preKeyField = 'config_name'; -$preAccess = 1; -$preFieldvars = 1; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Data processing -// =============== -$strEO = substr($chkChbGr1a.$chkChbGr1b.$chkChbGr1c.$chkChbGr1d.$chkChbGr1e.$chkChbGr1f, 0, -1); -$strNO = substr($chkChbGr2a.$chkChbGr2b.$chkChbGr2c.$chkChbGr2d.$chkChbGr2e.$chkChbGr2f, 0, -1); -// -// Add or modify data -// ================== -if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAccess == 0)) { +$preTableName = 'tbl_servicedependency'; +$preKeyField = 'config_name'; +$preAccess = 1; +$preFieldvars = 1; +$strErrorMessage = ''; +$strInfoMessage = ''; +$strConsistMessage = ''; +$strDBWarning = ''; +$intDataWarning = 0; +$intRet1 = 0; +$intRet2 = 0; +$intRet3 = 0; +$intRet4 = 0; +$intRet5 = 0; +$intRet6 = 0; +$intRet7 = 0; +$intRet8 = 0; +$intNoTime = 0; +/* +Default values for form variables +*/ +if (!isset($intMselValue1)) { + $intMselValue1 = 0; +} +if (!isset($intMselValue2)) { + $intMselValue2 = 0; +} +if (!isset($intMselValue3)) { + $intMselValue3 = 0; +} +if (!isset($intMselValue4)) { + $intMselValue4 = 0; +} +if (!isset($intMselValue5)) { + $intMselValue5 = 0; +} +if (!isset($intMselValue6)) { + $intMselValue6 = 0; +} +if (!isset($intMselValue7)) { + $intMselValue7 = 0; +} +if (!isset($intMselValue8)) { + $intMselValue8 = 0; +} +/* +Include preprocessing files +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Data processing +*/ +$strEO = substr($chkChbGr1a . $chkChbGr1b . $chkChbGr1c . $chkChbGr1d . $chkChbGr1e . $chkChbGr1f, 0, -1); +$strNO = substr($chkChbGr2a . $chkChbGr2b . $chkChbGr2c . $chkChbGr2d . $chkChbGr2e . $chkChbGr2f, 0, -1); +/* +Add or modify data +*/ +if ((($chkModus === 'insert') || ($chkModus === 'modify')) && ($intGlobalWriteAccess === 0)) { $strSQLx = "`$preTableName` SET `dependent_host_name`=$intMselValue2, `dependent_hostgroup_name`=$intMselValue4, " . "`dependent_service_description`=$intMselValue6, `dependent_servicegroup_name`=$intMselValue8, " . "`host_name`=$intMselValue1, `hostgroup_name`=$intMselValue3, `service_description`=$intMselValue5, " . "`servicegroup_name`=$intMselValue7, `$preKeyField`='$chkTfValue1', `inherits_parent`='$chkChbValue1', " . "`execution_failure_criteria`='$strEO', `notification_failure_criteria`='$strNO', " . "`dependency_period`=$chkSelValue1, $preSQLCommon1"; - if ($chkModus == 'insert') { - $strSQL = 'INSERT INTO ' .$strSQLx; + if ($chkModus === 'insert') { + $strSQL = 'INSERT INTO ' . $strSQLx; } else { - $strSQL = 'UPDATE ' .$strSQLx. ' WHERE `id`=' .$chkDataId; + $strSQL = 'UPDATE ' . $strSQLx . ' WHERE `id`=' . $chkDataId; } - if ($intWriteAccessId == 0) { - if (($chkTfValue1 != '') && (($intMselValue5 != 0) || ($intMselValue7 != 0)) && - (($intMselValue6 != 0) || ($intMselValue8 != 0))) { + if ($intWriteAccessId === 0) { + if (($chkTfValue1 !== '') && (($intMselValue5 !== 0) || ($intMselValue7 !== 0)) && + (($intMselValue6 !== 0) || ($intMselValue8 !== 0))) { $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($chkModus == 'insert') { + if ($chkModus === 'insert') { $chkDataId = $intInsertId; } - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); $myDataClass->updateStatusTable($preTableName); - if ($chkModus == 'insert') { - $myDataClass->writeLog(translate('New service dependency inserted:'). ' ' .$chkTfValue1); + if ($chkModus === 'insert') { + $myDataClass->writeLog(translate('New service dependency inserted:') . ' ' . $chkTfValue1); } - if ($chkModus == 'modify') { - $myDataClass->writeLog(translate('Service dependency modified:'). ' ' .$chkTfValue1); + if ($chkModus === 'modify') { + $myDataClass->writeLog(translate('Service dependency modified:') . ' ' . $chkTfValue1); } - // - // Insert/update relations - // ======================= - if ($chkModus == 'insert') { - if ($intMselValue1 != 0) { + /* + Insert/update relations + */ + if ($chkModus === 'insert') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataInsertRelation( 'tbl_lnkServicedependencyToHost_H', $chkDataId, $chkMselValue1 ); } - if (isset($intRet1) && ($intRet1 != 0)) { + if (isset($intRet1) && ($intRet1 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataInsertRelation( 'tbl_lnkServicedependencyToHost_DH', $chkDataId, $chkMselValue2 ); } - if (isset($intRet2) && ($intRet2 != 0)) { + if (isset($intRet2) && ($intRet2 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue3 != 0) { + if ($intMselValue3 !== 0) { $intRet3 = $myDataClass->dataInsertRelation( 'tbl_lnkServicedependencyToHostgroup_H', $chkDataId, $chkMselValue3 ); } - if (isset($intRet3) && ($intRet3 != 0)) { + if (isset($intRet3) && ($intRet3 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue4 != 0) { + if ($intMselValue4 !== 0) { $intRet4 = $myDataClass->dataInsertRelation( 'tbl_lnkServicedependencyToHostgroup_DH', $chkDataId, $chkMselValue4 ); } - if (isset($intRet4) && ($intRet4 != 0)) { + if (isset($intRet4) && ($intRet4 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue5 != 0) { + if ($intMselValue5 !== 0) { $intRet5 = $myDataClass->dataInsertRelation( 'tbl_lnkServicedependencyToService_S', $chkDataId, $chkMselValue5 ); } - if (isset($intRet5) && ($intRet5 != 0)) { + if (isset($intRet5) && ($intRet5 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue6 != 0) { + if ($intMselValue6 !== 0) { $intRet6 = $myDataClass->dataInsertRelation( 'tbl_lnkServicedependencyToService_DS', $chkDataId, $chkMselValue6 ); } - if (isset($intRet6) && ($intRet6 != 0)) { + if (isset($intRet6) && ($intRet6 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue7 != 0) { + if ($intMselValue7 !== 0) { $intRet7 = $myDataClass->dataInsertRelation( 'tbl_lnkServicedependencyToServicegroup_S', $chkDataId, $chkMselValue7 ); } - if (isset($intRet7) && ($intRet7 != 0)) { + if (isset($intRet7) && ($intRet7 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue8 != 0) { + if ($intMselValue8 !== 0) { $intRet8 = $myDataClass->dataInsertRelation( 'tbl_lnkServicedependencyToServicegroup_DS', $chkDataId, $chkMselValue8 ); } - if (isset($intRet8) && ($intRet8 != 0)) { + if (isset($intRet8) && ($intRet8 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - } elseif ($chkModus == 'modify') { - if ($intMselValue1 != 0) { + } elseif ($chkModus === 'modify') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataUpdateRelation( 'tbl_lnkServicedependencyToHost_H', $chkDataId, @@ -168,10 +272,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet1 = $myDataClass->dataDeleteRelation('tbl_lnkServicedependencyToHost_H', $chkDataId); } - if ($intRet1 != 0) { + if ($intRet1 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataUpdateRelation( 'tbl_lnkServicedependencyToHost_DH', $chkDataId, @@ -180,10 +284,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet2 = $myDataClass->dataDeleteRelation('tbl_lnkServicedependencyToHost_DH', $chkDataId); } - if ($intRet2 != 0) { + if ($intRet2 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue3 != 0) { + if ($intMselValue3 !== 0) { $intRet3 = $myDataClass->dataUpdateRelation( 'tbl_lnkServicedependencyToHostgroup_H', $chkDataId, @@ -195,10 +299,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce $chkDataId ); } - if ($intRet3 != 0) { + if ($intRet3 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue4 != 0) { + if ($intMselValue4 !== 0) { $intRet4 = $myDataClass->dataUpdateRelation( 'tbl_lnkServicedependencyToHostgroup_DH', $chkDataId, @@ -210,10 +314,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce $chkDataId ); } - if ($intRet4 != 0) { + if ($intRet4 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue5 != 0) { + if ($intMselValue5 !== 0) { $intRet5 = $myDataClass->dataUpdateRelation( 'tbl_lnkServicedependencyToService_S', $chkDataId, @@ -225,10 +329,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce $chkDataId ); } - if ($intRet5 != 0) { + if ($intRet5 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue6 != 0) { + if ($intMselValue6 !== 0) { $intRet6 = $myDataClass->dataUpdateRelation( 'tbl_lnkServicedependencyToService_DS', $chkDataId, @@ -240,10 +344,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce $chkDataId ); } - if ($intRet6 != 0) { + if ($intRet6 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue7 != 0) { + if ($intMselValue7 !== 0) { $intRet7 = $myDataClass->dataUpdateRelation( 'tbl_lnkServicedependencyToServicegroup_S', $chkDataId, @@ -255,10 +359,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce $chkDataId ); } - if ($intRet7 != 0) { + if ($intRet7 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue8 != 0) { + if ($intMselValue8 !== 0) { $intRet8 = $myDataClass->dataUpdateRelation( 'tbl_lnkServicedependencyToServicegroup_DS', $chkDataId, @@ -270,18 +374,18 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce $chkDataId ); } - if ($intRet8 != 0) { + if ($intRet8 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } - if (($intRet1 + $intRet2 + $intRet3 + $intRet4 + $intRet5 + $intRet6 + $intRet7 + $intRet8) != 0) { + if (($intRet1 + $intRet2 + $intRet3 + $intRet4 + $intRet5 + $intRet6 + $intRet7 + $intRet8) !== 0) { $strInfoMessage = ''; } - // - // Update Import HASH - // ================== + /* + Update Import HASH + */ $booReturn = $myDataClass->updateHash($preTableName, $chkDataId); - if ($booReturn != 0) { + if ($booReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } @@ -296,139 +400,125 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } $chkModus = 'display'; } -if (($chkModus != 'add') && ($chkModus != 'refresh')) { - $chkModus = 'display'; +if (($chkModus !== 'add') && ($chkModus !== 'refresh')) { + $chkModus = 'display'; } -// -// Get date/time of last database and config file manipulation -// =========================================================== +/* +Get date/time of last database and config file manipulation +*/ $intReturn = $myConfigClass->lastModifiedFile($preTableName, $arrTimeData, $strTimeInfoString); -if ($intReturn != 0) { +if ($intReturn !== 0) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } -// -// Singe data form -// =============== -if (($chkModus == 'add') || ($chkModus == 'refresh')) { +/* +Singe data form +*/ +if (($chkModus === 'add') || ($chkModus === 'refresh')) { $conttp->setVariable('TITLE', translate('Define service dependencies (servicedependencies.cfg)')); - if ($chkModus == 'refresh') { - $_SESSION['refresh']['sd_host'] = $chkMselValue1; - $_SESSION['refresh']['sd_dependent_host'] = $chkMselValue2; - $_SESSION['refresh']['sd_hostgroup'] = $chkMselValue3; - $_SESSION['refresh']['sd_dependent_hostgroup'] = $chkMselValue4; - $_SESSION['refresh']['sd_service'] = $chkMselValue5; - $_SESSION['refresh']['sd_dependent_service'] = $chkMselValue6; - $_SESSION['refresh']['sd_servicegroup'] = $chkMselValue7; - $_SESSION['refresh']['sd_dependent_servicegroup'] = $chkMselValue8; - $myVisClass->arrSession = $_SESSION; - } else { - $_SESSION['refresh']['sd_host'] = $chkMselValue1; - $_SESSION['refresh']['sd_dependent_host'] = $chkMselValue2; - $_SESSION['refresh']['sd_hostgroup'] = $chkMselValue3; - $_SESSION['refresh']['sd_dependent_hostgroup'] = $chkMselValue4; - $_SESSION['refresh']['sd_service'] = $chkMselValue5; - $_SESSION['refresh']['sd_dependent_service'] = $chkMselValue6; - $_SESSION['refresh']['sd_servicegroup'] = $chkMselValue7; - $_SESSION['refresh']['sd_dependent_servicegroup'] = $chkMselValue8; + $_SESSION['refresh']['sd_host'] = $chkMselValue1; + $_SESSION['refresh']['sd_dependent_host'] = $chkMselValue2; + $_SESSION['refresh']['sd_hostgroup'] = $chkMselValue3; + $_SESSION['refresh']['sd_dependent_hostgroup'] = $chkMselValue4; + $_SESSION['refresh']['sd_service'] = $chkMselValue5; + $_SESSION['refresh']['sd_dependent_service'] = $chkMselValue6; + $_SESSION['refresh']['sd_servicegroup'] = $chkMselValue7; + $_SESSION['refresh']['sd_dependent_servicegroup'] = $chkMselValue8; + if ($chkModus !== 'refresh') { if (isset($arrModifyData['dependent_host_name']) && ($arrModifyData['dependent_host_name'] > 0)) { $arrTemp = array(); - $strSQL = 'SELECT `idSlave`, `exclude` FROM `tbl_lnkServicedependencyToHost_DH` ' - . 'WHERE `idMaster` = ' .$arrModifyData['id']; + $strSQL = 'SELECT `idSlave`, `exclude` FROM `tbl_lnkServicedependencyToHost_DH` ' + . 'WHERE `idMaster` = ' . $arrModifyData['id']; $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDC); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($booReturn && ($intDC != 0)) { + if ($booReturn && ($intDC !== 0)) { foreach ($arrData as $elem) { - if ($elem['exclude'] == 1) { - $arrTemp[] = 'e' .$elem['idSlave']; + if ($elem['exclude'] === 1) { + $arrTemp[] = 'e' . $elem['idSlave']; } else { $arrTemp[] = $elem['idSlave']; } } } - if ($arrModifyData['dependent_host_name'] == 2) { + if ($arrModifyData['dependent_host_name'] === 2) { $arrTemp[] = '*'; } $_SESSION['refresh']['sd_dependent_host'] = $arrTemp; } if (isset($arrModifyData['host_name']) && ($arrModifyData['host_name'] > 0)) { $arrTemp = array(); - $strSQL = 'SELECT `idSlave`, `exclude` FROM `tbl_lnkServicedependencyToHost_H` ' - . 'WHERE `idMaster` = ' .$arrModifyData['id']; + $strSQL = 'SELECT `idSlave`, `exclude` FROM `tbl_lnkServicedependencyToHost_H` ' + . 'WHERE `idMaster` = ' . $arrModifyData['id']; $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDC); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($intDC != 0) { + if ($intDC !== 0) { foreach ($arrData as $elem) { - if ($elem['exclude'] == 1) { - $arrTemp[] = 'e' .$elem['idSlave']; + if ($elem['exclude'] === 1) { + $arrTemp[] = 'e' . $elem['idSlave']; } else { $arrTemp[] = $elem['idSlave']; } } } - if ($arrModifyData['host_name'] == 2) { + if ($arrModifyData['host_name'] === 2) { $arrTemp[] = '*'; } $_SESSION['refresh']['sd_host'] = $arrTemp; } if (isset($arrModifyData['dependent_hostgroup_name']) && ($arrModifyData['dependent_hostgroup_name'] > 0)) { $arrTemp = array(); - $strSQL = 'SELECT `idSlave`, `exclude` FROM `tbl_lnkServicedependencyToHostgroup_DH` ' - . 'WHERE `idMaster` = ' .$arrModifyData['id']; + $strSQL = 'SELECT `idSlave`, `exclude` FROM `tbl_lnkServicedependencyToHostgroup_DH` ' + . 'WHERE `idMaster` = ' . $arrModifyData['id']; $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDC); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($intDC != 0) { + if ($intDC !== 0) { foreach ($arrData as $elem) { - if ($elem['exclude'] == 1) { - $arrTemp[] = 'e' .$elem['idSlave']; + if ($elem['exclude'] === 1) { + $arrTemp[] = 'e' . $elem['idSlave']; } else { $arrTemp[] = $elem['idSlave']; } } } - if ($arrModifyData['dependent_hostgroup_name'] == 2) { + if ($arrModifyData['dependent_hostgroup_name'] === 2) { $arrTemp[] = '*'; } - $_SESSION['refresh']['sd_dependent_hostgroup'] = $arrTemp; + $_SESSION['refresh']['sd_dependent_hostgroup'] = $arrTemp; } if (isset($arrModifyData['hostgroup_name']) && ($arrModifyData['hostgroup_name'] > 0)) { - $arrTemp = array(); - $strSQL = 'SELECT `idSlave`, `exclude` FROM `tbl_lnkServicedependencyToHostgroup_H` ' - . 'WHERE `idMaster` = ' .$arrModifyData['id']; + $arrTemp = array(); + $strSQL = 'SELECT `idSlave`, `exclude` FROM `tbl_lnkServicedependencyToHostgroup_H` ' + . 'WHERE `idMaster` = ' . $arrModifyData['id']; $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDC); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($intDC != 0) { + if ($intDC !== 0) { foreach ($arrData as $elem) { - if ($elem['exclude'] == 1) { - $arrTemp[] = 'e' .$elem['idSlave']; + if ($elem['exclude'] === 1) { + $arrTemp[] = 'e' . $elem['idSlave']; } else { $arrTemp[] = $elem['idSlave']; } } } - if ($arrModifyData['hostgroup_name'] == 2) { + if ($arrModifyData['hostgroup_name'] === 2) { $arrTemp[] = '*'; } - $_SESSION['refresh']['sd_hostgroup'] = $arrTemp; + $_SESSION['refresh']['sd_hostgroup'] = $arrTemp; } - $myVisClass->arrSession = $_SESSION; } - // Do not show modified time list + $myVisClass->arrSession = $_SESSION; + /* Do not show modified time list */ $intNoTime = 1; - // Process host selection field - if (isset($arrModifyData['dependent_host_name'])) { - $intFieldId = $arrModifyData['dependent_host_name']; - } else { - $intFieldId = 0; - } - if (($chkModus == 'refresh') && is_array($chkMselValue2) && (count($chkMselValue2) != 0)) { + /* Process host selection field */ + $intFieldId = $arrModifyData['dependent_host_name'] ?? 0; + if (($chkModus === 'refresh') && is_array($chkMselValue2) && (count($chkMselValue2) !== 0)) { $strRefresh = 'sd_dependent_host'; } else { $strRefresh = ''; @@ -443,15 +533,11 @@ if (($chkModus == 'add') || ($chkModus == 'refresh')) { -9, $strRefresh ); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['host_name'])) { - $intFieldId = $arrModifyData['host_name']; - } else { - $intFieldId = 0; - } - if (($chkModus == 'refresh') && is_array($chkMselValue1) && (count($chkMselValue1) != 0)) { + $intFieldId = $arrModifyData['host_name'] ?? 0; + if (($chkModus === 'refresh') && is_array($chkMselValue1) && (count($chkMselValue1) !== 0)) { $strRefresh = 'sd_host'; } else { $strRefresh = ''; @@ -466,29 +552,21 @@ if (($chkModus == 'add') || ($chkModus == 'refresh')) { -9, $strRefresh ); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process time period selection field - if (isset($arrModifyData['dependency_period'])) { - $intFieldId = $arrModifyData['dependency_period']; - } else { - $intFieldId = 0; - } - if ($chkModus == 'refresh') { + /* Process time period selection field */ + $intFieldId = $arrModifyData['dependency_period'] ?? 0; + if ($chkModus === 'refresh') { $intFieldId = $chkSelValue1; } $intReturn = $myVisClass->parseSelectSimple('tbl_timeperiod', 'timeperiod_name', 'timeperiod', 1, $intFieldId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process host group selection field - if (isset($arrModifyData['dependent_hostgroup_name'])) { - $intFieldId = $arrModifyData['dependent_hostgroup_name']; - } else { - $intFieldId = 0; - } - if (($chkModus == 'refresh') && is_array($chkMselValue4) && (count($chkMselValue4) != 0)) { + /* Process host group selection field */ + $intFieldId = $arrModifyData['dependent_hostgroup_name'] ?? 0; + if (($chkModus === 'refresh') && is_array($chkMselValue4) && (count($chkMselValue4) !== 0)) { $strRefresh = 'sd_dependent_hostgroup'; } else { $strRefresh = ''; @@ -503,15 +581,11 @@ if (($chkModus == 'add') || ($chkModus == 'refresh')) { -9, $strRefresh ); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['hostgroup_name'])) { - $intFieldId = $arrModifyData['hostgroup_name']; - } else { - $intFieldId = 0; - } - if (($chkModus == 'refresh') && is_array($chkMselValue3) && (count($chkMselValue3) != 0)) { + $intFieldId = $arrModifyData['hostgroup_name'] ?? 0; + if (($chkModus === 'refresh') && is_array($chkMselValue3) && (count($chkMselValue3) !== 0)) { $strRefresh = 'sd_hostgroup'; } else { $strRefresh = ''; @@ -526,20 +600,16 @@ if (($chkModus == 'add') || ($chkModus == 'refresh')) { -9, $strRefresh ); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (($intReturn1 != 0) && ($intReturn2 != 0)) { + if (($intReturn1 !== 0) && ($intReturn2 !== 0)) { $myVisClass->processMessage(translate('Attention, no hosts and hostgroups defined!'), $strDBWarning); $intDataWarning = 1; } - // Process services selection field - if (isset($arrModifyData['dependent_service_description'])) { - $intFieldId = $arrModifyData['dependent_service_description']; - } else { - $intFieldId = 0; - } - if (($chkModus == 'refresh') && is_array($chkMselValue6) && (count($chkMselValue6) != 0)) { + /* Process services selection field */ + $intFieldId = $arrModifyData['dependent_service_description'] ?? 0; + if (($chkModus === 'refresh') && is_array($chkMselValue6) && (count($chkMselValue6) !== 0)) { $strRefresh = 'sd_dependent_service'; } else { $strRefresh = ''; @@ -554,15 +624,11 @@ if (($chkModus == 'add') || ($chkModus == 'refresh')) { -9, $strRefresh ); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['service_description'])) { - $intFieldId = $arrModifyData['service_description']; - } else { - $intFieldId = 0; - } - if (($chkModus == 'refresh') && is_array($chkMselValue5) && (count($chkMselValue5) != 0)) { + $intFieldId = $arrModifyData['service_description'] ?? 0; + if (($chkModus === 'refresh') && is_array($chkMselValue5) && (count($chkMselValue5) !== 0)) { $strRefresh = 'sd_service'; } else { $strRefresh = ''; @@ -577,16 +643,12 @@ if (($chkModus == 'add') || ($chkModus == 'refresh')) { -9, $strRefresh ); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process servicegroup selection field - if (isset($arrModifyData['dependent_servicegroup_name'])) { - $intFieldId = $arrModifyData['dependent_servicegroup_name']; - } else { - $intFieldId = 0; - } - if (($chkModus == 'refresh') && is_array($chkMselValue8) && (count($chkMselValue8) != 0)) { + /* Process servicegroup selection field */ + $intFieldId = $arrModifyData['dependent_servicegroup_name'] ?? 0; + if (($chkModus === 'refresh') && is_array($chkMselValue8) && (count($chkMselValue8) !== 0)) { $strRefresh = 'sd_dependent_servicegroup'; } else { $strRefresh = ''; @@ -601,15 +663,11 @@ if (($chkModus == 'add') || ($chkModus == 'refresh')) { -9, $strRefresh ); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['servicegroup_name'])) { - $intFieldId = $arrModifyData['servicegroup_name']; - } else { - $intFieldId = 0; - } - if (($chkModus == 'refresh') && is_array($chkMselValue7) && (count($chkMselValue7) != 0)) { + $intFieldId = $arrModifyData['servicegroup_name'] ?? 0; + if (($chkModus === 'refresh') && is_array($chkMselValue7) && (count($chkMselValue7) !== 0)) { $strRefresh = 'sd_servicegroup'; } else { $strRefresh = ''; @@ -624,102 +682,101 @@ if (($chkModus == 'add') || ($chkModus == 'refresh')) { -9, $strRefresh ); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process access group selection field - if (isset($arrModifyData['access_group'])) { - $intFieldId = $arrModifyData['access_group']; - } else { - $intFieldId = 0; - } - if ($chkModus == 'refresh') { + /* Process access group selection field */ + $intFieldId = $arrModifyData['access_group'] ?? 0; + if ($chkModus === 'refresh') { $intFieldId = $chkSelAccGr; } $intReturn = $myVisClass->parseSelectSimple('tbl_group', 'groupname', 'acc_group', 0, $intFieldId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Initial add/modify form definitions + /* Initial add/modify form definitions */ $myContentClass->addFormInit($conttp); - if ($intDataWarning == 1) { - $conttp->setVariable('WARNING', $strDBWarning. '
' .translate('Saving not possible!')); + if ($intDataWarning === 1) { + $conttp->setVariable('WARNING', $strDBWarning . '
' . translate('Saving not possible!')); } if ($intVersion < 3) { $conttp->setVariable('VERSION_20_VALUE_MUST', 'mselValue1,'); } - if ($chkModus == 'refresh') { - if ($chkTfValue1 != '') { + if ($chkModus === 'refresh') { + if ($chkTfValue1 !== '') { $conttp->setVariable('DAT_CONFIG_NAME', $chkTfValue1); } foreach (explode(',', $strEO) as $elem) { - $conttp->setVariable('DAT_EO' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_EO' . strtoupper($elem) . '_CHECKED', 'checked'); } foreach (explode(',', $strNO) as $elem) { - $conttp->setVariable('DAT_NO' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_NO' . strtoupper($elem) . '_CHECKED', 'checked'); } - if ($chkActive != 1) { - $conttp->setVariable('ACT_CHECKED', ''); + if ($chkActive !== 1) { + $conttp->setVariable('ACT_CHECKED'); } - if ($chkRegister != 1) { - $conttp->setVariable('REG_CHECKED', ''); + if ($chkRegister !== 1) { + $conttp->setVariable('REG_CHECKED'); } - if ($chkChbValue1 == 1) { + if ($chkChbValue1 === 1) { $conttp->setVariable('ACT_INHERIT', 'checked'); } - if ($chkDataId != 0) { + if ($chkDataId !== 0) { $conttp->setVariable('DAT_ID', $chkDataId); $conttp->setVariable('MODUS', 'modify'); } - // Insert data from database in "modify" mode - } elseif (isset($arrModifyData) && ($chkSelModify == 'modify')) { - // Check relation information to find out locked configuration datasets + /* Insert data from database in "modify" mode */ + } elseif (isset($arrModifyData) && ($chkSelModify === 'modify')) { + /* Check relation information to find out locked configuration datasets */ $intLocked = $myDataClass->infoRelation($preTableName, $arrModifyData['id'], $preKeyField); $myVisClass->processMessage($myDataClass->strInfoMessage, $strRelMessage); - $strInfo = '
' .translate('Entry cannot be activated because it is used by ' - . 'another configuration'). ':'; - $strInfo .= '
' .$strRelMessage. ''; - // Process data + $strInfo = '
' . translate('Entry cannot be activated because it is used by ' + . 'another configuration') . ':'; + $strInfo .= '
' . $strRelMessage . ''; + /* Process data */ $myContentClass->addInsertData($conttp, $arrModifyData, $intLocked, $strInfo); - // Setting special data - if ($arrModifyData['inherits_parent'] == 1) { + /* Setting special data */ + if ((int)$arrModifyData['inherits_parent'] === 1) { $conttp->setVariable('ACT_INHERIT', 'checked'); } foreach (explode(',', $arrModifyData['execution_failure_criteria']) as $elem) { - $conttp->setVariable('DAT_EO' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_EO' . strtoupper($elem) . '_CHECKED', 'checked'); } foreach (explode(',', $arrModifyData['notification_failure_criteria']) as $elem) { - $conttp->setVariable('DAT_NO' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_NO' . strtoupper($elem) . '_CHECKED', 'checked'); } } $conttp->parse('datainsert'); $conttp->show('datainsert'); } -// -// List view -// ========== -if ($chkModus == 'display') { - // Initial list view definitions +/* +List view +*/ +if ($chkModus === 'display') { + /* Initial list view definitions */ $myContentClass->listViewInit($mastertp); $mastertp->setVariable('TITLE', translate('Define service dependencies (servicedependencies.cfg)')); $mastertp->setVariable('FIELD_1', translate('Config name')); $mastertp->setVariable('FIELD_2', translate('Dependent services')); - // Process search string - if ($_SESSION['search'][$preSearchSession] != '') { - $strSearchTxt = $_SESSION['search'][$preSearchSession]; - $strSearchWhere = "AND (`$preKeyField` LIKE '%".$strSearchTxt."%')"; + $mastertp->setVariable('FILTER_VISIBLE', 'visibility: hidden'); + /* Process search string */ + if ($_SESSION['search'][$preSearchSession] !== '') { + $strSearchTxt = $_SESSION['search'][$preSearchSession]; + $strSearchWhere = "AND (`$preKeyField` LIKE '%" . $strSearchTxt . "%')"; } - // Row sorting + /* Row sorting */ $strOrderString = "ORDER BY `config_id`, `$preKeyField` $hidSortDir"; - if ($hidSortBy == 2) { + if ($hidSortBy === 2) { $strOrderString = "ORDER BY `config_id`, `$preKeyField` $hidSortDir"; } $mastertp->setVariable('DISABLE_SORT_2', 'disable'); - // Count datasets - $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` " + /* Count datasets */ + $intLineCount = 0; + /** @noinspection SqlResolve */ + $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` " . "WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess)"; $booReturn = $myDBClass->hasSingleDataset($strSQL, $arrDataLinesCount); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { @@ -728,16 +785,16 @@ if ($chkModus == 'display') { $chkLimit = 0; } } - // Get datasetsk - $strSQL = "SELECT `id`, `$preKeyField`, `dependent_service_description`, `register`, `active`, `config_id`, " + /* Get datasets */ + $strSQL = "SELECT `id`, `$preKeyField`, `dependent_service_description`, `register`, `active`, `config_id`, " . "`access_group` FROM `$preTableName`WHERE $strDomainWhere $strSearchWhere AND `access_group` " - . "IN ($strAccess) $strOrderString LIMIT $chkLimit,".$SETS['common']['pagelines']; + . "IN ($strAccess) $strOrderString LIMIT $chkLimit," . $SETS['common']['pagelines']; $booReturn = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - // Process data + /* Process data */ $myContentClass->listData( $mastertp, $arrDataLines, @@ -748,7 +805,7 @@ if ($chkModus == 'display') { 40 ); } -// Show messages +/* Show messages */ $myContentClass->showMessages( $mastertp, $strErrorMessage, @@ -758,7 +815,7 @@ $myContentClass->showMessages( $strTimeInfoString, $intNoTime ); -// -// Process footer -// ============== -$myContentClass->showFooter($maintp, $setFileVersion); +/* +Process footer +*/ +$myContentClass->showFooter($maintp, $setFileVersion); \ No newline at end of file diff --git a/admin/serviceescalations.php b/admin/serviceescalations.php index 7412fc5..2bc31eb 100644 --- a/admin/serviceescalations.php +++ b/admin/serviceescalations.php @@ -1,144 +1,230 @@ Application version string + * @var int $intVersion from prepend_adm.php -> Nagios version + * @var string $chkModus from prepend_adm.php -> Form work mode + * @var int $chkDataId from prepend_adm.php -> Actual dataset id + * @var string $chkSelModify from prepend_adm.php -> Modification selection value + * @var int $hidSortBy from prepend_adm.php -> Sort data by + * @var string $hidSortDir from prepend_adm.php -> Sort data direction (ASC, DESC) + * @var int $chkLimit from prepend_adm.php / settings -> Data set count per page + * @var array $SETS Settings array + * @var int $intGlobalWriteAccess from prepend_content.php -> Global admin write access + * @var int $intWriteAccessId from prepend_content.php -> Admin write access to actual dataset id + * @var string $strAccess from prepend_content.php -> List of read access group id's for actual user + * @var string $preSQLCommon1 from prepend_content.php -> Common SQL part 1 + * @var string $strSearchWhere from prepend_content.php -> SQL WHERE addon for data search + * @var string $strDomainWhere from prepend_adm.php -> Domain selection SQL part with table name + * @var string $chkSelAccGr from prepend_content.php -> Access group selector + * @var string $chkTfValue1 from prepend_content.php -> Configuration name + * @var int $chkSelValue1 from prepend_content.php -> Escalation period + * @var array $chkMselValue1 from prepend_content.php -> Hosts + * @var array $chkMselValue2 from prepend_content.php -> Host groups + * @var array $chkMselValue3 from prepend_content.php -> Services + * @var array $chkMselValue4 from prepend_content.php -> Contacts + * @var array $chkMselValue5 from prepend_content.php -> Contact groups + * @var array $chkMselValue6 from prepend_content.php -> Service groups + * @var int $intMselValue1 from prepend_content.php -> Hosts multiselect status value + * @var int $intMselValue2 from prepend_content.php -> Host groups multiselect status value + * @var int $intMselValue3 from prepend_content.php -> Services multiselect status value + * @var int $intMselValue4 from prepend_content.php -> Contacts multiselect status value + * @var int $intMselValue5 from prepend_content.php -> Contact groups multiselect status value + * @var int $intMselValue6 from prepend_content.php -> Service groups multiselect status value + * @var string $chkChbGr1a from prepend_content.php -> Escalation options (w) + * @var string $chkChbGr1b from prepend_content.php -> Escalation options (u) + * @var string $chkChbGr1c from prepend_content.php -> Escalation options (c) + * @var string $chkChbGr1d from prepend_content.php -> Escalation options (r) + * @var string $chkTfNullVal1 from prepend_content.php -> First notification + * @var string $chkTfNullVal2 from prepend_content.php -> Last notification + * @var string $chkTfNullVal3 from prepend_content.php -> Notification interval + * @var int $chkActive from prepend_adm.php -> Active checkbox + * @var int $chkRegister from prepend_adm.php -> Register checkbox + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 23; -$preContent = 'admin/serviceescalations.htm.tpl'; -$preListTpl = 'admin/datalist.htm.tpl'; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 23; +$preContent = 'admin/serviceescalations.htm.tpl'; +$preListTpl = 'admin/datalist.htm.tpl'; $preSearchSession = 'serviceescalation'; -$preTableName = 'tbl_serviceescalation'; -$preKeyField = 'config_name'; -$preAccess = 1; -$preFieldvars = 1; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Data processing -// =============== -$strEO = substr($chkChbGr1a.$chkChbGr1b.$chkChbGr1c.$chkChbGr1d, 0, -1); -// -// Add or modify data -// ================== -if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAccess == 0)) { +$preTableName = 'tbl_serviceescalation'; +$preKeyField = 'config_name'; +$preAccess = 1; +$preFieldvars = 1; +$strErrorMessage = ''; +$strInfoMessage = ''; +$strConsistMessage = ''; +$strDBWarning = ''; +$intDataWarning = 0; +$intRet1 = 0; +$intRet2 = 0; +$intRet3 = 0; +$intRet4 = 0; +$intRet5 = 0; +$intRet6 = 0; +$intNoTime = 0; +/* +Default values for form variables +*/ +if (!isset($intMselValue1)) { + $intMselValue1 = 0; +} +if (!isset($intMselValue2)) { + $intMselValue2 = 0; +} +if (!isset($intMselValue3)) { + $intMselValue3 = 0; +} +if (!isset($intMselValue4)) { + $intMselValue4 = 0; +} +if (!isset($intMselValue5)) { + $intMselValue5 = 0; +} +if (!isset($intMselValue6)) { + $intMselValue6 = 0; +} +/* +Include preprocessing files +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Data processing +*/ +$strEO = substr($chkChbGr1a . $chkChbGr1b . $chkChbGr1c . $chkChbGr1d, 0, -1); +/* +Add or modify data +*/ +if ((($chkModus === 'insert') || ($chkModus === 'modify')) && ($intGlobalWriteAccess === 0)) { $strSQLx = "`$preTableName` SET `$preKeyField`='$chkTfValue1', `host_name`=$intMselValue1, " . "`service_description`=$intMselValue3, `hostgroup_name`=$intMselValue2, `contacts`=$intMselValue4, " . "`contact_groups`=$intMselValue5, `servicegroup_name`=$intMselValue6, `first_notification`=$chkTfNullVal1, " . "`last_notification`=$chkTfNullVal2, `notification_interval`=$chkTfNullVal3, " . "`escalation_period`='$chkSelValue1', `escalation_options`='$strEO', $preSQLCommon1"; - if ($chkModus == 'insert') { - $strSQL = 'INSERT INTO ' .$strSQLx; + if ($chkModus === 'insert') { + $strSQL = 'INSERT INTO ' . $strSQLx; } else { - $strSQL = 'UPDATE ' .$strSQLx. ' WHERE `id`=' .$chkDataId; + $strSQL = 'UPDATE ' . $strSQLx . ' WHERE `id`=' . $chkDataId; } - if ($intWriteAccessId == 0) { - if ((($intMselValue1 != 0) || ($intMselValue2 != 0) || ($intMselValue6 != 0)) && (($intMselValue3 != 0) || - ($intMselValue6 != 0)) && (($intMselValue5 != 0) || ($intMselValue4 != 0)) && ($chkTfNullVal1 != 'NULL') && - ($chkTfNullVal2 != 'NULL') && ($chkTfNullVal3 != 'NULL')) { + if ($intWriteAccessId === 0) { + if ((($intMselValue1 !== 0) || ($intMselValue2 !== 0) || ($intMselValue6 !== 0)) && (($intMselValue3 !== 0) || + ($intMselValue6 !== 0)) && (($intMselValue5 !== 0) || ($intMselValue4 !== 0)) && ($chkTfNullVal1 !== 'NULL') && + ($chkTfNullVal2 !== 'NULL') && ($chkTfNullVal3 !== 'NULL')) { $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($chkModus == 'insert') { + if ($chkModus === 'insert') { $chkDataId = $intInsertId; } - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); $myDataClass->updateStatusTable($preTableName); - if ($chkModus == 'insert') { - $myDataClass->writeLog(translate('New service escalation inserted:'). ' ' .$chkTfValue1); + if ($chkModus === 'insert') { + $myDataClass->writeLog(translate('New service escalation inserted:') . ' ' . $chkTfValue1); } - if ($chkModus == 'modify') { - $myDataClass->writeLog(translate('Service escalation modified:'). ' ' .$chkTfValue1); + if ($chkModus === 'modify') { + $myDataClass->writeLog(translate('Service escalation modified:') . ' ' . $chkTfValue1); } - // - // Insert/update relations - // ======================= - if ($chkModus == 'insert') { - if ($intMselValue1 != 0) { + /* + Insert/update relations + */ + if ($chkModus === 'insert') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataInsertRelation( 'tbl_lnkServiceescalationToHost', $chkDataId, $chkMselValue1 ); } - if (isset($intRet1) && ($intRet1 != 0)) { + if (isset($intRet1) && ($intRet1 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataInsertRelation( 'tbl_lnkServiceescalationToHostgroup', $chkDataId, $chkMselValue2 ); } - if (isset($intRet2) && ($intRet2 != 0)) { + if (isset($intRet2) && ($intRet2 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue3 != 0) { + if ($intMselValue3 !== 0) { $intRet3 = $myDataClass->dataInsertRelation( 'tbl_lnkServiceescalationToService', $chkDataId, $chkMselValue3 ); } - if (isset($intRet3) && ($intRet3 != 0)) { + if (isset($intRet3) && ($intRet3 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue4 != 0) { + if ($intMselValue4 !== 0) { $intRet4 = $myDataClass->dataInsertRelation( 'tbl_lnkServiceescalationToContact', $chkDataId, $chkMselValue4 ); } - if (isset($intRet4) && ($intRet4 != 0)) { + if (isset($intRet4) && ($intRet4 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue5 != 0) { + if ($intMselValue5 !== 0) { $intRet5 = $myDataClass->dataInsertRelation( 'tbl_lnkServiceescalationToContactgroup', $chkDataId, $chkMselValue5 ); } - if (isset($intRet5) && ($intRet5 != 0)) { + if (isset($intRet5) && ($intRet5 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue6 != 0) { + if ($intMselValue6 !== 0) { $intRet6 = $myDataClass->dataInsertRelation( 'tbl_lnkServiceescalationToServicegroup', $chkDataId, $chkMselValue6 ); } - if (isset($intRet6) && ($intRet6 != 0)) { + if (isset($intRet6) && ($intRet6 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - } elseif ($chkModus == 'modify') { - if ($intMselValue1 != 0) { + } elseif ($chkModus === 'modify') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataUpdateRelation( 'tbl_lnkServiceescalationToHost', $chkDataId, @@ -147,10 +233,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet1 = $myDataClass->dataDeleteRelation('tbl_lnkServiceescalationToHost', $chkDataId); } - if (isset($intRet1) && ($intRet1 != 0)) { + if (isset($intRet1) && ($intRet1 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataUpdateRelation( 'tbl_lnkServiceescalationToHostgroup', $chkDataId, @@ -159,10 +245,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet2 = $myDataClass->dataDeleteRelation('tbl_lnkServiceescalationToHostgroup', $chkDataId); } - if (isset($intRet2) && ($intRet2 != 0)) { + if (isset($intRet2) && ($intRet2 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue3 != 0) { + if ($intMselValue3 !== 0) { $intRet3 = $myDataClass->dataUpdateRelation( 'tbl_lnkServiceescalationToService', $chkDataId, @@ -171,10 +257,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet3 = $myDataClass->dataDeleteRelation('tbl_lnkServiceescalationToService', $chkDataId); } - if (isset($intRet3) && ($intRet3 != 0)) { + if (isset($intRet3) && ($intRet3 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue4 != 0) { + if ($intMselValue4 !== 0) { $intRet4 = $myDataClass->dataUpdateRelation( 'tbl_lnkServiceescalationToContact', $chkDataId, @@ -183,10 +269,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet4 = $myDataClass->dataDeleteRelation('tbl_lnkServiceescalationToContact', $chkDataId); } - if (isset($intRet4) && ($intRet4 != 0)) { + if (isset($intRet4) && ($intRet4 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue5 != 0) { + if ($intMselValue5 !== 0) { $intRet5 = $myDataClass->dataUpdateRelation( 'tbl_lnkServiceescalationToContactgroup', $chkDataId, @@ -198,10 +284,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce $chkDataId ); } - if (isset($intRet5) && ($intRet5 != 0)) { + if (isset($intRet5) && ($intRet5 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue6 != 0) { + if ($intMselValue6 !== 0) { $intRet6 = $myDataClass->dataUpdateRelation( 'tbl_lnkServiceescalationToServicegroup', $chkDataId, @@ -213,18 +299,18 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce $chkDataId ); } - if (isset($intRet6) && ($intRet6 != 0)) { + if (isset($intRet6) && ($intRet6 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } - if (($intRet1 + $intRet2 + $intRet3 + $intRet4 + $intRet5 + $intRet6) != 0) { + if (($intRet1 + $intRet2 + $intRet3 + $intRet4 + $intRet5 + $intRet6) !== 0) { $strInfoMessage = ''; } - // - // Update Import HASH - // ================== + /* + Update Import HASH + */ $booReturn = $myDataClass->updateHash($preTableName, $chkDataId); - if ($booReturn != 0) { + if ($booReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } @@ -239,92 +325,80 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } $chkModus = 'display'; } -if (($chkModus != 'add') && ($chkModus != 'refresh')) { - $chkModus = 'display'; +if (($chkModus !== 'add') && ($chkModus !== 'refresh')) { + $chkModus = 'display'; } -// -// Get date/time of last database and config file manipulation -// =========================================================== +/* +Get date/time of last database and config file manipulation +*/ $intReturn = $myConfigClass->lastModifiedFile($preTableName, $arrTimeData, $strTimeInfoString); -if ($intReturn != 0) { +if ($intReturn !== 0) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } -// -// Singe data form -// =============== -if (($chkModus == 'add') || ($chkModus == 'refresh')) { +/* +Singe data form +*/ +if (($chkModus === 'add') || ($chkModus === 'refresh')) { $conttp->setVariable('TITLE', translate('Define service escalation (serviceescalations.cfg)')); - // Do not show modified time list + /* Do not show modified time list */ $intNoTime = 1; - // Refresh mode - if ($chkModus == 'refresh') { - $_SESSION['refresh']['se_host'] = $chkMselValue1; - $_SESSION['refresh']['se_hostgroup'] = $chkMselValue2; - $_SESSION['refresh']['se_service'] = $chkMselValue3; - $_SESSION['refresh']['se_contact'] = $chkMselValue4; - $_SESSION['refresh']['se_contactgroup'] = $chkMselValue5; - $_SESSION['refresh']['se_servicegroup'] = $chkMselValue6; - $myVisClass->arrSession = $_SESSION; - } else { - $_SESSION['refresh']['se_host'] = $chkMselValue1; - $_SESSION['refresh']['se_hostgroup'] = $chkMselValue2; - $_SESSION['refresh']['se_service'] = $chkMselValue3; - $_SESSION['refresh']['se_contact'] = $chkMselValue4; - $_SESSION['refresh']['se_contactgroup'] = $chkMselValue5; - $_SESSION['refresh']['se_servicegroup'] = $chkMselValue6; + /* Refresh mode */ + $_SESSION['refresh']['se_host'] = $chkMselValue1; + $_SESSION['refresh']['se_hostgroup'] = $chkMselValue2; + $_SESSION['refresh']['se_service'] = $chkMselValue3; + $_SESSION['refresh']['se_contact'] = $chkMselValue4; + $_SESSION['refresh']['se_contactgroup'] = $chkMselValue5; + $_SESSION['refresh']['se_servicegroup'] = $chkMselValue6; + if ($chkModus !== 'refresh') { if (isset($arrModifyData['host_name']) && ($arrModifyData['host_name'] > 0)) { - $arrTemp = array(); - $strSQL = 'SELECT `idSlave`, `exclude` ' - . 'FROM `tbl_lnkServiceescalationToHost` WHERE `idMaster` = ' .$arrModifyData['id']; + $arrTemp = array(); + $strSQL = 'SELECT `idSlave`, `exclude` ' + . 'FROM `tbl_lnkServiceescalationToHost` WHERE `idMaster` = ' . $arrModifyData['id']; $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDC); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($intDC != 0) { + if ($intDC !== 0) { foreach ($arrData as $elem) { - if ($elem['exclude'] == 1) { - $arrTemp[] = 'e' .$elem['idSlave']; + if ($elem['exclude'] === 1) { + $arrTemp[] = 'e' . $elem['idSlave']; } else { $arrTemp[] = $elem['idSlave']; } } } - if ($arrModifyData['host_name'] == 2) { + if ($arrModifyData['host_name'] === 2) { $arrTemp[] = '*'; } $_SESSION['refresh']['se_host'] = $arrTemp; } if (isset($arrModifyData['hostgroup_name']) && ($arrModifyData['hostgroup_name'] > 0)) { - $arrTemp = array(); - $strSQL = 'SELECT `idSlave`, `exclude` ' - . 'FROM `tbl_lnkServiceescalationToHostgroup` WHERE `idMaster` = ' .$arrModifyData['id']; + $arrTemp = array(); + $strSQL = 'SELECT `idSlave`, `exclude` ' + . 'FROM `tbl_lnkServiceescalationToHostgroup` WHERE `idMaster` = ' . $arrModifyData['id']; $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDC); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($intDC != 0) { + if ($intDC !== 0) { foreach ($arrData as $elem) { - if ($elem['exclude'] == 1) { - $arrTemp[] = 'e' .$elem['idSlave']; + if ($elem['exclude'] === 1) { + $arrTemp[] = 'e' . $elem['idSlave']; } else { $arrTemp[] = $elem['idSlave']; } } } - if ($arrModifyData['hostgroup_name'] == 2) { + if ($arrModifyData['hostgroup_name'] === 2) { $arrTemp[] = '*'; } - $_SESSION['refresh']['se_hostgroup'] = $arrTemp; + $_SESSION['refresh']['se_hostgroup'] = $arrTemp; } - $myVisClass->arrSession = $_SESSION; } - // Process host selection field - if (isset($arrModifyData['host_name'])) { - $intFieldId = $arrModifyData['host_name']; - } else { - $intFieldId = 0; - } - if (($chkModus == 'refresh') && is_array($chkMselValue1) && (count($chkMselValue1) != 0)) { + $myVisClass->arrSession = $_SESSION; + /* Process host selection field */ + $intFieldId = $arrModifyData['host_name'] ?? 0; + if (($chkModus === 'refresh') && is_array($chkMselValue1) && (count($chkMselValue1) !== 0)) { $strRefresh = 'se_host'; } else { $strRefresh = ''; @@ -339,15 +413,11 @@ if (($chkModus == 'add') || ($chkModus == 'refresh')) { -9, $strRefresh ); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['hostgroup_name'])) { - $intFieldId = $arrModifyData['hostgroup_name']; - } else { - $intFieldId = 0; - } - if (($chkModus == 'refresh') && is_array($chkMselValue2) && (count($chkMselValue2) != 0)) { + $intFieldId = $arrModifyData['hostgroup_name'] ?? 0; + if (($chkModus === 'refresh') && is_array($chkMselValue2) && (count($chkMselValue2) !== 0)) { $strRefresh = 'se_hostgroup'; } else { $strRefresh = ''; @@ -362,33 +432,25 @@ if (($chkModus == 'add') || ($chkModus == 'refresh')) { -9, $strRefresh ); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (($intReturn1 != 0) && ($intReturn2 != 0)) { + if (($intReturn1 !== 0) && ($intReturn2 !== 0)) { $myVisClass->processMessage(translate('Attention, no hosts and hostgroups defined!'), $strDBWarning); $intDataWarning = 1; } - // Process time period selection field - if (isset($arrModifyData['escalation_period'])) { - $intFieldId = $arrModifyData['escalation_period']; - } else { - $intFieldId = 0; - } - if ($chkModus == 'refresh') { + /* Process time period selection field */ + $intFieldId = $arrModifyData['escalation_period'] ?? 0; + if ($chkModus === 'refresh') { $intFieldId = $chkSelValue1; } $intReturn = $myVisClass->parseSelectSimple('tbl_timeperiod', 'timeperiod_name', 'timeperiod', 1, $intFieldId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process contact and contact group selection field - if (isset($arrModifyData['contacts'])) { - $intFieldId = $arrModifyData['contacts']; - } else { - $intFieldId = 0; - } - if (($chkModus == 'refresh') && is_array($chkMselValue4) && (count($chkMselValue4) != 0)) { + /* Process contact and contact group selection field */ + $intFieldId = $arrModifyData['contacts'] ?? 0; + if (($chkModus === 'refresh') && is_array($chkMselValue4) && (count($chkMselValue4) !== 0)) { $strRefresh = 'se_contact'; } else { $strRefresh = ''; @@ -403,15 +465,11 @@ if (($chkModus == 'add') || ($chkModus == 'refresh')) { -9, $strRefresh ); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['contact_groups'])) { - $intFieldId = $arrModifyData['contact_groups']; - } else { - $intFieldId = 0; - } - if (($chkModus == 'refresh') && is_array($chkMselValue5) && (count($chkMselValue5) != 0)) { + $intFieldId = $arrModifyData['contact_groups'] ?? 0; + if (($chkModus === 'refresh') && is_array($chkMselValue5) && (count($chkMselValue5) !== 0)) { $strRefresh = 'se_contactgroup'; } else { $strRefresh = ''; @@ -426,20 +484,16 @@ if (($chkModus == 'add') || ($chkModus == 'refresh')) { -9, $strRefresh ); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (($intReturn1 != 0) && ($intReturn2 != 0)) { + if (($intReturn1 !== 0) && ($intReturn2 !== 0)) { $myVisClass->processMessage(translate('Attention, no contacts and contactgroups defined!'), $strDBWarning); $intDataWarning = 1; } - // Process services selection field - if (isset($arrModifyData['service_description'])) { - $intFieldId = $arrModifyData['service_description']; - } else { - $intFieldId = 0; - } - if (($chkModus == 'refresh') && is_array($chkMselValue3) && (count($chkMselValue3) != 0)) { + /* Process services selection field */ + $intFieldId = $arrModifyData['service_description'] ?? 0; + if (($chkModus === 'refresh') && is_array($chkMselValue3) && (count($chkMselValue3) !== 0)) { $strRefresh = 'se_service'; } else { $strRefresh = ''; @@ -454,16 +508,12 @@ if (($chkModus == 'add') || ($chkModus == 'refresh')) { -9, $strRefresh ); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process servicegroup selection field - if (isset($arrModifyData['servicegroup_name'])) { - $intFieldId = $arrModifyData['servicegroup_name']; - } else { - $intFieldId = 0; - } - if (($chkModus == 'refresh') && is_array($chkMselValue6) && (count($chkMselValue6) != 0)) { + /* Process servicegroup selection field */ + $intFieldId = $arrModifyData['servicegroup_name'] ?? 0; + if (($chkModus === 'refresh') && is_array($chkMselValue6) && (count($chkMselValue6) !== 0)) { $strRefresh = 'se_servicegroup'; } else { $strRefresh = ''; @@ -478,99 +528,98 @@ if (($chkModus == 'add') || ($chkModus == 'refresh')) { -9, $strRefresh ); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process access group selection field - if (isset($arrModifyData['access_group'])) { - $intFieldId = $arrModifyData['access_group']; - } else { - $intFieldId = 0; - } - if ($chkModus == 'refresh') { + /* Process access group selection field */ + $intFieldId = $arrModifyData['access_group'] ?? 0; + if ($chkModus === 'refresh') { $intFieldId = $chkSelAccGr; } $intReturn = $myVisClass->parseSelectSimple('tbl_group', 'groupname', 'acc_group', 0, $intFieldId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Initial add/modify form definitions + /* Initial add/modify form definitions */ $myContentClass->addFormInit($conttp); - if ($intDataWarning == 1) { - $conttp->setVariable('WARNING', $strDBWarning. '
' .translate('Saving not possible!')); + if ($intDataWarning === 1) { + $conttp->setVariable('WARNING', $strDBWarning . '
' . translate('Saving not possible!')); } if ($intVersion < 3) { $conttp->setVariable('VERSION_20_VALUE_MUST', 'mselValue1,'); } - if ($chkModus == 'refresh') { - if ($chkTfNullVal1 != 'NULL') { + if ($chkModus === 'refresh') { + if ($chkTfNullVal1 !== 'NULL') { $conttp->setVariable('DAT_FIRST_NOTIFICATION', $chkTfNullVal1); } - if ($chkTfNullVal2 != 'NULL') { + if ($chkTfNullVal2 !== 'NULL') { $conttp->setVariable('DAT_LAST_NOTIFICATION', $chkTfNullVal2); } - if ($chkTfNullVal3 != 'NULL') { + if ($chkTfNullVal3 !== 'NULL') { $conttp->setVariable('DAT_NOTIFICATION_INTERVAL', $chkTfNullVal3); } - if ($chkTfValue1 != '') { + if ($chkTfValue1 !== '') { $conttp->setVariable('DAT_CONFIG_NAME', $chkTfValue1); } foreach (explode(',', $strEO) as $elem) { - $conttp->setVariable('DAT_EO' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_EO' . strtoupper($elem) . '_CHECKED', 'checked'); } - if ($chkActive != 1) { - $conttp->setVariable('ACT_CHECKED', ''); + if ($chkActive !== 1) { + $conttp->setVariable('ACT_CHECKED'); } - if ($chkRegister != 1) { - $conttp->setVariable('REG_CHECKED', ''); + if ($chkRegister !== 1) { + $conttp->setVariable('REG_CHECKED'); } - if ($chkDataId != 0) { + if ($chkDataId !== 0) { $conttp->setVariable('MODUS', 'modify'); $conttp->setVariable('DAT_ID', $chkDataId); } - // Insert data from database in "modify" mode - } elseif (isset($arrModifyData) && ($chkSelModify == 'modify')) { - // Check relation information to find out locked configuration datasets + /* Insert data from database in "modify" mode */ + } elseif (isset($arrModifyData) && ($chkSelModify === 'modify')) { + /* Check relation information to find out locked configuration datasets */ $intLocked = $myDataClass->infoRelation($preTableName, $arrModifyData['id'], $preKeyField); $myVisClass->processMessage($myDataClass->strInfoMessage, $strRelMessage); - $strInfo = '
' .translate('Entry cannot be activated because it is used by ' - .'another configuration'). ':'; - $strInfo .= '
' .$strRelMessage. ''; - // Process data + $strInfo = '
' . translate('Entry cannot be activated because it is used by ' + . 'another configuration') . ':'; + $strInfo .= '
' . $strRelMessage . ''; + /* Process data */ $myContentClass->addInsertData($conttp, $arrModifyData, $intLocked, $strInfo); - // Process option fields + /* Process option fields */ foreach (explode(',', $arrModifyData['escalation_options']) as $elem) { - $conttp->setVariable('DAT_EO' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_EO' . strtoupper($elem) . '_CHECKED', 'checked'); } } $conttp->parse('datainsert'); $conttp->show('datainsert'); } -// -// List view -// ========== -if ($chkModus == 'display') { - // Initial list view definitions +/* +List view +*/ +if ($chkModus === 'display') { + /* Initial list view definitions */ $myContentClass->listViewInit($mastertp); $mastertp->setVariable('TITLE', translate('Define service escalation (serviceescalations.cfg)')); $mastertp->setVariable('FIELD_1', translate('Config name')); $mastertp->setVariable('FIELD_2', translate('Services')); - // Process search string - if ($_SESSION['search'][$preSearchSession] != '') { - $strSearchTxt = $_SESSION['search'][$preSearchSession]; - $strSearchWhere = "AND (`$preKeyField` LIKE '%".$strSearchTxt."%')"; + $mastertp->setVariable('FILTER_VISIBLE', 'visibility: hidden'); + /* Process search string */ + if ($_SESSION['search'][$preSearchSession] !== '') { + $strSearchTxt = $_SESSION['search'][$preSearchSession]; + $strSearchWhere = "AND (`$preKeyField` LIKE '%" . $strSearchTxt . "%')"; } - // Row sorting + /* Row sorting */ $strOrderString = "ORDER BY `config_id`, `$preKeyField` $hidSortDir"; - if ($hidSortBy == 2) { + if ($hidSortBy === 2) { $strOrderString = "ORDER BY `config_id`, `$preKeyField` $hidSortDir"; } $mastertp->setVariable('DISABLE_SORT_2', 'disable'); - // Count datasets - $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` " + /* Count datasets */ + $intLineCount = 0; + /** @noinspection SqlResolve */ + $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` " . "WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess)"; $booReturn = $myDBClass->hasSingleDataset($strSQL, $arrDataLinesCount); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { @@ -579,16 +628,16 @@ if ($chkModus == 'display') { $chkLimit = 0; } } - // Get datasets - $strSQL = "SELECT `id`, `$preKeyField`, `service_description`, `register`, `active`, `config_id`, " + /* Get datasets */ + $strSQL = "SELECT `id`, `$preKeyField`, `service_description`, `register`, `active`, `config_id`, " . "`access_group` FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND `access_group` IN " - . "($strAccess) $strOrderString LIMIT $chkLimit,".$SETS['common']['pagelines']; + . "($strAccess) $strOrderString LIMIT $chkLimit," . $SETS['common']['pagelines']; $booReturn = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - // Process data + /* Process data */ $myContentClass->listData( $mastertp, $arrDataLines, @@ -599,7 +648,7 @@ if ($chkModus == 'display') { 40 ); } -// Show messages +/* Show messages */ $myContentClass->showMessages( $mastertp, $strErrorMessage, @@ -609,7 +658,7 @@ $myContentClass->showMessages( $strTimeInfoString, $intNoTime ); -// -// Process footer -// ============== -$myContentClass->showFooter($maintp, $setFileVersion); +/* +Process footer +*/ +$myContentClass->showFooter($maintp, $setFileVersion); \ No newline at end of file diff --git a/admin/serviceextinfo.php b/admin/serviceextinfo.php index 226c29e..6fe3817 100644 --- a/admin/serviceextinfo.php +++ b/admin/serviceextinfo.php @@ -1,78 +1,122 @@ Application version string + * @var string $chkModus from prepend_adm.php -> Form work mode + * @var int $chkDataId from prepend_adm.php -> Actual dataset id + * @var string $chkSelModify from prepend_adm.php -> Modification selection value + * @var int $hidSortBy from prepend_adm.php -> Sort data by + * @var string $hidSortDir from prepend_adm.php -> Sort data direction (ASC, DESC) + * @var int $chkLimit from prepend_adm.php / settings -> Data set count per page + * @var int $chkDomainId from prepend_adm.php -> Configuration domain id + * @var int $intVersion from prepend_adm.php -> Nagios version + * @var array $SETS Settings array + * @var int $intGlobalWriteAccess from prepend_content.php -> Global admin write access + * @var int $intWriteAccessId from prepend_content.php -> Admin write access to actual dataset id + * @var string $strAccess from prepend_content.php -> List of read access group id's for actual user + * @var string $preSQLCommon1 from prepend_content.php -> Common SQL part 1 + * @var string $strSearchWhere from prepend_content.php -> SQL WHERE addon for data search + * @var string $strDomainWhere from prepend_adm.php -> Domain selection SQL part with table name + * @var string $chkTfValue1 from prepend_content.php -> Notes + * @var string $chkTfValue2 from prepend_content.php -> Notes URL + * @var string $chkTfValue3 from prepend_content.php -> Action URL + * @var string $chkTfValue4 from prepend_content.php -> Icon image + * @var string $chkTfValue5 from prepend_content.php -> Icon image alt text + * @var int $chkSelValue1 from prepend_content.php -> Host + * @var int $chkSelValue2 from prepend_content.php -> Service description + * @var int $chkActive from prepend_adm.php -> Active checkbox + * @var int $chkRegister from prepend_adm.php -> Register checkbox + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 24; -$preContent = 'admin/serviceextinfo.htm.tpl'; -$preListTpl = 'admin/datalist.htm.tpl'; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 24; +$preContent = 'admin/serviceextinfo.htm.tpl'; +$preListTpl = 'admin/datalist.htm.tpl'; $preSearchSession = 'serviceextinfo'; -$preTableName = 'tbl_serviceextinfo'; -$preKeyField = 'host_name'; -$preAccess = 1; -$preFieldvars = 1; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Add or modify data -// ================== -if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAccess == 0)) { +$preTableName = 'tbl_serviceextinfo'; +$preKeyField = 'host_name'; +$preAccess = 1; +$preFieldvars = 1; +$strErrorMessage = ''; +$strInfoMessage = ''; +$strConsistMessage = ''; +$strDBWarning = ''; +$intDataWarning = 0; +$intNoTime = 0; +/* +Include preprocessing files +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Add or modify data +*/ +if ((($chkModus === 'insert') || ($chkModus === 'modify')) && ($intGlobalWriteAccess === 0)) { $strSQLx = "`$preTableName` SET `$preKeyField`='$chkSelValue1', `service_description`='$chkSelValue2', " . "`notes`='$chkTfValue1', `notes_url`='$chkTfValue2', `action_url`='$chkTfValue3', " . "`icon_image`='$chkTfValue4', `icon_image_alt`='$chkTfValue5', $preSQLCommon1"; - if ($chkModus == 'insert') { - $strSQL = 'INSERT INTO ' .$strSQLx; + if ($chkModus === 'insert') { + $strSQL = 'INSERT INTO ' . $strSQLx; } else { - $strSQL = 'UPDATE ' .$strSQLx. ' WHERE `id`=' .$chkDataId; + $strSQL = 'UPDATE ' . $strSQLx . ' WHERE `id`=' . $chkDataId; } - if ($intWriteAccessId == 0) { - if (($chkSelValue1 != 0) && ($chkSelValue2 != 0)) { + if ($intWriteAccessId === 0) { + if (($chkSelValue1 !== 0) && ($chkSelValue2 !== 0)) { $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($chkModus == 'insert') { + if ($chkModus === 'insert') { $chkDataId = $intInsertId; } - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); $myDataClass->updateStatusTable($preTableName); - if ($chkModus == 'insert') { - $myDataClass->writeLog(translate('New service extended information inserted:'). ' ' .$chkSelValue1. - '::' .$chkSelValue2); + if ($chkModus === 'insert') { + $myDataClass->writeLog(translate('New service extended information inserted:') . ' ' . $chkSelValue1 . + '::' . $chkSelValue2); } - if ($chkModus == 'modify') { - $myDataClass->writeLog(translate('Service extended information modified:'). ' ' .$chkSelValue1. - '::' .$chkSelValue2); + if ($chkModus === 'modify') { + $myDataClass->writeLog(translate('Service extended information modified:') . ' ' . $chkSelValue1 . + '::' . $chkSelValue2); } - // - // Update Import HASH - // ================== + /* + Update Import HASH + */ $booReturn = $myDataClass->updateHash($preTableName, $chkDataId); - if ($booReturn != 0) { + if ($booReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } @@ -87,66 +131,57 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } $chkModus = 'display'; } -if (($chkModus != 'add') && ($chkModus != 'refresh')) { - $chkModus = 'display'; +if (($chkModus !== 'add') && ($chkModus !== 'refresh')) { + $chkModus = 'display'; } -// -// Get date/time of last database and config file manipulation -// =========================================================== +/* +Get date/time of last database and config file manipulation +*/ $intReturn = $myConfigClass->lastModifiedFile($preTableName, $arrTimeData, $strTimeInfoString); -if ($intReturn != 0) { +if ($intReturn !== 0) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } -// -// Singe data form -// =============== -if (($chkModus == 'add') || ($chkModus == 'refresh')) { +/* +Singe data form +*/ +if (($chkModus === 'add') || ($chkModus === 'refresh')) { $conttp->setVariable('TITLE', translate('Define service extended information (serviceextinfo.cfg)')); - // Do not show modified time list + /* Do not show modified time list */ $intNoTime = 1; - // Refresh mode - if ($chkModus == 'refresh') { - $_SESSION['refresh']['se_host'] = $chkSelValue1; - $myVisClass->arrSession = $_SESSION; - } else { - $_SESSION['refresh']['se_host'] = $chkSelValue1; - if (isset($arrModifyData[$preKeyField]) && ($arrModifyData[$preKeyField] != 0)) { - $strSQL = "SELECT `$preKeyField` FROM `$preTableName` WHERE `id` = ".$arrModifyData['id']; - $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDC); - if ($intDC != 0) { + /* Refresh mode */ + $_SESSION['refresh']['se_host'] = $chkSelValue1; + if ($chkModus !== 'refresh') { + if (isset($arrModifyData[$preKeyField]) && ($arrModifyData[$preKeyField] !== 0)) { + /** @noinspection SqlResolve */ + $strSQL = "SELECT `$preKeyField` FROM `$preTableName` WHERE `id` = " . $arrModifyData['id']; + $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDC); + if ($intDC !== 0) { $_SESSION['refresh']['se_host'] = $arrData[0][$preKeyField]; } } else { - $strSQL = 'SELECT `id` FROM `tbl_host` ' + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `tbl_host` ' . "WHERE `active`='1' AND `config_id`=$chkDomainId ORDER BY `$preKeyField`"; $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDC); - if ($intDC != 0) { + if ($intDC !== 0) { $_SESSION['refresh']['se_host'] = $arrData[0]['id']; } } - $myVisClass->arrSession = $_SESSION; } - // Process host selection field - if (isset($arrModifyData[$preKeyField])) { - $intFieldId = $arrModifyData[$preKeyField]; - } else { - $intFieldId = 0; - } - if (($chkModus == 'refresh') && ($chkSelValue1 != 0)) { + $myVisClass->arrSession = $_SESSION; + /* Process host selection field */ + $intFieldId = $arrModifyData[$preKeyField] ?? 0; + if (($chkModus === 'refresh') && ($chkSelValue1 !== 0)) { $intFieldId = $chkSelValue1; } $intReturn1 = $myVisClass->parseSelectSimple('tbl_host', $preKeyField, 'host', 0, $intFieldId); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); $myVisClass->processMessage(translate('Attention, no hosts defined!'), $strDBWarning); $intDataWarning = 1; } - // Process service selection field - if (isset($arrModifyData['service_description'])) { - $intFieldId = $arrModifyData['service_description']; - } else { - $intFieldId = 0; - } + /* Process service selection field */ + $intFieldId = $arrModifyData['service_description'] ?? 0; $intReturn1 = $myVisClass->parseSelectSimple( 'tbl_service', 'service_description', @@ -154,84 +189,83 @@ if (($chkModus == 'add') || ($chkModus == 'refresh')) { 0, $intFieldId ); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process access group selection field - if (isset($arrModifyData['access_group'])) { - $intFieldId = $arrModifyData['access_group']; - } else { - $intFieldId = 0; - } + /* Process access group selection field */ + $intFieldId = $arrModifyData['access_group'] ?? 0; $intReturn = $myVisClass->parseSelectSimple('tbl_group', 'groupname', 'acc_group', 0, $intFieldId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Initial add/modify form definitions + /* Initial add/modify form definitions */ $myContentClass->addFormInit($conttp); - if ($intDataWarning == 1) { - $conttp->setVariable('WARNING', $strDBWarning. '
' .translate('Saving not possible!')); + if ($intDataWarning === 1) { + $conttp->setVariable('WARNING', $strDBWarning . '
' . translate('Saving not possible!')); } if ($intVersion < 3) { $conttp->setVariable('VERSION_20_VALUE_MUST', 'mselValue1,'); } - if ($chkModus == 'refresh') { + if ($chkModus === 'refresh') { $conttp->setVariable('DAT_NOTES', $chkTfValue1); $conttp->setVariable('DAT_NOTES_URL', $chkTfValue2); $conttp->setVariable('DAT_ACTION_URL', $chkTfValue3); $conttp->setVariable('DAT_ICON_IMAGE', $chkTfValue4); $conttp->setVariable('DAT_ICON_IMAGE_ALT', $chkTfValue5); - if ($chkActive != 1) { - $conttp->setVariable('ACT_CHECKED', ''); + if ($chkActive !== 1) { + $conttp->setVariable('ACT_CHECKED'); } - if ($chkRegister != 1) { - $conttp->setVariable('REG_CHECKED', ''); + if ($chkRegister !== 1) { + $conttp->setVariable('REG_CHECKED'); } - if ($chkDataId != 0) { + if ($chkDataId !== 0) { $conttp->setVariable('MODUS', 'modify'); $conttp->setVariable('DAT_ID', $chkDataId); } - // Insert data from database in "modify" mode - } elseif (isset($arrModifyData) && ($chkSelModify == 'modify')) { - // Check relation information to find out locked configuration datasets + /* Insert data from database in "modify" mode */ + } elseif (isset($arrModifyData) && ($chkSelModify === 'modify')) { + /* Check relation information to find out locked configuration datasets */ $intLocked = $myDataClass->infoRelation($preTableName, $arrModifyData['id'], $preKeyField); $myVisClass->processMessage($myDataClass->strInfoMessage, $strRelMessage); - $strInfo = '
' .translate('Entry cannot be activated because it is used by ' - .'another configuration'). ':'; - $strInfo .= '
' .$strRelMessage. ''; - // Process data + $strInfo = '
' . translate('Entry cannot be activated because it is used by ' + . 'another configuration') . ':'; + $strInfo .= '
' . $strRelMessage . ''; + /* Process data */ $myContentClass->addInsertData($conttp, $arrModifyData, $intLocked, $strInfo); } $conttp->parse('datainsert'); $conttp->show('datainsert'); } -// -// List view -// ========== -if ($chkModus == 'display') { - // Initial list view definitions +/* +List view +*/ +if ($chkModus === 'display') { + /* Initial list view definitions */ $myContentClass->listViewInit($mastertp); $mastertp->setVariable('TITLE', translate('Define service extended information (serviceextinfo.cfg)')); $mastertp->setVariable('FIELD_1', translate('Hostname')); $mastertp->setVariable('FIELD_2', translate('Service')); - // Process search string - if ($_SESSION['search'][$preSearchSession] != '') { - $strSearchTxt = $_SESSION['search'][$preSearchSession]; - $strSearchWhere = "AND (`tbl_host`.`$preKeyField` LIKE '%".$strSearchTxt."%' OR `$preTableName`.`notes` " - . "LIKE '%".$strSearchTxt."%' OR `$preTableName`.`notes_url` LIKE '%".$strSearchTxt."%')"; + $mastertp->setVariable('FILTER_VISIBLE', 'visibility: hidden'); + /* Process search string */ + if ($_SESSION['search'][$preSearchSession] !== '') { + $strSearchTxt = $_SESSION['search'][$preSearchSession]; + $strSearchWhere = "AND (`tbl_host`.`$preKeyField` LIKE '%" . $strSearchTxt . "%' OR `$preTableName`.`notes` " + . "LIKE '%" . $strSearchTxt . "%' OR `$preTableName`.`notes_url` LIKE '%" . $strSearchTxt . "%')"; } - // Row sorting + /* Row sorting */ $strOrderString = "ORDER BY `$preTableName`.`config_id`, `$preKeyField` $hidSortDir"; - if ($hidSortBy == 2) { + if ($hidSortBy === 2) { $strOrderString = "ORDER BY `$preTableName`.`config_id`, `tbl_service`.`service_description` $hidSortDir"; } - // Count datasets - $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` " + /* Count datasets */ + $intLineCount = 0; + /** @noinspection SqlResolve */ + $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` " . "LEFT JOIN `tbl_host` ON `$preTableName`.`$preKeyField` = `tbl_host`.`id` " . "LEFT JOIN `tbl_service` ON `$preTableName`.`service_description` = `tbl_service`.`id` " . "WHERE $strDomainWhere $strSearchWhere AND `$preTableName`.`access_group` IN ($strAccess)"; $booReturn = $myDBClass->hasSingleDataset($strSQL, $arrDataLinesCount); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { @@ -240,20 +274,20 @@ if ($chkModus == 'display') { $chkLimit = 0; } } - // Get datasets - $strSQL = "SELECT `$preTableName`.`id`, `tbl_host`.`$preKeyField`, `tbl_service`.`service_description`, " + /* Get datasets */ + $strSQL = "SELECT `$preTableName`.`id`, `tbl_host`.`$preKeyField`, `tbl_service`.`service_description`, " . "`$preTableName`.`notes`, `$preTableName`.`register`, `$preTableName`.`active`, `$preTableName`.`config_id`, " . "`$preTableName`.`access_group` FROM `$preTableName` " . "LEFT JOIN `tbl_host` ON `$preTableName`.`$preKeyField` = `tbl_host`.`id` " . "LEFT JOIN `tbl_service` ON `$preTableName`.`service_description` = `tbl_service`.`id` " . "WHERE $strDomainWhere $strSearchWhere AND `$preTableName`.`access_group` IN ($strAccess) $strOrderString " - . "LIMIT $chkLimit,".$SETS['common']['pagelines']; + . "LIMIT $chkLimit," . $SETS['common']['pagelines']; $booReturn = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - // Process data + /* Process data */ $myContentClass->listData( $mastertp, $arrDataLines, @@ -263,7 +297,7 @@ if ($chkModus == 'display') { 'service_description' ); } -// Show messages +/* Show messages */ $myContentClass->showMessages( $mastertp, $strErrorMessage, @@ -273,7 +307,7 @@ $myContentClass->showMessages( $strTimeInfoString, $intNoTime ); -// -// Process footer -// ============== -$myContentClass->showFooter($maintp, $setFileVersion); +/* +Process footer +*/ +$myContentClass->showFooter($maintp, $setFileVersion); \ No newline at end of file diff --git a/admin/servicegroups.php b/admin/servicegroups.php index efdccd7..393dbf8 100644 --- a/admin/servicegroups.php +++ b/admin/servicegroups.php @@ -1,75 +1,130 @@ Application version string + * @var string $chkModus from prepend_adm.php -> Form work mode + * @var int $chkDataId from prepend_adm.php -> Actual dataset id + * @var int $chkListId from prepend_adm.php -> Actual dataset id (list view) + * @var string $chkSelModify from prepend_adm.php -> Modification selection value + * @var int $hidSortBy from prepend_adm.php -> Sort data by + * @var string $hidSortDir from prepend_adm.php -> Sort data direction (ASC, DESC) + * @var int $chkLimit from prepend_adm.php / settings -> Data set count per page + * @var int $intVersion from prepend_adm.php -> Nagios version + * @var array $SETS Settings array + * @var int $intGlobalWriteAccess from prepend_content.php -> Global admin write access + * @var int $intWriteAccessId from prepend_content.php -> Admin write access to actual dataset id + * @var string $strAccess from prepend_content.php -> List of read access group id's for actual user + * @var string $preSQLCommon1 from prepend_content.php -> Common SQL part 1 + * @var string $strDomainWhere from prepend_adm.php -> Domain selection SQL part with table name + * @var string $chkTfValue1 from prepend_content.php -> Servicegroup name + * @var string $chkTfValue2 from prepend_content.php -> Servicegroup description + * @var string $chkTfValue3 from prepend_content.php -> Notes + * @var string $chkTfValue4 from prepend_content.php -> Notes URL + * @var string $chkTfValue5 from prepend_content.php -> Action URL + * @var array $chkMselValue1 from prepend_content.php -> Members + * @var array $chkMselValue2 from prepend_content.php -> Servicegroup members + * @var int $intMselValue1 from prepend_content.php -> Members multiselect status value + * @var int $intMselValue2 from prepend_content.php -> Servicegroup members multiselect status value + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 11; -$preContent = 'admin/servicegroups.htm.tpl'; -$preListTpl = 'admin/datalist.htm.tpl'; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 11; +$preContent = 'admin/servicegroups.htm.tpl'; +$preListTpl = 'admin/datalist.htm.tpl'; $preSearchSession = 'servicegroup'; -$preTableName = 'tbl_servicegroup'; -$preKeyField = 'servicegroup_name'; -$preAccess = 1; -$preFieldvars = 1; -// -// Include preprocessing file -// ========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Add or modify data -// ================== -if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAccess == 0)) { +$preTableName = 'tbl_servicegroup'; +$preKeyField = 'servicegroup_name'; +$preAccess = 1; +$preFieldvars = 1; +$strErrorMessage = ''; +$strInfoMessage = ''; +$strConsistMessage = ''; +$strDBWarning = ''; +$intDataWarning = 0; +$intRet1 = 0; +$intRet2 = 0; +$intNoTime = 0; +/* +Default values for form variables +*/ +if (!isset($intMselValue1)) { + $intMselValue1 = 0; +} +if (!isset($intMselValue2)) { + $intMselValue2 = 0; +} +/* +Include preprocessing file +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Add or modify data +*/ +if ((($chkModus === 'insert') || ($chkModus === 'modify')) && ($intGlobalWriteAccess === 0)) { $strSQLx = "`$preTableName` SET `$preKeyField`='$chkTfValue1', `alias`='$chkTfValue2', `members`=$intMselValue1, " - . "`servicegroup_members`=$intMselValue2, `notes`='$chkTfValue3', `notes_url`='$chkTfValue4', " - . "`action_url`='$chkTfValue5', $preSQLCommon1"; - if ($chkModus == 'insert') { - $strSQL = 'INSERT INTO ' .$strSQLx; + . "`servicegroup_members`=$intMselValue2, `notes`='$chkTfValue3', `notes_url`='$chkTfValue4', " + . "`action_url`='$chkTfValue5', $preSQLCommon1"; + if ($chkModus === 'insert') { + $strSQL = 'INSERT INTO ' . $strSQLx; } else { - $strSQL = 'UPDATE ' .$strSQLx. ' WHERE `id`=' .$chkDataId; + $strSQL = 'UPDATE ' . $strSQLx . ' WHERE `id`=' . $chkDataId; } - if ($intWriteAccessId == 0) { - if (($chkTfValue1 != '') && ($chkTfValue2 != '') && (($intMselValue1 != 0) || ($intVersion >= 3))) { + if ($intWriteAccessId === 0) { + if (($chkTfValue1 !== '') && ($chkTfValue2 !== '') && (($intMselValue1 !== 0) || ($intVersion >= 3))) { $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($chkModus == 'insert') { + if ($chkModus === 'insert') { $chkDataId = $intInsertId; } - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); $myDataClass->updateStatusTable($preTableName); - if ($chkModus == 'insert') { - $myDataClass->writeLog(translate('New service group inserted:'). ' ' .$chkTfValue1); + if ($chkModus === 'insert') { + $myDataClass->writeLog(translate('New service group inserted:') . ' ' . $chkTfValue1); } - if ($chkModus == 'modify') { - $myDataClass->writeLog(translate('Service group modified:'). ' ' .$chkTfValue1); + if ($chkModus === 'modify') { + $myDataClass->writeLog(translate('Service group modified:') . ' ' . $chkTfValue1); } - // - // Insert/update relations - // ======================= - if ($chkModus == 'insert') { - if ($intMselValue1 != 0) { + /* + Insert/update relations + */ + if ($chkModus === 'insert') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataInsertRelation( 'tbl_lnkServicegroupToService', $chkDataId, @@ -77,21 +132,21 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce 1 ); } - if (isset($intRet1) && ($intRet1 != 0)) { + if (isset($intRet1) && ($intRet1 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataInsertRelation( 'tbl_lnkServicegroupToServicegroup', $chkDataId, $chkMselValue2 ); } - if (isset($intRet2) && ($intRet2 != 0)) { + if (isset($intRet2) && ($intRet2 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - } elseif ($chkModus == 'modify') { - if ($intMselValue1 != 0) { + } elseif ($chkModus === 'modify') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataUpdateRelation( 'tbl_lnkServicegroupToService', $chkDataId, @@ -101,10 +156,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet1 = $myDataClass->dataDeleteRelation('tbl_lnkServicegroupToService', $chkDataId); } - if ($intRet1 != 0) { + if ($intRet1 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataUpdateRelation( 'tbl_lnkServicegroupToServicegroup', $chkDataId, @@ -113,11 +168,11 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet2 = $myDataClass->dataDeleteRelation('tbl_lnkServicegroupToServicegroup', $chkDataId); } - if ($intRet2 != 0) { + if ($intRet2 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } - if (($intRet1 + $intRet2) != 0) { + if (($intRet1 + $intRet2) !== 0) { $strInfoMessage = ''; } } @@ -132,29 +187,25 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } $chkModus = 'display'; } -if ($chkModus != 'add') { - $chkModus = 'display'; +if ($chkModus !== 'add') { + $chkModus = 'display'; } -// -// Get date/time of last database and config file manipulation -// =========================================================== +/* +Get date/time of last database and config file manipulation +*/ $intReturn = $myConfigClass->lastModifiedFile($preTableName, $arrTimeData, $strTimeInfoString); -if ($intReturn != 0) { +if ($intReturn !== 0) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } -// -// Singe data form -// =============== -if ($chkModus == 'add') { +/* +Singe data form +*/ +if ($chkModus === 'add') { $conttp->setVariable('TITLE', translate('Define service groups (servicegroups.cfg)')); - // Do not show modified time list + /* Do not show modified time list */ $intNoTime = 1; - // Process service selection field - if (isset($arrModifyData['members'])) { - $intFieldId = $arrModifyData['members']; - } else { - $intFieldId = 0; - } + /* Process service selection field */ + $intFieldId = $arrModifyData['members'] ?? 0; $intReturn1 = $myVisClass->parseSelectMulti( 'tbl_service', 'service_description', @@ -163,19 +214,15 @@ if ($chkModus == 'add') { 0, $intFieldId ); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (($intReturn1 != 0) && ($intVersion < 3)) { + if (($intReturn1 !== 0) && ($intVersion < 3)) { $myVisClass->processMessage(translate('Attention, no services defined!'), $strDBWarning); $intDataWarning = 1; } - // Process service group selection field - if (isset($arrModifyData['servicegroup_members'])) { - $intFieldId = $arrModifyData['servicegroup_members']; - } else { - $intFieldId = 0; - } + /* Process service group selection field */ + $intFieldId = $arrModifyData['servicegroup_members'] ?? 0; $intReturn2 = $myVisClass->parseSelectMulti( $preTableName, $preKeyField, @@ -185,66 +232,85 @@ if ($chkModus == 'add') { $intFieldId, $chkListId ); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process access group selection field - if (isset($arrModifyData['access_group'])) { - $intFieldId = $arrModifyData['access_group']; - } else { - $intFieldId = 0; - } + /* Process access group selection field */ + $intFieldId = $arrModifyData['access_group'] ?? 0; $intReturn3 = $myVisClass->parseSelectSimple('tbl_group', 'groupname', 'acc_group', 0, $intFieldId); - if ($intReturn3 != 0) { + if ($intReturn3 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Initial add/modify form definitions + /* Initial add/modify form definitions */ $myContentClass->addFormInit($conttp); - if ($intDataWarning == 1) { - $conttp->setVariable('WARNING', $strDBWarning. '
' .translate('Saving not possible!')); + if ($intDataWarning === 1) { + $conttp->setVariable('WARNING', $strDBWarning . '
' . translate('Saving not possible!')); } if ($intVersion < 3) { $conttp->setVariable('VERSION_20_VALUE_MUST', 'mselValue1,'); } - // Insert data from database in "modify" mode - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { + /* Insert data from database in "modify" mode */ + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { // Check relation information to find out locked configuration datasets $intLocked = $myDataClass->infoRelation($preTableName, $arrModifyData['id'], $preKeyField); $myVisClass->processMessage($myDataClass->strInfoMessage, $strRelMessage); - $strInfo = '
' .translate('Entry cannot be activated because it is used by ' - . 'another configuration'). ':'; - $strInfo .= '
' .$strRelMessage. ''; - // Process data + $strInfo = '
' . translate('Entry cannot be activated because it is used by ' + . 'another configuration') . ':'; + $strInfo .= '
' . $strRelMessage . ''; + // Process data */ $myContentClass->addInsertData($conttp, $arrModifyData, $intLocked, $strInfo); } $conttp->parse('datainsert'); $conttp->show('datainsert'); } -// -// List view -// ========== -if ($chkModus == 'display') { - // Initial list view definitions +/* +List view +*/ +if ($chkModus === 'display') { + /* Initial list view definitions */ $myContentClass->listViewInit($mastertp); $mastertp->setVariable('TITLE', translate('Define service groups (servicegroups.cfg)')); $mastertp->setVariable('FIELD_1', translate('Service group')); $mastertp->setVariable('FIELD_2', translate('Description')); - // Process search string - if ($_SESSION['search'][$preSearchSession] != '') { - $strSearchTxt = $_SESSION['search'][$preSearchSession]; - $strSearchWhere = "AND (`$preKeyField` LIKE '%".$strSearchTxt."%' OR `alias` LIKE '%".$strSearchTxt."%' " - . "OR `notes` LIKE '%".$strSearchTxt."%')"; + /* Process search string and filter */ + $strSearchWhere = ''; + if ($_SESSION['search'][$preSearchSession] !== '') { + $strSearchTxt = $_SESSION['search'][$preSearchSession]; + $strSearchWhere .= "AND (`$preKeyField` LIKE '%" . $strSearchTxt . "%' OR `alias` LIKE '%" . $strSearchTxt . "%' " + . "OR `notes` LIKE '%" . $strSearchTxt . "%') "; } - // Row sorting + if ($_SESSION['filter'][$preSearchSession]['registered'] !== '') { + $intRegistered = (int)$_SESSION['filter'][$preSearchSession]['registered']; + if ($intRegistered === 1) { + $strSearchWhere .= "AND `register` = '1' "; + } + if ($intRegistered === 2) { + $strSearchWhere .= "AND `register` = '0' "; + } + $mastertp->setVariable('SEL_REGFILTER_' . $intRegistered . '_SELECTED', 'selected'); + } + if ($_SESSION['filter'][$preSearchSession]['active'] !== '') { + $intActivated = (int)$_SESSION['filter'][$preSearchSession]['active']; + if ($intActivated === 1) { + $strSearchWhere .= "AND `active` = '1' "; + } + if ($intActivated === 2) { + $strSearchWhere .= "AND `active` = '0' "; + } + $mastertp->setVariable('SEL_ACTIVEFILTER_' . $intActivated . '_SELECTED', 'selected'); + } + /* Row sorting */ $strOrderString = "ORDER BY `config_id`, `$preKeyField` $hidSortDir"; - if ($hidSortBy == 2) { + if ($hidSortBy === 2) { $strOrderString = "ORDER BY `config_id`, `alias` $hidSortDir"; } - // Count datasets - $strSQL1 = "SELECT count(*) AS `number` FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere " - . "AND `access_group` IN ($strAccess)"; + /* Count datasets */ + $intLineCount = 0; + /** @noinspection SqlResolve */ + $strSQL1 = "SELECT count(*) AS `number` FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere " + . "AND `access_group` IN ($strAccess)"; $booReturn1 = $myDBClass->hasSingleDataset($strSQL1, $arrDataLinesCount); - if ($booReturn1 == false) { + if ($booReturn1 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { @@ -253,19 +319,19 @@ if ($chkModus == 'display') { $chkLimit = 0; } } - // Get datasets - $strSQL2 = "SELECT `id`, `$preKeyField`, `alias`, `register`, `active`, `config_id`, `access_group` " - . "FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess) " - . "$strOrderString LIMIT $chkLimit,".$SETS['common']['pagelines']; + /* Get datasets */ + $strSQL2 = "SELECT `id`, `$preKeyField`, `alias`, `register`, `active`, `config_id`, `access_group` " + . "FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess) " + . "$strOrderString LIMIT $chkLimit," . $SETS['common']['pagelines']; $booReturn2 = $myDBClass->hasDataArray($strSQL2, $arrDataLines, $intDataCount); - if ($booReturn2 == false) { + if ($booReturn2 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - // Process data + /* Process data */ $myContentClass->listData($mastertp, $arrDataLines, $intDataCount, $intLineCount, $preKeyField, 'alias'); } -// Show messages +/* Show messages */ $myContentClass->showMessages( $mastertp, $strErrorMessage, @@ -275,7 +341,7 @@ $myContentClass->showMessages( $strTimeInfoString, $intNoTime ); -// -// Process footer -// ============== -$myContentClass->showFooter($maintp, $setFileVersion); +/* +Process footer +*/ +$myContentClass->showFooter($maintp, $setFileVersion); \ No newline at end of file diff --git a/admin/services.php b/admin/services.php index a0cb121..8711840 100644 --- a/admin/services.php +++ b/admin/services.php @@ -1,65 +1,206 @@ Application version string + * @var int $chkActive from prepend_adm.php -> Active checkbox + * @var string $chkModus from prepend_adm.php -> Form work mode + * @var int $chkDataId from prepend_adm.php -> Actual dataset id + * @var string $chkSelModify from prepend_adm.php -> Modification selection value + * @var int $hidSortBy from prepend_adm.php -> Sort data by + * @var string $hidSortDir from prepend_adm.php -> Sort data direction (ASC, DESC) + * @var int $chkLimit from prepend_adm.php / settings -> Data set count per page + * @var int $intVersion from prepend_adm.php -> Nagios version + * @var int $chkDomainId from prepend_adm.php -> Configuration domain id + * @var array $SETS Settings array + * @var int $intGlobalWriteAccess from prepend_content.php -> Global admin write access + * @var int $intWriteAccessId from prepend_content.php -> Admin write access to actual dataset id + * @var string $strAccess from prepend_content.php -> List of read access group id's for actual user + * @var string $preSQLCommon1 from prepend_content.php -> Common SQL part 1 + * @var string $strDomainWhere from prepend_adm.php -> Domain selection SQL part with table name + * @var string $strDomainWhere2 from prepend_adm.php -> Domain selection SQL part without table name + * @var string $strSearchWhere2 from prepend_content.php -> SQL WHERE addon for configuration selection list + * @var string $chkTfValue1 from prepend_content.php -> Config name + * @var string $chkTfValue2 from prepend_content.php -> (hidden) config name + * @var string $chkTfValue3 from prepend_content.php -> Service description + * @var string $chkTfValue4 from prepend_content.php -> Display name + * @var string $chkTfValue5 from prepend_content.php -> Notes + * @var string $chkTfValue6 from prepend_content.php -> Notes URL + * @var string $chkTfValue7 from prepend_content.php -> Action URL + * @var string $chkTfValue8 from prepend_content.php -> Icon image + * @var string $chkTfValue9 from prepend_content.php -> Icon image alt text + * @var string $chkTfValue10 from prepend_content.php -> Generic name + * @var int $chkSelValue1 from prepend_content.php -> Check command + * @var int $chkSelValue2 from prepend_content.php -> Check period + * @var int $chkSelValue3 from prepend_content.php -> Event handler + * @var int $chkSelValue4 from prepend_content.php -> Notification period + * @var array $chkMselValue1 from prepend_content.php -> Hosts + * @var array $chkMselValue2 from prepend_content.php -> Host groups + * @var array $chkMselValue3 from prepend_content.php -> Service groups + * @var array $chkMselValue4 from prepend_content.php -> Contacts + * @var array $chkMselValue5 from prepend_content.php -> Contact groups + * @var array $chkMselValue6 from prepend_content.php -> Parent services + * @var int $intMselValue1 from prepend_content.php -> Hosts multiselect status value + * @var int $intMselValue2 from prepend_content.php -> Host groups multiselect status value + * @var int $intMselValue3 from prepend_content.php -> Service groups multiselect status value + * @var int $intMselValue4 from prepend_content.php -> Contacts multiselect status value + * @var int $intMselValue5 from prepend_content.php -> Contact groups multiselect status value + * @var int $intMselValue6 from prepend_content.php -> Parent services multiselect status value + * @var string $chkChbGr1a from prepend_content.php -> Notification options (w) + * @var string $chkChbGr1b from prepend_content.php -> Notification options (u) + * @var string $chkChbGr1c from prepend_content.php -> Notification options (c) + * @var string $chkChbGr1d from prepend_content.php -> Notification options (r) + * @var string $chkChbGr1e from prepend_content.php -> Notification options (f) + * @var string $chkChbGr1f from prepend_content.php -> Notification options (s) + * @var string $chkChbGr2a from prepend_content.php -> Initial state (o) + * @var string $chkChbGr2b from prepend_content.php -> Initial state (w) + * @var string $chkChbGr2c from prepend_content.php -> Initial state (u) + * @var string $chkChbGr2d from prepend_content.php -> Initial state (c) + * @var string $chkChbGr3a from prepend_content.php -> Flap detection options (o) + * @var string $chkChbGr3b from prepend_content.php -> Flap detection options (w) + * @var string $chkChbGr3c from prepend_content.php -> Flap detection options (u) + * @var string $chkChbGr3d from prepend_content.php -> Flap detection options (c) + * @var string $chkChbGr4a from prepend_content.php -> Stalking options (o) + * @var string $chkChbGr4b from prepend_content.php -> Stalking options (w) + * @var string $chkChbGr4c from prepend_content.php -> Stalking options (u) + * @var string $chkChbGr4d from prepend_content.php -> Stalking options (c) + * @var int $chkRadValue1 from prepend_content.php -> Hosts multiselect options + * @var int $chkRadValue2 from prepend_content.php -> Hosts groups multiselect options + * @var int $chkRadValue3 from prepend_content.php -> Service groups multiselect options + * @var int $chkRadValue4 from prepend_content.php -> Contacts multiselect options + * @var int $chkRadValue5 from prepend_content.php -> Contact groups multiselect options + * @var int $chkRadValue6 from prepend_content.php -> Active checks + * @var int $chkRadValue7 from prepend_content.php -> Passive checks + * @var int $chkRadValue8 from prepend_content.php -> Parallelize checks + * @var int $chkRadValue9 from prepend_content.php -> Freshness checks + * @var int $chkRadValue10 from prepend_content.php -> Obsess over service + * @var int $chkRadValue11 from prepend_content.php -> Event handler + * @var int $chkRadValue12 from prepend_content.php -> Flap detection + * @var int $chkRadValue13 from prepend_content.php -> Retain status information + * @var int $chkRadValue14 from prepend_content.php -> Retain non-status information + * @var int $chkRadValue15 from prepend_content.php -> Process performance data + * @var int $chkRadValue16 from prepend_content.php -> Is volatile + * @var int $chkRadValue17 from prepend_content.php -> Notifcation + * @var int $chkRadValue18 from prepend_content.php -> Parent services multiselect options + * @var string $chkTfNullVal1 from prepend_content.php -> Retry interval + * @var string $chkTfNullVal2 from prepend_content.php -> Max check attempts + * @var string $chkTfNullVal3 from prepend_content.php -> Check interval + * @var string $chkTfNullVal4 from prepend_content.php -> Freshness threshold + * @var string $chkTfNullVal5 from prepend_content.php -> Low flap threshold + * @var string $chkTfNullVal6 from prepend_content.php -> High flap threshold + * @var string $chkTfNullVal7 from prepend_content.php -> Notification interval + * @var string $chkTfNullVal8 from prepend_content.php -> First notification delay + * @var string $chkTfNullVal9 from prepend_content.php -> Importance + * @var int $intTemplates from prepend_content.php -> Form uses template definitions + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 9; -$preContent = 'admin/services.htm.tpl'; -$preListTpl = 'admin/datalist_services.htm.tpl'; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 9; +$preContent = 'admin/services.htm.tpl'; +$preListTpl = 'admin/datalist_services.htm.tpl'; $preSearchSession = 'service'; -$preTableName = 'tbl_service'; -$preKeyField = 'config_name'; -$preAccess = 1; -$preFieldvars = 1; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Data processing -// =============== -$strNO = substr($chkChbGr1a.$chkChbGr1b.$chkChbGr1c.$chkChbGr1d.$chkChbGr1e.$chkChbGr1f, 0, -1); -$strIS = substr($chkChbGr2a.$chkChbGr2b.$chkChbGr2c.$chkChbGr2d, 0, -1); -$strFL = substr($chkChbGr3a.$chkChbGr3b.$chkChbGr3c.$chkChbGr3d, 0, -1); -$strST = substr($chkChbGr4a.$chkChbGr4b.$chkChbGr4c.$chkChbGr4d, 0, -1); -if ($chkSelValue1 != '') { +$preTableName = 'tbl_service'; +$preKeyField = 'config_name'; +$preAccess = 1; +$preFieldvars = 1; +$strSqlParents = ''; +$strErrorMessage = ''; +$strInfoMessage = ''; +$strConsistMessage = ''; +$strDBWarning = ''; +$intDataWarning = 0; +$intRet1 = 0; +$intRet2 = 0; +$intRet3 = 0; +$intRet4 = 0; +$intRet5 = 0; +$intRet6 = 0; +$intNoTime = 0; +/* +Default values for form variables +*/ +if (!isset($intMselValue1)) { + $intMselValue1 = 0; +} +if (!isset($intMselValue2)) { + $intMselValue2 = 0; +} +if (!isset($intMselValue3)) { + $intMselValue3 = 0; +} +if (!isset($intMselValue4)) { + $intMselValue4 = 0; +} +if (!isset($intMselValue5)) { + $intMselValue5 = 0; +} +if (!isset($intMselValue6)) { + $intMselValue6 = 0; +} +/* +Define common variables +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Data processing +*/ +$strNO = substr($chkChbGr1a . $chkChbGr1b . $chkChbGr1c . $chkChbGr1d . $chkChbGr1e . $chkChbGr1f, 0, -1); +$strIS = substr($chkChbGr2a . $chkChbGr2b . $chkChbGr2c . $chkChbGr2d, 0, -1); +$strFL = substr($chkChbGr3a . $chkChbGr3b . $chkChbGr3c . $chkChbGr3d, 0, -1); +$strST = substr($chkChbGr4a . $chkChbGr4b . $chkChbGr4c . $chkChbGr4d, 0, -1); +if ($chkSelValue1 !== 0) { for ($i = 1; $i <= 8; $i++) { - $tmpVar = 'chkTfArg'.$i; + $tmpVar = 'chkTfArg' . $i; $$tmpVar = str_replace('!', '::bang::', $$tmpVar); - if ($$tmpVar != '') { - $chkSelValue1 .= '!' .$$tmpVar; + if ($$tmpVar !== '') { + $chkSelValue1 .= '!' . $$tmpVar; } } } -// -// Add or modify data -// ================== -if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAccess == 0)) { +/* +Add or modify data +*/ +if ((($chkModus === 'insert') || ($chkModus === 'modify')) && ($intGlobalWriteAccess === 0)) { + if ((int)$SETS['performance']['parents'] === 1) { + $strSqlParents = "`parents`=$intMselValue6, `parents_tploptions`=$chkRadValue18,"; + } $strSQLx = "`$preTableName` SET `$preKeyField`='$chkTfValue1', `host_name`=$intMselValue1, " . "`host_name_tploptions`=$chkRadValue1, `hostgroup_name`=$intMselValue2, " . "`hostgroup_name_tploptions`=$chkRadValue2, `service_description`='$chkTfValue3', " - . "`display_name`='$chkTfValue4', `parents`=$intMselValue6, `parents_tploptions`=$chkRadValue18, " + . "`display_name`='$chkTfValue4', $strSqlParents " . "`importance`=$chkTfNullVal9, `servicegroups`=$intMselValue3, " . "`servicegroups_tploptions`=$chkRadValue3, `check_command`='$chkSelValue1', " . "`use_template`=$intTemplates, `is_volatile`=$chkRadValue14, `initial_state`='$strIS', " @@ -77,97 +218,99 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce . "`notification_options`='$strNO', `notifications_enabled`=$chkRadValue17, `stalking_options`='$strST', " . "`notes`='$chkTfValue5', `notes_url`='$chkTfValue6', `action_url`='$chkTfValue7', " . "`icon_image`='$chkTfValue8', `icon_image_alt`='$chkTfValue9', `name`='$chkTfValue10', $preSQLCommon1"; - if ($chkModus == 'insert') { - $strSQL = 'INSERT INTO ' .$strSQLx; + if ($chkModus === 'insert') { + $strSQL = 'INSERT INTO ' . $strSQLx; } else { - $strSQL = 'UPDATE ' .$strSQLx. ' WHERE `id`=' .$chkDataId; + $strSQL = 'UPDATE ' . $strSQLx . ' WHERE `id`=' . $chkDataId; } - if ($intWriteAccessId == 0) { - if (($chkTfValue1 != '') && ($chkTfValue3 != '')) { + if ($intWriteAccessId === 0) { + if (($chkTfValue1 !== '') && ($chkTfValue3 !== '')) { $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($chkModus == 'insert') { + if ($chkModus === 'insert') { $chkDataId = $intInsertId; } - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); - if ($chkModus == 'insert') { - $myDataClass->writeLog(translate('New service inserted:'). ' ' .$chkTfValue1); + if ($chkModus === 'insert') { + $myDataClass->writeLog(translate('New service inserted:') . ' ' . $chkTfValue1); } - if ($chkModus == 'modify') { - $myDataClass->writeLog(translate('Service modified:'). ' ' .$chkTfValue1); + if ($chkModus === 'modify') { + $myDataClass->writeLog(translate('Service modified:') . ' ' . $chkTfValue1); } - // - // Insert/update relations - // ======================= - if ($chkModus == 'insert') { - if ($intMselValue1 != 0) { + /* + Insert/update relations + */ + if ($chkModus === 'insert') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataInsertRelation('tbl_lnkServiceToHost', $chkDataId, $chkMselValue1); } - if (isset($intRet1) && ($intRet1 != 0)) { + if (isset($intRet1) && ($intRet1 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataInsertRelation( 'tbl_lnkServiceToHostgroup', $chkDataId, $chkMselValue2 ); } - if (isset($intRet2) && ($intRet2 != 0)) { + if (isset($intRet2) && ($intRet2 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue3 != 0) { + if ($intMselValue3 !== 0) { $intRet3 = $myDataClass->dataInsertRelation( 'tbl_lnkServiceToServicegroup', $chkDataId, $chkMselValue3 ); } - if (isset($intRet3) && ($intRet3 != 0)) { + if (isset($intRet3) && ($intRet3 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue4 != 0) { + if ($intMselValue4 !== 0) { $intRet4 = $myDataClass->dataInsertRelation( 'tbl_lnkServiceToContact', $chkDataId, $chkMselValue4 ); } - if (isset($intRet4) && ($intRet4 != 0)) { + if (isset($intRet4) && ($intRet4 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue5 != 0) { + if ($intMselValue5 !== 0) { $intRet5 = $myDataClass->dataInsertRelation( 'tbl_lnkServiceToContactgroup', $chkDataId, $chkMselValue5 ); } - if (isset($intRet5) && ($intRet5 != 0)) { + if (isset($intRet5) && ($intRet5 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue6 != 0) { - $intRet6 = $myDataClass->dataInsertRelation( - 'tbl_lnkServiceToService', - $chkDataId, - $chkMselValue6 - ); + if ((int)$SETS['performance']['parents'] === 1) { + if ($intMselValue6 !== 0) { + $intRet6 = $myDataClass->dataInsertRelation( + 'tbl_lnkServiceToService', + $chkDataId, + $chkMselValue6 + ); + } + if (isset($intRet6) && ($intRet6 !== 0)) { + $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); + } } - if (isset($intRet6) && ($intRet6 != 0)) { - $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); - } - } elseif ($chkModus == 'modify') { - if ($intMselValue1 != 0) { + } elseif ($chkModus === 'modify') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataUpdateRelation('tbl_lnkServiceToHost', $chkDataId, $chkMselValue1); } else { $intRet1 = $myDataClass->dataDeleteRelation('tbl_lnkServiceToHost', $chkDataId); } - if (isset($intRet1) && ($intRet1 != 0)) { + if (isset($intRet1) && ($intRet1 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataUpdateRelation( 'tbl_lnkServiceToHostgroup', $chkDataId, @@ -176,10 +319,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet2 = $myDataClass->dataDeleteRelation('tbl_lnkServiceToHostgroup', $chkDataId); } - if (isset($intRet1) && ($intRet1 != 0)) { + if (isset($intRet2) && ($intRet2 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue3 != 0) { + if ($intMselValue3 !== 0) { $intRet3 = $myDataClass->dataUpdateRelation( 'tbl_lnkServiceToServicegroup', $chkDataId, @@ -188,10 +331,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet3 = $myDataClass->dataDeleteRelation('tbl_lnkServiceToServicegroup', $chkDataId); } - if (isset($intRet1) && ($intRet1 != 0)) { + if (isset($intRet3) && ($intRet3 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue4 != 0) { + if ($intMselValue4 !== 0) { $intRet4 = $myDataClass->dataUpdateRelation( 'tbl_lnkServiceToContact', $chkDataId, @@ -200,10 +343,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet4 = $myDataClass->dataDeleteRelation('tbl_lnkServiceToContact', $chkDataId); } - if (isset($intRet1) && ($intRet1 != 0)) { + if (isset($intRet4) && ($intRet4 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue5 != 0) { + if ($intMselValue5 !== 0) { $intRet5 = $myDataClass->dataUpdateRelation( 'tbl_lnkServiceToContactgroup', $chkDataId, @@ -212,73 +355,49 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet5 = $myDataClass->dataDeleteRelation('tbl_lnkServiceToContactgroup', $chkDataId); } - if (isset($intRet5) && ($intRet1 != 0)) { + if (isset($intRet5) && ($intRet5 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue6 != 0) { - $intRet6 = $myDataClass->dataUpdateRelation( - 'tbl_lnkServiceToService', - $chkDataId, - $chkMselValue6 - ); - } else { - $intRet6 = $myDataClass->dataDeleteRelation('tbl_lnkServiceToService', $chkDataId); - } - if ($intRet6 != 0) { - $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); - } - } - if (($intRet1 + $intRet2 + $intRet3 + $intRet4 + $intRet5 + $intRet6) != 0) { - $strInfoMessage = ''; - } - // - // Removing the config file if an entry was deleted or renamed - // =========================================================== - if (($chkModus == 'modify') && ($chkTfValue2 != $chkTfValue1) && ($chkDomainId != 0)) { - $intServiceCount = $myDBClass->countRows("SELECT * FROM `$preTableName` " - . "WHERE BINARY `$preKeyField`='$chkTfValue2' AND `config_id`=$chkDomainId " - . "AND `active`='1'"); - if ($intServiceCount == 0) { - $myConfigClass->getConfigTargets($arrConfigID); - if (($arrConfigID != 1) && is_array($arrConfigID)) { - $intReturn = 0; - foreach ($arrConfigID as $intConfigID) { - $intReturn += $myConfigClass->moveFile('service', $chkTfValue2. '.cfg', $intConfigID); - } - if ($intReturn == 0) { - $myVisClass->processMessage(translate('The assigned, no longer used configuration ' - . 'files were deleted successfully!'), $strInfoMessage); - $myDataClass->writeLog(translate('Service file deleted:'). ' ' .$chkTfValue2. '.cfg'); - } else { - if ($chkDomainId == 0) { - $myVisClass->processMessage(translate('Common files cannot be removed from target ' - . 'systems - please check manually'), $strErrorMessage); - } else { - $myVisClass->processMessage(translate('Errors while deleting the old configuration ' - . 'file - please check!:'), $strErrorMessage); - $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); - } - } + if ((int)$SETS['performance']['parents'] === 1) { + if ($intMselValue6 !== 0) { + $intRet6 = $myDataClass->dataUpdateRelation( + 'tbl_lnkServiceToService', + $chkDataId, + $chkMselValue6 + ); + } else { + $intRet6 = $myDataClass->dataDeleteRelation('tbl_lnkServiceToService', $chkDataId); + } + if ($intRet6 !== 0) { + $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } } - // - // Removing the config file if an entry was dectivated - // =================================================== - if (($chkModus == 'modify') && ($chkActive == 0)) { + if (($intRet1 + $intRet2 + $intRet3 + $intRet4 + $intRet5 + $intRet6) !== 0) { + $strInfoMessage = ''; + } + /* + Removing the config file if an entry was deleted or renamed + */ + if (($chkModus === 'modify') && ($chkTfValue2 !== $chkTfValue1) && ($chkDomainId !== 0)) { + /** @noinspection SqlResolve */ $intServiceCount = $myDBClass->countRows("SELECT * FROM `$preTableName` " - . "WHERE `$preKeyField`='$chkTfValue2' AND `config_id`=$chkDomainId AND `active`='1'"); - if ($intServiceCount == 0) { + . "WHERE BINARY `$preKeyField`='$chkTfValue2' AND `config_id`=$chkDomainId " + . "AND `active`='1'"); + if ($intServiceCount === 0) { $myConfigClass->getConfigTargets($arrConfigID); - if (($arrConfigID != 1) && is_array($arrConfigID)) { + if (($arrConfigID !== 1) && is_array($arrConfigID)) { $intReturn = 0; foreach ($arrConfigID as $intConfigID) { - $intReturn += $myConfigClass->moveFile('service', $chkTfValue2. '.cfg', $intConfigID); + $intReturn += $myConfigClass->moveFile('service', $chkTfValue2 . '.cfg', $intConfigID); } - if ($intReturn == 0) { + if ($intReturn === 0) { $myVisClass->processMessage(translate('The assigned, no longer used configuration ' . 'files were deleted successfully!'), $strInfoMessage); - $myDataClass->writeLog(translate('Service file deleted:'). ' ' .$chkTfValue2. '.cfg'); + $myDataClass->writeLog(translate('Service file deleted:') . ' ' . $chkTfValue2 . '.cfg'); + } else if ($chkDomainId === 0) { + $myVisClass->processMessage(translate('Common files cannot be removed from target ' + . 'systems - please check manually'), $strErrorMessage); } else { $myVisClass->processMessage(translate('Errors while deleting the old configuration ' . 'file - please check!:'), $strErrorMessage); @@ -287,98 +406,122 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } } } - // - // Insert/update session data for templates - // ======================================== - if ($chkModus == 'modify') { - $strSQL = 'DELETE FROM `tbl_lnkServiceToServicetemplate` WHERE `idMaster`=' .$chkDataId; - $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn != 0) { + /* + Removing the config file if an entry was dectivated + */ + if (($chkModus === 'modify') && ($chkActive === 0)) { + /** @noinspection SqlResolve */ + $intServiceCount = $myDBClass->countRows("SELECT * FROM `$preTableName` " + . "WHERE `$preKeyField`='$chkTfValue2' AND `config_id`=$chkDomainId AND `active`='1'"); + if ($intServiceCount === 0) { + $myConfigClass->getConfigTargets($arrConfigID); + if (($arrConfigID !== 1) && is_array($arrConfigID)) { + $intReturn = 0; + foreach ($arrConfigID as $intConfigID) { + $intReturn += $myConfigClass->moveFile('service', $chkTfValue2 . '.cfg', $intConfigID); + } + if ($intReturn === 0) { + $myVisClass->processMessage(translate('The assigned, no longer used configuration ' + . 'files were deleted successfully!'), $strInfoMessage); + $myDataClass->writeLog(translate('Service file deleted:') . ' ' . $chkTfValue2 . '.cfg'); + } else { + $myVisClass->processMessage(translate('Errors while deleting the old configuration ' + . 'file - please check!:'), $strErrorMessage); + $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); + } + } + } + } + /* + Insert/update session data for templates + */ + if ($chkModus === 'modify') { + $strSQL = 'DELETE FROM `tbl_lnkServiceToServicetemplate` WHERE `idMaster`=' . $chkDataId; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } if (isset($_SESSION['templatedefinition']) && is_array($_SESSION['templatedefinition']) && - (count($_SESSION['templatedefinition']) != 0)) { + (count($_SESSION['templatedefinition']) !== 0)) { $intSortId = 1; - /** @noinspection ForeachSourceInspection */ foreach ($_SESSION['templatedefinition'] as $elem) { - if ($elem['status'] == 0) { - $strSQL = 'INSERT INTO `tbl_lnkServiceToServicetemplate` (`idMaster`,`idSlave`, ' - . "`idTable`,`idSort`) VALUES ($chkDataId,".$elem['idSlave']. ', ' - . $elem['idTable']. ',' .$intSortId. ')'; + if ((int)$elem['status'] === 0) { + $strSQL = 'INSERT INTO `tbl_lnkServiceToServicetemplate` (`idMaster`,`idSlave`, ' + . "`idTable`,`idSort`) VALUES ($chkDataId," . $elem['idSlave'] . ', ' + . $elem['idTable'] . ',' . $intSortId . ')'; $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } $intSortId++; } } - // - // Insert/update session data for free variables - // ============================================= - if ($chkModus == 'modify') { - $strSQL = 'SELECT * FROM `tbl_lnkServiceToVariabledefinition` WHERE `idMaster`=' .$chkDataId; - $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($booReturn == false) { + /* + Insert/update session data for free variables + */ + if ($chkModus === 'modify') { + $strSQL = 'SELECT * FROM `tbl_lnkServiceToVariabledefinition` WHERE `idMaster`=' . $chkDataId; + $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); + if ($booReturn === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($intDataCount != 0) { + if ($intDataCount !== 0) { foreach ($arrData as $elem) { - $strSQL = 'DELETE FROM `tbl_variabledefinition` WHERE `id`=' .$elem['idSlave']; + $strSQL = 'DELETE FROM `tbl_variabledefinition` WHERE `id`=' . $elem['idSlave']; $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } } - $strSQL1 = 'DELETE FROM `tbl_lnkServiceToVariabledefinition` WHERE `idMaster`=' .$chkDataId; + $strSQL1 = 'DELETE FROM `tbl_lnkServiceToVariabledefinition` WHERE `idMaster`=' . $chkDataId; $intReturn1 = $myDataClass->dataInsert($strSQL1, $intInsertId); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - $strSQL2 = 'UPDATE `tbl_service` SET `use_variables`=0 WHERE `id`=' .$chkDataId; + $strSQL2 = 'UPDATE `tbl_service` SET `use_variables`=0 WHERE `id`=' . $chkDataId; $intReturn2 = $myDataClass->dataInsert($strSQL2, $intInsertId); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } if (isset($_SESSION['variabledefinition']) && is_array($_SESSION['variabledefinition']) && - (count($_SESSION['variabledefinition']) != 0)) { + (count($_SESSION['variabledefinition']) !== 0)) { $intCountVariable = 0; - /** @noinspection ForeachSourceInspection */ foreach ($_SESSION['variabledefinition'] as $elem) { - if ($elem['status'] == 0) { - $strSQL = 'INSERT INTO `tbl_variabledefinition` (`name`,`value`,`last_modified`) ' - . "VALUES ('".$elem['definition']."','".$elem['range']."',now())"; + if ((int)$elem['status'] === 0) { + $strSQL = 'INSERT INTO `tbl_variabledefinition` (`name`,`value`,`last_modified`) ' + . "VALUES ('" . $elem['definition'] . "','" . $elem['range'] . "',now())"; $intReturn1 = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - $strSQL = 'INSERT INTO `tbl_lnkServiceToVariabledefinition` (`idMaster`,`idSlave`) ' + $strSQL = 'INSERT INTO `tbl_lnkServiceToVariabledefinition` (`idMaster`,`idSlave`) ' . "VALUES ($chkDataId,$intInsertId)"; $intReturn2 = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if (($intReturn1 == 0) && ($intReturn2 == 0)) { + if (($intReturn1 === 0) && ($intReturn2 === 0)) { $intCountVariable++; } } } - if ($intCountVariable != 0) { - $strSQL = 'UPDATE `tbl_service` SET `use_variables`=1 WHERE `id`=' .$chkDataId; - $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn != 0) { + if ($intCountVariable !== 0) { + $strSQL = 'UPDATE `tbl_service` SET `use_variables`=1 WHERE `id`=' . $chkDataId; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } } - // - // Update Import HASH - // ================== + /* + Update import hash + */ $intReturn = $myDataClass->updateHash($preTableName, $chkDataId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } @@ -393,70 +536,74 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } $chkModus = 'display'; } -if ($chkModus != 'add') { +if ($chkModus !== 'add') { $chkModus = 'display'; } -// -// Singe data form -// =============== -if ($chkModus == 'add') { +/* +Singe data form +*/ +if ($chkModus === 'add') { $conttp->setVariable('TITLE', translate('Define services (services.cfg)')); - // Do not show modified time list + /* Do not show modified time list */ $intNoTime = 1; - // Process template fields + /* Process template fields */ $strWhere = ''; - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - $strWhere = 'AND `id` <> ' .$arrModifyData['id']; + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + $strWhere = 'AND `id` <> ' . $arrModifyData['id']; } - $strSQL1 = 'SELECT `id`,`template_name`, `active` FROM `tbl_servicetemplate` ' + $strSQL1 = 'SELECT `id`,`template_name`, `active`, `config_id` FROM `tbl_servicetemplate` ' . "WHERE $strDomainWhere2 ORDER BY `template_name`"; $booReturn1 = $myDBClass->hasDataArray($strSQL1, $arrDataTpl, $intDataCountTpl); - if ($booReturn1 == false) { + if ($booReturn1 === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($intDataCountTpl != 0) { + if ($intDataCountTpl !== 0) { /** @var array $arrDataTpl */ foreach ($arrDataTpl as $elem) { - if ($elem['active'] == 0) { + if ((int)$elem['active'] === 0) { $strActive = ' [inactive]'; $conttp->setVariable('SPECIAL_STYLE', 'inactive_option'); } else { $strActive = ''; - $conttp->setVariable('SPECIAL_STYLE', ''); + $conttp->setVariable('SPECIAL_STYLE'); } - $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem['template_name'], ENT_QUOTES, 'UTF-8'). - $strActive); - $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id']. '::1'); + if ((int)$elem['config_id'] === 0) { + $strCommon = ' [common]'; + } else { + $strCommon = ''; + } + $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem['template_name'], ENT_QUOTES, 'UTF-8') . + $strActive . $strCommon); + $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id'] . '::1'); + /** @noinspection DisconnectedForeachInstructionInspection */ $conttp->parse('template'); } } - $strSQL2 = "SELECT `id`, `name`, `active` FROM `$preTableName` " + /** @noinspection SqlResolve */ + $strSQL2 = "SELECT `id`, `name`, `active` FROM `$preTableName` " . "WHERE `name` <> '' $strWhere AND $strDomainWhere ORDER BY `name`"; $booReturn2 = $myDBClass->hasDataArray($strSQL2, $arrDataHpl, $intDataCountHpl); - if ($booReturn2 == false) { + if ($booReturn2 === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($intDataCountHpl != 0) { + if ($intDataCountHpl !== 0) { /** @var array $arrDataHpl */ foreach ($arrDataHpl as $elem) { - if ($elem['active'] == 0) { + if ($elem['active'] === 0) { $strActive = ' [inactive]'; $conttp->setVariable('SPECIAL_STYLE', 'inactive_option'); } else { $strActive = ''; - $conttp->setVariable('SPECIAL_STYLE', ''); + $conttp->setVariable('SPECIAL_STYLE'); } - $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem['name'], ENT_QUOTES, 'UTF-8').$strActive); - $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id']. '::2'); + $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem['name'], ENT_QUOTES, 'UTF-8') . $strActive); + $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id'] . '::2'); + /** @noinspection DisconnectedForeachInstructionInspection */ $conttp->parse('template'); } } - // Process host selection field - if (isset($arrModifyData['host_name'])) { - $intFieldId = $arrModifyData['host_name']; - } else { - $intFieldId = 0; - } + /* Process host selection field */ + $intFieldId = $arrModifyData['host_name'] ?? 0; $intReturn3 = $myVisClass->parseSelectMulti( 'tbl_host', 'host_name', @@ -465,14 +612,10 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn3 != 0) { + if ($intReturn3 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['hostgroup_name'])) { - $intFieldId = $arrModifyData['hostgroup_name']; - } else { - $intFieldId = 0; - } + $intFieldId = $arrModifyData['hostgroup_name'] ?? 0; $intReturn4 = $myVisClass->parseSelectMulti( 'tbl_hostgroup', 'hostgroup_name', @@ -481,42 +624,37 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn4 != 0) { + if ($intReturn4 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (($intReturn3 != 0) && ($intReturn4 != 0)) { + if (($intReturn3 !== 0) && ($intReturn4 !== 0)) { $myVisClass->processMessage(translate('Attention, no hosts or hostgroups defined!'), $strDBWarning); $intDataWarning = 1; } - // Process service selection field - if (isset($arrModifyData['parents'])) { - $intFieldId = $arrModifyData['parents']; - } else { - $intFieldId = 0; - } - if (isset($arrModifyData['id'])) { - $intKeyId = $arrModifyData['id']; - } else { - $intKeyId = 0; - } - $intReturn3 = $myVisClass->parseSelectMulti( - $preTableName, - $preKeyField, - 'service_parents', - 'tbl_lnkServiceToService', - 0, - $intFieldId, - $intKeyId - ); - if ($intReturn3 != 0) { - $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); - } - // Process service groups selection field - if (isset($arrModifyData['servicegroups'])) { - $intFieldId = $arrModifyData['servicegroups']; - } else { - $intFieldId = 0; + /* Process service selection field */ + if ((int)$SETS['performance']['parents'] === 1) { + $intFieldId = $arrModifyData['parents'] ?? 0; + $intKeyId = $arrModifyData['id'] ?? 0; + $intReturn3 = $myVisClass->parseSelectMulti( + $preTableName, + $preKeyField, + 'service_parents', + 'tbl_lnkServiceToService', + 0, + $intFieldId, + $intKeyId + ); + if ($intReturn3 !== 0) { + $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); + } + if ($intVersion === 4) { + $conttp->setVariable('PARENTS_VISIBLE', 'elementShow'); + } + } else if ($intVersion === 4) { + $conttp->setVariable('PARENTS_VISIBLE', 'elementHide'); } + /* Process service groups selection field */ + $intFieldId = $arrModifyData['servicegroups'] ?? 0; $intReturn5 = $myVisClass->parseSelectMulti( 'tbl_servicegroup', 'servicegroup_name', @@ -525,63 +663,47 @@ if ($chkModus == 'add') { 0, $intFieldId ); - if ($intReturn5 != 0) { + if ($intReturn5 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process check command selection field - if (isset($arrModifyData['check_command']) && ($arrModifyData['check_command'] != '')) { + /* Process check command selection field */ + if (isset($arrModifyData['check_command']) && ($arrModifyData['check_command'] !== '')) { $arrCommand = explode('!', $arrModifyData['check_command']); $intFieldId = $arrCommand[0]; } else { $intFieldId = 0; } $intReturn6 = $myVisClass->parseSelectSimple('tbl_command', 'command_name', 'servicecommand', 2, $intFieldId); - if ($intReturn6 != 0) { + if ($intReturn6 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if ($intReturn6 != 0) { + if ($intReturn6 !== 0) { $myVisClass->processMessage(translate('Attention, no check commands defined!'), $strDBWarning); $intDataWarning = 1; } - // Process check period selection field - if (isset($arrModifyData['check_period'])) { - $intFieldId = $arrModifyData['check_period']; - } else { - $intFieldId = 0; - } + /* Process check period selection field */ + $intFieldId = $arrModifyData['check_period'] ?? 0; $intReturn7 = $myVisClass->parseSelectSimple('tbl_timeperiod', 'timeperiod_name', 'checkperiod', 1, $intFieldId); - if ($intReturn7 != 0) { + if ($intReturn7 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['notification_period'])) { - $intFieldId = $arrModifyData['notification_period']; - } else { - $intFieldId = 0; - } + $intFieldId = $arrModifyData['notification_period'] ?? 0; $intReturn8 = $myVisClass->parseSelectSimple('tbl_timeperiod', 'timeperiod_name', 'notifyperiod', 1, $intFieldId); - if ($intReturn8 != 0) { + if ($intReturn8 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if ($intReturn8 != 0) { + if ($intReturn8 !== 0) { $myVisClass->processMessage(translate('Attention, no time periods defined!'), $strDBWarning); $intDataWarning = 1; } - // Process event handler selection field - if (isset($arrModifyData['event_handler'])) { - $intFieldId = $arrModifyData['event_handler']; - } else { - $intFieldId = 0; - } + /* Process event handler selection field */ + $intFieldId = $arrModifyData['event_handler'] ?? 0; $intReturn9 = $myVisClass->parseSelectSimple('tbl_command', 'command_name', 'eventhandler', 1, $intFieldId); - if ($intReturn9 != 0) { + if ($intReturn9 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process contact and contact group selection field - if (isset($arrModifyData['contacts'])) { - $intFieldId = $arrModifyData['contacts']; - } else { - $intFieldId = 0; - } + /* Process contact and contact group selection field */ + $intFieldId = $arrModifyData['contacts'] ?? 0; $intReturn10 = $myVisClass->parseSelectMulti( 'tbl_contact', 'contact_name', @@ -590,14 +712,10 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn10 != 0) { + if ($intReturn10 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['contact_groups'])) { - $intFieldId = $arrModifyData['contact_groups']; - } else { - $intFieldId = 0; - } + $intFieldId = $arrModifyData['contact_groups'] ?? 0; $intReturn12 = $myVisClass->parseSelectMulti( 'tbl_contactgroup', 'contactgroup_name', @@ -606,143 +724,164 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn12 != 0) { + if ($intReturn12 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (($intReturn9 != 0) && ($intReturn12 != 0)) { + if (($intReturn9 !== 0) && ($intReturn12 !== 0)) { $myVisClass->processMessage(translate('Attention, no contacts or contact groups defined!'), $strDBWarning); $intDataWarning = 1; } - // Process access group selection field - if (isset($arrModifyData['access_group'])) { - $intFieldId = $arrModifyData['access_group']; - } else { - $intFieldId = 0; - } + /* Process access group selection field */ + $intFieldId = $arrModifyData['access_group'] ?? 0; $intReturn13 = $myVisClass->parseSelectSimple('tbl_group', 'groupname', 'acc_group', 0, $intFieldId); - if ($intReturn13 != 0) { + if ($intReturn13 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Initial add/modify form definitions + /* Initial add/modify form definitions */ $strChbFields = 'ACE,PCE,PAC,FRE,OBS,EVH,FLE,STI,NSI,PED,ISV,NOE,HOS,HOG,SEG,COT,COG,TPL'; $myContentClass->addFormInit($conttp, $strChbFields); - if ($intDataWarning == 1) { - $conttp->setVariable('WARNING', $strDBWarning. '
' .translate('Saving not possible!')); + if ($intDataWarning === 1) { + $conttp->setVariable('WARNING', $strDBWarning . '
' . translate('Saving not possible!')); } - // Insert data from database in "modify" mode - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - // Check relation information to find out locked configuration datasets + /* Insert data from database in "modify" mode */ + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + // Check relation information to find out locked configuration datasets */ $intLocked = $myDataClass->infoRelation($preTableName, $arrModifyData['id'], $preKeyField); $myVisClass->processMessage($myDataClass->strInfoMessage, $strRelMessage); - $strInfo = '
' .translate('Entry cannot be activated because it is used by ' - . 'another configuration'). ':'; - $strInfo .= '
' .$strRelMessage. ''; - // Process data + $strInfo = '
' . translate('Entry cannot be activated because it is used by ' + . 'another configuration') . ':'; + $strInfo .= '
' . $strRelMessage . ''; + // Process data */ $myContentClass->addInsertData($conttp, $arrModifyData, $intLocked, $strInfo, $strChbFields); - $conttp->setVariable('DAT_ACE' .$arrModifyData['active_checks_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_PCE' .$arrModifyData['passive_checks_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_PAC' .$arrModifyData['parallelize_check']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_FRE' .$arrModifyData['check_freshness']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_OBS' .$arrModifyData['obsess_over_service']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_EVH' .$arrModifyData['event_handler_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_FLE' .$arrModifyData['flap_detection_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_STI' .$arrModifyData['retain_status_information']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_NSI' .$arrModifyData['retain_nonstatus_information']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_PED' .$arrModifyData['process_perf_data']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_ISV' .$arrModifyData['is_volatile']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_NOE' .$arrModifyData['notifications_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_HOS' .$arrModifyData['host_name_tploptions']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_HOG' .$arrModifyData['hostgroup_name_tploptions']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_SEG' .$arrModifyData['servicegroups_tploptions']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_COT' .$arrModifyData['contacts_tploptions']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_COG' .$arrModifyData['contact_groups_tploptions']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_TPL' .$arrModifyData['use_template_tploptions']. '_CHECKED', 'checked'); - // Special processing for -1 values - write 'null' to integer fields - $strIntegerfelder = 'max_check_attempts,check_interval,retry_interval,freshness_threshold,'; + $conttp->setVariable('DAT_ACE' . $arrModifyData['active_checks_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_PCE' . $arrModifyData['passive_checks_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_PAC' . $arrModifyData['parallelize_check'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_FRE' . $arrModifyData['check_freshness'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_OBS' . $arrModifyData['obsess_over_service'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_EVH' . $arrModifyData['event_handler_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_FLE' . $arrModifyData['flap_detection_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_STI' . $arrModifyData['retain_status_information'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_NSI' . $arrModifyData['retain_nonstatus_information'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_PED' . $arrModifyData['process_perf_data'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_ISV' . $arrModifyData['is_volatile'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_NOE' . $arrModifyData['notifications_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_HOS' . $arrModifyData['host_name_tploptions'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_HOG' . $arrModifyData['hostgroup_name_tploptions'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_SEG' . $arrModifyData['servicegroups_tploptions'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_PAR' . $arrModifyData['parents_tploptions'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_COT' . $arrModifyData['contacts_tploptions'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_COG' . $arrModifyData['contact_groups_tploptions'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_TPL' . $arrModifyData['use_template_tploptions'] . '_CHECKED', 'checked'); + /* Special processing for -1 values - write 'null' to integer fields */ + $strIntegerfelder = 'max_check_attempts,check_interval,retry_interval,freshness_threshold,'; $strIntegerfelder .= 'low_flap_threshold,high_flap_threshold,notification_interval,first_notification_delay'; foreach (explode(',', $strIntegerfelder) as $elem) { - if ($arrModifyData[$elem] == -1) { - $conttp->setVariable('DAT_' .strtoupper($elem), 'null'); + if ($arrModifyData[$elem] === -1) { + $conttp->setVariable('DAT_' . strtoupper($elem), 'null'); } } - if ($arrModifyData['check_command'] != '') { + if ($arrModifyData['check_command'] !== '') { $arrArgument = explode('!', $arrModifyData['check_command']); foreach ($arrArgument as $key => $value) { - if ($key == 0) { - $conttp->setVariable('IFRAME_SRC', $_SESSION['SETS']['path']['base_url']. - 'admin/commandline.php?cname=' .$value); + if ($key === 0) { + $conttp->setVariable('IFRAME_SRC', $_SESSION['SETS']['path']['base_url'] . + 'admin/commandline.php?cname=' . $value); } else { $value1 = str_replace('::bang::', '!', $value); $value2 = str_replace('::back::', "\\", $value1); - $conttp->setVariable('DAT_ARG' .$key, htmlentities($value2, ENT_QUOTES, 'UTF-8')); + $conttp->setVariable('DAT_ARG' . $key, htmlentities($value2, ENT_QUOTES, 'UTF-8')); } } } - // Process option fields + /* Process option fields */ foreach (explode(',', $arrModifyData['initial_state']) as $elem) { - $conttp->setVariable('DAT_IS' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_IS' . strtoupper($elem) . '_CHECKED', 'checked'); } foreach (explode(',', $arrModifyData['flap_detection_options']) as $elem) { - $conttp->setVariable('DAT_FL' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_FL' . strtoupper($elem) . '_CHECKED', 'checked'); } foreach (explode(',', $arrModifyData['notification_options']) as $elem) { - $conttp->setVariable('DAT_NO' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_NO' . strtoupper($elem) . '_CHECKED', 'checked'); } foreach (explode(',', $arrModifyData['stalking_options']) as $elem) { - $conttp->setVariable('DAT_ST' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_ST' . strtoupper($elem) . '_CHECKED', 'checked'); } } $conttp->parse('datainsert'); $conttp->show('datainsert'); } -// -// List view -// ========== -if ($chkModus == 'display') { - // Initial list view definitions +/* +List view +*/ +if ($chkModus === 'display') { + /* Initial list view definitions */ $myContentClass->listViewInit($mastertp); $mastertp->setVariable('TITLE', translate('Define services (services.cfg)')); $mastertp->setVariable('FIELD_1', translate('Config name')); $mastertp->setVariable('FIELD_2', translate('Service name')); - // Configuration name selection + /* Configuration name selection */ $mastertp->setVariable('DAT_CONFIGNAME', translate('All configs')); $mastertp->parse('configlist'); - $strSQL1 = "SELECT DISTINCT `$preKeyField` FROM `$preTableName` WHERE $strDomainWhere ORDER BY `$preKeyField`"; + /** @noinspection SqlResolve */ + $strSQL1 = "SELECT DISTINCT `$preKeyField` FROM `$preTableName` WHERE $strDomainWhere ORDER BY `$preKeyField`"; $booReturn1 = $myDBClass->hasDataArray($strSQL1, $arrDataConfig, $intDataCount); - if ($booReturn == false) { + if ($booReturn1 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); - } elseif ($intDataCount != 0) { + } elseif ($intDataCount !== 0) { for ($i = 0; $i < $intDataCount; $i++) { $mastertp->setVariable('DAT_CONFIGNAME', $arrDataConfig[$i][$preKeyField]); - if ($_SESSION['search']['config_selection'] == $arrDataConfig[$i][$preKeyField]) { + if ($_SESSION['search']['config_selection'] === $arrDataConfig[$i][$preKeyField]) { $mastertp->setVariable('DAT_CONFIGNAME_SEL', 'selected'); } $mastertp->parse('configlist'); } } - // Process filter string - if ($_SESSION['search'][$preSearchSession] != '') { - $strSearchTxt = $_SESSION['search'][$preSearchSession]; - $strSearchWhere = "AND (`$preKeyField` LIKE '%".$strSearchTxt."%' OR `service_description` " - . "LIKE '%".$strSearchTxt."%' OR `display_name` LIKE '%".$strSearchTxt."%')"; + /* Process search string and filter */ + $strSearchWhere = ''; + if ($_SESSION['search'][$preSearchSession] !== '') { + $strSearchTxt = $_SESSION['search'][$preSearchSession]; + $strSearchWhere .= "AND (`$preKeyField` LIKE '%" . $strSearchTxt . "%' OR `service_description` " + . "LIKE '%" . $strSearchTxt . "%' OR `display_name` LIKE '%" . $strSearchTxt . "%') "; } - if ($_SESSION['search']['config_selection'] != '') { - $strSearchTxt2 = $_SESSION['search']['config_selection']; - if ($strSearchTxt2 != translate('All configs')) { - $strSearchWhere2 = " AND `$preKeyField` = '".$strSearchTxt2."' "; + if ($_SESSION['search']['config_selection'] !== '') { + $strSearchTxt2 = $_SESSION['search']['config_selection']; + if ($strSearchTxt2 !== translate('All configs')) { + $strSearchWhere2 = " AND `$preKeyField` = '" . $strSearchTxt2 . "' "; } } - // Row sorting + if ($_SESSION['filter'][$preSearchSession]['registered'] !== '') { + $intRegistered = (int)$_SESSION['filter'][$preSearchSession]['registered']; + if ($intRegistered === 1) { + $strSearchWhere .= "AND `register` = '1' "; + } + if ($intRegistered === 2) { + $strSearchWhere .= "AND `register` = '0' "; + } + $mastertp->setVariable('SEL_REGFILTER_' . $intRegistered . '_SELECTED', 'selected'); + } + if ($_SESSION['filter'][$preSearchSession]['active'] !== '') { + $intActivated = (int)$_SESSION['filter'][$preSearchSession]['active']; + if ($intActivated === 1) { + $strSearchWhere .= "AND `active` = '1' "; + } + if ($intActivated === 2) { + $strSearchWhere .= "AND `active` = '0' "; + } + $mastertp->setVariable('SEL_ACTIVEFILTER_' . $intActivated . '_SELECTED', 'selected'); + } + /* Row sorting */ $strOrderString = "ORDER BY `config_id`,`$preKeyField` $hidSortDir"; - if ($hidSortBy == 2) { + if ($hidSortBy === 2) { $strOrderString = "ORDER BY `config_id`, `service_description` $hidSortDir"; } - // Count datasets - $strSQL2 = "SELECT count(*) AS `number` FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere2 " + /* Count datasets */ + $intLineCount = 0; + /** @noinspection SqlResolve */ + $strSQL2 = "SELECT count(*) AS `number` FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere2 " . "$strSearchWhere AND `access_group` IN ($strAccess)"; $booReturn2 = $myDBClass->hasSingleDataset($strSQL2, $arrDataLinesCount); - if ($booReturn2 == false) { + if ($booReturn2 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { @@ -751,33 +890,32 @@ if ($chkModus == 'display') { $chkLimit = 0; } } - // Datensätze holen - $strSQL3 = "SELECT `id`, `$preKeyField`, `service_description`, `register`, `active`, `last_modified`, " + /* Datensätze holen */ + $strSQL3 = "SELECT `id`, `$preKeyField`, `service_description`, `register`, `active`, `last_modified`, " . "`config_id`, `access_group` FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere2 " . "$strSearchWhere AND `access_group` IN ($strAccess) $strOrderString " - . "LIMIT $chkLimit,".$SETS['common']['pagelines']; + . "LIMIT $chkLimit," . $SETS['common']['pagelines']; $booReturn3 = $myDBClass->hasDataArray($strSQL3, $arrDataLines, $intDataCount); - if ($booReturn3 == false) { + if ($booReturn3 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - // Process data + /* Process data */ $myContentClass->listData( $mastertp, $arrDataLines, $intDataCount, $intLineCount, $preKeyField, - 'service_description', - 0 + 'service_description' ); - if ($myContentClass->strErrorMessage != '') { + if ($myContentClass->strErrorMessage !== '') { $myVisClass->processMessage($myContentClass->strErrorMessage, $strErrorMessage); } } -// Show messages -$arrTimeData = array(); -$strTimeInfoString = ''; +/* Show messages */ +$arrTimeData = array(); +$strTimeInfoString = ''; $myContentClass->showMessages( $mastertp, $strErrorMessage, @@ -787,7 +925,7 @@ $myContentClass->showMessages( $strTimeInfoString, $intNoTime ); -// -// Process footer -// ============== -$myContentClass->showFooter($maintp, $setFileVersion); +/* +Process footer +*/ +$myContentClass->showFooter($maintp, $setFileVersion); \ No newline at end of file diff --git a/admin/servicetemplates.php b/admin/servicetemplates.php index bf38cfa..136ae0b 100644 --- a/admin/servicetemplates.php +++ b/admin/servicetemplates.php @@ -1,170 +1,302 @@ Application version string + * @var string $chkModus from prepend_adm.php -> Form work mode + * @var int $chkDataId from prepend_adm.php -> Actual dataset id + * @var string $chkSelModify from prepend_adm.php -> Modification selection value + * @var int $hidSortBy from prepend_adm.php -> Sort data by + * @var string $hidSortDir from prepend_adm.php -> Sort data direction (ASC, DESC) + * @var int $chkLimit from prepend_adm.php / settings -> Data set count per page + * @var array $SETS Settings array + * @var int $intGlobalWriteAccess from prepend_content.php -> Global admin write access + * @var int $intWriteAccessId from prepend_content.php -> Admin write access to actual dataset id + * @var string $strAccess from prepend_content.php -> List of read access group id's for actual user + * @var string $preSQLCommon2 from prepend_content.php -> Common SQL part 2 + * @var string $strDomainWhere from prepend_adm.php -> Domain selection SQL part with table name + * @var string $strDomainWhere2 from prepend_adm.php -> Domain selection SQL part without table name + * @var string $chkTfValue1 from prepend_content.php -> Service template name + * @var string $chkTfValue2 from prepend_content.php -> Service template description + * @var string $chkTfValue3 from prepend_content.php -> Display name + * @var string $chkTfValue4 from prepend_content.php -> Notes + * @var string $chkTfValue5 from prepend_content.php -> Notes URL + * @var string $chkTfValue6 from prepend_content.php -> Action URL + * @var string $chkTfValue7 from prepend_content.php -> Icon image + * @var string $chkTfValue8 from prepend_content.php -> Icon image alt text + * @var int $chkSelValue1 from prepend_content.php -> Check command + * @var int $chkSelValue2 from prepend_content.php -> Check period + * @var int $chkSelValue3 from prepend_content.php -> Event handler + * @var int $chkSelValue4 from prepend_content.php -> Notification period + * @var array $chkMselValue1 from prepend_content.php -> Hosts + * @var array $chkMselValue2 from prepend_content.php -> Host groups + * @var array $chkMselValue3 from prepend_content.php -> Service groups + * @var array $chkMselValue4 from prepend_content.php -> Contacts + * @var array $chkMselValue5 from prepend_content.php -> Contact groups + * @var array $chkMselValue6 from prepend_content.php -> Parent services + * @var int $intMselValue1 from prepend_content.php -> Hosts multiselect status value + * @var int $intMselValue2 from prepend_content.php -> Host groups multiselect status value + * @var int $intMselValue3 from prepend_content.php -> Service groups multiselect status value + * @var int $intMselValue4 from prepend_content.php -> Contacts multiselect status value + * @var int $intMselValue5 from prepend_content.php -> Contact groups multiselect status value + * @var int $intMselValue6 from prepend_content.php -> Parent services multiselect status value + * @var string $chkChbGr1a from prepend_content.php -> Notification options (w) + * @var string $chkChbGr1b from prepend_content.php -> Notification options (u) + * @var string $chkChbGr1c from prepend_content.php -> Notification options (c) + * @var string $chkChbGr1d from prepend_content.php -> Notification options (r) + * @var string $chkChbGr1e from prepend_content.php -> Notification options (f) + * @var string $chkChbGr1f from prepend_content.php -> Notification options (s) + * @var string $chkChbGr2a from prepend_content.php -> Initial state (o) + * @var string $chkChbGr2b from prepend_content.php -> Initial state (w) + * @var string $chkChbGr2c from prepend_content.php -> Initial state (u) + * @var string $chkChbGr2d from prepend_content.php -> Initial state (c) + * @var string $chkChbGr3a from prepend_content.php -> Flap detection options (o) + * @var string $chkChbGr3b from prepend_content.php -> Flap detection options (w) + * @var string $chkChbGr3c from prepend_content.php -> Flap detection options (u) + * @var string $chkChbGr3d from prepend_content.php -> Flap detection options (c) + * @var string $chkChbGr4a from prepend_content.php -> Stalking options (o) + * @var string $chkChbGr4b from prepend_content.php -> Stalking options (w) + * @var string $chkChbGr4c from prepend_content.php -> Stalking options (u) + * @var string $chkChbGr4d from prepend_content.php -> Stalking options (c) + * @var int $chkRadValue1 from prepend_content.php -> Hosts multiselect options + * @var int $chkRadValue2 from prepend_content.php -> Hosts groups multiselect options + * @var int $chkRadValue3 from prepend_content.php -> Service groups multiselect options + * @var int $chkRadValue4 from prepend_content.php -> Contacts multiselect options + * @var int $chkRadValue5 from prepend_content.php -> Contact groups multiselect options + * @var int $chkRadValue6 from prepend_content.php -> Active checks + * @var int $chkRadValue7 from prepend_content.php -> Passive checks + * @var int $chkRadValue8 from prepend_content.php -> Parallelize checks + * @var int $chkRadValue9 from prepend_content.php -> Freshness checks + * @var int $chkRadValue10 from prepend_content.php -> Obsess over service + * @var int $chkRadValue11 from prepend_content.php -> Event handler + * @var int $chkRadValue12 from prepend_content.php -> Flap detection + * @var int $chkRadValue13 from prepend_content.php -> Retain status information + * @var int $chkRadValue14 from prepend_content.php -> Retain non-status information + * @var int $chkRadValue15 from prepend_content.php -> Process performance data + * @var int $chkRadValue16 from prepend_content.php -> Is volatile + * @var int $chkRadValue17 from prepend_content.php -> Notifcation + * @var int $chkRadValue18 from prepend_content.php -> Parent services multiselect options + * @var string $chkTfNullVal1 from prepend_content.php -> Retry interval + * @var string $chkTfNullVal2 from prepend_content.php -> Max check attempts + * @var string $chkTfNullVal3 from prepend_content.php -> Check interval + * @var string $chkTfNullVal4 from prepend_content.php -> Freshness threshold + * @var string $chkTfNullVal5 from prepend_content.php -> Low flap threshold + * @var string $chkTfNullVal6 from prepend_content.php -> High flap threshold + * @var string $chkTfNullVal7 from prepend_content.php -> Notification interval + * @var string $chkTfNullVal8 from prepend_content.php -> First notification delay + * @var string $chkTfNullVal9 from prepend_content.php -> Importance + * @var int $intVariables from prepend_content.php -> Form uses variable definitions + * @var int $intTemplates from prepend_content.php -> Form uses template definitions + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 13; -$preContent = 'admin/servicetemplates.htm.tpl'; -$preListTpl = 'admin/datalist.htm.tpl'; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 13; +$preContent = 'admin/servicetemplates.htm.tpl'; +$preListTpl = 'admin/datalist.htm.tpl'; $preSearchSession = 'servicetemplate'; -$preTableName = 'tbl_servicetemplate'; -$preKeyField = 'template_name'; -$preAccess = 1; -$preFieldvars = 1; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Data processing -// =============== -$strNO = substr($chkChbGr1a.$chkChbGr1b.$chkChbGr1c.$chkChbGr1d.$chkChbGr1e.$chkChbGr1f, 0, -1); -$strIS = substr($chkChbGr2a.$chkChbGr2b.$chkChbGr2c.$chkChbGr2d, 0, -1); -$strFL = substr($chkChbGr3a.$chkChbGr3b.$chkChbGr3c.$chkChbGr3d, 0, -1); -$strST = substr($chkChbGr4a.$chkChbGr4b.$chkChbGr4c.$chkChbGr4d, 0, -1); -if ($chkSelValue1 != '') { +$preTableName = 'tbl_servicetemplate'; +$preKeyField = 'template_name'; +$preAccess = 1; +$preFieldvars = 1; +$strErrorMessage = ''; +$strInfoMessage = ''; +$strConsistMessage = ''; +$strDBWarning = ''; +$intDataWarning = 0; +$intRet1 = 0; +$intRet2 = 0; +$intRet3 = 0; +$intRet4 = 0; +$intRet5 = 0; +$intRet6 = 0; +$intNoTime = 0; +/* +Default values for form variables +*/ +if (!isset($intMselValue1)) { + $intMselValue1 = 0; +} +if (!isset($intMselValue2)) { + $intMselValue2 = 0; +} +if (!isset($intMselValue3)) { + $intMselValue3 = 0; +} +if (!isset($intMselValue4)) { + $intMselValue4 = 0; +} +if (!isset($intMselValue5)) { + $intMselValue5 = 0; +} +if (!isset($intMselValue6)) { + $intMselValue6 = 0; +} +/* +Include preprocessing files +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Data processing +*/ +$strNO = substr($chkChbGr1a . $chkChbGr1b . $chkChbGr1c . $chkChbGr1d . $chkChbGr1e . $chkChbGr1f, 0, -1); +$strIS = substr($chkChbGr2a . $chkChbGr2b . $chkChbGr2c . $chkChbGr2d, 0, -1); +$strFL = substr($chkChbGr3a . $chkChbGr3b . $chkChbGr3c . $chkChbGr3d, 0, -1); +$strST = substr($chkChbGr4a . $chkChbGr4b . $chkChbGr4c . $chkChbGr4d, 0, -1); +if ($chkSelValue1 !== 0) { for ($i = 1; $i <= 8; $i++) { - $tmpVar = 'chkTfArg'.$i; - if ($$tmpVar != '') { - $chkSelValue1 .= '!' .$$tmpVar; + $tmpVar = 'chkTfArg' . $i; + if ($$tmpVar !== '') { + $chkSelValue1 .= '!' . $$tmpVar; } } } -// -// Add or modify data -// ================== -if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAccess == 0)) { +/* +Add or modify data +*/ +if ((($chkModus === 'insert') || ($chkModus === 'modify')) && ($intGlobalWriteAccess === 0)) { $strSQLx = "`$preTableName` SET `$preKeyField`='$chkTfValue1', `host_name`=$intMselValue1, " - . "`host_name_tploptions`=$chkRadValue1, `hostgroup_name`=$intMselValue2, " - . "`hostgroup_name_tploptions`=$chkRadValue2, `service_description`='$chkTfValue2', " - . "`display_name`='$chkTfValue3', `parents`=$intMselValue6, `parents_tploptions`=$chkRadValue18, " - . "`importance`=$chkTfNullVal9, `servicegroups`=$intMselValue3, " - . "`servicegroups_tploptions`=$chkRadValue3, `check_command`='$chkSelValue1', " - . "`use_template`=$intTemplates, `is_volatile`=$chkRadValue16, `initial_state`='$strIS', " - . "`max_check_attempts`=$chkTfNullVal2, `check_interval`=$chkTfNullVal3, `retry_interval`=$chkTfNullVal1, " - . "`active_checks_enabled`=$chkRadValue6, `passive_checks_enabled`=$chkRadValue7, " - . "`check_period`=$chkSelValue2, `parallelize_check`=$chkRadValue8, `obsess_over_service`=$chkRadValue10, " - . "`check_freshness`=$chkRadValue9, `freshness_threshold`=$chkTfNullVal4, `event_handler`=$chkSelValue3, " - . "`event_handler_enabled`=$chkRadValue11, `low_flap_threshold`=$chkTfNullVal5, " - . "`high_flap_threshold`=$chkTfNullVal6, `flap_detection_enabled`=$chkRadValue12, " - . "`flap_detection_options`='$strFL', `process_perf_data`=$chkRadValue15, " - . "`retain_status_information`=$chkRadValue13, `retain_nonstatus_information`=$chkRadValue14, " - . "`contacts`=$intMselValue4, `contacts_tploptions`=$chkRadValue4, `contact_groups`=$intMselValue5, " - . "`contact_groups_tploptions`=$chkRadValue5, `notification_interval`=$chkTfNullVal7, " - . "`notification_period`=$chkSelValue4, `first_notification_delay`=$chkTfNullVal8, " - . "`notification_options`='$strNO', `notifications_enabled`=$chkRadValue17, `stalking_options`='$strST', " - . "`notes`='$chkTfValue4', `notes_url`='$chkTfValue5', `action_url`='$chkTfValue6', " - . "`icon_image`='$chkTfValue7', `icon_image_alt`='$chkTfValue8', `use_variables`=$intVariables, " - . $preSQLCommon2; - if ($chkModus == 'insert') { - $strSQL = 'INSERT INTO ' .$strSQLx; + . "`host_name_tploptions`=$chkRadValue1, `hostgroup_name`=$intMselValue2, " + . "`hostgroup_name_tploptions`=$chkRadValue2, `service_description`='$chkTfValue2', " + . "`display_name`='$chkTfValue3', `parents`=$intMselValue6, `parents_tploptions`=$chkRadValue18, " + . "`importance`=$chkTfNullVal9, `servicegroups`=$intMselValue3, " + . "`servicegroups_tploptions`=$chkRadValue3, `check_command`='$chkSelValue1', " + . "`use_template`=$intTemplates, `is_volatile`=$chkRadValue16, `initial_state`='$strIS', " + . "`max_check_attempts`=$chkTfNullVal2, `check_interval`=$chkTfNullVal3, `retry_interval`=$chkTfNullVal1, " + . "`active_checks_enabled`=$chkRadValue6, `passive_checks_enabled`=$chkRadValue7, " + . "`check_period`=$chkSelValue2, `parallelize_check`=$chkRadValue8, `obsess_over_service`=$chkRadValue10, " + . "`check_freshness`=$chkRadValue9, `freshness_threshold`=$chkTfNullVal4, `event_handler`=$chkSelValue3, " + . "`event_handler_enabled`=$chkRadValue11, `low_flap_threshold`=$chkTfNullVal5, " + . "`high_flap_threshold`=$chkTfNullVal6, `flap_detection_enabled`=$chkRadValue12, " + . "`flap_detection_options`='$strFL', `process_perf_data`=$chkRadValue15, " + . "`retain_status_information`=$chkRadValue13, `retain_nonstatus_information`=$chkRadValue14, " + . "`contacts`=$intMselValue4, `contacts_tploptions`=$chkRadValue4, `contact_groups`=$intMselValue5, " + . "`contact_groups_tploptions`=$chkRadValue5, `notification_interval`=$chkTfNullVal7, " + . "`notification_period`=$chkSelValue4, `first_notification_delay`=$chkTfNullVal8, " + . "`notification_options`='$strNO', `notifications_enabled`=$chkRadValue17, `stalking_options`='$strST', " + . "`notes`='$chkTfValue4', `notes_url`='$chkTfValue5', `action_url`='$chkTfValue6', " + . "`icon_image`='$chkTfValue7', `icon_image_alt`='$chkTfValue8', `use_variables`=$intVariables, " + . $preSQLCommon2; + if ($chkModus === 'insert') { + $strSQL = 'INSERT INTO ' . $strSQLx; } else { - $strSQL = 'UPDATE ' .$strSQLx. ' WHERE `id`=' .$chkDataId; + $strSQL = 'UPDATE ' . $strSQLx . ' WHERE `id`=' . $chkDataId; } - if ($intWriteAccessId == 0) { - if ($chkTfValue1 != '') { + if ($intWriteAccessId === 0) { + if ($chkTfValue1 !== '') { $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($chkModus == 'insert') { + if ($chkModus === 'insert') { $chkDataId = $intInsertId; } - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); $myDataClass->updateStatusTable($preTableName); - if ($chkModus == 'insert') { - $myDataClass->writeLog(translate('New service template inserted:'). ' ' .$chkTfValue1); + if ($chkModus === 'insert') { + $myDataClass->writeLog(translate('New service template inserted:') . ' ' . $chkTfValue1); } - if ($chkModus == 'modify') { - $myDataClass->writeLog(translate('Service template modified:'). ' ' .$chkTfValue1); + if ($chkModus === 'modify') { + $myDataClass->writeLog(translate('Service template modified:') . ' ' . $chkTfValue1); } - // - // Insert/update relations - // ======================= - if ($chkModus == 'insert') { - if ($intMselValue1 != 0) { + /* + Insert/update relations + */ + if ($chkModus === 'insert') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataInsertRelation( 'tbl_lnkServicetemplateToHost', $chkDataId, $chkMselValue1 ); } - if (isset($intRet1) && ($intRet1 != 0)) { + if (isset($intRet1) && ($intRet1 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataInsertRelation( 'tbl_lnkServicetemplateToHostgroup', $chkDataId, $chkMselValue2 ); } - if (isset($intRet2) && ($intRet3 != 0)) { + if (isset($intRet2) && ($intRet3 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue3 != 0) { + if ($intMselValue3 !== 0) { $intRet3 = $myDataClass->dataInsertRelation( 'tbl_lnkServicetemplateToServicegroup', $chkDataId, $chkMselValue3 ); } - if (isset($intRet3) && ($intRet3 != 0)) { + if (isset($intRet3) && ($intRet3 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue4 != 0) { + if ($intMselValue4 !== 0) { $intRet4 = $myDataClass->dataInsertRelation( 'tbl_lnkServicetemplateToContact', $chkDataId, $chkMselValue4 ); } - if (isset($intRet4) && ($intRet4 != 0)) { + if (isset($intRet4) && ($intRet4 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue5 != 0) { + if ($intMselValue5 !== 0) { $intRet5 = $myDataClass->dataInsertRelation( 'tbl_lnkServicetemplateToContactgroup', $chkDataId, $chkMselValue5 ); } - if (isset($intRet5) && ($intRet5 != 0)) { + if (isset($intRet5) && ($intRet5 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue6 != 0) { + if ($intMselValue6 !== 0) { $intRet6 = $myDataClass->dataInsertRelation( 'tbl_lnkServicetemplateToService', $chkDataId, $chkMselValue6 ); } - if (isset($intRet6) && ($intRet6 != 0)) { + if (isset($intRet6) && ($intRet6 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - } elseif ($chkModus == 'modify') { - if ($intMselValue1 != 0) { + } elseif ($chkModus === 'modify') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataUpdateRelation( 'tbl_lnkServicetemplateToHost', $chkDataId, @@ -173,10 +305,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet1 = $myDataClass->dataDeleteRelation('tbl_lnkServicetemplateToHost', $chkDataId); } - if ($intRet1 != 0) { + if ($intRet1 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataUpdateRelation( 'tbl_lnkServicetemplateToHostgroup', $chkDataId, @@ -185,10 +317,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet2 = $myDataClass->dataDeleteRelation('tbl_lnkServicetemplateToHostgroup', $chkDataId); } - if ($intRet2 != 0) { + if ($intRet2 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue3 != 0) { + if ($intMselValue3 !== 0) { $intRet3 = $myDataClass->dataUpdateRelation( 'tbl_lnkServicetemplateToServicegroup', $chkDataId, @@ -197,10 +329,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet3 = $myDataClass->dataDeleteRelation('tbl_lnkServicetemplateToServicegroup', $chkDataId); } - if ($intRet3 != 0) { + if ($intRet3 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue4 != 0) { + if ($intMselValue4 !== 0) { $intRet4 = $myDataClass->dataUpdateRelation( 'tbl_lnkServicetemplateToContact', $chkDataId, @@ -209,10 +341,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet4 = $myDataClass->dataDeleteRelation('tbl_lnkServicetemplateToContact', $chkDataId); } - if ($intRet4 != 0) { + if ($intRet4 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue5 != 0) { + if ($intMselValue5 !== 0) { $intRet5 = $myDataClass->dataUpdateRelation( 'tbl_lnkServicetemplateToContactgroup', $chkDataId, @@ -221,10 +353,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet5 = $myDataClass->dataDeleteRelation('tbl_lnkServicetemplateToContactgroup', $chkDataId); } - if ($intRet5 != 0) { + if ($intRet5 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue6 != 0) { + if ($intMselValue6 !== 0) { $intRet1 = $myDataClass->dataUpdateRelation( 'tbl_lnkServicetemplateToService', $chkDataId, @@ -233,80 +365,79 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet6 = $myDataClass->dataDeleteRelation('tbl_lnkServicetemplateToService', $chkDataId); } - if ($intRet6 != 0) { + if ($intRet6 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } - if (($intRet1 + $intRet2 + $intRet3 + $intRet4 + $intRet5 + $intRet6) != 0) { + if (($intRet1 + $intRet2 + $intRet3 + $intRet4 + $intRet5 + $intRet6) !== 0) { $strInfoMessage = ''; } - // - // Insert/update session data for templates - // ======================================== - if ($chkModus == 'modify') { - $strSQL = 'DELETE FROM `tbl_lnkServicetemplateToServicetemplate` WHERE `idMaster`=' .$chkDataId; + /* + Insert/update session data for templates + */ + if ($chkModus === 'modify') { + $strSQL = 'DELETE FROM `tbl_lnkServicetemplateToServicetemplate` WHERE `idMaster`=' . $chkDataId; $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } if (isset($_SESSION['templatedefinition']) && is_array($_SESSION['templatedefinition']) && - (count($_SESSION['templatedefinition']) != 0)) { + (count($_SESSION['templatedefinition']) !== 0)) { $intSortId = 1; - /** @noinspection ForeachSourceInspection */ foreach ($_SESSION['templatedefinition'] as $elem) { - if ($elem['status'] == 0) { - $strSQL = 'INSERT INTO `tbl_lnkServicetemplateToServicetemplate` (`idMaster`,`idSlave`,' - . "`idTable`,`idSort`) VALUES ($chkDataId,".$elem['idSlave']. ', ' - . $elem['idTable']. ',' .$intSortId. ')'; + if ((int)$elem['status'] === 0) { + $strSQL = 'INSERT INTO `tbl_lnkServicetemplateToServicetemplate` (`idMaster`,`idSlave`,' + . "`idTable`,`idSort`) VALUES ($chkDataId," . $elem['idSlave'] . ', ' + . $elem['idTable'] . ',' . $intSortId . ')'; $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } $intSortId++; } } - // - // Insert/update session data for free variables - // ============================================= - if ($chkModus == 'modify') { - $strSQL = 'SELECT * FROM `tbl_lnkServicetemplateToVariabledefinition` ' - . 'WHERE `idMaster`=' .$chkDataId; + /* + Insert/update session data for free variables + */ + if ($chkModus === 'modify') { + $strSQL = 'SELECT * FROM `tbl_lnkServicetemplateToVariabledefinition` ' + . 'WHERE `idMaster`=' . $chkDataId; $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($intDataCount != 0) { + if ($intDataCount !== 0) { foreach ($arrData as $elem) { - $strSQL = 'DELETE FROM `tbl_variabledefinition` WHERE `id`=' .$elem['idSlave']; - $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn != 0) { + $strSQL = 'DELETE FROM `tbl_variabledefinition` WHERE `id`=' . $elem['idSlave']; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } } - $strSQL = 'DELETE FROM `tbl_lnkServicetemplateToVariabledefinition` ' - . 'WHERE `idMaster`=' .$chkDataId; + $strSQL = 'DELETE FROM `tbl_lnkServicetemplateToVariabledefinition` ' + . 'WHERE `idMaster`=' . $chkDataId; $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn != 0) { + if ($intReturn !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } if (isset($_SESSION['variabledefinition']) && is_array($_SESSION['variabledefinition']) && - (count($_SESSION['variabledefinition']) != 0)) { + (count($_SESSION['variabledefinition']) !== 0)) { foreach ($_SESSION['variabledefinition'] as $elem) { - if ($elem['status'] == 0) { - $strSQL1 = 'INSERT INTO `tbl_variabledefinition` (`name`,`value`,`last_modified`) ' - . "VALUES ('".$elem['definition']."','".$elem['range']."',now())"; + if ((int)$elem['status'] === 0) { + $strSQL1 = 'INSERT INTO `tbl_variabledefinition` (`name`,`value`,`last_modified`) ' + . "VALUES ('" . $elem['definition'] . "','" . $elem['range'] . "',now())"; $intReturn1 = $myDataClass->dataInsert($strSQL1, $intInsertId); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - $strSQL2 = 'INSERT INTO `tbl_lnkServicetemplateToVariabledefinition` (`idMaster`, ' - . "`idSlave`) VALUES ($chkDataId,$intInsertId)"; + $strSQL2 = 'INSERT INTO `tbl_lnkServicetemplateToVariabledefinition` (`idMaster`, ' + . "`idSlave`) VALUES ($chkDataId,$intInsertId)"; $intReturn2 = $myDataClass->dataInsert($strSQL2, $intInsertId); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } @@ -324,76 +455,75 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } $chkModus = 'display'; } -if ($chkModus != 'add') { - $chkModus = 'display'; +if ($chkModus !== 'add') { + $chkModus = 'display'; } -// -// Get date/time of last database and config file manipulation -// =========================================================== +/* +Get date/time of last database and config file manipulation +*/ $intReturn = $myConfigClass->lastModifiedFile($preTableName, $arrTimeData, $strTimeInfoString); -if ($intReturn != 0) { +if ($intReturn !== 0) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } -// -// Singe data form -// =============== -if ($chkModus == 'add') { +/* +Singe data form +*/ +if ($chkModus === 'add') { $conttp->setVariable('TITLE', translate('Define service templates (servicetemplates.cfg)')); - // Do not show modified time list + /* Do not show modified time list */ $intNoTime = 1; - // Process template fields + /* Process template fields */ $strWhere = ''; - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - $strWhere = 'AND `id` <> ' .$arrModifyData['id']; + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + $strWhere = 'AND `id` <> ' . $arrModifyData['id']; } - $strSQL1 = "SELECT `id`, `$preKeyField`, `active` FROM `$preTableName` " - . "WHERE $strDomainWhere $strWhere ORDER BY `$preKeyField`"; + /** @noinspection SqlResolve */ + $strSQL1 = "SELECT `id`, `$preKeyField`, `active` FROM `$preTableName` " + . "WHERE $strDomainWhere $strWhere ORDER BY `$preKeyField`"; $booReturn1 = $myDBClass->hasDataArray($strSQL1, $arrDataTpl, $intDataCountTpl); - if ($booReturn1 == false) { + if ($booReturn1 === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($intDataCountTpl != 0) { + if ($intDataCountTpl !== 0) { /** @var array $arrDataTpl */ foreach ($arrDataTpl as $elem) { - if ($elem['active'] == 0) { + if ($elem['active'] === 0) { $strActive = ' [inactive]'; $conttp->setVariable('SPECIAL_STYLE', 'inactive_option'); } else { $strActive = ''; - $conttp->setVariable('SPECIAL_STYLE', ''); + $conttp->setVariable('SPECIAL_STYLE'); } - $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem[$preKeyField], ENT_QUOTES, 'UTF-8').$strActive); - $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id']. '::1'); + $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem[$preKeyField], ENT_QUOTES, 'UTF-8') . $strActive); + $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id'] . '::1'); + /** @noinspection DisconnectedForeachInstructionInspection */ $conttp->parse('template'); } } - $strSQL2 = 'SELECT `id`, `name`, `active` FROM `tbl_service` ' - . "WHERE `name` <> '' AND $strDomainWhere2 ORDER BY `name`"; + $strSQL2 = 'SELECT `id`, `name`, `active` FROM `tbl_service` ' + . "WHERE `name` <> '' AND $strDomainWhere2 ORDER BY `name`"; $booReturn2 = $myDBClass->hasDataArray($strSQL2, $arrDataHpl, $intDataCountHpl); - if ($booReturn2 == false) { + if ($booReturn2 === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($intDataCountHpl != 0) { + if ($intDataCountHpl !== 0) { /** @var array $arrDataHpl */ foreach ($arrDataHpl as $elem) { - if ($elem['active'] == 0) { + if ($elem['active'] === 0) { $strActive = ' [inactive]'; $conttp->setVariable('SPECIAL_STYLE', 'inactive_option'); } else { $strActive = ''; - $conttp->setVariable('SPECIAL_STYLE', ''); + $conttp->setVariable('SPECIAL_STYLE'); } - $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem['name'], ENT_QUOTES, 'UTF-8').$strActive); - $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id']. '::2'); + $conttp->setVariable('DAT_TEMPLATE', htmlspecialchars($elem['name'], ENT_QUOTES, 'UTF-8') . $strActive); + $conttp->setVariable('DAT_TEMPLATE_ID', $elem['id'] . '::2'); + /** @noinspection DisconnectedForeachInstructionInspection */ $conttp->parse('template'); } } - // Process host selection field - if (isset($arrModifyData['host_name'])) { - $intFieldId = $arrModifyData['host_name']; - } else { - $intFieldId = 0; - } + /* Process host selection field */ + $intFieldId = $arrModifyData['host_name'] ?? 0; $intReturn1 = $myVisClass->parseSelectMulti( 'tbl_host', 'host_name', @@ -402,14 +532,10 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['hostgroup_name'])) { - $intFieldId = $arrModifyData['hostgroup_name']; - } else { - $intFieldId = 0; - } + $intFieldId = $arrModifyData['hostgroup_name'] ?? 0; $intReturn2 = $myVisClass->parseSelectMulti( 'tbl_hostgroup', 'hostgroup_name', @@ -418,20 +544,12 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process service selection field - if (isset($arrModifyData['parents'])) { - $intFieldId = $arrModifyData['parents']; - } else { - $intFieldId = 0; - } - if (isset($arrModifyData['id'])) { - $intKeyId = $arrModifyData['id']; - } else { - $intKeyId = 0; - } + /* Process service selection field */ + $intFieldId = $arrModifyData['parents'] ?? 0; + $intKeyId = $arrModifyData['id'] ?? 0; $intReturn3 = $myVisClass->parseSelectMulti( $preTableName, $preKeyField, @@ -441,15 +559,11 @@ if ($chkModus == 'add') { $intFieldId, $intKeyId ); - if ($intReturn3 != 0) { + if ($intReturn3 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process service groups selection field - if (isset($arrModifyData['servicegroups'])) { - $intFieldId = $arrModifyData['servicegroups']; - } else { - $intFieldId = 0; - } + /* Process service groups selection field */ + $intFieldId = $arrModifyData['servicegroups'] ?? 0; $intReturn3 = $myVisClass->parseSelectMulti( 'tbl_servicegroup', 'servicegroup_name', @@ -458,55 +572,39 @@ if ($chkModus == 'add') { 0, $intFieldId ); - if ($intReturn3 != 0) { + if ($intReturn3 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process check command selection field - if (isset($arrModifyData['check_command']) && ($arrModifyData['check_command'] != '')) { + /* Process check command selection field */ + if (isset($arrModifyData['check_command']) && ($arrModifyData['check_command'] !== '')) { $arrCommand = explode('!', $arrModifyData['check_command']); $intFieldId = $arrCommand[0]; } else { $intFieldId = 0; } $intReturn4 = $myVisClass->parseSelectSimple('tbl_command', 'command_name', 'servicecommand', 2, $intFieldId); - if ($intReturn4 != 0) { + if ($intReturn4 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process check period selection field - if (isset($arrModifyData['check_period'])) { - $intFieldId = $arrModifyData['check_period']; - } else { - $intFieldId = 0; - } + /* Process check period selection field */ + $intFieldId = $arrModifyData['check_period'] ?? 0; $intReturn5 = $myVisClass->parseSelectSimple('tbl_timeperiod', 'timeperiod_name', 'checkperiod', 1, $intFieldId); - if ($intReturn5 != 0) { + if ($intReturn5 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['notification_period'])) { - $intFieldId = $arrModifyData['notification_period']; - } else { - $intFieldId = 0; - } + $intFieldId = $arrModifyData['notification_period'] ?? 0; $intReturn6 = $myVisClass->parseSelectSimple('tbl_timeperiod', 'timeperiod_name', 'notifyperiod', 1, $intFieldId); - if ($intReturn6 != 0) { + if ($intReturn6 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process event handler selection field - if (isset($arrModifyData['event_handler'])) { - $intFieldId = $arrModifyData['event_handler']; - } else { - $intFieldId = 0; - } + /* Process event handler selection field */ + $intFieldId = $arrModifyData['event_handler'] ?? 0; $intReturn7 = $myVisClass->parseSelectSimple('tbl_command', 'command_name', 'eventhandler', 1, $intFieldId); - if ($intReturn7 != 0) { + if ($intReturn7 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process contact and contact group selection field - if (isset($arrModifyData['contacts'])) { - $intFieldId = $arrModifyData['contacts']; - } else { - $intFieldId = 0; - } + /* Process contact and contact group selection field */ + $intFieldId = $arrModifyData['contacts'] ?? 0; $intReturn8 = $myVisClass->parseSelectMulti( 'tbl_contact', 'contact_name', @@ -515,14 +613,10 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn8 != 0) { + if ($intReturn8 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - if (isset($arrModifyData['contact_groups'])) { - $intFieldId = $arrModifyData['contact_groups']; - } else { - $intFieldId = 0; - } + $intFieldId = $arrModifyData['contact_groups'] ?? 0; $intReturn9 = $myVisClass->parseSelectMulti( 'tbl_contactgroup', 'contactgroup_name', @@ -531,114 +625,125 @@ if ($chkModus == 'add') { 2, $intFieldId ); - if ($intReturn9 != 0) { + if ($intReturn9 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process access group selection field - if (isset($arrModifyData['access_group'])) { - $intFieldId = $arrModifyData['access_group']; - } else { - $intFieldId = 0; - } + /* Process access group selection field */ + $intFieldId = $arrModifyData['access_group'] ?? 0; $intReturn10 = $myVisClass->parseSelectSimple('tbl_group', 'groupname', 'acc_group', 0, $intFieldId); - if ($intReturn10 != 0) { + if ($intReturn10 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Initial add/modify form definitions - $strChbFields = 'ACE,PCE,PAC,FRE,OBS,EVH,FLE,STI,NSI,PED,ISV,NOE,HOS,HOG,SEG,COT,COG,TPL'; + /* Initial add/modify form definitions */ + $strChbFields = 'ACE,PCE,PAC,FRE,OBS,EVH,FLE,STI,NSI,PED,ISV,NOE,HOS,HOG,SEG,COT,COG,TPL,PAS'; $myContentClass->addFormInit($conttp, $strChbFields); - if ($intDataWarning == 1) { - $conttp->setVariable('WARNING', $strDBWarning. '
' .translate('Saving not possible!')); + if ($intDataWarning === 1) { + $conttp->setVariable('WARNING', $strDBWarning . '
' . translate('Saving not possible!')); } - // Insert data from database in "modify" mode - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - // Check relation information to find out locked configuration datasets + /* Insert data from database in "modify" mode */ + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + /* Check relation information to find out locked configuration datasets */ $intLocked = $myDataClass->infoRelation($preTableName, $arrModifyData['id'], $preKeyField); $myVisClass->processMessage($myDataClass->strInfoMessage, $strRelMessage); - $strInfo = '
' .translate('Entry cannot be activated because it is used by ' - . 'another configuration'). ':'; - $strInfo .= '
' .$strRelMessage. ''; - // Process data + $strInfo = '
' . translate('Entry cannot be activated because it is used by ' + . 'another configuration') . ':'; + $strInfo .= '
' . $strRelMessage . ''; + /* Process data */ $myContentClass->addInsertData($conttp, $arrModifyData, $intLocked, $strInfo, $strChbFields); - $conttp->setVariable('DAT_ACE' .$arrModifyData['active_checks_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_PCE' .$arrModifyData['passive_checks_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_PAC' .$arrModifyData['parallelize_check']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_FRE' .$arrModifyData['check_freshness']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_OBS' .$arrModifyData['obsess_over_service']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_EVH' .$arrModifyData['event_handler_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_FLE' .$arrModifyData['flap_detection_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_STI' .$arrModifyData['retain_status_information']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_NSI' .$arrModifyData['retain_nonstatus_information']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_PED' .$arrModifyData['process_perf_data']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_ISV' .$arrModifyData['is_volatile']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_NOE' .$arrModifyData['notifications_enabled']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_HOS' .$arrModifyData['host_name_tploptions']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_HOG' .$arrModifyData['hostgroup_name_tploptions']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_SEG' .$arrModifyData['servicegroups_tploptions']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_COT' .$arrModifyData['contacts_tploptions']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_COG' .$arrModifyData['contact_groups_tploptions']. '_CHECKED', 'checked'); - $conttp->setVariable('DAT_TPL' .$arrModifyData['use_template_tploptions']. '_CHECKED', 'checked'); - // Special processing for -1 values - write 'null' to integer fields - $strIntegerfelder = 'max_check_attempts,check_interval,retry_interval,freshness_threshold,low_flap_threshold,'; + $conttp->setVariable('DAT_ACE' . $arrModifyData['active_checks_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_PCE' . $arrModifyData['passive_checks_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_PAC' . $arrModifyData['parallelize_check'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_FRE' . $arrModifyData['check_freshness'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_OBS' . $arrModifyData['obsess_over_service'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_EVH' . $arrModifyData['event_handler_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_FLE' . $arrModifyData['flap_detection_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_STI' . $arrModifyData['retain_status_information'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_NSI' . $arrModifyData['retain_nonstatus_information'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_PED' . $arrModifyData['process_perf_data'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_ISV' . $arrModifyData['is_volatile'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_NOE' . $arrModifyData['notifications_enabled'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_HOS' . $arrModifyData['host_name_tploptions'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_HOG' . $arrModifyData['hostgroup_name_tploptions'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_SEG' . $arrModifyData['servicegroups_tploptions'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_COT' . $arrModifyData['contacts_tploptions'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_COG' . $arrModifyData['contact_groups_tploptions'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_TPL' . $arrModifyData['use_template_tploptions'] . '_CHECKED', 'checked'); + $conttp->setVariable('DAT_PAS' . $arrModifyData['parents_tploptions'] . '_CHECKED', 'checked'); + /* Special processing for -1 values - write 'null' to integer fields */ + $strIntegerfelder = 'max_check_attempts,check_interval,retry_interval,freshness_threshold,low_flap_threshold,'; $strIntegerfelder .= 'high_flap_threshold,notification_interval,first_notification_delay'; foreach (explode(',', $strIntegerfelder) as $elem) { - if ($arrModifyData[$elem] == -1) { - $conttp->setVariable('DAT_' .strtoupper($elem), 'null'); + if ((int)$arrModifyData[$elem] === -1) { + $conttp->setVariable('DAT_' . strtoupper($elem), 'null'); } } - if ($arrModifyData['check_command'] != '') { + if ($arrModifyData['check_command'] !== '') { $arrArgument = explode('!', $arrModifyData['check_command']); foreach ($arrArgument as $key => $value) { - if ($key == 0) { - $conttp->setVariable('IFRAME_SRC', $_SESSION['SETS']['path']['base_url']. - 'admin/commandline.php?cname=' .$value); + if ($key === 0) { + $conttp->setVariable('IFRAME_SRC', $_SESSION['SETS']['path']['base_url'] . + 'admin/commandline.php?cname=' . $value); } else { - $conttp->setVariable('DAT_ARG' .$key, htmlentities($value, ENT_QUOTES, 'UTF-8')); + $conttp->setVariable('DAT_ARG' . $key, htmlentities($value, ENT_QUOTES, 'UTF-8')); } } } - // Process option fields + /* Process option fields */ foreach (explode(',', $arrModifyData['initial_state']) as $elem) { - $conttp->setVariable('DAT_IS' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_IS' . strtoupper($elem) . '_CHECKED', 'checked'); } foreach (explode(',', $arrModifyData['flap_detection_options']) as $elem) { - $conttp->setVariable('DAT_FL' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_FL' . strtoupper($elem) . '_CHECKED', 'checked'); } foreach (explode(',', $arrModifyData['notification_options']) as $elem) { - $conttp->setVariable('DAT_NO' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_NO' . strtoupper($elem) . '_CHECKED', 'checked'); } foreach (explode(',', $arrModifyData['stalking_options']) as $elem) { - $conttp->setVariable('DAT_ST' .strtoupper($elem). '_CHECKED', 'checked'); + $conttp->setVariable('DAT_ST' . strtoupper($elem) . '_CHECKED', 'checked'); } } $conttp->parse('datainsert'); $conttp->show('datainsert'); } -// -// List view -// ========== -if ($chkModus == 'display') { - // Initial list view definitions +/* +List view +*/ +if ($chkModus === 'display') { + /* Initial list view definitions */ $myContentClass->listViewInit($mastertp); $mastertp->setVariable('TITLE', translate('Define service templates (servicetemplates.cfg)')); $mastertp->setVariable('FIELD_1', translate('Template name')); $mastertp->setVariable('FIELD_2', translate('Service description')); - // Process filter string - if ($_SESSION['search'][$preSearchSession] != '') { - $strSearchTxt = $_SESSION['search'][$preSearchSession]; - $strSearchWhere = "AND (`$preKeyField` LIKE '%".$strSearchTxt."%' OR `service_description` " - . "LIKE '%".$strSearchTxt."%' OR `display_name` LIKE '%".$strSearchTxt."%')"; + $mastertp->setVariable('FILTER_REG_VISIBLE', 'visibility: hidden'); + /* Process filter string */ + $strSearchWhere = ''; + if ($_SESSION['search'][$preSearchSession] !== '') { + $strSearchTxt = $_SESSION['search'][$preSearchSession]; + $strSearchWhere = "AND (`$preKeyField` LIKE '%" . $strSearchTxt . "%' OR `service_description` " + . "LIKE '%" . $strSearchTxt . "%' OR `display_name` LIKE '%" . $strSearchTxt . "%') "; } - // Row sorting + if ($_SESSION['filter'][$preSearchSession]['active'] !== '') { + $intActivated = (int)$_SESSION['filter'][$preSearchSession]['active']; + if ($intActivated === 1) { + $strSearchWhere .= "AND `active` = '1' "; + } + if ($intActivated === 2) { + $strSearchWhere .= "AND `active` = '0' "; + } + $mastertp->setVariable('SEL_ACTIVEFILTER_' . $intActivated . '_SELECTED', 'selected'); + } + /* Row sorting */ $strOrderString = "ORDER BY `config_id`, `$preKeyField` $hidSortDir"; - if ($hidSortBy == 2) { + if ($hidSortBy === 2) { $strOrderString = "ORDER BY `config_id`, `service_description` $hidSortDir"; } - // Count datasets - $strSQL1 = "SELECT count(*) AS `number` FROM `$preTableName` " - . "WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess)"; + /* Count datasets */ + $intLineCount = 0; + /** @noinspection SqlResolve */ + $strSQL1 = "SELECT count(*) AS `number` FROM `$preTableName` " + . "WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess)"; $booReturn1 = $myDBClass->hasSingleDataset($strSQL1, $arrDataLinesCount); - if ($booReturn1 == false) { + if ($booReturn1 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { @@ -647,27 +752,26 @@ if ($chkModus == 'display') { $chkLimit = 0; } } - // Get datasets - $strSQL2 = "SELECT `id`, `$preKeyField`, `service_description`, `register`, `active`, `last_modified`, " - . "`config_id`, `access_group` FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere " - . "AND `access_group` IN ($strAccess) $strOrderString LIMIT $chkLimit,".$SETS['common']['pagelines']; + /* Get datasets */ + $strSQL2 = "SELECT `id`, `$preKeyField`, `service_description`, `register`, `active`, `last_modified`, " + . "`config_id`, `access_group` FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere " + . "AND `access_group` IN ($strAccess) $strOrderString LIMIT $chkLimit," . $SETS['common']['pagelines']; $booReturn2 = $myDBClass->hasDataArray($strSQL2, $arrDataLines, $intDataCount); - if ($booReturn2 == false) { + if ($booReturn2 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - // Process data + /* Process data */ $myContentClass->listData( $mastertp, $arrDataLines, $intDataCount, $intLineCount, $preKeyField, - 'service_description', - 0 + 'service_description' ); } -// Show messages +/* Show messages */ $myContentClass->showMessages( $mastertp, $strErrorMessage, @@ -677,7 +781,7 @@ $myContentClass->showMessages( $strTimeInfoString, $intNoTime ); -// -// Process footer -// ============== -$myContentClass->showFooter($maintp, $setFileVersion); +/* +Process footer +*/ +$myContentClass->showFooter($maintp, $setFileVersion); \ No newline at end of file diff --git a/admin/settings.php b/admin/settings.php index 2166921..0b48f30 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -1,137 +1,173 @@ Application version string + * @var string $prePageKey from prepend_adm.php -> Menu group id + * @var array $SETS Settings array + * @var string $chkTfValue1 from prepend_content.php -> Temporary directory + * @var string $chkTfValue2 from prepend_content.php -> Encoding + * @var string $chkTfValue3 from prepend_content.php -> Database server + * @var string $chkTfValue4 from prepend_content.php -> Database server port + * @var string $chkTfValue5 from prepend_content.php -> Database server db name + * @var string $chkTfValue6 from prepend_content.php -> Database server user + * @var string $chkTfValue7 from prepend_content.php -> Database server password + * @var string $chkTfValue8 from prepend_content.php -> Logoff time + * @var string $chkTfValue9 from prepend_content.php -> Data lines per page + * @var string $chkTfValue10 from prepend_content.php -> Proxy server + * @var string $chkTfValue11 from prepend_content.php -> Proxy user + * @var string $chkTfValue12 from prepend_content.php -> Proxy password + * @var int $chkSelValue1 from prepend_content.php -> Server protocol + * @var int $chkSelValue2 from prepend_content.php -> Standard language + * @var int $chkSelValue3 from prepend_content.php -> Webserver authentication + * @var int $chkSelValue4 from prepend_content.php -> Multiselect method + * @var int $chkRadValue1 from prepend_content.php -> Template warnings + * @var int $chkRadValue2 from prepend_content.php -> Update check + * @var int $chkRadValue3 from prepend_content.php -> Enable proxy server + * @var int $chkRadValue4 from prepend_content.php -> Show dependencies + * @var array $arrDescription from fieldvars.php -> Translated common strings + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 38; -$preContent = 'admin/settings.htm.tpl'; -$preAccess = 1; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 38; +$preContent = 'admin/settings.htm.tpl'; +$preAccess = 1; $preFieldvars = 1; -$arrSQL = array(); -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Process initial values -// ====================== -if (filter_input(INPUT_POST, 'tfValue1') == null) { - $chkTfValue1 = $SETS['path']['tempdir']; +$arrSQL = array(); +$strErrorMessage = ''; +$strInfoMessage = ''; +/* +Include preprocessing file +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Process initial values +*/ +if (filter_input(INPUT_POST, 'tfValue1') === null) { + $chkTfValue1 = $SETS['path']['tempdir']; } -if (filter_input(INPUT_POST, 'tfValue2') == null) { - $chkTfValue2 = $SETS['data']['encoding']; +if (filter_input(INPUT_POST, 'tfValue2') === null) { + $chkTfValue2 = $SETS['data']['encoding']; } -if (filter_input(INPUT_POST, 'tfValue3') == null) { - $chkTfValue3 = $SETS['db']['server']; +if (filter_input(INPUT_POST, 'tfValue3') === null) { + $chkTfValue3 = $SETS['db']['server']; } -if (filter_input(INPUT_POST, 'tfValue4') == null) { - $chkTfValue4 = $SETS['db']['port']; +if (filter_input(INPUT_POST, 'tfValue4') === null) { + $chkTfValue4 = $SETS['db']['port']; } -if (filter_input(INPUT_POST, 'tfValue5') == null) { - $chkTfValue5 = $SETS['db']['database']; +if (filter_input(INPUT_POST, 'tfValue5') === null) { + $chkTfValue5 = $SETS['db']['database']; } -if (filter_input(INPUT_POST, 'tfValue6') == null) { - $chkTfValue6 = $SETS['db']['username']; +if (filter_input(INPUT_POST, 'tfValue6') === null) { + $chkTfValue6 = $SETS['db']['username']; } -if (filter_input(INPUT_POST, 'tfValue7') == null) { - $chkTfValue7 = $SETS['db']['password']; +if (filter_input(INPUT_POST, 'tfValue7') === null) { + $chkTfValue7 = $SETS['db']['password']; } -if (filter_input(INPUT_POST, 'tfValue8') == null) { - $chkTfValue8 = $SETS['security']['logofftime']; +if (filter_input(INPUT_POST, 'tfValue8') === null) { + $chkTfValue8 = $SETS['security']['logofftime']; } -if (filter_input(INPUT_POST, 'tfValue9') == null) { - $chkTfValue9 = $SETS['common']['pagelines']; +if (filter_input(INPUT_POST, 'tfValue9') === null) { + $chkTfValue9 = $SETS['common']['pagelines']; } -if (filter_input(INPUT_POST, 'tfValue10') == null) { +if (filter_input(INPUT_POST, 'tfValue10') === null) { $chkTfValue10 = $SETS['network']['proxyserver']; } -if (filter_input(INPUT_POST, 'tfValue11') == null) { +if (filter_input(INPUT_POST, 'tfValue11') === null) { $chkTfValue11 = $SETS['network']['proxyuser']; } -if (filter_input(INPUT_POST, 'tfValue12') == null) { +if (filter_input(INPUT_POST, 'tfValue12') === null) { $chkTfValue12 = $SETS['network']['proxypasswd']; } -if (filter_input(INPUT_POST, 'selValue3') == null) { - $chkSelValue3 = $SETS['security']['wsauth']; +if (filter_input(INPUT_POST, 'selValue3') === null) { + $chkSelValue3 = (int)$SETS['security']['wsauth']; } -if (filter_input(INPUT_POST, 'selValue4') == null) { - $chkSelValue4 = $SETS['common']['seldisable']; +if (filter_input(INPUT_POST, 'selValue4') === null) { + $chkSelValue4 = (int)$SETS['common']['seldisable']; } -if (filter_input(INPUT_POST, 'radValue1') == null) { - $chkRadValue1 = $SETS['common']['tplcheck']; +if (filter_input(INPUT_POST, 'radValue1') === null) { + $chkRadValue1 = (int)$SETS['common']['tplcheck']; } -if (filter_input(INPUT_POST, 'radValue2') == null) { - $chkRadValue2 = $SETS['common']['updcheck']; +if (filter_input(INPUT_POST, 'radValue2') === null) { + $chkRadValue2 = (int)$SETS['common']['updcheck']; } -if (filter_input(INPUT_POST, 'radValue3') == null) { - $chkRadValue3 = $SETS['network']['proxy']; +if (filter_input(INPUT_POST, 'radValue3') === null) { + $chkRadValue3 = (int)$SETS['network']['proxy']; } - -// -// Save changes -// ============ +if (filter_input(INPUT_POST, 'radValue4') === null) { + $chkRadValue4 = (int)$SETS['performance']['parents']; +} +/* +Save changes +*/ if (filter_input(INPUT_POST, 'selValue1')) { - // - // Write settings to database - // ========================== - if ($chkSelValue1 == 2) { + /* + Write settings to database + */ + if ($chkSelValue1 === 2) { $strProtocol = 'https'; } else { $strProtocol = 'http'; } - $strLocale = $myDBClass->getFieldData("SELECT `locale` FROM `tbl_language` WHERE `id`='".$chkSelValue2."'"); - if ($strLocale == '') { + $strLocale = $myDBClass->getFieldData("SELECT `locale` FROM `tbl_language` WHERE `id`='" . $chkSelValue2 . "'"); + if ($strLocale === '') { $strLocale = 'en_GB'; } $SETS['path']['protocol'] = $strProtocol; - $SETS['data']['locale'] = $strLocale; - // Check Proxy via curl + $SETS['data']['locale'] = $strLocale; + /* Check Proxy via curl */ if (!function_exists('curl_init')) { $myVisClass->processMessage(translate('Curl module not loaded, Proxy will be deactivated!'), $strErrorMessage); $chkRadValue3 = 0; } - // Check base paths + /* Check base paths */ $strSQLBase = "UPDATE `tbl_settings` SET `value`='%s' WHERE `category`='%s' AND `name`='%s'"; - $arrSQL[] = sprintf($strSQLBase, $strProtocol, 'path', 'protocol'); - $arrSQL[] = sprintf($strSQLBase, $chkTfValue1, 'path', 'tempdir'); - $arrSQL[] = sprintf($strSQLBase, $preRelPath, 'path', 'base_url'); - $arrSQL[] = sprintf($strSQLBase, $preBasePath, 'path', 'base_path'); - $arrSQL[] = sprintf($strSQLBase, $strLocale, 'data', 'locale'); - $arrSQL[] = sprintf($strSQLBase, $chkTfValue2, 'data', 'encoding'); - $arrSQL[] = sprintf($strSQLBase, $chkTfValue8, 'security', 'logofftime'); - $arrSQL[] = sprintf($strSQLBase, $chkSelValue3, 'security', 'wsauth'); - $arrSQL[] = sprintf($strSQLBase, $chkTfValue9, 'common', 'pagelines'); - $arrSQL[] = sprintf($strSQLBase, $chkSelValue4, 'common', 'seldisable'); - $arrSQL[] = sprintf($strSQLBase, $chkRadValue1, 'common', 'tplcheck'); - $arrSQL[] = sprintf($strSQLBase, $chkRadValue2, 'common', 'updcheck'); - $arrSQL[] = sprintf($strSQLBase, $chkRadValue3, 'network', 'proxy'); - $arrSQL[] = sprintf($strSQLBase, $chkTfValue10, 'network', 'proxyserver'); - $arrSQL[] = sprintf($strSQLBase, $chkTfValue11, 'network', 'proxyuser'); - $arrSQL[] = sprintf($strSQLBase, $chkTfValue12, 'network', 'proxypasswd'); + $arrSQL[] = sprintf($strSQLBase, $strProtocol, 'path', 'protocol'); + $arrSQL[] = sprintf($strSQLBase, $chkTfValue1, 'path', 'tempdir'); + $arrSQL[] = sprintf($strSQLBase, $preRelPath, 'path', 'base_url'); + $arrSQL[] = sprintf($strSQLBase, $preBasePath, 'path', 'base_path'); + $arrSQL[] = sprintf($strSQLBase, $strLocale, 'data', 'locale'); + $arrSQL[] = sprintf($strSQLBase, $chkTfValue2, 'data', 'encoding'); + $arrSQL[] = sprintf($strSQLBase, $chkTfValue8, 'security', 'logofftime'); + $arrSQL[] = sprintf($strSQLBase, $chkSelValue3, 'security', 'wsauth'); + $arrSQL[] = sprintf($strSQLBase, $chkTfValue9, 'common', 'pagelines'); + $arrSQL[] = sprintf($strSQLBase, $chkSelValue4, 'common', 'seldisable'); + $arrSQL[] = sprintf($strSQLBase, $chkRadValue1, 'common', 'tplcheck'); + $arrSQL[] = sprintf($strSQLBase, $chkRadValue2, 'common', 'updcheck'); + $arrSQL[] = sprintf($strSQLBase, $chkRadValue3, 'network', 'proxy'); + $arrSQL[] = sprintf($strSQLBase, $chkTfValue10, 'network', 'proxyserver'); + $arrSQL[] = sprintf($strSQLBase, $chkTfValue11, 'network', 'proxyuser'); + $arrSQL[] = sprintf($strSQLBase, $chkTfValue12, 'network', 'proxypasswd'); + $arrSQL[] = sprintf($strSQLBase, $chkRadValue4, 'performance', 'parents'); foreach ($arrSQL as $elem) { $booReturn = $myDBClass->insertData($elem); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage( translate('An error occured while writing settings to database:'), $strErrorMessage @@ -139,9 +175,9 @@ if (filter_input(INPUT_POST, 'selValue1')) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } } - // Write db settings to file - if (is_writable($preBasePath. 'config/settings.php')) { - $filSettings = fopen($preBasePath. 'config/settings.php', 'wb'); + /* Write db settings to file */ + if (is_writable($preBasePath . 'config/settings.php')) { + $filSettings = fopen($preBasePath . 'config/settings.php', 'wb'); if ($filSettings) { fwrite($filSettings, "processMessage(translate('Error setting the correct locale. Please report this error ' - . "with the associated output of 'locale -a'"), $strErrorMessage); + . "with the associated output of 'locale -a'"), $strErrorMessage); } - putenv('LC_ALL=' .$strLocale. '.utf-8'); - putenv('LANG=' .$strLocale. '.utf-8'); - bindtextdomain($strLocale, $preBasePath. 'config/locale'); + putenv('LC_ALL=' . $strLocale . '.utf-8'); + putenv('LANG=' . $strLocale . '.utf-8'); + bindtextdomain($strLocale, $preBasePath . 'config/locale'); bind_textdomain_codeset($strLocale, $chkTfValue2); textdomain($strLocale); $myVisClass->processMessage(translate('Settings were changed'), $strInfoMessage); } else { $myVisClass->processMessage(translate('An error occured while writing settings.php. Please ' - . 'check permissions!'), $strErrorMessage); + . 'check permissions!'), $strErrorMessage); } } else { - $myVisClass->processMessage($preBasePath. 'config/settings.php ' .translate('is not writeable, please ' + $myVisClass->processMessage($preBasePath . 'config/settings.php ' . translate('is not writeable, please ' . 'check permissions!'), $strErrorMessage); } } -// -// Start content -// ============= +/* +Start content +*/ $conttp->setVariable('TITLE', translate('Configure Settings')); foreach ($arrDescription as $elem) { $conttp->setVariable($elem['name'], $elem['string']); } -$conttp->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); +$conttp->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF')); $conttp->setVariable('LANG_DESCRIPTION', translate('Change your current NagiosQL settings (e.g. Database user, ' - . 'Language).')); -// -// Path settings -// ============= + . 'Language).')); +/* Path settings */ $conttp->setVariable('PATH', translate('Path')); $conttp->setVariable('TEMPDIR_NAME', translate('Temporary Directory')); $conttp->setVariable('TEMPDIR_VALUE', htmlspecialchars($chkTfValue1, ENT_QUOTES, 'utf-8')); $conttp->setVariable('PROTOCOL_NAME', translate('Server protocol')); -$conttp->setVariable(strtoupper($SETS['path']['protocol']). '_SELECTED', 'selected'); -// -// Data settings -// ============= +$conttp->setVariable(strtoupper($SETS['path']['protocol']) . '_SELECTED', 'selected'); +/* Data settings */ $conttp->setVariable('DATA', translate('Language')); $conttp->setVariable('LOCALE', translate('Language')); -// Process language selection field -$strSQL = "SELECT * FROM `tbl_language` WHERE `active`='1' ORDER BY `id`"; +/* Process language selection field */ +$strSQL = "SELECT * FROM `tbl_language` WHERE `active`='1' ORDER BY `id`"; $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); -if ($booReturn && ($intDataCount != 0)) { +if ($booReturn && ($intDataCount !== 0)) { foreach ($arrData as $elem) { $conttp->setVariable('LANGUAGE_ID', $elem['id']); $conttp->setVariable('LANGUAGE_NAME', translate($elem['language'])); - if ($elem['locale'] == $SETS['data']['locale']) { + if ($elem['locale'] === $SETS['data']['locale']) { $conttp->setVariable('LANGUAGE_SELECTED', 'selected'); } + /** @noinspection DisconnectedForeachInstructionInspection */ $conttp->parse('language'); } } else { @@ -243,9 +276,7 @@ if ($booReturn && ($intDataCount != 0)) { } $conttp->setVariable('ENCODING_NAME', translate('Encoding')); $conttp->setVariable('ENCODING_VALUE', htmlspecialchars($chkTfValue2, ENT_QUOTES, 'utf-8')); -// -// Database settings -// ================= +/* Database settings */ $conttp->setVariable('DB', translate('Database')); $conttp->setVariable('SERVER_NAME', translate('MySQL Server')); $conttp->setVariable('SERVER_VALUE', htmlspecialchars($chkTfValue3, ENT_QUOTES, 'utf-8')); @@ -257,45 +288,36 @@ $conttp->setVariable('USERNAME_NAME', translate('Database user')); $conttp->setVariable('USERNAME_VALUE', htmlspecialchars($chkTfValue6, ENT_QUOTES, 'utf-8')); $conttp->setVariable('PASSWORD_NAME', translate('Database password')); $conttp->setVariable('PASSWORD_VALUE', htmlspecialchars($chkTfValue7, ENT_QUOTES, 'utf-8')); -// -// Security settings -// ================= +/* Security settings */ $conttp->setVariable('SECURITY', translate('Security')); $conttp->setVariable('LOGOFFTIME_NAME', translate('Session auto logoff time')); $conttp->setVariable('LOGOFFTIME_VALUE', htmlspecialchars($chkTfValue8, ENT_QUOTES, 'utf-8')); $conttp->setVariable('WSAUTH_NAME', translate('Authentication type')); -$conttp->setVariable('WSAUTH_' .$chkSelValue3. '_SELECTED', 'selected'); -// -// Common settings -// =============== +$conttp->setVariable('WSAUTH_' . $chkSelValue3 . '_SELECTED', 'selected'); +/* Common settings */ $conttp->setVariable('COMMON', translate('Common')); $conttp->setVariable('PAGELINES_NAME', translate('Data lines per page')); $conttp->setVariable('PAGELINES_VALUE', htmlspecialchars($chkTfValue9, ENT_QUOTES, 'utf-8')); $conttp->setVariable('SELDISABLE_NAME', translate('Selection method')); -$conttp->setVariable('SELDISABLE_' .$chkSelValue4. '_SELECTED', 'selected'); -// -// Template Check -// ============== +$conttp->setVariable('SELDISABLE_' . $chkSelValue4 . '_SELECTED', 'selected'); +/* Template Check */ $conttp->setVariable('TEMPLATE_CHECK', translate('Template warn message')); $conttp->setVariable('LANG_ENABLE', translate('Enable')); $conttp->setVariable('LANG_DISABLE', translate('Disable')); -$conttp->setVariable('TPL_CHECK_' .$chkRadValue1. '_CHECKED', 'checked'); -// -// Online version check -// ==================== +$conttp->setVariable('TPL_CHECK_' . $chkRadValue1 . '_CHECKED', 'checked'); +/* Online version check */ $conttp->setVariable('CLASS_NAME_1', 'elementHide'); $conttp->setVariable('CLASS_NAME_2', 'elementHide'); $conttp->setVariable('UPDATE_CHECK', translate('Online version check')); -$conttp->setVariable('UPD_CHECK_' .$chkRadValue2. '_CHECKED', 'checked'); -if ($chkRadValue2 == 1) { +$conttp->setVariable('UPD_CHECK_' . $chkRadValue2 . '_CHECKED', 'checked'); +if ($chkRadValue2 === 1) { $conttp->setVariable('CLASS_NAME_1', 'elementShow'); } -// -// Online update proxy settings -// ============================ +/* Online update proxy settings */ $conttp->setVariable('UPD_PROXY_CHECK', translate('Proxyserver')); -$conttp->setVariable('UPD_PROXY_' .$chkRadValue3. '_CHECKED', 'checked'); -if (($chkRadValue3 == 1) && ($chkRadValue2 == 1)) { +$conttp->setVariable('UPD_PROXY_' . $chkRadValue3 . '_CHECKED', 'checked'); +if (($chkRadValue3 === 1) && ($chkRadValue2 === 1)) { + echo "da"; $conttp->setVariable('CLASS_NAME_2', 'elementShow'); } $conttp->setVariable('UPD_PROXY_SERVER', translate('Proxy Address')); @@ -304,26 +326,26 @@ $conttp->setVariable('UPD_PROXY_USERNAME', translate('Proxy Username (optional)' $conttp->setVariable('UPD_PROXY_USERNAME_VALUE', htmlspecialchars($chkTfValue11, ENT_QUOTES, 'utf-8')); $conttp->setVariable('UPD_PROXY_PASSWORD', translate('Proxy Password (optional)')); $conttp->setVariable('UPD_PROXY_PASSWORD_VALUE', htmlspecialchars($chkTfValue12, ENT_QUOTES, 'utf-8')); -// -// Requirements of form -// ==================== +/* Performance options */ +$conttp->setVariable('PERFORMANCE', translate('Performance options')); +$conttp->setVariable('SHOW_PARENTS', translate('Show object parents')); +$conttp->setVariable('PAR_CHECK_' . $chkRadValue4 . '_CHECKED', 'checked'); +/* Requirements of form */ $conttp->setVariable('LANG_SAVE', translate('Save')); $conttp->setVariable('LANG_ABORT', translate('Abort')); $conttp->setVariable('LANG_REQUIRED', translate('required')); $conttp->setVariable('ERRORMESSAGE', $strErrorMessage); $conttp->setVariable('INFOMESSAGE', $strInfoMessage); -// -// Check access rights for adding new objects -// ========================================== -if ($myVisClass->checkAccountGroup($prePageKey, 'write') != 0) { +/* Check access rights for adding new objects */ +if ($myVisClass->checkAccountGroup($prePageKey, 'write') !== 0) { $conttp->setVariable('ADD_CONTROL', 'disabled="disabled"'); } $conttp->parse('settingssite'); $conttp->show('settingssite'); -// -// Footer ausgeben -// =============== +/* +Footer ausgeben +*/ $maintp->setVariable('VERSION_INFO', "NagiosQL $setFileVersion"); + . "target='_blank'>NagiosQL $setFileVersion"); $maintp->parse('footer'); -$maintp->show('footer'); +$maintp->show('footer'); \ No newline at end of file diff --git a/admin/specials.php b/admin/specials.php index 1de5261..275db67 100644 --- a/admin/specials.php +++ b/admin/specials.php @@ -1,50 +1,59 @@ setVariable('TITLE', translate('Misc commands')); $conttp->parse('header'); $conttp->show('header'); -$conttp->setVariable('DESC', translate('Define host and service dependencies, host and service escalations as well '. +$conttp->setVariable('DESC', translate('Define host and service dependencies, host and service escalations as well ' . 'as host and service additional data.')); $conttp->setVariable('STATISTICS', translate('Statistical datas')); $conttp->setVariable('TYPE', translate('Group')); $conttp->setVariable('ACTIVE', translate('Active')); $conttp->setVariable('INACTIVE', translate('Inactive')); -// -// Include statistical data -// ======================== -// Get read access groups +/* +Include statistical data +*/ +/* Get read access groups */ $strAccess = $myVisClass->getAccessGroups('read'); $intAccessGrp19 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=19'); $intAccessGrp20 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=20'); @@ -52,7 +61,7 @@ $intAccessGrp21 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_men $intAccessGrp22 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=22'); $intAccessGrp23 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=23'); $intAccessGrp24 = (int)$myDBClass->getFieldData('SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=24'); -if ($myVisClass->checkAccountGroup($intAccessGrp19, 'read') == 0) { +if ($myVisClass->checkAccountGroup($intAccessGrp19, 'read') === 0) { $conttp->setVariable('NAME', translate('Host dependencies')); $conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_hostdependency` ' . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); @@ -60,7 +69,7 @@ if ($myVisClass->checkAccountGroup($intAccessGrp19, 'read') == 0) { . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->parse('statisticrow'); } -if ($myVisClass->checkAccountGroup($intAccessGrp20, 'read') == 0) { +if ($myVisClass->checkAccountGroup($intAccessGrp20, 'read') === 0) { $conttp->setVariable('NAME', translate('Host escalations')); $conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_hostescalation` ' . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); @@ -68,7 +77,7 @@ if ($myVisClass->checkAccountGroup($intAccessGrp20, 'read') == 0) { . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->parse('statisticrow'); } -if ($myVisClass->checkAccountGroup($intAccessGrp21, 'read') == 0) { +if ($myVisClass->checkAccountGroup($intAccessGrp21, 'read') === 0) { $conttp->setVariable('NAME', translate('Host ext. info')); $conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_hostextinfo` ' . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); @@ -76,7 +85,7 @@ if ($myVisClass->checkAccountGroup($intAccessGrp21, 'read') == 0) { . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->parse('statisticrow'); } -if ($myVisClass->checkAccountGroup($intAccessGrp22, 'read') == 0) { +if ($myVisClass->checkAccountGroup($intAccessGrp22, 'read') === 0) { $conttp->setVariable('NAME', translate('Service dependencies')); $conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_servicedependency` ' . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); @@ -84,7 +93,7 @@ if ($myVisClass->checkAccountGroup($intAccessGrp22, 'read') == 0) { . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->parse('statisticrow'); } -if ($myVisClass->checkAccountGroup($intAccessGrp23, 'read') == 0) { +if ($myVisClass->checkAccountGroup($intAccessGrp23, 'read') === 0) { $conttp->setVariable('NAME', translate('Service escalations')); $conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_serviceescalation` ' . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); @@ -92,7 +101,7 @@ if ($myVisClass->checkAccountGroup($intAccessGrp23, 'read') == 0) { . "WHERE `active`='0' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); $conttp->parse('statisticrow'); } -if ($myVisClass->checkAccountGroup($intAccessGrp24, 'read') == 0) { +if ($myVisClass->checkAccountGroup($intAccessGrp24, 'read') === 0) { $conttp->setVariable('NAME', translate('Service ext. info')); $conttp->setVariable('ACT_COUNT', $myDBClass->getFieldData('SELECT count(*) FROM `tbl_serviceextinfo` ' . "WHERE `active`='1' AND `config_id`=$chkDomainId AND `access_group` IN ($strAccess)")); @@ -103,10 +112,10 @@ if ($myVisClass->checkAccountGroup($intAccessGrp24, 'read') == 0) { $conttp->parse('statistics'); $conttp->parse('main'); $conttp->show('main'); -// -// Include Footer -// ============== +/* +Include Footer +*/ $maintp->setVariable('VERSION_INFO', "NagiosQL $setFileVersion"); $maintp->parse('footer'); -$maintp->show('footer'); +$maintp->show('footer'); \ No newline at end of file diff --git a/admin/support.php b/admin/support.php index 2266c9e..b8d3d9c 100644 --- a/admin/support.php +++ b/admin/support.php @@ -1,48 +1,65 @@ Application version string + * @var string $setGITVersion from prepend_adm.php -> Application version string - GIT version + * @var int $chkDomainId from prepend_adm.php -> Configuration domain id + * @var int $prePageKey from prepend_adm.php -> Admin access key + * @var array $SETS Settings array + * @var array $arrDescription from fieldvars.php -> Translated common strings + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 40; -$preContent = 'admin/support.htm.tpl'; -$preAccess = 1; -$preFieldvars = 1; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 40; +$preContent = 'admin/support.htm.tpl'; +$preAccess = 1; +$preFieldvars = 1; $setSaveLangId = 'private'; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Start content -// ============= +$strErrorMessage = ''; +$strInfoMessage = ''; +/* +Include preprocessing file +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Start content +*/ $conttp->setVariable('TITLE', translate('NagiosQL support page')); $conttp->parse('header'); $conttp->show('header'); -// -// Single data form -// ================ -$conttp->setVariable('MAINSITE', $_SESSION['SETS']['path']['base_url']. 'admin.php'); +/* +Single data form +*/ +$conttp->setVariable('MAINSITE', $_SESSION['SETS']['path']['base_url'] . 'admin.php'); foreach ($arrDescription as $elem) { $conttp->setVariable($elem['name'], $elem['string']); } @@ -50,17 +67,17 @@ $conttp->setVariable('SUBTITLE_1', translate('Support contact information')); $conttp->setVariable('SUPPORT_TEXT_1', translate('For questions, the online support forum or contact information ' . 'visit our website:')); $conttp->setVariable('WEBSITE_LINK', translate('NagiosQL on sourceforge')); -// -// Donation -// ======== +/* +Donation +*/ $conttp->setVariable('SUBTITLE_2', translate('Donate to support NagiosQL')); $conttp->setVariable('SUPPORT_TEXT_2', translate('If you like NagiosQL and it simplifies your daily work, then you ' . 'may want to support the project by making a donation. This helps us to keep NagiosQL alive and to cover ' . 'our costs. Thank you for your donation!')); $conttp->setVariable('DONATE_LINK', translate('Donate for NagiosQL on sourceforge')); -// -// Translations -// ============ +/* +Translations +*/ $conttp->setVariable('SUBTITLE_3', translate('Translation services')); $conttp->setVariable('SUPPORT_TEXT_3', translate('NagiosQL was translated into various languages​​. Since some ' . 'translators are no longer available in later versions, there may be untranslated words or phrases. If ' @@ -68,51 +85,53 @@ $conttp->setVariable('SUPPORT_TEXT_3', translate('NagiosQL was translated into v . 'with us now! The translations are simply feasible online - we use an open translation service where ' . 'you can register for free at any time:')); $conttp->setVariable('TRANSLATION_LINK', translate('Transifex translation service')); -// -// GIT repository -// ============== +/* +GIT repository +*/ $conttp->setVariable('SUBTITLE_8', translate('GIT software repository')); $conttp->setVariable('SUPPORT_TEXT_5', translate('The NagiosQL sources are available on GitLab. There you will ' - .'always find the latest bugfixes and changes as well as older branches.')); + . 'always find the latest bugfixes and changes as well as older branches.')); $conttp->setVariable('GIT_LINK', translate('GitLab')); -// -// Online version check -// ==================== +/* +Online version check +*/ $conttp->setVariable('SUBTITLE_4', translate('Version check')); -if (!isset($SETS['common']['updcheck']) || ($SETS['common']['updcheck'] == '0')) { +if (!isset($SETS['common']['updcheck']) || ($SETS['common']['updcheck'] === '0')) { $conttp->setVariable('SUPPORT_TEXT_4', translate('The online version check is not enabled. You can enable it ' . 'on the settings page.')); -} elseif (isset($SETS['common']['updcheck']) && ($SETS['common']['updcheck'] == '1')) { +} elseif (isset($SETS['common']['updcheck']) && ($SETS['common']['updcheck'] === '1')) { $conttp->setVariable('SUPPORT_TEXT_4', translate('The online version check connects the NagiosQL page to find ' . 'out, if your version is still up to date.')); - $conttp->setVariable('LOADER_IMAGE', $_SESSION['SETS']['path']['base_url']. 'images/loader.gif'); - $conttp->setVariable('VERSION_IF_SRC', $_SESSION['SETS']['path']['base_url']. 'admin/versioncheck.php?show=0'); + $conttp->setVariable('LOADER_IMAGE', $_SESSION['SETS']['path']['base_url'] . 'images/loader.gif'); + $conttp->setVariable('VERSION_IF_SRC', $_SESSION['SETS']['path']['base_url'] . 'admin/versioncheck.php?show=0'); $conttp->parse('versioncheck_frame'); - $conttp->setVariable('VERSION_IF_SRC_RELOAD', $_SESSION['SETS']['path']['base_url']. + $conttp->setVariable('VERSION_IF_SRC_RELOAD', $_SESSION['SETS']['path']['base_url'] . 'admin/versioncheck.php?show=1'); $conttp->parse('versioncheck_js'); } -// -// Environment check -// ================= +$conttp->setVariable('GIT_TITLE', translate('GIT code version')); +$conttp->setVariable('GIT_VERSION', $setFileVersion . '-' . $setGITVersion); +/* +Environment check +*/ $conttp->setVariable('SUBTITLE_5', translate('Environment check')); -// Javascript check +/* Javascript check */ $conttp->setVariable('FAILED', translate('failed')); $conttp->setVariable('OK', translate('ok')); -// PHP version check +/* PHP version check */ $conttp->setVariable('PHP_VERSION', translate('PHP version')); if (PHP_VERSION_ID >= 50500) { $conttp->setVariable('PHP_CLASS', 'checkgreen'); - $conttp->setVariable('PHP_RESULT', translate('ok'). ' (' .PHP_VERSION. ')'); + $conttp->setVariable('PHP_RESULT', translate('ok') . ' (' . PHP_VERSION . ')'); } else { $conttp->setVariable('PHP_CLASS', 'checkred'); - $conttp->setVariable('PHP_RESULT', translate('failed'). ' (' .PHP_VERSION. ' - ' - .translate('Required:'). ' 5.5.0)'); + $conttp->setVariable('PHP_RESULT', translate('failed') . ' (' . PHP_VERSION . ' - ' + . translate('Required:') . ' 5.5.0)'); } -// PHP modules / extensions +/* PHP modules / extensions */ $strExtPath = ini_get('extension_dir'); -$strPrefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : ''; -$conttp->setVariable('PHP_SESSION_MODULE', translate('PHP module:'). ' session'); +$strPrefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : ''; +$conttp->setVariable('PHP_SESSION_MODULE', translate('PHP module:') . ' session'); if (extension_loaded('session')) { $conttp->setVariable('PHP_SESSION_CLASS', 'checkgreen'); $conttp->setVariable('PHP_SESSION_RESULT', translate('ok')); @@ -120,7 +139,7 @@ if (extension_loaded('session')) { $conttp->setVariable('PHP_SESSION_CLASS', 'checkred'); $conttp->setVariable('PHP_SESSION_RESULT', translate('failed')); } -$conttp->setVariable('PHP_GETTEXT_MODULE', translate('PHP module:'). ' gettext'); +$conttp->setVariable('PHP_GETTEXT_MODULE', translate('PHP module:') . ' gettext'); if (extension_loaded('gettext')) { $conttp->setVariable('PHP_GETTEXT_CLASS', 'checkgreen'); $conttp->setVariable('PHP_GETTEXT_RESULT', translate('ok')); @@ -128,7 +147,7 @@ if (extension_loaded('gettext')) { $conttp->setVariable('PHP_GETTEXT_CLASS', 'checkred'); $conttp->setVariable('PHP_GETTEXT_RESULT', translate('failed')); } -$conttp->setVariable('PHP_FTP_MODULE', translate('PHP module:'). ' ftp'); +$conttp->setVariable('PHP_FTP_MODULE', translate('PHP module:') . ' ftp'); if (extension_loaded('ftp')) { $conttp->setVariable('PHP_FTP_CLASS', 'checkgreen'); $conttp->setVariable('PHP_FTP_RESULT', translate('ok')); @@ -138,7 +157,7 @@ if (extension_loaded('ftp')) { $conttp->setVariable('PHP_FTP_RESULT', translate('failed')); $intFTP_ok = 0; } -$conttp->setVariable('PHP_SSH2_MODULE', translate('PHP module:'). ' ssh'); +$conttp->setVariable('PHP_SSH2_MODULE', translate('PHP module:') . ' ssh'); if (extension_loaded('ssh2')) { $conttp->setVariable('PHP_SSH2_CLASS', 'checkgreen'); $conttp->setVariable('PHP_SSH2_RESULT', translate('ok')); @@ -148,62 +167,62 @@ if (extension_loaded('ssh2')) { $conttp->setVariable('PHP_SSH2_RESULT', translate('failed')); $intSSH_ok = 0; } -// Datenbankversion -if ($SETS['db']['type'] == 'mysql') { +/* Datenbankversion */ +if ($SETS['db']['type'] === 'mysql') { $conttp->setVariable('DB_VERSION', translate('MySQL version')); - $strSQL = "SHOW VARIABLES LIKE 'version'"; + $strSQL = "SHOW VARIABLES LIKE 'version'"; $booReturn = $myDBClass->hasSingleDataset($strSQL, $arrDataset); - if ($booReturn && (count($arrDataset) != 0)) { + if ($booReturn && (count($arrDataset) !== 0)) { $strDBVersion = $arrDataset['Value']; if (version_compare($strDBVersion, '5.0.0', '>=')) { $conttp->setVariable('DB_CLASS', 'checkgreen'); - $conttp->setVariable('DB_RESULT', translate('ok'). ' (' .$strDBVersion. ')'); + $conttp->setVariable('DB_RESULT', translate('ok') . ' (' . $strDBVersion . ')'); } else { $conttp->setVariable('DB_CLASS', 'checkorange'); - $conttp->setVariable('DB_RESULT', translate('failed'). ' (' .$strDBVersion. ' - ' .translate('Required:'). + $conttp->setVariable('DB_RESULT', translate('failed') . ' (' . $strDBVersion . ' - ' . translate('Required:') . ' 5.0.0)'); } } } -// INI settings -$conttp->setVariable('INI_FILE_UPLOADS', translate('PHP ini settings:'). ' file_uploads'); +/* INI settings */ +$conttp->setVariable('INI_FILE_UPLOADS', translate('PHP ini settings:') . ' file_uploads'); $strStatus1 = ini_get('file_uploads'); -if (empty($strStatus1) || ($strStatus1 == 1)) { +if (empty($strStatus1) || ($strStatus1 === '1')) { $conttp->setVariable('INI_FILE_UPLOADS_CLASS', 'checkgreen'); $conttp->setVariable('INI_FILE_UPLOADS_RESULT', translate('ok')); } else { $conttp->setVariable('INI_FILE_UPLOADS_CLASS', 'checkred'); $conttp->setVariable('INI_FILE_UPLOADS_RESULT', translate('failed')); } -$conttp->setVariable('INI_AUTO_START', translate('PHP ini settings:'). ' session.auto_start'); +$conttp->setVariable('INI_AUTO_START', translate('PHP ini settings:') . ' session.auto_start'); $strStatus2 = ini_get('session.auto_start'); -if (empty($strStatus2) || ($strStatus2 == 0)) { +if (empty($strStatus2) || ($strStatus2 === '0')) { $conttp->setVariable('INI_AUTO_START_CLASS', 'checkgreen'); $conttp->setVariable('INI_AUTO_START_RESULT', translate('ok')); } else { $conttp->setVariable('INI_AUTO_START_CLASS', 'checkred'); $conttp->setVariable('INI_AUTO_START_RESULT', translate('failed')); } -$conttp->setVariable('INI_SUHO_SESS_ENC', translate('PHP ini settings:'). ' suhosin.session.encrypt'); +$conttp->setVariable('INI_SUHO_SESS_ENC', translate('PHP ini settings:') . ' suhosin.session.encrypt'); $strStatus3 = ini_get('suhosin.session.encrypt'); -if (empty($strStatus3) || ($strStatus3 == 0)) { +if (empty($strStatus3) || ($strStatus3 === '0')) { $conttp->setVariable('INI_SUHO_SESS_ENC_CLASS', 'checkgreen'); $conttp->setVariable('INI_SUHO_SESS_ENC_RESULT', translate('ok')); } else { $conttp->setVariable('INI_SUHO_SESS_ENC_CLASS', 'checkred'); $conttp->setVariable('INI_SUHO_SESS_ENC_RESULT', translate('failed')); } -$conttp->setVariable('INI_DATE_TIMEZONE', translate('PHP ini settings:'). ' date.timezone'); +$conttp->setVariable('INI_DATE_TIMEZONE', translate('PHP ini settings:') . ' date.timezone'); $strStatus4 = ini_get('date.timezone'); if (!empty($strStatus4)) { $conttp->setVariable('INI_DATE_TIMEZONE_CLASS', 'checkgreen'); - $conttp->setVariable('INI_DATE_TIMEZONE_RESULT', translate('ok'). ' (' .$strStatus4. ')'); + $conttp->setVariable('INI_DATE_TIMEZONE_RESULT', translate('ok') . ' (' . $strStatus4 . ')'); } else { $conttp->setVariable('INI_DATE_TIMEZONE_CLASS', 'checkred'); $conttp->setVariable('INI_DATE_TIMEZONE_RESULT', translate('failed')); } -// File access checks -$conttp->setVariable('RW_CONFIG', translate('Read/Write access:'). ' settings.php'); +/* File access checks */ +$conttp->setVariable('RW_CONFIG', translate('Read/Write access:') . ' settings.php'); $strConfigFile = '../config/settings.php'; if (file_exists($strConfigFile) && is_readable($strConfigFile) && is_writable($strConfigFile)) { $conttp->setVariable('RW_CONFIG_CLASS', 'checkgreen'); @@ -212,13 +231,14 @@ if (file_exists($strConfigFile) && is_readable($strConfigFile) && is_writable($s $conttp->setVariable('RW_CONFIG_CLASS', 'checkred'); $conttp->setVariable('RW_CONFIG_RESULT', translate('failed')); } -// -// Domain checks -// ============= +/* +Domain checks +*/ $myConfigClass->getConfigTargets($arrConfigSet); -$intConfigId = $arrConfigSet[0]; -$myConfigClass->getConfigValues($intConfigId, 'method', $intMethod); -if ($intConfigId != 0) { +$intConfigId = $arrConfigSet[0]; +$myConfigClass->getConfigValues($intConfigId, 'method', $strMethod); +$intMethod = (int)$strMethod; +if ($intConfigId !== 0) { $conttp->setVariable('SUBTITLE_6', translate('Config domain checks')); $conttp->setVariable('SUPPORT_TEXT_6', translate('The checks below are based on your data domain and config ' . 'domain settings. To change the data domain, use the pull down menu in the upper right corner. Repeat ' @@ -229,19 +249,19 @@ if ($intConfigId != 0) { $conttp->setVariable('DOMAIN_NAME', translate('Config domain name')); $conttp->setVariable('DOMAIN_NAME_VALUE', $strConfName); $conttp->setVariable('CONNECT_TYPE', translate('Connection type')); - if ($intMethod == 1) { + if ($intMethod === 1) { $conttp->setVariable('CONNECT_TYPE_CLASS', 'checkgreen'); $conttp->setVariable('CONNECT_TYPE_RESULT', 'Fileaccess'); - } elseif ($intMethod == 2) { - if ($intFTP_ok == 1) { + } elseif ($intMethod === 2) { + if ($intFTP_ok === 1) { $conttp->setVariable('CONNECT_TYPE_CLASS', 'checkgreen'); $conttp->setVariable('CONNECT_TYPE_RESULT', 'FTP'); } else { $conttp->setVariable('CONNECT_TYPE_CLASS', 'checkred'); $conttp->setVariable('CONNECT_TYPE_RESULT', 'FTP (no FTP module)'); } - } elseif ($intMethod == 3) { - if ($intSSH_ok == 1) { + } elseif ($intMethod === 3) { + if ($intSSH_ok === 1) { $conttp->setVariable('CONNECT_TYPE_CLASS', 'checkgreen'); $conttp->setVariable('CONNECT_TYPE_RESULT', 'SSH/SFTP'); } else { @@ -250,15 +270,15 @@ if ($intConfigId != 0) { } } $conttp->setVariable('CONNECT_CHECK', translate('Connection check')); - if ($intMethod == 1) { + if ($intMethod === 1) { $conttp->setVariable('CONNECT_CHECK_CLASS', 'checkgreen'); $conttp->setVariable('CONNECT_CHECK_RESULT', translate('ok')); - } elseif ($intMethod == 2) { + } elseif ($intMethod === 2) { $booReturn = 0; - if (empty($myConfigClass->resConnectId) || !is_resource($myConfigClass->resConnectId)) { + if (empty($myConfigClass->conFTPConId)) { $booReturn = $myConfigClass->getFTPConnection($intConfigId); } - if ($booReturn == 1) { + if ($booReturn === 1) { $conttp->setVariable('CONNECT_CHECK_CLASS', 'checkred'); $conttp->setVariable('CONNECT_CHECK_RESULT', translate('failed')); $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); @@ -268,12 +288,12 @@ if ($intConfigId != 0) { $conttp->setVariable('CONNECT_CHECK_RESULT', translate('ok')); $intConnectCheck = 1; } - } elseif ($intMethod == 3) { + } elseif ($intMethod === 3) { $booReturn = 0; - if (empty($myConfigClass->resConnectId) || !is_resource($myConfigClass->resConnectId)) { + if (empty($myConfigClass->resSSHConId) || !is_resource($myConfigClass->resSSHConId)) { $booReturn = $myConfigClass->getSSHConnection($intConfigId); } - if ($booReturn == 1) { + if ($booReturn === 1) { $conttp->setVariable('CONNECT_CHECK_CLASS', 'checkred'); $conttp->setVariable('CONNECT_CHECK_RESULT', translate('failed')); $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); @@ -285,25 +305,25 @@ if ($intConfigId != 0) { } } $conttp->setVariable('RW_NAG_CONF', translate('Nagios config file')); - if ($intMethod == 1) { + if ($intMethod === 1) { if (file_exists($strConffile) && is_readable($strConffile)) { if (is_writable($strConffile)) { $conttp->setVariable('RW_NAG_CONF_CLASS', 'checkgreen'); $conttp->setVariable('RW_NAG_CONF_RESULT', translate('ok')); } else { $conttp->setVariable('RW_NAG_CONF_CLASS', 'checkorange'); - $conttp->setVariable('RW_NAG_CONF_RESULT', translate('ok'). ' (' .translate('readonly'). ')'); + $conttp->setVariable('RW_NAG_CONF_RESULT', translate('ok') . ' (' . translate('readonly') . ')'); } } else { $conttp->setVariable('RW_NAG_CONF_CLASS', 'checkred'); $conttp->setVariable('RW_NAG_CONF_RESULT', translate('failed')); } - } elseif (($intMethod == 2) || ($intMethod == 3)) { - // Write file to temporary + } elseif (($intMethod === 2) || ($intMethod === 3)) { + /* Write file to temporary */ $strFileName = tempnam($SETS['path']['tempdir'], 'nagiosql_conf'); - // Copy configuration from remote system - $intReturn = $myConfigClass->remoteFileCopy($strConffile, $intConfigId, $strFileName, 0); - if ($intReturn == 0) { + /* Copy configuration from remote system */ + $intReturn = $myConfigClass->remoteFileCopy($strConffile, $intConfigId, $strFileName); + if ($intReturn === 0) { $intCheck = 0; } else { $intCheck = 1; @@ -312,41 +332,40 @@ if ($intConfigId != 0) { unlink($strFileName); } } - // Copy configuration to remote system - if ($intCheck == 0) { + /* Copy configuration to remote system */ + if ($intCheck === 0) { $intReturn = $myConfigClass->remoteFileCopy($strConffile, $intConfigId, $strFileName, 1); - if ($intReturn == 0) { + if ($intReturn === 0) { $intCheck = 0; - if (file_exists($strFileName)) { - unlink($strFileName); - } } else { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); $intCheck = 2; - if (file_exists($strFileName)) { - unlink($strFileName); - } + } + if (file_exists($strFileName)) { + unlink($strFileName); } } - // Write Results - if ($intCheck == 0) { + /* Write Results */ + if ($intCheck === 0) { $conttp->setVariable('RW_NAG_CONF_CLASS', 'checkgreen'); $conttp->setVariable('RW_NAG_CONF_RESULT', translate('ok')); - } elseif ($intCheck == 1) { + } elseif ($intCheck === 1) { $conttp->setVariable('RW_NAG_CONF_CLASS', 'checkred'); $conttp->setVariable('RW_NAG_CONF_RESULT', translate('failed')); - } elseif ($intCheck == 2) { + } elseif ($intCheck === 2) { $conttp->setVariable('RW_NAG_CONF_CLASS', 'checkorange'); - $conttp->setVariable('RW_NAG_CONF_RESULT', translate('ok'). ' (' .translate('readonly'). ')'); + $conttp->setVariable('RW_NAG_CONF_RESULT', translate('ok') . ' (' . translate('readonly') . ')'); } } $myConfigClass->getConfigValues($intConfigId, 'pidfile', $strPidfile); $myConfigClass->getConfigValues($intConfigId, 'binaryfile', $strBinary); $myConfigClass->getConfigValues($intConfigId, 'commandfile', $strCommandfile); $conttp->setVariable('CHECK_NAG_LOCK', translate('Nagios process file')); - if ($intMethod == 1) { - if (substr_count(PHP_OS, 'Linux') != 0) { - exec('ps -ef | grep '.basename($strBinary).' | grep -v grep', $arrExec); + $intDemonOk = 0; + $intCheck = 0; + if ($intMethod === 1) { + if (substr_count(PHP_OS, 'Linux') !== 0) { + exec('ps -ef | grep ' . basename($strBinary) . ' | grep -v grep', $arrExec); } else { $arrExec[0] = 1; } @@ -356,9 +375,9 @@ if ($intConfigId != 0) { $conttp->setVariable('CHECK_NAG_LOCK_RESULT', translate('ok')); $intDemonOk = 0; } else { - $conttp->setVariable('CHECK_NAG_LOCK_CLASS', 'checkred'); - $conttp->setVariable('CHECK_NAG_LOCK_RESULT', translate('failed') . ' (' - . translate('file is missed') . ')'); + $conttp->setVariable('CHECK_NAG_LOCK_CLASS', 'checkorange'); + $conttp->setVariable('CHECK_NAG_LOCK_RESULT', translate('ok') . ' (' + . translate('file is missed or not used') . ')'); $intDemonOk = 1; } } else { @@ -367,189 +386,186 @@ if ($intConfigId != 0) { $myVisClass->processMessage(translate('Nagios daemon is not running'), $strErrorMessage); $intDemonOk = 1; } - } elseif ($intMethod == 2) { + } elseif ($intMethod === 2) { $conttp->setVariable('CHECK_NAG_LOCK_CLASS', 'checkorange'); - $conttp->setVariable('CHECK_NAG_LOCK_RESULT', translate('ok'). ' (' .translate('not used with FTP'). ')'); + $conttp->setVariable('CHECK_NAG_LOCK_RESULT', translate('ok') . ' (' . translate('not used with FTP') . ')'); $intDemonOk = 1; - } elseif ($intMethod == 3) { + } elseif ($intMethod === 3) { $arrResultBinary = array(); - $arrResultPid = array(); - $intBinary = 1; - $intPid = 1; - if ($strBinary != '') { - $intBinary = $myConfigClass->sendSSHCommand('ps -ef | grep '.basename($strBinary).' | grep '. - basename($strConffile).' | grep -v grep', $arrResultBinary); + $arrResultPid = array(); + $intBinary = 1; + $intPid = 1; + if ($strBinary !== '') { + $intBinary = $myConfigClass->sendSSHCommand('ps -ef | grep ' . basename($strBinary) . ' | grep ' . + basename($strConffile) . ' | grep -v grep', $arrResultBinary); } - if ($strPidfile != '') { + if ($strPidfile !== '') { $intPid = $myConfigClass->sendSSHCommand('ls ' . $strPidfile, $arrResult2); } - if (($intBinary == 0) && ($intPid == 0)) { + if (($intBinary === 0) && ($intPid === 0)) { $conttp->setVariable('CHECK_NAG_LOCK_CLASS', 'checkgreen'); $conttp->setVariable('CHECK_NAG_LOCK_RESULT', translate('ok')); $intDemonOk = 0; - } elseif (($intBinary == 0) && ($intPid == 1)) { - $conttp->setVariable('CHECK_NAG_LOCK_CLASS', 'checkred'); - $conttp->setVariable('CHECK_NAG_LOCK_RESULT', translate('failed'). ' (' .translate('file is missed'). ')'); + } elseif (($intBinary === 0) && ($intPid === 1)) { + $conttp->setVariable('CHECK_NAG_LOCK_CLASS', 'checkorange'); + $conttp->setVariable('CHECK_NAG_LOCK_RESULT', translate('ok') . ' (' . translate('file is missed or not used') . ')'); $intDemonOk = 1; } else { $conttp->setVariable('CHECK_NAG_LOCK_CLASS', 'checkred'); - $conttp->setVariable('CHECK_NAG_LOCK_RESULT', translate('failed'). ' (' .translate('demon dead'). ')'); + $conttp->setVariable('CHECK_NAG_LOCK_RESULT', translate('failed') . ' (' . translate('demon dead') . ')'); $myVisClass->processMessage(translate('Nagios daemon is not running'), $strErrorMessage); $intDemonOk = 1; } } - // Command file + /* Command file */ $conttp->setVariable('RW_NAG_COMMAND', translate('Nagios command file')); - if ($intMethod == 1) { + if ($intMethod === 1) { if (file_exists($strCommandfile) && is_readable($strCommandfile) && is_writable($strCommandfile)) { - if ($intDemonOk == 0) { + if ($intDemonOk === 0) { $conttp->setVariable('RW_NAG_COMMAND_CLASS', 'checkgreen'); $conttp->setVariable('RW_NAG_COMMAND_RESULT', translate('ok')); } else { $conttp->setVariable('RW_NAG_COMMAND_CLASS', 'checkorange'); - $conttp->setVariable('RW_NAG_COMMAND_RESULT', translate('ok'). ' (' .translate('demon dead'). '?)'); + $conttp->setVariable('RW_NAG_COMMAND_RESULT', translate('ok') . ' (' . translate('demon dead') . '?)'); } } if (!file_exists($strCommandfile)) { $conttp->setVariable('RW_NAG_COMMAND_CLASS', 'checkred'); - $conttp->setVariable('RW_NAG_COMMAND_RESULT', translate('failed'). ' (' .translate('file is missed'). ')'); + $conttp->setVariable('RW_NAG_COMMAND_RESULT', translate('failed') . ' (' . translate('file is missed') . ')'); } elseif (!is_writable($strCommandfile)) { $conttp->setVariable('RW_NAG_COMMAND_CLASS', 'checkred'); - $conttp->setVariable('RW_NAG_COMMAND_RESULT', translate('failed'). ' (' .translate('readonly'). ')'); + $conttp->setVariable('RW_NAG_COMMAND_RESULT', translate('failed') . ' (' . translate('readonly') . ')'); } elseif (!is_readable($strCommandfile)) { $conttp->setVariable('RW_NAG_COMMAND_CLASS', 'checkred'); $conttp->setVariable('RW_NAG_COMMAND_RESULT', translate('failed')); } - } elseif ($intMethod == 2) { + } elseif ($intMethod === 2) { $conttp->setVariable('RW_NAG_COMMAND_CLASS', 'checkorange'); - $conttp->setVariable('RW_NAG_COMMAND_RESULT', translate('ok'). ' (' .translate('not used with FTP'). ')'); - } elseif ($intMethod == 3) { - if ($strCommandfile != '') { - if ($intDemonOk == 0) { + $conttp->setVariable('RW_NAG_COMMAND_RESULT', translate('ok') . ' (' . translate('not used with FTP') . ')'); + } elseif ($intMethod === 3) { + if ($strCommandfile !== '') { + if ($intDemonOk === 0) { $myConfigClass->sendSSHCommand('echo "TEST" >>' . $strCommandfile . '; echo $?; echo ""', $arrTemp); - if ($arrTemp[0] == 0) { + if ($arrTemp[0] === 0) { $conttp->setVariable('RW_NAG_COMMAND_CLASS', 'checkgreen'); $conttp->setVariable('RW_NAG_COMMAND_RESULT', translate('ok')); } else { $conttp->setVariable('RW_NAG_COMMAND_CLASS', 'checkred'); - $conttp->setVariable('RW_NAG_COMMAND_RESULT', translate('failed'). ' (' - .translate('readonly'). ')'); + $conttp->setVariable('RW_NAG_COMMAND_RESULT', translate('failed') . ' (' + . translate('readonly') . ')'); } - } elseif ($intDemonOk == 1) { + } elseif ($intDemonOk === 1) { $conttp->setVariable('RW_NAG_COMMAND_CLASS', 'checkred'); - $conttp->setVariable('RW_NAG_COMMAND_RESULT', translate('failed'). ' (' .translate('demon dead'). ')'); + $conttp->setVariable('RW_NAG_COMMAND_RESULT', translate('failed') . ' (' . translate('demon dead') . ')'); } else { $conttp->setVariable('RW_NAG_COMMAND_CLASS', 'checkred'); - $conttp->setVariable('RW_NAG_COMMAND_RESULT', translate('failed'). ' (' - .translate('file is missed'). ')'); + $conttp->setVariable('RW_NAG_COMMAND_RESULT', translate('failed') . ' (' + . translate('file is missed') . ')'); } } else { $conttp->setVariable('RW_NAG_COMMAND_CLASS', 'checkred'); - $conttp->setVariable('RW_NAG_COMMAND_RESULT', translate('failed'). ' (' .translate('file is missed'). ')'); + $conttp->setVariable('RW_NAG_COMMAND_RESULT', translate('failed') . ' (' . translate('file is missed') . ')'); } } - // Binary file + /* Binary file */ $conttp->setVariable('EXE_NAG_BINARY', translate('Nagios binary file')); - if ($intMethod == 1) { + if ($intMethod === 1) { if (file_exists($strBinary)) { if (is_executable($strBinary)) { $conttp->setVariable('EXE_NAG_BINARY_CLASS', 'checkgreen'); $conttp->setVariable('EXE_NAG_BINARY_RESULT', translate('ok')); } else { $conttp->setVariable('EXE_NAG_BINARY_CLASS', 'checkred'); - $conttp->setVariable('EXE_NAG_BINARY_RESULT', translate('failed'). ' (' - .translate('not executable'). ')'); + $conttp->setVariable('EXE_NAG_BINARY_RESULT', translate('failed') . ' (' + . translate('not executable') . ')'); } } else { $conttp->setVariable('EXE_NAG_BINARY_CLASS', 'checkred'); - $conttp->setVariable('EXE_NAG_BINARY_RESULT', translate('failed'). ' (' .translate('file is missed'). ')'); + $conttp->setVariable('EXE_NAG_BINARY_RESULT', translate('failed') . ' (' . translate('file is missed') . ')'); } - } elseif ($intMethod == 2) { + } elseif ($intMethod === 2) { $conttp->setVariable('EXE_NAG_BINARY_CLASS', 'checkorange'); - $conttp->setVariable('EXE_NAG_BINARY_RESULT', translate('ok'). ' (' .translate('not used with FTP'). ')'); - } elseif ($intMethod == 3) { + $conttp->setVariable('EXE_NAG_BINARY_RESULT', translate('ok') . ' (' . translate('not used with FTP') . ')'); + } elseif ($intMethod === 3) { $booReturn = 0; - /** @noinspection IsEmptyFunctionUsageInspection */ - if (empty($myConfigClass->resConnectId) || !is_resource($myConfigClass->resConnectId)) { + if (empty($myConfigClass->resSSHConId) || !is_resource($myConfigClass->resSSHConId)) { $booReturn = $myConfigClass->getSSHConnection($intConfigId); } - if ($booReturn == 1) { + if ($booReturn === 1) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); - } else { - if (($strBinary != '') && ($strConffile != '') && - ($myConfigClass->sendSSHCommand('ls '.$strBinary, $arrTemp) == 0)) { - $myConfigClass->sendSSHCommand($strBinary.' -V', $arrResult); - if (!is_array($arrResult) || ($arrResult == false)) { - $conttp->setVariable('EXE_NAG_BINARY_CLASS', 'checkred'); - $conttp->setVariable('EXE_NAG_BINARY_RESULT', translate('failed'). ' (' . - translate('not executable'). ')'); - } else { - $conttp->setVariable('EXE_NAG_BINARY_CLASS', 'checkgreen'); - $conttp->setVariable('EXE_NAG_BINARY_RESULT', translate('ok')); - } - } else { + } else if (($strBinary !== '') && ($strConffile !== '') && + ($myConfigClass->sendSSHCommand('ls ' . $strBinary, $arrTemp) === 0)) { + $myConfigClass->sendSSHCommand($strBinary . ' -V', $arrResult); + if (!is_array($arrResult) || (count($arrResult) === 0)) { $conttp->setVariable('EXE_NAG_BINARY_CLASS', 'checkred'); - $conttp->setVariable('EXE_NAG_BINARY_RESULT', translate('failed'). ' (' . - translate('file is missed'). ')'); + $conttp->setVariable('EXE_NAG_BINARY_RESULT', translate('failed') . ' (' . + translate('not executable') . ')'); + } else { + $conttp->setVariable('EXE_NAG_BINARY_CLASS', 'checkgreen'); + $conttp->setVariable('EXE_NAG_BINARY_RESULT', translate('ok')); } + } else { + $conttp->setVariable('EXE_NAG_BINARY_CLASS', 'checkred'); + $conttp->setVariable('EXE_NAG_BINARY_RESULT', translate('failed') . ' (' . + translate('file is missed') . ')'); } } - // Check config files + /* Check config files */ $myConfigClass->getConfigValues($intConfigId, 'basedir', $strBasedir); $myConfigClass->getConfigValues($intConfigId, 'hostconfig', $strHostdir); $myConfigClass->getConfigValues($intConfigId, 'serviceconfig', $strServicedir); $conttp->setVariable('SUBTITLE_7', translate('Verify configuration files and demon configuration')); $conttp->setVariable('CONFIGURATION_NAME', translate('Configuration name')); $conttp->setVariable('USED', translate('Used in data domain')); - $conttp->setVariable('DEMON_CONFIG', translate('Included in demon configuration'). ' (' - .basename($strConffile). ')'); - $arrConfig = array(); + $conttp->setVariable('DEMON_CONFIG', translate('Included in demon configuration') . ' (' + . basename($strConffile) . ')'); + $arrConfig = array(); $arrConfigFiles = array( - 'Hosts' => array( 'table' => 'tbl_host', 'file' => 'directory'), - 'Services' => array( 'table' => 'tbl_service', 'file' => 'directory'), - 'Hostgroups' => array( 'table' => 'tbl_hostgroup', 'file' => 'hostgroups.cfg'), - 'Servicegroups' => array( 'table' => 'tbl_servicegroup', 'file' => 'servicegroups.cfg'), - 'Hosttemplates' => array( 'table' => 'tbl_hosttemplate', 'file' => 'hosttemplates.cfg'), - 'servicetemplates' => array( 'table' => 'tbl_servicetemplate', 'file' => 'servicetemplates.cfg'), - 'Contacts' => array( 'table' => 'tbl_contact', 'file' => 'contacts.cfg'), - 'Contactgroups' => array( 'table' => 'tbl_contactgroup', 'file' => 'contactgroups.cfg'), - 'Timeperiods' => array( 'table' => 'tbl_timeperiod', 'file' => 'timeperiods.cfg'), - 'Contacttemplates' => array( 'table' => 'tbl_contacttemplate', 'file' => 'contacttemplates.cfg'), - 'Commands' => array( 'table' => 'tbl_command', 'file' => 'commands.cfg'), - 'Hostdependencies' => array( 'table' => 'tbl_hostdependency', 'file' => 'hostdependencies.cfg'), - 'Hostescalations' => array( 'table' => 'tbl_hostescalation', 'file' => 'hostescalations.cfg'), - 'Hostextinfo' => array( 'table' => 'tbl_hostextinfo', 'file' => 'hostextinfo.cfg'), - 'Servicedependencies' => array( 'table' => 'tbl_servicedependency', 'file' => 'servicedependencies.cfg'), - 'Serviceescalations' => array( 'table' => 'tbl_serviceescalation', 'file' => 'serviceescalations.cfg'), - 'Serviceextinfo' => array( 'table' => 'tbl_serviceextinfo', 'file' => 'serviceextinfo.cfg')); - if ($intMethod == 1) { + 'Hosts' => array('table' => 'tbl_host', 'file' => 'directory'), + 'Services' => array('table' => 'tbl_service', 'file' => 'directory'), + 'Hostgroups' => array('table' => 'tbl_hostgroup', 'file' => 'hostgroups.cfg'), + 'Servicegroups' => array('table' => 'tbl_servicegroup', 'file' => 'servicegroups.cfg'), + 'Hosttemplates' => array('table' => 'tbl_hosttemplate', 'file' => 'hosttemplates.cfg'), + 'servicetemplates' => array('table' => 'tbl_servicetemplate', 'file' => 'servicetemplates.cfg'), + 'Contacts' => array('table' => 'tbl_contact', 'file' => 'contacts.cfg'), + 'Contactgroups' => array('table' => 'tbl_contactgroup', 'file' => 'contactgroups.cfg'), + 'Timeperiods' => array('table' => 'tbl_timeperiod', 'file' => 'timeperiods.cfg'), + 'Contacttemplates' => array('table' => 'tbl_contacttemplate', 'file' => 'contacttemplates.cfg'), + 'Commands' => array('table' => 'tbl_command', 'file' => 'commands.cfg'), + 'Hostdependencies' => array('table' => 'tbl_hostdependency', 'file' => 'hostdependencies.cfg'), + 'Hostescalations' => array('table' => 'tbl_hostescalation', 'file' => 'hostescalations.cfg'), + 'Hostextinfo' => array('table' => 'tbl_hostextinfo', 'file' => 'hostextinfo.cfg'), + 'Servicedependencies' => array('table' => 'tbl_servicedependency', 'file' => 'servicedependencies.cfg'), + 'Serviceescalations' => array('table' => 'tbl_serviceescalation', 'file' => 'serviceescalations.cfg'), + 'Serviceextinfo' => array('table' => 'tbl_serviceextinfo', 'file' => 'serviceextinfo.cfg')); + if ($intMethod === 1) { $intCheck = 1; if (file_exists($strConffile) && is_readable($strConffile)) { $resFile = fopen($strConffile, 'rb'); while (!feof($resFile)) { $strLine = trim(fgets($resFile)); - if ((0 === strpos($strLine, 'c')) && ((substr_count($strLine, 'cfg_dir') != 0) || - (substr_count($strLine, 'cfg_file') != 0))) { + if ((0 === strpos($strLine, 'c')) && ((substr_count($strLine, 'cfg_dir') !== 0) || + (substr_count($strLine, 'cfg_file') !== 0))) { $arrConfig[] = $strLine; } } $intCheck = 0; fclose($resFile); } - } elseif (($intMethod == 2) || ($intMethod == 3)) { + } elseif (($intMethod === 2) || ($intMethod === 3)) { $intCheck = 1; - // Write file to temporary + /* Write file to temporary */ $strFileName = tempnam($SETS['path']['tempdir'], 'nagiosql_conf'); - // Copy configuration from remote system - $intReturn = $myConfigClass->remoteFileCopy($strConffile, $intConfigId, $strFileName, 0); - if ($intReturn == 0) { + /* Copy configuration from remote system */ + $intReturn = $myConfigClass->remoteFileCopy($strConffile, $intConfigId, $strFileName); + if ($intReturn === 0) { $intCheck = 0; if (file_exists($strFileName) && is_readable($strFileName)) { $resFile = fopen($strFileName, 'rb'); while (!feof($resFile)) { $strLine = trim(fgets($resFile)); - if ((0 === strpos($strLine, 'c')) && ((substr_count($strLine, 'cfg_dir') != 0) || - (substr_count($strLine, 'cfg_file') != 0))) { + if ((0 === strpos($strLine, 'c')) && ((substr_count($strLine, 'cfg_dir') !== 0) || + (substr_count($strLine, 'cfg_file') !== 0))) { $arrConfig[] = $strLine; } } @@ -566,117 +582,118 @@ if ($intConfigId != 0) { } $i = 0; foreach ($arrConfigFiles as $key => $elem) { - // Line colours + /* Line colours */ $strClassL = 'tdlb'; $strClassM = 'tdmb'; - if ($i%2 == 1) { + if ($i % 2 === 1) { $strClassL = 'tdld'; $strClassM = 'tdmd'; } $conttp->setVariable('CLASS_L', $strClassL); $conttp->setVariable('CLASS_M', $strClassM); - // Write configuiration name + /* Write configuiration name */ $conttp->setVariable('CONFIG_NAME', $key); - // Count active datasets - $strSQL = 'SELECT * FROM `' .$elem['table']."` WHERE `active`='1' AND `config_id`=$chkDomainId"; + /* Count active datasets */ + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $elem['table'] . "` WHERE `active`='1' AND `config_id`=$chkDomainId"; $booReturn = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - if ($booReturn && ($intDataCount != 0)) { - $conttp->setVariable('ACTIVE_CONFIG_COUNT', '' .translate('ok'). ' (' . - $intDataCount. ')'); - } elseif ($intDataCount == 0) { - $conttp->setVariable('ACTIVE_CONFIG_COUNT', '' .translate('not used'). ''); + if ($booReturn && ($intDataCount !== 0)) { + $conttp->setVariable('ACTIVE_CONFIG_COUNT', '' . translate('ok') . ' (' . + $intDataCount . ')'); + } elseif ($intDataCount === 0) { + $conttp->setVariable('ACTIVE_CONFIG_COUNT', '' . translate('not used') . ''); } else { - $conttp->setVariable('ACTIVE_CONFIG_COUNT', '' .translate('failed'). ''); + $conttp->setVariable('ACTIVE_CONFIG_COUNT', '' . translate('failed') . ''); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - $conttp->setVariable('DEMON_CFG_OK', '' .translate('failed'). ' (' . - translate('cfg definition missed'). ')'); - if (($intCheck == 0) && is_array($arrConfig) && (count($arrConfig) != 0)) { + $conttp->setVariable('DEMON_CFG_OK', '' . translate('failed') . ' (' . + translate('cfg definition missed') . ')'); + if (($intCheck === 0) && is_array($arrConfig) && (count($arrConfig) !== 0)) { foreach ($arrConfig as $line) { - if ($elem['file'] != 'directory') { - if ((substr_count($line, 'cfg_dir=' .$strBasedir) != 0) && (substr_count($line, 'cfg_dir=' . - substr($strHostdir, 0, -1)) == 0) && (substr_count($line, 'cfg_dir=' . - substr($strServicedir, 0, -1)) == 0)) { - $conttp->setVariable('DEMON_CFG_OK', '' .translate('ok'). - ' (' .$line. ')'); + if ($elem['file'] !== 'directory') { + if ((substr_count($line, 'cfg_dir=' . $strBasedir) !== 0) && (substr_count($line, 'cfg_dir=' . + substr($strHostdir, 0, -1)) === 0) && (substr_count($line, 'cfg_dir=' . + substr($strServicedir, 0, -1)) === 0)) { + $conttp->setVariable('DEMON_CFG_OK', '' . translate('ok') . + ' (' . $line . ')'); break; } - if (substr_count($line, $strBasedir.$elem['file']) != 0) { - $conttp->setVariable('DEMON_CFG_OK', '' .translate('ok'). - ' (' .$line. ')'); + if (substr_count($line, $strBasedir . $elem['file']) !== 0) { + $conttp->setVariable('DEMON_CFG_OK', '' . translate('ok') . + ' (' . $line . ')'); break; } - if ($intDataCount == 0) { - $conttp->setVariable('DEMON_CFG_OK', '' .translate('ok'). - ' (' .translate('cfg definition missed, but actually not used'). ')'); - } elseif (substr_count($line, $elem['file']) != 0) { - $conttp->setVariable('DEMON_CFG_OK', '' .translate('failed'). - ' (' .translate('wrong base path:'). ' ' .$line. ')'); + if ($intDataCount === 0) { + $conttp->setVariable('DEMON_CFG_OK', '' . translate('ok') . + ' (' . translate('cfg definition missed, but actually not used') . ')'); + } elseif (substr_count($line, $elem['file']) !== 0) { + $conttp->setVariable('DEMON_CFG_OK', '' . translate('failed') . + ' (' . translate('wrong base path:') . ' ' . $line . ')'); break; } - } elseif ($elem['table'] == 'tbl_host') { - if (substr_count($line, 'cfg_dir=' .substr($strHostdir, 0, -1)) != 0) { - $conttp->setVariable('DEMON_CFG_OK', '' .translate('ok'). - ' (' .$line. ')'); + } elseif ($elem['table'] === 'tbl_host') { + if (substr_count($line, 'cfg_dir=' . substr($strHostdir, 0, -1)) !== 0) { + $conttp->setVariable('DEMON_CFG_OK', '' . translate('ok') . + ' (' . $line . ')'); break; } - if ($intDataCount == 0) { - $conttp->setVariable('DEMON_CFG_OK', '' .translate('ok'). - ' (' .translate('cfg definition missed, but actually not used'). ')'); + if ($intDataCount === 0) { + $conttp->setVariable('DEMON_CFG_OK', '' . translate('ok') . + ' (' . translate('cfg definition missed, but actually not used') . ')'); break; } - } elseif ($elem['table'] == 'tbl_service') { - if (substr_count($line, 'cfg_dir=' .substr($strServicedir, 0, -1)) != 0) { - $conttp->setVariable('DEMON_CFG_OK', '' .translate('ok'). - ' (' .$line. ')'); + } elseif ($elem['table'] === 'tbl_service') { + if (substr_count($line, 'cfg_dir=' . substr($strServicedir, 0, -1)) !== 0) { + $conttp->setVariable('DEMON_CFG_OK', '' . translate('ok') . + ' (' . $line . ')'); break; } - if ($intDataCount == 0) { - $conttp->setVariable('DEMON_CFG_OK', '' .translate('ok'). - ' (' .translate('cfg definition missed, but actually not used'). ')'); + if ($intDataCount === 0) { + $conttp->setVariable('DEMON_CFG_OK', '' . translate('ok') . + ' (' . translate('cfg definition missed, but actually not used') . ')'); break; } } } } else { - $conttp->setVariable('DEMON_CFG_OK', '' .translate('failed'). - ' (' .translate('cfg file not readable'). ')'); + $conttp->setVariable('DEMON_CFG_OK', '' . translate('failed') . + ' (' . translate('cfg file not readable') . ')'); } $conttp->parse('configfileline'); $i++; } - // Check for unused config - if (($intCheck == 0) && is_array($arrConfig) && (count($arrConfig) != 0)) { + /* Check for unused config */ + if (($intCheck === 0) && is_array($arrConfig) && (count($arrConfig) !== 0)) { foreach ($arrConfig as $line) { - $intTest=0; + $intTest = 0; foreach ($arrConfigFiles as $elem) { - if (substr_count($line, $elem['file']) != 0) { + if (substr_count($line, $elem['file']) !== 0) { $intTest = 1; } } - if ($intTest == 0) { - if (substr_count($line, substr('cfg_dir=' .$strHostdir, 0, -1)) != 0) { + if ($intTest === 0) { + if (substr_count($line, substr('cfg_dir=' . $strHostdir, 0, -1)) !== 0) { $intTest = 1; } - if (substr_count($line, substr('cfg_dir=' .$strServicedir, 0, -1)) != 0) { + if (substr_count($line, substr('cfg_dir=' . $strServicedir, 0, -1)) !== 0) { $intTest = 1; } - //if (substr_count($line,substr("cfg_dir=".$strBasedir,0,-1)) != 0) $intTest = 1; + //if (substr_count($line,substr("cfg_dir=".$strBasedir,0,-1)) !== 0) $intTest = 1; } - if ($intTest == 0) { - // Line colours + if ($intTest === 0) { + /* Line colours */ $strClassL = 'tdlb'; $strClassM = 'tdmb'; - if ($i%2 == 1) { + if ($i % 2 === 1) { $strClassL = 'tdld'; $strClassM = 'tdmd'; } $conttp->setVariable('CLASS_L', $strClassL); $conttp->setVariable('CLASS_M', $strClassM); $conttp->setVariable('CONFIG_NAME', translate('Not used')); - $conttp->setVariable('ACTIVE_CONFIG_COUNT', '' .translate('failed'). ''); - $conttp->setVariable('DEMON_CFG_OK', '' .translate('unused - please delete!'). - ' (' .$line. ')'); + $conttp->setVariable('ACTIVE_CONFIG_COUNT', '' . translate('failed') . ''); + $conttp->setVariable('DEMON_CFG_OK', '' . translate('unused - please delete!') . + ' (' . $line . ')'); $conttp->parse('configfileline'); $i++; } @@ -685,23 +702,23 @@ if ($intConfigId != 0) { $conttp->parse('configdomain'); } -// Messages -if ($strErrorMessage != '') { +/* Messages */ +if ($strErrorMessage !== '') { $conttp->setVariable('ERRORMESSAGE', $strErrorMessage); } -if ($strInfoMessage != '') { +if ($strInfoMessage !== '') { $conttp->setVariable('INFOMESSAGE', $strInfoMessage); } -// Check access rights for adding new objects -if ($myVisClass->checkAccountGroup($prePageKey, 'write') != 0) { +/* Check access rights for adding new objects */ +if ($myVisClass->checkAccountGroup($prePageKey, 'write') !== 0) { $conttp->setVariable('ADD_CONTROL', 'disabled="disabled"'); } $conttp->parse('support'); $conttp->show('support'); -// -// Process footer -// ============== +/* +Process footer +*/ $maintp->setVariable('VERSION_INFO', "NagiosQL $setFileVersion"); $maintp->parse('footer'); -$maintp->show('footer'); +$maintp->show('footer'); \ No newline at end of file diff --git a/admin/templatedefinitions.php b/admin/templatedefinitions.php index 1ad330e..1269835 100644 --- a/admin/templatedefinitions.php +++ b/admin/templatedefinitions.php @@ -1,285 +1,317 @@ array('default' => 0))); -$chkMode = filter_input(INPUT_GET, 'mode', FILTER_SANITIZE_STRING); -$chkKey = filter_input(INPUT_GET, 'key', FILTER_SANITIZE_STRING); -$chkDef = filter_input(INPUT_GET, 'def', FILTER_SANITIZE_STRING); -$chkType = filter_input(INPUT_GET, 'type', FILTER_SANITIZE_STRING); -if ($chkDataId == '') { +$chkMode = filter_input(INPUT_GET, 'mode'); +$chkKey = filter_input(INPUT_GET, 'key'); +$chkDef = filter_input(INPUT_GET, 'def'); +$chkType = filter_input(INPUT_GET, 'type'); +if ($chkDataId === '') { $chkDataId = 0; } -if (get_magic_quotes_gpc() == 0) { - $chkDef = addslashes($chkDef); -} $arrDefinition = explode('::', $chkDef); -if ($chkType == '') { +if ($chkType === '') { exit; } -if ($chkType == 'host') { +if ($chkType === 'host') { $chkLinkTab = 'tbl_lnkHostToHosttemplate'; - $chkPreTab = 'host'; + $chkPreTab = 'host'; } -if ($chkType == 'hosttemplate') { +if ($chkType === 'hosttemplate') { $chkLinkTab = 'tbl_lnkHosttemplateToHosttemplate'; - $chkPreTab = 'host'; + $chkPreTab = 'host'; } -if ($chkType == 'service') { +if ($chkType === 'service') { $chkLinkTab = 'tbl_lnkServiceToServicetemplate'; - $chkPreTab = 'service'; + $chkPreTab = 'service'; } -if ($chkType == 'servicetemplate') { +if ($chkType === 'servicetemplate') { $chkLinkTab = 'tbl_lnkServicetemplateToServicetemplate'; - $chkPreTab = 'service'; + $chkPreTab = 'service'; } -if ($chkType == 'contact') { +if ($chkType === 'contact') { $chkLinkTab = 'tbl_lnkContactToContacttemplate'; - $chkPreTab = 'contact'; + $chkPreTab = 'contact'; } -if ($chkType == 'contacttemplate') { +if ($chkType === 'contacttemplate') { $chkLinkTab = 'tbl_lnkContacttemplateToContacttemplate'; - $chkPreTab = 'contact'; + $chkPreTab = 'contact'; } -// -// Get data -// ======== -if ($chkLinkTab != '') { - $strSQL = 'SELECT * FROM `' .$chkLinkTab."` WHERE `idMaster` = $chkDataId ORDER BY `idSort`"; +/* +Get data +*/ +if ($chkLinkTab !== '') { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $chkLinkTab . "` WHERE `idMaster` = $chkDataId ORDER BY `idSort`"; $booReturn = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - // - // Store data to session - // ============================ - if ($chkMode == '') { + /* Store data to session */ + if ($chkMode === null) { $_SESSION['templatedefinition'] = array(); - $arrTemp = array(); - if ($booReturn && ($intDataCount != 0)) { + $arrTemp = array(); + if ($booReturn && ($intDataCount !== 0)) { foreach ($arrDataLines as $elem) { - if ($elem['idTable'] == 1) { + if ((int)$elem['idTable'] === 1) { $strSQL2 = 'SELECT `template_name` ' - . 'FROM `tbl_' .$chkPreTab. 'template` WHERE `id` = ' .$elem['idSlave']; - $strSQL3 = 'SELECT `active` FROM `tbl_' .$chkPreTab. 'template` WHERE `id` = ' .$elem['idSlave']; + . 'FROM `tbl_' . $chkPreTab . 'template` WHERE `id` = ' . $elem['idSlave']; + /** @noinspection SqlResolve */ + $strSQL3 = 'SELECT `active` FROM `tbl_' . $chkPreTab . 'template` WHERE `id` = ' . $elem['idSlave']; + /** @noinspection SqlResolve */ + $strSQL4 = 'SELECT `config_id` FROM `tbl_' . $chkPreTab . 'template` WHERE `id` = ' . $elem['idSlave']; } else { - $strSQL2 = 'SELECT `name` FROM `tbl_' .$chkPreTab. '` WHERE `id` = ' .$elem['idSlave']; - $strSQL3 = 'SELECT `active` FROM `tbl_' .$chkPreTab. '` WHERE `id` = ' .$elem['idSlave']; + /** @noinspection SqlResolve */ + $strSQL2 = 'SELECT `name` FROM `tbl_' . $chkPreTab . '` WHERE `id` = ' . $elem['idSlave']; + /** @noinspection SqlResolve */ + $strSQL3 = 'SELECT `active` FROM `tbl_' . $chkPreTab . '` WHERE `id` = ' . $elem['idSlave']; + /** @noinspection SqlResolve */ + $strSQL4 = 'SELECT `config_id` FROM `tbl_' . $chkPreTab . '` WHERE `id` = ' . $elem['idSlave']; } - $arrTemp['idSlave'] = $elem['idSlave']; - $arrTemp['definition'] = addslashes($myDBClass->getFieldData($strSQL2)); - $arrTemp['idTable'] = $elem['idTable']; - $arrTemp['idSort'] = $elem['idSort']; - $arrTemp['active'] = (int)$myDBClass->getFieldData($strSQL3); - $arrTemp['status'] = 0; + $arrTemp['idSlave'] = $elem['idSlave']; + $arrTemp['definition'] = addslashes($myDBClass->getFieldData($strSQL2)); + $arrTemp['idTable'] = $elem['idTable']; + $arrTemp['idSort'] = $elem['idSort']; + $arrTemp['active'] = (int)$myDBClass->getFieldData($strSQL3); + $arrTemp['config_id'] = (int)$myDBClass->getFieldData($strSQL4); + $arrTemp['status'] = 0; $_SESSION['templatedefinition'][] = $arrTemp; } } } } -// -// Add mode -// ======== -if ($chkMode == 'add') { +/* +Add mode +*/ +if ($chkMode === 'add') { $arrTemp = array(); - if ($arrDefinition[1] == 1) { - $strSQL2 = 'SELECT `template_name` FROM `tbl_' .$chkPreTab. 'template` WHERE `id` = ' .$arrDefinition[0]; - $strSQL3 = 'SELECT `active` FROM `tbl_' .$chkPreTab. 'template` WHERE `id` = ' .$arrDefinition[0]; + if ((int)$arrDefinition[1] === 1) { + /** @noinspection SqlResolve */ + $strSQL2 = 'SELECT `template_name` FROM `tbl_' . $chkPreTab . 'template` WHERE `id` = ' . $arrDefinition[0]; + /** @noinspection SqlResolve */ + $strSQL3 = 'SELECT `active` FROM `tbl_' . $chkPreTab . 'template` WHERE `id` = ' . $arrDefinition[0]; + /** @noinspection SqlResolve */ + $strSQL4 = 'SELECT `config_id` FROM `tbl_' . $chkPreTab . 'template` WHERE `id` = ' . $arrDefinition[0]; } else { - $strSQL2 = 'SELECT `name` FROM `tbl_' .$chkPreTab. '` WHERE `id` = ' .$arrDefinition[0]; - $strSQL3 = 'SELECT `active` FROM `tbl_' .$chkPreTab. '` WHERE `id` = ' .$arrDefinition[0]; + /** @noinspection SqlResolve */ + $strSQL2 = 'SELECT `name` FROM `tbl_' . $chkPreTab . '` WHERE `id` = ' . $arrDefinition[0]; + /** @noinspection SqlResolve */ + $strSQL3 = 'SELECT `active` FROM `tbl_' . $chkPreTab . '` WHERE `id` = ' . $arrDefinition[0]; + /** @noinspection SqlResolve */ + $strSQL4 = 'SELECT `config_id` FROM `tbl_' . $chkPreTab . '` WHERE `id` = ' . $arrDefinition[0]; } if (isset($_SESSION['templatedefinition']) && is_array($_SESSION['templatedefinition'])) { $intCheck = 0; foreach ($_SESSION['templatedefinition'] as $key => $elem) { - if (($elem['idSlave'] == $arrDefinition[0]) && ($elem['idTable'] == $arrDefinition[1]) && - ($elem['status'] == 0)) { + if ((int)($elem['idSlave'] === $arrDefinition[0]) && ((int)$elem['idTable'] === (int)$arrDefinition[1]) && + ((int)$elem['status'] === 0)) { $intCheck = 1; } } - if ($intCheck == 0) { - $arrTemp['idSlave'] = $arrDefinition[0]; - $arrTemp['definition'] = addslashes($myDBClass->getFieldData($strSQL2)); - $arrTemp['idTable'] = $arrDefinition[1]; - $arrTemp['idSort'] = 0; - $arrTemp['status'] = 0; - $arrTemp['active'] = (int)$myDBClass->getFieldData($strSQL3); + if ($intCheck === 0) { + $arrTemp['idSlave'] = $arrDefinition[0]; + $arrTemp['definition'] = addslashes($myDBClass->getFieldData($strSQL2)); + $arrTemp['idTable'] = $arrDefinition[1]; + $arrTemp['idSort'] = 0; + $arrTemp['status'] = 0; + $arrTemp['active'] = (int)$myDBClass->getFieldData($strSQL3); + $arrTemp['config_id'] = (int)$myDBClass->getFieldData($strSQL4); $_SESSION['templatedefinition'][] = $arrTemp; } } else { - $arrTemp['idSlave'] = $arrDefinition[0]; - $arrTemp['definition'] = addslashes($myDBClass->getFieldData($strSQL2)); - $arrTemp['idTable'] = $arrDefinition[1]; - $arrTemp['idSort'] = 0; - $arrTemp['status'] = 0; - $arrTemp['active'] = (int)$myDBClass->getFieldData($strSQL3); + $arrTemp['idSlave'] = $arrDefinition[0]; + $arrTemp['definition'] = addslashes($myDBClass->getFieldData($strSQL2)); + $arrTemp['idTable'] = $arrDefinition[1]; + $arrTemp['idSort'] = 0; + $arrTemp['status'] = 0; + $arrTemp['active'] = (int)$myDBClass->getFieldData($strSQL3); + $arrTemp['config_id'] = (int)$myDBClass->getFieldData($strSQL4); $_SESSION['templatedefinition'][] = $arrTemp; } } -// -// Deletion mode -// ============= -if ($chkMode == 'del' && isset($_SESSION['templatedefinition']) && is_array($_SESSION['templatedefinition'])) { +/* +Deletion mode +*/ +if ($chkMode === 'del' && isset($_SESSION['templatedefinition']) && is_array($_SESSION['templatedefinition'])) { foreach ($_SESSION['templatedefinition'] as $key => $elem) { - if (($elem['idSlave'] == $arrDefinition[0]) && ($elem['idTable'] == $arrDefinition[1]) && - ($elem['status'] == 0)) { + if (((int)$elem['idSlave'] === (int)$arrDefinition[0]) && ((int)$elem['idTable'] === (int)$arrDefinition[1]) && + ((int)$elem['status'] === 0)) { $_SESSION['templatedefinition'][$key]['status'] = 1; } } } -// -// Sort mode -// ========= -if ($chkMode == 'sortup') { - $chkKey = (int)$chkKey; +/* +Sort mode +*/ +if ($chkMode === 'sortup') { + $chkKey = (int)$chkKey; if (isset($_SESSION['templatedefinition']) && is_array($_SESSION['templatedefinition']) && - (count($_SESSION['templatedefinition']) > 1) && ($chkKey != 0)) { + (count($_SESSION['templatedefinition']) > 1) && ($chkKey !== 0)) { $arrTemp = array(); $arrWait = array(); - $intNow = 0; + $intNow = 0; foreach ($_SESSION['templatedefinition'] as $key => $elem) { - if ($key != ($chkKey-1)) { + if ($key !== ($chkKey - 1)) { $arrTemp[] = $elem; - if ($intNow == 1) { - $intNow = 0; - $arrTemp[] = $arrWait; - } - } else { - $arrWait = $elem; - $intNow = 1; - } - } - $_SESSION['templatedefinition'] = $arrTemp; - } -} -if ($chkMode == 'sortdown') { - $chkKey = (int)$chkKey; - if (isset($_SESSION['templatedefinition']) && is_array($_SESSION['templatedefinition']) && - (count($_SESSION['templatedefinition']) > 1) && ($chkKey < (count($_SESSION['templatedefinition'])-1))) { - $arrTemp = array(); - $arrWait = array(); - $intNow = 0; - foreach ($_SESSION['templatedefinition'] as $key => $elem) { - if ($key != $chkKey) { - $arrTemp[] = $elem; - if ($intNow == 1) { + if ($intNow === 1) { $intNow = 0; $arrTemp[] = $arrWait; } } else { $arrWait = $elem; - $intNow = 1; + $intNow = 1; } } $_SESSION['templatedefinition'] = $arrTemp; } } -// -// Clean up data structure -// ======================= +if ($chkMode === 'sortdown') { + $chkKey = (int)$chkKey; + if (isset($_SESSION['templatedefinition']) && is_array($_SESSION['templatedefinition']) && + (count($_SESSION['templatedefinition']) > 1) && ($chkKey < (count($_SESSION['templatedefinition']) - 1))) { + $arrTemp = array(); + $arrWait = array(); + $intNow = 0; + foreach ($_SESSION['templatedefinition'] as $key => $elem) { + if ($key !== $chkKey) { + $arrTemp[] = $elem; + if ($intNow === 1) { + $intNow = 0; + $arrTemp[] = $arrWait; + } + } else { + $arrWait = $elem; + $intNow = 1; + } + } + $_SESSION['templatedefinition'] = $arrTemp; + } +} +/* +Clean up data structure +*/ if (isset($_SESSION['templatedefinition']) && is_array($_SESSION['templatedefinition'])) { $arrTemp = array(); foreach ($_SESSION['templatedefinition'] as $key => $elem) { - if ($elem['status'] == 0) { + if ((int)$elem['status'] === 0) { $arrTemp[] = $elem; } } $_SESSION['templatedefinition'] = $arrTemp; } ?> - - - - - None - - - - - - $elem) { - if ($elem['status'] == 0) { - ?> - - - - - + + + + None + + + + +
<?php
-                    echo translate('Up'); ?> <?php
-                    echo translate('Down'); ?> <?php
-                    echo translate('Delete'); ?>
+ $elem) { + if ((int)$elem['status'] === 0) { + ?> + + + + + + + + + + - - - - - -
<?php
+                        echo translate('Up'); ?> <?php
+                                echo translate('Down'); ?> <?php
+                                echo translate('Delete'); ?>
 
 
- + ?> + + diff --git a/admin/timedefinitions.php b/admin/timedefinitions.php index cef0e42..18ade69 100644 --- a/admin/timedefinitions.php +++ b/admin/timedefinitions.php @@ -1,81 +1,80 @@ array('default' => 0))); +/* +Include preprocessing file +*/ +require $preBasePath . 'functions/prepend_adm.php'; +/* +Process post parameters +*/ +$chkTipId = filter_input(INPUT_GET, 'tipId', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); $chkVersion = filter_input(INPUT_GET, 'version', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); -$chkMode = filter_input(INPUT_GET, 'mode', FILTER_SANITIZE_STRING); -$chkDef = filter_input(INPUT_GET, 'def', FILTER_SANITIZE_STRING); -$chkRange = filter_input(INPUT_GET, 'range', FILTER_SANITIZE_STRING); -$chkId = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING); -if (get_magic_quotes_gpc() == 0) { - $chkDef = addslashes($chkDef); - $chkRange = addslashes($chkRange); -} -// -// Get data -// ======== -$strSQL = "SELECT * FROM `tbl_timedefinition` WHERE `tipId`=$chkTipId ORDER BY `definition`"; +$chkMode = filter_input(INPUT_GET, 'mode'); +$chkDef = filter_input(INPUT_GET, 'def'); +$chkRange = filter_input(INPUT_GET, 'range'); +$chkId = filter_input(INPUT_GET, 'id'); +/* +Get data +*/ +$strSQL = "SELECT * FROM `tbl_timedefinition` WHERE `tipId`=$chkTipId ORDER BY `definition`"; $booReturn = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); -// -// Store data to session -// ============================ -if ($chkMode == '') { +/* +Store data to session +*/ +if ($chkMode === null) { $_SESSION['timedefinition'] = array(); - if ($booReturn && ($intDataCount != 0)) { + if ($booReturn && ($intDataCount !== 0)) { foreach ($arrDataLines as $elem) { - $arrTemp['id'] = $elem['id']; - $arrTemp['definition'] = addslashes($elem['definition']); - $arrTemp['range'] = addslashes($elem['range']); - $arrTemp['status'] = 0; - $_SESSION['timedefinition'][] = $arrTemp; + $arrTemp['id'] = $elem['id']; + $arrTemp['definition'] = addslashes($elem['definition']); + $arrTemp['range'] = addslashes($elem['range']); + $arrTemp['status'] = 0; + $_SESSION['timedefinition'][] = $arrTemp; } } } -// -// Add mode -// ========= -if ($chkMode == 'add') { +/* +Add mode +*/ +if ($chkMode === 'add') { if (isset($_SESSION['timedefinition']) && is_array($_SESSION['timedefinition'])) { $intCheck = 0; foreach ($_SESSION['timedefinition'] as $key => $elem) { - if (($elem['definition'] == $chkDef) && ($elem['status'] == 0)) { + if (($elem['definition'] === $chkDef) && ((int)$elem['status'] === 0)) { $_SESSION['timedefinition'][$key]['definition'] = $chkDef; $_SESSION['timedefinition'][$key]['range'] = $chkRange; $intCheck = 1; } } - if ($intCheck == 0) { + if ($intCheck === 0) { $arrTemp['id'] = 0; $arrTemp['definition'] = $chkDef; $arrTemp['range'] = $chkRange; @@ -90,109 +89,114 @@ if ($chkMode == 'add') { $_SESSION['timedefinition'][] = $arrTemp; } } -// -// Deletion mode -// ============= -if ($chkMode == 'del' && isset($_SESSION['timedefinition']) && is_array($_SESSION['timedefinition'])) { +/* +Deletion mode +*/ +if ($chkMode === 'del' && isset($_SESSION['timedefinition']) && is_array($_SESSION['timedefinition'])) { foreach ($_SESSION['timedefinition'] as $key => $elem) { - if (($elem['definition'] == $chkDef) && ($elem['status'] == 0)) { + if (($elem['definition'] === $chkDef) && ((int)$elem['status'] === 0)) { $_SESSION['timedefinition'][$key]['status'] = 1; } } } ?> - - - - - None - - - - - - - - - - - - - - } + + function doDel(key) { + document.location.href = "admin/timedefinitions.php?tipId=&version=&mode=del&def=" + key; + } + + //--> + + + + +
<?php
-                    echo translate('Modify'); ?> <?php
-                    echo translate('Delete'); ?>
+ + + + + + + + + + + + + - - - - - - -
<?php
+                        echo translate('Modify'); ?> <?php
+                                echo translate('Delete'); ?>
  
  
- + ?> + + \ No newline at end of file diff --git a/admin/timeperiods.php b/admin/timeperiods.php index bd4b682..bc0229e 100644 --- a/admin/timeperiods.php +++ b/admin/timeperiods.php @@ -1,95 +1,146 @@ Application version string + * @var string $chkModus from prepend_adm.php -> Form work mode + * @var int $chkDataId from prepend_adm.php -> Actual dataset id + * @var string $chkSelModify from prepend_adm.php -> Modification selection value + * @var int $hidSortBy from prepend_adm.php -> Sort data by + * @var string $hidSortDir from prepend_adm.php -> Sort data direction (ASC, DESC) + * @var int $chkLimit from prepend_adm.php / settings -> Data set count per page + * @var int $intVersion from prepend_adm.php -> Nagios version + * @var int $chkListId from prepend_adm.php -> Actual dataset id (list view) + * @var array $SETS Settings array + * @var int $intGlobalWriteAccess from prepend_content.php -> Global admin write access + * @var int $intWriteAccessId from prepend_content.php -> Admin write access to actual dataset id + * @var string $strAccess from prepend_content.php -> List of read access group id's for actual user + * @var string $preSQLCommon1 from prepend_content.php -> Common SQL part 1 + * @var string $strDomainWhere from prepend_adm.php -> Domain selection SQL part with table name + * @var string $chkTfValue1 from prepend_content.php -> Time period name + * @var string $chkTfValue2 from prepend_content.php -> Time period description + * @var string $chkTfValue3 from prepend_content.php -> Time period template name + * @var array $chkMselValue1 from prepend_content.php -> Excluded time period + * @var array $chkMselValue2 from prepend_content.php -> Included time period + * @var int $intMselValue1 from prepend_content.php -> Excluded time period multiselect status value + * @var int $intMselValue2 from prepend_content.php -> Included time period multiselect status value + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 16; -$preContent = 'admin/timeperiods.htm.tpl'; -$preListTpl = 'admin/datalist.htm.tpl'; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 16; +$preContent = 'admin/timeperiods.htm.tpl'; +$preListTpl = 'admin/datalist.htm.tpl'; $preSearchSession = 'timeperiod'; -$preTableName = 'tbl_timeperiod'; -$preKeyField = 'timeperiod_name'; -$preAccess = 1; -$preFieldvars = 1; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Add or modify data -// ================== -if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAccess == 0)) { +$preTableName = 'tbl_timeperiod'; +$preKeyField = 'timeperiod_name'; +$preAccess = 1; +$preFieldvars = 1; +$intNoTime = 0; +$strErrorMessage = ''; +$strInfoMessage = ''; +$strConsistMessage = ''; +/* + * Default values for form variables +*/ +if (!isset($intMselValue1)) { + $intMselValue1 = 0; +} +if (!isset($intMselValue2)) { + $intMselValue2 = 0; +} +/* +Include preprocessing files +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Add or modify data +*/ +if ((($chkModus === 'insert') || ($chkModus === 'modify')) && ($intGlobalWriteAccess === 0)) { $strSQLx = "`$preTableName` SET `$preKeyField`='$chkTfValue1', `alias`='$chkTfValue2', `exclude`=$intMselValue1, " - . "`use_template`=$intMselValue2, `name`='$chkTfValue3', $preSQLCommon1"; - if ($chkModus == 'insert') { - $strSQL = 'INSERT INTO ' .$strSQLx; + . "`use_template`=$intMselValue2, `name`='$chkTfValue3', $preSQLCommon1"; + if ($chkModus === 'insert') { + $strSQL = 'INSERT INTO ' . $strSQLx; } else { - $strSQL = 'UPDATE ' .$strSQLx. ' WHERE `id`=' .$chkDataId; + $strSQL = 'UPDATE ' . $strSQLx . ' WHERE `id`=' . $chkDataId; } - if ($intWriteAccessId == 0) { - if (($chkTfValue1 != '') && ($chkTfValue2 != '')) { + if ($intWriteAccessId === 0) { + if (($chkTfValue1 !== '') && ($chkTfValue2 !== '')) { $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($chkModus == 'insert') { + if ($chkModus === 'insert') { $chkDataId = $intInsertId; } - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); $myDataClass->updateStatusTable($preTableName); - if ($chkModus == 'insert') { - $myDataClass->writeLog(translate('New time period inserted:'). ' ' .$chkTfValue1); + if ($chkModus === 'insert') { + $myDataClass->writeLog(translate('New time period inserted:') . ' ' . $chkTfValue1); } - if ($chkModus == 'modify') { - $myDataClass->writeLog(translate('Time period modified:'). ' ' .$chkTfValue1); + if ($chkModus === 'modify') { + $myDataClass->writeLog(translate('Time period modified:') . ' ' . $chkTfValue1); } - // - // Insert/update relations - // ======================= - if ($chkModus == 'insert') { - if ($intMselValue1 != 0) { + /* + Insert/update relations + */ + $intRet1 = 0; + $intRet2 = 0; + if ($chkModus === 'insert') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataInsertRelation( 'tbl_lnkTimeperiodToTimeperiod', $chkDataId, $chkMselValue1 ); } - if (isset($intRet1) && ($intRet1 != 0)) { + if (isset($intRet1) && ($intRet1 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataInsertRelation( 'tbl_lnkTimeperiodToTimeperiodUse', $chkDataId, $chkMselValue2 ); } - if (isset($intRet2) && ($intRet2 != 0)) { + if (isset($intRet2) && ($intRet2 !== 0)) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - } elseif ($chkModus == 'modify') { - if ($intMselValue1 != 0) { + } elseif ($chkModus === 'modify') { + if ($intMselValue1 !== 0) { $intRet1 = $myDataClass->dataUpdateRelation( 'tbl_lnkTimeperiodToTimeperiod', $chkDataId, @@ -98,10 +149,10 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet1 = $myDataClass->dataDeleteRelation('tbl_lnkTimeperiodToTimeperiod', $chkDataId); } - if ($intRet1 != 0) { + if ($intRet1 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intMselValue2 != 0) { + if ($intMselValue2 !== 0) { $intRet2 = $myDataClass->dataUpdateRelation( 'tbl_lnkTimeperiodToTimeperiodUse', $chkDataId, @@ -110,35 +161,35 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } else { $intRet2 = $myDataClass->dataDeleteRelation('tbl_lnkTimeperiodToTimeperiodUse', $chkDataId); } - if ($intRet2 != 0) { + if ($intRet2 !== 0) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } - if (($intRet1 + $intRet2) != 0) { + if (($intRet1 + $intRet2) !== 0) { $strInfoMessage = ''; } - // - // Insert/update time defintions - // ============================= - if ($chkModus == 'modify') { - $strSQL = "DELETE FROM `tbl_timedefinition` WHERE `tipId`=$chkDataId"; - $booReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($booReturn == false) { + /* + Insert/update time defintions + */ + if ($chkModus === 'modify') { + $strSQL = "DELETE FROM `tbl_timedefinition` WHERE `tipId`=$chkDataId"; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } if (isset($_SESSION['timedefinition']) && is_array($_SESSION['timedefinition']) && - (count($_SESSION['timedefinition']) != 0)) { + (count($_SESSION['timedefinition']) !== 0)) { foreach ($_SESSION['timedefinition'] as $elem) { - if ($elem['status'] == 0) { - if ($elem['definition'] != 'use') { + if ((int)$elem['status'] === 0) { + if ($elem['definition'] !== 'use') { $elem['range'] = str_replace(' ', '', $elem['range']); } - $strSQL = 'INSERT INTO `tbl_timedefinition` (`tipId`,`definition`,`range`, ' - . "`last_modified`) VALUES ($chkDataId,'".$elem['definition']."'," - . "'".$elem['range']."',now())"; - $booReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($booReturn == false) { + $strSQL = 'INSERT INTO `tbl_timedefinition` (`tipId`,`definition`,`range`, ' + . "`last_modified`) VALUES ($chkDataId,'" . $elem['definition'] . "'," + . "'" . $elem['range'] . "',now())"; + $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } } @@ -156,47 +207,41 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } $chkModus = 'display'; } -if ($chkModus != 'add') { - $chkModus = 'display'; +if ($chkModus !== 'add') { + $chkModus = 'display'; } -// -// Get date/time of last database and config file manipulation -// =========================================================== +/* +Get date/time of last database and config file manipulation +*/ $intReturn = $myConfigClass->lastModifiedFile($preTableName, $arrTimeData, $strTimeInfoString); -if ($intReturn != 0) { +if ($intReturn !== 0) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } -// -// Singe data form -// =============== -if ($chkModus == 'add') { +/* +Singe data form +*/ +if ($chkModus === 'add') { + $intDataWarning = 0; + $strDBWarning = ''; $conttp->setVariable('TITLE', translate('Time period definitions (timeperiods.cfg)')); - // Do not show modified time list + /* Do not show modified time list */ $intNoTime = 1; - // Process exclude selection fields - if (isset($arrModifyData['exclude'])) { - $intFieldId = $arrModifyData['exclude']; - } else { - $intFieldId = 0; - } + /* Process exclude selection fields */ + $intFieldId = $arrModifyData['exclude'] ?? 0; $intReturn1 = $myVisClass->parseSelectMulti( $preTableName, - 'name', + 'timeperiod_name', 'excludes', 'tbl_lnkTimeperiodToTimeperiod', 0, $intFieldId, $chkListId ); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process include selection fields - if (isset($arrModifyData['use_template'])) { - $intFieldId = $arrModifyData['use_template']; - } else { - $intFieldId = 0; - } + /* Process include selection fields */ + $intFieldId = $arrModifyData['use_template'] ?? 0; $intReturn2 = $myVisClass->parseSelectMulti( $preTableName, 'name', @@ -206,68 +251,68 @@ if ($chkModus == 'add') { $intFieldId, $chkListId ); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process acces group selection field - if (isset($arrModifyData['access_group'])) { - $intFieldId = $arrModifyData['access_group']; - } else { - $intFieldId = 0; - } + /* Process acces group selection field */ + $intFieldId = $arrModifyData['access_group'] ?? 0; $intReturn3 = $myVisClass->parseSelectSimple('tbl_group', 'groupname', 'acc_group', 0, $intFieldId); - if ($intReturn3 != 0) { + if ($intReturn3 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Initial add/modify form definitions + /* Initial add/modify form definitions */ $myContentClass->addFormInit($conttp); - if ($intDataWarning == 1) { - $conttp->setVariable('WARNING', $strDBWarning. '
' .translate('Saving not possible!')); + if ($intDataWarning === 1) { + $conttp->setVariable('WARNING', $strDBWarning . '
' . translate('Saving not possible!')); } if ($intVersion < 3) { $conttp->setVariable('VERSION_20_VALUE_MUST', 'mselValue1,'); } $conttp->setVariable('LANG_INSERT_ALL_TIMERANGE', translate('Please insert a time definition and a time range')); - // Insert data from database in "modify" mode - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - // Check relation information to find out locked configuration datasets + /* Insert data from database in "modify" mode */ + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + /* Check relation information to find out locked configuration datasets */ $intLocked = $myDataClass->infoRelation($preTableName, $arrModifyData['id'], $preKeyField); $myVisClass->processMessage($myDataClass->strInfoMessage, $strRelMessage); - $strInfo = '
' .translate('Entry cannot be activated because it is used by ' - . 'another configuration'). ':'; - $strInfo .= '
' .$strRelMessage. ''; - // Process data + $strInfo = '
' . translate('Entry cannot be activated because it is used by ' + . 'another configuration') . ':'; + $strInfo .= '
' . $strRelMessage . ''; + /* Process data */ $myContentClass->addInsertData($conttp, $arrModifyData, $intLocked, $strInfo); $conttp->setVariable('TIP_ID', $arrModifyData['id']); } $conttp->parse('datainsert'); $conttp->show('datainsert'); } -// -// List view -// ========== -if ($chkModus == 'display') { - // Initial list view definitions +/* +List view +*/ +if ($chkModus === 'display') { + $strSearchWhere = ''; + // Initial list view definitions */ $myContentClass->listViewInit($mastertp); $mastertp->setVariable('TITLE', translate('Time period definitions (timeperiods.cfg)')); $mastertp->setVariable('FIELD_1', translate('Time period')); $mastertp->setVariable('FIELD_2', translate('Description')); - // Process filter string - if ($_SESSION['search'][$preSearchSession] != '') { - $strSearchTxt = $_SESSION['search'][$preSearchSession]; - $strSearchWhere = "AND (`$preKeyField` LIKE '%".$strSearchTxt."%' OR `alias` LIKE '%".$strSearchTxt."%' " - . "OR `name` LIKE '%".$strSearchTxt."%')"; + $mastertp->setVariable('FILTER_VISIBLE', 'visibility: hidden'); + /* Process filter string */ + if ($_SESSION['search'][$preSearchSession] !== '') { + $strSearchTxt = $_SESSION['search'][$preSearchSession]; + $strSearchWhere = "AND (`$preKeyField` LIKE '%" . $strSearchTxt . "%' OR `alias` LIKE '%" . $strSearchTxt . "%' " + . "OR `name` LIKE '%" . $strSearchTxt . "%')"; } - // Row sorting + /* Row sorting */ $strOrderString = "ORDER BY `config_id`, `$preKeyField` $hidSortDir"; - if ($hidSortBy == 2) { + if ($hidSortBy === 2) { $strOrderString = "ORDER BY `config_id`, `alias` $hidSortDir"; } - // Count datasets - $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere " - . "AND `access_group` IN ($strAccess)"; + /* Count datasets */ + $intLineCount = 0; + /** @noinspection SqlResolve */ + $strSQL = "SELECT count(*) AS `number` FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere " + . "AND `access_group` IN ($strAccess)"; $booReturn1 = $myDBClass->hasSingleDataset($strSQL, $arrDataLinesCount); - if ($booReturn1 == false) { + if ($booReturn1 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { @@ -276,19 +321,19 @@ if ($chkModus == 'display') { $chkLimit = 0; } } - // Get datasets - $strSQL = "SELECT `id`, `$preKeyField`, `alias`, `register`, `active`, `config_id`, `access_group` " - . "FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess) " - . "$strOrderString LIMIT $chkLimit,".$SETS['common']['pagelines']; + /* Get datasets */ + $strSQL = "SELECT `id`, `$preKeyField`, `alias`, `register`, `active`, `config_id`, `access_group` " + . "FROM `$preTableName` WHERE $strDomainWhere $strSearchWhere AND `access_group` IN ($strAccess) " + . "$strOrderString LIMIT $chkLimit," . $SETS['common']['pagelines']; $booReturn2 = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - if ($booReturn2 == false) { + if ($booReturn2 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - // Process data + /* Process data */ $myContentClass->listData($mastertp, $arrDataLines, $intDataCount, $intLineCount, $preKeyField, 'alias'); } -// Show messages +/* Show messages */ $myContentClass->showMessages( $mastertp, $strErrorMessage, @@ -298,7 +343,7 @@ $myContentClass->showMessages( $strTimeInfoString, $intNoTime ); -// -// Process footer -// ============== -$myContentClass->showFooter($maintp, $setFileVersion); +/* +Process footer +*/ +$myContentClass->showFooter($maintp, $setFileVersion); \ No newline at end of file diff --git a/admin/tools.php b/admin/tools.php index 28c6ca1..773cd13 100644 --- a/admin/tools.php +++ b/admin/tools.php @@ -1,45 +1,47 @@ Application version string + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 6; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 6; $preContent = 'admin/mainpages.htm.tpl'; -// -// Include preprocessing file -// ========================== -require $preBasePath.'functions/prepend_adm.php'; -// -// Include content -// =============== +/* +Include preprocessing file +*/ +require $preBasePath . 'functions/prepend_adm.php'; +/* +Include content +*/ $conttp->setVariable('TITLE', translate('Different tools')); $conttp->setVariable('DESC', translate('Useful functions for data import, main configuration, daemon control, etc.')); $conttp->parse('main'); $conttp->show('main'); -// -// Include Footer -// ============== +/* +Include Footer +*/ $maintp->setVariable('VERSION_INFO', "NagiosQL $setFileVersion"); + . "target='_blank'>NagiosQL $setFileVersion"); $maintp->parse('footer'); -$maintp->show('footer'); +$maintp->show('footer'); \ No newline at end of file diff --git a/admin/user.php b/admin/user.php index 497cf73..5f80674 100644 --- a/admin/user.php +++ b/admin/user.php @@ -1,80 +1,115 @@ Application version string + * @var int $chkActive from prepend_adm.php -> Active checkbox + * @var string $chkModus from prepend_adm.php -> Form work mode + * @var int $chkDataId from prepend_adm.php -> Actual dataset id + * @var string $chkSelModify from prepend_adm.php -> Modification selection value + * @var int $hidSortBy from prepend_adm.php -> Sort data by + * @var string $hidSortDir from prepend_adm.php -> Sort data direction (ASC, DESC) + * @var int $chkLimit from prepend_adm.php / settings -> Data set count per page + * @var array $SETS Settings array + * @var int $intGlobalWriteAccess from prepend_content.php -> Global admin write access + * @var int $intWriteAccessId from prepend_content.php -> Admin write access to actual dataset id + * @var string $chkTfValue1 from prepend_content.php -> User name + * @var string $chkTfValue2 from prepend_content.php -> User description + * @var string $chkTfValue3 from prepend_content.php -> Password + * @var string $chkTfValue4 from prepend_content.php -> Password confirmation + * @var string $chkTfValue5 from prepend_content.php -> (hidden) old user name + * @var int $chkChbValue1 from prepend_content.php -> Admin rights checkbox + * @var int $chkChbValue2 from prepend_content.php -> Webserver authentification checkbox + * @var int $chkSelValue1 from prepend_content.php -> Language selector + * @var int $chkSelValue2 from prepend_content.php -> Standard domain selector + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 32; -$preContent = 'admin/user.htm.tpl'; -$preListTpl = 'admin/datalist_common.htm.tpl'; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 32; +$preContent = 'admin/user.htm.tpl'; +$preListTpl = 'admin/datalist_common.htm.tpl'; $preSearchSession = 'user'; -$preTableName = 'tbl_user'; -$preKeyField = 'username'; -$preAccess = 1; -$preFieldvars = 1; -$preNoAccessGrp = 1; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Add or modify data -// ================== -if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAccess == 0)) { - // Check password +$preTableName = 'tbl_user'; +$preKeyField = 'username'; +$preAccess = 1; +$preFieldvars = 1; +$preNoAccessGrp = 1; +$strErrorMessage = ''; +$strInfoMessage = ''; +$strConsistMessage = ''; +/* +Include preprocessing file +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Add or modify data +*/ +if ((($chkModus === 'insert') || ($chkModus === 'modify')) && ($intGlobalWriteAccess === 0)) { + /* Check password */ if ((($chkTfValue3 === $chkTfValue4) && (strlen($chkTfValue3) > 5)) || - (($chkModus == 'modify') && ($chkTfValue3 == ''))) { - if ($chkTfValue3 == '') { + (($chkModus === 'modify') && ($chkTfValue3 === ''))) { + if ($chkTfValue3 === '') { $strPasswd = ''; } else { $strPasswd = "`password`=MD5('$chkTfValue3'),"; } - // Grant admin rights - if ($chkTfValue5 == 'Admin') { - $chkTfValue1 = 'Admin'; - $chkActive = '1'; + /* Admin user cannot be renamed and must be active with full admin rights */ + if (strtolower($chkTfValue5) === 'admin') { + $chkTfValue1 = 'admin'; + $chkActive = '1'; $chkChbValue1 = '1'; } $strSQLx = "`$preTableName` SET `$preKeyField`='$chkTfValue1', `alias`='$chkTfValue2', $strPasswd " - . "`admin_enable`='$chkChbValue1', `wsauth`='$chkChbValue2', `active`='$chkActive', " - . "`language`='$chkSelValue1', `domain`='$chkSelValue2', `last_modified`=NOW()"; - if ($chkModus == 'insert') { - $strSQL = 'INSERT INTO ' .$strSQLx; + . "`admin_enable`='$chkChbValue1', `wsauth`='$chkChbValue2', `active`='$chkActive', " + . "`language`='$chkSelValue1', `domain`='$chkSelValue2', `last_modified`=NOW()"; + if ($chkModus === 'insert') { + $strSQL = 'INSERT INTO ' . $strSQLx; } else { - $strSQL = 'UPDATE ' .$strSQLx. ' WHERE `id`=' .$chkDataId; + $strSQL = 'UPDATE ' . $strSQLx . ' WHERE `id`=' . $chkDataId; } - if ($intWriteAccessId == 0) { - if (($chkTfValue1 != '') && ($chkTfValue2 != '')) { + if ($intWriteAccessId === 0) { + if (($chkTfValue1 !== '') && ($chkTfValue2 !== '')) { $intReturn = $myDataClass->dataInsert($strSQL, $intInsertId); - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); - if ($chkModus == 'insert') { - $myDataClass->writeLog(translate('New user added:'). ' ' .$chkTfValue1); + if ($chkModus === 'insert') { + $myDataClass->writeLog(translate('New user added:') . ' ' . $chkTfValue1); } - if ($chkModus == 'modify') { - $myDataClass->writeLog(translate('User modified:'). ' ' .$chkTfValue1); + if ($chkModus === 'modify') { + $myDataClass->writeLog(translate('User modified:') . ' ' . $chkTfValue1); } } } else { @@ -91,39 +126,31 @@ if ((($chkModus == 'insert') || ($chkModus == 'modify')) && ($intGlobalWriteAcce } $chkModus = 'display'; } -if ($chkModus != 'add') { +if ($chkModus !== 'add') { $chkModus = 'display'; } -// -// Singe data form -// =============== -if ($chkModus == 'add') { - // Process domain selection field - if (isset($arrModifyData['domain'])) { - $intFieldId = $arrModifyData['domain']; - } else { - $intFieldId = 1; - } +/* +Singe data form +*/ +if ($chkModus === 'add') { + /* Process domain selection field */ + $intFieldId = $arrModifyData['domain'] ?? 1; $intReturn1 = $myVisClass->parseSelectSimple('tbl_datadomain', 'domain', 'std_domain', 0, $intFieldId, 0); - if ($intReturn1 != 0) { + if ($intReturn1 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Process language selection field - if (isset($arrModifyData['language'])) { - $intFieldId = $arrModifyData['language']; - } else { - $intFieldId = 0; - } - if ($intFieldId == 0) { + /* Process language selection field */ + $intFieldId = $arrModifyData['language'] ?? 0; + if ($intFieldId === 0) { $intFieldId = $myDBClass->getFieldData('SELECT `id` FROM `tbl_language` ' - . "WHERE `locale`='".$_SESSION['SETS']['data']['locale']."'"); + . "WHERE `locale`='" . $_SESSION['SETS']['data']['locale'] . "'"); $intFieldId = (int)$intFieldId; } $intReturn2 = $myVisClass->parseSelectSimple('tbl_language', 'language', 'language_name', 0, $intFieldId); - if ($intReturn2 != 0) { + if ($intReturn2 !== 0) { $myVisClass->processMessage($myVisClass->strErrorMessage, $strErrorMessage); } - // Initial add/modify form definitions + /* Initial add/modify form definitions */ $myContentClass->addFormInit($conttp); $conttp->setVariable('TITLE', translate('User administration')); $conttp->setVariable('WSAUTH_DISABLE', 'disabled'); @@ -135,56 +162,58 @@ if ($chkModus == 'add') { $conttp->setVariable('LANG_WEBSERVER_AUTH', translate('Webserver authentification')); $conttp->setVariable('PASSWORD_MUST', 'class="inpmust"'); $conttp->setVariable('PASSWORD_MUST_STAR', '*'); - // If webserver authetification is enabled - show option field - if (isset($SETS['security']['wsauth']) && ($SETS['security']['wsauth'] == 1)) { - $conttp->setVariable('WSAUTH_DISABLE', ''); + /* If webserver authetification is enabled - show option field */ + if (isset($SETS['security']['wsauth']) && ((int)$SETS['security']['wsauth'] === 1)) { + $conttp->setVariable('WSAUTH_DISABLE'); } - // Insert data from database in "modify" mode - if (isset($arrModifyData) && ($chkSelModify == 'modify')) { - // Process data + /* Insert data from database in "modify" mode */ + if (isset($arrModifyData) && ($chkSelModify === 'modify')) { + /* Process data */ $myContentClass->addInsertData($conttp, $arrModifyData, 0, ''); - // Webserver authentification - $conttp->setVariable('WSAUTH_CHECKED', ''); - if ($arrModifyData['wsauth'] == 1) { + /* Webserver authentification */ + $conttp->setVariable('WSAUTH_CHECKED'); + if ((int)$arrModifyData['wsauth'] === 1) { $conttp->setVariable('WSAUTH_CHECKED', 'checked'); } - // Object based group administration - $conttp->setVariable('ADMINENABLE_CHECKED', ''); - if ($arrModifyData['admin_enable'] == 1) { + /* Object based group administration */ + $conttp->setVariable('ADMINENABLE_CHECKED'); + if ((int)$arrModifyData['admin_enable'] === 1) { $conttp->setVariable('ADMINENABLE_CHECKED', 'checked'); } - // Admin rules - if ($arrModifyData[$preKeyField] == 'Admin') { + /* Admin rules */ + if ((string)$arrModifyData[$preKeyField] === 'Admin') { $conttp->setVariable('NAME_DISABLE', 'disabled'); $conttp->setVariable('ACT_DISABLE', 'disabled'); $conttp->setVariable('WSAUTH_DISABLE', 'disabled'); $conttp->setVariable('ADMINENABLE_DISABLE', 'disabled'); $conttp->setVariable('ADMINENABLE_CHECKED', 'checked'); } - $conttp->setVariable('PASSWORD_MUST', ''); - $conttp->setVariable('PASSWORD_MUST_STAR', ''); + $conttp->setVariable('PASSWORD_MUST'); + $conttp->setVariable('PASSWORD_MUST_STAR'); } $conttp->parse('datainsert'); $conttp->show('datainsert'); } -// -// Data table -// ========== -if ($chkModus == 'display') { - // Initial list view definitions +/* +Data list view +*/ +if ($chkModus === 'display') { + /* Initial list view definitions */ $myContentClass->listViewInit($mastertp); $mastertp->setVariable('TITLE', translate('User administration')); $mastertp->setVariable('FIELD_1', translate('Username')); $mastertp->setVariable('FIELD_2', translate('Description')); - // Row sorting + /* Row sorting */ $strOrderString = "ORDER BY `$preKeyField` $hidSortDir"; - if ($hidSortBy == 2) { + if ($hidSortBy === 2) { $strOrderString = "ORDER BY `alias` $hidSortDir"; } - // Count datasets - $strSQL = "SELECT count(*) AS `number` FROM `$preTableName`"; + /* Count datasets */ + $intLineCount = 0; + /** @noinspection SqlResolve */ + $strSQL = "SELECT count(*) AS `number` FROM `$preTableName`"; $booReturn1 = $myDBClass->hasSingleDataset($strSQL, $arrDataLinesCount); - if ($booReturn1 == false) { + if ($booReturn1 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } else { @@ -193,20 +222,20 @@ if ($chkModus == 'display') { $chkLimit = 0; } } - // Get datasets - $strSQL = "SELECT `id`, `$preKeyField`, `alias`, `active`, `nodelete` " - . "FROM `$preTableName` $strOrderString LIMIT $chkLimit,".$SETS['common']['pagelines']; + /* Get datasets */ + $strSQL = "SELECT `id`, `$preKeyField`, `alias`, `active`, `nodelete` " + . "FROM `$preTableName` $strOrderString LIMIT $chkLimit," . $SETS['common']['pagelines']; $booReturn2 = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - if ($booReturn2 == false) { + if ($booReturn2 === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - // Process data + /* Process data */ $myContentClass->listData($mastertp, $arrDataLines, $intDataCount, $intLineCount, $preKeyField, 'alias'); } -// Show messages +/* Show messages */ $myContentClass->showMessages($mastertp, $strErrorMessage, $strInfoMessage, $strConsistMessage, array(), '', 1); -// -// Process footer -// ============== -$myContentClass->showFooter($maintp, $setFileVersion); +/* +Process footer +*/ +$myContentClass->showFooter($maintp, $setFileVersion); \ No newline at end of file diff --git a/admin/variabledefinitions.php b/admin/variabledefinitions.php index 6d20378..834018a 100644 --- a/admin/variabledefinitions.php +++ b/admin/variabledefinitions.php @@ -1,165 +1,192 @@ array('default' => 0))); -$chkMode = filter_input(INPUT_GET, 'mode', FILTER_SANITIZE_STRING); -$chkDef = filter_input(INPUT_GET, 'def', FILTER_SANITIZE_STRING); -$chkRange = filter_input(INPUT_GET, 'range', FILTER_SANITIZE_STRING); -$chkLinkTab = filter_input(INPUT_GET, 'linktab', FILTER_SANITIZE_STRING); -if (get_magic_quotes_gpc() == 0) { - $chkDef = addslashes($chkDef); - $chkRange = addslashes($chkRange); -} -// -// Get data -// ======== -if ($chkLinkTab != '') { - $strSQL = 'SELECT * FROM `tbl_variabledefinition` LEFT JOIN `' .$chkLinkTab. '` ON `id`=`idSlave` ' . - "WHERE `idMaster`=$chkDataId ORDER BY `name`"; +/* +Include preprocessing file +*/ +require $preBasePath . 'functions/prepend_adm.php'; +/* +Process post parameters +*/ +$chkDataId = filter_input(INPUT_GET, 'dataId', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); +$chkMode = filter_input(INPUT_GET, 'mode'); +$chkDef = filter_input(INPUT_GET, 'def'); +$chkRange = filter_input(INPUT_GET, 'range'); +$chkLinkTab = filter_input(INPUT_GET, 'linktab'); +/* +Get data +*/ +if ($chkLinkTab !== '') { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `tbl_variabledefinition` LEFT JOIN `' . $chkLinkTab . '` ON `id`=`idSlave` ' . + "WHERE `idMaster`=$chkDataId ORDER BY `name`"; $booReturn = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - // - // Store data to session - // ============================ - if ($chkMode == '') { - $arrTemp = array(); + /* Store data to session */ + if ($chkMode === null) { + $arrTemp = array(); $_SESSION['variabledefinition'] = array(); - if ($booReturn && ($intDataCount != 0)) { + if ($booReturn && ($intDataCount !== 0)) { foreach ($arrDataLines as $elem) { - $arrTemp['id'] = $elem['id']; - $arrTemp['definition'] = addslashes($elem['name']); - $arrTemp['range'] = addslashes($elem['value']); - $arrTemp['status'] = 0; + $arrTemp['id'] = $elem['id']; + $arrTemp['definition'] = addslashes($elem['name']); + $arrTemp['range'] = addslashes($elem['value']); + $arrTemp['status'] = 0; $_SESSION['variabledefinition'][] = $arrTemp; } } } } -// -// Add mode -// ======== -if ($chkMode == 'add') { +/* +Add mode +*/ +if ($chkMode === 'add') { $arrTemp = array(); if (isset($_SESSION['variabledefinition']) && is_array($_SESSION['variabledefinition'])) { $intCheck = 0; foreach ($_SESSION['variabledefinition'] as $key => $elem) { - if (($elem['definition'] == $chkDef) && ($elem['status'] == 0)) { + if (($elem['definition'] === $chkDef) && ((int)$elem['status'] === 0)) { $_SESSION['variabledefinition'][$key]['definition'] = $chkDef; $_SESSION['variabledefinition'][$key]['range'] = $chkRange; $intCheck = 1; } } - if ($intCheck == 0) { - $arrTemp['id'] = 0; - $arrTemp['definition'] = $chkDef; - $arrTemp['range'] = $chkRange; - $arrTemp['status'] = 0; + if ($intCheck === 0) { + $arrTemp['id'] = 0; + $arrTemp['definition'] = $chkDef; + $arrTemp['range'] = $chkRange; + $arrTemp['status'] = 0; $_SESSION['variabledefinition'][] = $arrTemp; } } else { - $arrTemp['id'] = 0; - $arrTemp['definition'] = $chkDef; - $arrTemp['range'] = $chkRange; - $arrTemp['status'] = 0; + $arrTemp['id'] = 0; + $arrTemp['definition'] = $chkDef; + $arrTemp['range'] = $chkRange; + $arrTemp['status'] = 0; $_SESSION['variabledefinition'][] = $arrTemp; } } -// -// Deletion mode -// ============= -if ($chkMode == 'del' && isset($_SESSION['variabledefinition']) && is_array($_SESSION['variabledefinition'])) { +/* +Deletion mode +*/ +if ($chkMode === 'del' && isset($_SESSION['variabledefinition']) && is_array($_SESSION['variabledefinition'])) { foreach ($_SESSION['variabledefinition'] as $key => $elem) { - if (($elem['definition'] == $chkDef) && ($elem['status'] == 0)) { + if (($elem['definition'] === $chkDef) && ((int)$elem['status'] === 0)) { $_SESSION['variabledefinition'][$key]['status'] = 1; } } } ?> - - + + None - - - - - - - - + + + + + + + + if ($intCounter === 0) { + ?> + + + + + + - -
<?php
-                echo translate('Modify'); ?> <?php
-                echo translate('Delete'); ?>
<?php
+                        echo translate('Modify'); ?> <?php
+                                                                                                    echo translate('Delete'); ?> +
  
   
+ + \ No newline at end of file diff --git a/admin/verify.php b/admin/verify.php index b56792a..4063cb5 100644 --- a/admin/verify.php +++ b/admin/verify.php @@ -1,575 +1,565 @@ Application version string + * @var string $prePageKey from prepend_adm.php -> Menu group id + * @var int $chkDomainId from prepend_adm.php -> Configuration domain id + * @var string $chkButValue1 from prepend_content.php -> Write monitoring data button + * @var string $chkButValue2 from prepend_content.php -> Write additional data button + * @var string $chkButValue3 from prepend_content.php -> Check configuration button + * @var string $chkButValue4 from prepend_content.php -> Restart Nagios button + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= -$prePageId = 30; -$preContent = 'admin/verify.htm.tpl'; -$preAccess = 1; +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ +$prePageId = 30; +$preContent = 'admin/verify.htm.tpl'; +$preAccess = 1; $preFieldvars = 1; -$intModus = 0; -$strInfo = ''; -// -// Include preprocessing files -// =========================== -require $preBasePath.'functions/prepend_adm.php'; -require $preBasePath.'functions/prepend_content.php'; -// -// Get configuration set ID -// ======================== +$intModus = 0; +$strInfo = ''; +$strErrorMessage = ''; +$strInfoMessage = ''; +/* +Include preprocessing files +*/ +require $preBasePath . 'functions/prepend_adm.php'; +require $preBasePath . 'functions/prepend_content.php'; +/* +Get configuration set ID +*/ +$intMethod = 0; +$strMethod = ''; $myConfigClass->getConfigTargets($arrConfigSet); -$intConfigId = $arrConfigSet[0]; -$myConfigClass->getConfigValues($intConfigId, 'method', $intMethod); -// -// Process form variables -// ====================== +$intConfigId = (int)$arrConfigSet[0]; +if ($myConfigClass->getConfigValues($intConfigId, 'method', $strMethod) === 0) { + $intMethod = (int)$strMethod; +} +/* +Process form variables +*/ $intProcessError = 0; -$intError = 0; -// Write monitoring data -if ($chkButValue1 != '') { - $strNoData = translate('Writing of the configuration failed - no dataset or not activated dataset found'). '::'; - // Write host configuration - $strSQL1 = "SELECT `id` FROM `tbl_host` WHERE `config_id` = $chkDomainId AND `active`='1'"; +$intError = 0; +/* Write monitoring data */ +if (($chkButValue1 !== '') && ($chkButValue1 !== null)) { + $strNoData = translate('Writing of the configuration failed - no dataset or not activated dataset found') . '::'; + /* Write host configuration */ + $strSQL1 = "SELECT `id` FROM `tbl_host` WHERE `config_id` = $chkDomainId AND `active`='1'"; $myDBClass->hasDataArray($strSQL1, $arrData, $intDataCount); - if ($intDataCount != 0) { + if ($intDataCount !== 0) { $intError = 0; foreach ($arrData as $data) { $intReturn = $myConfigClass->createConfigSingle('tbl_host', $data['id']); $intError += $intReturn; } } - if (($intError == 0) && ($intDataCount != 0)) { - $myVisClass->processMessage(translate('Write host configurations'). ' ...', $strInfo); - $myVisClass->processMessage('Hosts: ' .translate('Configuration file successfully written!'), $strInfo); - } elseif ($intDataCount != 0) { - $myVisClass->processMessage('Hosts: ' .translate('Cannot open/overwrite the configuration file (check the ' + if (($intError === 0) && ($intDataCount !== 0)) { + $myVisClass->processMessage(translate('Write host configurations') . ' ...', $strInfo); + $myVisClass->processMessage('Hosts: ' . translate('Configuration file successfully written!'), $strInfo); + } elseif ($intDataCount !== 0) { + $myVisClass->processMessage('Hosts: ' . translate('Cannot open/overwrite the configuration file (check the ' . 'permissions)!'), $strErrorMessage); $intProcessError = 1; } else { - $myVisClass->processMessage('Hosts: ' .translate('No configuration items defined!'), $strErrorMessage); + $myVisClass->processMessage('Hosts: ' . translate('No configuration items defined!'), $strErrorMessage); $intProcessError = 1; } - // Write service configuration - $strSQL = 'SELECT `id`, `config_name` ' + /* Write service configuration */ + $strSQL = 'SELECT `id`, `config_name` ' . "FROM `tbl_service` WHERE `config_id` = $chkDomainId AND `active`='1' GROUP BY `config_name`"; $myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($intDataCount != 0) { + if ($intDataCount !== 0) { $intError = 0; foreach ($arrData as $data) { $intReturn = $myConfigClass->createConfigSingle('tbl_service', $data['id']); $intError += $intReturn; } } - if (($intError == 0) && ($intDataCount != 0)) { - $myVisClass->processMessage(translate('Write service configurations'). ' ...', $strInfo); - $myVisClass->processMessage('Services: ' .translate('Configuration file successfully written!'), $strInfo); - } elseif ($intDataCount != 0) { - $myVisClass->processMessage('Services: ' .translate('Cannot open/overwrite the configuration file (check the ' + if (($intError === 0) && ($intDataCount !== 0)) { + $myVisClass->processMessage(translate('Write service configurations') . ' ...', $strInfo); + $myVisClass->processMessage('Services: ' . translate('Configuration file successfully written!'), $strInfo); + } elseif ($intDataCount !== 0) { + $myVisClass->processMessage('Services: ' . translate('Cannot open/overwrite the configuration file (check the ' . 'permissions)!'), $strErrorMessage); $intProcessError = 1; } else { - $myVisClass->processMessage('Services: ' .translate('No configuration items defined!'), $strErrorMessage); + $myVisClass->processMessage('Services: ' . translate('No configuration items defined!'), $strErrorMessage); $intProcessError = 1; } - // Write hostgroup configuration + /* Write hostgroup configuration */ $intReturn1 = $myConfigClass->createConfig('tbl_hostgroup'); - if ($intReturn1 == 0) { - $myVisClass->processMessage(translate('Write'). ' hostgroups.cfg ...', $strInfo); - $myVisClass->processMessage('Hostgroups: ' .$myConfigClass->strInfoMessage, $strInfo); + if ($intReturn1 === 0) { + $myVisClass->processMessage(translate('Write') . ' hostgroups.cfg ...', $strInfo); + $myVisClass->processMessage('Hostgroups: ' . $myConfigClass->strInfoMessage, $strInfo); + } else if ($myConfigClass->strErrorMessage === $strNoData) { + $myVisClass->processMessage(translate('Write') . ' hostgroups.cfg ...', $strInfo); + $myVisClass->processMessage('Hostgroups: ' . translate('No dataset or no activated dataset found - empty ' + . 'configuration written') . '::', $strInfo); } else { - if ($myConfigClass->strErrorMessage == $strNoData) { - $myVisClass->processMessage(translate('Write'). ' hostgroups.cfg ...', $strInfo); - $myVisClass->processMessage('Hostgroups: ' .translate('No dataset or no activated dataset found - empty ' - . 'configuration written'). '::', $strInfo); - } else { - $myVisClass->processMessage('Hostgroups: ' .$myConfigClass->strErrorMessage, $strErrorMessage); - $intProcessError = 1; - } + $myVisClass->processMessage('Hostgroups: ' . $myConfigClass->strErrorMessage, $strErrorMessage); + $intProcessError = 1; } - // Write servicegroup configuration + /* Write servicegroup configuration */ $intReturn2 = $myConfigClass->createConfig('tbl_servicegroup'); - if ($intReturn2 == 0) { - $myVisClass->processMessage(translate('Write'). ' servicegroups.cfg ...', $strInfo); - $myVisClass->processMessage('Servicegroups: ' .$myConfigClass->strInfoMessage, $strInfo); + if ($intReturn2 === 0) { + $myVisClass->processMessage(translate('Write') . ' servicegroups.cfg ...', $strInfo); + $myVisClass->processMessage('Servicegroups: ' . $myConfigClass->strInfoMessage, $strInfo); + } else if ($myConfigClass->strErrorMessage === $strNoData) { + $myVisClass->processMessage(translate('Write') . ' servicegroups.cfg ...', $strInfo); + $myVisClass->processMessage('Servicegroups: ' . translate('No dataset or no activated dataset found - empty ' + . 'configuration written') . '::', $strInfo); } else { - if ($myConfigClass->strErrorMessage == $strNoData) { - $myVisClass->processMessage(translate('Write'). ' servicegroups.cfg ...', $strInfo); - $myVisClass->processMessage('Servicegroups: ' .translate('No dataset or no activated dataset found - empty ' - . 'configuration written'). '::', $strInfo); - } else { - $myVisClass->processMessage('Servicegroups: ' .$myConfigClass->strErrorMessage, $strErrorMessage); - $intProcessError = 1; - } + $myVisClass->processMessage('Servicegroups: ' . $myConfigClass->strErrorMessage, $strErrorMessage); + $intProcessError = 1; } - // Write hosttemplate configuration + /* Write hosttemplate configuration */ $intReturn3 = $myConfigClass->createConfig('tbl_hosttemplate'); - if ($intReturn3 == 0) { - $myVisClass->processMessage(translate('Write'). ' hosttemplates.cfg ...', $strInfo); - $myVisClass->processMessage('Hosttemplates: ' .$myConfigClass->strInfoMessage, $strInfo); + if ($intReturn3 === 0) { + $myVisClass->processMessage(translate('Write') . ' hosttemplates.cfg ...', $strInfo); + $myVisClass->processMessage('Hosttemplates: ' . $myConfigClass->strInfoMessage, $strInfo); + } else if ($myConfigClass->strErrorMessage === $strNoData) { + $myVisClass->processMessage(translate('Write') . ' hosttemplates.cfg ...', $strInfo); + $myVisClass->processMessage('Hosttemplates: ' . translate('No dataset or no activated dataset found - empty ' + . 'configuration written') . '::', $strInfo); } else { - if ($myConfigClass->strErrorMessage == $strNoData) { - $myVisClass->processMessage(translate('Write'). ' hosttemplates.cfg ...', $strInfo); - $myVisClass->processMessage('Hosttemplates: ' .translate('No dataset or no activated dataset found - empty ' - . 'configuration written'). '::', $strInfo); - } else { - $myVisClass->processMessage('Hosttemplates: ' .$myConfigClass->strErrorMessage, $strErrorMessage); - $intProcessError = 1; - } + $myVisClass->processMessage('Hosttemplates: ' . $myConfigClass->strErrorMessage, $strErrorMessage); + $intProcessError = 1; } - // Write servicetemplate configuration + /* Write servicetemplate configuration */ $intReturn4 = $myConfigClass->createConfig('tbl_servicetemplate'); - if ($intReturn4 == 0) { - $myVisClass->processMessage(translate('Write'). ' servicetemplates.cfg ...', $strInfo); - $myVisClass->processMessage('Servicetemplates: ' .$myConfigClass->strInfoMessage, $strInfo); + if ($intReturn4 === 0) { + $myVisClass->processMessage(translate('Write') . ' servicetemplates.cfg ...', $strInfo); + $myVisClass->processMessage('Servicetemplates: ' . $myConfigClass->strInfoMessage, $strInfo); + } else if ($myConfigClass->strErrorMessage === $strNoData) { + $myVisClass->processMessage(translate('Write') . ' servicetemplates.cfg ...', $strInfo); + $myVisClass->processMessage('Servicetemplates: ' . translate('No dataset or no activated dataset found - ' + . 'empty configuration written') . '::', $strInfo); } else { - if ($myConfigClass->strErrorMessage == $strNoData) { - $myVisClass->processMessage(translate('Write'). ' servicetemplates.cfg ...', $strInfo); - $myVisClass->processMessage('Servicetemplates: ' .translate('No dataset or no activated dataset found - ' - . 'empty configuration written'). '::', $strInfo); - } else { - $myVisClass->processMessage('Servicetemplates: ' .$myConfigClass->strErrorMessage, $strErrorMessage); - $intProcessError = 1; - } + $myVisClass->processMessage('Servicetemplates: ' . $myConfigClass->strErrorMessage, $strErrorMessage); + $intProcessError = 1; } } -// Write additional data -if ($chkButValue2 != '') { - $strNoData = translate('Writing of the configuration failed - no dataset or not activated dataset found'). '::'; - // Write timeperiod configuration +/* Write additional data */ +if (($chkButValue2 !== '') && ($chkButValue2 !== null)) { + $strNoData = translate('Writing of the configuration failed - no dataset or not activated dataset found') . '::'; + /* Write timeperiod configuration */ $intReturn5 = $myConfigClass->createConfig('tbl_timeperiod'); - if ($intReturn5 == 0) { - $myVisClass->processMessage(translate('Write'). ' timeperiods.cfg ...', $strInfo); - $myVisClass->processMessage('Timeperiods: ' .$myConfigClass->strInfoMessage, $strInfo); + if ($intReturn5 === 0) { + $myVisClass->processMessage(translate('Write') . ' timeperiods.cfg ...', $strInfo); + $myVisClass->processMessage('Timeperiods: ' . $myConfigClass->strInfoMessage, $strInfo); } else { - $myVisClass->processMessage('Timeperiods: ' .$myConfigClass->strErrorMessage, $strErrorMessage); + $myVisClass->processMessage('Timeperiods: ' . $myConfigClass->strErrorMessage, $strErrorMessage); $intProcessError = 1; } - // Write command configuration + /* Write command configuration */ $intReturn6 = $myConfigClass->createConfig('tbl_command'); - if ($intReturn6 == 0) { - $myVisClass->processMessage(translate('Write'). ' commands.cfg ...', $strInfo); - $myVisClass->processMessage('Commands: ' .$myConfigClass->strInfoMessage, $strInfo); + if ($intReturn6 === 0) { + $myVisClass->processMessage(translate('Write') . ' commands.cfg ...', $strInfo); + $myVisClass->processMessage('Commands: ' . $myConfigClass->strInfoMessage, $strInfo); } else { - $myVisClass->processMessage('Commands: ' .$myConfigClass->strErrorMessage, $strErrorMessage); + $myVisClass->processMessage('Commands: ' . $myConfigClass->strErrorMessage, $strErrorMessage); $intProcessError = 1; } - // Write contact configuration + /* Write contact configuration */ $intReturn7 = $myConfigClass->createConfig('tbl_contact'); - if ($intReturn7 == 0) { - $myVisClass->processMessage(translate('Write'). ' contacts.cfg ...', $strInfo); - $myVisClass->processMessage('Contacts: ' .$myConfigClass->strInfoMessage, $strInfo); + if ($intReturn7 === 0) { + $myVisClass->processMessage(translate('Write') . ' contacts.cfg ...', $strInfo); + $myVisClass->processMessage('Contacts: ' . $myConfigClass->strInfoMessage, $strInfo); } else { - $myVisClass->processMessage('Contacts: ' .$myConfigClass->strErrorMessage, $strErrorMessage); + $myVisClass->processMessage('Contacts: ' . $myConfigClass->strErrorMessage, $strErrorMessage); $intProcessError = 1; } - // Write contactgroup configuration + /* Write contactgroup configuration */ $intReturn8 = $myConfigClass->createConfig('tbl_contactgroup'); - if ($intReturn8 == 0) { - $myVisClass->processMessage(translate('Write'). ' contactgroups.cfg ...', $strInfo); - $myVisClass->processMessage('Contactgroups: ' .$myConfigClass->strInfoMessage, $strInfo); + if ($intReturn8 === 0) { + $myVisClass->processMessage(translate('Write') . ' contactgroups.cfg ...', $strInfo); + $myVisClass->processMessage('Contactgroups: ' . $myConfigClass->strInfoMessage, $strInfo); } else { - $myVisClass->processMessage('Contactgroups: ' .$myConfigClass->strErrorMessage, $strErrorMessage); + $myVisClass->processMessage('Contactgroups: ' . $myConfigClass->strErrorMessage, $strErrorMessage); $intProcessError = 1; } - // Write contacttemplate configuration + /* Write contacttemplate configuration */ $intReturn9 = $myConfigClass->createConfig('tbl_contacttemplate'); - if ($intReturn9 == 0) { - $myVisClass->processMessage(translate('Write'). ' contacttemplates.cfg ...', $strInfo); - $myVisClass->processMessage('Contacttemplates: ' .$myConfigClass->strInfoMessage, $strInfo); + if ($intReturn9 === 0) { + $myVisClass->processMessage(translate('Write') . ' contacttemplates.cfg ...', $strInfo); + $myVisClass->processMessage('Contacttemplates: ' . $myConfigClass->strInfoMessage, $strInfo); + } else if ($myConfigClass->strErrorMessage === $strNoData) { + $myVisClass->processMessage(translate('Write') . ' contacttemplates.cfg ...', $strInfo); + $myVisClass->processMessage('Contacttemplates: ' . translate('No dataset or no activated dataset found - ' + . 'empty configuration written') . '::', $strInfo); } else { - if ($myConfigClass->strErrorMessage == $strNoData) { - $myVisClass->processMessage(translate('Write'). ' contacttemplates.cfg ...', $strInfo); - $myVisClass->processMessage('Contacttemplates: ' .translate('No dataset or no activated dataset found - ' - . 'empty configuration written'). '::', $strInfo); - } else { - $myVisClass->processMessage('Contacttemplates: ' .$myConfigClass->strErrorMessage, $strErrorMessage); - $intProcessError = 1; - } + $myVisClass->processMessage('Contacttemplates: ' . $myConfigClass->strErrorMessage, $strErrorMessage); + $intProcessError = 1; } - // Write servicedependency configuration + /* Write servicedependency configuration */ $intReturn10 = $myConfigClass->createConfig('tbl_servicedependency'); - if ($intReturn10 == 0) { - $myVisClass->processMessage(translate('Write'). ' servicedependencies.cfg ...', $strInfo); - $myVisClass->processMessage('Servicedependencies: ' .$myConfigClass->strInfoMessage, $strInfo); + if ($intReturn10 === 0) { + $myVisClass->processMessage(translate('Write') . ' servicedependencies.cfg ...', $strInfo); + $myVisClass->processMessage('Servicedependencies: ' . $myConfigClass->strInfoMessage, $strInfo); + } else if ($myConfigClass->strErrorMessage === $strNoData) { + $myVisClass->processMessage(translate('Write') . ' servicedependencies.cfg ...', $strInfo); + $myVisClass->processMessage('Servicedependencies: ' . translate('No dataset or no activated dataset found - ' + . 'empty configuration written') . '::', $strInfo); } else { - if ($myConfigClass->strErrorMessage == $strNoData) { - $myVisClass->processMessage(translate('Write'). ' servicedependencies.cfg ...', $strInfo); - $myVisClass->processMessage('Servicedependencies: ' .translate('No dataset or no activated dataset found - ' - . 'empty configuration written'). '::', $strInfo); - } else { - $myVisClass->processMessage('Servicedependencies: ' .$myConfigClass->strErrorMessage, $strErrorMessage); - $intProcessError = 1; - } + $myVisClass->processMessage('Servicedependencies: ' . $myConfigClass->strErrorMessage, $strErrorMessage); + $intProcessError = 1; } - // Write hostdependency configuration + /* Write hostdependency configuration */ $intReturn11 = $myConfigClass->createConfig('tbl_hostdependency'); - if ($intReturn11 == 0) { - $myVisClass->processMessage(translate('Write'). ' hostdependencies.cfg ...', $strInfo); - $myVisClass->processMessage('Hostdependencies: ' .$myConfigClass->strInfoMessage, $strInfo); + if ($intReturn11 === 0) { + $myVisClass->processMessage(translate('Write') . ' hostdependencies.cfg ...', $strInfo); + $myVisClass->processMessage('Hostdependencies: ' . $myConfigClass->strInfoMessage, $strInfo); + } else if ($myConfigClass->strErrorMessage === $strNoData) { + $myVisClass->processMessage(translate('Write') . ' hostdependencies.cfg ...', $strInfo); + $myVisClass->processMessage('Hostdependencies: ' . translate('No dataset or no activated dataset found - ' + . 'empty configuration written') . '::', $strInfo); } else { - if ($myConfigClass->strErrorMessage == $strNoData) { - $myVisClass->processMessage(translate('Write'). ' hostdependencies.cfg ...', $strInfo); - $myVisClass->processMessage('Hostdependencies: ' .translate('No dataset or no activated dataset found - ' - . 'empty configuration written'). '::', $strInfo); - } else { - $myVisClass->processMessage('Hostdependencies: ' .$myConfigClass->strErrorMessage, $strErrorMessage); - $intProcessError = 1; - } + $myVisClass->processMessage('Hostdependencies: ' . $myConfigClass->strErrorMessage, $strErrorMessage); + $intProcessError = 1; } - // Write serviceescalation configuration + /* Write serviceescalation configuration */ $intReturn12 = $myConfigClass->createConfig('tbl_serviceescalation'); - if ($intReturn12 == 0) { - $myVisClass->processMessage(translate('Write'). ' serviceescalations.cfg ...', $strInfo); - $myVisClass->processMessage('Serviceescalations: ' .$myConfigClass->strInfoMessage, $strInfo); + if ($intReturn12 === 0) { + $myVisClass->processMessage(translate('Write') . ' serviceescalations.cfg ...', $strInfo); + $myVisClass->processMessage('Serviceescalations: ' . $myConfigClass->strInfoMessage, $strInfo); + } else if ($myConfigClass->strErrorMessage === $strNoData) { + $myVisClass->processMessage(translate('Write') . ' serviceescalations.cfg ...', $strInfo); + $myVisClass->processMessage('Serviceescalations: ' . translate('No dataset or no activated dataset found - ' + . 'empty configuration written') . '::', $strInfo); } else { - if ($myConfigClass->strErrorMessage == $strNoData) { - $myVisClass->processMessage(translate('Write'). ' serviceescalations.cfg ...', $strInfo); - $myVisClass->processMessage('Serviceescalations: ' .translate('No dataset or no activated dataset found - ' - . 'empty configuration written'). '::', $strInfo); - } else { - $myVisClass->processMessage('Serviceescalations: ' .$myConfigClass->strErrorMessage, $strErrorMessage); - $intProcessError = 1; - } + $myVisClass->processMessage('Serviceescalations: ' . $myConfigClass->strErrorMessage, $strErrorMessage); + $intProcessError = 1; } - // Write hostescalation configuration + /* Write hostescalation configuration */ $intReturn13 = $myConfigClass->createConfig('tbl_hostescalation'); - if ($intReturn13 == 0) { - $myVisClass->processMessage(translate('Write'). ' hostescalations.cfg ...', $strInfo); - $myVisClass->processMessage('Hostescalations: ' .$myConfigClass->strInfoMessage, $strInfo); + if ($intReturn13 === 0) { + $myVisClass->processMessage(translate('Write') . ' hostescalations.cfg ...', $strInfo); + $myVisClass->processMessage('Hostescalations: ' . $myConfigClass->strInfoMessage, $strInfo); + } else if ($myConfigClass->strErrorMessage === $strNoData) { + $myVisClass->processMessage(translate('Write') . ' hostescalations.cfg ...', $strInfo); + $myVisClass->processMessage('Hostescalations: ' . translate('No dataset or no activated dataset found - ' + . 'empty configuration written') . '::', $strInfo); } else { - if ($myConfigClass->strErrorMessage == $strNoData) { - $myVisClass->processMessage(translate('Write'). ' hostescalations.cfg ...', $strInfo); - $myVisClass->processMessage('Hostescalations: ' .translate('No dataset or no activated dataset found - ' - . 'empty configuration written'). '::', $strInfo); - } else { - $myVisClass->processMessage('Hostescalations: ' .$myConfigClass->strErrorMessage, $strErrorMessage); - $intProcessError = 1; - } + $myVisClass->processMessage('Hostescalations: ' . $myConfigClass->strErrorMessage, $strErrorMessage); + $intProcessError = 1; } - // Write serviceextinfo configuration + /* Write serviceextinfo configuration */ $intReturn14 = $myConfigClass->createConfig('tbl_serviceextinfo'); - if ($intReturn14 == 0) { - $myVisClass->processMessage(translate('Write'). ' serviceextinfo.cfg ...', $strInfo); - $myVisClass->processMessage('Serviceextinfo: ' .$myConfigClass->strInfoMessage, $strInfo); + if ($intReturn14 === 0) { + $myVisClass->processMessage(translate('Write') . ' serviceextinfo.cfg ...', $strInfo); + $myVisClass->processMessage('Serviceextinfo: ' . $myConfigClass->strInfoMessage, $strInfo); + } else if ($myConfigClass->strErrorMessage === $strNoData) { + $myVisClass->processMessage(translate('Write') . ' serviceextinfo.cfg ...', $strInfo); + $myVisClass->processMessage('Serviceextinfo: ' . translate('No dataset or no activated dataset found - ' + . 'empty configuration written') . '::', $strInfo); } else { - if ($myConfigClass->strErrorMessage == $strNoData) { - $myVisClass->processMessage(translate('Write'). ' serviceextinfo.cfg ...', $strInfo); - $myVisClass->processMessage('Serviceextinfo: ' .translate('No dataset or no activated dataset found - ' - . 'empty configuration written'). '::', $strInfo); - } else { - $myVisClass->processMessage('Serviceextinfo: ' .$myConfigClass->strErrorMessage, $strErrorMessage); - $intProcessError = 1; - } + $myVisClass->processMessage('Serviceextinfo: ' . $myConfigClass->strErrorMessage, $strErrorMessage); + $intProcessError = 1; } - // Write hostextinfo configuration + /* Write hostextinfo configuration */ $intReturn15 = $myConfigClass->createConfig('tbl_hostextinfo'); - if ($intReturn15 == 0) { - $myVisClass->processMessage(translate('Write'). ' hostextinfo.cfg ...', $strInfo); - $myVisClass->processMessage('Hostextinfo: ' .$myConfigClass->strInfoMessage, $strInfo); + if ($intReturn15 === 0) { + $myVisClass->processMessage(translate('Write') . ' hostextinfo.cfg ...', $strInfo); + $myVisClass->processMessage('Hostextinfo: ' . $myConfigClass->strInfoMessage, $strInfo); + } else if ($myConfigClass->strErrorMessage === $strNoData) { + $myVisClass->processMessage(translate('Write') . ' hostextinfo.cfg ...', $strInfo); + $myVisClass->processMessage('Hostextinfo: ' . translate('No dataset or no activated dataset found - empty ' + . 'configuration written') . '::', $strInfo); } else { - if ($myConfigClass->strErrorMessage == $strNoData) { - $myVisClass->processMessage(translate('Write'). ' hostextinfo.cfg ...', $strInfo); - $myVisClass->processMessage('Hostextinfo: ' .translate('No dataset or no activated dataset found - empty ' - . 'configuration written'). '::', $strInfo); - } else { - $myVisClass->processMessage('Hostextinfo: ' .$myConfigClass->strErrorMessage, $strErrorMessage); - $intProcessError = 1; - } + $myVisClass->processMessage('Hostextinfo: ' . $myConfigClass->strErrorMessage, $strErrorMessage); + $intProcessError = 1; } } -// Check configuration -if ($chkButValue3 != '') { +/* Check configuration */ +if (($chkButValue3 !== '') && ($chkButValue3 !== null)) { $myConfigClass->getConfigValues($intConfigId, 'binaryfile', $strBinary); $myConfigClass->getConfigValues($intConfigId, 'basedir', $strBaseDir); $myConfigClass->getConfigValues($intConfigId, 'nagiosbasedir', $strNagiosBaseDir); $myConfigClass->getConfigValues($intConfigId, 'conffile', $strConffile); - if ($intMethod == 1) { + if ($intMethod === 1) { if (file_exists($strBinary) && is_executable($strBinary)) { - $resFile = popen($strBinary. ' -v ' .$strConffile, 'r'); + $resFile = popen($strBinary . ' -v ' . $strConffile, 'r'); } else { $myVisClass->processMessage( translate('Cannot find the Nagios binary or no execute permissions!'), $strErrorMessage ); } - } elseif ($intMethod == 2) { + } elseif ($intMethod === 2) { $booReturn = 0; - if (empty($myConfigClass->resConnectId) || !is_resource($myConfigClass->resConnectId)) { + if (empty($myConfigClass->conFTPConId)) { $booReturn = $myConfigClass->getFTPConnection($intConfigId); } - if ($booReturn == 1) { + if ($booReturn === 1) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } else { $intErrorReporting = error_reporting(); error_reporting(0); - if (!($resFile = ftp_exec($myConfigClass->resConnectId, $strBinary.' -v '.$strConffile))) { + if (!($resFile = ftp_exec($myConfigClass->conFTPConId, $strBinary . ' -v ' . $strConffile))) { $myVisClass->processMessage(translate('Remote execution (FTP SITE EXEC) is not supported on your ' . 'system!'), $strErrorMessage); } - ftp_close($conn_id); + ftp_close($myConfigClass->conFTPConId); error_reporting($intErrorReporting); } - } elseif ($intMethod == 3) { + } elseif ($intMethod === 3) { $booReturn = 0; - if (empty($myConfigClass->resConnectId) || !is_resource($myConfigClass->resConnectId)) { + if (empty($myConfigClass->resSSHConId) || !is_resource($myConfigClass->resSSHConId)) { $booReturn = $myConfigClass->getSSHConnection($intConfigId); } - if ($booReturn == 1) { + if ($booReturn === 1) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); - } else { - if (($strBinary != '') && ($strConffile != '') && - $myConfigClass->sendSSHCommand('ls '.$strBinary, $arrTemp) == 0 && - $myConfigClass->sendSSHCommand('ls '.$strConffile, $arrTemp) == 0) { - $intResult = $myConfigClass->sendSSHCommand($strBinary.' -v '.$strConffile, $arrResult, 15000); - if (!is_array($arrResult) || ($arrResult == false)) { - $myVisClass->processMessage(translate('Remote execution of nagios verify command failed (remote ' - . 'SSH)!'), $strErrorMessage); - } - } else { - $myVisClass->processMessage( - translate('Nagios binary or configuration file not found (remote SSH)!'), - $strErrorMessage - ); + } else if (($strBinary !== '') && ($strConffile !== '') && + $myConfigClass->sendSSHCommand('ls ' . $strBinary, $arrTemp) === 0 && + $myConfigClass->sendSSHCommand('ls ' . $strConffile, $arrTemp) === 0) { + $intResult = $myConfigClass->sendSSHCommand($strBinary . ' -v ' . $strConffile, $arrResult, 15000); + if (!is_array($arrResult)) { + $myVisClass->processMessage(translate('Remote execution of nagios verify command failed (remote ' + . 'SSH)!'), $strErrorMessage); } + } else { + $myVisClass->processMessage( + translate('Nagios binary or configuration file not found (remote SSH)!'), + $strErrorMessage + ); } } } -// Restart nagios -if ($chkButValue4 != '') { - // Read config file +/* Restart nagios */ +if (($chkButValue4 !== '') && ($chkButValue4 !== null)) { + /* Read config file */ $myConfigClass->getConfigValues($intConfigId, 'commandfile', $strCommandfile); $myConfigClass->getConfigValues($intConfigId, 'binaryfile', $strBinary); $myConfigClass->getConfigValues($intConfigId, 'pidfile', $strPidfile); $myConfigClass->getConfigValues($intConfigId, 'version', $intVersion); - // Check state nagios demon + /* Check state nagios demon */ clearstatcache(); - if ($intMethod == 1) { - if (substr_count(PHP_OS, 'Linux') != 0) { - exec('ps -ef | grep '.basename($strBinary).' | grep -v grep', $arrExec); + if ($intMethod === 1) { + if (substr_count(PHP_OS, 'Linux') !== 0) { + exec('ps -ef | grep ' . basename($strBinary) . ' | grep -v grep', $arrExec); } else { $arrExec[0] = 1; } - if (file_exists($strPidfile) && isset($arrExec[0])) { - if (file_exists($strCommandfile) && is_writable($strCommandfile)) { - if ($intVersion == 4) { - $strCommandString = '[' .time(). "] RESTART_PROGRAM\n"; - } else { - $strCommandString = '[' .time(). '] RESTART_PROGRAM;' .time()."\n"; - } - $timeout = 3; - $old = ini_set('default_socket_timeout', $timeout); - $resCmdFile = fopen($strCommandfile, 'wb'); - ini_set('default_socket_timeout', $old); - stream_set_timeout($resCmdFile, $timeout); - stream_set_blocking($resCmdFile, 0); - if ($resCmdFile) { - fwrite($resCmdFile, $strCommandString); - fclose($resCmdFile); - $myDataClass->writeLog(translate('Nagios daemon successfully restarted')); - $myVisClass->processMessage( - translate('Restart command successfully send to Nagios'), - $strInfoMessage - ); - } else { - $myDataClass->writeLog(translate('Restart failed - Nagios command file not found or no execute ' - . 'permissions')); - $myVisClass->processMessage( - translate('Nagios command file not found or no write permissions!'), - $strErrorMessage - ); - } + if (file_exists($strCommandfile) && is_writable($strCommandfile)) { + if ($intVersion === 4) { + $strCommandString = '[' . time() . "] RESTART_PROGRAM\n"; + } else { + $strCommandString = '[' . time() . '] RESTART_PROGRAM;' . time() . "\n"; + } + $timeout = 3; + $old = ini_set('default_socket_timeout', $timeout); + $resCmdFile = fopen($strCommandfile, 'wb'); + ini_set('default_socket_timeout', $old); + stream_set_timeout($resCmdFile, $timeout); + stream_set_blocking($resCmdFile, 0); + if ($resCmdFile) { + fwrite($resCmdFile, $strCommandString); + fclose($resCmdFile); + $myDataClass->writeLog(translate('Nagios daemon successfully restarted')); + $myVisClass->processMessage( + translate('Restart command successfully send to Nagios'), + $strInfoMessage + ); } else { $myDataClass->writeLog(translate('Restart failed - Nagios command file not found or no execute ' . 'permissions')); - $myVisClass->processMessage(translate('Restart failed - Nagios command file not found or no rights ' - . 'to execute'), $strErrorMessage); + $myVisClass->processMessage( + translate('Nagios command file not found or no write permissions!'), + $strErrorMessage + ); } } else { - $myDataClass->writeLog(translate('Restart failed - Nagios daemon was not running')); - $myVisClass->processMessage( - translate('Nagios daemon is not running, cannot send restart command!'), - $strErrorMessage - ); + $myDataClass->writeLog(translate('Restart failed - Nagios command file not found or no execute ' + . 'permissions')); + $myVisClass->processMessage(translate('Restart failed - Nagios command file not found or no rights ' + . 'to execute'), $strErrorMessage); } - } elseif ($intMethod == 2) { + } elseif ($intMethod === 2) { $myDataClass->writeLog(translate('Restart failed - FTP restrictions')); $myVisClass->processMessage( translate('Nagios restart is not possible via FTP remote connection!'), $strErrorMessage ); - } elseif ($intMethod == 3) { + } elseif ($intMethod === 3) { $booReturn = 0; - if (empty($myConfigClass->resConnectId) || !is_resource($myConfigClass->resConnectId)) { + if (empty($myConfigClass->resSSHConId) || !is_resource($myConfigClass->resSSHConId)) { $booReturn = $myConfigClass->getSSHConnection($intConfigId); } - if ($booReturn == 1) { + if ($booReturn === 1) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); - } else { - if ($myConfigClass->sendSSHCommand('ls '.$strCommandfile, $arrTemp) == 0) { - if ($intVersion == 4) { - $strCommandString = '[' .time(). "] RESTART_PROGRAM\n"; - } else { - $strCommandString = '[' .time(). '] RESTART_PROGRAM;' .time()."\n"; - } - $arrInfo1 = ssh2_sftp_stat($myConfigClass->resSFTP, $strCommandfile); - $intFileStamp1 = $arrInfo1['mtime']; - $myConfigClass->sendSSHCommand('echo "'.$strCommandString.'" >> '.$strCommandfile, $arrResult); - $arrInfo2 = ssh2_sftp_stat($myConfigClass->resSFTP, $strCommandfile); - $intFileStamp2 = $arrInfo2['mtime']; - if ($intFileStamp2 <= $intFileStamp1) { - $myVisClass->processMessage(translate('Restart failed - Nagios command file not found or no ' - . 'rights to execute (remote SSH)!'), $strErrorMessage); - } else { - $myDataClass->writeLog(translate('Nagios daemon successfully restarted (remote SSH)')); - $myVisClass->processMessage( - translate('Restart command successfully send to Nagios (remote SSH)'), - $strInfoMessage - ); - } + } else if ($myConfigClass->sendSSHCommand('ls ' . $strCommandfile, $arrTemp) === 0) { + if ($intVersion === 4) { + $strCommandString = '[' . time() . "] RESTART_PROGRAM\n"; } else { - $myVisClass->processMessage(translate('Nagios command file not found (remote SSH)!'), $strErrorMessage); + $strCommandString = '[' . time() . '] RESTART_PROGRAM;' . time() . "\n"; } + $arrInfo1 = ssh2_sftp_stat($myConfigClass->resSFTP, $strCommandfile); + $intFileStamp1 = $arrInfo1['mtime']; + $myConfigClass->sendSSHCommand('echo "' . $strCommandString . '" >> ' . $strCommandfile, $arrResult); + $arrInfo2 = ssh2_sftp_stat($myConfigClass->resSFTP, $strCommandfile); + $intFileStamp2 = $arrInfo2['mtime']; + if ($intFileStamp2 <= $intFileStamp1) { + $myVisClass->processMessage(translate('Restart failed - Nagios command file not found or no ' + . 'rights to execute (remote SSH)!'), $strErrorMessage); + } else { + $myDataClass->writeLog(translate('Nagios daemon successfully restarted (remote SSH)')); + $myVisClass->processMessage( + translate('Restart command successfully send to Nagios (remote SSH)'), + $strInfoMessage + ); + } + } else { + $myVisClass->processMessage(translate('Nagios command file not found (remote SSH)!'), $strErrorMessage); } } } -// -// include content -// =============== +/* +Include content +*/ $conttp->setVariable('TITLE', translate('Check written configuration files')); $conttp->setVariable('CHECK_CONFIG', translate('Check configuration files:')); $conttp->setVariable('RESTART_NAGIOS', translate('Restart Nagios:')); $conttp->setVariable('WRITE_MONITORING_DATA', translate('Write monitoring data')); $conttp->setVariable('WRITE_ADDITIONAL_DATA', translate('Write additional data')); -if (($chkButValue3 == '') && ($chkButValue4 == '')) { +if (($chkButValue3 === '') && ($chkButValue4 === '')) { $conttp->setVariable('WARNING', translate('Warning, always check the configuration files before restarting ' - .'Nagios!')); + . 'Nagios!')); } $conttp->setVariable('MAKE', translate('Do it')); -$conttp->setVariable('IMAGE_PATH', $_SESSION['SETS']['path']['base_url']. 'images/'); -$conttp->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); +$conttp->setVariable('IMAGE_PATH', $_SESSION['SETS']['path']['base_url'] . 'images/'); +$conttp->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF')); $strOutput = ''; -if (isset($resFile) && ($resFile != false)) { - $intError = 0; +if (isset($resFile) && ($resFile !== false)) { + $intError = 0; $intWarning = 0; - $intLines = 0; + $intLines = 0; while (!feof($resFile)) { $strLine = fgets($resFile, 1024); $intLines++; - if ((substr_count($strLine, 'Error:') != 0) || (substr_count($strLine, 'Total Errors:') != 0)) { + if ((substr_count($strLine, 'Error:') !== 0) || (substr_count($strLine, 'Total Errors:') !== 0)) { $conttp->setVariable('VERIFY_CLASS', 'errormessage'); $conttp->setVariable('VERIFY_LINE', $strLine); $conttp->parse('verifyline'); $intError++; - if (substr_count($strLine, 'Total Errors:') != 0) { + if (substr_count($strLine, 'Total Errors:') !== 0) { $intError--; } } - if ((substr_count($strLine, 'Warning:') != 0) || (substr_count($strLine, 'Total Warnings:') != 0)) { + if ((substr_count($strLine, 'Warning:') !== 0) || (substr_count($strLine, 'Total Warnings:') !== 0)) { $conttp->setVariable('VERIFY_CLASS', 'warnmessage'); $conttp->setVariable('VERIFY_LINE', $strLine); $conttp->parse('verifyline'); $intWarning++; - if (substr_count($strLine, 'Total Warnings:') != 0) { + if (substr_count($strLine, 'Total Warnings:') !== 0) { $intWarning--; } } - $strOutput .= $strLine. '
'; + $strOutput .= $strLine . '
'; } - $myDataClass->writeLog(translate('Nagios written configuration files checked - Warnings/Errors:'). ' ' - .$intWarning. '/' . + $myDataClass->writeLog(translate('Nagios written configuration files checked - Warnings/Errors:') . ' ' + . $intWarning . '/' . $intError); pclose($resFile); - if (($intError == 0) && ($intWarning == 0) && ($intLines > 5)) { + if (($intError === 0) && ($intWarning === 0) && ($intLines > 5)) { $conttp->setVariable('VERIFY_CLASS', 'greenmessage'); - $conttp->setVariable('VERIFY_LINE', '' .translate('Written configuration files are valid, Nagios can be ' - . 'restarted!'). ''); + $conttp->setVariable('VERIFY_LINE', '' . translate('Written configuration files are valid, Nagios can be ' + . 'restarted!') . ''); $conttp->parse('verifyline'); } if ($intLines < 5) { $conttp->setVariable('VERIFY_CLASS', 'redmessage'); - $conttp->setVariable('VERIFY_LINE', '' .translate('The configuration could not be tested successfully. ' + $conttp->setVariable('VERIFY_LINE', '' . translate('The configuration could not be tested successfully. ' . 'The Nagios binary may have crashed during the test. Please repeat the test or try using the ' . 'commandline to test. A running Nagios service should not be restarted because the configuration may ' - . 'be invalid.'). ''); + . 'be invalid.') . ''); $conttp->parse('verifyline'); } $conttp->setVariable('DATA', $strOutput); $conttp->parse('verifyline'); } elseif (isset($arrResult) && is_array($arrResult)) { - $intError = 0; + $intError = 0; $intWarning = 0; foreach ($arrResult as $elem) { - if ((substr_count($elem, 'Error:') != 0) || (substr_count($elem, 'Total Errors:') != 0)) { + if ((substr_count($elem, 'Error:') !== 0) || (substr_count($elem, 'Total Errors:') !== 0)) { $conttp->setVariable('VERIFY_CLASS', 'errormessage'); $conttp->setVariable('VERIFY_LINE', $elem); $conttp->parse('verifyline'); $intError++; - if (substr_count($elem, 'Total Errors:') != 0) { + if (substr_count($elem, 'Total Errors:') !== 0) { $intError--; } } - if ((substr_count($elem, 'Warning:') != 0) || (substr_count($elem, 'Total Warnings:') != 0)) { + if ((substr_count($elem, 'Warning:') !== 0) || (substr_count($elem, 'Total Warnings:') !== 0)) { $conttp->setVariable('VERIFY_CLASS', 'warnmessage'); $conttp->setVariable('VERIFY_LINE', $elem); $conttp->parse('verifyline'); $intWarning++; - if (substr_count($elem, 'Total Warnings:') != 0) { + if (substr_count($elem, 'Total Warnings:') !== 0) { $intWarning--; } } - $strOutput .= $elem. '
'; + $strOutput .= $elem . '
'; } - $myDataClass->writeLog(translate('Nagios written configuration files checked - Warnings/Errors:'). ' ' - .$intWarning. '/' . + $myDataClass->writeLog(translate('Nagios written configuration files checked - Warnings/Errors:') . ' ' + . $intWarning . '/' . $intError); - if (($intError == 0) && ($intWarning == 0)) { + if (($intError === 0) && ($intWarning === 0)) { $conttp->setVariable('VERIFY_CLASS', 'greenmessage'); - $conttp->setVariable('VERIFY_LINE', '' .translate('Written configuration files are valid, Nagios can be ' - . 'restarted!'). ''); + $conttp->setVariable('VERIFY_LINE', '' . translate('Written configuration files are valid, Nagios can be ' + . 'restarted!') . ''); $conttp->parse('verifyline'); } $conttp->setVariable('DATA', $strOutput); $conttp->parse('verifyline'); } -if ($strErrorMessage != '') { +if ($strErrorMessage !== '') { $conttp->setVariable('ERRORMESSAGE', $strErrorMessage); } $conttp->setVariable('INFOMESSAGE', $strInfoMessage); -if ($strInfo != '') { +if ($strInfo !== '') { $conttp->setVariable('VERIFY_CLASS', 'greenmessage'); - $conttp->setVariable('VERIFY_LINE', '
' .$strInfo); + $conttp->setVariable('VERIFY_LINE', '
' . $strInfo); $conttp->parse('verifyline'); } -// Check access rights for adding new objects -if ($myVisClass->checkAccountGroup($prePageKey, 'write') != 0) { +/* Check access rights for adding new objects */ +if ($myVisClass->checkAccountGroup($prePageKey, 'write') !== 0) { $conttp->setVariable('ADD_CONTROL', 'disabled="disabled"'); } $conttp->parse('main'); $conttp->show('main'); -// -// Insert footer -// ============= -$maintp->setVariable('VERSION_INFO', "setVariable('VERSION_INFO', "NagiosQL $setFileVersion"); $maintp->parse('footer'); -$maintp->show('footer'); +$maintp->show('footer'); \ No newline at end of file diff --git a/admin/versioncheck.php b/admin/versioncheck.php index 820bcf6..6f57b0a 100644 --- a/admin/versioncheck.php +++ b/admin/versioncheck.php @@ -1,124 +1,145 @@ Application version string + * @var string $setGITVersion from prepend_adm.php -> Application version string - GIT version + * @var array $SETS Settings array + */ +/* +Path settings +*/ $strPattern = '(admin/[^/]*.php)'; -$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); -$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING)); -// -// Define common variables -// ======================= +$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); +$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); +/* +Define common variables +*/ $preNoMain = 1; -$chkShow = filter_input(INPUT_GET, 'show', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); -// -// Include preprocessing file -// ========================== -require $preBasePath.'functions/prepend_adm.php'; +$chkShow = filter_input(INPUT_GET, 'show', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); +/* +Include preprocessing file +*/ +require $preBasePath . 'functions/prepend_adm.php'; $strCommandLine = ' '; -$intCount = 0; -// -// Get database values -// =================== -if ($chkShow == 1) { - $versionfeed = 'http://api.wizonet.ch/nagiosql/versioncheck.php?myversion=' .urlencode($setFileVersion); - $strError = ''; - if ((isset($SETS['network']['proxy']) && ($SETS['network']['proxy'] == '1')) && - (isset($SETS['network']['proxyserver']) && ($SETS['network']['proxyserver'] != ''))) { - if ((isset($SETS['network']['proxyuser']) && ($SETS['network']['proxyuser'] != '')) && - (isset($SETS['network']['proxypasswd']) && ($SETS['network']['proxypasswd'] != ''))) { - $strProxyAuth = base64_encode($SETS['network']['proxyuser']. ':' .$SETS['network']['proxypasswd']); +$intCount = 0; +/* +Get database values +*/ +if ($chkShow === 1) { + $strInstallHash = $SETS['install']['hash'] ?? 'nohash'; + if (isset($setFileVersion) && ($setFileVersion !== '') && ($setFileVersion !== null)) { + $strVersion = $setFileVersion; + } else { + $strVersion = '0.0.0'; + } + if (isset($setGITVersion) && ($setGITVersion !== '') && ($setGITVersion !== null)) { + $strGITVersion = $setGITVersion; + } else { + $strGITVersion = '0000-00-00'; + } + /** @noinspection HttpUrlsUsage */ + $versionfeed = 'http://api.wizonet.ch/nagiosql/versioncheck.php?myversion=' . urlencode($strVersion) . '&mygit=' + . urlencode($strGITVersion) . '&myhash=' . urlencode($strInstallHash); + $strError = ''; + if (isset($SETS['network']['proxy'], $SETS['network']['proxyserver']) && ($SETS['network']['proxy'] === '1') && + ($SETS['network']['proxyserver'] !== '')) { + if (isset($SETS['network']['proxyuser'], $SETS['network']['proxypasswd']) && ($SETS['network']['proxyuser'] !== '') + && ($SETS['network']['proxypasswd'] !== '')) { + $strProxyAuth = base64_encode($SETS['network']['proxyuser'] . ':' . $SETS['network']['proxypasswd']); $aContext = array( 'http' => array( - 'proxy' => 'tcp://'.$SETS['network']['proxyserver'], - 'request_fulluri' => true, - 'header' => "Proxy-Authorization: Basic $strProxyAuth", - 'timeout' => 1, + 'proxy' => 'tcp://' . $SETS['network']['proxyserver'], + 'request_fulluri' => true, + 'header' => "Proxy-Authorization: Basic $strProxyAuth", + 'timeout' => 1, ), ); } else { $aContext = array( 'http' => array( - 'proxy' => 'tcp://'.$SETS['network']['proxyserver'], - 'request_fulluri' => true, - 'timeout' => 1, + 'proxy' => 'tcp://' . $SETS['network']['proxyserver'], + 'request_fulluri' => true, + 'timeout' => 1, ), ); } $intErrorReporting = error_reporting(); error_reporting(0); $cxContext = stream_context_create($aContext); - $arrFile = file($versionfeed, false, $cxContext); - $arrError = error_get_last(); - error_reporting($intErrorReporting); - if ($arrError['message'] != '') { - $strError .= utf8_encode($arrError['message']). ' (' .translate('check proxy settings'). ')'; - } } else { $intErrorReporting = error_reporting(); error_reporting(0); $cxContext = stream_context_create(array('http' => array('timeout' => 1))); - $arrFile = file($versionfeed, false, $cxContext); - $arrError = error_get_last(); - error_reporting($intErrorReporting); - if ($arrError['message'] != '') { - $strError .= utf8_encode($arrError['message']). ' (' .translate('check proxy settings'). ')'; - } } - $strInstalled = translate('Installed'); - $strAvailable = translate('Available'); + $arrFile = file($versionfeed, false, $cxContext); + $arrError = error_get_last(); + error_reporting($intErrorReporting); + if (isset($arrError['message']) && $arrError['message'] !== '') { + $strError .= utf8_encode($arrError['message']) . ' (' . translate('check proxy settings') . ')'; + } + $strInstalled = translate('Installed'); + $strAvailable = translate('Available'); $strInformation = translate('Information'); - $strVersion = ''; - $strRelease = ''; - $strRelInfo = ''; - if (is_array($arrFile) && count($arrFile) != 0) { + $strVersion = ''; + $strRelease = ''; + $strRelInfo = ''; + $strGIT = ''; + if (is_array($arrFile) && count($arrFile) !== 0) { foreach ($arrFile as $elem) { - if (substr_count($elem, 'version') != 0) { + if (substr_count($elem, 'version') !== 0) { $strVersion = trim(strip_tags($elem)); } - if (substr_count($elem, 'release_date') != 0) { + if (substr_count($elem, 'git') !== 0) { + $strGIT = trim(strip_tags($elem)); + } + if (substr_count($elem, 'release_date') !== 0) { $strRelease = trim(strip_tags($elem)); } - if (substr_count($elem, 'error') != 0) { - $strError = trim(strip_tags($elem)); + if (substr_count($elem, 'error') !== 0) { + $strError = trim(strip_tags($elem)); } - if (substr_count($elem, 'information') != 0) { + if (substr_count($elem, 'information') !== 0) { $strRelInfo = trim(strip_tags($elem)); } } } $setFileAvailable = $strVersion; + $setFileInformation = ''; if (version_compare($strVersion, $setFileVersion, '==')) { - $setFileInformation = "".translate('You already have the latest version installed'). - ''; + if ($strGIT === $setGITVersion) { + $setFileInformation = "" . translate('You already have the latest version installed') . + ''; + } else { + $setFileInformation = "" . translate('You already have the latest version installed') . + ' (' . translate('new GIT hotfix version available:') . ' ' . $strVersion . '-' . $strGIT . ')'; + } + } elseif (version_compare($strVersion, $setFileVersion, '>=')) { - $setFileInformation = "".translate('You are using an old NagiosQL version. Please '. - 'update to the latest stable version'). ': '; - $setFileInformation .= '' . + $setFileInformation = "" . translate('You are using an old NagiosQL version. Please ' . + 'update to the latest stable version') . ': '; + $setFileInformation .= '' . 'NagiosQL on Sourceforge'; } elseif (version_compare($strVersion, $setFileVersion, '<=')) { - $setFileInformation = "".translate('You are using a newer development version '. - 'without official support'). ''; + $setFileInformation = "" . translate('You are using a newer development version ' . + 'without official support') . ''; } - if (($strError != 'none') && ($strError != '')) { - $setFileInformation = "".$strError. ''; + if (($strError !== 'none') && ($strError !== '')) { + $setFileInformation = "" . $strError . ''; } ?> - - + + Version check @@ -129,70 +150,72 @@ if ($chkShow == 1) { - - - - - - - - - - - -
- + + + + + + + + + + + +
+ - - + - - + ?> + + Commandline -


Loading...

+


Loading...

- - + \ No newline at end of file diff --git a/config/content.css b/config/content.css index 28157ec..2c6bae4 100644 --- a/config/content.css +++ b/config/content.css @@ -1,480 +1,559 @@ @charset "utf-8"; -/*///////////////////////////////////////////////////////////////////////////// -// -// NagiosQL -// -/////////////////////////////////////////////////////////////////////////////// -// -// (c) 2005-2018 by Martin Willisegger -// -// Project : NagiosQL -// Component : CSS content definition -// Website : https://sourceforge.net/projects/nagiosql/ -// Version : 3.4.0 -// GIT Repo : https://gitlab.com/wizonet/NagiosQL -// -/////////////////////////////////////////////////////////////////////////////*/ +/* ---------------------------------------------------------------------------- + NagiosQL +------------------------------------------------------------------------------- + (c) 2005-2022 by Martin Willisegger + + Project : NagiosQL + Component : CSS content definition + Website : https://sourceforge.net/projects/nagiosql/ + Version : 3.5.0 + GIT Repo : https://gitlab.com/wizonet/NagiosQL +-----------------------------------------------------------------------------*/ /* Content main div */ #content_main { - top:-3px; - left:0; - width:890px; - margin: 0; - padding: 0 0 0 10px; - position:relative; - font-size: 12px; + top: -3px; + left: 0; + width: 890px; + margin: 0; + padding: 0 0 0 10px; + position: relative; + font-size: 12px; } + /* Content title (list and single view) */ #content_title { - color: #0c4271; - margin: 0 0 0 2px; - font-size:20px; - font-weight:bold; - font-family:Arial, Helvetica, sans-serif; - padding: 0 0 5px; + color: #0c4271; + margin: 0 0 0 2px; + font-size: 20px; + font-weight: bold; + font-family: Arial, Helvetica, sans-serif; + padding: 0 0 5px; } + /* Content special definitions */ .elementHide { - display:none; + display: none; } -.elementShow {} + +.elementShow { +} + .redmessage { - color: #FF0000; + color: #FF0000; } + .greenmessage { - color: #009900; -} + color: #009900; +} + .blackmessage { - color:#000000; -} + color: #000000; +} + .bluemessage { - color:#0000FF; -} + color: #0000FF; +} + .checkred { - color: #FF0000; - font-weight:bold; + color: #FF0000; + font-weight: bold; } + .checkgreen { - color: #009900; - font-weight:bold; + color: #009900; + font-weight: bold; } + .checkorange { - color: #FF9900; - font-weight:bold; + color: #FF9900; + font-weight: bold; } + .env_table { - padding-top:10px; + padding-top: 10px; } + .env_table td { - font-size: 12px; - padding:2px; + font-size: 12px; + padding: 2px; } /*noinspection CssUnusedSymbol*/ #content_main .warnmessage { - font-size: 12px; - color: #FF9900; - font-weight: bold; + font-size: 12px; + color: #FF9900; + font-weight: bold; } + #content_main .errormessage { - font-size: 12px; - color: #FF0000; - font-weight: bold; + font-size: 12px; + color: #FF0000; + font-weight: bold; } + #content_main .pagelinks { - font-size: 12px; - color: #006600; - margin: 0 auto; - width: 25%; + font-size: 12px; + color: #006600; + margin: 0 auto; + width: 25%; } + /* Content tags */ #content_main h2 { - font-size: 14px; - margin-bottom:0; + font-size: 14px; + margin-bottom: 0; } + /* Version string */ .version { - font-size: 9px; - color: #999999; - text-align: center; + font-size: 9px; + color: #999999; + text-align: center; } + .version a { - text-decoration:none; - color:#999999; + text-decoration: none; + color: #999999; } + .version a:hover { - text-decoration:none; - color:#333333; + text-decoration: none; + color: #333333; } + /* Content forms */ #content_main form { - margin:0; - padding:0; + margin: 0; + padding: 0; } + /* Content form table (single view and top/bottom line of list view) */ .content_formtable { - top:10px; - position:relative; - font-family:Verdana, Helvetica, sans-serif; - font-size:12px; + top: 10px; + position: relative; + font-family: Verdana, Helvetica, sans-serif; + font-size: 12px; } + .content_formtable td { - padding:0; - margin:0; - height:18px; - text-align:left; + padding: 0; + margin: 0; + height: 18px; + text-align: left; } + .content_tbl_row1 { - width: 200px; + width: 200px; } + .content_tbl_row2 { - width: 205px; + width: 205px; } + .content_tbl_row3 { - width: 45px; + width: 45px; } + .content_tbl_row4 { - width: 30px; + width: 30px; } + /* Form field definitions */ .content_formtable input[type=text] { - width:200px; - padding:0; - margin:0; - border: 1px solid #6CF; - background: #d1e2fd url(../images/input.png); - font-family:Verdana, Helvetica, sans-serif; - font-size:12px; - height:18px; + width: 200px; + padding: 0; + margin: 0; + border: 1px solid #6CF; + background: #d1e2fd url(../images/input.png); + font-family: Verdana, Helvetica, sans-serif; + font-size: 12px; + height: 18px; } + .content_formtable input[type=password] { - width:200px; - padding:0; - margin:0; - border: 1px solid #6CF; - background: #d1e2fd url(../images/input.png); - font-family:Verdana, Helvetica, sans-serif; - font-size:12px; - height:18px; + width: 200px; + padding: 0; + margin: 0; + border: 1px solid #6CF; + background: #d1e2fd url(../images/input.png); + font-family: Verdana, Helvetica, sans-serif; + font-size: 12px; + height: 18px; } + .content_formtable input[type=file] { - width:400px; - background: #d1e2fd url(../images/input.png); - font-family:Verdana, Helvetica, sans-serif; - font-size:12px; - height:25px; + width: 400px; + background: #d1e2fd url(../images/input.png); + font-family: Verdana, Helvetica, sans-serif; + font-size: 12px; + height: 25px; } + .content_formtable input[type=text].inpmust { - width:200px; - border: 1px solid #053056; - background: #941616 url(../images/inputmust.png); - font-family:Verdana, Helvetica, sans-serif; - color: #FFFFFF; - font-weight: bold; - font-size:12px; - height:18px; + width: 200px; + border: 1px solid #053056; + background: #941616 url(../images/inputmust.png); + font-family: Verdana, Helvetica, sans-serif; + color: #FFFFFF; + font-weight: bold; + font-size: 12px; + height: 18px; } /*noinspection CssUnusedSymbol*/ .content_formtable input[type=text].inputlock { - width:200px; - border: 1px solid #053056; - background: #5d5d5d url(../images/inputlock.png); - font-family:Verdana, Helvetica, sans-serif; - color: #f7f7f7; - font-weight: normal; - font-size:12px; - height:18px; + width: 200px; + border: 1px solid #053056; + background: #5d5d5d url(../images/inputlock.png); + font-family: Verdana, Helvetica, sans-serif; + color: #f7f7f7; + font-weight: normal; + font-size: 12px; + height: 18px; } + .content_formtable input[type=password].inpmust { - width:200px; - border: 1px solid #053056; - background: #941616 url(../images/inputmust.png); - font-family:Verdana, Helvetica, sans-serif; - color: #FFFFFF; - font-weight: bold; - font-size:12px; - height:18px; + width: 200px; + border: 1px solid #053056; + background: #941616 url(../images/inputmust.png); + font-family: Verdana, Helvetica, sans-serif; + color: #FFFFFF; + font-weight: bold; + font-size: 12px; + height: 18px; } + .content_formtable input[type=text].short { - width:150px; - height:18px; - padding:0; - margin:0; - border: 1px solid #6CF; - background: #d1e2fd url(../images/input.png); - font-family:Verdana, Helvetica, sans-serif; - font-size:12px; - float:left; - display:inline-block; + width: 150px; + height: 18px; + padding: 0; + margin: 0; + border: 1px solid #6CF; + background: #d1e2fd url(../images/input.png); + font-family: Verdana, Helvetica, sans-serif; + font-size: 12px; + float: left; + display: inline-block; } + .content_formtable input[type=text].shortmust { - width:150px; - border: 1px solid #053056; - background: #941616 url(../images/inputmust.png); - font-family:Verdana, Helvetica, sans-serif; - color: #FFFFFF; - font-weight: bold; - font-size:12px; - height:18px; - float:left; - display:inline-block; + width: 150px; + border: 1px solid #053056; + background: #941616 url(../images/inputmust.png); + font-family: Verdana, Helvetica, sans-serif; + color: #FFFFFF; + font-weight: bold; + font-size: 12px; + height: 18px; + float: left; + display: inline-block; } + .content_formtable input[type=button] { - border:1px solid #6CF; - background: #d1e2fd url(../images/input.png); - font-family:Verdana, Helvetica, sans-serif; - font-size:12px; - color:#0c4271; - height:25px; - padding-left:10px; - padding-right:10px; - margin:0; - padding-bottom:2px; + border: 1px solid #6CF; + background: #d1e2fd url(../images/input.png); + font-family: Verdana, Helvetica, sans-serif; + font-size: 12px; + color: #0c4271; + height: 25px; + padding-left: 10px; + padding-right: 10px; + margin: 0; + padding-bottom: 2px; } + .content_formtable input[type=button][disabled] { - border:1px solid #6CF; - background: #d1e2fd url(../images/input.png); - font-family:Verdana, Helvetica, sans-serif; - font-size:12px; - color:#CCC; - height:25px; - padding-left:10px; - padding-right:10px; - margin:0; - padding-bottom:2px; + border: 1px solid #6CF; + background: #d1e2fd url(../images/input.png); + font-family: Verdana, Helvetica, sans-serif; + font-size: 12px; + color: #CCC; + height: 25px; + padding-left: 10px; + padding-right: 10px; + margin: 0; + padding-bottom: 2px; } + .content_formtable input[type=submit] { - border:1px solid #6CF; - background: #d1e2fd url(../images/input.png); - font-family:Verdana, Helvetica, sans-serif; - font-size:12px; - color:#0c4271; - height:25px; - padding-left:10px; - padding-right:10px; - margin:0; - padding-bottom:2px; + border: 1px solid #6CF; + background: #d1e2fd url(../images/input.png); + font-family: Verdana, Helvetica, sans-serif; + font-size: 12px; + color: #0c4271; + height: 25px; + padding-left: 10px; + padding-right: 10px; + margin: 0; + padding-bottom: 2px; } + .content_formtable input[type=submit][disabled] { - border:1px solid #6CF; - background: #d1e2fd url(../images/input.png); - font-family:Verdana, Helvetica, sans-serif; - font-size:12px; - color:#CCC; - height:25px; - padding-left:10px; - padding-right:10px; - margin:0; - padding-bottom:2px; + border: 1px solid #6CF; + background: #d1e2fd url(../images/input.png); + font-family: Verdana, Helvetica, sans-serif; + font-size: 12px; + color: #CCC; + height: 25px; + padding-left: 10px; + padding-right: 10px; + margin: 0; + padding-bottom: 2px; } + .content_formtable input[type=reset] { - border:1px solid #6CF; - background: #d1e2fd url(../images/input.png); - font-family:Verdana, Helvetica, sans-serif; - font-size:12px; - color:#0c4271; - height:25px; - padding-left:10px; - padding-right:10px; - margin:0; - padding-bottom:2px; + border: 1px solid #6CF; + background: #d1e2fd url(../images/input.png); + font-family: Verdana, Helvetica, sans-serif; + font-size: 12px; + color: #0c4271; + height: 25px; + padding-left: 10px; + padding-right: 10px; + margin: 0; + padding-bottom: 2px; } + .content_formtable input[type=checkbox] { - border:none; - margin-left:0; - margin-right:0; - background:none; - float:left; + border: none; + margin-left: 0; + margin-right: 0; + background: none; + float: left; } + .content_formtable input[type=radio] { - border:none; - margin-left:0; - margin-right:0; - background:none; - float:left; + border: none; + margin-left: 0; + margin-right: 0; + background: none; + float: left; } + +.content_formtable textarea.arginfo { + width: 200px; + border: 1px solid #6CF; + background-color: #d1e2fd; + font-family: Verdana, Helvetica, sans-serif; + color: #000000; + font-size: 12px; + height: 50px; + float: left; + resize: none; +} + .content_formtable select { - background-color: #d1e2fd; - font-family:Verdana, Helvetica, sans-serif; - font-size:12px; - border: 1px solid #6CF; - padding-top:2px; + background-color: #d1e2fd; + font-family: Verdana, Helvetica, sans-serif; + font-size: 12px; + border: 1px solid #6CF; + padding-top: 2px; } + .content_formtable option { - height: 15px; + height: 15px; } + .content_formtable iframe { border: none; } + #versioncheck { border: none; } + /* Additional form table definitions */ .content_formtable .inpmust { - background-color: #941616; - font-family: Verdana, Arial, Helvetica, sans-serif; - color: #FFFFFF; - font-weight: bold; + background-color: #941616; + font-family: Verdana, Arial, Helvetica, sans-serif; + color: #FFFFFF; + font-weight: bold; } /*noinspection CssUnusedSymbol*/ .content_formtable .inactive_option { - background-color:#FF8000; + background-color: #FF8000; } /*noinspection ALL*/ .content_formtable .foreign_option { - background-color:#C90; + background-color: #C90; } /*noinspection ALL*/ .content_formtable .ieselected { - background-color:#3399FF; - color:#000000; + background-color: #3399FF; + color: #000000; } + .content_formtable .selectborder { - border: 1px solid #6CF; - width:202px; + border: 1px solid #6CF; + width: 202px; } + .content_formtable .selectbordermust { - border: 1px solid #000; - width:202px; + border: 1px solid #000; + width: 202px; } -.content_formtable .empty_class {} + +.content_formtable .empty_class { +} + .content_formtable .infobutton_1 { - left:3px; - position:relative; + left: 3px; + position: relative; } + .content_formtable .infobutton_2 { - left:3px; - top:10px; - position:relative; + left: 3px; + top: 10px; + position: relative; } + .content_formtable .shorttext { - display: inline-block; - float:left; - padding-left:5px; - padding-top:3px; + display: inline-block; + float: left; + padding-left: 5px; + padding-top: 3px; } + .content_formtable .required_info { - margin-left:30px; + margin-left: 30px; } + .content_formtable .radio_cell_1 { - width:20px; - height:18px; + width: 20px; + height: 18px; } + .content_formtable .radio_cell_2 { - width:29px; - padding-bottom:2px; + width: 29px; + padding-bottom: 2px; } + /* Content list view */ .content_listtable { - top:15px; - position:relative; - font-family:Verdana, Helvetica, sans-serif; - font-size:12px; - margin-bottom:10px; + top: 15px; + position: relative; + font-family: Verdana, Helvetica, sans-serif; + font-size: 12px; + margin-bottom: 10px; } + .content_listtable th { - background-color: #0c4271; - font-weight: bold; - color: #FFFFFF; - text-align: left; - vertical-align: middle; - padding: 5px; + background-color: #0c4271; + font-weight: bold; + color: #FFFFFF; + text-align: left; + vertical-align: middle; + padding: 5px; } + .content_listtable td { - text-align: left; - vertical-align: middle; - padding: 0 0 2px; - height:25px; + text-align: left; + vertical-align: middle; + padding: 0 0 2px; + height: 25px; } + .content_listtable .tdlb { - padding-left:5px; + padding-left: 5px; } /*noinspection ALL*/ .content_listtable .tdld { - padding-left:5px; - background-color: #dbe6ff; + padding-left: 5px; + background-color: #dbe6ff; } + .content_listtable .tdmb { - text-align: center; + text-align: center; } /*noinspection ALL*/ .content_listtable .tdmd { - text-align: center; - background-color: #dbe6ff; + text-align: center; + background-color: #dbe6ff; } + /* Log table */ .content_logtable { - top:15px; - position:relative; - font-family:Verdana, Helvetica, sans-serif; - font-size:12px; - margin-bottom:10px; + top: 15px; + position: relative; + font-family: Verdana, Helvetica, sans-serif; + font-size: 12px; + margin-bottom: 10px; } + .content_logtable th { - background-color: #0c4271; - border: 1px solid #333333; - padding: 2px; - color: #FFFFFF; + background-color: #0c4271; + border: 1px solid #333333; + padding: 2px; + color: #FFFFFF; } + .content_logtable td { - background-color: #FFFFFF; - padding: 2px; - border: 1px solid #333333; - text-align:center; + background-color: #FFFFFF; + padding: 2px; + border: 1px solid #333333; + text-align: center; } + .content_logtable .loglegend { - border: 0; - padding: 0; - width:445px; + border: 0; + padding: 0; + width: 445px; } + /* Custom */ .tablerow { - border-bottom:1px solid #0c4271; - font-size:12px; - height:20px; - padding-top:2px; - padding-left:5px; - padding-right:5px; + border-bottom: 1px solid #0c4271; + font-size: 12px; + height: 20px; + padding-top: 2px; + padding-left: 5px; + padding-right: 5px; } + /* Page links / site numbers */ .sitenumber { - background-color:#4080BE; - width:25px; - height:25px; - color:#d6d6d6; - border:1px solid #FFF; - text-align:center; - cursor:pointer; + background-color: #4080BE; + width: 25px; + height: 25px; + color: #d6d6d6; + border: 1px solid #FFF; + text-align: center; + cursor: pointer; } + .sitenumber a { - color:#d6d6d6; - text-decoration:none; + color: #d6d6d6; + text-decoration: none; } + .sitenumber a:hover { - color:#d6d6d6; - text-decoration:none; + color: #d6d6d6; + text-decoration: none; } + .sitenumber-sel { - background-color:#CCC;; - color:#00396a; - width:25px; - height:25px; - border:1px solid #FFF; - text-align:center; - font-weight:bold; + background-color: #CCC;; + color: #00396a; + width: 25px; + height: 25px; + border: 1px solid #FFF; + text-align: center; + font-weight: bold; } + #donate { - top: 550px; - left:3px; - width: 150px; - position:absolute; - text-align:center; - z-index:auto; + top: 550px; + left: 3px; + width: 150px; + position: absolute; + text-align: center; + z-index: auto; } + /* END */ \ No newline at end of file diff --git a/config/fieldvars.php b/config/fieldvars.php index 2cbc538..59064da 100644 --- a/config/fieldvars.php +++ b/config/fieldvars.php @@ -1,293 +1,297 @@ 'LANG_DOMAIN', 'string' => translate('Domain')); -$arrDescription[] = array('name' => 'LANG_DESCRIPTION', 'string' => translate('Description')); -$arrDescription[] = array('name' => 'LANG_SERVER_NAMEe', 'string' => translate('Server name')); -$arrDescription[] = array('name' => 'LANG_METHOD', 'string' => translate('Method')); -$arrDescription[] = array('name' => 'LANG_USERNAME', 'string' => translate('Username')); -$arrDescription[] = array('name' => 'LANG_PASSWORD', 'string' => translate('Password')); +/* ------------------------------------------------ese-------------------------- + NagiosQL +------------------------------------------------------------------------------- + (c) 2005-2022 by Martin Willisegger + + Project : NagiosQL + Component : field language variables (for replace in templates) + Website : https://sourceforge.net/projects/nagiosql/ + Version : 3.5.0 + GIT Repo : https://gitlab.com/wizonet/NagiosQL +-----------------------------------------------------------------------------*/ +/** + * Variable includes + * @var array $SETS from prepend_adm.php + */ +/* +Feldvariabeln setzen +*/ +$arrDescription[] = array('name' => 'LANG_DOMAIN', 'string' => translate('Domain')); +$arrDescription[] = array('name' => 'LANG_DESCRIPTION', 'string' => translate('Description')); +$arrDescription[] = array('name' => 'LANG_SERVER_NAME', 'string' => translate('Server name')); +$arrDescription[] = array('name' => 'LANG_METHOD', 'string' => translate('Method')); +$arrDescription[] = array('name' => 'LANG_USERNAME', 'string' => translate('Username')); +$arrDescription[] = array('name' => 'LANG_PASSWORD', 'string' => translate('Password')); +$arrDescription[] = array('name' => 'LANG_SSH_PORT', 'string' => translate('SSH Port number')); $arrDescription[] = array('name' => 'LANG_SSH_KEY', 'string' => translate('Directory with SSH key pair')); $arrDescription[] = array('name' => 'LANG_FTPS', 'string' => translate('Use encrypted FTP (FTPS)')); -$arrDescription[] = array('name' => 'LANG_SERVER_NAME', 'string' => translate('Server name')); +$arrDescription[] = array('name' => 'LANG_SERVER_NAME', 'string' => translate('Server name')); $arrDescription[] = array('name' => 'LANG_CONFIGURATION_DIRECTORIES', 'string' => translate('Configuration directories')); $arrDescription[] = array('name' => 'LANG_NAGIOS_DIRECTORIES', 'string' => translate('Nagios configuration files and directories')); -$arrDescription[] = array('name' => 'LANG_BASE_DIRECTORY', 'string' => translate('Base directory')); -$arrDescription[] = array('name' => 'LANG_HOST_DIRECTORY', 'string' => translate('Host directory')); -$arrDescription[] = array('name' => 'LANG_SERVICE_DIRECTORY', 'string' => translate('Service directory')); -$arrDescription[] = array('name' => 'LANG_BACKUP_DIRECTORY', 'string' => translate('Backup directory')); -$arrDescription[] = array('name' => 'LANG_HOST_BACKUP_DIRECTORY', 'string' => translate('Host backup directory')); +$arrDescription[] = array('name' => 'LANG_BASE_DIRECTORY', 'string' => translate('Base directory')); +$arrDescription[] = array('name' => 'LANG_HOST_DIRECTORY', 'string' => translate('Host directory')); +$arrDescription[] = array('name' => 'LANG_SERVICE_DIRECTORY', 'string' => translate('Service directory')); +$arrDescription[] = array('name' => 'LANG_BACKUP_DIRECTORY', 'string' => translate('Backup directory')); +$arrDescription[] = array('name' => 'LANG_HOST_BACKUP_DIRECTORY', 'string' => translate('Host backup directory')); $arrDescription[] = array('name' => 'LANG_SERVICE_BACKUP_DIRECTORY', 'string' => translate('Service backup directory')); -$arrDescription[] = array('name' => 'LANG_PICTURE_DIRECTORY', 'string' => translate('Picture base directory')); -$arrDescription[] = array('name' => 'LANG_NAGIOS_COMMAND_FILE', 'string' => translate('Nagios command file')); -$arrDescription[] = array('name' => 'LANG_NAGIOS_BINARY_FILE', 'string' => translate('Nagios binary file')); -$arrDescription[] = array('name' => 'LANG_NAGIOS_PROCESS_FILE', 'string' => translate('Nagios process file')); -$arrDescription[] = array('name' => 'LANG_NAGIOS_CONFIG_FILE', 'string' => translate('Nagios config file')); -$arrDescription[] = array('name' => 'LANG_NAGIOS_CGI_FILE', 'string' => translate('Nagios cgi file')); -$arrDescription[] = array('name' => 'LANG_NAGIOS_RESOURCE_FILE', 'string' => translate('Nagios resource file')); -$arrDescription[] = array('name' => 'LANG_NAGIOS_VERSION', 'string' => translate('Nagios version')); -$arrDescription[] = array('name' => 'LANG_ENABLE_COMMON_DOMAIN', 'string' => translate('Use common domain')); +$arrDescription[] = array('name' => 'LANG_PICTURE_DIRECTORY', 'string' => translate('Picture base directory')); +$arrDescription[] = array('name' => 'LANG_NAGIOS_COMMAND_FILE', 'string' => translate('Nagios command file')); +$arrDescription[] = array('name' => 'LANG_NAGIOS_BINARY_FILE', 'string' => translate('Nagios binary file')); +$arrDescription[] = array('name' => 'LANG_NAGIOS_PROCESS_FILE', 'string' => translate('Nagios process file')); +$arrDescription[] = array('name' => 'LANG_NAGIOS_CONFIG_FILE', 'string' => translate('Nagios config file')); +$arrDescription[] = array('name' => 'LANG_NAGIOS_CGI_FILE', 'string' => translate('Nagios cgi file')); +$arrDescription[] = array('name' => 'LANG_NAGIOS_RESOURCE_FILE', 'string' => translate('Nagios resource file')); +$arrDescription[] = array('name' => 'LANG_NAGIOS_VERSION', 'string' => translate('Nagios version')); +$arrDescription[] = array('name' => 'LANG_ENABLE_COMMON_DOMAIN', 'string' => translate('Use common domain')); $arrDescription[] = array('name' => 'LANG_ENABLE_UTF8_DECODE', 'string' => translate('Decode UTF8 data in config files')); -$arrDescription[] = array('name' => 'LANG_ACCESS_KEY_HOLES', 'string' => translate('Access key holes')); -$arrDescription[] = array('name' => 'LANG_ACCESS_KEYS', 'string' => translate('Access keys')); -$arrDescription[] = array('name' => 'LANG_ACTIVE', 'string' => translate('Active')); -$arrDescription[] = array('name' => 'LANG_REGISTERED', 'string' => translate('Registered')); -$arrDescription[] = array('name' => 'LANG_REQUIRED', 'string' => translate('required')); -$arrDescription[] = array('name' => 'LANG_SAVE', 'string' => translate('Save')); -$arrDescription[] = array('name' => 'LANG_ABORT', 'string' => translate('Abort')); -$arrDescription[] = array('name' => 'LANG_FUNCTION', 'string' => translate('Function')); -$arrDescription[] = array('name' => 'LANG_MARKED', 'string' => translate('Marked')); -$arrDescription[] = array('name' => 'LANG_DO_IT', 'string' => translate('Do it')); -$arrDescription[] = array('name' => 'LANG_ADD', 'string' => translate('Add')); -$arrDescription[] = array('name' => 'LANG_FORMCHECK', 'string' => translate('Form check')); -$arrDescription[] = array('name' => 'LANG_SECURE_QUESTION', 'string' => translate('Secure question')); -$arrDescription[] = array('name' => 'LANG_YES', 'string' => translate('Yes')); -$arrDescription[] = array('name' => 'LANG_NO', 'string' => translate('No')); -$arrDescription[] = array('name' => 'LANG_TIME', 'string' => translate('Time')); -$arrDescription[] = array('name' => 'LANG_USER', 'string' => translate('User')); -$arrDescription[] = array('name' => 'LANG_IP', 'string' => translate('IP Address')); -$arrDescription[] = array('name' => 'LANG_ENTRY', 'string' => translate('Entry')); -$arrDescription[] = array('name' => 'LANG_FROM', 'string' => translate('From')); -$arrDescription[] = array('name' => 'LANG_TO', 'string' => translate('To')); -$arrDescription[] = array('name' => 'LANG_DELETE_LOG_ENTRIES', 'string' => translate('Delete log entries')); -$arrDescription[] = array('name' => 'LANG_COPY', 'string' => translate('Copy')); -$arrDescription[] = array('name' => 'LANG_DELETE', 'string' => translate('Delete')); -$arrDescription[] = array('name' => 'LANG_MODIFY', 'string' => translate('Modify')); -$arrDescription[] = array('name' => 'LANG_CONFIRM_PASSWORD', 'string' => translate('Confirm password')); -$arrDescription[] = array('name' => 'LANG_OLD_PASSWORD', 'string' => translate('Old password')); -$arrDescription[] = array('name' => 'LANG_NEW_PASSWORD', 'string' => translate('New password')); -$arrDescription[] = array('name' => 'LANG_CHANGE_PASSWORD', 'string' => translate('Change password')); -$arrDescription[] = array('name' => 'LANG_MENU_PAGE', 'string' => translate('Menu page')); -$arrDescription[] = array('name' => 'LANG_SEARCH_STRING', 'string' => translate('Search string')); -$arrDescription[] = array('name' => 'LANG_SEARCH', 'string' => translate('Search')); -$arrDescription[] = array('name' => 'LANG_DELETE_SEARCH', 'string' => translate('Reset filter')); -$arrDescription[] = array('name' => 'LANG_WRITE_CONFIG_FILE', 'string' => translate('Write config file')); -$arrDescription[] = array('name' => 'LANG_DOWNLOAD', 'string' => translate('Download')); -$arrDescription[] = array('name' => 'LANG_DUPLICATE', 'string' => translate('Copy')); -$arrDescription[] = array('name' => 'LANG_COMMAND', 'string' => translate('Command')); -$arrDescription[] = array('name' => 'LANG_COMMAND_LINE', 'string' => translate('Command line')); -$arrDescription[] = array('name' => 'LANG_COMMAND_TYPE', 'string' => translate('Command type')); -$arrDescription[] = array('name' => 'LANG_TIME_PERIOD', 'string' => translate('Time period')); -$arrDescription[] = array('name' => 'LANG_EXCLUDE', 'string' => translate('Exclude')); -$arrDescription[] = array('name' => 'LANG_INCLUDE', 'string' => translate('Include')); -$arrDescription[] = array('name' => 'LANG_TIME_DEFINITIONS', 'string' => translate('Time definitions')); -$arrDescription[] = array('name' => 'LANG_WEEKDAY', 'string' => translate('Weekday')); -$arrDescription[] = array('name' => 'LANG_TIME_RANGE', 'string' => translate('Time range')); -$arrDescription[] = array('name' => 'LANG_TIME_DEFINITION', 'string' => translate('Time definition')); -$arrDescription[] = array('name' => 'LANG_INSERT', 'string' => translate('Insert')); -$arrDescription[] = array('name' => 'LANG_MODIFY_SELECTION', 'string' => translate('Modify selection')); -$arrDescription[] = array('name' => 'LANG_CONTACT_NAME', 'string' => translate('Contact name')); -$arrDescription[] = array('name' => 'LANG_CONTACT_GROUP', 'string' => translate('Contact group')); -$arrDescription[] = array('name' => 'LANG_MINIMUM_IMPORTANCE', 'string' => translate('Minimum importance')); -$arrDescription[] = array('name' => 'LANG_TIME_PERIOD_HOSTS', 'string' => translate('Time period hosts')); -$arrDescription[] = array('name' => 'LANG_TIME_PERIOD_SERVICES', 'string' => translate('Time period services')); -$arrDescription[] = array('name' => 'LANG_HOST_OPTIONS', 'string' => translate('Host options')); -$arrDescription[] = array('name' => 'LANG_SERVICE_OPTIONS', 'string' => translate('Service options')); -$arrDescription[] = array('name' => 'LANG_HOST_COMMAND', 'string' => translate('Host command')); -$arrDescription[] = array('name' => 'LANG_SERVICE_COMMAND', 'string' => translate('Service command')); -$arrDescription[] = array('name' => 'LANG_EMAIL_ADDRESS', 'string' => translate('EMail address')); -$arrDescription[] = array('name' => 'LANG_PAGER_NUMBER', 'string' => translate('Pager number')); -$arrDescription[] = array('name' => 'LANG_ADDON_ADDRESS', 'string' => translate('Addon address')); -$arrDescription[] = array('name' => 'LANG_HOST_NOTIF_ENABLE', 'string' => translate('Host notif. enable')); -$arrDescription[] = array('name' => 'LANG_SERVICE_NOTIF_ENABLE', 'string' => translate('Service notif. enable')); -$arrDescription[] = array('name' => 'LANG_CAN_SUBMIT_COMMANDS', 'string' => translate('Can submit commands')); -$arrDescription[] = array('name' => 'LANG_RETAIN_STATUS_INFO', 'string' => translate('Retain status info')); -$arrDescription[] = array('name' => 'LANG_RETAIN_NONSTATUS_INFO', 'string' => translate('Retain non-status info')); -$arrDescription[] = array('name' => 'LANG_MEMBERS', 'string' => translate('Members')); -$arrDescription[] = array('name' => 'LANG_GROUP_MEMBERS', 'string' => translate('Group members')); -$arrDescription[] = array('name' => 'LANG_COMMON_SETTINGS', 'string' => translate('Common settings')); -$arrDescription[] = array('name' => 'LANG_SERVICE_SETTINGS', 'string' => translate('Service settings')); +$arrDescription[] = array('name' => 'LANG_ACCESS_KEY_HOLES', 'string' => translate('Access key holes')); +$arrDescription[] = array('name' => 'LANG_ACCESS_KEYS', 'string' => translate('Access keys')); +$arrDescription[] = array('name' => 'LANG_ACTIVE', 'string' => translate('Active')); +$arrDescription[] = array('name' => 'LANG_REGISTERED', 'string' => translate('Registered')); +$arrDescription[] = array('name' => 'LANG_REQUIRED', 'string' => translate('required')); +$arrDescription[] = array('name' => 'LANG_SAVE', 'string' => translate('Save')); +$arrDescription[] = array('name' => 'LANG_ABORT', 'string' => translate('Abort')); +$arrDescription[] = array('name' => 'LANG_FUNCTION', 'string' => translate('Function')); +$arrDescription[] = array('name' => 'LANG_MARKED', 'string' => translate('Marked')); +$arrDescription[] = array('name' => 'LANG_DO_IT', 'string' => translate('Do it')); +$arrDescription[] = array('name' => 'LANG_ADD', 'string' => translate('Add')); +$arrDescription[] = array('name' => 'LANG_FORMCHECK', 'string' => translate('Form check')); +$arrDescription[] = array('name' => 'LANG_SECURE_QUESTION', 'string' => translate('Secure question')); +$arrDescription[] = array('name' => 'LANG_YES', 'string' => translate('Yes')); +$arrDescription[] = array('name' => 'LANG_NO', 'string' => translate('No')); +$arrDescription[] = array('name' => 'LANG_ALL', 'string' => translate('All')); +$arrDescription[] = array('name' => 'LANG_TIME', 'string' => translate('Time')); +$arrDescription[] = array('name' => 'LANG_USER', 'string' => translate('User')); +$arrDescription[] = array('name' => 'LANG_IP', 'string' => translate('IP Address')); +$arrDescription[] = array('name' => 'LANG_ENTRY', 'string' => translate('Entry')); +$arrDescription[] = array('name' => 'LANG_FROM', 'string' => translate('From')); +$arrDescription[] = array('name' => 'LANG_TO', 'string' => translate('To')); +$arrDescription[] = array('name' => 'LANG_DELETE_LOG_ENTRIES', 'string' => translate('Delete log entries')); +$arrDescription[] = array('name' => 'LANG_COPY', 'string' => translate('Copy')); +$arrDescription[] = array('name' => 'LANG_DELETE', 'string' => translate('Delete')); +$arrDescription[] = array('name' => 'LANG_MODIFY', 'string' => translate('Modify')); +$arrDescription[] = array('name' => 'LANG_CONFIRM_PASSWORD', 'string' => translate('Confirm password')); +$arrDescription[] = array('name' => 'LANG_OLD_PASSWORD', 'string' => translate('Old password')); +$arrDescription[] = array('name' => 'LANG_NEW_PASSWORD', 'string' => translate('New password')); +$arrDescription[] = array('name' => 'LANG_CHANGE_PASSWORD', 'string' => translate('Change password')); +$arrDescription[] = array('name' => 'LANG_MENU_PAGE', 'string' => translate('Menu page')); +$arrDescription[] = array('name' => 'LANG_SEARCH_STRING', 'string' => translate('Search string')); +$arrDescription[] = array('name' => 'LANG_SEARCH', 'string' => translate('Search')); +$arrDescription[] = array('name' => 'LANG_DELETE_SEARCH', 'string' => translate('Reset filter')); +$arrDescription[] = array('name' => 'LANG_WRITE_CONFIG_FILE', 'string' => translate('Write config file')); +$arrDescription[] = array('name' => 'LANG_DOWNLOAD', 'string' => translate('Download')); +$arrDescription[] = array('name' => 'LANG_DUPLICATE', 'string' => translate('Copy')); +$arrDescription[] = array('name' => 'LANG_COMMAND', 'string' => translate('Command')); +$arrDescription[] = array('name' => 'LANG_COMMAND_LINE', 'string' => translate('Command line')); +$arrDescription[] = array('name' => 'LANG_COMMAND_TYPE', 'string' => translate('Command type')); +$arrDescription[] = array('name' => 'LANG_HELP_TEXT', 'string' => translate('Help text')); +$arrDescription[] = array('name' => 'LANG_TIME_PERIOD', 'string' => translate('Time period')); +$arrDescription[] = array('name' => 'LANG_EXCLUDE', 'string' => translate('Exclude')); +$arrDescription[] = array('name' => 'LANG_INCLUDE', 'string' => translate('Include')); +$arrDescription[] = array('name' => 'LANG_TIME_DEFINITIONS', 'string' => translate('Time definitions')); +$arrDescription[] = array('name' => 'LANG_WEEKDAY', 'string' => translate('Weekday')); +$arrDescription[] = array('name' => 'LANG_TIME_RANGE', 'string' => translate('Time range')); +$arrDescription[] = array('name' => 'LANG_TIME_DEFINITION', 'string' => translate('Time definition')); +$arrDescription[] = array('name' => 'LANG_INSERT', 'string' => translate('Insert')); +$arrDescription[] = array('name' => 'LANG_MODIFY_SELECTION', 'string' => translate('Modify selection')); +$arrDescription[] = array('name' => 'LANG_CONTACT_NAME', 'string' => translate('Contact name')); +$arrDescription[] = array('name' => 'LANG_CONTACT_GROUP', 'string' => translate('Contact group')); +$arrDescription[] = array('name' => 'LANG_MINIMUM_IMPORTANCE', 'string' => translate('Minimum importance')); +$arrDescription[] = array('name' => 'LANG_TIME_PERIOD_HOSTS', 'string' => translate('Time period hosts')); +$arrDescription[] = array('name' => 'LANG_TIME_PERIOD_SERVICES', 'string' => translate('Time period services')); +$arrDescription[] = array('name' => 'LANG_HOST_OPTIONS', 'string' => translate('Host options')); +$arrDescription[] = array('name' => 'LANG_SERVICE_OPTIONS', 'string' => translate('Service options')); +$arrDescription[] = array('name' => 'LANG_HOST_COMMAND', 'string' => translate('Host command')); +$arrDescription[] = array('name' => 'LANG_SERVICE_COMMAND', 'string' => translate('Service command')); +$arrDescription[] = array('name' => 'LANG_EMAIL_ADDRESS', 'string' => translate('EMail address')); +$arrDescription[] = array('name' => 'LANG_PAGER_NUMBER', 'string' => translate('Pager number')); +$arrDescription[] = array('name' => 'LANG_ADDON_ADDRESS', 'string' => translate('Addon address')); +$arrDescription[] = array('name' => 'LANG_HOST_NOTIF_ENABLE', 'string' => translate('Host notif. enable')); +$arrDescription[] = array('name' => 'LANG_SERVICE_NOTIF_ENABLE', 'string' => translate('Service notif. enable')); +$arrDescription[] = array('name' => 'LANG_CAN_SUBMIT_COMMANDS', 'string' => translate('Can submit commands')); +$arrDescription[] = array('name' => 'LANG_RETAIN_STATUS_INFO', 'string' => translate('Retain status info')); +$arrDescription[] = array('name' => 'LANG_RETAIN_NONSTATUS_INFO', 'string' => translate('Retain non-status info')); +$arrDescription[] = array('name' => 'LANG_MEMBERS', 'string' => translate('Members')); +$arrDescription[] = array('name' => 'LANG_GROUP_MEMBERS', 'string' => translate('Group members')); +$arrDescription[] = array('name' => 'LANG_COMMON_SETTINGS', 'string' => translate('Common settings')); +$arrDescription[] = array('name' => 'LANG_SERVICE_SETTINGS', 'string' => translate('Service settings')); $arrDescription[] = array('name' => 'LANG_SERVICE_SETTINGS_DESC', 'string' => translate('Add this host configuration to existing service definitions')); -$arrDescription[] = array('name' => 'LANG_TEMPLATE_NAME', 'string' => translate('Template name')); -$arrDescription[] = array('name' => 'LANG_PARENTS', 'string' => translate('Parents')); -$arrDescription[] = array('name' => 'LANG_PARENT_SERVICES', 'string' => translate('Parent services')); -$arrDescription[] = array('name' => 'LANG_HOST_GROUPS', 'string' => translate('Host groups')); -$arrDescription[] = array('name' => 'LANG_CHECK_COMMAND', 'string' => translate('Check command')); -$arrDescription[] = array('name' => 'LANG_COMMAND_VIEW', 'string' => translate('Command view')); -$arrDescription[] = array('name' => 'LANG_ADDITIONAL_TEMPLATES', 'string' => translate('Additional templates')); -$arrDescription[] = array('name' => 'LANG_CHECK_SETTINGS', 'string' => translate('Check settings')); -$arrDescription[] = array('name' => 'LANG_INITIAL_STATE', 'string' => translate('Initial state')); -$arrDescription[] = array('name' => 'LANG_RETRY_INTERVAL', 'string' => translate('Retry interval')); -$arrDescription[] = array('name' => 'LANG_MAX_CHECK_ATTEMPTS', 'string' => translate('Max check attempts')); -$arrDescription[] = array('name' => 'LANG_CHECK_INTERVAL', 'string' => translate('Check interval')); -$arrDescription[] = array('name' => 'LANG_ACTIVE_CHECKS_ENABLED', 'string' => translate('Active checks enabled')); -$arrDescription[] = array('name' => 'LANG_PASSIVE_CHECKS_ENABLED', 'string' => translate('Passive checks enabled')); -$arrDescription[] = array('name' => 'LANG_CHECK_PERIOD', 'string' => translate('Check period')); -$arrDescription[] = array('name' => 'LANG_FRESHNESS_TRESHOLD', 'string' => translate('Freshness treshold')); -$arrDescription[] = array('name' => 'LANG_CHECK_FRESHNESS', 'string' => translate('Check freshness')); -$arrDescription[] = array('name' => 'LANG_OBSESS_OVER_HOST', 'string' => translate('Obsess over host')); -$arrDescription[] = array('name' => 'LANG_OBSESS_OVER_SERVICE', 'string' => translate('Obsess over service')); -$arrDescription[] = array('name' => 'LANG_EVENT_HANDLER', 'string' => translate('Event handler')); -$arrDescription[] = array('name' => 'LANG_EVENT_HANDLER_ENABLED', 'string' => translate('Event handler enabled')); -$arrDescription[] = array('name' => 'LANG_LOW_FLAP_THRESHOLD', 'string' => translate('Low flap threshold')); -$arrDescription[] = array('name' => 'LANG_HIGH_FLAP_THRESHOLD', 'string' => translate('High flap threshold')); -$arrDescription[] = array('name' => 'LANG_FLAP_DETECTION_ENABLED', 'string' => translate('Flap detection enabled')); -$arrDescription[] = array('name' => 'LANG_FLAP_DETECTION_OPTIONS', 'string' => translate('Flap detection options')); +$arrDescription[] = array('name' => 'LANG_TEMPLATE_NAME', 'string' => translate('Template name')); +$arrDescription[] = array('name' => 'LANG_PARENTS', 'string' => translate('Parents')); +$arrDescription[] = array('name' => 'LANG_PARENT_SERVICES', 'string' => translate('Parent services')); +$arrDescription[] = array('name' => 'LANG_HOST_GROUPS', 'string' => translate('Host groups')); +$arrDescription[] = array('name' => 'LANG_CHECK_COMMAND', 'string' => translate('Check command')); +$arrDescription[] = array('name' => 'LANG_COMMAND_VIEW', 'string' => translate('Command view')); +$arrDescription[] = array('name' => 'LANG_ADDITIONAL_TEMPLATES', 'string' => translate('Additional templates')); +$arrDescription[] = array('name' => 'LANG_CHECK_SETTINGS', 'string' => translate('Check settings')); +$arrDescription[] = array('name' => 'LANG_INITIAL_STATE', 'string' => translate('Initial state')); +$arrDescription[] = array('name' => 'LANG_RETRY_INTERVAL', 'string' => translate('Retry interval')); +$arrDescription[] = array('name' => 'LANG_MAX_CHECK_ATTEMPTS', 'string' => translate('Max check attempts')); +$arrDescription[] = array('name' => 'LANG_CHECK_INTERVAL', 'string' => translate('Check interval')); +$arrDescription[] = array('name' => 'LANG_ACTIVE_CHECKS_ENABLED', 'string' => translate('Active checks enabled')); +$arrDescription[] = array('name' => 'LANG_PASSIVE_CHECKS_ENABLED', 'string' => translate('Passive checks enabled')); +$arrDescription[] = array('name' => 'LANG_CHECK_PERIOD', 'string' => translate('Check period')); +$arrDescription[] = array('name' => 'LANG_FRESHNESS_TRESHOLD', 'string' => translate('Freshness treshold')); +$arrDescription[] = array('name' => 'LANG_CHECK_FRESHNESS', 'string' => translate('Check freshness')); +$arrDescription[] = array('name' => 'LANG_OBSESS_OVER_HOST', 'string' => translate('Obsess over host')); +$arrDescription[] = array('name' => 'LANG_OBSESS_OVER_SERVICE', 'string' => translate('Obsess over service')); +$arrDescription[] = array('name' => 'LANG_EVENT_HANDLER', 'string' => translate('Event handler')); +$arrDescription[] = array('name' => 'LANG_EVENT_HANDLER_ENABLED', 'string' => translate('Event handler enabled')); +$arrDescription[] = array('name' => 'LANG_LOW_FLAP_THRESHOLD', 'string' => translate('Low flap threshold')); +$arrDescription[] = array('name' => 'LANG_HIGH_FLAP_THRESHOLD', 'string' => translate('High flap threshold')); +$arrDescription[] = array('name' => 'LANG_FLAP_DETECTION_ENABLED', 'string' => translate('Flap detection enabled')); +$arrDescription[] = array('name' => 'LANG_FLAP_DETECTION_OPTIONS', 'string' => translate('Flap detection options')); $arrDescription[] = array('name' => 'LANG_RETAIN_STATUS_INFORMATION', 'string' => translate('Retain status information')); $arrDescription[] = array('name' => 'LANG_RETAIN_NOSTATUS_INFORMATION', 'string' => translate('Retain non-status information')); -$arrDescription[] = array('name' => 'LANG_PROCESS_PERF_DATA', 'string' => translate('Process perf data')); -$arrDescription[] = array('name' => 'LANG_ALARM_SETTINGS', 'string' => translate('Alarm settings')); -$arrDescription[] = array('name' => 'LANG_CONTACTS', 'string' => translate('Contacts')); -$arrDescription[] = array('name' => 'LANG_CONTACT_GROUPS', 'string' => translate('Contact groups')); -$arrDescription[] = array('name' => 'LANG_NOTIFICATION_PERIOD', 'string' => translate('Notification period')); -$arrDescription[] = array('name' => 'LANG_NOTIFICATION_OPTIONS', 'string' => translate('Notification options')); -$arrDescription[] = array('name' => 'LANG_NOTIFICATION_INTERVAL', 'string' => translate('Notification interval')); +$arrDescription[] = array('name' => 'LANG_PROCESS_PERF_DATA', 'string' => translate('Process perf data')); +$arrDescription[] = array('name' => 'LANG_ALARM_SETTINGS', 'string' => translate('Alarm settings')); +$arrDescription[] = array('name' => 'LANG_CONTACTS', 'string' => translate('Contacts')); +$arrDescription[] = array('name' => 'LANG_CONTACT_GROUPS', 'string' => translate('Contact groups')); +$arrDescription[] = array('name' => 'LANG_NOTIFICATION_PERIOD', 'string' => translate('Notification period')); +$arrDescription[] = array('name' => 'LANG_NOTIFICATION_OPTIONS', 'string' => translate('Notification options')); +$arrDescription[] = array('name' => 'LANG_NOTIFICATION_INTERVAL', 'string' => translate('Notification interval')); $arrDescription[] = array('name' => 'LANG_FIRST_NOTIFICATION_DELAY', 'string' => translate('First notification delay')); -$arrDescription[] = array('name' => 'LANG_NOTIFICATION_ENABLED', 'string' => translate('Notification enabled')); -$arrDescription[] = array('name' => 'LANG_IMPORTANCE', 'string' => translate('Importance')); -$arrDescription[] = array('name' => 'LANG_STALKING_OPTIONS', 'string' => translate('Stalking options')); -$arrDescription[] = array('name' => 'LANG_ADDON_SETTINGS', 'string' => translate('Addon settings')); -$arrDescription[] = array('name' => 'LANG_NOTES', 'string' => translate('Notes')); -$arrDescription[] = array('name' => 'LANG_VRML_IMAGE', 'string' => translate('VRML image')); -$arrDescription[] = array('name' => 'LANG_NOTES_URL', 'string' => translate('Notes URL')); -$arrDescription[] = array('name' => 'LANG_STATUS_IMAGE', 'string' => translate('Status image')); -$arrDescription[] = array('name' => 'LANG_ICON_IMAGE', 'string' => translate('Icon image')); -$arrDescription[] = array('name' => 'LANG_ACTION_URL', 'string' => translate('Action URL')); -$arrDescription[] = array('name' => 'LANG_2D_COORDS', 'string' => translate('2D coords')); -$arrDescription[] = array('name' => 'LANG_3D_COORDS', 'string' => translate('3D coords')); -$arrDescription[] = array('name' => 'LANG_ICON_IMAGE_ALT_TEXT', 'string' => translate('Icon image ALT text')); -$arrDescription[] = array('name' => 'LANG_STANDARD', 'string' => translate('standard')); -$arrDescription[] = array('name' => 'LANG_ON', 'string' => translate('on')); -$arrDescription[] = array('name' => 'LANG_OFF', 'string' => translate('off')); -$arrDescription[] = array('name' => 'LANG_SKIP', 'string' => translate('skip')); +$arrDescription[] = array('name' => 'LANG_NOTIFICATION_ENABLED', 'string' => translate('Notification enabled')); +$arrDescription[] = array('name' => 'LANG_IMPORTANCE', 'string' => translate('Importance')); +$arrDescription[] = array('name' => 'LANG_STALKING_OPTIONS', 'string' => translate('Stalking options')); +$arrDescription[] = array('name' => 'LANG_ADDON_SETTINGS', 'string' => translate('Addon settings')); +$arrDescription[] = array('name' => 'LANG_NOTES', 'string' => translate('Notes')); +$arrDescription[] = array('name' => 'LANG_VRML_IMAGE', 'string' => translate('VRML image')); +$arrDescription[] = array('name' => 'LANG_NOTES_URL', 'string' => translate('Notes URL')); +$arrDescription[] = array('name' => 'LANG_STATUS_IMAGE', 'string' => translate('Status image')); +$arrDescription[] = array('name' => 'LANG_ICON_IMAGE', 'string' => translate('Icon image')); +$arrDescription[] = array('name' => 'LANG_ACTION_URL', 'string' => translate('Action URL')); +$arrDescription[] = array('name' => 'LANG_2D_COORDS', 'string' => translate('2D coords')); +$arrDescription[] = array('name' => 'LANG_3D_COORDS', 'string' => translate('3D coords')); +$arrDescription[] = array('name' => 'LANG_ICON_IMAGE_ALT_TEXT', 'string' => translate('Icon image ALT text')); +$arrDescription[] = array('name' => 'LANG_STANDARD', 'string' => translate('standard')); +$arrDescription[] = array('name' => 'LANG_ON', 'string' => translate('on')); +$arrDescription[] = array('name' => 'LANG_OFF', 'string' => translate('off')); +$arrDescription[] = array('name' => 'LANG_SKIP', 'string' => translate('skip')); $arrDescription[] = array('name' => 'LANG_FREE_VARIABLE_DEFINITIONS', 'string' => translate('Free variable definitions')); -$arrDescription[] = array('name' => 'LANG_VARIABLE_NAME', 'string' => translate('Variable name')); -$arrDescription[] = array('name' => 'LANG_VARIABLE_VALUE', 'string' => translate('Variable value')); -$arrDescription[] = array('name' => 'DELETE', 'string' => translate('Delete')); -$arrDescription[] = array('name' => 'DUPLICATE', 'string' => translate('Copy')); -$arrDescription[] = array('name' => 'ACTIVATE', 'string' => translate('Activate')); -$arrDescription[] = array('name' => 'DEACTIVATE', 'string' => translate('Deactivate')); -$arrDescription[] = array('name' => 'INFO', 'string' => translate('Information')); -$arrDescription[] = array('name' => 'WRITE_CONFIG', 'string' => translate('Write config file')); +$arrDescription[] = array('name' => 'LANG_VARIABLE_NAME', 'string' => translate('Variable name')); +$arrDescription[] = array('name' => 'LANG_VARIABLE_VALUE', 'string' => translate('Variable value')); +$arrDescription[] = array('name' => 'DELETE', 'string' => translate('Delete')); +$arrDescription[] = array('name' => 'DUPLICATE', 'string' => translate('Copy')); +$arrDescription[] = array('name' => 'ACTIVATE', 'string' => translate('Activate')); +$arrDescription[] = array('name' => 'DEACTIVATE', 'string' => translate('Deactivate')); +$arrDescription[] = array('name' => 'INFO', 'string' => translate('Information')); +$arrDescription[] = array('name' => 'WRITE_CONFIG', 'string' => translate('Write config file')); $arrDescription[] = array('name' => 'LANG_DELETESINGLE', 'string' => translate('Do you really want to delete this database entry:')); $arrDescription[] = array('name' => 'LANG_DELETEOK', 'string' => translate('Do you really want to delete all marked entries?')); $arrDescription[] = array('name' => 'LANG_MARKALL', 'string' => translate('Mark all shown datasets')); -$arrDescription[] = array('name' => 'LANG_FILE', 'string' => translate('File')); -$arrDescription[] = array('name' => 'LANG_WRITE_CONF_ALL', 'string' => translate('Write all config files')); -$arrDescription[] = array('name' => 'LANG_ADDRESS', 'string' => translate('Address')); -$arrDescription[] = array('name' => 'LANG_DISPLAY_NAME', 'string' => translate('Display name')); +$arrDescription[] = array('name' => 'LANG_FILE', 'string' => translate('File')); +$arrDescription[] = array('name' => 'LANG_WRITE_CONF_ALL', 'string' => translate('Write all config files')); +$arrDescription[] = array('name' => 'LANG_ADDRESS', 'string' => translate('Address')); +$arrDescription[] = array('name' => 'LANG_DISPLAY_NAME', 'string' => translate('Display name')); $arrDescription[] = array('name' => 'LANG_USE_THIS_AS_TEMPLATE', 'string' => translate('Use this configuration as a template')); -$arrDescription[] = array('name' => 'LANG_GENERIC_NAME', 'string' => translate('Generic name')); -$arrDescription[] = array('name' => 'LANG_HOST_NAME', 'string' => translate('Host name')); +$arrDescription[] = array('name' => 'LANG_GENERIC_NAME', 'string' => translate('Generic name')); +$arrDescription[] = array('name' => 'LANG_HOST_NAME', 'string' => translate('Host name')); $arrDescription[] = array('name' => 'FILL_ALLFIELDS', 'string' => translate('Please fill in all fields marked with an *')); $arrDescription[] = array('name' => 'FILL_ILLEGALCHARS', 'string' => translate('The following field contains illegal characters:')); $arrDescription[] = array('name' => 'FILL_BOXES', 'string' => translate('Please check at least one option from:')); -$arrDescription[] = array('name' => 'LANG_HOSTGROUP_NAME', 'string' => translate('Host group name')); -$arrDescription[] = array('name' => 'LANG_HOSTGROUP_MEMBERS', 'string' => translate('Host group members')); -$arrDescription[] = array('name' => 'LANG_HOSTS', 'string' => translate('Hosts')); -$arrDescription[] = array('name' => 'LANG_SERVICE_DESCRIPTION', 'string' => translate('Service description')); -$arrDescription[] = array('name' => 'LANG_SERVICEGROUPS', 'string' => translate('Service groups')); -$arrDescription[] = array('name' => 'LANG_IS_VOLATILE', 'string' => translate('Is volatile')); -$arrDescription[] = array('name' => 'LANG_PARALLELIZE_CHECK', 'string' => translate('Parallelize checks')); -$arrDescription[] = array('name' => 'LANG_CONFIGFILTER', 'string' => translate('Config name filter')); -$arrDescription[] = array('name' => 'LANG_CONFIG_NAME', 'string' => translate('Config name')); -$arrDescription[] = array('name' => 'LANG_IMPORT_DIRECTORY', 'string' => translate('Import directory')); +$arrDescription[] = array('name' => 'LANG_HOSTGROUP_NAME', 'string' => translate('Host group name')); +$arrDescription[] = array('name' => 'LANG_HOSTGROUP_MEMBERS', 'string' => translate('Host group members')); +$arrDescription[] = array('name' => 'LANG_HOSTS', 'string' => translate('Hosts')); +$arrDescription[] = array('name' => 'LANG_SERVICE_DESCRIPTION', 'string' => translate('Service description')); +$arrDescription[] = array('name' => 'LANG_SERVICEGROUPS', 'string' => translate('Service groups')); +$arrDescription[] = array('name' => 'LANG_IS_VOLATILE', 'string' => translate('Is volatile')); +$arrDescription[] = array('name' => 'LANG_PARALLELIZE_CHECK', 'string' => translate('Parallelize checks')); +$arrDescription[] = array('name' => 'LANG_CONFIGFILTER', 'string' => translate('Config name filter')); +$arrDescription[] = array('name' => 'LANG_FILTER', 'string' => translate('Filter')); +$arrDescription[] = array('name' => 'LANG_SERVICE_NAME', 'string' => translate('Service name')); +$arrDescription[] = array('name' => 'LANG_CONFIG_NAME', 'string' => translate('Config name')); +$arrDescription[] = array('name' => 'LANG_IMPORT_DIRECTORY', 'string' => translate('Import directory')); $arrDescription[] = array('name' => 'LANG_INSERT_ALL_VARIABLE', 'string' => translate('Please insert a variable name and a variable definition')); $arrDescription[] = array('name' => 'LANG_MUST_BUT_TEMPLATE', - 'string' => '' .translate('Warning:'). ' ' .translate('You have not filled in some required fields!

' - . 'If this values are set by a template, you can save anyway - otherwise you will get an invalid ' + 'string' => '' . translate('Warning:') . ' ' . translate('You have not filled in some required fields!

' + . 'If these values are set by a template, you can save anyway - otherwise you will get an invalid ' . 'configuration!')); -$arrDescription[] = array('name' => 'LANG_TPLNAME', 'string' => translate('Template name')); -$arrDescription[] = array('name' => 'LANG_NAGIOS_BASEDIR', 'string' => translate('Nagios base directory')); -$arrDescription[] = array('name' => 'LANG_WRITE_CONFIG', 'string' => translate('Write config')); +$arrDescription[] = array('name' => 'LANG_TPLNAME', 'string' => translate('Template name')); +$arrDescription[] = array('name' => 'LANG_NAGIOS_BASEDIR', 'string' => translate('Nagios base directory')); +$arrDescription[] = array('name' => 'LANG_WRITE_CONFIG', 'string' => translate('Write config')); $arrDescription[] = array('name' => 'FILL_ARGUMENTS', - 'string' => '' .translate('Warning:'). ' ' .translate('You have not filled in all command arguments (ARGx) ' - . 'for your selected command!

If this arguments are optional, you can save anyway - otherwise ' + 'string' => '' . translate('Warning:') . ' ' . translate('You have not filled in all command arguments (ARGx) ' + . 'for your selected command!

If these arguments are optional, you can save anyway - otherwise ' . 'you will get an invalid configuration!')); -$arrDescription[] = array('name' => 'LANG_SERVICEGROUP_MEMBERS', 'string' => translate('Service group members')); -$arrDescription[] = array('name' => 'LANG_SERVICEGROUP_NAME', 'string' => translate('Service group name')); -$arrDescription[] = array('name' => 'LANG_DEPENDHOSTS', 'string' => translate('Dependent hosts')); -$arrDescription[] = array('name' => 'LANG_DEPENDHOSTGRS', 'string' => translate('Dependent hostgroups')); -$arrDescription[] = array('name' => 'LANG_HOSTGROUPS', 'string' => translate('Hostgroups')); -$arrDescription[] = array('name' => 'LANG_INHERIT', 'string' => translate('Inherit parents')); +$arrDescription[] = array('name' => 'LANG_SERVICEGROUP_MEMBERS', 'string' => translate('Service group members')); +$arrDescription[] = array('name' => 'LANG_SERVICEGROUP_NAME', 'string' => translate('Service group name')); +$arrDescription[] = array('name' => 'LANG_DEPENDHOSTS', 'string' => translate('Dependent hosts')); +$arrDescription[] = array('name' => 'LANG_DEPENDHOSTGRS', 'string' => translate('Dependent hostgroups')); +$arrDescription[] = array('name' => 'LANG_HOSTGROUPS', 'string' => translate('Hostgroups')); +$arrDescription[] = array('name' => 'LANG_INHERIT', 'string' => translate('Inherit parents')); $arrDescription[] = array('name' => 'LANG_EXECFAILCRIT', 'string' => translate('Execution failure criteria')); $arrDescription[] = array('name' => 'LANG_NOTIFFAILCRIT', 'string' => translate('Nofification failure criteria')); -$arrDescription[] = array('name' => 'LANG_DEPENDENCY_PERIOD', 'string' => translate('Dependency period')); -$arrDescription[] = array('name' => 'LANG_ESCALATION_PERIOD', 'string' => translate('Escalation period')); -$arrDescription[] = array('name' => 'LANG_ESCALATION_OPTIONS', 'string' => translate('Escalation options')); -$arrDescription[] = array('name' => 'LANG_FIRST_NOTIFICATION', 'string' => translate('First notification')); -$arrDescription[] = array('name' => 'LANG_LAST_NOTIFICATION', 'string' => translate('Last notification')); -$arrDescription[] = array('name' => 'LANG_DEPENDSERVICES', 'string' => translate('Dependent services')); -$arrDescription[] = array('name' => 'LANG_SERVICES', 'string' => translate('Services')); +$arrDescription[] = array('name' => 'LANG_DEPENDENCY_PERIOD', 'string' => translate('Dependency period')); +$arrDescription[] = array('name' => 'LANG_ESCALATION_PERIOD', 'string' => translate('Escalation period')); +$arrDescription[] = array('name' => 'LANG_ESCALATION_OPTIONS', 'string' => translate('Escalation options')); +$arrDescription[] = array('name' => 'LANG_FIRST_NOTIFICATION', 'string' => translate('First notification')); +$arrDescription[] = array('name' => 'LANG_LAST_NOTIFICATION', 'string' => translate('Last notification')); +$arrDescription[] = array('name' => 'LANG_DEPENDSERVICES', 'string' => translate('Dependent services')); +$arrDescription[] = array('name' => 'LANG_SERVICES', 'string' => translate('Services')); $arrDescription[] = array('name' => 'LANG_DEPENDSERVICEGROUPS', 'string' => translate('Dependent servicegroups')); -$arrDescription[] = array('name' => 'LANG_HELP', 'string' => translate('Help')); -$arrDescription[] = array('name' => 'LANG_CALENDAR', 'string' => translate('Calendar')); -$arrDescription[] = array('name' => 'LANG_GROUPNAME', 'string' => translate('Group name')); -$arrDescription[] = array('name' => 'LANG_USERS', 'string' => translate('Users')); -$arrDescription[] = array('name' => 'LANG_ACCESS_GROUP', 'string' => translate('Access group')); -$arrDescription[] = array('name' => 'LANG_USER_DEFINITIONS', 'string' => translate('User definitions')); -$arrDescription[] = array('name' => 'LANG_USER_NAME', 'string' => translate('User name')); -$arrDescription[] = array('name' => 'LANG_USER_RIGHTS', 'string' => translate('User rights')); +$arrDescription[] = array('name' => 'LANG_HELP', 'string' => translate('Help')); +$arrDescription[] = array('name' => 'LANG_CALENDAR', 'string' => translate('Calendar')); +$arrDescription[] = array('name' => 'LANG_GROUPNAME', 'string' => translate('Group name')); +$arrDescription[] = array('name' => 'LANG_USERS', 'string' => translate('Users')); +$arrDescription[] = array('name' => 'LANG_ACCESS_GROUP', 'string' => translate('Access group')); +$arrDescription[] = array('name' => 'LANG_USER_DEFINITIONS', 'string' => translate('User definitions')); +$arrDescription[] = array('name' => 'LANG_USER_NAME', 'string' => translate('User name')); +$arrDescription[] = array('name' => 'LANG_USER_RIGHTS', 'string' => translate('User rights')); $arrDescription[] = array('name' => 'LANG_OBJECT_ACCESS_RESTRICTIONS', 'string' => translate('Object access restrictions')); $arrDescription[] = array('name' => 'LANG_ADMIN_ENABLE', 'string' => translate('Enable group administration')); -$arrDescription[] = array('name' => 'LANG_SHOW_RELATION_DATA', 'string' => translate('Show relation data')); -$arrDescription[] = array('name' => 'LANG_HIDE_RELATION_DATA', 'string' => translate('Hide relation data')); -$arrDescription[] = array('name' => 'LANG_CONFIG_TARGET', 'string' => translate('Configuration target')); -$arrDescription[] = array('name' => 'LANG_LANGUAGE', 'string' => translate('User language')); -$arrDescription[] = array('name' => 'LANG_STANDARD_DOMAIN', 'string' => translate('Standard domain')); +$arrDescription[] = array('name' => 'LANG_SHOW_RELATION_DATA', 'string' => translate('Show relation data')); +$arrDescription[] = array('name' => 'LANG_HIDE_RELATION_DATA', 'string' => translate('Hide relation data')); +$arrDescription[] = array('name' => 'LANG_CONFIG_TARGET', 'string' => translate('Configuration target')); +$arrDescription[] = array('name' => 'LANG_LANGUAGE', 'string' => translate('User language')); +$arrDescription[] = array('name' => 'LANG_STANDARD_DOMAIN', 'string' => translate('Standard domain')); $arrDescription[] = array('name' => 'LANG_SERVICES_WARNING', - 'string' => '' .translate('Warning:'). ' ' .translate('The associated services must be additionally '. + 'string' => '' . translate('Warning:') . ' ' . translate('The associated services must be additionally ' . 'written to the files. Only writing the host configuration is not sufficient because the modification is ' . 'stored inside the service files!')); // weekdays -$arrDescription[] = array('name' => 'LANG_MONDAY', 'string' => translate('Monday')); -$arrDescription[] = array('name' => 'LANG_TUESDAY', 'string' => translate('Tuesday')); -$arrDescription[] = array('name' => 'LANG_WEDNESDAY', 'string' => translate('Wednesday')); -$arrDescription[] = array('name' => 'LANG_THURSDAY', 'string' => translate('Thursday')); -$arrDescription[] = array('name' => 'LANG_FRIDAY', 'string' => translate('Friday')); -$arrDescription[] = array('name' => 'LANG_SATURDAY', 'string' => translate('Saturday')); -$arrDescription[] = array('name' => 'LANG_SUNDAY', 'string' => translate('Sunday')); -if ($SETS['common']['seldisable'] == 0) { +$arrDescription[] = array('name' => 'LANG_MONDAY', 'string' => translate('Monday')); +$arrDescription[] = array('name' => 'LANG_TUESDAY', 'string' => translate('Tuesday')); +$arrDescription[] = array('name' => 'LANG_WEDNESDAY', 'string' => translate('Wednesday')); +$arrDescription[] = array('name' => 'LANG_THURSDAY', 'string' => translate('Thursday')); +$arrDescription[] = array('name' => 'LANG_FRIDAY', 'string' => translate('Friday')); +$arrDescription[] = array('name' => 'LANG_SATURDAY', 'string' => translate('Saturday')); +$arrDescription[] = array('name' => 'LANG_SUNDAY', 'string' => translate('Sunday')); +if ($SETS['common']['seldisable'] === 0) { $arrDescription[] = array('name' => 'LANG_CTRLINFO', 'string' => translate('Hold CTRL to select
more than one entry')); } else { - $arrDescription[] = array('name' => 'LANG_CTRLINFO', 'string' => ' '); + $arrDescription[] = array('name' => 'LANG_CTRLINFO', 'string' => ' '); } -// -// Quick fix for poEdit for dynamically loaded Parameters -// ====================================================== -// -// Main menu +/* +Quick fix for poEdit for dynamically loaded Parameters +*/ +/* Main menu */ translate('Main page'); translate('Supervision'); translate('Alarming'); @@ -296,7 +300,7 @@ translate('Commands'); translate('Specialties'); translate('Tools'); translate('Administration'); -// Submenu +/* Submenu */ translate('Hosts'); translate('Time periods'); translate('Host templates'); @@ -331,4 +335,4 @@ translate('Contact templates'); translate('Help editor'); translate('Data domains'); translate('Config targets'); -translate('Support'); +translate('Support'); \ No newline at end of file diff --git a/config/locale/da_DK/LC_MESSAGES/da_DK.po b/config/locale/da_DK/LC_MESSAGES/da_DK.po index 00eaf0e..eb3162a 100644 --- a/config/locale/da_DK/LC_MESSAGES/da_DK.po +++ b/config/locale/da_DK/LC_MESSAGES/da_DK.po @@ -3,7 +3,7 @@ # # Project : NagiosQL # # Component : Translation File English # # Website : https://sourceforge.net/projects/nagiosql/ -# # Version : 3.4.0 +# # Version : 3.4.1 # # GIT Repo : https://gitlab.com/wizonet/NagiosQL # # # ############################################################################# diff --git a/config/locale/de_DE/LC_MESSAGES/de_DE.mo b/config/locale/de_DE/LC_MESSAGES/de_DE.mo index b9c393a..79be087 100644 Binary files a/config/locale/de_DE/LC_MESSAGES/de_DE.mo and b/config/locale/de_DE/LC_MESSAGES/de_DE.mo differ diff --git a/config/locale/de_DE/LC_MESSAGES/de_DE.po b/config/locale/de_DE/LC_MESSAGES/de_DE.po index 25cda0d..fbec526 100644 --- a/config/locale/de_DE/LC_MESSAGES/de_DE.po +++ b/config/locale/de_DE/LC_MESSAGES/de_DE.po @@ -3,7 +3,7 @@ # # Project : NagiosQL # # Component : Translation File English # # Website : https://sourceforge.net/projects/nagiosql/ -# # Version : 3.4.0 +# # Version : 3.5.0 # # GIT Repo : https://gitlab.com/wizonet/NagiosQL # # # ############################################################################# @@ -11,10 +11,10 @@ # Martin , 2012. msgid "" msgstr "" -"Project-Id-Version: NagiosQL 3.4\n" +"Project-Id-Version: NagiosQL 3.5.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-05-07 16:01+0200\n" -"PO-Revision-Date: 2018-05-07 16:01+0200\n" +"POT-Creation-Date: 2023-01-20 15:11+0100\n" +"PO-Revision-Date: 2023-01-20 15:28+0100\n" "Last-Translator: \n" "Language-Team: German (http://www.transifex.net/projects/p/nagiosql/language/" "de/)\n" @@ -23,7 +23,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 2.0.6\n" +"X-Generator: Poedit 3.2.2\n" "X-Poedit-Basepath: ../../../..\n" "X-Poedit-KeywordsList: translate\n" "X-Poedit-SourceCharset: UTF-8\n" @@ -33,11 +33,11 @@ msgstr "" "X-Poedit-SearchPathExcluded-2: functions/yui\n" "X-Poedit-SearchPathExcluded-3: functions/tinyMCE\n" -#: admin.php:37 +#: admin.php:40 msgid "NagiosQL Administration" msgstr "NagiosQL Verwaltung" -#: admin.php:40 +#: admin.php:43 msgid "" "Welcome to NagiosQL, the administration module that can be used to easily " "create, modify and delete configuration files for Nagios. The data is stored " @@ -49,22 +49,22 @@ msgstr "" "Datenbank gespeichert und bei Bedarf als reguläre Konfigurationsdatei " "geschrieben." -#: admin/administration.php:35 config/fieldvars.php:298 -#: functions/prepend_adm.php:460 functions/prepend_adm.php:469 +#: admin/administration.php:37 config/fieldvars.php:302 +#: functions/prepend_adm.php:459 functions/prepend_adm.php:466 msgid "Administration" msgstr "Verwaltung" # administration.php -#: admin/administration.php:38 +#: admin/administration.php:40 msgid "Functions to administrate NagiosQL V3" msgstr "Funktionen für die Administration von NagiosQL V3" -#: admin/alarming.php:35 config/fieldvars.php:293 config/fieldvars.php:294 +#: admin/alarming.php:44 config/fieldvars.php:297 config/fieldvars.php:298 msgid "Alarming" msgstr "Alarmierung" # alarming.php -#: admin/alarming.php:36 +#: admin/alarming.php:45 msgid "" "To define contact data, contact templates and contact groups and time " "periods." @@ -72,64 +72,64 @@ msgstr "" "Definieren von Kontaktdaten, Kontaktvorlagen, Kontaktgruppen und " "Zeitperioden." -#: admin/alarming.php:38 admin/commands.php:38 admin/monitoring.php:40 -#: admin/specials.php:40 +#: admin/alarming.php:47 admin/commands.php:47 admin/monitoring.php:49 +#: admin/specials.php:49 msgid "Statistical datas" msgstr "Statistische Daten" -#: admin/alarming.php:39 admin/commands.php:39 admin/monitoring.php:41 -#: admin/specials.php:41 +#: admin/alarming.php:48 admin/commands.php:48 admin/monitoring.php:50 +#: admin/specials.php:50 msgid "Group" msgstr "Gruppe" -#: admin/alarming.php:40 admin/commands.php:40 admin/monitoring.php:42 -#: admin/specials.php:42 config/fieldvars.php:55 +#: admin/alarming.php:49 admin/commands.php:49 admin/monitoring.php:51 +#: admin/specials.php:51 config/fieldvars.php:56 msgid "Active" msgstr "Aktiv" -#: admin/alarming.php:41 admin/commands.php:41 admin/monitoring.php:43 -#: admin/specials.php:43 +#: admin/alarming.php:50 admin/commands.php:50 admin/monitoring.php:52 +#: admin/specials.php:52 msgid "Inactive" msgstr "Inaktiv" -#: admin/alarming.php:52 config/fieldvars.php:303 +#: admin/alarming.php:61 config/fieldvars.php:307 msgid "Contact data" msgstr "Kontaktdaten" -#: admin/alarming.php:60 config/fieldvars.php:156 config/fieldvars.php:304 +#: admin/alarming.php:69 config/fieldvars.php:159 config/fieldvars.php:308 msgid "Contact groups" msgstr "Kontaktgruppen" -#: admin/alarming.php:68 config/fieldvars.php:301 +#: admin/alarming.php:77 config/fieldvars.php:305 msgid "Time periods" msgstr "Zeitperioden" -#: admin/alarming.php:76 config/fieldvars.php:330 +#: admin/alarming.php:85 config/fieldvars.php:334 msgid "Contact templates" msgstr "Kontaktvorlagen" -#: admin/cgicfg.php:65 admin/cgicfg.php:87 admin/nagioscfg.php:65 -#: admin/nagioscfg.php:87 admin/verify.php:63 admin/verify.php:85 -#: functions/NagConfigClass.php:2107 +#: admin/cgicfg.php:85 admin/cgicfg.php:107 admin/nagioscfg.php:82 +#: admin/nagioscfg.php:104 admin/verify.php:87 admin/verify.php:109 +#: functions/NagConfigClass.php:2432 msgid "Configuration file successfully written!" msgstr "Konfigurationsdatei erfolgreich geschrieben!" -#: admin/cgicfg.php:67 admin/cgicfg.php:89 admin/nagioscfg.php:67 -#: admin/nagioscfg.php:89 functions/NagConfigClass.php:2106 +#: admin/cgicfg.php:87 admin/cgicfg.php:109 admin/nagioscfg.php:84 +#: admin/nagioscfg.php:106 functions/NagConfigClass.php:2431 msgid "Configuration successfully written:" msgstr "Konfiguration erfolgreich geschrieben:" -#: admin/cgicfg.php:69 admin/nagioscfg.php:69 admin/verify.php:65 -#: admin/verify.php:87 functions/NagConfigClass.php:1993 +#: admin/cgicfg.php:89 admin/nagioscfg.php:86 admin/verify.php:89 +#: admin/verify.php:111 functions/NagConfigClass.php:2195 msgid "Cannot open/overwrite the configuration file (check the permissions)!" msgstr "" "Kann Konfigurationsdatei nicht öffnen/überschreiben (Berechtigungen prüfen)!" -#: admin/cgicfg.php:71 admin/nagioscfg.php:71 functions/NagConfigClass.php:1992 +#: admin/cgicfg.php:91 admin/nagioscfg.php:88 functions/NagConfigClass.php:2194 msgid "Configuration write failed:" msgstr "Schreiben der Konfiguration fehlgeschlagen:" -#: admin/cgicfg.php:92 admin/nagioscfg.php:92 +#: admin/cgicfg.php:111 admin/nagioscfg.php:108 msgid "" "Cannot open/overwrite the configuration file (check the permissions on " "remote system)!" @@ -137,12 +137,12 @@ msgstr "" "Kann die Konfigurationsdatei nicht öffnen/überschreiben (Berechtigungen auf " "dem entfernten System prüfen)!" -#: admin/cgicfg.php:94 admin/nagioscfg.php:94 +#: admin/cgicfg.php:113 admin/nagioscfg.php:110 msgid "Configuration write failed (remote):" msgstr "" "Konfigurationsdatei konnte nicht geschrieben werden (Entfernter Zugriff)" -#: admin/cgicfg.php:99 admin/nagioscfg.php:99 +#: admin/cgicfg.php:118 admin/nagioscfg.php:115 msgid "" "There are no nagios configuration files in common domain, please select a " "valid domain to edit this files!" @@ -150,661 +150,662 @@ msgstr "" "In der gemeinsamen Domäne gibt es keine Nagios Konfigurationsdateien. Wählen " "sie bitte eine gültige Konfigurationsdomäne um diese Dateien zu bearbeiten!" -#: admin/cgicfg.php:105 +#: admin/cgicfg.php:124 msgid "CGI configuration file" msgstr "CGI Konfigurationsdatei" -#: admin/cgicfg.php:123 admin/nagioscfg.php:123 -#: functions/NagImportClass.php:209 +#: admin/cgicfg.php:142 admin/nagioscfg.php:139 +#: functions/NagImportClass.php:206 msgid "Cannot open the data file (check the permissions)!" msgstr "Datei kann nicht geöffnet werden (Berechtigungen prüfen)!" -#: admin/cgicfg.php:139 admin/nagioscfg.php:138 +#: admin/cgicfg.php:158 admin/nagioscfg.php:154 msgid "Cannot open the temporary file" msgstr "Kann die temporäre Datei nicht öffnen" -#: admin/cgicfg.php:143 admin/nagioscfg.php:142 +#: admin/cgicfg.php:162 admin/nagioscfg.php:158 msgid "Configuration read failed (remote):" msgstr "Konfigurationsdatei konnte nicht gelesen werden (Entfernter Zugriff)" -#: admin/checkcommands.php:62 +#: admin/checkcommands.php:109 msgid "New command inserted:" msgstr "Neuer Befehl eingetragen:" -#: admin/checkcommands.php:65 +#: admin/checkcommands.php:112 msgid "Command modified:" msgstr "Befehl modifiziert:" -#: admin/checkcommands.php:70 admin/configtargets.php:152 -#: admin/contactgroups.php:123 admin/contacts.php:237 -#: admin/contacttemplates.php:242 admin/datadomain.php:72 admin/group.php:115 -#: admin/hostdependencies.php:182 admin/hostescalations.php:182 -#: admin/hostextinfo.php:72 admin/hostgroups.php:124 admin/hosts.php:380 -#: admin/hosttemplates.php:272 admin/password.php:83 -#: admin/servicedependencies.php:290 admin/serviceescalations.php:233 -#: admin/serviceextinfo.php:81 admin/servicegroups.php:126 -#: admin/services.php:387 admin/servicetemplates.php:318 -#: admin/timeperiods.php:150 admin/user.php:82 +#: admin/checkcommands.php:117 admin/configtargets.php:212 +#: admin/contactgroups.php:174 admin/contacts.php:324 +#: admin/contacttemplates.php:328 admin/datadomain.php:105 admin/group.php:143 +#: admin/hostdependencies.php:256 admin/hostescalations.php:251 +#: admin/hostextinfo.php:117 admin/hostgroups.php:179 admin/hosts.php:510 +#: admin/hosttemplates.php:387 admin/password.php:101 +#: admin/servicedependencies.php:394 admin/serviceescalations.php:319 +#: admin/serviceextinfo.php:125 admin/servicegroups.php:181 +#: admin/services.php:530 admin/servicetemplates.php:449 +#: admin/timeperiods.php:201 admin/user.php:117 msgid "Database entry failed! Not all necessary data filled in!" msgstr "Datenbankeintrag fehlgeschlagen! Nicht alle Pflichtfelder ausgefüllt!" -#: admin/checkcommands.php:75 admin/configtargets.php:157 -#: admin/contactgroups.php:128 admin/contacts.php:242 -#: admin/contacttemplates.php:247 admin/datadomain.php:77 admin/group.php:120 -#: admin/hostdependencies.php:187 admin/hostescalations.php:187 -#: admin/hostextinfo.php:77 admin/hostgroups.php:129 admin/hosts.php:385 -#: admin/hosttemplates.php:277 admin/servicedependencies.php:295 -#: admin/serviceescalations.php:238 admin/serviceextinfo.php:86 -#: admin/servicegroups.php:131 admin/services.php:392 -#: admin/servicetemplates.php:323 admin/timeperiods.php:155 admin/user.php:87 +#: admin/checkcommands.php:122 admin/configtargets.php:217 +#: admin/contactgroups.php:179 admin/contacts.php:329 +#: admin/contacttemplates.php:333 admin/datadomain.php:110 admin/group.php:148 +#: admin/hostdependencies.php:261 admin/hostescalations.php:256 +#: admin/hostextinfo.php:122 admin/hostgroups.php:184 admin/hosts.php:515 +#: admin/hosttemplates.php:392 admin/servicedependencies.php:399 +#: admin/serviceescalations.php:324 admin/serviceextinfo.php:130 +#: admin/servicegroups.php:186 admin/services.php:535 +#: admin/servicetemplates.php:454 admin/timeperiods.php:206 admin/user.php:122 msgid "Database entry failed! No write access!" msgstr "Datenbankeintrag fehlgeschlagen! Keine Schreibrechte!" -#: admin/checkcommands.php:108 admin/contactgroups.php:199 -#: admin/contacts.php:398 admin/contacttemplates.php:398 -#: admin/datadomain.php:114 admin/hostdependencies.php:301 -#: admin/hostescalations.php:305 admin/hostextinfo.php:122 -#: admin/hostgroups.php:202 admin/hosts.php:596 admin/hosttemplates.php:466 -#: admin/servicedependencies.php:646 admin/serviceescalations.php:500 -#: admin/serviceextinfo.php:173 admin/servicegroups.php:204 -#: admin/services.php:630 admin/servicetemplates.php:551 -#: admin/timeperiods.php:225 +#: admin/checkcommands.php:152 admin/contactgroups.php:239 +#: admin/contacts.php:462 admin/contacttemplates.php:462 +#: admin/datadomain.php:140 admin/hostdependencies.php:351 +#: admin/hostescalations.php:350 admin/hostextinfo.php:159 +#: admin/hostgroups.php:245 admin/hosts.php:695 admin/hosttemplates.php:552 +#: admin/servicedependencies.php:700 admin/serviceescalations.php:546 +#: admin/serviceextinfo.php:204 admin/servicegroups.php:247 +#: admin/services.php:739 admin/servicetemplates.php:641 +#: admin/timeperiods.php:266 msgid "Saving not possible!" msgstr "Speichern nicht möglich!" # checkcommand.php -#: admin/checkcommands.php:113 admin/checkcommands.php:144 +#: admin/checkcommands.php:157 admin/checkcommands.php:188 msgid "Command definitions" msgstr "Befehlsdefinitionen (commands.cfg)" -#: admin/checkcommands.php:114 +#: admin/checkcommands.php:158 msgid "unclassified" msgstr "nicht klassifiziert" -#: admin/checkcommands.php:115 +#: admin/checkcommands.php:159 msgid "check command" msgstr "Prüfbefehl (check)" -#: admin/checkcommands.php:116 +#: admin/checkcommands.php:160 msgid "misc command" msgstr "Spezialbefehl (misc)" -#: admin/checkcommands.php:122 admin/contactgroups.php:209 -#: admin/contacts.php:419 admin/contacttemplates.php:418 -#: admin/hostdependencies.php:308 admin/hostescalations.php:312 -#: admin/hostextinfo.php:132 admin/hostgroups.php:212 admin/hosts.php:606 -#: admin/hosttemplates.php:476 admin/servicedependencies.php:679 -#: admin/serviceescalations.php:536 admin/serviceextinfo.php:199 -#: admin/servicegroups.php:214 admin/services.php:637 -#: admin/servicetemplates.php:558 admin/timeperiods.php:236 +#: admin/checkcommands.php:166 admin/contactgroups.php:249 +#: admin/contacts.php:483 admin/contacttemplates.php:482 +#: admin/hostdependencies.php:358 admin/hostescalations.php:357 +#: admin/hostextinfo.php:169 admin/hostgroups.php:255 admin/hosts.php:705 +#: admin/hosttemplates.php:562 admin/servicedependencies.php:733 +#: admin/serviceescalations.php:582 admin/serviceextinfo.php:230 +#: admin/servicegroups.php:257 admin/services.php:746 +#: admin/servicetemplates.php:648 admin/timeperiods.php:277 msgid "Entry cannot be activated because it is used by another configuration" msgstr "" "Eintrag kann nicht deaktiviert werden, da er als obligatorischer Eintrag in " "einer anderen Konfiguration verwendet wird" -#: admin/checkcommands.php:145 +#: admin/checkcommands.php:189 msgid "Command name" msgstr "Befehlsname" -#: admin/checkcommands.php:146 config/fieldvars.php:90 +#: admin/checkcommands.php:190 config/fieldvars.php:92 msgid "Command line" msgstr "Befehlszeile" # prepend.adm -#: admin/checkcommands.php:163 admin/checkcommands.php:177 -#: admin/configtargets.php:321 admin/configtargets.php:335 -#: admin/contactgroups.php:242 admin/contactgroups.php:256 -#: admin/contacts.php:477 admin/contacts.php:491 admin/contacttemplates.php:475 -#: admin/contacttemplates.php:489 admin/datadomain.php:162 -#: admin/datadomain.php:176 admin/group.php:177 admin/group.php:190 -#: admin/hostdependencies.php:352 admin/hostdependencies.php:366 -#: admin/hostescalations.php:349 admin/hostescalations.php:363 -#: admin/hostextinfo.php:167 admin/hostextinfo.php:184 admin/hostgroups.php:246 -#: admin/hostgroups.php:260 admin/hosts.php:690 admin/hosts.php:704 -#: admin/hosttemplates.php:558 admin/hosttemplates.php:572 admin/logbook.php:50 -#: admin/logbook.php:77 admin/menuaccess.php:69 admin/password.php:45 -#: admin/password.php:66 admin/servicedependencies.php:723 -#: admin/servicedependencies.php:737 admin/serviceescalations.php:574 -#: admin/serviceescalations.php:588 admin/serviceextinfo.php:235 -#: admin/serviceextinfo.php:253 admin/servicegroups.php:248 -#: admin/servicegroups.php:262 admin/services.php:713 admin/services.php:746 -#: admin/services.php:761 admin/servicetemplates.php:642 -#: admin/servicetemplates.php:656 admin/settings.php:241 -#: admin/timeperiods.php:271 admin/timeperiods.php:285 admin/user.php:188 -#: admin/user.php:201 functions/NagConfigClass.php:1352 -#: functions/NagDataClass.php:191 functions/NagVisualClass.php:841 -#: functions/prepend_adm.php:111 functions/prepend_adm.php:322 -#: functions/prepend_adm.php:381 functions/prepend_adm.php:495 -#: functions/prepend_adm.php:527 functions/prepend_content.php:495 +#: admin/checkcommands.php:211 admin/checkcommands.php:225 +#: admin/configtargets.php:379 admin/configtargets.php:393 +#: admin/contactgroups.php:286 admin/contactgroups.php:300 +#: admin/contacts.php:544 admin/contacts.php:558 admin/contacttemplates.php:542 +#: admin/contacttemplates.php:556 admin/datadomain.php:190 +#: admin/datadomain.php:204 admin/group.php:208 admin/group.php:221 +#: admin/hostdependencies.php:405 admin/hostdependencies.php:419 +#: admin/hostescalations.php:397 admin/hostescalations.php:411 +#: admin/hostextinfo.php:207 admin/hostextinfo.php:224 admin/hostgroups.php:312 +#: admin/hostgroups.php:326 admin/hosts.php:812 admin/hosts.php:826 +#: admin/hosttemplates.php:658 admin/hosttemplates.php:672 admin/logbook.php:69 +#: admin/logbook.php:96 admin/menuaccess.php:86 admin/password.php:63 +#: admin/password.php:84 admin/servicedependencies.php:780 +#: admin/servicedependencies.php:794 admin/serviceescalations.php:623 +#: admin/serviceescalations.php:637 admin/serviceextinfo.php:269 +#: admin/serviceextinfo.php:287 admin/servicegroups.php:314 +#: admin/servicegroups.php:328 admin/services.php:824 admin/services.php:880 +#: admin/services.php:895 admin/servicetemplates.php:747 +#: admin/servicetemplates.php:761 admin/settings.php:274 +#: admin/timeperiods.php:316 admin/timeperiods.php:330 admin/user.php:217 +#: admin/user.php:230 functions/NagConfigClass.php:1191 +#: functions/NagDataClass.php:90 functions/NagVisualClass.php:1365 +#: functions/prepend_adm.php:112 functions/prepend_adm.php:321 +#: functions/prepend_adm.php:381 functions/prepend_adm.php:492 +#: functions/prepend_adm.php:524 functions/prepend_content.php:541 msgid "Error while selecting data from database:" msgstr "Fehler bei der Datenbankabfrage:" -#: admin/commands.php:35 admin/commands.php:49 +#: admin/commands.php:44 admin/commands.php:58 msgid "Check commands" msgstr "Definitionen" # commands.php -#: admin/commands.php:36 +#: admin/commands.php:45 msgid "" "To define check and misc commands, notification commands and special " "commands." msgstr "Definieren von Prüfbefehlen, Alarmierungsbefehlen und Spezialbefehlen." # mutdialog.php -#: admin/configtargets.php:60 admin/configtargets.php:67 -#: admin/configtargets.php:89 admin/configtargets.php:94 +#: admin/configtargets.php:120 admin/configtargets.php:127 +#: admin/configtargets.php:149 admin/configtargets.php:154 msgid "is not writeable" msgstr "ist nicht beschreibbar" -#: admin/configtargets.php:66 admin/configtargets.php:82 admin/support.php:287 -#: config/fieldvars.php:46 +#: admin/configtargets.php:126 admin/configtargets.php:142 +#: admin/support.php:307 config/fieldvars.php:47 msgid "Nagios config file" msgstr "Nagios Konfigurationsdatei" -#: admin/configtargets.php:83 +#: admin/configtargets.php:143 msgid "is not a valid configuration file!" msgstr "ist keine gültige Konfigurationsdatei!" -#: admin/configtargets.php:88 config/fieldvars.php:226 +#: admin/configtargets.php:148 config/fieldvars.php:231 msgid "Nagios base directory" msgstr "Nagios Basisverzeichnis" -#: admin/configtargets.php:93 +#: admin/configtargets.php:153 msgid "Nagios cgi config file" msgstr "Nagios CGI Konfigurationsdatei" -#: admin/configtargets.php:98 +#: admin/configtargets.php:158 msgid "Nagios resource config file" msgstr "Nagios Ressource Konfigurationsdatei" # mutdialog.php -#: admin/configtargets.php:99 +#: admin/configtargets.php:159 msgid "is not readable" msgstr "ist nicht lesbar" -#: admin/configtargets.php:105 functions/NagConfigClass.php:363 -#: functions/NagConfigClass.php:2083 +#: admin/configtargets.php:165 functions/NagConfigClass.php:375 +#: functions/NagConfigClass.php:2409 msgid "SSH module not loaded!" msgstr "SSH Modul nicht geladen!" -#: admin/configtargets.php:110 functions/NagConfigClass.php:2061 +#: admin/configtargets.php:170 functions/NagConfigClass.php:2387 msgid "FTP module not loaded!" msgstr "FTP Modul nicht geladen!" # domain.php -#: admin/configtargets.php:144 admin/datadomain.php:64 +#: admin/configtargets.php:204 admin/datadomain.php:97 msgid "New Domain inserted:" msgstr "Neue Domäne hinzugefügt:" -#: admin/configtargets.php:147 admin/datadomain.php:67 +#: admin/configtargets.php:207 admin/datadomain.php:100 msgid "Domain modified:" msgstr "Domäne modifiziert:" -#: admin/configtargets.php:180 admin/configtargets.php:309 +#: admin/configtargets.php:236 admin/configtargets.php:365 msgid "Configuration domain administration" msgstr "Konfigurationsdomänen" -#: admin/configtargets.php:182 +#: admin/configtargets.php:238 msgid "Warning, at least one error occured, please check!" msgstr "Warnung, es ist mindestens ein Fehler aufgetreten, bitte prüfen!" -#: admin/configtargets.php:188 admin/datadomain.php:117 admin/group.php:149 -#: admin/password.php:99 admin/user.php:130 config/fieldvars.php:204 -#: install/step2.php:33 +#: admin/configtargets.php:244 admin/datadomain.php:143 admin/group.php:178 +#: admin/password.php:117 admin/user.php:157 config/fieldvars.php:207 +#: install/step2.php:38 msgid "Please fill in all fields marked with an *" msgstr "Bitte füllen Sie alle Felder mit einem * aus" -#: admin/configtargets.php:189 admin/datadomain.php:118 admin/group.php:150 -#: admin/user.php:131 config/fieldvars.php:206 +#: admin/configtargets.php:245 admin/datadomain.php:144 admin/group.php:179 +#: admin/user.php:158 config/fieldvars.php:209 msgid "The following field contains illegal characters:" msgstr "Das folgende Feld enthält unerlaubte Zeichen:" -#: admin/configtargets.php:310 config/fieldvars.php:265 +#: admin/configtargets.php:366 config/fieldvars.php:270 msgid "Configuration target" msgstr "Konfigurationsziel" -#: admin/configtargets.php:311 admin/contactgroups.php:226 -#: admin/contacts.php:456 admin/contacttemplates.php:455 -#: admin/datadomain.php:152 admin/group.php:167 admin/hostgroups.php:229 -#: admin/hosts.php:673 admin/hosttemplates.php:542 admin/servicegroups.php:231 -#: admin/timeperiods.php:254 admin/user.php:178 config/fieldvars.php:21 +#: admin/configtargets.php:367 admin/contactgroups.php:267 +#: admin/contacts.php:522 admin/contacttemplates.php:521 +#: admin/datadomain.php:179 admin/group.php:196 admin/hostgroups.php:272 +#: admin/hosts.php:772 admin/hosttemplates.php:628 admin/servicegroups.php:274 +#: admin/timeperiods.php:296 admin/user.php:205 config/fieldvars.php:21 msgid "Description" msgstr "Beschreibung" -#: admin/contactgroups.php:62 +#: admin/contactgroups.php:113 msgid "New contact group inserted:" msgstr "Neue Kontaktgruppe eingetragen:" -#: admin/contactgroups.php:65 +#: admin/contactgroups.php:116 msgid "Contact group modified:" msgstr "Kontaktgruppe modifiziert:" -#: admin/contactgroups.php:146 admin/contactgroups.php:224 +#: admin/contactgroups.php:198 admin/contactgroups.php:265 msgid "Define contact groups (contactgroups.cfg)" msgstr "Kontaktgruppen definieren (contactgroups.cfg)" -#: admin/contactgroups.php:165 +#: admin/contactgroups.php:213 msgid "Attention, no contacts defined!" msgstr "Achtung, noch keine Kontakte definiert!" -#: admin/contactgroups.php:225 config/fieldvars.php:102 +#: admin/contactgroups.php:266 config/fieldvars.php:105 msgid "Contact group" msgstr "Kontaktgruppe" # contacts.php -#: admin/contacts.php:84 +#: admin/contacts.php:175 msgid "New contact inserted:" msgstr "Neuer Kontakt eingetragen:" -#: admin/contacts.php:87 +#: admin/contacts.php:178 msgid "Contact modified:" msgstr "Kontakt modifiziert:" -#: admin/contacts.php:260 admin/contacts.php:454 +#: admin/contacts.php:348 admin/contacts.php:520 msgid "Define contacts (contacts.cfg)" msgstr "Kontakte definieren (contacts.cfg)" -#: admin/contacts.php:329 admin/hosts.php:515 admin/services.php:566 +#: admin/contacts.php:409 admin/hosts.php:630 admin/services.php:691 msgid "Attention, no time periods defined!" msgstr "Achtung, noch keine Zeitperioden definiert!" -#: admin/contacts.php:364 +#: admin/contacts.php:436 msgid "Attention, no commands defined!" msgstr "Achtung, noch keine Befehle definiert!" -#: admin/contacts.php:455 admin/contacttemplates.php:454 -#: config/fieldvars.php:101 +#: admin/contacts.php:521 admin/contacttemplates.php:520 +#: config/fieldvars.php:104 msgid "Contact name" msgstr "Kontaktname" # hosttemplates.php -#: admin/contacttemplates.php:84 +#: admin/contacttemplates.php:174 msgid "New contact template inserted:" msgstr "Neues Kontakttemplate eingefügt:" -#: admin/contacttemplates.php:87 +#: admin/contacttemplates.php:177 msgid "Contact template modified:" msgstr "Kontakttemplate modifiziert:" -#: admin/contacttemplates.php:265 admin/contacttemplates.php:453 +#: admin/contacttemplates.php:352 admin/contacttemplates.php:519 msgid "Define contact templates (contacttemplates.cfg)" msgstr "Kontaktvorlagen definieren (contacttemplates.cfg)" -#: admin/datadomain.php:98 +#: admin/datadomain.php:128 msgid "Attention, no configuration targets defined!" msgstr "Achtung, noch keine Konfigurationsziele definiert!" -#: admin/datadomain.php:116 admin/datadomain.php:150 +#: admin/datadomain.php:142 admin/datadomain.php:177 msgid "Data domain administration" msgstr "Datendomänen" -#: admin/datadomain.php:119 admin/settings.php:280 +#: admin/datadomain.php:145 admin/settings.php:305 msgid "Enable" msgstr "Einschalten" # mutdialog.php -#: admin/datadomain.php:120 admin/settings.php:281 +#: admin/datadomain.php:146 admin/settings.php:306 msgid "Disable" msgstr "Ausschalten" # fieldvars.php -#: admin/datadomain.php:151 +#: admin/datadomain.php:178 msgid "Data domain" msgstr "Datendomäne" -#: admin/delbackup.php:55 admin/delconfig.php:55 +#: admin/delbackup.php:75 admin/delconfig.php:74 msgid "File deleted" msgstr "Datei gelöscht" -#: admin/delbackup.php:56 admin/delconfig.php:56 +#: admin/delbackup.php:76 admin/delconfig.php:75 msgid "successfully deleted" msgstr "erfolgreich gelöscht" -#: admin/delbackup.php:65 config/fieldvars.php:316 +#: admin/delbackup.php:85 config/fieldvars.php:320 msgid "Delete backup files" msgstr "Backupdateien löschen" -#: admin/delbackup.php:68 admin/delconfig.php:68 admin/import.php:94 +#: admin/delbackup.php:88 admin/delconfig.php:87 admin/import.php:110 msgid "Filter string" msgstr "Filterausdruck" -#: admin/delbackup.php:69 admin/delconfig.php:69 admin/import.php:95 -#: config/fieldvars.php:84 +#: admin/delbackup.php:89 admin/delconfig.php:88 admin/import.php:111 +#: config/fieldvars.php:86 msgid "Search" msgstr "Suche" -#: admin/delbackup.php:70 admin/delbackup.php:75 admin/delconfig.php:70 -#: admin/delconfig.php:75 admin/groupusers.php:166 admin/import.php:96 -#: admin/templatedefinitions.php:268 admin/timedefinitions.php:180 -#: admin/variabledefinitions.php:147 config/fieldvars.php:76 -#: config/fieldvars.php:183 +#: admin/delbackup.php:90 admin/delbackup.php:95 admin/delconfig.php:89 +#: admin/delconfig.php:94 admin/groupusers.php:169 admin/groupusers.php:170 +#: admin/import.php:112 admin/templatedefinitions.php:285 +#: admin/timedefinitions.php:183 admin/variabledefinitions.php:161 +#: admin/variabledefinitions.php:162 config/fieldvars.php:78 +#: config/fieldvars.php:186 msgid "Delete" msgstr "Löschen" -#: admin/delbackup.php:71 admin/delconfig.php:71 admin/import.php:97 -#: config/fieldvars.php:85 +#: admin/delbackup.php:91 admin/delconfig.php:90 admin/import.php:113 +#: config/fieldvars.php:87 msgid "Reset filter" msgstr "Filter zurücksetzen" -#: admin/delbackup.php:73 +#: admin/delbackup.php:93 msgid "Backup file" msgstr "Backupdatei" -#: admin/delbackup.php:74 admin/delconfig.php:74 admin/settings.php:312 -#: config/fieldvars.php:57 +#: admin/delbackup.php:94 admin/delconfig.php:93 admin/settings.php:336 +#: config/fieldvars.php:58 msgid "required" msgstr "Pflichtfelder" -#: admin/delbackup.php:76 admin/delconfig.php:76 admin/import.php:104 -#: admin/password.php:98 admin/settings.php:311 config/fieldvars.php:59 +#: admin/delbackup.php:96 admin/delconfig.php:95 admin/import.php:120 +#: admin/password.php:116 admin/settings.php:335 config/fieldvars.php:60 msgid "Abort" msgstr "Abbrechen" -#: admin/delbackup.php:77 admin/delconfig.php:77 config/fieldvars.php:282 +#: admin/delbackup.php:97 admin/delconfig.php:96 config/fieldvars.php:287 msgid "Hold CTRL to select
more than one entry" msgstr "CTRL halten um mehr
als einen Eintrag auszuwählen" -#: admin/delbackup.php:120 admin/delbackup.php:156 +#: admin/delbackup.php:140 admin/delbackup.php:176 msgid "No backup files or no permission to read the backup files" msgstr "Keine Backupdateien oder keine Rechte die Backupdateien zu lesen" -#: admin/delconfig.php:65 config/fieldvars.php:315 +#: admin/delconfig.php:84 config/fieldvars.php:319 msgid "Delete config files" msgstr "Konfigdateien löschen" -#: admin/delconfig.php:73 +#: admin/delconfig.php:92 msgid "Configuration file" msgstr "Konfigurationsdatei" -#: admin/download.php:61 config/fieldvars.php:87 +#: admin/download.php:66 config/fieldvars.php:89 msgid "Download" msgstr "Download" -#: admin/group.php:63 +#: admin/group.php:91 msgid "A new group added:" msgstr "Neue Gruppe angelegt:" -#: admin/group.php:66 admin/user.php:77 +#: admin/group.php:94 admin/user.php:112 msgid "User modified:" msgstr "Benutzer modifizert:" -#: admin/group.php:144 admin/group.php:165 +#: admin/group.php:173 admin/group.php:194 msgid "Group administration" msgstr "Gruppenadministration" -#: admin/group.php:145 +#: admin/group.php:174 msgid "Read" msgstr "Lesen" -#: admin/group.php:146 admin/verify.php:97 admin/verify.php:101 -#: admin/verify.php:112 admin/verify.php:116 admin/verify.php:127 -#: admin/verify.php:131 admin/verify.php:142 admin/verify.php:146 -#: admin/verify.php:161 admin/verify.php:170 admin/verify.php:179 -#: admin/verify.php:188 admin/verify.php:197 admin/verify.php:201 -#: admin/verify.php:212 admin/verify.php:216 admin/verify.php:227 -#: admin/verify.php:231 admin/verify.php:242 admin/verify.php:246 -#: admin/verify.php:257 admin/verify.php:261 admin/verify.php:272 -#: admin/verify.php:276 admin/verify.php:287 admin/verify.php:291 +#: admin/group.php:175 admin/verify.php:121 admin/verify.php:124 +#: admin/verify.php:134 admin/verify.php:137 admin/verify.php:147 +#: admin/verify.php:150 admin/verify.php:160 admin/verify.php:163 +#: admin/verify.php:177 admin/verify.php:186 admin/verify.php:195 +#: admin/verify.php:204 admin/verify.php:213 admin/verify.php:216 +#: admin/verify.php:226 admin/verify.php:229 admin/verify.php:239 +#: admin/verify.php:242 admin/verify.php:252 admin/verify.php:255 +#: admin/verify.php:265 admin/verify.php:268 admin/verify.php:278 +#: admin/verify.php:281 admin/verify.php:291 admin/verify.php:294 msgid "Write" msgstr "Schreiben" -#: admin/group.php:147 +#: admin/group.php:176 msgid "Link" msgstr "Verbinden" -#: admin/group.php:166 +#: admin/group.php:195 msgid "Groupname" msgstr "Gruppenname" -#: admin/groupusers.php:175 admin/templatedefinitions.php:277 -#: admin/timedefinitions.php:189 admin/variabledefinitions.php:156 -#: functions/NagContentClass.php:136 +#: admin/groupusers.php:181 admin/templatedefinitions.php:295 +#: admin/timedefinitions.php:193 admin/variabledefinitions.php:174 +#: admin/variabledefinitions.php:183 functions/NagContentClass.php:131 msgid "No data" msgstr "Keine Daten" -#: admin/helpedit.php:83 +#: admin/helpedit.php:94 msgid "Help text editor" msgstr "Hilfesystem Texteditor" -#: admin/helpedit.php:89 +#: admin/helpedit.php:100 msgid "Main key" msgstr "Oberbereich" -#: admin/helpedit.php:90 +#: admin/helpedit.php:101 msgid "Sub key" msgstr "Unterbereich" -#: admin/helpedit.php:91 admin/settings.php:226 admin/settings.php:227 -#: install/index.php:71 +#: admin/helpedit.php:102 admin/settings.php:258 admin/settings.php:259 +#: install/index.php:76 msgid "Language" msgstr "Sprache" -#: admin/helpedit.php:92 config/fieldvars.php:49 +#: admin/helpedit.php:103 config/fieldvars.php:50 msgid "Nagios version" msgstr "Nagios Version" -#: admin/helpedit.php:93 +#: admin/helpedit.php:104 msgid "Load default text" msgstr "Lade Standard Text" # hosttemplates.php -#: admin/hostdependencies.php:70 +#: admin/hostdependencies.php:144 msgid "New host dependency inserted:" msgstr "Neues Hostabhängigkeit eingefügt:" -#: admin/hostdependencies.php:73 +#: admin/hostdependencies.php:147 msgid "Host dependency modified:" msgstr "Hostabhängigkeit modifiziert:" -#: admin/hostdependencies.php:205 admin/hostdependencies.php:332 +#: admin/hostdependencies.php:279 admin/hostdependencies.php:382 msgid "Define host dependencies (hostdependencies.cfg)" msgstr "Hostanhängigkeiten definieren (hostdependencies.cfg)" -#: admin/hostdependencies.php:285 admin/hostescalations.php:242 -#: admin/servicedependencies.php:533 admin/serviceescalations.php:369 +#: admin/hostdependencies.php:339 admin/hostescalations.php:303 +#: admin/servicedependencies.php:607 admin/serviceescalations.php:439 msgid "Attention, no hosts and hostgroups defined!" msgstr "Achtung, noch keine Hosts und Hostgruppen definiert!" -#: admin/hostdependencies.php:333 admin/hostescalations.php:331 -#: admin/servicedependencies.php:705 admin/serviceescalations.php:556 -#: admin/services.php:705 config/fieldvars.php:217 +#: admin/hostdependencies.php:383 admin/hostescalations.php:376 +#: admin/servicedependencies.php:759 admin/serviceescalations.php:602 +#: admin/services.php:815 config/fieldvars.php:222 msgid "Config name" msgstr "Konfigurationsname" -#: admin/hostdependencies.php:334 config/fieldvars.php:234 +#: admin/hostdependencies.php:384 config/fieldvars.php:239 msgid "Dependent hosts" msgstr "Abhängige Hosts" -#: admin/hostdependencies.php:334 config/fieldvars.php:235 +#: admin/hostdependencies.php:384 config/fieldvars.php:240 msgid "Dependent hostgroups" msgstr "Abhängige Hostgruppen" # hosttemplates.php -#: admin/hostescalations.php:70 +#: admin/hostescalations.php:139 msgid "New host escalation inserted:" msgstr "Neue Hosteskalation eingefügt:" -#: admin/hostescalations.php:73 +#: admin/hostescalations.php:142 msgid "Host escalation modified:" msgstr "Hosteskalation modifiziert:" -#: admin/hostescalations.php:205 admin/hostescalations.php:330 +#: admin/hostescalations.php:274 admin/hostescalations.php:375 msgid "Define host escalation (hostescalations.cfg)" msgstr "Hosteskalation definieren (hostescalations.cfg)" -#: admin/hostescalations.php:289 admin/serviceescalations.php:433 +#: admin/hostescalations.php:338 admin/serviceescalations.php:491 msgid "Attention, no contacts and contactgroups defined!" msgstr "Achtung, noch keine Kontake oder Kontaktgruppen definiert!" -#: admin/hostescalations.php:332 admin/monitoring.php:56 -#: config/fieldvars.php:211 config/fieldvars.php:300 +#: admin/hostescalations.php:377 admin/monitoring.php:65 +#: config/fieldvars.php:214 config/fieldvars.php:304 msgid "Hosts" msgstr "Hosts" -#: admin/hostescalations.php:332 admin/monitoring.php:72 -#: config/fieldvars.php:127 config/fieldvars.php:306 +#: admin/hostescalations.php:377 admin/monitoring.php:81 +#: config/fieldvars.php:130 config/fieldvars.php:310 msgid "Host groups" msgstr "Hostgruppen" # hosttemplates.php -#: admin/hostextinfo.php:64 +#: admin/hostextinfo.php:109 msgid "New host extended information inserted:" msgstr "Neue erweiterte Hostinformation eingefügt:" -#: admin/hostextinfo.php:67 +#: admin/hostextinfo.php:112 msgid "Host extended information modified:" msgstr "Erweiterte Hostinformation modifiziert:" -#: admin/hostextinfo.php:95 admin/hostextinfo.php:147 +#: admin/hostextinfo.php:140 admin/hostextinfo.php:184 msgid "Define host extended information (hostextinfo.cfg)" msgstr "Erweiterte Hostinformationen definieren (hostextinfo.cfg)" -#: admin/hostextinfo.php:106 admin/hostgroups.php:168 -#: admin/serviceextinfo.php:141 +#: admin/hostextinfo.php:147 admin/hostgroups.php:219 +#: admin/serviceextinfo.php:180 msgid "Attention, no hosts defined!" msgstr "Achtung, noch keine Hosts definiert!" -#: admin/hostextinfo.php:148 admin/hosts.php:672 config/fieldvars.php:202 +#: admin/hostextinfo.php:185 admin/hosts.php:771 config/fieldvars.php:205 msgid "Host name" msgstr "Hostname" -#: admin/hostextinfo.php:149 config/fieldvars.php:166 +#: admin/hostextinfo.php:186 config/fieldvars.php:169 msgid "Notes" msgstr "Notizen" -#: admin/hostgroups.php:63 +#: admin/hostgroups.php:118 msgid "New host group inserted:" msgstr "Neue Hostgruppe eingetragen:" -#: admin/hostgroups.php:66 +#: admin/hostgroups.php:121 msgid "Host group modified:" msgstr "Hostgruppe modifiziert:" -#: admin/hostgroups.php:147 admin/hostgroups.php:227 +#: admin/hostgroups.php:202 admin/hostgroups.php:270 msgid "Define host groups (hostgroups.cfg)" msgstr "Hostgruppen definieren (hostgroups.cfg)" -#: admin/hostgroups.php:228 +#: admin/hostgroups.php:271 msgid "Host group" msgstr "Hostgruppen" # contacts.php -#: admin/hosts.php:95 +#: admin/hosts.php:227 msgid "New host inserted:" msgstr "Neuen Host eingetragen:" -#: admin/hosts.php:98 +#: admin/hosts.php:230 msgid "Host modified:" msgstr "Host modifizert:" -#: admin/hosts.php:192 admin/hosts.php:218 admin/services.php:249 -#: admin/services.php:279 functions/NagDataClass.php:556 -#: functions/NagDataClass.php:583 functions/prepend_content.php:415 -#: functions/prepend_content.php:475 +#: admin/hosts.php:328 admin/hosts.php:352 admin/services.php:395 +#: admin/services.php:424 functions/NagDataClass.php:961 +#: functions/NagDataClass.php:988 functions/prepend_content.php:458 +#: functions/prepend_content.php:520 msgid "" "The assigned, no longer used configuration files were deleted successfully!" msgstr "" "Die dazugehörenden, nicht mehr benutzten Konfigurationsdateien wurden " "erfolgreich gelöscht!" -#: admin/hosts.php:194 admin/hosts.php:220 functions/NagDataClass.php:558 -#: functions/NagDataClass.php:586 functions/prepend_content.php:401 +#: admin/hosts.php:330 admin/hosts.php:354 functions/NagDataClass.php:963 +#: functions/NagDataClass.php:991 functions/prepend_content.php:444 msgid "Host file deleted:" msgstr "Hostdatei gelöscht:" -#: admin/hosts.php:197 admin/hosts.php:223 admin/services.php:254 -#: functions/prepend_content.php:424 functions/prepend_content.php:484 +#: admin/hosts.php:332 admin/hosts.php:356 admin/services.php:399 +#: functions/prepend_content.php:467 functions/prepend_content.php:529 msgid "" "Common files cannot be removed from target systems - please check manually" msgstr "" "Globale Konfigurationsdateien können auf den Zielsystemen nicht gelöscht " "werden - bitte manuell überprüfen" -#: admin/hosts.php:200 admin/hosts.php:226 admin/services.php:257 -#: admin/services.php:283 functions/NagDataClass.php:560 -#: functions/NagDataClass.php:588 functions/prepend_content.php:419 -#: functions/prepend_content.php:479 +#: admin/hosts.php:335 admin/hosts.php:359 admin/services.php:402 +#: admin/services.php:428 functions/NagDataClass.php:965 +#: functions/NagDataClass.php:993 functions/prepend_content.php:462 +#: functions/prepend_content.php:524 msgid "Errors while deleting the old configuration file - please check!:" msgstr "" "Beim Löschen der nicht mehr benutzten Konfigurationsdateien ist ein Fehler " "aufgetreten - bitte überprüfen! :" -#: admin/hosts.php:396 admin/hosts.php:671 +#: admin/hosts.php:526 admin/hosts.php:770 msgid "Define hosts (hosts.cfg)" msgstr "Host definieren" -#: admin/hosts.php:562 +#: admin/hosts.php:665 msgid "Attention, no contact groups defined!" msgstr "Achtung, noch keine Kontaktdaten definiert!" # hosttemplates.php -#: admin/hosttemplates.php:96 +#: admin/hosttemplates.php:212 msgid "New host template inserted:" msgstr "Neues Hosttemplate eingefügt:" -#: admin/hosttemplates.php:99 +#: admin/hosttemplates.php:215 msgid "Host template modified:" msgstr "Hosttemplate modifiziert:" -#: admin/hosttemplates.php:295 admin/hosttemplates.php:540 +#: admin/hosttemplates.php:410 admin/hosttemplates.php:626 msgid "Host template definition (hosttemplates.cfg)" msgstr "Hosttemplates definieren (hosttemplates.cfg)" -#: admin/hosttemplates.php:541 +#: admin/hosttemplates.php:627 msgid "Host template name" msgstr "Hosttemplatename" -#: admin/import.php:55 +#: admin/import.php:72 msgid "File upload error:" msgstr "Datei Upload-Fehler:" -#: admin/import.php:67 admin/import.php:83 +#: admin/import.php:84 admin/import.php:99 msgid "File imported - File [overwrite flag]:" msgstr "Datei importiert - Datei [Überschreibmarker]:" -#: admin/import.php:91 +#: admin/import.php:107 msgid "Configuration import" msgstr "Import von Konfigurationsdateien" -#: admin/import.php:99 +#: admin/import.php:115 msgid "Template definition" msgstr "Vorlagen" -#: admin/import.php:100 +#: admin/import.php:116 msgid "Import file" msgstr "Importdatei" -#: admin/import.php:101 +#: admin/import.php:117 msgid "Local import file" msgstr "Lokale Importdatei" -#: admin/import.php:102 +#: admin/import.php:118 msgid "Overwrite database" msgstr "Überschreibe Datenbankwerte" -#: admin/import.php:103 +#: admin/import.php:119 msgid "Import" msgstr "Import" -#: admin/import.php:105 +#: admin/import.php:121 msgid "Hold CTRL to select
more than one" msgstr "CTRL halten um mehr
als einen Eintrag auszuwählen" -#: admin/import.php:109 +#: admin/import.php:125 msgid "" "To prevent errors or misconfigurations, you should import your " -"configurations in an useful order. We recommend to do it like this:" +"configurations in a useful order. We recommend to do it like this:" "

commands -> timeperiods -> contacttemplates -> contacts -> " "contactgroups -> hosttemplates -> hosts -> hostgroups -> servicetemplates -> " "services -> servicegroups

" msgstr "" -"Um Fehler und Fehlkonfigurationen vorzubeugen, sollte der Import soweit " -"möglich in einer sinnvollen Reihenfolge vorgenommen werden. Wir empfehlen " -"folgenden Ablauf:

commands -> timeperiods -> contacttemplates -" -"> contacts -> contactgroups -> hosttemplates -> hosts -> hostgroups -> " -"servicetemplates -> services -> servicegroups

" +"Um Fehler oder Fehlkonfigurationen zu vermeiden, sollten Sie Ihre " +"Konfigurationen in einer sinnvollen Reihenfolge importieren. Wir empfehlen " +"Ihnen, wie folgt vorzugehen:

commands -> timeperiods -> " +"contacttemplates -> contacts -> contactgroups -> hosttemplates -> hosts -> " +"hostgroups -> servicetemplates -> services -> servicegroups

" -#: admin/import.php:113 +#: admin/import.php:129 msgid "" "Check your configuration after import!
In cause of an error or an " "uncomplete configuration, re-importing the wrong configuration can solve the " @@ -814,21 +815,21 @@ msgstr "" "eines Fehlers oder einer unvollständigen Konfiguration kann ein erneuter " "Import der einzelnen fehlerhaften Konfiguration oft Abhilfe schaffen." -#: admin/info.php:43 +#: admin/info.php:46 msgid "This is relative path of your NagiosQL Installation" msgstr "Der Pfad aus Sicht des Webservers" -#: admin/info.php:44 +#: admin/info.php:47 msgid "This is the absolut path to your NagiosQL Installation" msgstr "Der komplette Pfad zur NagiosQL Installation" -#: admin/info.php:45 +#: admin/info.php:48 msgid "If you need a secure connection, select HTTPS instead of HTTP" msgstr "" "Wenn eine gesicherte Verbindung benutzt werden soll, muss die Installation " "mit Angabe von https anstatt http erneut ausgeführt werden" -#: admin/info.php:46 +#: admin/info.php:49 msgid "" "Please choose a temporary directory with write permissions. The default is " "the temp directory provided by your OS" @@ -836,12 +837,12 @@ msgstr "" "Der Pfad zu einem temporären Verzeichnis das zur Zwischenspeicherung der " "Daten benötigt wird, normalerweise unter Linux /tmp" -#: admin/info.php:48 +#: admin/info.php:51 msgid "Please choose your application language for new users and login portal" msgstr "" "Bitte wählen Sie die Sprache für neue NagiosQL Benutzer und das Login-Portal" -#: admin/info.php:49 +#: admin/info.php:52 msgid "" "Encoding should be set to nothing else than utf-8. Any changes at your own " "risk" @@ -849,20 +850,20 @@ msgstr "" "Die Kodierung sollte auf utf-8 stehen bleiben. Alle Ändeurngen auf Ihr " "eigenes Risiko" -#: admin/info.php:50 +#: admin/info.php:53 msgid "IP-Address or hostname of the database server
e.g. localhost" msgstr "" "Auflösbarer Hostname oder IP-Adresse des Datenbank Servers
z.B. localhost" -#: admin/info.php:51 +#: admin/info.php:54 msgid "MySQL Server Port, default is 3306" msgstr "MySQL Server Port, Vorgabewert ist 3306" -#: admin/info.php:52 +#: admin/info.php:55 msgid "Name of the NagiosQL database
e.g. db_nagiosql_v3" msgstr "Name der NagiosQL Datenbank
z.B. db_nagiosql_v3" -#: admin/info.php:53 +#: admin/info.php:56 msgid "" "User with sufficient permission for the NagiosQL database
At least this " "user should have SELECT, INSERT, UPDATE, DELETE permissions" @@ -871,11 +872,11 @@ msgstr "" "Benutzer sollte zumindest SELECT, INSERT, UPDATE und DELETE Berechtigungen " "haben" -#: admin/info.php:55 +#: admin/info.php:58 msgid "Password for the above mentioned user" msgstr "Passwort des o.a. Benutzers" -#: admin/info.php:56 +#: admin/info.php:59 msgid "" "After the defined amount of seconds the session will terminate for security " "reasons" @@ -883,7 +884,7 @@ msgstr "" "Aus Sicherheitsgründen wird die Sitzung nach der hier angebeben Anzahl von " "Sekunden bei Inaktivität beendet" -#: admin/info.php:58 +#: admin/info.php:61 msgid "" "Decide between authentication based on your Webserver
e.g. Apache " "configuration (config file or htaccess) or NagiosQL" @@ -891,14 +892,14 @@ msgstr "" "Authentizierung auf Basis von NagiosQL oder über den Webserver. Über den " "Webserver lässt sich z.B. auch eine LDAP Verbindung realisieren" -#: admin/info.php:60 +#: admin/info.php:63 msgid "" "Number of entries per side that should be visible (e.g. services or hosts)" msgstr "" "Wieviel Einträge pro Seite sollen angezeigt werden (z.B. bei Hosts oder " "Services)" -#: admin/info.php:61 +#: admin/info.php:64 msgid "" "Method of selection of multiple entries by using the new dialog or by " "holding CTRL + left mouse button, as in NagiosQL 2" @@ -906,7 +907,7 @@ msgstr "" "Die Auswahl mehrerer Einträge innerhalb der Dialogfelder wie in NagiosQL 2 " "durch STRG+ linker Mausclick" -#: admin/info.php:63 +#: admin/info.php:66 msgid "" "Enable or disable the warning if a required field contains no data in " "objects with templates" @@ -914,11 +915,11 @@ msgstr "" "Aktiviere oder deaktiviere Warnungen wenn ein Pflichtfeld keine Daten in " "Objekten mit Vorlagen enthält" -#: admin/info.php:65 +#: admin/info.php:68 msgid "Enable or disable the automatic online version check." msgstr "Aktiviere oder Deaktiviere die automatische Versionskontrolle." -#: admin/info.php:66 +#: admin/info.php:69 msgid "" "If you require a Proxyserver to connect to the Internet (Port 80), please " "define one." @@ -926,79 +927,90 @@ msgstr "" "Sollten Sie einen Proxyserver für Verbindungen ins Internet (Port 80) " "benötigen, dann definieren Sie hier einen." -#: admin/info.php:68 +#: admin/info.php:71 msgid "Address of your Proxyserver e.g. proxy.yourdomain.com:3128" msgstr "Adresse oder Name des Proxyservers, z.B. proxy.meinedomain.de:3128" -#: admin/info.php:69 +#: admin/info.php:72 msgid "Username to connect through your proxy (optional)" msgstr "Benutzername für Proxyverbindungen (optional)" -#: admin/info.php:70 +#: admin/info.php:73 msgid "Password to connect through your proxy (optional)" msgstr "Passwort für Proxyverbindungen (optional)" -#: admin/info.php:92 +#: admin/info.php:74 +msgid "" +"In environments with a high number of host and service objects, the display " +"of the parent objects can be disabled to improve performance. Existing " +"assignments are preserved during modification." +msgstr "" +"In Umgebungen mit einer sehr grossen Anzahl von Host und Service Objekten " +"kann die Anzeige der abhängigen Objekte ausgeschaltet werden um die " +"Performance zu erhöhen. Bestehende Zuordnungen bleiben dabei bei einer " +"Modifikation erhalten." + +#: admin/info.php:100 msgid "Information PopUp" msgstr "Information Pop-Up" # mutdialog.php -#: admin/info.php:105 +#: admin/info.php:113 msgid "No information available" msgstr "Keine Information verfügbar" -#: admin/logbook.php:53 functions/NagDataClass.php:401 -#: functions/NagDataClass.php:436 functions/NagDataClass.php:611 +#: admin/logbook.php:72 functions/NagDataClass.php:798 +#: functions/NagDataClass.php:835 functions/NagDataClass.php:1017 msgid "Dataset successfully deleted. Affected rows:" msgstr "Daten erfolgreich gelöscht. Betroffene Datensätze:" # logbook.php -#: admin/logbook.php:83 +#: admin/logbook.php:102 msgid "View logbook" msgstr "Logbuch einsehen" -#: admin/logbook.php:87 +#: admin/logbook.php:106 msgid "Delete logentries between:" msgstr "Lösche Logbucheinträge zwischen:" -#: admin/logbook.php:89 +#: admin/logbook.php:108 msgid "Please supply a start or a stop time at least" msgstr "Bitte mindestens ein Start- oder eine Stop-Datum eintragen" -#: admin/logbook.php:90 +#: admin/logbook.php:109 msgid "" "Do you really want to delete all log entries between the selected dates?" msgstr "" "Wollen Sie die Logeinträge zwischen den angegebenen Daten wirklich löschen?" -#: admin/logbook.php:97 +#: admin/logbook.php:116 msgid "previous 20 entries" msgstr "vorherige 20 Einträge" -#: admin/logbook.php:104 +#: admin/logbook.php:123 msgid "next 20 entries" msgstr "nächste 20 Einträge" -#: admin/menuaccess.php:44 functions/NagDataClass.php:137 -#: functions/NagDataClass.php:290 +#: admin/menuaccess.php:61 functions/NagDataClass.php:199 +#: functions/NagDataClass.php:755 msgid "Error while inserting the data into the database:" msgstr "Fehler beim Einfügen der Daten in die Datenbank:" -#: admin/menuaccess.php:47 functions/NagDataClass.php:134 -#: functions/NagDataClass.php:285 +#: admin/menuaccess.php:64 functions/NagDataClass.php:194 +#: functions/NagDataClass.php:752 msgid "Data were successfully inserted to the data base!" msgstr "Daten wurden erfolgreich in die Datenbank eingetragen!" -#: admin/menuaccess.php:48 +#: admin/menuaccess.php:65 msgid "Access group set for menu item:" msgstr "Zugriffsgruppe festgelegt für Menuitem:" # menuaccess.php -#: admin/menuaccess.php:55 +#: admin/menuaccess.php:72 msgid "Define Menu Access Rights" msgstr "Zugriffsrechte für das Menu festlegen" -#: admin/menuaccess.php:59 +#: admin/menuaccess.php:76 msgid "" "In order for a user to get access, he needs to be member of the group " "selected here." @@ -1006,212 +1018,212 @@ msgstr "" "Damit ein Benutzer Zugriff hat, muss er Mitglied der hier ausgewählten " "Gruppe sein." -#: admin/monitoring.php:36 +#: admin/monitoring.php:45 msgid "Monitoring" msgstr "Überwachung" # monitoring.php -#: admin/monitoring.php:39 +#: admin/monitoring.php:48 msgid "" "Define host and service supervisions as well as host and service groups." msgstr "" "Definieren von Host- und Serviceüberwachungen sowie Host- und Servicegruppen." -#: admin/monitoring.php:64 admin/serviceescalations.php:557 -#: config/fieldvars.php:248 config/fieldvars.php:305 +#: admin/monitoring.php:73 admin/serviceescalations.php:603 +#: config/fieldvars.php:253 config/fieldvars.php:309 msgid "Services" msgstr "Services" -#: admin/monitoring.php:80 config/fieldvars.php:213 config/fieldvars.php:307 +#: admin/monitoring.php:89 config/fieldvars.php:216 config/fieldvars.php:311 msgid "Service groups" msgstr "Servicegruppen" -#: admin/monitoring.php:88 config/fieldvars.php:302 config/fieldvars.php:328 +#: admin/monitoring.php:97 config/fieldvars.php:306 config/fieldvars.php:332 msgid "Host templates" msgstr "Hostvorlagen" -#: admin/monitoring.php:96 config/fieldvars.php:329 +#: admin/monitoring.php:105 config/fieldvars.php:333 msgid "Service templates" msgstr "Servicevorlagen" # mutdialog.php -#: admin/mutdialog.php:57 admin/versioncheck.php:83 +#: admin/mutdialog.php:58 admin/versioncheck.php:93 msgid "Available" msgstr "Verfügbar" -#: admin/mutdialog.php:58 +#: admin/mutdialog.php:59 msgid "Selected" msgstr "Ausgewählt" -#: admin/nagioscfg.php:105 +#: admin/nagioscfg.php:121 msgid "Nagios main configuration file" msgstr "Nagios Hauptkonfigurationsdatei" -#: admin/password.php:55 +#: admin/password.php:73 msgid "Password successfully modified" msgstr "Passwort erfolgreich geändert" -#: admin/password.php:72 admin/user.php:90 +#: admin/password.php:90 admin/user.php:125 msgid "Password too short or password fields do not match!" msgstr "Passwort zu kurz oder Passwörter ungleich!" -#: admin/password.php:78 +#: admin/password.php:96 msgid "The old password is invalid" msgstr "Das alte Passwort ist falsch" -#: admin/password.php:97 admin/settings.php:310 config/fieldvars.php:58 +#: admin/password.php:115 admin/settings.php:334 config/fieldvars.php:59 msgid "Save" msgstr "Speichern" -#: admin/password.php:100 +#: admin/password.php:118 msgid "The new passwords don not match!" msgstr "Die neuen Passwörter sind ungleich!" -#: admin/password.php:101 +#: admin/password.php:119 msgid "The new password is too short - use at least 6 characters!" msgstr "Das neue Passwort ist zu kurz - mindestens 6 Zeichen sind nötig!" # hosttemplates.php -#: admin/servicedependencies.php:72 +#: admin/servicedependencies.php:176 msgid "New service dependency inserted:" msgstr "Neue Serviceabhängigkeit eingefügt:" -#: admin/servicedependencies.php:75 +#: admin/servicedependencies.php:179 msgid "Service dependency modified:" msgstr "Serviceabhängigkeit modifiziert:" -#: admin/servicedependencies.php:313 admin/servicedependencies.php:704 +#: admin/servicedependencies.php:417 admin/servicedependencies.php:758 msgid "Define service dependencies (servicedependencies.cfg)" msgstr "Serviceanhängigkeiten definieren (servicedependencies.cfg)" -#: admin/servicedependencies.php:706 config/fieldvars.php:247 +#: admin/servicedependencies.php:760 config/fieldvars.php:252 msgid "Dependent services" msgstr "Abhängige Services" # hosttemplates.php -#: admin/serviceescalations.php:71 +#: admin/serviceescalations.php:157 msgid "New service escalation inserted:" msgstr "Neue Serviceeskalation eingefügt:" -#: admin/serviceescalations.php:74 +#: admin/serviceescalations.php:160 msgid "Service escalation modified:" msgstr "Serviceeskalation modifiziert:" -#: admin/serviceescalations.php:256 admin/serviceescalations.php:555 +#: admin/serviceescalations.php:342 admin/serviceescalations.php:601 msgid "Define service escalation (serviceescalations.cfg)" msgstr "Serviceeskalation definieren (serviceescalations.cfg)" # hosttemplates.php -#: admin/serviceextinfo.php:64 +#: admin/serviceextinfo.php:108 msgid "New service extended information inserted:" msgstr "Neue erweiterte Serviceinformation eingefügt:" -#: admin/serviceextinfo.php:68 +#: admin/serviceextinfo.php:112 msgid "Service extended information modified:" msgstr "Erweiterte Serviceinformation modifiziert:" -#: admin/serviceextinfo.php:104 admin/serviceextinfo.php:214 +#: admin/serviceextinfo.php:148 admin/serviceextinfo.php:245 msgid "Define service extended information (serviceextinfo.cfg)" msgstr "Erweiterte Serviceinformationen definieren (serviceextinfo.cfg)" -#: admin/serviceextinfo.php:215 +#: admin/serviceextinfo.php:246 msgid "Hostname" msgstr "Hostname" -#: admin/serviceextinfo.php:216 +#: admin/serviceextinfo.php:247 msgid "Service" msgstr "Service" # hosttemplates.php -#: admin/servicegroups.php:63 +#: admin/servicegroups.php:118 msgid "New service group inserted:" msgstr "Neue Servicegruppe eingetragen:" -#: admin/servicegroups.php:66 +#: admin/servicegroups.php:121 msgid "Service group modified:" msgstr "Servicegruppe modifiziert:" -#: admin/servicegroups.php:149 admin/servicegroups.php:229 +#: admin/servicegroups.php:204 admin/servicegroups.php:272 msgid "Define service groups (servicegroups.cfg)" msgstr "Servicesgruppen definieren (servicegroups.cfg)" -#: admin/servicegroups.php:170 +#: admin/servicegroups.php:221 msgid "Attention, no services defined!" msgstr "Achtung, noch keine Services definiert!" -#: admin/servicegroups.php:230 +#: admin/servicegroups.php:273 msgid "Service group" msgstr "Servicegruppe" # hosttemplates.php -#: admin/services.php:96 +#: admin/services.php:237 msgid "New service inserted:" msgstr "Neuen Service eingefügt:" -#: admin/services.php:99 +#: admin/services.php:240 msgid "Service modified:" msgstr "Service modifiziert:" -#: admin/services.php:251 admin/services.php:281 -#: functions/prepend_content.php:460 +#: admin/services.php:397 admin/services.php:426 +#: functions/prepend_content.php:505 msgid "Service file deleted:" msgstr "Servicedatei gelöscht:" -#: admin/services.php:403 admin/services.php:704 +#: admin/services.php:546 admin/services.php:814 msgid "Define services (services.cfg)" msgstr "Services definieren" -#: admin/services.php:488 +#: admin/services.php:626 msgid "Attention, no hosts or hostgroups defined!" msgstr "Achtung, noch keine Hosts oder Hostgruppen definiert!" -#: admin/services.php:543 +#: admin/services.php:676 msgid "Attention, no check commands defined!" msgstr "Achtung, noch keine Prüfbefehle definiert!" -#: admin/services.php:613 +#: admin/services.php:726 msgid "Attention, no contacts or contact groups defined!" msgstr "Achtung, noch keine Kontakte oder Kontaktgruppen definiert!" -#: admin/services.php:706 +#: admin/services.php:816 config/fieldvars.php:221 msgid "Service name" msgstr "Servicename" -#: admin/services.php:708 admin/services.php:732 +#: admin/services.php:818 admin/services.php:844 msgid "All configs" msgstr "Alle Konfigurationen" # hosttemplates.php -#: admin/servicetemplates.php:97 +#: admin/servicetemplates.php:229 msgid "New service template inserted:" msgstr "Neue Servicevorlage eingefügt:" -#: admin/servicetemplates.php:100 +#: admin/servicetemplates.php:232 msgid "Service template modified:" msgstr "Servicevorlage modifiziert:" -#: admin/servicetemplates.php:341 admin/servicetemplates.php:623 +#: admin/servicetemplates.php:472 admin/servicetemplates.php:714 msgid "Define service templates (servicetemplates.cfg)" msgstr "Servicevorlagen definieren (servicetemplates.cfg)" -#: admin/servicetemplates.php:624 config/fieldvars.php:124 -#: config/fieldvars.php:225 +#: admin/servicetemplates.php:715 config/fieldvars.php:127 +#: config/fieldvars.php:230 msgid "Template name" msgstr "Vorlagenname" -#: admin/servicetemplates.php:625 config/fieldvars.php:212 +#: admin/servicetemplates.php:716 config/fieldvars.php:215 msgid "Service description" msgstr "Servicebeschreibung" -#: admin/settings.php:111 +#: admin/settings.php:146 msgid "Curl module not loaded, Proxy will be deactivated!" msgstr "Curl Modul nicht geladen, der Proxy wird deaktiviert!" -#: admin/settings.php:136 +#: admin/settings.php:172 msgid "An error occured while writing settings to database:" msgstr "Beim Schreiben der Einstellungen in die Datenbank trat ein Fehler auf:" -#: admin/settings.php:187 functions/prepend_adm.php:150 +#: admin/settings.php:223 functions/prepend_adm.php:151 msgid "" "Error setting the correct locale. Please report this error with the " "associated output of 'locale -a'" @@ -1219,124 +1231,132 @@ msgstr "" "Fehler bei der Erkennung der Umgebungsvariable locale. Bitte diese " "Fehlermeldung und die Ausgabe von 'locale -a' melden." -#: admin/settings.php:195 +#: admin/settings.php:231 msgid "Settings were changed" msgstr "Systemeinstellungen wurden geändert" -#: admin/settings.php:197 +#: admin/settings.php:233 msgid "An error occured while writing settings.php. Please check permissions!" msgstr "" "Beim Schreiben der settings.php trat ein Fehler auf - bitte Berechtigungen " "prüfen!" -#: admin/settings.php:201 +#: admin/settings.php:237 msgid "is not writeable, please check permissions!" msgstr "ist nicht beschreibbar (Berechtigungen prüfen)!" -#: admin/settings.php:208 +#: admin/settings.php:244 msgid "Configure Settings" msgstr "NagiosQL Systemeinstellungen konfigurieren" -#: admin/settings.php:213 +#: admin/settings.php:249 msgid "Change your current NagiosQL settings (e.g. Database user, Language)." msgstr "" "Ändern der aktuellen NagiosQL Einstellungen (Datenbankbenutzer, Sprache, " "usw.)" -#: admin/settings.php:218 +#: admin/settings.php:252 msgid "Path" msgstr "Pfad" -#: admin/settings.php:219 +#: admin/settings.php:253 msgid "Temporary Directory" msgstr "Temporäres Verzeichnis" -#: admin/settings.php:221 +#: admin/settings.php:255 msgid "Server protocol" msgstr "Server Protokoll" -#: admin/settings.php:244 +#: admin/settings.php:277 msgid "Encoding" msgstr "Encoding" -#: admin/settings.php:249 +#: admin/settings.php:280 msgid "Database" msgstr "Datenbank" -#: admin/settings.php:250 +#: admin/settings.php:281 msgid "MySQL Server" msgstr "MySQL Server" -#: admin/settings.php:252 +#: admin/settings.php:283 msgid "MySQL Server Port" msgstr "MySQL Server Port" -#: admin/settings.php:254 install/step2.php:66 +#: admin/settings.php:285 install/step2.php:71 msgid "Database name" msgstr "Datenbankname" -#: admin/settings.php:256 +#: admin/settings.php:287 msgid "Database user" msgstr "Datenbankbenutzer" -#: admin/settings.php:258 +#: admin/settings.php:289 msgid "Database password" msgstr "Datenbankpasswort" -#: admin/settings.php:263 +#: admin/settings.php:292 msgid "Security" msgstr "Sicherheit" -#: admin/settings.php:264 +#: admin/settings.php:293 msgid "Session auto logoff time" msgstr "Automatisches Ausloggen nach" -#: admin/settings.php:266 +#: admin/settings.php:295 msgid "Authentication type" msgstr "Authentifikation" -#: admin/settings.php:271 +#: admin/settings.php:298 msgid "Common" msgstr "Allgemeines" -#: admin/settings.php:272 +#: admin/settings.php:299 msgid "Data lines per page" msgstr "Zeilen pro Seite" -#: admin/settings.php:274 +#: admin/settings.php:301 msgid "Selection method" msgstr "Auswahl methode" -#: admin/settings.php:279 +#: admin/settings.php:304 msgid "Template warn message" msgstr "Warnungen bei Templatewerten" -#: admin/settings.php:288 +#: admin/settings.php:311 msgid "Online version check" msgstr "Online Versionsüberprüfung" -#: admin/settings.php:296 +#: admin/settings.php:317 msgid "Proxyserver" msgstr "Proxyserver" -#: admin/settings.php:301 +#: admin/settings.php:323 msgid "Proxy Address" msgstr "Proxyadresse" -#: admin/settings.php:303 +#: admin/settings.php:325 msgid "Proxy Username (optional)" msgstr "Proxy Benutzername (optional)" -#: admin/settings.php:305 +#: admin/settings.php:327 msgid "Proxy Password (optional)" msgstr "Proxy Passwort (optional)" -#: admin/specials.php:35 +#: admin/settings.php:330 +msgid "Performance options" +msgstr "Performance Optionen" + +#: admin/settings.php:331 +msgid "Show object parents" +msgstr "Zeige abhängige Objekte" + +#: admin/specials.php:44 msgid "Misc commands" msgstr "Spezialbefehle" # specials.php -#: admin/specials.php:38 +#: admin/specials.php:47 msgid "" "Define host and service dependencies, host and service escalations as well " "as host and service additional data." @@ -1344,39 +1364,39 @@ msgstr "" "Definieren von Host- und Serviceabhängigkeiten, Host- und " "Serviceeskalationen sowie Host- und Service-Zusatzdaten." -#: admin/specials.php:56 +#: admin/specials.php:65 msgid "Host dependencies" msgstr "Host Abhängigkeiten" -#: admin/specials.php:64 +#: admin/specials.php:73 msgid "Host escalations" msgstr "Host Eskalationen" -#: admin/specials.php:72 +#: admin/specials.php:81 msgid "Host ext. info" msgstr "Host AddOn" -#: admin/specials.php:80 +#: admin/specials.php:89 msgid "Service dependencies" msgstr "Service Abhängigkeiten" -#: admin/specials.php:88 +#: admin/specials.php:97 msgid "Service escalations" msgstr "Service Eskalationen" -#: admin/specials.php:96 +#: admin/specials.php:105 msgid "Service ext. info" msgstr "Service AddOn" -#: admin/support.php:39 +#: admin/support.php:56 msgid "NagiosQL support page" msgstr "NagiosQL Supportseite" -#: admin/support.php:49 +#: admin/support.php:66 msgid "Support contact information" msgstr "Support- und Kontaktinformationen" -#: admin/support.php:50 +#: admin/support.php:67 msgid "" "For questions, the online support forum or contact information visit our " "website:" @@ -1384,15 +1404,15 @@ msgstr "" "Für Fragen, das öffentliche Supportforum oder Kontaktinformationen besuchen " "Sie unsere Webseite unter:" -#: admin/support.php:52 +#: admin/support.php:69 msgid "NagiosQL on sourceforge" msgstr "NagiosQL auf Sourceforge" -#: admin/support.php:56 +#: admin/support.php:73 msgid "Donate to support NagiosQL" msgstr "NagiosQL durch Spenden unterstützen" -#: admin/support.php:57 +#: admin/support.php:74 msgid "" "If you like NagiosQL and it simplifies your daily work, then you may want to " "support the project by making a donation. This helps us to keep NagiosQL " @@ -1403,16 +1423,16 @@ msgstr "" "uns NagiosQL weiterzuentwickeln und dabei entstehende Kosten zu decken. " "Vielen Dank für Ihre Spende!" -#: admin/support.php:60 functions/NagVisualClass.php:230 -#: functions/NagVisualClass.php:231 +#: admin/support.php:77 functions/NagVisualClass.php:134 +#: functions/NagVisualClass.php:135 msgid "Donate for NagiosQL on sourceforge" msgstr "Für NagiosQL auf Sourceforge spenden" -#: admin/support.php:64 +#: admin/support.php:81 msgid "Translation services" msgstr "Übersetzungsdienste" -#: admin/support.php:65 +#: admin/support.php:82 msgid "" "NagiosQL was translated into various languages​​. Since some translators are " "no longer available in later versions, there may be untranslated words or " @@ -1429,15 +1449,15 @@ msgstr "" "einfach online bearbeitet werden - wir benutzen einen offenen " "Übersetzungsdienst bei dem Sie sich jederzeit kostenlos registrieren können:" -#: admin/support.php:70 +#: admin/support.php:87 msgid "Transifex translation service" msgstr "Transifex Übersetzungsservice" -#: admin/support.php:74 +#: admin/support.php:91 msgid "GIT software repository" msgstr "Git Software Repository" -#: admin/support.php:75 +#: admin/support.php:92 msgid "" "The NagiosQL sources are available on GitLab. There you will always find the " "latest bugfixes and changes as well as older branches." @@ -1445,15 +1465,15 @@ msgstr "" "Die NagiosQL Dateien sind auf GitLab verfügbar. Dort finden sie immer sie " "letzten Fehlerbehebungen, Änderungen sowie auch ältere Versionen." -#: admin/support.php:77 +#: admin/support.php:94 msgid "GitLab" msgstr "GitLab" -#: admin/support.php:81 +#: admin/support.php:98 msgid "Version check" msgstr "Überprüfung der NagiosQL Version" -#: admin/support.php:83 +#: admin/support.php:100 msgid "" "The online version check is not enabled. You can enable it on the settings " "page." @@ -1461,7 +1481,7 @@ msgstr "" "Die Onlineüberprüfung der Version ist nicht eingeschaltet. Sie können diese " "auf der Einstellungsseite aktivieren." -#: admin/support.php:86 +#: admin/support.php:103 msgid "" "The online version check connects the NagiosQL page to find out, if your " "version is still up to date." @@ -1469,102 +1489,105 @@ msgstr "" "Die Onlineüberprüfung öffnet eine Verbindung zur NagiosQL Entwicklerwebseite " "und prüft, ob Sie die aktuelle Version verwenden." -#: admin/support.php:98 +#: admin/support.php:112 +msgid "GIT code version" +msgstr "GIT Codeversion" + +#: admin/support.php:117 msgid "Environment check" msgstr "Umgebungsprüfung" -#: admin/support.php:100 admin/support.php:109 admin/support.php:121 -#: admin/support.php:129 admin/support.php:138 admin/support.php:148 -#: admin/support.php:163 admin/support.php:176 admin/support.php:185 -#: admin/support.php:194 admin/support.php:203 admin/support.php:213 -#: admin/support.php:263 admin/support.php:278 admin/support.php:299 -#: admin/support.php:337 admin/support.php:360 admin/support.php:366 -#: admin/support.php:392 admin/support.php:396 admin/support.php:415 -#: admin/support.php:418 admin/support.php:421 admin/support.php:435 -#: admin/support.php:440 admin/support.php:443 admin/support.php:448 -#: admin/support.php:460 admin/support.php:465 admin/support.php:484 -#: admin/support.php:492 admin/support.php:589 admin/support.php:592 -#: admin/support.php:613 admin/support.php:642 admin/support.php:677 -#: install/functions/NagInstallClass.php:338 -#: install/functions/NagInstallClass.php:370 -#: install/functions/NagInstallClass.php:406 +#: admin/support.php:119 admin/support.php:128 admin/support.php:140 +#: admin/support.php:148 admin/support.php:157 admin/support.php:167 +#: admin/support.php:182 admin/support.php:195 admin/support.php:204 +#: admin/support.php:213 admin/support.php:222 admin/support.php:232 +#: admin/support.php:283 admin/support.php:298 admin/support.php:319 +#: admin/support.php:354 admin/support.php:385 admin/support.php:415 +#: admin/support.php:434 admin/support.php:437 admin/support.php:440 +#: admin/support.php:454 admin/support.php:459 admin/support.php:462 +#: admin/support.php:467 admin/support.php:479 admin/support.php:484 +#: admin/support.php:501 admin/support.php:509 admin/support.php:606 +#: admin/support.php:609 admin/support.php:630 admin/support.php:659 +#: admin/support.php:694 install/functions/NagInstallClass.php:184 +#: install/functions/NagInstallClass.php:216 +#: install/functions/NagInstallClass.php:252 +#: install/functions/NagInstallClass.php:329 +#: install/functions/NagInstallClass.php:337 +#: install/functions/NagInstallClass.php:359 +#: install/functions/NagInstallClass.php:383 +#: install/functions/NagInstallClass.php:395 +#: install/functions/NagInstallClass.php:462 #: install/functions/NagInstallClass.php:485 -#: install/functions/NagInstallClass.php:493 -#: install/functions/NagInstallClass.php:515 -#: install/functions/NagInstallClass.php:539 +#: install/functions/NagInstallClass.php:494 +#: install/functions/NagInstallClass.php:546 #: install/functions/NagInstallClass.php:551 +#: install/functions/NagInstallClass.php:583 #: install/functions/NagInstallClass.php:618 -#: install/functions/NagInstallClass.php:640 -#: install/functions/NagInstallClass.php:649 -#: install/functions/NagInstallClass.php:701 -#: install/functions/NagInstallClass.php:706 -#: install/functions/NagInstallClass.php:739 -#: install/functions/NagInstallClass.php:777 -#: install/functions/NagInstallClass.php:784 -#: install/functions/NagInstallClass.php:812 -#: install/functions/NagInstallClass.php:872 -#: install/functions/NagInstallClass.php:904 -#: install/functions/NagInstallClass.php:938 -#: install/functions/NagInstallClass.php:971 -#: install/functions/NagInstallClass.php:1010 -#: install/functions/NagInstallClass.php:1019 -#: install/functions/NagInstallClass.php:1062 -#: install/functions/NagInstallClass.php:1071 install/step1.php:229 -#: install/step1.php:242 install/step1.php:246 install/step1.php:255 -#: install/step1.php:264 install/step1.php:273 install/step1.php:282 -#: install/step1.php:291 install/step1.php:300 install/step3.php:90 -#: install/step3.php:179 install/step3.php:204 +#: install/functions/NagInstallClass.php:625 +#: install/functions/NagInstallClass.php:652 +#: install/functions/NagInstallClass.php:714 +#: install/functions/NagInstallClass.php:746 +#: install/functions/NagInstallClass.php:780 +#: install/functions/NagInstallClass.php:813 +#: install/functions/NagInstallClass.php:853 +#: install/functions/NagInstallClass.php:862 +#: install/functions/NagInstallClass.php:905 +#: install/functions/NagInstallClass.php:914 install/step1.php:246 +#: install/step1.php:259 install/step1.php:263 install/step1.php:272 +#: install/step1.php:281 install/step1.php:290 install/step1.php:299 +#: install/step1.php:308 install/step1.php:317 install/step3.php:98 +#: install/step3.php:187 install/step3.php:212 msgid "failed" msgstr "fehlgeschlagen" -#: admin/support.php:101 admin/support.php:106 admin/support.php:118 -#: admin/support.php:126 admin/support.php:134 admin/support.php:144 -#: admin/support.php:160 admin/support.php:173 admin/support.php:182 -#: admin/support.php:191 admin/support.php:200 admin/support.php:210 -#: admin/support.php:255 admin/support.php:268 admin/support.php:283 -#: admin/support.php:292 admin/support.php:295 admin/support.php:334 -#: admin/support.php:340 admin/support.php:356 admin/support.php:372 -#: admin/support.php:388 admin/support.php:407 admin/support.php:410 -#: admin/support.php:425 admin/support.php:432 admin/support.php:457 -#: admin/support.php:469 admin/support.php:488 admin/support.php:584 -#: admin/support.php:600 admin/support.php:605 admin/support.php:610 -#: admin/support.php:619 admin/support.php:624 admin/support.php:630 -#: admin/support.php:635 +#: admin/support.php:120 admin/support.php:125 admin/support.php:137 +#: admin/support.php:145 admin/support.php:153 admin/support.php:163 +#: admin/support.php:179 admin/support.php:192 admin/support.php:201 +#: admin/support.php:210 admin/support.php:219 admin/support.php:229 +#: admin/support.php:275 admin/support.php:288 admin/support.php:303 +#: admin/support.php:312 admin/support.php:315 admin/support.php:351 +#: admin/support.php:357 admin/support.php:375 admin/support.php:379 +#: admin/support.php:391 admin/support.php:407 admin/support.php:411 +#: admin/support.php:426 admin/support.php:429 admin/support.php:444 +#: admin/support.php:451 admin/support.php:476 admin/support.php:488 +#: admin/support.php:505 admin/support.php:601 admin/support.php:617 +#: admin/support.php:622 admin/support.php:627 admin/support.php:636 +#: admin/support.php:641 admin/support.php:647 admin/support.php:652 msgid "ok" msgstr "OK" -#: admin/support.php:103 +#: admin/support.php:122 msgid "PHP version" msgstr "PHP Version" -#: admin/support.php:110 admin/support.php:163 +#: admin/support.php:129 admin/support.php:182 msgid "Required:" msgstr "Benötigt:" -#: admin/support.php:115 admin/support.php:123 admin/support.php:131 -#: admin/support.php:141 install/index.php:170 install/index.php:171 -#: install/index.php:172 install/index.php:173 +#: admin/support.php:134 admin/support.php:142 admin/support.php:150 +#: admin/support.php:160 install/index.php:171 install/index.php:172 +#: install/index.php:173 install/index.php:174 msgid "PHP module:" msgstr "PHP Modul:" -#: admin/support.php:153 +#: admin/support.php:172 msgid "MySQL version" msgstr "MySQL Version" -#: admin/support.php:169 admin/support.php:178 admin/support.php:187 -#: admin/support.php:196 +#: admin/support.php:188 admin/support.php:197 admin/support.php:206 +#: admin/support.php:215 msgid "PHP ini settings:" msgstr "PHP ini Einstellungen:" -#: admin/support.php:206 +#: admin/support.php:225 msgid "Read/Write access:" msgstr "Schreib-/Leserechte:" -#: admin/support.php:222 +#: admin/support.php:242 msgid "Config domain checks" msgstr "Überprüfung der Konfigurationsdomäne" -#: admin/support.php:223 +#: admin/support.php:243 msgid "" "The checks below are based on your data domain and config domain settings. " "To change the data domain, use the pull down menu in the upper right corner. " @@ -1578,181 +1601,184 @@ msgstr "" "jeweiligen Datendomäne definiert. Wiederholen Sie diese Überprüfungen für " "alle Konfigurationsdomänen die Sie verwenden." -#: admin/support.php:229 +#: admin/support.php:249 msgid "Config domain name" msgstr "Name der Konfigurationsdomäne" -#: admin/support.php:231 +#: admin/support.php:251 msgid "Connection type" msgstr "Verbindungstyp" -#: admin/support.php:252 +#: admin/support.php:272 msgid "Connection check" msgstr "Verbindungsprüfung" -#: admin/support.php:295 admin/support.php:340 admin/support.php:418 -#: admin/support.php:436 +#: admin/support.php:315 admin/support.php:357 admin/support.php:437 +#: admin/support.php:455 msgid "readonly" msgstr "nur lesen" -#: admin/support.php:346 config/fieldvars.php:45 +#: admin/support.php:363 config/fieldvars.php:46 msgid "Nagios process file" msgstr "Nagios Prozess Datei" -#: admin/support.php:361 admin/support.php:392 admin/support.php:415 -#: admin/support.php:444 admin/support.php:448 admin/support.php:465 -#: admin/support.php:493 -msgid "file is missed" -msgstr "Datei fehlt" +#: admin/support.php:380 admin/support.php:411 +msgid "file is missed or not used" +msgstr "Datei fehlt oder wird nicht verwendet" -#: admin/support.php:367 admin/support.php:397 +#: admin/support.php:386 admin/support.php:416 msgid "Nagios daemon is not running" msgstr "Demon ist nicht gestartet" -#: admin/support.php:372 admin/support.php:425 admin/support.php:469 +#: admin/support.php:391 admin/support.php:444 admin/support.php:488 msgid "not used with FTP" msgstr "Wird nicht benutzt bei FTP" -#: admin/support.php:396 admin/support.php:410 admin/support.php:440 +#: admin/support.php:415 admin/support.php:429 admin/support.php:459 msgid "demon dead" msgstr "Demon läuft nicht" -#: admin/support.php:402 config/fieldvars.php:43 +#: admin/support.php:421 config/fieldvars.php:44 msgid "Nagios command file" msgstr "Nagios Command Datei" -#: admin/support.php:452 config/fieldvars.php:44 +#: admin/support.php:434 admin/support.php:463 admin/support.php:467 +#: admin/support.php:484 admin/support.php:510 +msgid "file is missed" +msgstr "Datei fehlt" + +#: admin/support.php:471 config/fieldvars.php:45 msgid "Nagios binary file" msgstr "Nagios Binary Datei" # mutdialog.php -#: admin/support.php:461 admin/support.php:485 +#: admin/support.php:480 admin/support.php:502 msgid "not executable" msgstr "Nicht ausführbar" # config_class.php -#: admin/support.php:501 +#: admin/support.php:517 msgid "Verify configuration files and demon configuration" msgstr "Überprüfung der Konfigurationsdateien und der Demon Konfiguration" -#: admin/support.php:502 +#: admin/support.php:518 msgid "Configuration name" msgstr "Konfigurationsname" # fieldvars.php -#: admin/support.php:503 +#: admin/support.php:519 msgid "Used in data domain" msgstr "Benutzt in der Datendomäne" -#: admin/support.php:504 +#: admin/support.php:520 msgid "Included in demon configuration" msgstr "Eingebunden in der Demon Konfiguration" -#: admin/support.php:587 +#: admin/support.php:604 msgid "not used" msgstr "Nicht benutzt" -#: admin/support.php:593 +#: admin/support.php:610 msgid "cfg definition missed" msgstr "Definition fehlt" -#: admin/support.php:611 admin/support.php:625 admin/support.php:636 +#: admin/support.php:628 admin/support.php:642 admin/support.php:653 msgid "cfg definition missed, but actually not used" msgstr "Definition fehlt, wird aber aktuell nicht benutzt" -#: admin/support.php:614 +#: admin/support.php:631 msgid "wrong base path:" msgstr "Falscher Basispfad:" -#: admin/support.php:643 +#: admin/support.php:660 msgid "cfg file not readable" msgstr "Konfigurationsdatei nicht lesbar" -#: admin/support.php:676 +#: admin/support.php:693 msgid "Not used" msgstr "Nicht benutzt" -#: admin/support.php:678 +#: admin/support.php:695 msgid "unused - please delete!" msgstr "unbenutzt - bitte löschen!" -#: admin/templatedefinitions.php:260 +#: admin/templatedefinitions.php:272 msgid "Up" msgstr "Hinauf" -#: admin/templatedefinitions.php:264 +#: admin/templatedefinitions.php:278 msgid "Down" msgstr "Hinunter" -#: admin/timedefinitions.php:176 admin/variabledefinitions.php:143 -#: config/fieldvars.php:77 +#: admin/timedefinitions.php:177 admin/variabledefinitions.php:156 +#: config/fieldvars.php:79 msgid "Modify" msgstr "Bearbeiten" -#: admin/timeperiods.php:62 +#: admin/timeperiods.php:111 msgid "New time period inserted:" msgstr "Neue Zeitgruppe eingetragen:" -#: admin/timeperiods.php:65 +#: admin/timeperiods.php:114 msgid "Time period modified:" msgstr "Zeitgruppe modifiziert:" -#: admin/timeperiods.php:173 admin/timeperiods.php:252 +#: admin/timeperiods.php:226 admin/timeperiods.php:294 msgid "Time period definitions (timeperiods.cfg)" msgstr "Zeitperioden (timeperiods.cfg)" -#: admin/timeperiods.php:230 +#: admin/timeperiods.php:271 msgid "Please insert a time definition and a time range" msgstr "Bitte eine Zeitdefinition und einen Zeitbereich eintragen" # timeperiod.php -#: admin/timeperiods.php:253 config/fieldvars.php:92 +#: admin/timeperiods.php:295 config/fieldvars.php:95 msgid "Time period" msgstr "Zeitperiode" # tools.php -#: admin/tools.php:35 +#: admin/tools.php:37 msgid "Different tools" msgstr "Verschiedene Werkzeuge" -#: admin/tools.php:36 +#: admin/tools.php:38 msgid "" "Useful functions for data import, main configuration, daemon control, etc." msgstr "" "Verschiedene nützliche Funktionen wie Datenimport, Nagios Konfiguration, " "Prozesssteuerung etc." -#: admin/user.php:74 +#: admin/user.php:109 msgid "New user added:" msgstr "Neuen Benutzer angelegt:" -#: admin/user.php:128 admin/user.php:176 +#: admin/user.php:155 admin/user.php:203 msgid "User administration" msgstr "Benutzeradministration" -#: admin/user.php:132 +#: admin/user.php:159 msgid "The passwords do not match!" msgstr "Die Passwörter sind ungleich!" -#: admin/user.php:133 +#: admin/user.php:160 msgid "Please fill in the password" msgstr "Bitte ein Passwort eintragen" -#: admin/user.php:134 +#: admin/user.php:161 msgid "The password is too short - use at least 6 characters!" msgstr "Passwort ist zu kurz - mindestens 6 Zeichen sind nötig!" -#: admin/user.php:135 +#: admin/user.php:162 msgid "Webserver authentification" msgstr "Webserver Authentifikation" -#: admin/user.php:177 config/fieldvars.php:24 index.php:51 +#: admin/user.php:204 config/fieldvars.php:24 index.php:53 msgid "Username" msgstr "Benutzername" -#: admin/verify.php:50 admin/verify.php:157 functions/NagConfigClass.php:1115 -#: functions/NagConfigClass.php:1117 functions/NagConfigClass.php:1357 -#: functions/NagConfigClass.php:1359 +#: admin/verify.php:74 admin/verify.php:173 functions/NagConfigClass.php:1196 +#: functions/NagConfigClass.php:1198 functions/NagConfigClass.php:2506 +#: functions/NagConfigClass.php:2508 msgid "" "Writing of the configuration failed - no dataset or not activated dataset " "found" @@ -1760,94 +1786,84 @@ msgstr "" "Schreiben der Konfiguration fehlgeschlagen - es wurde kein existierender " "bzw. kein aktiver Datensatz gefunden" -#: admin/verify.php:62 +#: admin/verify.php:86 msgid "Write host configurations" msgstr "Schreibe Hostkonfigurationen" -#: admin/verify.php:69 admin/verify.php:91 +#: admin/verify.php:93 admin/verify.php:115 msgid "No configuration items defined!" msgstr "Keine Konfiguration definiert!" -#: admin/verify.php:84 +#: admin/verify.php:108 msgid "Write service configurations" msgstr "Schreibe Servicekonfigurationen" -#: admin/verify.php:102 admin/verify.php:117 admin/verify.php:132 -#: admin/verify.php:147 admin/verify.php:202 admin/verify.php:217 -#: admin/verify.php:232 admin/verify.php:247 admin/verify.php:262 -#: admin/verify.php:277 admin/verify.php:292 +#: admin/verify.php:125 admin/verify.php:138 admin/verify.php:151 +#: admin/verify.php:164 admin/verify.php:217 admin/verify.php:230 +#: admin/verify.php:243 admin/verify.php:256 admin/verify.php:269 +#: admin/verify.php:282 admin/verify.php:295 msgid "No dataset or no activated dataset found - empty configuration written" msgstr "" "Kein Datensatz oder kein aktivierter Datensatz gefunden - leere " "Konfiguration geschrieben" -#: admin/verify.php:311 +#: admin/verify.php:313 msgid "Cannot find the Nagios binary or no execute permissions!" msgstr "" "Nagios Binary Datei nicht gefunden oder keine Rechte dieses auszuführen!" -#: admin/verify.php:326 +#: admin/verify.php:328 msgid "Remote execution (FTP SITE EXEC) is not supported on your system!" msgstr "" "Ihr FTP Server unterstützt nicht die (FTP SITE EXEC) Funktion zum Ausführen " "von Befehlen!" -#: admin/verify.php:345 +#: admin/verify.php:346 msgid "Remote execution of nagios verify command failed (remote SSH)!" msgstr "" "Entfernte Ausführung des Nagios Prüfbefehls fehlgeschlagen (SSH Verbindung)" -#: admin/verify.php:350 +#: admin/verify.php:351 msgid "Nagios binary or configuration file not found (remote SSH)!" msgstr "" "Nagios Programmdatei oder Konfiguration nicht gefunden (Entfernter Zugriff " "via SSH/SFTP)!" -#: admin/verify.php:388 +#: admin/verify.php:387 msgid "Nagios daemon successfully restarted" msgstr "Nagios wurde erfolgreich neu gestartet" -#: admin/verify.php:390 +#: admin/verify.php:389 msgid "Restart command successfully send to Nagios" msgstr "Der Neustart Befehl wurde erfolgreich an Nagios übermittelt" -#: admin/verify.php:394 admin/verify.php:402 +#: admin/verify.php:393 admin/verify.php:401 msgid "" "Restart failed - Nagios command file not found or no execute permissions" msgstr "" "Nagios Neustart schlug fehl - Die Nagios Commanddatei konnte nicht gefunden " "werden oder die Dateiberechtigungen sind ungenügend" -#: admin/verify.php:397 +#: admin/verify.php:396 msgid "Nagios command file not found or no write permissions!" msgstr "" "Nagios Command Datei nicht gefunden oder keine Schreibrechte auf die Datei!" -#: admin/verify.php:404 +#: admin/verify.php:403 msgid "Restart failed - Nagios command file not found or no rights to execute" msgstr "" "Neustart von Nagios schlug fehl - Die Nagios Command Datei konnte nicht " "gefunden werden oder die Datei Berechtigungen reichen nicht aus" -#: admin/verify.php:408 -msgid "Restart failed - Nagios daemon was not running" -msgstr "Neustart fehlgeschlagen - Der Nagios Dienst lief nicht" - -#: admin/verify.php:410 -msgid "Nagios daemon is not running, cannot send restart command!" -msgstr "" -"Der Nagios Dienst läuft nicht, die Aufforderung zum Neustart konnte nicht " -"gesendet werden!" - -#: admin/verify.php:415 +#: admin/verify.php:407 msgid "Restart failed - FTP restrictions" msgstr "Neustart fehlgeschlagen aufgrund von FTP Fehlern" -#: admin/verify.php:417 +#: admin/verify.php:409 msgid "Nagios restart is not possible via FTP remote connection!" msgstr "Nagios Neustart ist nicht möglich über eine FTP Verbindung!" -#: admin/verify.php:440 +#: admin/verify.php:431 msgid "" "Restart failed - Nagios command file not found or no rights to execute " "(remote SSH)!" @@ -1856,63 +1872,63 @@ msgstr "" "gefunden werden oder die Datei Berechtigungen reichen nicht aus (Entfernter " "Zugriff via SSH/SFTP)!" -#: admin/verify.php:443 +#: admin/verify.php:434 msgid "Nagios daemon successfully restarted (remote SSH)" msgstr "" "Nagios wurde erfolgreich neu gestartet (Entfernter Zugriff via SSH/SFTP)" -#: admin/verify.php:445 +#: admin/verify.php:436 msgid "Restart command successfully send to Nagios (remote SSH)" msgstr "" "Der Neustart Befehl wurde erfolgreich an Nagios übermittelt (Entfernter " "Zugriff via SSH/SFTP)" -#: admin/verify.php:450 +#: admin/verify.php:441 msgid "Nagios command file not found (remote SSH)!" msgstr "" "Nagios command Datei nicht gefunden oder es besteht keine " "Schreibberechtigung auf die Datei (Entfernter Zugriff via SSH/SFTP)!" -#: admin/verify.php:458 +#: admin/verify.php:448 msgid "Check written configuration files" msgstr "Prüfe geschriebene Konfigurationsdateien" -#: admin/verify.php:459 +#: admin/verify.php:449 msgid "Check configuration files:" msgstr "Konfigurationsdateien prüfen:" -#: admin/verify.php:460 +#: admin/verify.php:450 msgid "Restart Nagios:" msgstr "Nagios neu starten:" -#: admin/verify.php:461 +#: admin/verify.php:451 msgid "Write monitoring data" msgstr "Schreibe Überwachungsdaten" -#: admin/verify.php:462 +#: admin/verify.php:452 msgid "Write additional data" msgstr "Schreibe zusätzliche Daten" -#: admin/verify.php:464 +#: admin/verify.php:454 msgid "Warning, always check the configuration files before restarting Nagios!" msgstr "" "Achtung, immer die Konfiguration prüfen bevor Nagios neu gestartet wird!" -#: admin/verify.php:467 config/fieldvars.php:62 +#: admin/verify.php:457 config/fieldvars.php:63 msgid "Do it" msgstr "Ausführen" -#: admin/verify.php:498 admin/verify.php:542 +#: admin/verify.php:488 admin/verify.php:532 msgid "Nagios written configuration files checked - Warnings/Errors:" msgstr "Geschriebene Nagios Konfiguration überprüft - Warnungen/Fehler:" # config_class.php -#: admin/verify.php:504 admin/verify.php:547 +#: admin/verify.php:494 admin/verify.php:537 msgid "Written configuration files are valid, Nagios can be restarted!" msgstr "" "Die geschriebene Konfiguration ist gültig, Nagios kann neu gestartet werden!" -#: admin/verify.php:510 +#: admin/verify.php:500 msgid "" "The configuration could not be tested successfully. The Nagios binary may " "have crashed during the test. Please repeat the test or try using the " @@ -1925,42 +1941,46 @@ msgstr "" "Dienst sollte nicht neu gestartet werden, da die Konfiguration ungültig sein " "kann." -#: admin/versioncheck.php:69 admin/versioncheck.php:79 +#: admin/versioncheck.php:90 msgid "check proxy settings" msgstr "prüfen Sie die Proxyeinstellungen" -#: admin/versioncheck.php:82 +#: admin/versioncheck.php:92 msgid "Installed" msgstr "Installiert" -#: admin/versioncheck.php:84 config/fieldvars.php:187 +#: admin/versioncheck.php:94 config/fieldvars.php:190 msgid "Information" msgstr "Information" -#: admin/versioncheck.php:106 +#: admin/versioncheck.php:122 admin/versioncheck.php:125 msgid "You already have the latest version installed" msgstr "Sie haben bereits die letzte stabile Version installiert" -#: admin/versioncheck.php:109 +#: admin/versioncheck.php:126 +msgid "new GIT hotfix version available:" +msgstr "Neue GIT Hotfix Version verfügbar:" + +#: admin/versioncheck.php:130 msgid "" "You are using an old NagiosQL version. Please update to the latest stable " "version" msgstr "" -"You are using an old NagiosQL version. Please update to the latest stable " -"version" +"Sie verwenden eine veraltete NagiosQL Version. Bitte aktualisieren sie zur " +"aktuellen stabilen Version" -#: admin/versioncheck.php:114 +#: admin/versioncheck.php:135 msgid "You are using a newer development version without official support" msgstr "" "Sie verwenden eine neuere Entwicklerversion, welche nicht offiziell " "unterstützt wird" # fieldvars.php -#: config/fieldvars.php:20 functions/prepend_adm.php:538 +#: config/fieldvars.php:20 functions/prepend_adm.php:533 msgid "Domain" msgstr "Domäne" -#: config/fieldvars.php:22 config/fieldvars.php:30 +#: config/fieldvars.php:22 config/fieldvars.php:31 msgid "Server name" msgstr "Servername" @@ -1968,711 +1988,727 @@ msgstr "Servername" msgid "Method" msgstr "Methode" -#: config/fieldvars.php:25 index.php:52 +#: config/fieldvars.php:25 index.php:54 msgid "Password" msgstr "Passwort" -#: config/fieldvars.php:27 +#: config/fieldvars.php:26 +msgid "SSH Port number" +msgstr "SSH Portnummer" + +#: config/fieldvars.php:28 msgid "Directory with SSH key pair" msgstr "Verzeichnis zum SSH Schlüsselpaar" -#: config/fieldvars.php:29 +#: config/fieldvars.php:30 msgid "Use encrypted FTP (FTPS)" msgstr "Verschlüsseltes FTP (FTPS)" -#: config/fieldvars.php:32 +#: config/fieldvars.php:33 msgid "Configuration directories" msgstr "Konfigurationsverzeichnisse" -#: config/fieldvars.php:34 +#: config/fieldvars.php:35 msgid "Nagios configuration files and directories" msgstr "Nagios Konfigurationdateien und -verzeichnisse" -#: config/fieldvars.php:35 +#: config/fieldvars.php:36 msgid "Base directory" msgstr "Basisverzeichnis" -#: config/fieldvars.php:36 +#: config/fieldvars.php:37 msgid "Host directory" msgstr "Hostverzeichnis" -#: config/fieldvars.php:37 +#: config/fieldvars.php:38 msgid "Service directory" msgstr "Serviceverzeichnis" -#: config/fieldvars.php:38 +#: config/fieldvars.php:39 msgid "Backup directory" msgstr "Backupverzeichnis" -#: config/fieldvars.php:39 +#: config/fieldvars.php:40 msgid "Host backup directory" msgstr "Host Backupverzeichnis" -#: config/fieldvars.php:41 +#: config/fieldvars.php:42 msgid "Service backup directory" msgstr "Service Backupverzeichnis" -#: config/fieldvars.php:42 +#: config/fieldvars.php:43 msgid "Picture base directory" msgstr "Nagios Bilderverzeichnis" -#: config/fieldvars.php:47 +#: config/fieldvars.php:48 msgid "Nagios cgi file" msgstr "Nagios CGI Datei" -#: config/fieldvars.php:48 +#: config/fieldvars.php:49 msgid "Nagios resource file" msgstr "Nagios Ressource Datei" -#: config/fieldvars.php:50 +#: config/fieldvars.php:51 msgid "Use common domain" msgstr "Benutze die globale Domäne" -#: config/fieldvars.php:52 +#: config/fieldvars.php:53 msgid "Decode UTF8 data in config files" msgstr "Übersetze UTF8 Daten in Konfigurationsdateien" -#: config/fieldvars.php:53 +#: config/fieldvars.php:54 msgid "Access key holes" msgstr "Zugriffsschlüssellöcher" # user.php -#: config/fieldvars.php:54 +#: config/fieldvars.php:55 msgid "Access keys" msgstr "Zugriffsschlüssel" -#: config/fieldvars.php:56 +#: config/fieldvars.php:57 msgid "Registered" msgstr "Registriert" -#: config/fieldvars.php:60 +#: config/fieldvars.php:61 msgid "Function" msgstr "Funktion" -#: config/fieldvars.php:61 +#: config/fieldvars.php:62 msgid "Marked" msgstr "Markierte" -#: config/fieldvars.php:63 +#: config/fieldvars.php:64 msgid "Add" msgstr "Hinzufügen" -#: config/fieldvars.php:64 +#: config/fieldvars.php:65 msgid "Form check" msgstr "Formularprüfung" -#: config/fieldvars.php:65 +#: config/fieldvars.php:66 msgid "Secure question" msgstr "Sicherheitsabfrage" -#: config/fieldvars.php:66 functions/NagContentClass.php:172 -#: functions/NagContentClass.php:177 +#: config/fieldvars.php:67 functions/NagContentClass.php:167 +#: functions/NagContentClass.php:172 msgid "Yes" msgstr "Ja" -#: config/fieldvars.php:67 functions/NagContentClass.php:170 -#: functions/NagContentClass.php:175 +#: config/fieldvars.php:68 functions/NagContentClass.php:165 +#: functions/NagContentClass.php:170 msgid "No" msgstr "Nein" -#: config/fieldvars.php:68 +#: config/fieldvars.php:69 +msgid "All" +msgstr "Alle" + +#: config/fieldvars.php:70 msgid "Time" msgstr "Zeit" -#: config/fieldvars.php:69 +#: config/fieldvars.php:71 msgid "User" msgstr "Benutzer" -#: config/fieldvars.php:70 +#: config/fieldvars.php:72 msgid "IP Address" msgstr "IP Adresse" -#: config/fieldvars.php:71 functions/NagImportClass.php:350 -#: functions/NagImportClass.php:355 functions/NagImportClass.php:419 -#: functions/NagImportClass.php:425 functions/NagImportClass.php:432 -#: functions/NagImportClass.php:437 +#: config/fieldvars.php:73 functions/NagImportClass.php:354 +#: functions/NagImportClass.php:359 functions/NagImportClass.php:425 +#: functions/NagImportClass.php:431 functions/NagImportClass.php:438 +#: functions/NagImportClass.php:443 msgid "Entry" msgstr "Eintrag" -#: config/fieldvars.php:72 +#: config/fieldvars.php:74 msgid "From" msgstr "Von" -#: config/fieldvars.php:73 +#: config/fieldvars.php:75 msgid "To" msgstr "Bis" -#: config/fieldvars.php:74 +#: config/fieldvars.php:76 msgid "Delete log entries" msgstr "Lösche Logeinträge" -#: config/fieldvars.php:75 config/fieldvars.php:88 config/fieldvars.php:184 +#: config/fieldvars.php:77 config/fieldvars.php:90 config/fieldvars.php:187 msgid "Copy" msgstr "Kopieren" -#: config/fieldvars.php:78 +#: config/fieldvars.php:80 msgid "Confirm password" msgstr "Passwort bestätigen" # password.php -#: config/fieldvars.php:79 +#: config/fieldvars.php:81 msgid "Old password" msgstr "Altes Passwort" -#: config/fieldvars.php:80 config/fieldvars.php:320 +#: config/fieldvars.php:82 config/fieldvars.php:324 msgid "New password" msgstr "Neues Passwort" -#: config/fieldvars.php:81 +#: config/fieldvars.php:83 msgid "Change password" msgstr "Passwort ändern" -#: config/fieldvars.php:82 +#: config/fieldvars.php:84 msgid "Menu page" msgstr "Menüseite" -#: config/fieldvars.php:83 +#: config/fieldvars.php:85 msgid "Search string" msgstr "Suchbegriff" -#: config/fieldvars.php:86 config/fieldvars.php:188 +#: config/fieldvars.php:88 config/fieldvars.php:191 msgid "Write config file" msgstr "Konfigdatei schreiben" -#: config/fieldvars.php:89 +#: config/fieldvars.php:91 msgid "Command" msgstr "Befehl" -#: config/fieldvars.php:91 +#: config/fieldvars.php:93 msgid "Command type" msgstr "Befehlstyp" -#: config/fieldvars.php:93 +#: config/fieldvars.php:94 +msgid "Help text" +msgstr "Hilfetext" + +#: config/fieldvars.php:96 msgid "Exclude" msgstr "Ausschliessen" -#: config/fieldvars.php:94 +#: config/fieldvars.php:97 msgid "Include" msgstr "Einschliessen" -#: config/fieldvars.php:95 +#: config/fieldvars.php:98 msgid "Time definitions" msgstr "Zeitdefinitionen" -#: config/fieldvars.php:96 +#: config/fieldvars.php:99 msgid "Weekday" msgstr "Wochentag" -#: config/fieldvars.php:97 +#: config/fieldvars.php:100 msgid "Time range" msgstr "Zeitbereich" -#: config/fieldvars.php:98 +#: config/fieldvars.php:101 msgid "Time definition" msgstr "Zeitdefinition" -#: config/fieldvars.php:99 +#: config/fieldvars.php:102 msgid "Insert" msgstr "Einfügen" -#: config/fieldvars.php:100 +#: config/fieldvars.php:103 msgid "Modify selection" msgstr "Auswahl ändern" -#: config/fieldvars.php:103 +#: config/fieldvars.php:106 msgid "Minimum importance" msgstr "Minimale Dringlichkeit" -#: config/fieldvars.php:104 +#: config/fieldvars.php:107 msgid "Time period hosts" msgstr "Zeitperiode Hosts" -#: config/fieldvars.php:105 +#: config/fieldvars.php:108 msgid "Time period services" msgstr "Zeitperiode Services" -#: config/fieldvars.php:106 +#: config/fieldvars.php:109 msgid "Host options" msgstr "Hostoptionen" -#: config/fieldvars.php:107 +#: config/fieldvars.php:110 msgid "Service options" msgstr "Serviceoptionen" -#: config/fieldvars.php:108 +#: config/fieldvars.php:111 msgid "Host command" msgstr "Hostbefehl" -#: config/fieldvars.php:109 +#: config/fieldvars.php:112 msgid "Service command" msgstr "Servicebefehl" -#: config/fieldvars.php:110 +#: config/fieldvars.php:113 msgid "EMail address" msgstr "E-Mail Adresse" -#: config/fieldvars.php:111 +#: config/fieldvars.php:114 msgid "Pager number" msgstr "Pagernummer" -#: config/fieldvars.php:112 +#: config/fieldvars.php:115 msgid "Addon address" msgstr "Zusatzadresse" -#: config/fieldvars.php:113 +#: config/fieldvars.php:116 msgid "Host notif. enable" msgstr "Hostalarmierung" -#: config/fieldvars.php:114 +#: config/fieldvars.php:117 msgid "Service notif. enable" msgstr "Servicealarmierung" -#: config/fieldvars.php:115 +#: config/fieldvars.php:118 msgid "Can submit commands" msgstr "Darf Befehle senden" -#: config/fieldvars.php:116 +#: config/fieldvars.php:119 msgid "Retain status info" msgstr "Behält Statusinfo" -#: config/fieldvars.php:117 +#: config/fieldvars.php:120 msgid "Retain non-status info" msgstr "Behält Nicht-Status information" # contactgroups.php -#: config/fieldvars.php:118 +#: config/fieldvars.php:121 msgid "Members" msgstr "Mitglieder" -#: config/fieldvars.php:119 +#: config/fieldvars.php:122 msgid "Group members" msgstr "Gruppenmitglieder" -#: config/fieldvars.php:120 +#: config/fieldvars.php:123 msgid "Common settings" msgstr "Allgemeine Einstellungen" -#: config/fieldvars.php:121 +#: config/fieldvars.php:124 msgid "Service settings" msgstr "Serviceeinstellungen" -#: config/fieldvars.php:123 +#: config/fieldvars.php:126 msgid "Add this host configuration to existing service definitions" msgstr "Diese Hostkonfiguration bestehenden Services hinzufügen" -#: config/fieldvars.php:125 +#: config/fieldvars.php:128 msgid "Parents" msgstr "Vorgeschaltete Hosts" -#: config/fieldvars.php:126 +#: config/fieldvars.php:129 msgid "Parent services" msgstr "Abhängige Services" -#: config/fieldvars.php:128 +#: config/fieldvars.php:131 msgid "Check command" msgstr "Prüfbefehl" -#: config/fieldvars.php:129 +#: config/fieldvars.php:132 msgid "Command view" msgstr "Befehlsübersicht" -#: config/fieldvars.php:130 +#: config/fieldvars.php:133 msgid "Additional templates" msgstr "Zusätzliche Vorlagen" -#: config/fieldvars.php:131 +#: config/fieldvars.php:134 msgid "Check settings" msgstr "Prüfeinstellungen" -#: config/fieldvars.php:132 +#: config/fieldvars.php:135 msgid "Initial state" msgstr "Initialstatus" -#: config/fieldvars.php:133 +#: config/fieldvars.php:136 msgid "Retry interval" msgstr "Wiederholintervall" -#: config/fieldvars.php:134 +#: config/fieldvars.php:137 msgid "Max check attempts" msgstr "Max. Prüfversuche" -#: config/fieldvars.php:135 +#: config/fieldvars.php:138 msgid "Check interval" msgstr "Prüfintervall" -#: config/fieldvars.php:136 +#: config/fieldvars.php:139 msgid "Active checks enabled" msgstr "Aktive Prüfungen" -#: config/fieldvars.php:137 +#: config/fieldvars.php:140 msgid "Passive checks enabled" msgstr "Passive Prüfungen" -#: config/fieldvars.php:138 +#: config/fieldvars.php:141 msgid "Check period" msgstr "Prüfperiode" -#: config/fieldvars.php:139 +#: config/fieldvars.php:142 msgid "Freshness treshold" msgstr "Aktualitätsschwelle" -#: config/fieldvars.php:140 +#: config/fieldvars.php:143 msgid "Check freshness" msgstr "Aktualitätsprüfung" -#: config/fieldvars.php:141 +#: config/fieldvars.php:144 msgid "Obsess over host" msgstr "Hostverfolgung" -#: config/fieldvars.php:142 +#: config/fieldvars.php:145 msgid "Obsess over service" msgstr "Serviceverfolgung" -#: config/fieldvars.php:143 +#: config/fieldvars.php:146 msgid "Event handler" msgstr "Ereignisbefehl" -#: config/fieldvars.php:144 +#: config/fieldvars.php:147 msgid "Event handler enabled" msgstr "Ereignisverarbeitung" -#: config/fieldvars.php:145 +#: config/fieldvars.php:148 msgid "Low flap threshold" msgstr "Untere Flatterschwelle" -#: config/fieldvars.php:146 +#: config/fieldvars.php:149 msgid "High flap threshold" msgstr "Obere Flatterschwelle" -#: config/fieldvars.php:147 +#: config/fieldvars.php:150 msgid "Flap detection enabled" msgstr "Flattererkennung" -#: config/fieldvars.php:148 +#: config/fieldvars.php:151 msgid "Flap detection options" msgstr "Flattererkennungsoptionen" -#: config/fieldvars.php:150 +#: config/fieldvars.php:153 msgid "Retain status information" msgstr "Behalte Statusinfo" -#: config/fieldvars.php:152 +#: config/fieldvars.php:155 msgid "Retain non-status information" msgstr "Behalte Nicht-Status Information" -#: config/fieldvars.php:153 +#: config/fieldvars.php:156 msgid "Process perf data" msgstr "Verarbeite Perf. Daten" -#: config/fieldvars.php:154 +#: config/fieldvars.php:157 msgid "Alarm settings" msgstr "Alarmeinstellungen" -#: config/fieldvars.php:155 +#: config/fieldvars.php:158 msgid "Contacts" msgstr "Kontakte" -#: config/fieldvars.php:157 +#: config/fieldvars.php:160 msgid "Notification period" msgstr "Meldungsdauer" -#: config/fieldvars.php:158 +#: config/fieldvars.php:161 msgid "Notification options" msgstr "Meldungsoptionen" -#: config/fieldvars.php:159 +#: config/fieldvars.php:162 msgid "Notification interval" msgstr "Meldungsinterval" -#: config/fieldvars.php:161 +#: config/fieldvars.php:164 msgid "First notification delay" msgstr "Verzögerung erste Meldung" -#: config/fieldvars.php:162 +#: config/fieldvars.php:165 msgid "Notification enabled" msgstr "Meldungen" -#: config/fieldvars.php:163 +#: config/fieldvars.php:166 msgid "Importance" msgstr "Dringlichkeit" -#: config/fieldvars.php:164 +#: config/fieldvars.php:167 msgid "Stalking options" msgstr "Verfolgungsoptionen" -#: config/fieldvars.php:165 +#: config/fieldvars.php:168 msgid "Addon settings" msgstr "Zusatzeinstellungen" -#: config/fieldvars.php:167 +#: config/fieldvars.php:170 msgid "VRML image" msgstr "VRML Bild" -#: config/fieldvars.php:168 +#: config/fieldvars.php:171 msgid "Notes URL" msgstr "Notizen URL" -#: config/fieldvars.php:169 +#: config/fieldvars.php:172 msgid "Status image" msgstr "Statusbild" -#: config/fieldvars.php:170 +#: config/fieldvars.php:173 msgid "Icon image" msgstr "Icon Bild" -#: config/fieldvars.php:171 +#: config/fieldvars.php:174 msgid "Action URL" msgstr "Vorgangs URL" -#: config/fieldvars.php:172 +#: config/fieldvars.php:175 msgid "2D coords" msgstr "2D Koordinaten" -#: config/fieldvars.php:173 +#: config/fieldvars.php:176 msgid "3D coords" msgstr "3D Koordinaten" -#: config/fieldvars.php:174 +#: config/fieldvars.php:177 msgid "Icon image ALT text" msgstr "Icon Bild ALT Text" -#: config/fieldvars.php:175 +#: config/fieldvars.php:178 msgid "standard" msgstr "standard" -#: config/fieldvars.php:176 +#: config/fieldvars.php:179 msgid "on" msgstr "ein" -#: config/fieldvars.php:177 +#: config/fieldvars.php:180 msgid "off" msgstr "aus" -#: config/fieldvars.php:178 +#: config/fieldvars.php:181 msgid "skip" msgstr "skip" -#: config/fieldvars.php:180 +#: config/fieldvars.php:183 msgid "Free variable definitions" msgstr "Freie Variabel Definitionen" -#: config/fieldvars.php:181 +#: config/fieldvars.php:184 msgid "Variable name" msgstr "Variabelname" -#: config/fieldvars.php:182 +#: config/fieldvars.php:185 msgid "Variable value" msgstr "Variablen Wert" -#: config/fieldvars.php:185 +#: config/fieldvars.php:188 msgid "Activate" msgstr "Aktivieren" -#: config/fieldvars.php:186 +#: config/fieldvars.php:189 msgid "Deactivate" msgstr "Deaktivieren" -#: config/fieldvars.php:190 +#: config/fieldvars.php:193 msgid "Do you really want to delete this database entry:" msgstr "Soll dieser Datenbankeintrag wirklich gelöscht werden:" -#: config/fieldvars.php:192 +#: config/fieldvars.php:195 msgid "Do you really want to delete all marked entries?" msgstr "Sollen die markierten Einträge wirklich gelöscht werden?" -#: config/fieldvars.php:194 +#: config/fieldvars.php:197 msgid "Mark all shown datasets" msgstr "Alle angezeigten Datensätze markieren" -#: config/fieldvars.php:195 +#: config/fieldvars.php:198 msgid "File" msgstr "Datei" -#: config/fieldvars.php:196 +#: config/fieldvars.php:199 msgid "Write all config files" msgstr "Alle Konfigdateien schreiben" -#: config/fieldvars.php:197 +#: config/fieldvars.php:200 msgid "Address" msgstr "Hostadresse" -#: config/fieldvars.php:198 +#: config/fieldvars.php:201 msgid "Display name" msgstr "Anzeigename" -#: config/fieldvars.php:200 +#: config/fieldvars.php:203 msgid "Use this configuration as a template" msgstr "Diese Definition als Vorlage verwenden" -#: config/fieldvars.php:201 +#: config/fieldvars.php:204 msgid "Generic name" msgstr "Generischer Name" -#: config/fieldvars.php:208 +#: config/fieldvars.php:211 msgid "Please check at least one option from:" msgstr "Bitte mindestens eine Option auswählen bei:" -#: config/fieldvars.php:209 +#: config/fieldvars.php:212 msgid "Host group name" msgstr "Hostgruppenname" -#: config/fieldvars.php:210 +#: config/fieldvars.php:213 msgid "Host group members" msgstr "Hostgruppenmitglieder" -#: config/fieldvars.php:214 +#: config/fieldvars.php:217 msgid "Is volatile" msgstr "Ist unstetig" -#: config/fieldvars.php:215 +#: config/fieldvars.php:218 msgid "Parallelize checks" msgstr "Parallele Prüfungen" -#: config/fieldvars.php:216 +#: config/fieldvars.php:219 msgid "Config name filter" msgstr "Filter Konfigurationsname" -#: config/fieldvars.php:218 +#: config/fieldvars.php:220 +msgid "Filter" +msgstr "Filter" + +#: config/fieldvars.php:223 msgid "Import directory" msgstr "Importverzeichnis" -#: config/fieldvars.php:220 +#: config/fieldvars.php:225 msgid "Please insert a variable name and a variable definition" msgstr "Bitte einen Variablennamen und einen Wertbereich eintragen" -#: config/fieldvars.php:222 config/fieldvars.php:229 config/fieldvars.php:269 +#: config/fieldvars.php:227 config/fieldvars.php:234 config/fieldvars.php:274 msgid "Warning:" msgstr "Warnung:" -#: config/fieldvars.php:222 +#: config/fieldvars.php:227 msgid "" -"You have not filled in some required fields!

If this values are set " +"You have not filled in some required fields!

If these values are set " "by a template, you can save anyway - otherwise you will get an invalid " "configuration!" msgstr "" -"Es wurden nicht alls Pflichfelder ausgefüllt!

Sofern diese Werte über " -"eine Vorlage gesetzt werden kann trotzdem gespeichert werden - andernfalls " -"wird eine ungültige Konfiguration entstehen!" +"Sie haben einige Pflichtfelder nicht ausgefüllt!

Wenn diese Werte " +"durch eine Vorlage vorgegeben sind, können Sie trotzdem speichern - " +"ansonsten erhalten Sie eine ungültige Konfiguration!" -#: config/fieldvars.php:227 +#: config/fieldvars.php:232 msgid "Write config" msgstr "Konfigurationsdatei schreiben" -#: config/fieldvars.php:229 +#: config/fieldvars.php:234 msgid "" "You have not filled in all command arguments (ARGx) for your selected " -"command!

If this arguments are optional, you can save anyway - " +"command!

If these arguments are optional, you can save anyway - " "otherwise you will get an invalid configuration!" msgstr "" -"Es wurden nicht alle Befehlsargumente (ARGx) für den ausgewählten Befehl " -"ausgefüllt!

Wenn diese Argumente nicht benötigt werden, speichern Sie " -"einfach - andernfalls wird eine ungültige Konfiguration entstehen!" +"Sie haben nicht alle Befehlsargumente (ARGx) für den ausgewählten Befehl " +"eingegeben!

Wenn diese Argumente optional sind, können Sie trotzdem " +"speichern - ansonsten erhalten Sie eine ungültige Konfiguration!" -#: config/fieldvars.php:232 +#: config/fieldvars.php:237 msgid "Service group members" msgstr "Servicegruppenmitglieder" -#: config/fieldvars.php:233 +#: config/fieldvars.php:238 msgid "Service group name" msgstr "Servicegruppenname" -#: config/fieldvars.php:236 +#: config/fieldvars.php:241 msgid "Hostgroups" msgstr "Hostgruppen" -#: config/fieldvars.php:237 +#: config/fieldvars.php:242 msgid "Inherit parents" msgstr "Vererbung" -#: config/fieldvars.php:239 +#: config/fieldvars.php:244 msgid "Execution failure criteria" msgstr "Ausführungsfehlerkriterium" -#: config/fieldvars.php:241 +#: config/fieldvars.php:246 msgid "Nofification failure criteria" msgstr "Meldungsfehlerkriterium" -#: config/fieldvars.php:242 +#: config/fieldvars.php:247 msgid "Dependency period" msgstr "Abhängigkeitsperiode" -#: config/fieldvars.php:243 +#: config/fieldvars.php:248 msgid "Escalation period" msgstr "Eskalationsdauer" -#: config/fieldvars.php:244 +#: config/fieldvars.php:249 msgid "Escalation options" msgstr "Eskalationsoptionen" -#: config/fieldvars.php:245 +#: config/fieldvars.php:250 msgid "First notification" msgstr "Erste Meldung" -#: config/fieldvars.php:246 +#: config/fieldvars.php:251 msgid "Last notification" msgstr "Letzte Meldung" -#: config/fieldvars.php:250 +#: config/fieldvars.php:255 msgid "Dependent servicegroups" msgstr "Abhängige Servicegruppen" -#: config/fieldvars.php:251 +#: config/fieldvars.php:256 msgid "Help" msgstr "Hilfe" -#: config/fieldvars.php:252 +#: config/fieldvars.php:257 msgid "Calendar" msgstr "Kalender" -#: config/fieldvars.php:253 +#: config/fieldvars.php:258 msgid "Group name" msgstr "Gruppenname" -#: config/fieldvars.php:254 +#: config/fieldvars.php:259 msgid "Users" msgstr "Benutzer" -#: config/fieldvars.php:255 +#: config/fieldvars.php:260 msgid "Access group" msgstr "Zugriffsgruppe" -#: config/fieldvars.php:256 +#: config/fieldvars.php:261 msgid "User definitions" msgstr "Benutzerdefinitionen" -#: config/fieldvars.php:257 +#: config/fieldvars.php:262 msgid "User name" msgstr "Benutzername" -#: config/fieldvars.php:258 +#: config/fieldvars.php:263 msgid "User rights" msgstr "Benutzerrechte" -#: config/fieldvars.php:260 +#: config/fieldvars.php:265 msgid "Object access restrictions" msgstr "Objektzugriffsrestriktionen" -#: config/fieldvars.php:262 +#: config/fieldvars.php:267 msgid "Enable group administration" msgstr "Erlaube Gruppenadministration" -#: config/fieldvars.php:263 +#: config/fieldvars.php:268 msgid "Show relation data" msgstr "Zeige verknüpfte Daten" -#: config/fieldvars.php:264 +#: config/fieldvars.php:269 msgid "Hide relation data" msgstr "Verstecke verknüpfte Daten" -#: config/fieldvars.php:266 +#: config/fieldvars.php:271 msgid "User language" msgstr "Benutzersprache" -#: config/fieldvars.php:267 +#: config/fieldvars.php:272 msgid "Standard domain" msgstr "Standarddomäne" -#: config/fieldvars.php:269 +#: config/fieldvars.php:274 msgid "" "The associated services must be additionally written to the files. Only " "writing the host configuration is not sufficient because the modification is " @@ -2682,276 +2718,239 @@ msgstr "" "Schreiben der Hostkonfiguration alleine genügt nicht, weil die Änderungen in " "der Servicekonfiguration eingetragen werden!" -#: config/fieldvars.php:273 +#: config/fieldvars.php:278 msgid "Monday" msgstr "Montag" -#: config/fieldvars.php:274 +#: config/fieldvars.php:279 msgid "Tuesday" msgstr "Dienstag" -#: config/fieldvars.php:275 +#: config/fieldvars.php:280 msgid "Wednesday" msgstr "Mittwoch" -#: config/fieldvars.php:276 +#: config/fieldvars.php:281 msgid "Thursday" msgstr "Donnerstag" -#: config/fieldvars.php:277 +#: config/fieldvars.php:282 msgid "Friday" msgstr "Freitag" -#: config/fieldvars.php:278 +#: config/fieldvars.php:283 msgid "Saturday" msgstr "Samstag" -#: config/fieldvars.php:279 +#: config/fieldvars.php:284 msgid "Sunday" msgstr "Sonntag" -#: config/fieldvars.php:291 +#: config/fieldvars.php:295 msgid "Main page" msgstr "Hauptseite" -#: config/fieldvars.php:292 +#: config/fieldvars.php:296 msgid "Supervision" msgstr "Überwachung" -#: config/fieldvars.php:295 +#: config/fieldvars.php:299 msgid "Commands" msgstr "Befehle" -#: config/fieldvars.php:296 +#: config/fieldvars.php:300 msgid "Specialties" msgstr "Spezialitäten" -#: config/fieldvars.php:297 +#: config/fieldvars.php:301 msgid "Tools" msgstr "Werkzeuge" -#: config/fieldvars.php:308 +#: config/fieldvars.php:312 msgid "Service dependency" msgstr "Service Abhängigkeiten" -#: config/fieldvars.php:309 +#: config/fieldvars.php:313 msgid "Service escalation" msgstr "Service Eskalationen" -#: config/fieldvars.php:310 +#: config/fieldvars.php:314 msgid "Host dependency" msgstr "Host Abhängigk." -#: config/fieldvars.php:311 +#: config/fieldvars.php:315 msgid "Host escalation" msgstr "Host Eskalation" -#: config/fieldvars.php:312 +#: config/fieldvars.php:316 msgid "Extended Host" msgstr "Host erweitert" -#: config/fieldvars.php:313 +#: config/fieldvars.php:317 msgid "Extended Service" msgstr "Service erweitert" -#: config/fieldvars.php:314 +#: config/fieldvars.php:318 msgid "Data import" msgstr "Datenimport" -#: config/fieldvars.php:317 +#: config/fieldvars.php:321 msgid "User admin" msgstr "Benutzer" -#: config/fieldvars.php:318 +#: config/fieldvars.php:322 msgid "Group admin" msgstr "Gruppen" -#: config/fieldvars.php:319 +#: config/fieldvars.php:323 msgid "Nagios control" msgstr "Nagios steuern" -#: config/fieldvars.php:321 +#: config/fieldvars.php:325 msgid "Logbook" msgstr "Logbuch" -#: config/fieldvars.php:322 +#: config/fieldvars.php:326 msgid "Nagios config" msgstr "Nagios Config" -#: config/fieldvars.php:323 +#: config/fieldvars.php:327 msgid "Settings" msgstr "Einstellungen" -#: config/fieldvars.php:324 +#: config/fieldvars.php:328 msgid "Definitions" msgstr "Definitionen" -#: config/fieldvars.php:325 +#: config/fieldvars.php:329 msgid "CGI config" msgstr "CGI Config" -#: config/fieldvars.php:326 +#: config/fieldvars.php:330 msgid "Menu access" msgstr "Menu Zugriff" -#: config/fieldvars.php:327 +#: config/fieldvars.php:331 msgid "Domains" msgstr "Domänen" -#: config/fieldvars.php:331 +#: config/fieldvars.php:335 msgid "Help editor" msgstr "Hilfe Editor" # fieldvars.php -#: config/fieldvars.php:332 +#: config/fieldvars.php:336 msgid "Data domains" msgstr "Datendomäne" -#: config/fieldvars.php:333 +#: config/fieldvars.php:337 msgid "Config targets" msgstr "Konfigdomäne" -#: config/fieldvars.php:334 +#: config/fieldvars.php:338 msgid "Support" msgstr "Support" -#: functions/MysqliDbClass.php:291 +#: functions/MysqliDbClass.php:132 msgid "Missing server connection parameter!" msgstr "Fehlende Parameter für die Serververbindung!" -#: functions/MysqliDbClass.php:310 +#: functions/MysqliDbClass.php:151 msgid "Connection to the database server has failed by reason:" msgstr "Die Verbindung zum Datenbankserver erzeugte den folgenden Fehler:" -#: functions/MysqliDbClass.php:338 +#: functions/MysqliDbClass.php:194 msgid "Missing database connection parameter!" msgstr "Fehlende Parameter für die Datenbankverbindung!" -#: functions/MysqliDbClass.php:347 +#: functions/MysqliDbClass.php:206 msgid "Connection to the database has failed by reason:" msgstr "Die Verbindung zum Datenbankserver erzeugte den folgenden Fehler:" -#: functions/NagConfigClass.php:336 functions/NagConfigClass.php:338 +#: functions/MysqliDbClass.php:404 +msgid "Missing MySQL SSL parameter!" +msgstr "Fehlende SSL Parameter für die Serververbindung!" + +#: functions/NagConfigClass.php:331 functions/NagConfigClass.php:333 msgid "Connection to remote system failed (FTP connection):" msgstr "Verbindung zum entfernten System ist fehlgeschlagen (FTP Verbindung):" -#: functions/NagConfigClass.php:387 functions/NagConfigClass.php:389 +#: functions/NagConfigClass.php:407 functions/NagConfigClass.php:409 msgid "SSH public key does not exist or is not readable" msgstr "Der SSH Public Key existiert nicht oder ist nicht lesbar" -#: functions/NagConfigClass.php:394 functions/NagConfigClass.php:396 +#: functions/NagConfigClass.php:414 functions/NagConfigClass.php:416 msgid "SSH private key does not exist or is not readable" msgstr "Der SSH Private Key existiert nicht oder ist nicht lesbar" -#: functions/NagConfigClass.php:430 functions/NagConfigClass.php:432 -#: functions/NagConfigClass.php:441 functions/NagConfigClass.php:443 +#: functions/NagConfigClass.php:449 functions/NagConfigClass.php:451 +#: functions/NagConfigClass.php:460 functions/NagConfigClass.php:462 msgid "Connection to remote system failed (SSH2 connection):" msgstr "Verbindung zum entfernten System ist fehlgeschlagen (SSH2 Verbindung):" -#: functions/NagConfigClass.php:600 -msgid "" -"Cannot backup the old file because the permissions are wrong - destination " -"file: " -msgstr "" -"Kann die alte Datei nicht sichern weil die Dateirechte falsch sind - " -"Zieldatei: " +#: functions/NagConfigClass.php:450 functions/NagConfigClass.php:452 +#: functions/NagConfigClass.php:461 functions/NagConfigClass.php:463 +msgid "port" +msgstr "Port" -#: functions/NagConfigClass.php:605 -msgid "" -"Cannot backup the old file because the source file is missing - source file: " -msgstr "" -"Kann die alte Datei nicht sichern weil die Quelldatei nicht gefunden wurde: " - -#: functions/NagConfigClass.php:623 -msgid "" -"Cannot backup the old file because the source file is missing (remote FTP) - " -"source file: " -msgstr "" -"Kann die alte Datei nicht sichern weil die Quelldatei nicht gefunden wurde " -"(FTP Zugriff) - Quelldatei: " - -#: functions/NagConfigClass.php:629 -msgid "" -"Cannot backup the old file because the permissions are wrong (remote FTP) - " -"destination file: " -msgstr "" -"Kann die alte Datei nicht sichern weil die Dateirechte falsch sind (FTP " -"Zugriff) - Zieldatei: " - -#: functions/NagConfigClass.php:648 -msgid "" -"Cannot backup the old file because the source file is missing (remote SFTP) " -"- source file: " -msgstr "" -"Kann die alte Datei nicht sichern weil die Quelldatei nicht gefunden wurde " -"(SSH/SFTP Zugriff) - Quelldatei: " - -#: functions/NagConfigClass.php:654 -msgid "" -"Cannot backup the old file because the permissions are wrong (remote SFTP) - " -"destination file: " -msgstr "" -"Kann die alte Datei nicht sichern weil die Dateirechte falsch sind (SSH/SFTP " -"Zugriff) - Zieldatei: " - -#: functions/NagConfigClass.php:685 +#: functions/NagConfigClass.php:552 msgid "Cannot delete the file (wrong permissions)!" msgstr "Datei kann nicht gelöscht werden (Berechtigungen prüfen)!" -#: functions/NagConfigClass.php:690 +#: functions/NagConfigClass.php:557 msgid "Cannot delete the file (file does not exist)!" msgstr "Datei kann nicht gelöscht werden (Datei existiert nicht)!" -#: functions/NagConfigClass.php:706 +#: functions/NagConfigClass.php:573 msgid "Cannot delete file because it does not exists (remote FTP)!" msgstr "" "Datei kann nicht gelöscht werden, da sie nicht exisitiert (Entfernter " "Zugriff via FTP)" -#: functions/NagConfigClass.php:712 +#: functions/NagConfigClass.php:579 msgid "Cannot delete file because the permissions are incorrect (remote FTP)!" msgstr "" "Datei kann aufgrund falscher Dateiberechtigungen nicht gelöscht werden (FTP " "Remote Dateirechte)" -#: functions/NagConfigClass.php:724 +#: functions/NagConfigClass.php:591 msgid "Cannot delete file because it does not exists (remote SSH/SFTP)!" msgstr "" "Datei kann nicht gelöscht werden, da sie nicht vorhanden ist (Entfernter " "Zugriff via SSH/SFTP)" -#: functions/NagConfigClass.php:730 +#: functions/NagConfigClass.php:597 msgid "" "Cannot delete file because the permissions are incorrect (remote SSH/SFTP)!" msgstr "" "Datei kann aufgrund falscher Dateiberechtigungen nicht gelöscht werden " "(Entfernter Zugriff via SSH/SFTP)" -#: functions/NagConfigClass.php:822 functions/NagConfigClass.php:846 +#: functions/NagConfigClass.php:692 functions/NagConfigClass.php:716 msgid "" "Cannot get the remote file (it does not exist or is not readable) - remote " "file: " msgstr "Importdatei existiert nicht oder ist nicht lesbar - Importdatei: " -#: functions/NagConfigClass.php:831 +#: functions/NagConfigClass.php:701 msgid "" "Cannot write the remote file (remote file is not writeable)- remote file: " msgstr "" "Kann die entfernte Datei nicht schreiben (fehlende Schreibrechte) - " "entfernte Datei: " -#: functions/NagConfigClass.php:849 +#: functions/NagConfigClass.php:719 msgid "Remote file is not readable - remote file: " msgstr "Entfernte Datei ist nicht lesbar - entfernte Datei: " -#: functions/NagConfigClass.php:860 +#: functions/NagConfigClass.php:730 msgid "" "Cannot write a remote file (remote file is not writeable) - remote file: " msgstr "" "Kann eine entfernte Datei nicht schreiben (fehlende Schreibrechte) - " "entfernte Datei: " -#: functions/NagConfigClass.php:866 +#: functions/NagConfigClass.php:736 msgid "" "Cannot copy a local file to remote because the local file does not exist or " "is not readable - local file: " @@ -2960,72 +2959,118 @@ msgstr "" "lokale Datei nicht existiert oder nicht lesbar ist - lokale Datei: " # contacts.php -#: functions/NagConfigClass.php:894 +#: functions/NagConfigClass.php:764 msgid "Could not open directory" msgstr "Kann das Verzeichnis nicht öffnen" # config_class.php -#: functions/NagConfigClass.php:1003 functions/NagConfigClass.php:1006 +#: functions/NagConfigClass.php:873 functions/NagConfigClass.php:876 msgid "Warning: configuration file is out of date!" msgstr "Achtung: Konfigurationsdatei ist veraltet!" -#: functions/NagConfigClass.php:1010 functions/NagConfigClass.php:1042 -#: functions/NagConfigClass.php:1108 +#: functions/NagConfigClass.php:880 functions/NagConfigClass.php:995 +#: functions/NagConfigClass.php:2499 msgid "Warning: no configuration target defined!" msgstr "Achtung: kein Konfigurationsziel definiert!" -#: functions/NagConfigClass.php:1030 functions/NagConfigClass.php:1076 +#: functions/NagConfigClass.php:983 functions/NagConfigClass.php:2466 msgid "" "It is not possible to write config files directly from the common domain!" msgstr "" "Es ist nicht möglich Konfigurationsdateien direkt aus der globalen Domäne zu " "schreiben!" -#: functions/NagConfigClass.php:2069 +#: functions/NagConfigClass.php:2288 +msgid "" +"Cannot backup the old file because the permissions are wrong - destination " +"file: " +msgstr "" +"Kann die alte Datei nicht sichern weil die Dateirechte falsch sind - " +"Zieldatei: " + +#: functions/NagConfigClass.php:2293 +msgid "" +"Cannot backup the old file because the source file is missing - source file: " +msgstr "" +"Kann die alte Datei nicht sichern weil die Quelldatei nicht gefunden wurde: " + +#: functions/NagConfigClass.php:2311 +msgid "" +"Cannot backup the old file because the source file is missing (remote FTP) - " +"source file: " +msgstr "" +"Kann die alte Datei nicht sichern weil die Quelldatei nicht gefunden wurde " +"(FTP Zugriff) - Quelldatei: " + +#: functions/NagConfigClass.php:2317 +msgid "" +"Cannot backup the old file because the permissions are wrong (remote FTP) - " +"destination file: " +msgstr "" +"Kann die alte Datei nicht sichern weil die Dateirechte falsch sind (FTP " +"Zugriff) - Zieldatei: " + +#: functions/NagConfigClass.php:2336 +msgid "" +"Cannot backup the old file because the source file is missing (remote SFTP) " +"- source file: " +msgstr "" +"Kann die alte Datei nicht sichern weil die Quelldatei nicht gefunden wurde " +"(SSH/SFTP Zugriff) - Quelldatei: " + +#: functions/NagConfigClass.php:2342 +msgid "" +"Cannot backup the old file because the permissions are wrong (remote SFTP) - " +"destination file: " +msgstr "" +"Kann die alte Datei nicht sichern weil die Dateirechte falsch sind (SSH/SFTP " +"Zugriff) - Zieldatei: " + +#: functions/NagConfigClass.php:2395 msgid "Cannot open/overwrite the configuration file (FTP connection failed)!" msgstr "" "Kann die Konfigurationsdatei nicht schreiben/überschreiben (FTP Verbindung " "fehlgeschlagen)!" -#: functions/NagConfigClass.php:2091 +#: functions/NagConfigClass.php:2417 msgid "Cannot open/overwrite the configuration file (remote SFTP)!" msgstr "" "Kann Konfigurationsdatei nicht öffnen/überschreiben (Entfernter Zugriff via " "SSH/SFTP)!" -#: functions/NagContentClass.php:251 +#: functions/NagContentClass.php:246 msgid "out-of-date" msgstr "Veraltet" -#: functions/NagContentClass.php:253 +#: functions/NagContentClass.php:248 msgid "no target" msgstr "kein Ziel" -#: functions/NagContentClass.php:256 functions/NagContentClass.php:259 +#: functions/NagContentClass.php:251 functions/NagContentClass.php:254 msgid "missed" msgstr "fehlt" -#: functions/NagContentClass.php:262 install/functions/NagInstallClass.php:479 +#: functions/NagContentClass.php:257 install/functions/NagInstallClass.php:323 msgid "up-to-date" msgstr "Aktuell" -#: functions/NagContentClass.php:355 +#: functions/NagContentClass.php:476 msgid "Last database update:" msgstr "Letzte Datenbankänderung:" -#: functions/NagContentClass.php:359 +#: functions/NagContentClass.php:480 msgid "Last file change of the configuration target " msgstr "Letzte Dateiänderung beim Konfigurationsziel " -#: functions/NagDataClass.php:267 functions/NagDataClass.php:269 +#: functions/NagDataClass.php:176 functions/NagDataClass.php:178 msgid "Data set copy failed - table [new name]:" msgstr "Kopieren fehlgeschlagen - Tabelle [Neuer Name]:" -#: functions/NagDataClass.php:273 functions/NagDataClass.php:275 +#: functions/NagDataClass.php:182 functions/NagDataClass.php:184 msgid "Data set copied - table [new name]:" msgstr "Daten in Tabelle kopiert - Tabelle [Neuer Name]:" -#: functions/NagDataClass.php:295 functions/NagDataClass.php:300 +#: functions/NagDataClass.php:204 functions/NagDataClass.php:209 msgid "" "No dataset copied. Maybe the dataset does not exist or you do not have write " "permission." @@ -3034,11 +3079,11 @@ msgstr "" "die Schreibrechte fehlen." # data_class.php -#: functions/NagDataClass.php:393 functions/NagDataClass.php:422 +#: functions/NagDataClass.php:790 functions/NagDataClass.php:821 msgid "Delete failed because a database error:" msgstr "Löschen wegen eines Datenbankfehlers fehlgeschlagen:" -#: functions/NagDataClass.php:397 +#: functions/NagDataClass.php:794 msgid "" "No data deleted. The dataset probably does not exist or is protected from " "deletion." @@ -3046,21 +3091,21 @@ msgstr "" "Keine Daten gelöscht. Möglicherweise existiert der Datensatz nicht oder er " "ist Löschgeschützt." -#: functions/NagDataClass.php:403 +#: functions/NagDataClass.php:800 msgid "Delete dataset id:" msgstr "Daten gelöscht mit id:" -#: functions/NagDataClass.php:403 +#: functions/NagDataClass.php:800 msgid "- from table:" msgstr "- von Tabelle:" -#: functions/NagDataClass.php:404 functions/NagDataClass.php:439 -#: functions/NagDataClass.php:614 functions/NagDataClass.php:963 -#: functions/NagDataClass.php:1020 +#: functions/NagDataClass.php:801 functions/NagDataClass.php:838 +#: functions/NagDataClass.php:1020 functions/NagDataClass.php:1379 +#: functions/NagDataClass.php:1437 msgid "- with affected rows:" msgstr "- Anzahl betroffene Datensätze:" -#: functions/NagDataClass.php:432 functions/NagDataClass.php:443 +#: functions/NagDataClass.php:831 functions/NagDataClass.php:842 msgid "" "No data deleted. Probably the dataset does not exist or it is protected from " "delete." @@ -3068,11 +3113,11 @@ msgstr "" "Keine Daten gelöscht. Möglicherweise existiert der Datensatz nicht, oder er " "ist Löschgeschützt." -#: functions/NagDataClass.php:438 functions/NagDataClass.php:613 +#: functions/NagDataClass.php:837 functions/NagDataClass.php:1019 msgid "Deleted data from table:" msgstr "Daten gelöscht aus der Tabelle:" -#: functions/NagDataClass.php:603 +#: functions/NagDataClass.php:1009 msgid "" "No data deleted. Probably the dataset does not exist, it is protected from " "deletion, you do not have write permission or it has relations to other " @@ -3084,7 +3129,7 @@ msgstr "" "aufgelöste Abhängigkeiten. Benutze die \"info\" Funktion für weitere " "Informationen über Abhängigkeiten!" -#: functions/NagDataClass.php:619 +#: functions/NagDataClass.php:1025 msgid "" "No data deleted. Probably the dataset does not exist, it is protected from " "deletion or you do not have write permission." @@ -3092,36 +3137,36 @@ msgstr "" "Kein Datensatz gelöscht. Möglicherweise existiert der Datensatz nicht, er " "ist Löschgeschützt oder die Schreibrechte fehlen." -#: functions/NagDataClass.php:691 +#: functions/NagDataClass.php:1097 msgid "Relation information for " msgstr "Verknüpfungsinformationen für " -#: functions/NagDataClass.php:692 +#: functions/NagDataClass.php:1098 msgid " of table " msgstr " aus der Tabelle " -#: functions/NagDataClass.php:747 functions/NagDataClass.php:752 -#: functions/NagDataClass.php:759 functions/NagDataClass.php:778 -#: functions/NagDataClass.php:784 +#: functions/NagDataClass.php:1157 functions/NagDataClass.php:1162 +#: functions/NagDataClass.php:1169 functions/NagDataClass.php:1189 +#: functions/NagDataClass.php:1195 msgid "Relation to " msgstr "Verknüpfung nach " -#: functions/NagDataClass.php:748 functions/NagDataClass.php:753 -#: functions/NagDataClass.php:760 functions/NagDataClass.php:779 -#: functions/NagDataClass.php:785 +#: functions/NagDataClass.php:1158 functions/NagDataClass.php:1163 +#: functions/NagDataClass.php:1170 functions/NagDataClass.php:1190 +#: functions/NagDataClass.php:1196 msgid ", entry " msgstr ", Eintrag " -#: functions/NagDataClass.php:749 functions/NagDataClass.php:761 -#: functions/NagDataClass.php:787 +#: functions/NagDataClass.php:1159 functions/NagDataClass.php:1171 +#: functions/NagDataClass.php:1198 msgid "deletion possible" msgstr "löschen möglich" -#: functions/NagDataClass.php:755 functions/NagDataClass.php:781 +#: functions/NagDataClass.php:1165 functions/NagDataClass.php:1192 msgid "deletion not possible" msgstr "löschen nicht möglich" -#: functions/NagDataClass.php:954 +#: functions/NagDataClass.php:1370 msgid "" "No dataset deactivated. Maybe the dataset does not exist, it is protected " "from deactivation, no dataset was selected or you do not have write " @@ -3133,15 +3178,15 @@ msgstr "" "Schreibrechte fehlen. Benutze die \"info\" Funktion für weitere " "Informationen über Abhängigkeiten!" -#: functions/NagDataClass.php:960 +#: functions/NagDataClass.php:1376 msgid "Dataset successfully deactivated. Affected rows:" msgstr "Datensatz erfolgreich deaktiviert. Betroffene Datensätze:" -#: functions/NagDataClass.php:962 +#: functions/NagDataClass.php:1378 msgid "Deactivate dataset from table:" msgstr "Datensatz deaktiviert aus der Tabelle:" -#: functions/NagDataClass.php:967 +#: functions/NagDataClass.php:1383 msgid "" "No dataset deactivated. Maybe the dataset does not exist or you do not have " "write permission." @@ -3149,7 +3194,7 @@ msgstr "" "Kein Datensatz deaktiviert. Möglicherweise existiert der Datensatz nicht, es " "wurde kein Datensatz ausgewählt oder die Schreibrechte fehlen." -#: functions/NagDataClass.php:1013 +#: functions/NagDataClass.php:1430 msgid "" "No dataset activated. Maybe the dataset does not exist, no dataset was " "selected or you do not have write permission." @@ -3157,15 +3202,15 @@ msgstr "" "Kein Datensatz aktiviert. Möglicherweise existiert der Datensatz nicht, es " "wurde kein Datensatz ausgewählt oder die Schreibrechte fehlen." -#: functions/NagDataClass.php:1017 +#: functions/NagDataClass.php:1434 msgid "Dataset successfully activated. Affected rows:" msgstr "Datensätze erfolgreich aktiviert. Betroffenene Datensätze:" -#: functions/NagDataClass.php:1019 +#: functions/NagDataClass.php:1436 msgid "Activate dataset from table:" msgstr "Datensatz aktiviert aus der Tabelle:" -#: functions/NagDataClass.php:1024 +#: functions/NagDataClass.php:1441 msgid "" "No dataset activated. Maybe the dataset does not exist or you do not have " "write permission." @@ -3173,102 +3218,102 @@ msgstr "" "Kein Datensatz aktiviert. Möglicherweise existiert der Datensatz nicht, es " "wurde kein Datensatz ausgewählt oder die Schreibrechte fehlen." -#: functions/NagImportClass.php:162 +#: functions/NagImportClass.php:158 msgid "No valid configuration found:" msgstr "Keine gültige Konfiguration gefunden:" -#: functions/NagImportClass.php:170 +#: functions/NagImportClass.php:166 msgid "Import file does not exist or is not readable:" msgstr "Importdatei existiert nicht oder ist nicht lesbar:" -#: functions/NagImportClass.php:202 +#: functions/NagImportClass.php:199 msgid "Unable to get configuration data:" msgstr "Konfigurationsdaten nicht gefunden:" -#: functions/NagImportClass.php:229 +#: functions/NagImportClass.php:226 msgid "Cannot receive the configuration file (FTP connection)!" msgstr "" "Kann die Konfigurationsdatei nicht empfangen (Entfernter Zugriff via FTP)" -#: functions/NagImportClass.php:252 +#: functions/NagImportClass.php:249 msgid "Cannot receive the configuration file (SSH connection)!" msgstr "" "Kann die Konfigurationsdatei nicht empfangen (Entfernter Zugriff via SSH/" "SFTP)" -#: functions/NagImportClass.php:351 functions/NagImportClass.php:356 -#: functions/NagImportClass.php:420 functions/NagImportClass.php:426 -#: functions/NagImportClass.php:433 functions/NagImportClass.php:438 +#: functions/NagImportClass.php:355 functions/NagImportClass.php:360 +#: functions/NagImportClass.php:426 functions/NagImportClass.php:432 +#: functions/NagImportClass.php:439 functions/NagImportClass.php:444 msgid "inside" msgstr "innerhalb" -#: functions/NagImportClass.php:352 +#: functions/NagImportClass.php:356 msgid "exists and were not overwritten" msgstr "existiert bereits und wurden nicht überschrieben" -#: functions/NagImportClass.php:357 +#: functions/NagImportClass.php:361 msgid "were not written" msgstr "konnten nicht geschrieben werden" # contacts.php -#: functions/NagImportClass.php:421 functions/NagImportClass.php:427 +#: functions/NagImportClass.php:427 functions/NagImportClass.php:433 msgid "could not be inserted:" msgstr "konnte nicht eingetragen werden:" -#: functions/NagImportClass.php:434 functions/NagImportClass.php:439 +#: functions/NagImportClass.php:440 functions/NagImportClass.php:445 msgid "successfully inserted" msgstr "erfolgreich eingetragen" -#: functions/NagImportClass.php:564 +#: functions/NagImportClass.php:572 msgid "Table for import definition" msgstr "Tabelle für die Importdefinition" # mutdialog.php -#: functions/NagImportClass.php:565 +#: functions/NagImportClass.php:573 msgid "is not available!" msgstr "ist nicht verfügbar!" -#: functions/NagImportClass.php:1640 +#: functions/NagImportClass.php:1678 msgid "" "Error: incorrect number of arguments - cannot import service group members" msgstr "" "Fehler: ungültige Anzahl Argumente - kann die Servicegruppenmitglieder nicht " "importieren" -#: functions/NagImportClass.php:1868 +#: functions/NagImportClass.php:1918 msgid "" "Error: incorrect number of arguments - cannot import service parent members" msgstr "" "Fehler: ungültige Anzahl Argumente - kann die vorgeschalteten Services der " "Servicedefinition nicht importieren" -#: functions/NagImportClass.php:1929 functions/NagImportClass.php:1934 +#: functions/NagImportClass.php:1980 functions/NagImportClass.php:1985 msgid "Error: cannot import the service parent member " msgstr "" "Fehler: kann die vorgeschalteten Services der Servicedefinition nicht " "eintragen " -#: functions/NagImportClass.php:1931 +#: functions/NagImportClass.php:1982 msgid "This combination is not unique!" msgstr "Diese Kombination ist nicht eindeutig!" -#: functions/NagImportClass.php:1936 +#: functions/NagImportClass.php:1987 msgid "This combination is not unique or does not exist!" msgstr "Diese Kombination ist nicht eindeutig oder nicht vorhanden!" -#: functions/NagVisualClass.php:227 +#: functions/NagVisualClass.php:131 msgid "Hide menu" msgstr "Menu ausblenden" -#: functions/NagVisualClass.php:237 +#: functions/NagVisualClass.php:140 msgid "Show menu" msgstr "Menu einblenden" -#: functions/NagVisualClass.php:272 +#: functions/NagVisualClass.php:316 msgid "Page" msgstr "Seite" -#: functions/NagVisualClass.php:805 +#: functions/NagVisualClass.php:524 msgid "Unrestricted access" msgstr "Uneingeschränkter Zugriff" @@ -3280,7 +3325,7 @@ msgstr "" "Fehler bei der Erkennung der richtigen Umgebungsvariable locale. Bitte diese " "Fehlermeldung und die Ausgabe von 'locale -a' an bugs@nagiosql.org schicken" -#: functions/prepend_adm.php:306 +#: functions/prepend_adm.php:305 msgid "Webserver login successfull" msgstr "Webserver-Login erfolgreich" @@ -3296,23 +3341,23 @@ msgstr "Login fehlgeschlagen!" msgid "Session timeout reached - Seconds:" msgstr "Session timeout erreicht - Sekunden:" -#: functions/prepend_adm.php:402 +#: functions/prepend_adm.php:401 msgid "Restricted site accessed:" msgstr "Unerlaubte Seite aufgerufen:" -#: functions/prepend_adm.php:419 +#: functions/prepend_adm.php:418 msgid "User not found in database" msgstr "User in Datenbank nicht gefunden" -#: functions/prepend_adm.php:548 +#: functions/prepend_adm.php:543 msgid "Logged in:" msgstr "Eingeloggt:" -#: functions/prepend_adm.php:550 +#: functions/prepend_adm.php:545 msgid "Logout" msgstr "Abmelden" -#: functions/prepend_adm.php:573 +#: functions/prepend_adm.php:568 msgid "" "Warning - template file not found or not readable, please check your file " "permissions! - File: " @@ -3320,8 +3365,8 @@ msgstr "" "Achtung, das Template konnte nicht gefunden werden oder ist nicht " "schreibbar, bitte überprüfe die Rechte! - Datei: " -#: functions/prepend_content.php:258 functions/prepend_content.php:265 -#: functions/prepend_content.php:288 functions/prepend_content.php:295 +#: functions/prepend_content.php:301 functions/prepend_content.php:308 +#: functions/prepend_content.php:331 functions/prepend_content.php:338 msgid "" "Some configuration files were not written. Dataset not activated, not found " "or you do not have write permission!" @@ -3330,71 +3375,71 @@ msgstr "" "existierender bzw. kein aktiver Datensatz gefunden oder die Schreibrechte " "fehlen!" -#: functions/prepend_content.php:262 functions/prepend_content.php:292 +#: functions/prepend_content.php:305 functions/prepend_content.php:335 msgid "Configuration files successfully written!" msgstr "Konfigurationsdateien erfolgreich geschrieben!" -#: functions/prepend_content.php:321 +#: functions/prepend_content.php:364 msgid "Admin cannot be deleted" msgstr "Der Benutzer Admin kann nicht gelöscht werden" -#: functions/prepend_content.php:325 +#: functions/prepend_content.php:368 msgid "Localhost can't be deleted" msgstr "Localhost kann nicht gelöscht werden" -#: functions/prepend_content.php:502 +#: functions/prepend_content.php:548 msgid "No permission to open configuration!" msgstr "Nicht genügend Rechte um die Konfiguration zu öffnen!" -#: functions/translator.php:63 install/functions/NagInstallClass.php:99 +#: functions/translator.php:56 install/functions/NagInstallClass.php:111 msgid "English" msgstr "Englisch" -#: functions/translator.php:67 install/functions/NagInstallClass.php:103 +#: functions/translator.php:60 install/functions/NagInstallClass.php:115 msgid "German" msgstr "Deutsch" -#: functions/translator.php:71 install/functions/NagInstallClass.php:107 +#: functions/translator.php:64 install/functions/NagInstallClass.php:119 msgid "Chinese (Simplified)" msgstr "Chinese (Simplified)" -#: functions/translator.php:75 install/functions/NagInstallClass.php:111 +#: functions/translator.php:68 install/functions/NagInstallClass.php:123 msgid "Italian" msgstr "Italienisch" -#: functions/translator.php:79 install/functions/NagInstallClass.php:115 +#: functions/translator.php:72 install/functions/NagInstallClass.php:127 msgid "French" msgstr "Französisch" -#: functions/translator.php:83 install/functions/NagInstallClass.php:119 +#: functions/translator.php:76 install/functions/NagInstallClass.php:131 msgid "Russian" msgstr "Russisch" -#: functions/translator.php:87 install/functions/NagInstallClass.php:123 +#: functions/translator.php:80 install/functions/NagInstallClass.php:135 msgid "Spanish" msgstr "Spanisch" -#: functions/translator.php:91 install/functions/NagInstallClass.php:127 +#: functions/translator.php:84 install/functions/NagInstallClass.php:139 msgid "Portuguese (Brazilian)" msgstr "Portugiesisch (Brasilianisch)" -#: functions/translator.php:95 install/functions/NagInstallClass.php:131 +#: functions/translator.php:88 install/functions/NagInstallClass.php:143 msgid "Dutch" msgstr "Niederländisch" -#: functions/translator.php:99 install/functions/NagInstallClass.php:135 +#: functions/translator.php:92 install/functions/NagInstallClass.php:147 msgid "Danish" msgstr "Dänisch" -#: index.php:47 +#: index.php:49 msgid "Welcome to" msgstr "Willkommen bei" -#: index.php:48 +#: index.php:50 msgid "Welcome" msgstr "Willkommen" -#: index.php:49 +#: index.php:51 msgid "" "Please enter your username and password to access NagiosQL.
If you forgot " "one of them, please contact your Administrator." @@ -3403,42 +3448,42 @@ msgstr "" "Zugriff ein.
Sollten Sie keinen Zugang besitzen oder Ihr Passwort " "vergessen haben, so wenden Sie sich an einen Administrator." -#: index.php:53 +#: index.php:55 msgid "Login" msgstr "Login" -#: install/functions/NagInstallClass.php:75 +#: install/functions/NagInstallClass.php:67 msgid "Template file not found" msgstr "Vorlagenndatei nicht gefunden" -#: install/functions/NagInstallClass.php:336 -#: install/functions/NagInstallClass.php:368 +#: install/functions/NagInstallClass.php:182 +#: install/functions/NagInstallClass.php:214 msgid "passed" msgstr "funktioniert" # prepend.adm -#: install/functions/NagInstallClass.php:358 +#: install/functions/NagInstallClass.php:204 msgid "Error while connecting to database:" msgstr "Fehler beim Verbinden mit der Datenbank:" -#: install/functions/NagInstallClass.php:399 -#: install/functions/NagInstallClass.php:474 +#: install/functions/NagInstallClass.php:245 +#: install/functions/NagInstallClass.php:318 msgid "supported" msgstr "unterstützt" -#: install/functions/NagInstallClass.php:401 +#: install/functions/NagInstallClass.php:247 msgid "not supported" msgstr "nicht unterstützt" -#: install/functions/NagInstallClass.php:477 +#: install/functions/NagInstallClass.php:321 msgid "" "Your NagiosQL installation is up to date - no further actions are needed!" msgstr "" "Ihre NagiosQL Installation ist aktuell - es sind keine weiteren Schritte " "notwendig!" -#: install/functions/NagInstallClass.php:483 -#: install/functions/NagInstallClass.php:491 +#: install/functions/NagInstallClass.php:327 +#: install/functions/NagInstallClass.php:335 msgid "" "Updates to NagiosQL 3.2 and above are only supported from NagiosQL 3.0.0 and " "above!" @@ -3447,98 +3492,98 @@ msgstr "" "3.0 unterstützt!" # prepend.adm -#: install/functions/NagInstallClass.php:489 +#: install/functions/NagInstallClass.php:333 msgid "Error while selecting settings table." msgstr "Fehler bei Abrufen der Einstellungstabelle." -#: install/functions/NagInstallClass.php:511 -#: install/functions/NagInstallClass.php:547 -#: install/functions/NagInstallClass.php:610 -#: install/functions/NagInstallClass.php:614 -#: install/functions/NagInstallClass.php:655 -#: install/functions/NagInstallClass.php:736 -#: install/functions/NagInstallClass.php:819 -#: install/functions/NagInstallClass.php:870 -#: install/functions/NagInstallClass.php:935 -#: install/functions/NagInstallClass.php:945 -#: install/functions/NagInstallClass.php:967 -#: install/functions/NagInstallClass.php:1015 -#: install/functions/NagInstallClass.php:1067 +#: install/functions/NagInstallClass.php:355 +#: install/functions/NagInstallClass.php:391 +#: install/functions/NagInstallClass.php:454 +#: install/functions/NagInstallClass.php:458 +#: install/functions/NagInstallClass.php:500 +#: install/functions/NagInstallClass.php:580 +#: install/functions/NagInstallClass.php:660 +#: install/functions/NagInstallClass.php:712 +#: install/functions/NagInstallClass.php:777 +#: install/functions/NagInstallClass.php:787 +#: install/functions/NagInstallClass.php:809 +#: install/functions/NagInstallClass.php:858 +#: install/functions/NagInstallClass.php:910 msgid "done" msgstr "erledigt" -#: install/functions/NagInstallClass.php:538 +#: install/functions/NagInstallClass.php:382 msgid "Unsupported database type." msgstr "Nicht unterstützter Datenbanktyp." -#: install/functions/NagInstallClass.php:611 +#: install/functions/NagInstallClass.php:455 msgid "Only added rights to existing user" msgstr "Nur Rechte zum bestehenden Benutzer hinzugefügt" # mutdialog.php -#: install/functions/NagInstallClass.php:641 +#: install/functions/NagInstallClass.php:486 msgid "No SQL update files available" msgstr "Keine SQL Updatedateien verfügbar" -#: install/functions/NagInstallClass.php:650 -#: install/functions/NagInstallClass.php:707 +#: install/functions/NagInstallClass.php:495 +#: install/functions/NagInstallClass.php:552 msgid "SQL file is not readable or empty" msgstr "SQL Datei nicht lesbar oder leer" -#: install/functions/NagInstallClass.php:778 -#: install/functions/NagInstallClass.php:785 -#: install/functions/NagInstallClass.php:813 +#: install/functions/NagInstallClass.php:619 +#: install/functions/NagInstallClass.php:626 +#: install/functions/NagInstallClass.php:653 msgid "Inserting initial data to settings database has failed:" msgstr "" "Das Einfügen der Vorgabewerte in die Einstellungstabelle ist fehlgeschlagen:" -#: install/functions/NagInstallClass.php:873 -msgid "Connot open/write to config/settings.php" +#: install/functions/NagInstallClass.php:715 +msgid "Cannot open/write to config/settings.php" msgstr "" "Kann die Konfigurationsdatei nicht öffnen/beschreiben (config/settings.php)" -#: install/functions/NagInstallClass.php:905 +#: install/functions/NagInstallClass.php:747 msgid "Inserting path data to database has failed:" msgstr "Das Einfügen der Verzeichnisdaten in die Datenbank ist fehlgeschlagen:" -#: install/functions/NagInstallClass.php:936 +#: install/functions/NagInstallClass.php:778 msgid "Check the permissions of the created paths!" msgstr "Überprüfen Sie die Rechte der Verzeichnisse!" -#: install/functions/NagInstallClass.php:939 +#: install/functions/NagInstallClass.php:781 msgid "NagiosQL config path is not writeable - only database values updated" msgstr "" "NagiosQL Konfigurationsverzeichnis ist nicht beschreibbar - es wurden nur " "die Datenbankwerte eingetragen" # prepend.adm -#: install/functions/NagInstallClass.php:969 -#: install/functions/NagInstallClass.php:1017 -#: install/functions/NagInstallClass.php:1069 +#: install/functions/NagInstallClass.php:811 +#: install/functions/NagInstallClass.php:860 +#: install/functions/NagInstallClass.php:912 msgid "Database errors while converting to utf-8:" msgstr "Datenbankfehler während dem Konvertieren nach UTF-8:" -#: install/functions/NagInstallClass.php:1008 -#: install/functions/NagInstallClass.php:1060 install/step3.php:88 -#: install/step3.php:177 +#: install/functions/NagInstallClass.php:851 +#: install/functions/NagInstallClass.php:903 install/step3.php:96 +#: install/step3.php:185 msgid "Database type not defined!" msgstr "Datenbanktyp nicht definiert!" -#: install/index.php:69 +#: install/index.php:74 msgid "Online Documentation" msgstr "Online Handbuch" -#: install/index.php:115 +#: install/index.php:119 msgid "Database connection failed. Upgrade not available!" msgstr "Datenbankverbindung fehlgeschlagen. Upgrade ist nicht verfügbar!" -#: install/index.php:122 +#: install/index.php:126 msgid "Settings table not available or wrong. Upgrade not available!" msgstr "" "Einstellungstabelle nicht vorhanden oder fehlerhaft. Das Upgrade ist nicht " "verfügbar!" -#: install/index.php:133 +#: install/index.php:137 msgid "" "Invalid database type in settings file (config/settings.php). Upgrade not " "available!" @@ -3546,7 +3591,7 @@ msgstr "" "Datenbanktyp in der Konfigurationsdatei ist ungültig (config/settings.php). " "Upgrade nicht verfügbar!" -#: install/index.php:137 +#: install/index.php:141 msgid "" "Database values in settings file are missing (config/settings.php). Upgrade " "not available!" @@ -3554,7 +3599,7 @@ msgstr "" "Datenbankeinstellungen in der Konfigurationsdatei nicht gefunden (config/" "settings.php). Upgrade nicht verfügbar!" -#: install/index.php:141 +#: install/index.php:145 msgid "" "Settings file not found or not readable (config/settings.php). Upgrade not " "available!" @@ -3562,7 +3607,7 @@ msgstr "" "Konfigurationsdatei nicht gefunden oder nicht lesbar (config/settings.php). " "Upgrade ist nicht verfügbar!" -#: install/index.php:152 +#: install/index.php:156 msgid "" "Default values file is not available or not readable (install/functions/" "initial_settings.php). Installation possible, but without predefined data!" @@ -3571,24 +3616,24 @@ msgstr "" "gelesen werden (install/functions/initial_settings.php). Die Installation " "ist möglich, aber ohne Standardwertvorgaben!" -#: install/index.php:159 +#: install/index.php:162 msgid "Installation wizard" msgstr "Installationsassistent" -#: install/index.php:160 +#: install/index.php:163 msgid "Welcome to the NagiosQL installation wizard" msgstr "Willkommen zum NagiosQL Installations Assistenten" -#: install/index.php:161 +#: install/index.php:164 msgid "This wizard will help you to install and configure NagiosQL." msgstr "" "Dieser Assistent hilft Ihnen NagiosQL zu installieren und zu konfigurieren." -#: install/index.php:163 +#: install/index.php:165 msgid "For questions please visit" msgstr "Für Rückfragen besuchen Sie bitte" -#: install/index.php:164 +#: install/index.php:166 msgid "" "First let's check your local environment and find out if everything NagiosQL " "needs is available." @@ -3596,122 +3641,126 @@ msgstr "" "Zuerst prüfen wir die lokale Umgebung und schauen ob NagiosQL alles findet " "was es benötigt." -#: install/index.php:166 +#: install/index.php:167 msgid "The basic requirements are:" msgstr "Die wichtigsten Voraussetzungen sind:" -#: install/index.php:167 -msgid "PHP 5.5.0 or greater including:" -msgstr "PHP 5.5.0 oder größer, inklusive:" - #: install/index.php:168 +msgid "PHP 7.2.0 or above (PHP 8 is recommended) including:" +msgstr "PHP 7.2.0 oder höher (PHP8 ist empfohlen) - inklusive:" + +#: install/index.php:169 msgid "PHP database module:" msgstr "PHP Datenbank Modul:" -#: install/index.php:169 +#: install/index.php:170 msgid "supported types are" msgstr "unterstützte Typen sind" -#: install/index.php:174 install/index.php:176 +#: install/index.php:175 install/index.php:177 msgid "(optional)" msgstr "(optional)" -#: install/index.php:175 +#: install/index.php:176 msgid "PECL extension:" msgstr "PECL Erweiterung:" -#: install/index.php:177 +#: install/index.php:178 msgid "php.ini options" msgstr "php.ini Einstellungen" -#: install/index.php:178 +#: install/index.php:179 msgid "file_uploads on (for upload features)" msgstr "file_uploads on (für Upload Unterstützung)" -#: install/index.php:179 +#: install/index.php:180 msgid "session.auto_start needs to be off" msgstr "session.auto_start sollte auf \"off\" stehen" -#: install/index.php:180 +#: install/index.php:181 +msgid "date.timezone should be set to your local timezone" +msgstr "date.timezone sollte passend zur lokalen Zeitzone eingestellt sein" + +#: install/index.php:182 msgid "A database server" msgstr "Ein Datenbankserver" -#: install/index.php:181 +#: install/index.php:183 msgid "Nagios 2.x/3.x/4.x" msgstr "Nagios 2.x/3.x/4.x" -#: install/index.php:182 +#: install/index.php:184 msgid "NagiosQL version" msgstr "NagiosQL Version" -#: install/index.php:184 +#: install/index.php:186 msgid "Online documentation" msgstr "Online Handbuch" -#: install/index.php:188 +#: install/index.php:190 msgid "START INSTALLATION" msgstr "STARTE NEUINSTALLTION" -#: install/index.php:189 +#: install/index.php:191 msgid "START UPDATE" msgstr "STARTE AKTUALISIERUNG" -#: install/install.php:214 +#: install/install.php:196 msgid "Welcome to the NagiosQL Installation Wizard" msgstr "Willkommen zum NagiosQL Installations Assistenten" -#: install/step1.php:74 install/step2.php:34 install/step3.php:38 +#: install/step1.php:79 install/step2.php:39 install/step3.php:47 msgid "Requirements" msgstr "Voraussetzungen" -#: install/step1.php:75 install/step1.php:77 install/step2.php:35 -#: install/step2.php:37 install/step3.php:39 install/step3.php:41 +#: install/step1.php:80 install/step1.php:82 install/step2.php:40 +#: install/step2.php:42 install/step3.php:48 install/step3.php:50 msgid "Installation" msgstr "Installation" -#: install/step1.php:76 install/step2.php:36 install/step3.php:40 -#: install/step3.php:301 +#: install/step1.php:81 install/step2.php:41 install/step3.php:49 +#: install/step3.php:308 msgid "Finish" msgstr "Ende" -#: install/step1.php:78 +#: install/step1.php:83 msgid "Checking requirements" msgstr "Überprüfe Voraussetzungen" -#: install/step1.php:79 +#: install/step1.php:84 msgid "Checking Client" msgstr "Überprüfe Client" -#: install/step1.php:80 +#: install/step1.php:85 msgid "Checking PHP version" msgstr "Überprüfe PHP Version" -#: install/step1.php:81 +#: install/step1.php:86 msgid "Checking PHP extensions" msgstr "Überprüfe die PHP Erweiterungen" -#: install/step1.php:82 +#: install/step1.php:87 msgid "Checking available database interfaces" msgstr "Überprüfe vorhandene Datenbankschnittstellen" -#: install/step1.php:83 +#: install/step1.php:88 msgid "Checking php.ini/.htaccess settings" msgstr "Überprüfe php.ini/.htaccess Einstellungen" -#: install/step1.php:84 +#: install/step1.php:89 msgid "Checking System Permission" msgstr "Überprüfe Systemberechtigungen" -#: install/step1.php:85 +#: install/step1.php:90 msgid "The following modules/extensions are required to run NagiosQL" msgstr "" "Die folgenden Module/Erweiterungen sind notwendig für NagiosQL" -#: install/step1.php:87 +#: install/step1.php:91 msgid "The next couple of extensions are optional but recommended" msgstr "Die nächsten Erweiterungen sind optional aber empfohlen" -#: install/step1.php:89 +#: install/step1.php:92 msgid "" "Check which of the supported extensions are installed. At least one of them " "is required." @@ -3719,19 +3768,19 @@ msgstr "" "Überprüfe welche der unterstützten Erweiterungen installiert sind. " "Wenigstens eine ist notwendig." -#: install/step1.php:91 +#: install/step1.php:93 msgid "The following settings are required to run NagiosQL" msgstr "Die folgenden Einstellungen sind notwendig für NagiosQL" -#: install/step1.php:109 +#: install/step1.php:110 msgid "ENABLED" msgstr "AKTIVIERT" -#: install/step1.php:114 +#: install/step1.php:115 msgid "NOT ENABLED" msgstr "NICHT EINGESCHALTET" -#: install/step1.php:115 +#: install/step1.php:116 msgid "" "After enabling Javascript, the page must be updated twice so that the status " "changes" @@ -3739,36 +3788,37 @@ msgstr "" "Nach dem einschalten von JavaScript muss die Seite zweimal neu geladen " "werden sodass die Statusänderung" -#: install/step1.php:120 +#: install/step1.php:121 msgid "Version" msgstr "Version" -#: install/step1.php:124 install/step1.php:140 install/step1.php:155 -#: install/step1.php:180 install/step1.php:208 install/step1.php:212 -#: install/step1.php:226 install/step1.php:236 install/step1.php:239 -#: install/step1.php:252 install/step1.php:261 install/step1.php:270 -#: install/step1.php:279 install/step1.php:288 install/step1.php:297 +#: install/step1.php:125 install/step1.php:149 install/step1.php:159 +#: install/step1.php:174 install/step1.php:199 install/step1.php:227 +#: install/step1.php:230 install/step1.php:243 install/step1.php:253 +#: install/step1.php:256 install/step1.php:269 install/step1.php:278 +#: install/step1.php:287 install/step1.php:296 install/step1.php:305 +#: install/step1.php:314 msgid "OK" msgstr "OK" -#: install/step1.php:125 install/step1.php:129 +#: install/step1.php:126 install/step1.php:130 msgid "detected" msgstr "erkannt" -#: install/step1.php:130 +#: install/step1.php:131 msgid "or greater is required" msgstr "oder größer ist notwendig" -#: install/step1.php:143 install/step1.php:158 install/step1.php:187 -msgid "Could be loaded. Please add in php.ini" -msgstr "Kann geladen werden. Bitte zur php.ini hinzufügen" - -#: install/step1.php:145 install/step1.php:160 install/step1.php:189 -#: install/step1.php:204 +#: install/step1.php:152 install/step1.php:164 install/step1.php:179 +#: install/step1.php:208 install/step1.php:223 msgid "NOT AVAILABLE" msgstr "NICHT VERFÜGBAR" -#: install/step1.php:177 +#: install/step1.php:162 install/step1.php:177 install/step1.php:206 +msgid "Could be loaded. Please add in php.ini" +msgstr "Kann geladen werden. Bitte zur php.ini hinzufügen" + +#: install/step1.php:196 msgid "" "New installation only - updates are only supported using the same database " "interface!" @@ -3776,59 +3826,59 @@ msgstr "" "Nur Neuinstallation möglich - Upgrades werden nur bei gleichbleibendem " "Datenbankinterface unterstützt!" -#: install/step1.php:205 +#: install/step1.php:224 msgid "cannot be empty and needs to be set" msgstr "Kann nicht leer sein und muss gesetzt werden" -#: install/step1.php:214 +#: install/step1.php:232 msgid "should be" msgstr "Sollte auf" -#: install/step1.php:225 install/step1.php:228 +#: install/step1.php:242 install/step1.php:245 msgid "Read test on settings file (config/settings.php)" msgstr "Lesezugriff auf die Konfigurationsdatei (config/settings.php)" -#: install/step1.php:231 +#: install/step1.php:248 msgid "Settings file does not exists (config/settings.php)" msgstr "Konfigurationsdatei existiert nicht (config/settings.php)" -#: install/step1.php:232 +#: install/step1.php:249 msgid "will be created" msgstr "wird später erstellt" -#: install/step1.php:235 install/step1.php:241 +#: install/step1.php:252 install/step1.php:258 msgid "Write test on settings file (config/settings.php)" msgstr "Schreibzugriff auf die Konfigurationsdatei (config/settings.php)" -#: install/step1.php:238 install/step1.php:245 +#: install/step1.php:255 install/step1.php:262 msgid "Write test on settings directory (config/)" msgstr "Schreibzugriff auf das Konfigurationsverzeichnis (config/)" -#: install/step1.php:251 install/step1.php:254 +#: install/step1.php:268 install/step1.php:271 msgid "Read test on one class file (functions/NagVisualClass.php)" msgstr "Lesezugriff auf eine Klassendatei (functions/NagVisualClass.php)" -#: install/step1.php:260 install/step1.php:263 +#: install/step1.php:277 install/step1.php:280 msgid "Read test on home page file (admin.php)" msgstr "Lesezugriff auf die Startseite (admin.php)" -#: install/step1.php:269 install/step1.php:272 +#: install/step1.php:286 install/step1.php:289 msgid "Read test on one template file (templates/index.tpl.htm)" msgstr "Lesezugriff auf eine Template Datei (templates/index.tpl.htm)" -#: install/step1.php:278 install/step1.php:281 +#: install/step1.php:295 install/step1.php:298 msgid "Read test on one admin template file (templates/admin/datalist.htm.tpl)" msgstr "Lesezugriff auf ein Admin-Template (templates/admin/datalist.htm.tpl)" -#: install/step1.php:287 install/step1.php:290 +#: install/step1.php:304 install/step1.php:307 msgid "Read test on one file template (templates/files/contacts.tpl.dat)" msgstr "Lesezugriff auf ein File-Template (templates/files/contacts.tpl.da)" -#: install/step1.php:296 install/step1.php:299 +#: install/step1.php:313 install/step1.php:316 msgid "Read test on one image file (images/pixel.gif)" msgstr "Lesezugriff auf ein Bild (images/pixel.gif)" -#: install/step1.php:304 +#: install/step1.php:321 msgid "" "There are some errors - please check your system settings and read the " "requirements of NagiosQL!" @@ -3836,7 +3886,7 @@ msgstr "" "Es sind Fehler aufgetreten. Bitte überprüfen Sie die Einstellungen und lesen " "Sie die Dokumentation über die Systemanforderungen!" -#: install/step1.php:306 +#: install/step1.php:323 msgid "" "Read the INSTALLATION file in the NagiosQL doc directory or the installation " "PDF file on our" @@ -3844,125 +3894,125 @@ msgstr "" "Lesen sie die INSTALLATION Datei im Nagiosql doc Verzeichnis oder die " "Installation PDF Datei von unserer" -#: install/step1.php:310 +#: install/step1.php:327 msgid "online documentation" msgstr "Online Handbuch" -#: install/step1.php:311 +#: install/step1.php:328 msgid "site to find out, how to fix them." msgstr "Webseite um herauszufinden, wie dies zu beheben ist." -#: install/step1.php:312 +#: install/step1.php:329 msgid "After that - refresh this page to proceed" msgstr "Nach Änderungen aktualisieren Sie bitte diese Seite um fortzufahren" -#: install/step1.php:316 +#: install/step1.php:333 msgid "Refresh" msgstr "Aktualisieren" -#: install/step1.php:318 +#: install/step1.php:335 msgid "Environment test completed successfully" msgstr "Umgebungstest erfolgreich abgeschlossen" -#: install/step1.php:323 install/step2.php:94 +#: install/step1.php:340 install/step2.php:99 msgid "Next" msgstr "Weiter" -#: install/step2.php:32 +#: install/step2.php:37 msgid "The NagiosQL first passwords are not equal!" msgstr "Die NagiosQL Administrationspasswörter sind nicht gleich!" -#: install/step2.php:38 +#: install/step2.php:43 msgid "Setup" msgstr "Einrichtung" -#: install/step2.php:39 +#: install/step2.php:44 msgid "Please complete the form below. Mandatory fields marked *" msgstr "" "Bitte vervollständigen Sie das u.a. Formular. Pflichtfelder sind mit einem " "* markiert" -#: install/step2.php:41 +#: install/step2.php:46 msgid "Database Configuration" msgstr "Datenbank Konfiguration" -#: install/step2.php:42 +#: install/step2.php:47 msgid "Database Type" msgstr "Datenbanktyp" -#: install/step2.php:56 +#: install/step2.php:61 msgid "Database Server" msgstr "Datenbankserver" -#: install/step2.php:58 +#: install/step2.php:63 msgid "Local hostname or IP address" msgstr "Lokaler Hostname oder IP-Adresse" -#: install/step2.php:64 +#: install/step2.php:69 msgid "Database Server Port" msgstr "Datenbankserver Port" -#: install/step2.php:68 +#: install/step2.php:73 msgid "NagiosQL DB User" msgstr "NagiosQL Datenbank Benutzer" -#: install/step2.php:70 +#: install/step2.php:75 msgid "NagiosQL DB Password" msgstr "NagiosQL Datenbank Passwort" -#: install/step2.php:72 +#: install/step2.php:77 msgid "Administrative Database User" msgstr "Administrativer Datenbankbenutzer" -#: install/step2.php:74 +#: install/step2.php:79 msgid "Administrative Database Password" msgstr "Administratives Datenbankpasswort" -#: install/step2.php:75 +#: install/step2.php:80 msgid "Drop database if already exists?" msgstr "Lösche Datenbank, sofern sie bereits existiert?" -#: install/step2.php:81 +#: install/step2.php:86 msgid "NagiosQL User Setup" msgstr "NagiosQL Benutzer Einrichtung" -#: install/step2.php:82 +#: install/step2.php:87 msgid "Initial NagiosQL User" msgstr "Erster NagiosQL Benutzer" -#: install/step2.php:84 +#: install/step2.php:89 msgid "Initial NagiosQL Password" msgstr "Erstes NagiosQL Passwort" -#: install/step2.php:86 +#: install/step2.php:91 msgid "Please repeat the password" msgstr "Bitte Passwort wiederholen" -#: install/step2.php:87 +#: install/step2.php:92 msgid "Nagios Configuration" msgstr "Nagios Konfiguration" -#: install/step2.php:88 +#: install/step2.php:93 msgid "Import Nagios sample config?" msgstr "Importiere Nagios Beispiel Konfiguration?" -#: install/step2.php:95 +#: install/step2.php:100 msgid "NagiosQL path values" msgstr "NagiosQL Verzeichnisdaten" -#: install/step2.php:96 +#: install/step2.php:101 msgid "Create NagiosQL config paths?" msgstr "Erstelle NagiosQL Verzeichnisse?" -#: install/step2.php:102 +#: install/step2.php:107 msgid "NagiosQL config path" msgstr "NagiosQL Konfigurationsverzeichnis" -#: install/step2.php:104 +#: install/step2.php:109 msgid "Nagios config path" msgstr "Nagios Konfigurationsverzeichnis" -#: install/step2.php:106 +#: install/step2.php:111 msgid "" "Both path values were stored in your configuration target settings for " "localhost." @@ -3970,7 +4020,7 @@ msgstr "" "Beide Verzeichnisdefinitionen werden in der Datenbank beim " "Konfigurationsziel \"localhost\" eingetragen." -#: install/step2.php:108 +#: install/step2.php:113 msgid "" "If you select the create path option, be sure that the NagiosQL base path " "exist and the webserver demon has write access to it. So the installer will " @@ -3983,103 +4033,103 @@ msgstr "" "benötigten Unterverzeichnisse im Dateisystem von \"localhost\" erstellen " "(hosts, services, backup etc.)" -#: install/step2.php:120 +#: install/step2.php:125 msgid "Please backup your database before proceeding!" msgstr "Bitte sichern Sie Ihre Datenbank bevor Sie fortfahren!" -#: install/step3.php:42 +#: install/step3.php:51 msgid "Finishing Setup" msgstr "Fertigstellen" -#: install/step3.php:44 +#: install/step3.php:53 msgid "Deploy NagiosQL settings" msgstr "Setze NagiosQL Einstellungen" -#: install/step3.php:45 +#: install/step3.php:54 msgid "Database server connection (privileged user)" msgstr "Datenbankserver Verbindung (privilegierter Benutzer)" -#: install/step3.php:46 +#: install/step3.php:55 msgid "Database server version" msgstr "Datenbankserver Version" -#: install/step3.php:47 +#: install/step3.php:56 msgid "Database server support" msgstr "Datenbankserver Unterstützung" -#: install/step3.php:48 +#: install/step3.php:57 msgid "Delete existing NagiosQL database" msgstr "Bestehende NagiosQL 3 Datenbank löschen" -#: install/step3.php:49 +#: install/step3.php:58 msgid "Creating new database" msgstr "Erstelle neue Datenbank" -#: install/step3.php:50 +#: install/step3.php:59 msgid "Installing NagiosQL database tables" msgstr "Installiere NagiosQL Datenbanktabellen" -#: install/step3.php:51 +#: install/step3.php:60 msgid "Create NagiosQL database user" msgstr "Erstelle NagiosQL Datenbankbenutzer" -#: install/step3.php:52 +#: install/step3.php:61 msgid "Set initial NagiosQL Administrator" msgstr "Setze den NagiosQL Administrator" -#: install/step3.php:53 +#: install/step3.php:62 msgid "Database server connection (NagiosQL user)" msgstr "Datenbankserver Verbindung (NagiosQL Benutzer)" -#: install/step3.php:54 +#: install/step3.php:63 msgid "Writing global settings to database" msgstr "Schreiben der Einstellungen in die Datenbank" -#: install/step3.php:55 +#: install/step3.php:64 msgid "Writing database configuration to settings.php" msgstr "Schreibe Datenbank Konfiguration in settings.php" -#: install/step3.php:56 +#: install/step3.php:65 msgid "Import Nagios sample data" msgstr "Import Nagios Beispiel Daten" -#: install/step3.php:57 +#: install/step3.php:66 msgid "Create and/or store NagiosQL path settings" msgstr "Erstelle und/oder speichere NagiosQL Verzeichnisse" -#: install/step3.php:80 +#: install/step3.php:88 msgid "Updating existing NagiosQL database" msgstr "Aktualisiere bestehende NagiosQL Datenbank" -#: install/step3.php:113 +#: install/step3.php:121 msgid "Installed NagiosQL version" msgstr "Installierte NagiosQL Version" -#: install/step3.php:124 +#: install/step3.php:132 msgid "Upgrading from version" msgstr "Aktualisiere von Version" -#: install/step3.php:125 +#: install/step3.php:133 msgid "to" msgstr "nach" -#: install/step3.php:132 +#: install/step3.php:140 msgid "Converting database to utf8 character set" msgstr "Konvertiere Datenbank zu UTF8" -#: install/step3.php:138 +#: install/step3.php:146 msgid "Converting database tables to utf8 character set" msgstr "Konvertiere Datenbanktabellen zu UTF8" -#: install/step3.php:145 +#: install/step3.php:153 msgid "Converting database fields to utf8 character set" msgstr "Konvertiere Datenbankfelder zu UTF8" -#: install/step3.php:169 +#: install/step3.php:177 msgid "Create new NagiosQL database" msgstr "Erstelle NagiosQL MySQL Benutzer" -#: install/step3.php:202 +#: install/step3.php:210 msgid "" "Database already exists and drop database was not selected, please correct " "or manage manually" @@ -4087,18 +4137,26 @@ msgstr "" "Die Datenbank existiert bereits und das Löschen der Datenbank wurde nicht " "ausgewählt. Bitte beheben Sie das Problem" -#: install/step3.php:218 +#: install/step3.php:226 msgid "unknown" msgstr "unbekannt" -#: install/step3.php:293 +#: install/step3.php:301 msgid "Back" msgstr "Zurück" -#: install/step3.php:298 +#: install/step3.php:305 msgid "Please delete the install directory to continue!" msgstr "Bitte löschen Sie den Installationsordner bevor Sie fortfahren!" +#~ msgid "Restart failed - Nagios daemon was not running" +#~ msgstr "Neustart fehlgeschlagen - Der Nagios Dienst lief nicht" + +#~ msgid "Nagios daemon is not running, cannot send restart command!" +#~ msgstr "" +#~ "Der Nagios Dienst läuft nicht, die Aufforderung zum Neustart konnte nicht " +#~ "gesendet werden!" + #~ msgid "Cgi config file" #~ msgstr "CGI Konfigurationsdatei" @@ -4235,9 +4293,6 @@ msgstr "Bitte löschen Sie den Installationsordner bevor Sie fortfahren!" #~ "Konfigurationsdatei konnte nicht geschrieben werden (FTP Verbindung " #~ "fehlgeschlagen)" -#~ msgid "Missing MySQL SSL parameter!" -#~ msgstr "Fehlende SSL Parameter für die Serververbindung!" - #~ msgid "" #~ "Installation cannot continue, please make sure you have the mysql " #~ "extension loaded!" diff --git a/config/locale/en_GB/LC_MESSAGES/en_GB.mo b/config/locale/en_GB/LC_MESSAGES/en_GB.mo index 4c182a7..85d8bf6 100644 Binary files a/config/locale/en_GB/LC_MESSAGES/en_GB.mo and b/config/locale/en_GB/LC_MESSAGES/en_GB.mo differ diff --git a/config/locale/en_GB/LC_MESSAGES/en_GB.po b/config/locale/en_GB/LC_MESSAGES/en_GB.po index 5fa21cb..bfbd78d 100644 --- a/config/locale/en_GB/LC_MESSAGES/en_GB.po +++ b/config/locale/en_GB/LC_MESSAGES/en_GB.po @@ -3,16 +3,16 @@ # # Project : NagiosQL # # Component : Translation File English # # Website : https://sourceforge.net/projects/nagiosql/ -# # Version : 3.4.0 +# # Version : 3.5.0 # # GIT Repo : https://gitlab.com/wizonet/NagiosQL # # # ############################################################################# msgid "" msgstr "" -"Project-Id-Version: NagiosQL 3.4.0\n" +"Project-Id-Version: NagiosQL 3.5.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-05-07 15:58+0200\n" -"PO-Revision-Date: 2018-05-07 15:59+0200\n" +"POT-Creation-Date: 2023-01-20 15:07+0100\n" +"PO-Revision-Date: 2023-01-20 15:09+0100\n" "Last-Translator: \n" "Language-Team: NagiosQL\n" "Language: en_GB\n" @@ -20,7 +20,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 2.0.6\n" +"X-Generator: Poedit 3.2.2\n" "X-Poedit-SourceCharset: UTF-8\n" "X-Poedit-Basepath: ../../../..\n" "X-Poedit-KeywordsList: translate\n" @@ -29,11 +29,11 @@ msgstr "" "X-Poedit-SearchPathExcluded-1: functions/tinyMCE\n" "X-Poedit-SearchPathExcluded-2: _archive\n" -#: admin.php:37 +#: admin.php:40 msgid "NagiosQL Administration" msgstr "NagiosQL Administration" -#: admin.php:40 +#: admin.php:43 msgid "" "Welcome to NagiosQL, the administration module that can be used to easily " "create, modify and delete configuration files for Nagios. The data is stored " @@ -45,22 +45,22 @@ msgstr "" "in a database and can be written directly to the standard files at any time " "you want." -#: admin/administration.php:35 config/fieldvars.php:298 -#: functions/prepend_adm.php:460 functions/prepend_adm.php:469 +#: admin/administration.php:37 config/fieldvars.php:302 +#: functions/prepend_adm.php:459 functions/prepend_adm.php:466 msgid "Administration" msgstr "Administration" # administration.php -#: admin/administration.php:38 +#: admin/administration.php:40 msgid "Functions to administrate NagiosQL V3" msgstr "Functions to administrate NagiosQL V3" -#: admin/alarming.php:35 config/fieldvars.php:293 config/fieldvars.php:294 +#: admin/alarming.php:44 config/fieldvars.php:297 config/fieldvars.php:298 msgid "Alarming" msgstr "Alerting" # alarming.php -#: admin/alarming.php:36 +#: admin/alarming.php:45 msgid "" "To define contact data, contact templates and contact groups and time " "periods." @@ -68,63 +68,63 @@ msgstr "" "To define contact data, contact templates and contact groups and time " "periods." -#: admin/alarming.php:38 admin/commands.php:38 admin/monitoring.php:40 -#: admin/specials.php:40 +#: admin/alarming.php:47 admin/commands.php:47 admin/monitoring.php:49 +#: admin/specials.php:49 msgid "Statistical datas" msgstr "Statistical data" -#: admin/alarming.php:39 admin/commands.php:39 admin/monitoring.php:41 -#: admin/specials.php:41 +#: admin/alarming.php:48 admin/commands.php:48 admin/monitoring.php:50 +#: admin/specials.php:50 msgid "Group" msgstr "Group" -#: admin/alarming.php:40 admin/commands.php:40 admin/monitoring.php:42 -#: admin/specials.php:42 config/fieldvars.php:55 +#: admin/alarming.php:49 admin/commands.php:49 admin/monitoring.php:51 +#: admin/specials.php:51 config/fieldvars.php:56 msgid "Active" msgstr "Active" -#: admin/alarming.php:41 admin/commands.php:41 admin/monitoring.php:43 -#: admin/specials.php:43 +#: admin/alarming.php:50 admin/commands.php:50 admin/monitoring.php:52 +#: admin/specials.php:52 msgid "Inactive" msgstr "Inactive" -#: admin/alarming.php:52 config/fieldvars.php:303 +#: admin/alarming.php:61 config/fieldvars.php:307 msgid "Contact data" msgstr "Contact data" -#: admin/alarming.php:60 config/fieldvars.php:156 config/fieldvars.php:304 +#: admin/alarming.php:69 config/fieldvars.php:159 config/fieldvars.php:308 msgid "Contact groups" msgstr "Contact groups" -#: admin/alarming.php:68 config/fieldvars.php:301 +#: admin/alarming.php:77 config/fieldvars.php:305 msgid "Time periods" msgstr "Time periods" -#: admin/alarming.php:76 config/fieldvars.php:330 +#: admin/alarming.php:85 config/fieldvars.php:334 msgid "Contact templates" msgstr "Contact templates" -#: admin/cgicfg.php:65 admin/cgicfg.php:87 admin/nagioscfg.php:65 -#: admin/nagioscfg.php:87 admin/verify.php:63 admin/verify.php:85 -#: functions/NagConfigClass.php:2107 +#: admin/cgicfg.php:85 admin/cgicfg.php:107 admin/nagioscfg.php:82 +#: admin/nagioscfg.php:104 admin/verify.php:87 admin/verify.php:109 +#: functions/NagConfigClass.php:2432 msgid "Configuration file successfully written!" msgstr "Configuration file successfully written!" -#: admin/cgicfg.php:67 admin/cgicfg.php:89 admin/nagioscfg.php:67 -#: admin/nagioscfg.php:89 functions/NagConfigClass.php:2106 +#: admin/cgicfg.php:87 admin/cgicfg.php:109 admin/nagioscfg.php:84 +#: admin/nagioscfg.php:106 functions/NagConfigClass.php:2431 msgid "Configuration successfully written:" msgstr "Configuration successfully written:" -#: admin/cgicfg.php:69 admin/nagioscfg.php:69 admin/verify.php:65 -#: admin/verify.php:87 functions/NagConfigClass.php:1993 +#: admin/cgicfg.php:89 admin/nagioscfg.php:86 admin/verify.php:89 +#: admin/verify.php:111 functions/NagConfigClass.php:2195 msgid "Cannot open/overwrite the configuration file (check the permissions)!" msgstr "Cannot open/overwrite the configuration file (check the permissions)!" -#: admin/cgicfg.php:71 admin/nagioscfg.php:71 functions/NagConfigClass.php:1992 +#: admin/cgicfg.php:91 admin/nagioscfg.php:88 functions/NagConfigClass.php:2194 msgid "Configuration write failed:" msgstr "Configuration write failed:" -#: admin/cgicfg.php:92 admin/nagioscfg.php:92 +#: admin/cgicfg.php:111 admin/nagioscfg.php:108 msgid "" "Cannot open/overwrite the configuration file (check the permissions on " "remote system)!" @@ -132,11 +132,11 @@ msgstr "" "Cannot open/overwrite the configuration file (check the permissions on " "remote system)!" -#: admin/cgicfg.php:94 admin/nagioscfg.php:94 +#: admin/cgicfg.php:113 admin/nagioscfg.php:110 msgid "Configuration write failed (remote):" msgstr "Configuration write failed (remote):" -#: admin/cgicfg.php:99 admin/nagioscfg.php:99 +#: admin/cgicfg.php:118 admin/nagioscfg.php:115 msgid "" "There are no nagios configuration files in common domain, please select a " "valid domain to edit this files!" @@ -144,139 +144,139 @@ msgstr "" "There are no nagios configuration files in common domain, please select a " "valid domain to edit this files!" -#: admin/cgicfg.php:105 +#: admin/cgicfg.php:124 msgid "CGI configuration file" msgstr "CGI configuration file" -#: admin/cgicfg.php:123 admin/nagioscfg.php:123 -#: functions/NagImportClass.php:209 +#: admin/cgicfg.php:142 admin/nagioscfg.php:139 +#: functions/NagImportClass.php:206 msgid "Cannot open the data file (check the permissions)!" msgstr "Cannot open the data file (check the permissions)!" -#: admin/cgicfg.php:139 admin/nagioscfg.php:138 +#: admin/cgicfg.php:158 admin/nagioscfg.php:154 msgid "Cannot open the temporary file" msgstr "Cannot open the temporary file" -#: admin/cgicfg.php:143 admin/nagioscfg.php:142 +#: admin/cgicfg.php:162 admin/nagioscfg.php:158 msgid "Configuration read failed (remote):" msgstr "Configuration read failed (remote):" -#: admin/checkcommands.php:62 +#: admin/checkcommands.php:109 msgid "New command inserted:" msgstr "New command inserted:" -#: admin/checkcommands.php:65 +#: admin/checkcommands.php:112 msgid "Command modified:" msgstr "Command modified:" -#: admin/checkcommands.php:70 admin/configtargets.php:152 -#: admin/contactgroups.php:123 admin/contacts.php:237 -#: admin/contacttemplates.php:242 admin/datadomain.php:72 admin/group.php:115 -#: admin/hostdependencies.php:182 admin/hostescalations.php:182 -#: admin/hostextinfo.php:72 admin/hostgroups.php:124 admin/hosts.php:380 -#: admin/hosttemplates.php:272 admin/password.php:83 -#: admin/servicedependencies.php:290 admin/serviceescalations.php:233 -#: admin/serviceextinfo.php:81 admin/servicegroups.php:126 -#: admin/services.php:387 admin/servicetemplates.php:318 -#: admin/timeperiods.php:150 admin/user.php:82 +#: admin/checkcommands.php:117 admin/configtargets.php:212 +#: admin/contactgroups.php:174 admin/contacts.php:324 +#: admin/contacttemplates.php:328 admin/datadomain.php:105 admin/group.php:143 +#: admin/hostdependencies.php:256 admin/hostescalations.php:251 +#: admin/hostextinfo.php:117 admin/hostgroups.php:179 admin/hosts.php:510 +#: admin/hosttemplates.php:387 admin/password.php:101 +#: admin/servicedependencies.php:394 admin/serviceescalations.php:319 +#: admin/serviceextinfo.php:125 admin/servicegroups.php:181 +#: admin/services.php:530 admin/servicetemplates.php:449 +#: admin/timeperiods.php:201 admin/user.php:117 msgid "Database entry failed! Not all necessary data filled in!" msgstr "Database entry failed! Not all necessary data supplied!" -#: admin/checkcommands.php:75 admin/configtargets.php:157 -#: admin/contactgroups.php:128 admin/contacts.php:242 -#: admin/contacttemplates.php:247 admin/datadomain.php:77 admin/group.php:120 -#: admin/hostdependencies.php:187 admin/hostescalations.php:187 -#: admin/hostextinfo.php:77 admin/hostgroups.php:129 admin/hosts.php:385 -#: admin/hosttemplates.php:277 admin/servicedependencies.php:295 -#: admin/serviceescalations.php:238 admin/serviceextinfo.php:86 -#: admin/servicegroups.php:131 admin/services.php:392 -#: admin/servicetemplates.php:323 admin/timeperiods.php:155 admin/user.php:87 +#: admin/checkcommands.php:122 admin/configtargets.php:217 +#: admin/contactgroups.php:179 admin/contacts.php:329 +#: admin/contacttemplates.php:333 admin/datadomain.php:110 admin/group.php:148 +#: admin/hostdependencies.php:261 admin/hostescalations.php:256 +#: admin/hostextinfo.php:122 admin/hostgroups.php:184 admin/hosts.php:515 +#: admin/hosttemplates.php:392 admin/servicedependencies.php:399 +#: admin/serviceescalations.php:324 admin/serviceextinfo.php:130 +#: admin/servicegroups.php:186 admin/services.php:535 +#: admin/servicetemplates.php:454 admin/timeperiods.php:206 admin/user.php:122 msgid "Database entry failed! No write access!" msgstr "Database entry failed! No write access!" -#: admin/checkcommands.php:108 admin/contactgroups.php:199 -#: admin/contacts.php:398 admin/contacttemplates.php:398 -#: admin/datadomain.php:114 admin/hostdependencies.php:301 -#: admin/hostescalations.php:305 admin/hostextinfo.php:122 -#: admin/hostgroups.php:202 admin/hosts.php:596 admin/hosttemplates.php:466 -#: admin/servicedependencies.php:646 admin/serviceescalations.php:500 -#: admin/serviceextinfo.php:173 admin/servicegroups.php:204 -#: admin/services.php:630 admin/servicetemplates.php:551 -#: admin/timeperiods.php:225 +#: admin/checkcommands.php:152 admin/contactgroups.php:239 +#: admin/contacts.php:462 admin/contacttemplates.php:462 +#: admin/datadomain.php:140 admin/hostdependencies.php:351 +#: admin/hostescalations.php:350 admin/hostextinfo.php:159 +#: admin/hostgroups.php:245 admin/hosts.php:695 admin/hosttemplates.php:552 +#: admin/servicedependencies.php:700 admin/serviceescalations.php:546 +#: admin/serviceextinfo.php:204 admin/servicegroups.php:247 +#: admin/services.php:739 admin/servicetemplates.php:641 +#: admin/timeperiods.php:266 msgid "Saving not possible!" msgstr "Saving not possible!" # checkcommand.php -#: admin/checkcommands.php:113 admin/checkcommands.php:144 +#: admin/checkcommands.php:157 admin/checkcommands.php:188 msgid "Command definitions" msgstr "Command definitions (commands.cfg)" -#: admin/checkcommands.php:114 +#: admin/checkcommands.php:158 msgid "unclassified" msgstr "unclassified" -#: admin/checkcommands.php:115 +#: admin/checkcommands.php:159 msgid "check command" msgstr "check command" -#: admin/checkcommands.php:116 +#: admin/checkcommands.php:160 msgid "misc command" msgstr "misc command" -#: admin/checkcommands.php:122 admin/contactgroups.php:209 -#: admin/contacts.php:419 admin/contacttemplates.php:418 -#: admin/hostdependencies.php:308 admin/hostescalations.php:312 -#: admin/hostextinfo.php:132 admin/hostgroups.php:212 admin/hosts.php:606 -#: admin/hosttemplates.php:476 admin/servicedependencies.php:679 -#: admin/serviceescalations.php:536 admin/serviceextinfo.php:199 -#: admin/servicegroups.php:214 admin/services.php:637 -#: admin/servicetemplates.php:558 admin/timeperiods.php:236 +#: admin/checkcommands.php:166 admin/contactgroups.php:249 +#: admin/contacts.php:483 admin/contacttemplates.php:482 +#: admin/hostdependencies.php:358 admin/hostescalations.php:357 +#: admin/hostextinfo.php:169 admin/hostgroups.php:255 admin/hosts.php:705 +#: admin/hosttemplates.php:562 admin/servicedependencies.php:733 +#: admin/serviceescalations.php:582 admin/serviceextinfo.php:230 +#: admin/servicegroups.php:257 admin/services.php:746 +#: admin/servicetemplates.php:648 admin/timeperiods.php:277 msgid "Entry cannot be activated because it is used by another configuration" msgstr "Entry cannot be activated because it is used by another configuration" -#: admin/checkcommands.php:145 +#: admin/checkcommands.php:189 msgid "Command name" msgstr "Command name" -#: admin/checkcommands.php:146 config/fieldvars.php:90 +#: admin/checkcommands.php:190 config/fieldvars.php:92 msgid "Command line" msgstr "Command line" # prepend.adm -#: admin/checkcommands.php:163 admin/checkcommands.php:177 -#: admin/configtargets.php:321 admin/configtargets.php:335 -#: admin/contactgroups.php:242 admin/contactgroups.php:256 -#: admin/contacts.php:477 admin/contacts.php:491 admin/contacttemplates.php:475 -#: admin/contacttemplates.php:489 admin/datadomain.php:162 -#: admin/datadomain.php:176 admin/group.php:177 admin/group.php:190 -#: admin/hostdependencies.php:352 admin/hostdependencies.php:366 -#: admin/hostescalations.php:349 admin/hostescalations.php:363 -#: admin/hostextinfo.php:167 admin/hostextinfo.php:184 admin/hostgroups.php:246 -#: admin/hostgroups.php:260 admin/hosts.php:690 admin/hosts.php:704 -#: admin/hosttemplates.php:558 admin/hosttemplates.php:572 admin/logbook.php:50 -#: admin/logbook.php:77 admin/menuaccess.php:69 admin/password.php:45 -#: admin/password.php:66 admin/servicedependencies.php:723 -#: admin/servicedependencies.php:737 admin/serviceescalations.php:574 -#: admin/serviceescalations.php:588 admin/serviceextinfo.php:235 -#: admin/serviceextinfo.php:253 admin/servicegroups.php:248 -#: admin/servicegroups.php:262 admin/services.php:713 admin/services.php:746 -#: admin/services.php:761 admin/servicetemplates.php:642 -#: admin/servicetemplates.php:656 admin/settings.php:241 -#: admin/timeperiods.php:271 admin/timeperiods.php:285 admin/user.php:188 -#: admin/user.php:201 functions/NagConfigClass.php:1352 -#: functions/NagDataClass.php:191 functions/NagVisualClass.php:841 -#: functions/prepend_adm.php:111 functions/prepend_adm.php:322 -#: functions/prepend_adm.php:381 functions/prepend_adm.php:495 -#: functions/prepend_adm.php:527 functions/prepend_content.php:495 +#: admin/checkcommands.php:211 admin/checkcommands.php:225 +#: admin/configtargets.php:379 admin/configtargets.php:393 +#: admin/contactgroups.php:286 admin/contactgroups.php:300 +#: admin/contacts.php:544 admin/contacts.php:558 admin/contacttemplates.php:542 +#: admin/contacttemplates.php:556 admin/datadomain.php:190 +#: admin/datadomain.php:204 admin/group.php:208 admin/group.php:221 +#: admin/hostdependencies.php:405 admin/hostdependencies.php:419 +#: admin/hostescalations.php:397 admin/hostescalations.php:411 +#: admin/hostextinfo.php:207 admin/hostextinfo.php:224 admin/hostgroups.php:312 +#: admin/hostgroups.php:326 admin/hosts.php:812 admin/hosts.php:826 +#: admin/hosttemplates.php:658 admin/hosttemplates.php:672 admin/logbook.php:69 +#: admin/logbook.php:96 admin/menuaccess.php:86 admin/password.php:63 +#: admin/password.php:84 admin/servicedependencies.php:780 +#: admin/servicedependencies.php:794 admin/serviceescalations.php:623 +#: admin/serviceescalations.php:637 admin/serviceextinfo.php:269 +#: admin/serviceextinfo.php:287 admin/servicegroups.php:314 +#: admin/servicegroups.php:328 admin/services.php:824 admin/services.php:880 +#: admin/services.php:895 admin/servicetemplates.php:747 +#: admin/servicetemplates.php:761 admin/settings.php:274 +#: admin/timeperiods.php:316 admin/timeperiods.php:330 admin/user.php:217 +#: admin/user.php:230 functions/NagConfigClass.php:1191 +#: functions/NagDataClass.php:90 functions/NagVisualClass.php:1365 +#: functions/prepend_adm.php:112 functions/prepend_adm.php:321 +#: functions/prepend_adm.php:381 functions/prepend_adm.php:492 +#: functions/prepend_adm.php:524 functions/prepend_content.php:541 msgid "Error while selecting data from database:" msgstr "Error while selecting data from database:" -#: admin/commands.php:35 admin/commands.php:49 +#: admin/commands.php:44 admin/commands.php:58 msgid "Check commands" msgstr "Check commands" # commands.php -#: admin/commands.php:36 +#: admin/commands.php:45 msgid "" "To define check and misc commands, notification commands and special " "commands." @@ -285,516 +285,517 @@ msgstr "" "commands." # mutdialog.php -#: admin/configtargets.php:60 admin/configtargets.php:67 -#: admin/configtargets.php:89 admin/configtargets.php:94 +#: admin/configtargets.php:120 admin/configtargets.php:127 +#: admin/configtargets.php:149 admin/configtargets.php:154 msgid "is not writeable" msgstr "is not writeable" -#: admin/configtargets.php:66 admin/configtargets.php:82 admin/support.php:287 -#: config/fieldvars.php:46 +#: admin/configtargets.php:126 admin/configtargets.php:142 +#: admin/support.php:307 config/fieldvars.php:47 msgid "Nagios config file" msgstr "Nagios config file" -#: admin/configtargets.php:83 +#: admin/configtargets.php:143 msgid "is not a valid configuration file!" msgstr "is not a valid configuration file!" -#: admin/configtargets.php:88 config/fieldvars.php:226 +#: admin/configtargets.php:148 config/fieldvars.php:231 msgid "Nagios base directory" msgstr "Nagios base directory" -#: admin/configtargets.php:93 +#: admin/configtargets.php:153 msgid "Nagios cgi config file" msgstr "Nagios cgi config file" -#: admin/configtargets.php:98 +#: admin/configtargets.php:158 msgid "Nagios resource config file" msgstr "Nagios resource config file" # mutdialog.php -#: admin/configtargets.php:99 +#: admin/configtargets.php:159 msgid "is not readable" msgstr "is not readable" -#: admin/configtargets.php:105 functions/NagConfigClass.php:363 -#: functions/NagConfigClass.php:2083 +#: admin/configtargets.php:165 functions/NagConfigClass.php:375 +#: functions/NagConfigClass.php:2409 msgid "SSH module not loaded!" msgstr "SSH module not loaded!" -#: admin/configtargets.php:110 functions/NagConfigClass.php:2061 +#: admin/configtargets.php:170 functions/NagConfigClass.php:2387 msgid "FTP module not loaded!" msgstr "FTP module not loaded!" # domain.php -#: admin/configtargets.php:144 admin/datadomain.php:64 +#: admin/configtargets.php:204 admin/datadomain.php:97 msgid "New Domain inserted:" msgstr "New Domain inserted:" -#: admin/configtargets.php:147 admin/datadomain.php:67 +#: admin/configtargets.php:207 admin/datadomain.php:100 msgid "Domain modified:" msgstr "Domain modified:" -#: admin/configtargets.php:180 admin/configtargets.php:309 +#: admin/configtargets.php:236 admin/configtargets.php:365 msgid "Configuration domain administration" msgstr "Configuration domain administration" -#: admin/configtargets.php:182 +#: admin/configtargets.php:238 msgid "Warning, at least one error occured, please check!" msgstr "Warning, at least one error occurred. Please check!" -#: admin/configtargets.php:188 admin/datadomain.php:117 admin/group.php:149 -#: admin/password.php:99 admin/user.php:130 config/fieldvars.php:204 -#: install/step2.php:33 +#: admin/configtargets.php:244 admin/datadomain.php:143 admin/group.php:178 +#: admin/password.php:117 admin/user.php:157 config/fieldvars.php:207 +#: install/step2.php:38 msgid "Please fill in all fields marked with an *" msgstr "Please fill in all fields marked with an *" -#: admin/configtargets.php:189 admin/datadomain.php:118 admin/group.php:150 -#: admin/user.php:131 config/fieldvars.php:206 +#: admin/configtargets.php:245 admin/datadomain.php:144 admin/group.php:179 +#: admin/user.php:158 config/fieldvars.php:209 msgid "The following field contains illegal characters:" msgstr "The following field contains illegal characters:" -#: admin/configtargets.php:310 config/fieldvars.php:265 +#: admin/configtargets.php:366 config/fieldvars.php:270 msgid "Configuration target" msgstr "Configuration target" -#: admin/configtargets.php:311 admin/contactgroups.php:226 -#: admin/contacts.php:456 admin/contacttemplates.php:455 -#: admin/datadomain.php:152 admin/group.php:167 admin/hostgroups.php:229 -#: admin/hosts.php:673 admin/hosttemplates.php:542 admin/servicegroups.php:231 -#: admin/timeperiods.php:254 admin/user.php:178 config/fieldvars.php:21 +#: admin/configtargets.php:367 admin/contactgroups.php:267 +#: admin/contacts.php:522 admin/contacttemplates.php:521 +#: admin/datadomain.php:179 admin/group.php:196 admin/hostgroups.php:272 +#: admin/hosts.php:772 admin/hosttemplates.php:628 admin/servicegroups.php:274 +#: admin/timeperiods.php:296 admin/user.php:205 config/fieldvars.php:21 msgid "Description" msgstr "Description" -#: admin/contactgroups.php:62 +#: admin/contactgroups.php:113 msgid "New contact group inserted:" msgstr "New contact group inserted:" -#: admin/contactgroups.php:65 +#: admin/contactgroups.php:116 msgid "Contact group modified:" msgstr "Contact group modified:" -#: admin/contactgroups.php:146 admin/contactgroups.php:224 +#: admin/contactgroups.php:198 admin/contactgroups.php:265 msgid "Define contact groups (contactgroups.cfg)" msgstr "Define contact groups (contactgroups.cfg)" -#: admin/contactgroups.php:165 +#: admin/contactgroups.php:213 msgid "Attention, no contacts defined!" msgstr "Attention, no contacts defined!" -#: admin/contactgroups.php:225 config/fieldvars.php:102 +#: admin/contactgroups.php:266 config/fieldvars.php:105 msgid "Contact group" msgstr "Contact group" # contacts.php -#: admin/contacts.php:84 +#: admin/contacts.php:175 msgid "New contact inserted:" msgstr "New contact inserted:" -#: admin/contacts.php:87 +#: admin/contacts.php:178 msgid "Contact modified:" msgstr "Contact modified:" -#: admin/contacts.php:260 admin/contacts.php:454 +#: admin/contacts.php:348 admin/contacts.php:520 msgid "Define contacts (contacts.cfg)" msgstr "Define contacts (contacts.cfg)" -#: admin/contacts.php:329 admin/hosts.php:515 admin/services.php:566 +#: admin/contacts.php:409 admin/hosts.php:630 admin/services.php:691 msgid "Attention, no time periods defined!" msgstr "Attention, no time periods defined!" -#: admin/contacts.php:364 +#: admin/contacts.php:436 msgid "Attention, no commands defined!" msgstr "Attention, no commands defined!" -#: admin/contacts.php:455 admin/contacttemplates.php:454 -#: config/fieldvars.php:101 +#: admin/contacts.php:521 admin/contacttemplates.php:520 +#: config/fieldvars.php:104 msgid "Contact name" msgstr "Contact name" # hosttemplates.php -#: admin/contacttemplates.php:84 +#: admin/contacttemplates.php:174 msgid "New contact template inserted:" msgstr "New contact template inserted:" -#: admin/contacttemplates.php:87 +#: admin/contacttemplates.php:177 msgid "Contact template modified:" msgstr "Contact template modified:" -#: admin/contacttemplates.php:265 admin/contacttemplates.php:453 +#: admin/contacttemplates.php:352 admin/contacttemplates.php:519 msgid "Define contact templates (contacttemplates.cfg)" msgstr "Define contact templates (contacttemplates.cfg)" -#: admin/datadomain.php:98 +#: admin/datadomain.php:128 msgid "Attention, no configuration targets defined!" msgstr "Attention, no configuration targets defined!" -#: admin/datadomain.php:116 admin/datadomain.php:150 +#: admin/datadomain.php:142 admin/datadomain.php:177 msgid "Data domain administration" msgstr "Data domain administration" -#: admin/datadomain.php:119 admin/settings.php:280 +#: admin/datadomain.php:145 admin/settings.php:305 msgid "Enable" msgstr "Enable" # mutdialog.php -#: admin/datadomain.php:120 admin/settings.php:281 +#: admin/datadomain.php:146 admin/settings.php:306 msgid "Disable" msgstr "Disable" # fieldvars.php -#: admin/datadomain.php:151 +#: admin/datadomain.php:178 msgid "Data domain" msgstr "Data domain" -#: admin/delbackup.php:55 admin/delconfig.php:55 +#: admin/delbackup.php:75 admin/delconfig.php:74 msgid "File deleted" msgstr "File deleted" -#: admin/delbackup.php:56 admin/delconfig.php:56 +#: admin/delbackup.php:76 admin/delconfig.php:75 msgid "successfully deleted" msgstr "successfully deleted" -#: admin/delbackup.php:65 config/fieldvars.php:316 +#: admin/delbackup.php:85 config/fieldvars.php:320 msgid "Delete backup files" msgstr "Delete backup files" -#: admin/delbackup.php:68 admin/delconfig.php:68 admin/import.php:94 +#: admin/delbackup.php:88 admin/delconfig.php:87 admin/import.php:110 msgid "Filter string" msgstr "Filter string" -#: admin/delbackup.php:69 admin/delconfig.php:69 admin/import.php:95 -#: config/fieldvars.php:84 +#: admin/delbackup.php:89 admin/delconfig.php:88 admin/import.php:111 +#: config/fieldvars.php:86 msgid "Search" msgstr "Search" -#: admin/delbackup.php:70 admin/delbackup.php:75 admin/delconfig.php:70 -#: admin/delconfig.php:75 admin/groupusers.php:166 admin/import.php:96 -#: admin/templatedefinitions.php:268 admin/timedefinitions.php:180 -#: admin/variabledefinitions.php:147 config/fieldvars.php:76 -#: config/fieldvars.php:183 +#: admin/delbackup.php:90 admin/delbackup.php:95 admin/delconfig.php:89 +#: admin/delconfig.php:94 admin/groupusers.php:169 admin/groupusers.php:170 +#: admin/import.php:112 admin/templatedefinitions.php:285 +#: admin/timedefinitions.php:183 admin/variabledefinitions.php:161 +#: admin/variabledefinitions.php:162 config/fieldvars.php:78 +#: config/fieldvars.php:186 msgid "Delete" msgstr "Delete" -#: admin/delbackup.php:71 admin/delconfig.php:71 admin/import.php:97 -#: config/fieldvars.php:85 +#: admin/delbackup.php:91 admin/delconfig.php:90 admin/import.php:113 +#: config/fieldvars.php:87 msgid "Reset filter" msgstr "Reset filter" -#: admin/delbackup.php:73 +#: admin/delbackup.php:93 msgid "Backup file" msgstr "Backup file" -#: admin/delbackup.php:74 admin/delconfig.php:74 admin/settings.php:312 -#: config/fieldvars.php:57 +#: admin/delbackup.php:94 admin/delconfig.php:93 admin/settings.php:336 +#: config/fieldvars.php:58 msgid "required" msgstr "required" -#: admin/delbackup.php:76 admin/delconfig.php:76 admin/import.php:104 -#: admin/password.php:98 admin/settings.php:311 config/fieldvars.php:59 +#: admin/delbackup.php:96 admin/delconfig.php:95 admin/import.php:120 +#: admin/password.php:116 admin/settings.php:335 config/fieldvars.php:60 msgid "Abort" msgstr "Abort" -#: admin/delbackup.php:77 admin/delconfig.php:77 config/fieldvars.php:282 +#: admin/delbackup.php:97 admin/delconfig.php:96 config/fieldvars.php:287 msgid "Hold CTRL to select
more than one entry" msgstr "Hold down CTRL to select
more than one entry" -#: admin/delbackup.php:120 admin/delbackup.php:156 +#: admin/delbackup.php:140 admin/delbackup.php:176 msgid "No backup files or no permission to read the backup files" msgstr "No backup files or no permission to read the backup files" -#: admin/delconfig.php:65 config/fieldvars.php:315 +#: admin/delconfig.php:84 config/fieldvars.php:319 msgid "Delete config files" msgstr "Delete config files" -#: admin/delconfig.php:73 +#: admin/delconfig.php:92 msgid "Configuration file" msgstr "Configuration file" -#: admin/download.php:61 config/fieldvars.php:87 +#: admin/download.php:66 config/fieldvars.php:89 msgid "Download" msgstr "Download" -#: admin/group.php:63 +#: admin/group.php:91 msgid "A new group added:" msgstr "A new group added:" -#: admin/group.php:66 admin/user.php:77 +#: admin/group.php:94 admin/user.php:112 msgid "User modified:" msgstr "User modified:" -#: admin/group.php:144 admin/group.php:165 +#: admin/group.php:173 admin/group.php:194 msgid "Group administration" msgstr "Group administration" -#: admin/group.php:145 +#: admin/group.php:174 msgid "Read" msgstr "Read" -#: admin/group.php:146 admin/verify.php:97 admin/verify.php:101 -#: admin/verify.php:112 admin/verify.php:116 admin/verify.php:127 -#: admin/verify.php:131 admin/verify.php:142 admin/verify.php:146 -#: admin/verify.php:161 admin/verify.php:170 admin/verify.php:179 -#: admin/verify.php:188 admin/verify.php:197 admin/verify.php:201 -#: admin/verify.php:212 admin/verify.php:216 admin/verify.php:227 -#: admin/verify.php:231 admin/verify.php:242 admin/verify.php:246 -#: admin/verify.php:257 admin/verify.php:261 admin/verify.php:272 -#: admin/verify.php:276 admin/verify.php:287 admin/verify.php:291 +#: admin/group.php:175 admin/verify.php:121 admin/verify.php:124 +#: admin/verify.php:134 admin/verify.php:137 admin/verify.php:147 +#: admin/verify.php:150 admin/verify.php:160 admin/verify.php:163 +#: admin/verify.php:177 admin/verify.php:186 admin/verify.php:195 +#: admin/verify.php:204 admin/verify.php:213 admin/verify.php:216 +#: admin/verify.php:226 admin/verify.php:229 admin/verify.php:239 +#: admin/verify.php:242 admin/verify.php:252 admin/verify.php:255 +#: admin/verify.php:265 admin/verify.php:268 admin/verify.php:278 +#: admin/verify.php:281 admin/verify.php:291 admin/verify.php:294 msgid "Write" msgstr "Write" -#: admin/group.php:147 +#: admin/group.php:176 msgid "Link" msgstr "Link" -#: admin/group.php:166 +#: admin/group.php:195 msgid "Groupname" msgstr "Groupname" -#: admin/groupusers.php:175 admin/templatedefinitions.php:277 -#: admin/timedefinitions.php:189 admin/variabledefinitions.php:156 -#: functions/NagContentClass.php:136 +#: admin/groupusers.php:181 admin/templatedefinitions.php:295 +#: admin/timedefinitions.php:193 admin/variabledefinitions.php:174 +#: admin/variabledefinitions.php:183 functions/NagContentClass.php:131 msgid "No data" msgstr "No data" -#: admin/helpedit.php:83 +#: admin/helpedit.php:94 msgid "Help text editor" msgstr "Help text editor" -#: admin/helpedit.php:89 +#: admin/helpedit.php:100 msgid "Main key" msgstr "Main key" -#: admin/helpedit.php:90 +#: admin/helpedit.php:101 msgid "Sub key" msgstr "Sub key" -#: admin/helpedit.php:91 admin/settings.php:226 admin/settings.php:227 -#: install/index.php:71 +#: admin/helpedit.php:102 admin/settings.php:258 admin/settings.php:259 +#: install/index.php:76 msgid "Language" msgstr "Language" -#: admin/helpedit.php:92 config/fieldvars.php:49 +#: admin/helpedit.php:103 config/fieldvars.php:50 msgid "Nagios version" msgstr "Nagios version" -#: admin/helpedit.php:93 +#: admin/helpedit.php:104 msgid "Load default text" msgstr "Load default text" # hosttemplates.php -#: admin/hostdependencies.php:70 +#: admin/hostdependencies.php:144 msgid "New host dependency inserted:" msgstr "New host dependency inserted:" -#: admin/hostdependencies.php:73 +#: admin/hostdependencies.php:147 msgid "Host dependency modified:" msgstr "Host dependency modified:" -#: admin/hostdependencies.php:205 admin/hostdependencies.php:332 +#: admin/hostdependencies.php:279 admin/hostdependencies.php:382 msgid "Define host dependencies (hostdependencies.cfg)" msgstr "Define host dependencies (hostdependencies.cfg)" -#: admin/hostdependencies.php:285 admin/hostescalations.php:242 -#: admin/servicedependencies.php:533 admin/serviceescalations.php:369 +#: admin/hostdependencies.php:339 admin/hostescalations.php:303 +#: admin/servicedependencies.php:607 admin/serviceescalations.php:439 msgid "Attention, no hosts and hostgroups defined!" msgstr "Attention, no hosts and hostgroups defined!" -#: admin/hostdependencies.php:333 admin/hostescalations.php:331 -#: admin/servicedependencies.php:705 admin/serviceescalations.php:556 -#: admin/services.php:705 config/fieldvars.php:217 +#: admin/hostdependencies.php:383 admin/hostescalations.php:376 +#: admin/servicedependencies.php:759 admin/serviceescalations.php:602 +#: admin/services.php:815 config/fieldvars.php:222 msgid "Config name" msgstr "Config name" -#: admin/hostdependencies.php:334 config/fieldvars.php:234 +#: admin/hostdependencies.php:384 config/fieldvars.php:239 msgid "Dependent hosts" msgstr "Dependent hosts" -#: admin/hostdependencies.php:334 config/fieldvars.php:235 +#: admin/hostdependencies.php:384 config/fieldvars.php:240 msgid "Dependent hostgroups" msgstr "Dependent hostgroups" # hosttemplates.php -#: admin/hostescalations.php:70 +#: admin/hostescalations.php:139 msgid "New host escalation inserted:" msgstr "New host escalation inserted:" -#: admin/hostescalations.php:73 +#: admin/hostescalations.php:142 msgid "Host escalation modified:" msgstr "Host escalation modified:" -#: admin/hostescalations.php:205 admin/hostescalations.php:330 +#: admin/hostescalations.php:274 admin/hostescalations.php:375 msgid "Define host escalation (hostescalations.cfg)" msgstr "Define host escalation (hostescalations.cfg)" -#: admin/hostescalations.php:289 admin/serviceescalations.php:433 +#: admin/hostescalations.php:338 admin/serviceescalations.php:491 msgid "Attention, no contacts and contactgroups defined!" msgstr "Attention, no contacts and contactgroups defined!" -#: admin/hostescalations.php:332 admin/monitoring.php:56 -#: config/fieldvars.php:211 config/fieldvars.php:300 +#: admin/hostescalations.php:377 admin/monitoring.php:65 +#: config/fieldvars.php:214 config/fieldvars.php:304 msgid "Hosts" msgstr "Hosts" -#: admin/hostescalations.php:332 admin/monitoring.php:72 -#: config/fieldvars.php:127 config/fieldvars.php:306 +#: admin/hostescalations.php:377 admin/monitoring.php:81 +#: config/fieldvars.php:130 config/fieldvars.php:310 msgid "Host groups" msgstr "Host groups" # hosttemplates.php -#: admin/hostextinfo.php:64 +#: admin/hostextinfo.php:109 msgid "New host extended information inserted:" msgstr "New host extended information inserted:" -#: admin/hostextinfo.php:67 +#: admin/hostextinfo.php:112 msgid "Host extended information modified:" msgstr "Host extended information modified:" -#: admin/hostextinfo.php:95 admin/hostextinfo.php:147 +#: admin/hostextinfo.php:140 admin/hostextinfo.php:184 msgid "Define host extended information (hostextinfo.cfg)" msgstr "Define host extended information (hostextinfo.cfg)" -#: admin/hostextinfo.php:106 admin/hostgroups.php:168 -#: admin/serviceextinfo.php:141 +#: admin/hostextinfo.php:147 admin/hostgroups.php:219 +#: admin/serviceextinfo.php:180 msgid "Attention, no hosts defined!" msgstr "Attention, no hosts defined!" -#: admin/hostextinfo.php:148 admin/hosts.php:672 config/fieldvars.php:202 +#: admin/hostextinfo.php:185 admin/hosts.php:771 config/fieldvars.php:205 msgid "Host name" msgstr "Host name" -#: admin/hostextinfo.php:149 config/fieldvars.php:166 +#: admin/hostextinfo.php:186 config/fieldvars.php:169 msgid "Notes" msgstr "Notes" -#: admin/hostgroups.php:63 +#: admin/hostgroups.php:118 msgid "New host group inserted:" msgstr "New host group inserted:" -#: admin/hostgroups.php:66 +#: admin/hostgroups.php:121 msgid "Host group modified:" msgstr "Host group modified:" -#: admin/hostgroups.php:147 admin/hostgroups.php:227 +#: admin/hostgroups.php:202 admin/hostgroups.php:270 msgid "Define host groups (hostgroups.cfg)" msgstr "Define host groups (hostgroups.cfg)" -#: admin/hostgroups.php:228 +#: admin/hostgroups.php:271 msgid "Host group" msgstr "Host group" # contacts.php -#: admin/hosts.php:95 +#: admin/hosts.php:227 msgid "New host inserted:" msgstr "New host inserted:" -#: admin/hosts.php:98 +#: admin/hosts.php:230 msgid "Host modified:" msgstr "Host modified:" -#: admin/hosts.php:192 admin/hosts.php:218 admin/services.php:249 -#: admin/services.php:279 functions/NagDataClass.php:556 -#: functions/NagDataClass.php:583 functions/prepend_content.php:415 -#: functions/prepend_content.php:475 +#: admin/hosts.php:328 admin/hosts.php:352 admin/services.php:395 +#: admin/services.php:424 functions/NagDataClass.php:961 +#: functions/NagDataClass.php:988 functions/prepend_content.php:458 +#: functions/prepend_content.php:520 msgid "" "The assigned, no longer used configuration files were deleted successfully!" msgstr "" "The associated, now obsolete, configuration files were deleted successfully!" -#: admin/hosts.php:194 admin/hosts.php:220 functions/NagDataClass.php:558 -#: functions/NagDataClass.php:586 functions/prepend_content.php:401 +#: admin/hosts.php:330 admin/hosts.php:354 functions/NagDataClass.php:963 +#: functions/NagDataClass.php:991 functions/prepend_content.php:444 msgid "Host file deleted:" msgstr "Host file deleted:" -#: admin/hosts.php:197 admin/hosts.php:223 admin/services.php:254 -#: functions/prepend_content.php:424 functions/prepend_content.php:484 +#: admin/hosts.php:332 admin/hosts.php:356 admin/services.php:399 +#: functions/prepend_content.php:467 functions/prepend_content.php:529 msgid "" "Common files cannot be removed from target systems - please check manually" msgstr "" "Common files cannot be removed from target systems - please check manually" -#: admin/hosts.php:200 admin/hosts.php:226 admin/services.php:257 -#: admin/services.php:283 functions/NagDataClass.php:560 -#: functions/NagDataClass.php:588 functions/prepend_content.php:419 -#: functions/prepend_content.php:479 +#: admin/hosts.php:335 admin/hosts.php:359 admin/services.php:402 +#: admin/services.php:428 functions/NagDataClass.php:965 +#: functions/NagDataClass.php:993 functions/prepend_content.php:462 +#: functions/prepend_content.php:524 msgid "Errors while deleting the old configuration file - please check!:" msgstr "Error while deleting the old configuration file - please check!:" -#: admin/hosts.php:396 admin/hosts.php:671 +#: admin/hosts.php:526 admin/hosts.php:770 msgid "Define hosts (hosts.cfg)" msgstr "Define hosts (hosts.cfg)" -#: admin/hosts.php:562 +#: admin/hosts.php:665 msgid "Attention, no contact groups defined!" msgstr "Attention, no contact groups defined!" # hosttemplates.php -#: admin/hosttemplates.php:96 +#: admin/hosttemplates.php:212 msgid "New host template inserted:" msgstr "New host template inserted:" -#: admin/hosttemplates.php:99 +#: admin/hosttemplates.php:215 msgid "Host template modified:" msgstr "Host template modified:" -#: admin/hosttemplates.php:295 admin/hosttemplates.php:540 +#: admin/hosttemplates.php:410 admin/hosttemplates.php:626 msgid "Host template definition (hosttemplates.cfg)" msgstr "Host template definition (hosttemplates.cfg)" -#: admin/hosttemplates.php:541 +#: admin/hosttemplates.php:627 msgid "Host template name" msgstr "Host template name" -#: admin/import.php:55 +#: admin/import.php:72 msgid "File upload error:" msgstr "File upload error:" -#: admin/import.php:67 admin/import.php:83 +#: admin/import.php:84 admin/import.php:99 msgid "File imported - File [overwrite flag]:" msgstr "File imported - File [overwrite flag]:" -#: admin/import.php:91 +#: admin/import.php:107 msgid "Configuration import" msgstr "Configuration import" -#: admin/import.php:99 +#: admin/import.php:115 msgid "Template definition" msgstr "Template definition" -#: admin/import.php:100 +#: admin/import.php:116 msgid "Import file" msgstr "Import file" -#: admin/import.php:101 +#: admin/import.php:117 msgid "Local import file" msgstr "Local import file" -#: admin/import.php:102 +#: admin/import.php:118 msgid "Overwrite database" msgstr "Overwrite database" -#: admin/import.php:103 +#: admin/import.php:119 msgid "Import" msgstr "Import" -#: admin/import.php:105 +#: admin/import.php:121 msgid "Hold CTRL to select
more than one" msgstr "Hold down CTRL to select
more than one" -#: admin/import.php:109 +#: admin/import.php:125 msgid "" "To prevent errors or misconfigurations, you should import your " -"configurations in an useful order. We recommend to do it like this:" +"configurations in a useful order. We recommend to do it like this:" "

commands -> timeperiods -> contacttemplates -> contacts -> " "contactgroups -> hosttemplates -> hosts -> hostgroups -> servicetemplates -> " "services -> servicegroups

" msgstr "" "To prevent errors or misconfigurations, you should import your " -"configurations in an useful order. We recommend to do it like this:" +"configurations in a useful order. We recommend to do it like this:" "

commands -> timeperiods -> contacttemplates -> contacts -> " "contactgroups -> hosttemplates -> hosts -> hostgroups -> servicetemplates -> " "services -> servicegroups

" -#: admin/import.php:113 +#: admin/import.php:129 msgid "" "Check your configuration after import!
In cause of an error or an " "uncomplete configuration, re-importing the wrong configuration can solve the " @@ -804,19 +805,19 @@ msgstr "" "uncomplete configuration, re-importing the wrong configuration can solve the " "problem." -#: admin/info.php:43 +#: admin/info.php:46 msgid "This is relative path of your NagiosQL Installation" msgstr "This is relative path of your NagiosQL Installation" -#: admin/info.php:44 +#: admin/info.php:47 msgid "This is the absolut path to your NagiosQL Installation" msgstr "This is the absolut path to your NagiosQL Installation" -#: admin/info.php:45 +#: admin/info.php:48 msgid "If you need a secure connection, select HTTPS instead of HTTP" msgstr "If you need a secure connection, select HTTPS instead of HTTP" -#: admin/info.php:46 +#: admin/info.php:49 msgid "" "Please choose a temporary directory with write permissions. The default is " "the temp directory provided by your OS" @@ -824,11 +825,11 @@ msgstr "" "Please choose a temporary directory with write permissions. The default is " "the temp directory provided by your OS" -#: admin/info.php:48 +#: admin/info.php:51 msgid "Please choose your application language for new users and login portal" msgstr "Please choose your application language for new users and login portal" -#: admin/info.php:49 +#: admin/info.php:52 msgid "" "Encoding should be set to nothing else than utf-8. Any changes at your own " "risk" @@ -836,19 +837,19 @@ msgstr "" "Encoding should be set to nothing else than utf-8. Any changes at your own " "risk" -#: admin/info.php:50 +#: admin/info.php:53 msgid "IP-Address or hostname of the database server
e.g. localhost" msgstr "IP-Address or hostname of the database server
e.g. localhost" -#: admin/info.php:51 +#: admin/info.php:54 msgid "MySQL Server Port, default is 3306" msgstr "MySQL Server Port, default is 3306" -#: admin/info.php:52 +#: admin/info.php:55 msgid "Name of the NagiosQL database
e.g. db_nagiosql_v3" msgstr "Name of the NagiosQL database
e.g. db_nagiosql_v3" -#: admin/info.php:53 +#: admin/info.php:56 msgid "" "User with sufficient permission for the NagiosQL database
At least this " "user should have SELECT, INSERT, UPDATE, DELETE permissions" @@ -856,11 +857,11 @@ msgstr "" "User with sufficient permission for the NagiosQL database
At least this " "user should have SELECT, INSERT, UPDATE, DELETE permissions" -#: admin/info.php:55 +#: admin/info.php:58 msgid "Password for the above mentioned user" msgstr "Password for the above mentioned user" -#: admin/info.php:56 +#: admin/info.php:59 msgid "" "After the defined amount of seconds the session will terminate for security " "reasons" @@ -868,41 +869,41 @@ msgstr "" "After the defined amount of seconds the session will terminate for security " "reasons" -#: admin/info.php:58 -msgid "" -"Decide between authentication based on your Webserver
e.g. Apache " -"configuration (config file or htaccess) or NagiosQL" -msgstr "" -"Decide between authentication based on your Webserver
e.g. Apache " -"configuration (config file or htaccess) or NagiosQL" - -#: admin/info.php:60 -msgid "" -"Number of entries per side that should be visible (e.g. services or hosts)" -msgstr "" -"Number of entries per side that should be visible (e.g. services or hosts)" - #: admin/info.php:61 msgid "" -"Method of selection of multiple entries by using the new dialog or by " -"holding CTRL + left mouse button, as in NagiosQL 2" +"Decide between authentication based on your Webserver
e.g. Apache " +"configuration (config file or htaccess) or NagiosQL" msgstr "" -"Method of selection of multiple entries by using the new dialog or by " -"holding CTRL + left mouse button, as in NagiosQL 2" +"Decide between authentication based on your Webserver
e.g. Apache " +"configuration (config file or htaccess) or NagiosQL" #: admin/info.php:63 msgid "" +"Number of entries per side that should be visible (e.g. services or hosts)" +msgstr "" +"Number of entries per side that should be visible (e.g. services or hosts)" + +#: admin/info.php:64 +msgid "" +"Method of selection of multiple entries by using the new dialog or by " +"holding CTRL + left mouse button, as in NagiosQL 2" +msgstr "" +"Method of selection of multiple entries by using the new dialog or by " +"holding CTRL + left mouse button, as in NagiosQL 2" + +#: admin/info.php:66 +msgid "" "Enable or disable the warning if a required field contains no data in " "objects with templates" msgstr "" "Enable or disable the warning if a required field contains no data in " "objects with templates" -#: admin/info.php:65 +#: admin/info.php:68 msgid "Enable or disable the automatic online version check." msgstr "Enable or disable the automatic online version check." -#: admin/info.php:66 +#: admin/info.php:69 msgid "" "If you require a Proxyserver to connect to the Internet (Port 80), please " "define one." @@ -910,79 +911,89 @@ msgstr "" "If you require a Proxyserver to connect to the Internet (Port 80), please " "define one." -#: admin/info.php:68 +#: admin/info.php:71 msgid "Address of your Proxyserver e.g. proxy.yourdomain.com:3128" msgstr "Address of your Proxyserver e.g. proxy.yourdomain.com:3128" -#: admin/info.php:69 +#: admin/info.php:72 msgid "Username to connect through your proxy (optional)" msgstr "Username to connect through your proxy (optional)" -#: admin/info.php:70 +#: admin/info.php:73 msgid "Password to connect through your proxy (optional)" msgstr "Password to connect through your proxy (optional)" -#: admin/info.php:92 +#: admin/info.php:74 +msgid "" +"In environments with a high number of host and service objects, the display " +"of the parent objects can be disabled to improve performance. Existing " +"assignments are preserved during modification." +msgstr "" +"In environments with a high number of host and service objects, the display " +"of the parent objects can be disabled to improve performance. Existing " +"assignments are preserved during modification." + +#: admin/info.php:100 msgid "Information PopUp" msgstr "Information PopUp" # mutdialog.php -#: admin/info.php:105 +#: admin/info.php:113 msgid "No information available" msgstr "No information available" -#: admin/logbook.php:53 functions/NagDataClass.php:401 -#: functions/NagDataClass.php:436 functions/NagDataClass.php:611 +#: admin/logbook.php:72 functions/NagDataClass.php:798 +#: functions/NagDataClass.php:835 functions/NagDataClass.php:1017 msgid "Dataset successfully deleted. Affected rows:" msgstr "Dataset successfully deleted. Affected rows:" # logbook.php -#: admin/logbook.php:83 +#: admin/logbook.php:102 msgid "View logbook" msgstr "View logbook" -#: admin/logbook.php:87 +#: admin/logbook.php:106 msgid "Delete logentries between:" msgstr "Delete log entries between:" -#: admin/logbook.php:89 +#: admin/logbook.php:108 msgid "Please supply a start or a stop time at least" msgstr "Please supply a start or a stop time at least" -#: admin/logbook.php:90 +#: admin/logbook.php:109 msgid "" "Do you really want to delete all log entries between the selected dates?" msgstr "" "Do you really want to delete all log entries between the selected dates?" -#: admin/logbook.php:97 +#: admin/logbook.php:116 msgid "previous 20 entries" msgstr "previous 20 entries" -#: admin/logbook.php:104 +#: admin/logbook.php:123 msgid "next 20 entries" msgstr "next 20 entries" -#: admin/menuaccess.php:44 functions/NagDataClass.php:137 -#: functions/NagDataClass.php:290 +#: admin/menuaccess.php:61 functions/NagDataClass.php:199 +#: functions/NagDataClass.php:755 msgid "Error while inserting the data into the database:" msgstr "Error while inserting the data into the database:" -#: admin/menuaccess.php:47 functions/NagDataClass.php:134 -#: functions/NagDataClass.php:285 +#: admin/menuaccess.php:64 functions/NagDataClass.php:194 +#: functions/NagDataClass.php:752 msgid "Data were successfully inserted to the data base!" msgstr "Data successfully inserted into the database!" -#: admin/menuaccess.php:48 +#: admin/menuaccess.php:65 msgid "Access group set for menu item:" msgstr "Access group set for menu item:" # menuaccess.php -#: admin/menuaccess.php:55 +#: admin/menuaccess.php:72 msgid "Define Menu Access Rights" msgstr "Define Menu Access Rights" -#: admin/menuaccess.php:59 +#: admin/menuaccess.php:76 msgid "" "In order for a user to get access, he needs to be member of the group " "selected here." @@ -990,212 +1001,212 @@ msgstr "" "In order for a user to get access, he needs to be member of the group " "selected here." -#: admin/monitoring.php:36 +#: admin/monitoring.php:45 msgid "Monitoring" msgstr "Monitoring" # monitoring.php -#: admin/monitoring.php:39 +#: admin/monitoring.php:48 msgid "" "Define host and service supervisions as well as host and service groups." msgstr "" "Define host and service supervisions as well as host and service groups." -#: admin/monitoring.php:64 admin/serviceescalations.php:557 -#: config/fieldvars.php:248 config/fieldvars.php:305 +#: admin/monitoring.php:73 admin/serviceescalations.php:603 +#: config/fieldvars.php:253 config/fieldvars.php:309 msgid "Services" msgstr "Services" -#: admin/monitoring.php:80 config/fieldvars.php:213 config/fieldvars.php:307 +#: admin/monitoring.php:89 config/fieldvars.php:216 config/fieldvars.php:311 msgid "Service groups" msgstr "Service groups" -#: admin/monitoring.php:88 config/fieldvars.php:302 config/fieldvars.php:328 +#: admin/monitoring.php:97 config/fieldvars.php:306 config/fieldvars.php:332 msgid "Host templates" msgstr "Host templates" -#: admin/monitoring.php:96 config/fieldvars.php:329 +#: admin/monitoring.php:105 config/fieldvars.php:333 msgid "Service templates" msgstr "Service templates" # mutdialog.php -#: admin/mutdialog.php:57 admin/versioncheck.php:83 +#: admin/mutdialog.php:58 admin/versioncheck.php:93 msgid "Available" msgstr "Available" -#: admin/mutdialog.php:58 +#: admin/mutdialog.php:59 msgid "Selected" msgstr "Selected" -#: admin/nagioscfg.php:105 +#: admin/nagioscfg.php:121 msgid "Nagios main configuration file" msgstr "Nagios main configuration file" -#: admin/password.php:55 +#: admin/password.php:73 msgid "Password successfully modified" msgstr "Password successfully modified" -#: admin/password.php:72 admin/user.php:90 +#: admin/password.php:90 admin/user.php:125 msgid "Password too short or password fields do not match!" msgstr "Password too short or password fields do not match!" -#: admin/password.php:78 +#: admin/password.php:96 msgid "The old password is invalid" msgstr "The old password is invalid" -#: admin/password.php:97 admin/settings.php:310 config/fieldvars.php:58 +#: admin/password.php:115 admin/settings.php:334 config/fieldvars.php:59 msgid "Save" msgstr "Save" -#: admin/password.php:100 +#: admin/password.php:118 msgid "The new passwords don not match!" msgstr "The new passwords don not match!" -#: admin/password.php:101 +#: admin/password.php:119 msgid "The new password is too short - use at least 6 characters!" msgstr "The new password is too short - use at least 6 characters!" # hosttemplates.php -#: admin/servicedependencies.php:72 +#: admin/servicedependencies.php:176 msgid "New service dependency inserted:" msgstr "New service dependency inserted:" -#: admin/servicedependencies.php:75 +#: admin/servicedependencies.php:179 msgid "Service dependency modified:" msgstr "Service dependency modified:" -#: admin/servicedependencies.php:313 admin/servicedependencies.php:704 +#: admin/servicedependencies.php:417 admin/servicedependencies.php:758 msgid "Define service dependencies (servicedependencies.cfg)" msgstr "Define service dependencies (servicedependencies.cfg)" -#: admin/servicedependencies.php:706 config/fieldvars.php:247 +#: admin/servicedependencies.php:760 config/fieldvars.php:252 msgid "Dependent services" msgstr "Dependent services" # hosttemplates.php -#: admin/serviceescalations.php:71 +#: admin/serviceescalations.php:157 msgid "New service escalation inserted:" msgstr "New service escalation inserted:" -#: admin/serviceescalations.php:74 +#: admin/serviceescalations.php:160 msgid "Service escalation modified:" msgstr "Service escalation modified:" -#: admin/serviceescalations.php:256 admin/serviceescalations.php:555 +#: admin/serviceescalations.php:342 admin/serviceescalations.php:601 msgid "Define service escalation (serviceescalations.cfg)" msgstr "Define service escalation (serviceescalations.cfg)" # hosttemplates.php -#: admin/serviceextinfo.php:64 +#: admin/serviceextinfo.php:108 msgid "New service extended information inserted:" msgstr "New service extended information inserted:" -#: admin/serviceextinfo.php:68 +#: admin/serviceextinfo.php:112 msgid "Service extended information modified:" msgstr "Service extended information modified:" -#: admin/serviceextinfo.php:104 admin/serviceextinfo.php:214 +#: admin/serviceextinfo.php:148 admin/serviceextinfo.php:245 msgid "Define service extended information (serviceextinfo.cfg)" msgstr "Define service extended information (serviceextinfo.cfg)" -#: admin/serviceextinfo.php:215 +#: admin/serviceextinfo.php:246 msgid "Hostname" msgstr "Hostname" -#: admin/serviceextinfo.php:216 +#: admin/serviceextinfo.php:247 msgid "Service" msgstr "Service" # hosttemplates.php -#: admin/servicegroups.php:63 +#: admin/servicegroups.php:118 msgid "New service group inserted:" msgstr "New service group inserted:" -#: admin/servicegroups.php:66 +#: admin/servicegroups.php:121 msgid "Service group modified:" msgstr "Service group modified:" -#: admin/servicegroups.php:149 admin/servicegroups.php:229 +#: admin/servicegroups.php:204 admin/servicegroups.php:272 msgid "Define service groups (servicegroups.cfg)" msgstr "Define service groups (servicegroups.cfg)" -#: admin/servicegroups.php:170 +#: admin/servicegroups.php:221 msgid "Attention, no services defined!" msgstr "Attention, no services defined!" -#: admin/servicegroups.php:230 +#: admin/servicegroups.php:273 msgid "Service group" msgstr "Service group" # hosttemplates.php -#: admin/services.php:96 +#: admin/services.php:237 msgid "New service inserted:" msgstr "New service inserted:" -#: admin/services.php:99 +#: admin/services.php:240 msgid "Service modified:" msgstr "Service modified:" -#: admin/services.php:251 admin/services.php:281 -#: functions/prepend_content.php:460 +#: admin/services.php:397 admin/services.php:426 +#: functions/prepend_content.php:505 msgid "Service file deleted:" msgstr "Service file deleted:" -#: admin/services.php:403 admin/services.php:704 +#: admin/services.php:546 admin/services.php:814 msgid "Define services (services.cfg)" msgstr "Define services (services.cfg)" -#: admin/services.php:488 +#: admin/services.php:626 msgid "Attention, no hosts or hostgroups defined!" msgstr "Attention, no hosts or hostgroups defined!" -#: admin/services.php:543 +#: admin/services.php:676 msgid "Attention, no check commands defined!" msgstr "Attention, no check commands defined!" -#: admin/services.php:613 +#: admin/services.php:726 msgid "Attention, no contacts or contact groups defined!" msgstr "Attention, no contacts or contact groups defined!" -#: admin/services.php:706 +#: admin/services.php:816 config/fieldvars.php:221 msgid "Service name" msgstr "Service name" -#: admin/services.php:708 admin/services.php:732 +#: admin/services.php:818 admin/services.php:844 msgid "All configs" msgstr "All configs" # hosttemplates.php -#: admin/servicetemplates.php:97 +#: admin/servicetemplates.php:229 msgid "New service template inserted:" msgstr "New service template inserted:" -#: admin/servicetemplates.php:100 +#: admin/servicetemplates.php:232 msgid "Service template modified:" msgstr "Service template modified:" -#: admin/servicetemplates.php:341 admin/servicetemplates.php:623 +#: admin/servicetemplates.php:472 admin/servicetemplates.php:714 msgid "Define service templates (servicetemplates.cfg)" msgstr "Define service templates (servicetemplates.cfg)" -#: admin/servicetemplates.php:624 config/fieldvars.php:124 -#: config/fieldvars.php:225 +#: admin/servicetemplates.php:715 config/fieldvars.php:127 +#: config/fieldvars.php:230 msgid "Template name" msgstr "Template name" -#: admin/servicetemplates.php:625 config/fieldvars.php:212 +#: admin/servicetemplates.php:716 config/fieldvars.php:215 msgid "Service description" msgstr "Service description" -#: admin/settings.php:111 +#: admin/settings.php:146 msgid "Curl module not loaded, Proxy will be deactivated!" msgstr "Curl module not loaded, Proxy will be deactivated!" -#: admin/settings.php:136 +#: admin/settings.php:172 msgid "An error occured while writing settings to database:" msgstr "An error occured while writing settings to database:" -#: admin/settings.php:187 functions/prepend_adm.php:150 +#: admin/settings.php:223 functions/prepend_adm.php:151 msgid "" "Error setting the correct locale. Please report this error with the " "associated output of 'locale -a'" @@ -1203,120 +1214,128 @@ msgstr "" "Error setting the correct locale. Please report this error with the " "associated output of 'locale -a'" -#: admin/settings.php:195 +#: admin/settings.php:231 msgid "Settings were changed" msgstr "Settings were changed" -#: admin/settings.php:197 +#: admin/settings.php:233 msgid "An error occured while writing settings.php. Please check permissions!" msgstr "An error occured while writing settings.php. Please check permissions!" -#: admin/settings.php:201 +#: admin/settings.php:237 msgid "is not writeable, please check permissions!" msgstr "is not writeable, please check permissions!" -#: admin/settings.php:208 +#: admin/settings.php:244 msgid "Configure Settings" msgstr "Configure Settings" -#: admin/settings.php:213 +#: admin/settings.php:249 msgid "Change your current NagiosQL settings (e.g. Database user, Language)." msgstr "Change your current NagiosQL settings (e.g. Database user, Language)." -#: admin/settings.php:218 +#: admin/settings.php:252 msgid "Path" msgstr "Path" -#: admin/settings.php:219 +#: admin/settings.php:253 msgid "Temporary Directory" msgstr "Temporary Directory" -#: admin/settings.php:221 +#: admin/settings.php:255 msgid "Server protocol" msgstr "Server protocol" -#: admin/settings.php:244 +#: admin/settings.php:277 msgid "Encoding" msgstr "Encoding" -#: admin/settings.php:249 +#: admin/settings.php:280 msgid "Database" msgstr "Database" -#: admin/settings.php:250 +#: admin/settings.php:281 msgid "MySQL Server" msgstr "MySQL Server" -#: admin/settings.php:252 +#: admin/settings.php:283 msgid "MySQL Server Port" msgstr "MySQL Server Port" -#: admin/settings.php:254 install/step2.php:66 +#: admin/settings.php:285 install/step2.php:71 msgid "Database name" msgstr "Database name" -#: admin/settings.php:256 +#: admin/settings.php:287 msgid "Database user" msgstr "Database user" -#: admin/settings.php:258 +#: admin/settings.php:289 msgid "Database password" msgstr "Database password" -#: admin/settings.php:263 +#: admin/settings.php:292 msgid "Security" msgstr "Security" -#: admin/settings.php:264 +#: admin/settings.php:293 msgid "Session auto logoff time" msgstr "Session auto logoff time" -#: admin/settings.php:266 +#: admin/settings.php:295 msgid "Authentication type" msgstr "Authentication type" -#: admin/settings.php:271 +#: admin/settings.php:298 msgid "Common" msgstr "Common" -#: admin/settings.php:272 +#: admin/settings.php:299 msgid "Data lines per page" msgstr "Data lines per page" -#: admin/settings.php:274 +#: admin/settings.php:301 msgid "Selection method" msgstr "Selection method" -#: admin/settings.php:279 +#: admin/settings.php:304 msgid "Template warn message" msgstr "Template warn message" -#: admin/settings.php:288 +#: admin/settings.php:311 msgid "Online version check" msgstr "Online version check" -#: admin/settings.php:296 +#: admin/settings.php:317 msgid "Proxyserver" msgstr "Proxyserver" -#: admin/settings.php:301 +#: admin/settings.php:323 msgid "Proxy Address" msgstr "Proxy Address" -#: admin/settings.php:303 +#: admin/settings.php:325 msgid "Proxy Username (optional)" msgstr "Proxy Username (optional)" -#: admin/settings.php:305 +#: admin/settings.php:327 msgid "Proxy Password (optional)" msgstr "Proxy Password (optional)" -#: admin/specials.php:35 +#: admin/settings.php:330 +msgid "Performance options" +msgstr "Performance options" + +#: admin/settings.php:331 +msgid "Show object parents" +msgstr "Show object parents" + +#: admin/specials.php:44 msgid "Misc commands" msgstr "Misc commands" # specials.php -#: admin/specials.php:38 +#: admin/specials.php:47 msgid "" "Define host and service dependencies, host and service escalations as well " "as host and service additional data." @@ -1324,39 +1343,39 @@ msgstr "" "Define host and service dependencies, host and service escalations as well " "as host and service additional data." -#: admin/specials.php:56 +#: admin/specials.php:65 msgid "Host dependencies" msgstr "Host dependencies" -#: admin/specials.php:64 +#: admin/specials.php:73 msgid "Host escalations" msgstr "Host escalations" -#: admin/specials.php:72 +#: admin/specials.php:81 msgid "Host ext. info" msgstr "Host ext. info" -#: admin/specials.php:80 +#: admin/specials.php:89 msgid "Service dependencies" msgstr "Service dependencies" -#: admin/specials.php:88 +#: admin/specials.php:97 msgid "Service escalations" msgstr "Service escalations" -#: admin/specials.php:96 +#: admin/specials.php:105 msgid "Service ext. info" msgstr "Service ext. info" -#: admin/support.php:39 +#: admin/support.php:56 msgid "NagiosQL support page" msgstr "NagiosQL support page" -#: admin/support.php:49 +#: admin/support.php:66 msgid "Support contact information" msgstr "Support contact information" -#: admin/support.php:50 +#: admin/support.php:67 msgid "" "For questions, the online support forum or contact information visit our " "website:" @@ -1364,15 +1383,15 @@ msgstr "" "For questions, the online support forum or contact information visit our " "website:" -#: admin/support.php:52 +#: admin/support.php:69 msgid "NagiosQL on sourceforge" msgstr "NagiosQL on sourceforge" -#: admin/support.php:56 +#: admin/support.php:73 msgid "Donate to support NagiosQL" msgstr "Donate to support NagiosQL" -#: admin/support.php:57 +#: admin/support.php:74 msgid "" "If you like NagiosQL and it simplifies your daily work, then you may want to " "support the project by making a donation. This helps us to keep NagiosQL " @@ -1382,16 +1401,16 @@ msgstr "" "support the project by making a donation. This helps us to keep NagiosQL " "alive and to cover our costs. Thank you for your donation!" -#: admin/support.php:60 functions/NagVisualClass.php:230 -#: functions/NagVisualClass.php:231 +#: admin/support.php:77 functions/NagVisualClass.php:134 +#: functions/NagVisualClass.php:135 msgid "Donate for NagiosQL on sourceforge" msgstr "Donate for NagiosQL on sourceforge" -#: admin/support.php:64 +#: admin/support.php:81 msgid "Translation services" msgstr "Translation services" -#: admin/support.php:65 +#: admin/support.php:82 msgid "" "NagiosQL was translated into various languages​​. Since some translators are " "no longer available in later versions, there may be untranslated words or " @@ -1407,15 +1426,15 @@ msgstr "" "simply feasible online - we use an open translation service where you can " "register for free at any time:" -#: admin/support.php:70 +#: admin/support.php:87 msgid "Transifex translation service" msgstr "Transifex translation service" -#: admin/support.php:74 +#: admin/support.php:91 msgid "GIT software repository" msgstr "GIT software repository" -#: admin/support.php:75 +#: admin/support.php:92 msgid "" "The NagiosQL sources are available on GitLab. There you will always find the " "latest bugfixes and changes as well as older branches." @@ -1423,15 +1442,15 @@ msgstr "" "The NagiosQL sources are available on GitLab. There you will always find the " "latest bugfixes and changes as well as older branches." -#: admin/support.php:77 +#: admin/support.php:94 msgid "GitLab" msgstr "GitLab" -#: admin/support.php:81 +#: admin/support.php:98 msgid "Version check" msgstr "Version check" -#: admin/support.php:83 +#: admin/support.php:100 msgid "" "The online version check is not enabled. You can enable it on the settings " "page." @@ -1439,7 +1458,7 @@ msgstr "" "The online version check is not enabled. You can enable it on the settings " "page." -#: admin/support.php:86 +#: admin/support.php:103 msgid "" "The online version check connects the NagiosQL page to find out, if your " "version is still up to date." @@ -1447,102 +1466,105 @@ msgstr "" "The online version check connects the NagiosQL page to find out, if your " "version is still up to date." -#: admin/support.php:98 +#: admin/support.php:112 +msgid "GIT code version" +msgstr "GIT code version" + +#: admin/support.php:117 msgid "Environment check" msgstr "Environment check" -#: admin/support.php:100 admin/support.php:109 admin/support.php:121 -#: admin/support.php:129 admin/support.php:138 admin/support.php:148 -#: admin/support.php:163 admin/support.php:176 admin/support.php:185 -#: admin/support.php:194 admin/support.php:203 admin/support.php:213 -#: admin/support.php:263 admin/support.php:278 admin/support.php:299 -#: admin/support.php:337 admin/support.php:360 admin/support.php:366 -#: admin/support.php:392 admin/support.php:396 admin/support.php:415 -#: admin/support.php:418 admin/support.php:421 admin/support.php:435 -#: admin/support.php:440 admin/support.php:443 admin/support.php:448 -#: admin/support.php:460 admin/support.php:465 admin/support.php:484 -#: admin/support.php:492 admin/support.php:589 admin/support.php:592 -#: admin/support.php:613 admin/support.php:642 admin/support.php:677 -#: install/functions/NagInstallClass.php:338 -#: install/functions/NagInstallClass.php:370 -#: install/functions/NagInstallClass.php:406 +#: admin/support.php:119 admin/support.php:128 admin/support.php:140 +#: admin/support.php:148 admin/support.php:157 admin/support.php:167 +#: admin/support.php:182 admin/support.php:195 admin/support.php:204 +#: admin/support.php:213 admin/support.php:222 admin/support.php:232 +#: admin/support.php:283 admin/support.php:298 admin/support.php:319 +#: admin/support.php:354 admin/support.php:385 admin/support.php:415 +#: admin/support.php:434 admin/support.php:437 admin/support.php:440 +#: admin/support.php:454 admin/support.php:459 admin/support.php:462 +#: admin/support.php:467 admin/support.php:479 admin/support.php:484 +#: admin/support.php:501 admin/support.php:509 admin/support.php:606 +#: admin/support.php:609 admin/support.php:630 admin/support.php:659 +#: admin/support.php:694 install/functions/NagInstallClass.php:184 +#: install/functions/NagInstallClass.php:216 +#: install/functions/NagInstallClass.php:252 +#: install/functions/NagInstallClass.php:329 +#: install/functions/NagInstallClass.php:337 +#: install/functions/NagInstallClass.php:359 +#: install/functions/NagInstallClass.php:383 +#: install/functions/NagInstallClass.php:395 +#: install/functions/NagInstallClass.php:462 #: install/functions/NagInstallClass.php:485 -#: install/functions/NagInstallClass.php:493 -#: install/functions/NagInstallClass.php:515 -#: install/functions/NagInstallClass.php:539 +#: install/functions/NagInstallClass.php:494 +#: install/functions/NagInstallClass.php:546 #: install/functions/NagInstallClass.php:551 +#: install/functions/NagInstallClass.php:583 #: install/functions/NagInstallClass.php:618 -#: install/functions/NagInstallClass.php:640 -#: install/functions/NagInstallClass.php:649 -#: install/functions/NagInstallClass.php:701 -#: install/functions/NagInstallClass.php:706 -#: install/functions/NagInstallClass.php:739 -#: install/functions/NagInstallClass.php:777 -#: install/functions/NagInstallClass.php:784 -#: install/functions/NagInstallClass.php:812 -#: install/functions/NagInstallClass.php:872 -#: install/functions/NagInstallClass.php:904 -#: install/functions/NagInstallClass.php:938 -#: install/functions/NagInstallClass.php:971 -#: install/functions/NagInstallClass.php:1010 -#: install/functions/NagInstallClass.php:1019 -#: install/functions/NagInstallClass.php:1062 -#: install/functions/NagInstallClass.php:1071 install/step1.php:229 -#: install/step1.php:242 install/step1.php:246 install/step1.php:255 -#: install/step1.php:264 install/step1.php:273 install/step1.php:282 -#: install/step1.php:291 install/step1.php:300 install/step3.php:90 -#: install/step3.php:179 install/step3.php:204 +#: install/functions/NagInstallClass.php:625 +#: install/functions/NagInstallClass.php:652 +#: install/functions/NagInstallClass.php:714 +#: install/functions/NagInstallClass.php:746 +#: install/functions/NagInstallClass.php:780 +#: install/functions/NagInstallClass.php:813 +#: install/functions/NagInstallClass.php:853 +#: install/functions/NagInstallClass.php:862 +#: install/functions/NagInstallClass.php:905 +#: install/functions/NagInstallClass.php:914 install/step1.php:246 +#: install/step1.php:259 install/step1.php:263 install/step1.php:272 +#: install/step1.php:281 install/step1.php:290 install/step1.php:299 +#: install/step1.php:308 install/step1.php:317 install/step3.php:98 +#: install/step3.php:187 install/step3.php:212 msgid "failed" msgstr "failed" -#: admin/support.php:101 admin/support.php:106 admin/support.php:118 -#: admin/support.php:126 admin/support.php:134 admin/support.php:144 -#: admin/support.php:160 admin/support.php:173 admin/support.php:182 -#: admin/support.php:191 admin/support.php:200 admin/support.php:210 -#: admin/support.php:255 admin/support.php:268 admin/support.php:283 -#: admin/support.php:292 admin/support.php:295 admin/support.php:334 -#: admin/support.php:340 admin/support.php:356 admin/support.php:372 -#: admin/support.php:388 admin/support.php:407 admin/support.php:410 -#: admin/support.php:425 admin/support.php:432 admin/support.php:457 -#: admin/support.php:469 admin/support.php:488 admin/support.php:584 -#: admin/support.php:600 admin/support.php:605 admin/support.php:610 -#: admin/support.php:619 admin/support.php:624 admin/support.php:630 -#: admin/support.php:635 +#: admin/support.php:120 admin/support.php:125 admin/support.php:137 +#: admin/support.php:145 admin/support.php:153 admin/support.php:163 +#: admin/support.php:179 admin/support.php:192 admin/support.php:201 +#: admin/support.php:210 admin/support.php:219 admin/support.php:229 +#: admin/support.php:275 admin/support.php:288 admin/support.php:303 +#: admin/support.php:312 admin/support.php:315 admin/support.php:351 +#: admin/support.php:357 admin/support.php:375 admin/support.php:379 +#: admin/support.php:391 admin/support.php:407 admin/support.php:411 +#: admin/support.php:426 admin/support.php:429 admin/support.php:444 +#: admin/support.php:451 admin/support.php:476 admin/support.php:488 +#: admin/support.php:505 admin/support.php:601 admin/support.php:617 +#: admin/support.php:622 admin/support.php:627 admin/support.php:636 +#: admin/support.php:641 admin/support.php:647 admin/support.php:652 msgid "ok" msgstr "ok" -#: admin/support.php:103 +#: admin/support.php:122 msgid "PHP version" msgstr "PHP version" -#: admin/support.php:110 admin/support.php:163 +#: admin/support.php:129 admin/support.php:182 msgid "Required:" msgstr "Required:" -#: admin/support.php:115 admin/support.php:123 admin/support.php:131 -#: admin/support.php:141 install/index.php:170 install/index.php:171 -#: install/index.php:172 install/index.php:173 +#: admin/support.php:134 admin/support.php:142 admin/support.php:150 +#: admin/support.php:160 install/index.php:171 install/index.php:172 +#: install/index.php:173 install/index.php:174 msgid "PHP module:" msgstr "PHP module:" -#: admin/support.php:153 +#: admin/support.php:172 msgid "MySQL version" msgstr "MySQL version" -#: admin/support.php:169 admin/support.php:178 admin/support.php:187 -#: admin/support.php:196 +#: admin/support.php:188 admin/support.php:197 admin/support.php:206 +#: admin/support.php:215 msgid "PHP ini settings:" msgstr "PHP ini settings:" -#: admin/support.php:206 +#: admin/support.php:225 msgid "Read/Write access:" msgstr "Read/Write access:" -#: admin/support.php:222 +#: admin/support.php:242 msgid "Config domain checks" msgstr "Config domain checks" -#: admin/support.php:223 +#: admin/support.php:243 msgid "" "The checks below are based on your data domain and config domain settings. " "To change the data domain, use the pull down menu in the upper right corner. " @@ -1556,180 +1578,183 @@ msgstr "" "config domain, use the data domain menu and select a different config domain " "value." -#: admin/support.php:229 +#: admin/support.php:249 msgid "Config domain name" msgstr "Config domain name" -#: admin/support.php:231 +#: admin/support.php:251 msgid "Connection type" msgstr "Connection type" -#: admin/support.php:252 +#: admin/support.php:272 msgid "Connection check" msgstr "Connection check" -#: admin/support.php:295 admin/support.php:340 admin/support.php:418 -#: admin/support.php:436 +#: admin/support.php:315 admin/support.php:357 admin/support.php:437 +#: admin/support.php:455 msgid "readonly" msgstr "readonly" -#: admin/support.php:346 config/fieldvars.php:45 +#: admin/support.php:363 config/fieldvars.php:46 msgid "Nagios process file" msgstr "Nagios process file" -#: admin/support.php:361 admin/support.php:392 admin/support.php:415 -#: admin/support.php:444 admin/support.php:448 admin/support.php:465 -#: admin/support.php:493 -msgid "file is missed" -msgstr "file is missed" +#: admin/support.php:380 admin/support.php:411 +msgid "file is missed or not used" +msgstr "file is missed or not used" -#: admin/support.php:367 admin/support.php:397 +#: admin/support.php:386 admin/support.php:416 msgid "Nagios daemon is not running" msgstr "Nagios daemon is not running" -#: admin/support.php:372 admin/support.php:425 admin/support.php:469 +#: admin/support.php:391 admin/support.php:444 admin/support.php:488 msgid "not used with FTP" msgstr "not used with FTP" -#: admin/support.php:396 admin/support.php:410 admin/support.php:440 +#: admin/support.php:415 admin/support.php:429 admin/support.php:459 msgid "demon dead" msgstr "demon dead" -#: admin/support.php:402 config/fieldvars.php:43 +#: admin/support.php:421 config/fieldvars.php:44 msgid "Nagios command file" msgstr "Nagios command file" -#: admin/support.php:452 config/fieldvars.php:44 +#: admin/support.php:434 admin/support.php:463 admin/support.php:467 +#: admin/support.php:484 admin/support.php:510 +msgid "file is missed" +msgstr "file is missed" + +#: admin/support.php:471 config/fieldvars.php:45 msgid "Nagios binary file" msgstr "Nagios binary file" # mutdialog.php -#: admin/support.php:461 admin/support.php:485 +#: admin/support.php:480 admin/support.php:502 msgid "not executable" msgstr "not executable" # config_class.php -#: admin/support.php:501 +#: admin/support.php:517 msgid "Verify configuration files and demon configuration" msgstr "Verify configuration files and demon configuration" -#: admin/support.php:502 +#: admin/support.php:518 msgid "Configuration name" msgstr "Configuration name" # fieldvars.php -#: admin/support.php:503 +#: admin/support.php:519 msgid "Used in data domain" msgstr "Used in data domain" -#: admin/support.php:504 +#: admin/support.php:520 msgid "Included in demon configuration" msgstr "Included in demon configuration" -#: admin/support.php:587 +#: admin/support.php:604 msgid "not used" msgstr "not used" -#: admin/support.php:593 +#: admin/support.php:610 msgid "cfg definition missed" msgstr "cfg definition missed" -#: admin/support.php:611 admin/support.php:625 admin/support.php:636 +#: admin/support.php:628 admin/support.php:642 admin/support.php:653 msgid "cfg definition missed, but actually not used" msgstr "cfg definition missed, but actually not used" -#: admin/support.php:614 +#: admin/support.php:631 msgid "wrong base path:" msgstr "wrong base path:" -#: admin/support.php:643 +#: admin/support.php:660 msgid "cfg file not readable" msgstr "cfg file not readable" -#: admin/support.php:676 +#: admin/support.php:693 msgid "Not used" msgstr "Not used" -#: admin/support.php:678 +#: admin/support.php:695 msgid "unused - please delete!" msgstr "unused - please delete!" -#: admin/templatedefinitions.php:260 +#: admin/templatedefinitions.php:272 msgid "Up" msgstr "Up" -#: admin/templatedefinitions.php:264 +#: admin/templatedefinitions.php:278 msgid "Down" msgstr "Down" -#: admin/timedefinitions.php:176 admin/variabledefinitions.php:143 -#: config/fieldvars.php:77 +#: admin/timedefinitions.php:177 admin/variabledefinitions.php:156 +#: config/fieldvars.php:79 msgid "Modify" msgstr "Modify" -#: admin/timeperiods.php:62 +#: admin/timeperiods.php:111 msgid "New time period inserted:" msgstr "New time period inserted:" -#: admin/timeperiods.php:65 +#: admin/timeperiods.php:114 msgid "Time period modified:" msgstr "Time period modified:" -#: admin/timeperiods.php:173 admin/timeperiods.php:252 +#: admin/timeperiods.php:226 admin/timeperiods.php:294 msgid "Time period definitions (timeperiods.cfg)" msgstr "Time period definitions (timeperiods.cfg)" -#: admin/timeperiods.php:230 +#: admin/timeperiods.php:271 msgid "Please insert a time definition and a time range" msgstr "Please insert a time definition and a time range" # timeperiod.php -#: admin/timeperiods.php:253 config/fieldvars.php:92 +#: admin/timeperiods.php:295 config/fieldvars.php:95 msgid "Time period" msgstr "Time period" # tools.php -#: admin/tools.php:35 +#: admin/tools.php:37 msgid "Different tools" msgstr "Different tools" -#: admin/tools.php:36 +#: admin/tools.php:38 msgid "" "Useful functions for data import, main configuration, daemon control, etc." msgstr "" "Useful functions for data import, main configuration, daemon control, etc." -#: admin/user.php:74 +#: admin/user.php:109 msgid "New user added:" msgstr "New user added:" -#: admin/user.php:128 admin/user.php:176 +#: admin/user.php:155 admin/user.php:203 msgid "User administration" msgstr "User administration" -#: admin/user.php:132 +#: admin/user.php:159 msgid "The passwords do not match!" msgstr "The passwords do not match!" -#: admin/user.php:133 +#: admin/user.php:160 msgid "Please fill in the password" msgstr "Please fill in the password" -#: admin/user.php:134 +#: admin/user.php:161 msgid "The password is too short - use at least 6 characters!" msgstr "The password is too short - use at least 6 characters!" -#: admin/user.php:135 +#: admin/user.php:162 msgid "Webserver authentification" msgstr "Webserver authentification" -#: admin/user.php:177 config/fieldvars.php:24 index.php:51 +#: admin/user.php:204 config/fieldvars.php:24 index.php:53 msgid "Username" msgstr "Username" -#: admin/verify.php:50 admin/verify.php:157 functions/NagConfigClass.php:1115 -#: functions/NagConfigClass.php:1117 functions/NagConfigClass.php:1357 -#: functions/NagConfigClass.php:1359 +#: admin/verify.php:74 admin/verify.php:173 functions/NagConfigClass.php:1196 +#: functions/NagConfigClass.php:1198 functions/NagConfigClass.php:2506 +#: functions/NagConfigClass.php:2508 msgid "" "Writing of the configuration failed - no dataset or not activated dataset " "found" @@ -1737,81 +1762,73 @@ msgstr "" "Writing of the configuration failed - no dataset or not activated dataset " "found" -#: admin/verify.php:62 +#: admin/verify.php:86 msgid "Write host configurations" msgstr "Write host configurations" -#: admin/verify.php:69 admin/verify.php:91 +#: admin/verify.php:93 admin/verify.php:115 msgid "No configuration items defined!" msgstr "No configuration items defined!" -#: admin/verify.php:84 +#: admin/verify.php:108 msgid "Write service configurations" msgstr "Write service configurations" -#: admin/verify.php:102 admin/verify.php:117 admin/verify.php:132 -#: admin/verify.php:147 admin/verify.php:202 admin/verify.php:217 -#: admin/verify.php:232 admin/verify.php:247 admin/verify.php:262 -#: admin/verify.php:277 admin/verify.php:292 +#: admin/verify.php:125 admin/verify.php:138 admin/verify.php:151 +#: admin/verify.php:164 admin/verify.php:217 admin/verify.php:230 +#: admin/verify.php:243 admin/verify.php:256 admin/verify.php:269 +#: admin/verify.php:282 admin/verify.php:295 msgid "No dataset or no activated dataset found - empty configuration written" msgstr "No dataset or no activated dataset found - empty configuration written" -#: admin/verify.php:311 +#: admin/verify.php:313 msgid "Cannot find the Nagios binary or no execute permissions!" msgstr "Cannot find the Nagios binary or no execute permissions!" -#: admin/verify.php:326 +#: admin/verify.php:328 msgid "Remote execution (FTP SITE EXEC) is not supported on your system!" msgstr "Remote execution (FTP SITE EXEC) is not supported on your system!" -#: admin/verify.php:345 +#: admin/verify.php:346 msgid "Remote execution of nagios verify command failed (remote SSH)!" msgstr "Remote execution of nagios verify command failed (remote SSH)!" -#: admin/verify.php:350 +#: admin/verify.php:351 msgid "Nagios binary or configuration file not found (remote SSH)!" msgstr "Nagios binary or configuration file not found (remote SSH)!" -#: admin/verify.php:388 +#: admin/verify.php:387 msgid "Nagios daemon successfully restarted" msgstr "Nagios daemon successfully restarted" -#: admin/verify.php:390 +#: admin/verify.php:389 msgid "Restart command successfully send to Nagios" msgstr "Restart command successfully sent to Nagios" -#: admin/verify.php:394 admin/verify.php:402 +#: admin/verify.php:393 admin/verify.php:401 msgid "" "Restart failed - Nagios command file not found or no execute permissions" msgstr "" "Restart failed - Nagios command file not found or no execute permissions" -#: admin/verify.php:397 +#: admin/verify.php:396 msgid "Nagios command file not found or no write permissions!" msgstr "Nagios command file not found or no write permissions!" -#: admin/verify.php:404 +#: admin/verify.php:403 msgid "Restart failed - Nagios command file not found or no rights to execute" msgstr "" "Restart failed - Nagios command file not found or no execute permissions" -#: admin/verify.php:408 -msgid "Restart failed - Nagios daemon was not running" -msgstr "Restart failed - Nagios daemon was not running" - -#: admin/verify.php:410 -msgid "Nagios daemon is not running, cannot send restart command!" -msgstr "Nagios daemon is not running, cannot send restart command!" - -#: admin/verify.php:415 +#: admin/verify.php:407 msgid "Restart failed - FTP restrictions" msgstr "Restart failed - FTP restrictions" -#: admin/verify.php:417 +#: admin/verify.php:409 msgid "Nagios restart is not possible via FTP remote connection!" msgstr "Nagios restart is not possible via FTP remote connection!" -#: admin/verify.php:440 +#: admin/verify.php:431 msgid "" "Restart failed - Nagios command file not found or no rights to execute " "(remote SSH)!" @@ -1819,57 +1836,57 @@ msgstr "" "Restart failed - Nagios command file not found or no rights to execute " "(remote SSH)!" -#: admin/verify.php:443 +#: admin/verify.php:434 msgid "Nagios daemon successfully restarted (remote SSH)" msgstr "Nagios daemon successfully restarted (remote SSH)" -#: admin/verify.php:445 +#: admin/verify.php:436 msgid "Restart command successfully send to Nagios (remote SSH)" msgstr "Restart command successfully send to Nagios (remote SSH)" -#: admin/verify.php:450 +#: admin/verify.php:441 msgid "Nagios command file not found (remote SSH)!" msgstr "Nagios command file not found (remote SSH)!" -#: admin/verify.php:458 +#: admin/verify.php:448 msgid "Check written configuration files" msgstr "Check written configuration files" -#: admin/verify.php:459 +#: admin/verify.php:449 msgid "Check configuration files:" msgstr "Check configuration files:" -#: admin/verify.php:460 +#: admin/verify.php:450 msgid "Restart Nagios:" msgstr "Restart Nagios:" -#: admin/verify.php:461 +#: admin/verify.php:451 msgid "Write monitoring data" msgstr "Write monitoring data" -#: admin/verify.php:462 +#: admin/verify.php:452 msgid "Write additional data" msgstr "Write additional data" -#: admin/verify.php:464 +#: admin/verify.php:454 msgid "Warning, always check the configuration files before restarting Nagios!" msgstr "" "Warning, always check the configuration files before restarting Nagios!" -#: admin/verify.php:467 config/fieldvars.php:62 +#: admin/verify.php:457 config/fieldvars.php:63 msgid "Do it" msgstr "Do it" -#: admin/verify.php:498 admin/verify.php:542 +#: admin/verify.php:488 admin/verify.php:532 msgid "Nagios written configuration files checked - Warnings/Errors:" msgstr "Nagios written configuration files checked - Warnings/Errors:" # config_class.php -#: admin/verify.php:504 admin/verify.php:547 +#: admin/verify.php:494 admin/verify.php:537 msgid "Written configuration files are valid, Nagios can be restarted!" msgstr "Written configuration files are valid. Nagios can be restarted!" -#: admin/verify.php:510 +#: admin/verify.php:500 msgid "" "The configuration could not be tested successfully. The Nagios binary may " "have crashed during the test. Please repeat the test or try using the " @@ -1881,23 +1898,27 @@ msgstr "" "commandline to test. A running Nagios service should not be restarted " "because the configuration may be invalid." -#: admin/versioncheck.php:69 admin/versioncheck.php:79 +#: admin/versioncheck.php:90 msgid "check proxy settings" msgstr "check proxy settings" -#: admin/versioncheck.php:82 +#: admin/versioncheck.php:92 msgid "Installed" msgstr "Installed" -#: admin/versioncheck.php:84 config/fieldvars.php:187 +#: admin/versioncheck.php:94 config/fieldvars.php:190 msgid "Information" msgstr "Information" -#: admin/versioncheck.php:106 +#: admin/versioncheck.php:122 admin/versioncheck.php:125 msgid "You already have the latest version installed" msgstr "You already have the latest version installed" -#: admin/versioncheck.php:109 +#: admin/versioncheck.php:126 +msgid "new GIT hotfix version available:" +msgstr "new GIT hotfix version available:" + +#: admin/versioncheck.php:130 msgid "" "You are using an old NagiosQL version. Please update to the latest stable " "version" @@ -1905,16 +1926,16 @@ msgstr "" "You are using an old NagiosQL version. Please update to the latest stable " "version" -#: admin/versioncheck.php:114 +#: admin/versioncheck.php:135 msgid "You are using a newer development version without official support" msgstr "You are using a newer development version without official support" # fieldvars.php -#: config/fieldvars.php:20 functions/prepend_adm.php:538 +#: config/fieldvars.php:20 functions/prepend_adm.php:533 msgid "Domain" msgstr "Domain" -#: config/fieldvars.php:22 config/fieldvars.php:30 +#: config/fieldvars.php:22 config/fieldvars.php:31 msgid "Server name" msgstr "Server name" @@ -1922,711 +1943,727 @@ msgstr "Server name" msgid "Method" msgstr "Method" -#: config/fieldvars.php:25 index.php:52 +#: config/fieldvars.php:25 index.php:54 msgid "Password" msgstr "Password" -#: config/fieldvars.php:27 +#: config/fieldvars.php:26 +msgid "SSH Port number" +msgstr "SSH Port number" + +#: config/fieldvars.php:28 msgid "Directory with SSH key pair" msgstr "Directory with SSH key pair" -#: config/fieldvars.php:29 +#: config/fieldvars.php:30 msgid "Use encrypted FTP (FTPS)" msgstr "Use encrypted FTP (FTPS)" -#: config/fieldvars.php:32 +#: config/fieldvars.php:33 msgid "Configuration directories" msgstr "Configuration directories" -#: config/fieldvars.php:34 +#: config/fieldvars.php:35 msgid "Nagios configuration files and directories" msgstr "Nagios configuration files and directories" -#: config/fieldvars.php:35 +#: config/fieldvars.php:36 msgid "Base directory" msgstr "Base directory" -#: config/fieldvars.php:36 +#: config/fieldvars.php:37 msgid "Host directory" msgstr "Host directory" -#: config/fieldvars.php:37 +#: config/fieldvars.php:38 msgid "Service directory" msgstr "Service directory" -#: config/fieldvars.php:38 +#: config/fieldvars.php:39 msgid "Backup directory" msgstr "Backup directory" -#: config/fieldvars.php:39 +#: config/fieldvars.php:40 msgid "Host backup directory" msgstr "Host backup directory" -#: config/fieldvars.php:41 +#: config/fieldvars.php:42 msgid "Service backup directory" msgstr "Service backup directory" -#: config/fieldvars.php:42 +#: config/fieldvars.php:43 msgid "Picture base directory" msgstr "Picture base directory" -#: config/fieldvars.php:47 +#: config/fieldvars.php:48 msgid "Nagios cgi file" msgstr "Nagios cgi file" -#: config/fieldvars.php:48 +#: config/fieldvars.php:49 msgid "Nagios resource file" msgstr "Nagios resource file" -#: config/fieldvars.php:50 +#: config/fieldvars.php:51 msgid "Use common domain" msgstr "Use common domain" -#: config/fieldvars.php:52 +#: config/fieldvars.php:53 msgid "Decode UTF8 data in config files" msgstr "Decode UTF8 data in config files" -#: config/fieldvars.php:53 +#: config/fieldvars.php:54 msgid "Access key holes" msgstr "Access keyholes" # user.php -#: config/fieldvars.php:54 +#: config/fieldvars.php:55 msgid "Access keys" msgstr "Access keys" -#: config/fieldvars.php:56 +#: config/fieldvars.php:57 msgid "Registered" msgstr "Registered" -#: config/fieldvars.php:60 +#: config/fieldvars.php:61 msgid "Function" msgstr "Function" -#: config/fieldvars.php:61 +#: config/fieldvars.php:62 msgid "Marked" msgstr "Marked" -#: config/fieldvars.php:63 +#: config/fieldvars.php:64 msgid "Add" msgstr "Add" -#: config/fieldvars.php:64 +#: config/fieldvars.php:65 msgid "Form check" msgstr "Form check" -#: config/fieldvars.php:65 +#: config/fieldvars.php:66 msgid "Secure question" msgstr "Secure question" -#: config/fieldvars.php:66 functions/NagContentClass.php:172 -#: functions/NagContentClass.php:177 +#: config/fieldvars.php:67 functions/NagContentClass.php:167 +#: functions/NagContentClass.php:172 msgid "Yes" msgstr "Yes" -#: config/fieldvars.php:67 functions/NagContentClass.php:170 -#: functions/NagContentClass.php:175 +#: config/fieldvars.php:68 functions/NagContentClass.php:165 +#: functions/NagContentClass.php:170 msgid "No" msgstr "No" -#: config/fieldvars.php:68 +#: config/fieldvars.php:69 +msgid "All" +msgstr "All" + +#: config/fieldvars.php:70 msgid "Time" msgstr "Time" -#: config/fieldvars.php:69 +#: config/fieldvars.php:71 msgid "User" msgstr "User" -#: config/fieldvars.php:70 +#: config/fieldvars.php:72 msgid "IP Address" msgstr "IP Address" -#: config/fieldvars.php:71 functions/NagImportClass.php:350 -#: functions/NagImportClass.php:355 functions/NagImportClass.php:419 -#: functions/NagImportClass.php:425 functions/NagImportClass.php:432 -#: functions/NagImportClass.php:437 +#: config/fieldvars.php:73 functions/NagImportClass.php:354 +#: functions/NagImportClass.php:359 functions/NagImportClass.php:425 +#: functions/NagImportClass.php:431 functions/NagImportClass.php:438 +#: functions/NagImportClass.php:443 msgid "Entry" msgstr "Entry" -#: config/fieldvars.php:72 +#: config/fieldvars.php:74 msgid "From" msgstr "From" -#: config/fieldvars.php:73 +#: config/fieldvars.php:75 msgid "To" msgstr "To" -#: config/fieldvars.php:74 +#: config/fieldvars.php:76 msgid "Delete log entries" msgstr "Delete log entries" -#: config/fieldvars.php:75 config/fieldvars.php:88 config/fieldvars.php:184 +#: config/fieldvars.php:77 config/fieldvars.php:90 config/fieldvars.php:187 msgid "Copy" msgstr "Copy" -#: config/fieldvars.php:78 +#: config/fieldvars.php:80 msgid "Confirm password" msgstr "Confirm password" # password.php -#: config/fieldvars.php:79 +#: config/fieldvars.php:81 msgid "Old password" msgstr "Old password" -#: config/fieldvars.php:80 config/fieldvars.php:320 +#: config/fieldvars.php:82 config/fieldvars.php:324 msgid "New password" msgstr "New password" -#: config/fieldvars.php:81 +#: config/fieldvars.php:83 msgid "Change password" msgstr "Change password" -#: config/fieldvars.php:82 +#: config/fieldvars.php:84 msgid "Menu page" msgstr "Menu page" -#: config/fieldvars.php:83 +#: config/fieldvars.php:85 msgid "Search string" msgstr "Search string" -#: config/fieldvars.php:86 config/fieldvars.php:188 +#: config/fieldvars.php:88 config/fieldvars.php:191 msgid "Write config file" msgstr "Write config file" -#: config/fieldvars.php:89 +#: config/fieldvars.php:91 msgid "Command" msgstr "Command" -#: config/fieldvars.php:91 +#: config/fieldvars.php:93 msgid "Command type" msgstr "Command type" -#: config/fieldvars.php:93 +#: config/fieldvars.php:94 +msgid "Help text" +msgstr "Help text" + +#: config/fieldvars.php:96 msgid "Exclude" msgstr "Exclude" -#: config/fieldvars.php:94 +#: config/fieldvars.php:97 msgid "Include" msgstr "Include" -#: config/fieldvars.php:95 +#: config/fieldvars.php:98 msgid "Time definitions" msgstr "Time definitions" -#: config/fieldvars.php:96 +#: config/fieldvars.php:99 msgid "Weekday" msgstr "Weekday" -#: config/fieldvars.php:97 +#: config/fieldvars.php:100 msgid "Time range" msgstr "Time range" -#: config/fieldvars.php:98 +#: config/fieldvars.php:101 msgid "Time definition" msgstr "Time definition" -#: config/fieldvars.php:99 +#: config/fieldvars.php:102 msgid "Insert" msgstr "Insert" -#: config/fieldvars.php:100 +#: config/fieldvars.php:103 msgid "Modify selection" msgstr "Modify selection" -#: config/fieldvars.php:103 +#: config/fieldvars.php:106 msgid "Minimum importance" msgstr "Minimum importance" -#: config/fieldvars.php:104 +#: config/fieldvars.php:107 msgid "Time period hosts" msgstr "Time period hosts" -#: config/fieldvars.php:105 +#: config/fieldvars.php:108 msgid "Time period services" msgstr "Time period services" -#: config/fieldvars.php:106 +#: config/fieldvars.php:109 msgid "Host options" msgstr "Host options" -#: config/fieldvars.php:107 +#: config/fieldvars.php:110 msgid "Service options" msgstr "Service options" -#: config/fieldvars.php:108 +#: config/fieldvars.php:111 msgid "Host command" msgstr "Host command" -#: config/fieldvars.php:109 +#: config/fieldvars.php:112 msgid "Service command" msgstr "Service command" -#: config/fieldvars.php:110 +#: config/fieldvars.php:113 msgid "EMail address" msgstr "E-Mail address" -#: config/fieldvars.php:111 +#: config/fieldvars.php:114 msgid "Pager number" msgstr "Pager number" -#: config/fieldvars.php:112 +#: config/fieldvars.php:115 msgid "Addon address" msgstr "Addon address" -#: config/fieldvars.php:113 +#: config/fieldvars.php:116 msgid "Host notif. enable" msgstr "Host notif. enable" -#: config/fieldvars.php:114 +#: config/fieldvars.php:117 msgid "Service notif. enable" msgstr "Service notif. enable" -#: config/fieldvars.php:115 +#: config/fieldvars.php:118 msgid "Can submit commands" msgstr "Can submit commands" -#: config/fieldvars.php:116 +#: config/fieldvars.php:119 msgid "Retain status info" msgstr "Retain status info" -#: config/fieldvars.php:117 +#: config/fieldvars.php:120 msgid "Retain non-status info" msgstr "Retain non-status info" # contactgroups.php -#: config/fieldvars.php:118 +#: config/fieldvars.php:121 msgid "Members" msgstr "Members" -#: config/fieldvars.php:119 +#: config/fieldvars.php:122 msgid "Group members" msgstr "Group members" -#: config/fieldvars.php:120 +#: config/fieldvars.php:123 msgid "Common settings" msgstr "Common settings" -#: config/fieldvars.php:121 +#: config/fieldvars.php:124 msgid "Service settings" msgstr "Service settings" -#: config/fieldvars.php:123 +#: config/fieldvars.php:126 msgid "Add this host configuration to existing service definitions" msgstr "Add this host configuration to existing service definitions" -#: config/fieldvars.php:125 +#: config/fieldvars.php:128 msgid "Parents" msgstr "Parents" -#: config/fieldvars.php:126 +#: config/fieldvars.php:129 msgid "Parent services" msgstr "Parent services" -#: config/fieldvars.php:128 +#: config/fieldvars.php:131 msgid "Check command" msgstr "Check command" -#: config/fieldvars.php:129 +#: config/fieldvars.php:132 msgid "Command view" msgstr "Command view" -#: config/fieldvars.php:130 +#: config/fieldvars.php:133 msgid "Additional templates" msgstr "Additional templates" -#: config/fieldvars.php:131 +#: config/fieldvars.php:134 msgid "Check settings" msgstr "Check settings" -#: config/fieldvars.php:132 +#: config/fieldvars.php:135 msgid "Initial state" msgstr "Initial state" -#: config/fieldvars.php:133 +#: config/fieldvars.php:136 msgid "Retry interval" msgstr "Retry interval" -#: config/fieldvars.php:134 +#: config/fieldvars.php:137 msgid "Max check attempts" msgstr "Max. check attempts" -#: config/fieldvars.php:135 +#: config/fieldvars.php:138 msgid "Check interval" msgstr "Check interval" -#: config/fieldvars.php:136 +#: config/fieldvars.php:139 msgid "Active checks enabled" msgstr "Active checks enabled" -#: config/fieldvars.php:137 +#: config/fieldvars.php:140 msgid "Passive checks enabled" msgstr "Passive checks enabled" -#: config/fieldvars.php:138 +#: config/fieldvars.php:141 msgid "Check period" msgstr "Check period" -#: config/fieldvars.php:139 +#: config/fieldvars.php:142 msgid "Freshness treshold" msgstr "Freshness threshold" -#: config/fieldvars.php:140 +#: config/fieldvars.php:143 msgid "Check freshness" msgstr "Check freshness" -#: config/fieldvars.php:141 +#: config/fieldvars.php:144 msgid "Obsess over host" msgstr "Obsess over host" -#: config/fieldvars.php:142 +#: config/fieldvars.php:145 msgid "Obsess over service" msgstr "Obsess over service" -#: config/fieldvars.php:143 +#: config/fieldvars.php:146 msgid "Event handler" msgstr "Event handler" -#: config/fieldvars.php:144 +#: config/fieldvars.php:147 msgid "Event handler enabled" msgstr "Event handler enabled" -#: config/fieldvars.php:145 +#: config/fieldvars.php:148 msgid "Low flap threshold" msgstr "Low flap threshold" -#: config/fieldvars.php:146 +#: config/fieldvars.php:149 msgid "High flap threshold" msgstr "High flap threshold" -#: config/fieldvars.php:147 +#: config/fieldvars.php:150 msgid "Flap detection enabled" msgstr "Flap detection enabled" -#: config/fieldvars.php:148 +#: config/fieldvars.php:151 msgid "Flap detection options" msgstr "Flap detection options" -#: config/fieldvars.php:150 +#: config/fieldvars.php:153 msgid "Retain status information" msgstr "Retain status information" -#: config/fieldvars.php:152 +#: config/fieldvars.php:155 msgid "Retain non-status information" msgstr "Retain non-status information" -#: config/fieldvars.php:153 +#: config/fieldvars.php:156 msgid "Process perf data" msgstr "Process perf data" -#: config/fieldvars.php:154 +#: config/fieldvars.php:157 msgid "Alarm settings" msgstr "Alarm settings" -#: config/fieldvars.php:155 +#: config/fieldvars.php:158 msgid "Contacts" msgstr "Contacts" -#: config/fieldvars.php:157 +#: config/fieldvars.php:160 msgid "Notification period" msgstr "Notification period" -#: config/fieldvars.php:158 +#: config/fieldvars.php:161 msgid "Notification options" msgstr "Notification options" -#: config/fieldvars.php:159 +#: config/fieldvars.php:162 msgid "Notification interval" msgstr "Notification interval" -#: config/fieldvars.php:161 +#: config/fieldvars.php:164 msgid "First notification delay" msgstr "First notification delay" -#: config/fieldvars.php:162 +#: config/fieldvars.php:165 msgid "Notification enabled" msgstr "Notification enabled" -#: config/fieldvars.php:163 +#: config/fieldvars.php:166 msgid "Importance" msgstr "Importance" -#: config/fieldvars.php:164 +#: config/fieldvars.php:167 msgid "Stalking options" msgstr "Stalking options" -#: config/fieldvars.php:165 +#: config/fieldvars.php:168 msgid "Addon settings" msgstr "Addon settings" -#: config/fieldvars.php:167 +#: config/fieldvars.php:170 msgid "VRML image" msgstr "VRML image" -#: config/fieldvars.php:168 +#: config/fieldvars.php:171 msgid "Notes URL" msgstr "Notes URL" -#: config/fieldvars.php:169 +#: config/fieldvars.php:172 msgid "Status image" msgstr "Status image" -#: config/fieldvars.php:170 +#: config/fieldvars.php:173 msgid "Icon image" msgstr "Icon image" -#: config/fieldvars.php:171 +#: config/fieldvars.php:174 msgid "Action URL" msgstr "Action URL" -#: config/fieldvars.php:172 +#: config/fieldvars.php:175 msgid "2D coords" msgstr "2D coords" -#: config/fieldvars.php:173 +#: config/fieldvars.php:176 msgid "3D coords" msgstr "3D coords" -#: config/fieldvars.php:174 +#: config/fieldvars.php:177 msgid "Icon image ALT text" msgstr "Icon image ALT text" -#: config/fieldvars.php:175 +#: config/fieldvars.php:178 msgid "standard" msgstr "standard" -#: config/fieldvars.php:176 +#: config/fieldvars.php:179 msgid "on" msgstr "on" -#: config/fieldvars.php:177 +#: config/fieldvars.php:180 msgid "off" msgstr "off" -#: config/fieldvars.php:178 +#: config/fieldvars.php:181 msgid "skip" msgstr "skip" -#: config/fieldvars.php:180 +#: config/fieldvars.php:183 msgid "Free variable definitions" msgstr "Free variable definitions" -#: config/fieldvars.php:181 +#: config/fieldvars.php:184 msgid "Variable name" msgstr "Variable name" -#: config/fieldvars.php:182 +#: config/fieldvars.php:185 msgid "Variable value" msgstr "Variable value" -#: config/fieldvars.php:185 +#: config/fieldvars.php:188 msgid "Activate" msgstr "Activate" -#: config/fieldvars.php:186 +#: config/fieldvars.php:189 msgid "Deactivate" msgstr "Deactivate" -#: config/fieldvars.php:190 +#: config/fieldvars.php:193 msgid "Do you really want to delete this database entry:" msgstr "Do you really want to delete this database entry:" -#: config/fieldvars.php:192 +#: config/fieldvars.php:195 msgid "Do you really want to delete all marked entries?" msgstr "Do you really want to delete all marked entries?" -#: config/fieldvars.php:194 +#: config/fieldvars.php:197 msgid "Mark all shown datasets" msgstr "Mark all shown datasets" -#: config/fieldvars.php:195 +#: config/fieldvars.php:198 msgid "File" msgstr "File" -#: config/fieldvars.php:196 +#: config/fieldvars.php:199 msgid "Write all config files" msgstr "Write all config files" -#: config/fieldvars.php:197 +#: config/fieldvars.php:200 msgid "Address" msgstr "Address" -#: config/fieldvars.php:198 +#: config/fieldvars.php:201 msgid "Display name" msgstr "Display name" -#: config/fieldvars.php:200 +#: config/fieldvars.php:203 msgid "Use this configuration as a template" msgstr "Use this configuration as a template" -#: config/fieldvars.php:201 +#: config/fieldvars.php:204 msgid "Generic name" msgstr "Generic name" -#: config/fieldvars.php:208 +#: config/fieldvars.php:211 msgid "Please check at least one option from:" msgstr "Please check at least one option from:" -#: config/fieldvars.php:209 +#: config/fieldvars.php:212 msgid "Host group name" msgstr "Host group name" -#: config/fieldvars.php:210 +#: config/fieldvars.php:213 msgid "Host group members" msgstr "Host group members" -#: config/fieldvars.php:214 +#: config/fieldvars.php:217 msgid "Is volatile" msgstr "Is volatile" -#: config/fieldvars.php:215 +#: config/fieldvars.php:218 msgid "Parallelize checks" msgstr "Parallelize checks" -#: config/fieldvars.php:216 +#: config/fieldvars.php:219 msgid "Config name filter" msgstr "Config name filter" -#: config/fieldvars.php:218 +#: config/fieldvars.php:220 +msgid "Filter" +msgstr "Filter" + +#: config/fieldvars.php:223 msgid "Import directory" msgstr "Import directory" -#: config/fieldvars.php:220 +#: config/fieldvars.php:225 msgid "Please insert a variable name and a variable definition" msgstr "Please insert a variable name and a variable definition" -#: config/fieldvars.php:222 config/fieldvars.php:229 config/fieldvars.php:269 +#: config/fieldvars.php:227 config/fieldvars.php:234 config/fieldvars.php:274 msgid "Warning:" msgstr "Warning:" -#: config/fieldvars.php:222 +#: config/fieldvars.php:227 msgid "" -"You have not filled in some required fields!

If this values are set " +"You have not filled in some required fields!

If these values are set " "by a template, you can save anyway - otherwise you will get an invalid " "configuration!" msgstr "" -"You have not filled in some required fields!

If this values are set " +"You have not filled in some required fields!

If these values are set " "by a template, you can save anyway - otherwise you will get an invalid " "configuration!" -#: config/fieldvars.php:227 +#: config/fieldvars.php:232 msgid "Write config" msgstr "Write config" -#: config/fieldvars.php:229 +#: config/fieldvars.php:234 msgid "" "You have not filled in all command arguments (ARGx) for your selected " -"command!

If this arguments are optional, you can save anyway - " +"command!

If these arguments are optional, you can save anyway - " "otherwise you will get an invalid configuration!" msgstr "" "You have not filled in all command arguments (ARGx) for your selected " -"command!

If this arguments are optional, you can save anyway - " +"command!

If these arguments are optional, you can save anyway - " "otherwise you will get an invalid configuration!" -#: config/fieldvars.php:232 +#: config/fieldvars.php:237 msgid "Service group members" msgstr "Service group members" -#: config/fieldvars.php:233 +#: config/fieldvars.php:238 msgid "Service group name" msgstr "Service group name" -#: config/fieldvars.php:236 +#: config/fieldvars.php:241 msgid "Hostgroups" msgstr "Host groups" -#: config/fieldvars.php:237 +#: config/fieldvars.php:242 msgid "Inherit parents" msgstr "Inherit parents" -#: config/fieldvars.php:239 +#: config/fieldvars.php:244 msgid "Execution failure criteria" msgstr "Execution failure criteria" -#: config/fieldvars.php:241 +#: config/fieldvars.php:246 msgid "Nofification failure criteria" msgstr "Notification failure criteria" -#: config/fieldvars.php:242 +#: config/fieldvars.php:247 msgid "Dependency period" msgstr "Dependency period" -#: config/fieldvars.php:243 +#: config/fieldvars.php:248 msgid "Escalation period" msgstr "Escalation period" -#: config/fieldvars.php:244 +#: config/fieldvars.php:249 msgid "Escalation options" msgstr "Escalation options" -#: config/fieldvars.php:245 +#: config/fieldvars.php:250 msgid "First notification" msgstr "First notification" -#: config/fieldvars.php:246 +#: config/fieldvars.php:251 msgid "Last notification" msgstr "Last notification" -#: config/fieldvars.php:250 +#: config/fieldvars.php:255 msgid "Dependent servicegroups" msgstr "Dependent servicegroups" -#: config/fieldvars.php:251 +#: config/fieldvars.php:256 msgid "Help" msgstr "Help" -#: config/fieldvars.php:252 +#: config/fieldvars.php:257 msgid "Calendar" msgstr "Calendar" -#: config/fieldvars.php:253 +#: config/fieldvars.php:258 msgid "Group name" msgstr "Group name" -#: config/fieldvars.php:254 +#: config/fieldvars.php:259 msgid "Users" msgstr "Users" -#: config/fieldvars.php:255 +#: config/fieldvars.php:260 msgid "Access group" msgstr "Access group" -#: config/fieldvars.php:256 +#: config/fieldvars.php:261 msgid "User definitions" msgstr "User definitions" -#: config/fieldvars.php:257 +#: config/fieldvars.php:262 msgid "User name" msgstr "User name" -#: config/fieldvars.php:258 +#: config/fieldvars.php:263 msgid "User rights" msgstr "User rights" -#: config/fieldvars.php:260 +#: config/fieldvars.php:265 msgid "Object access restrictions" msgstr "Object access restrictions" -#: config/fieldvars.php:262 +#: config/fieldvars.php:267 msgid "Enable group administration" msgstr "Enable group administration" -#: config/fieldvars.php:263 +#: config/fieldvars.php:268 msgid "Show relation data" msgstr "Show relation data" -#: config/fieldvars.php:264 +#: config/fieldvars.php:269 msgid "Hide relation data" msgstr "Hide relation data" -#: config/fieldvars.php:266 +#: config/fieldvars.php:271 msgid "User language" msgstr "User language" -#: config/fieldvars.php:267 +#: config/fieldvars.php:272 msgid "Standard domain" msgstr "Standard domain" -#: config/fieldvars.php:269 +#: config/fieldvars.php:274 msgid "" "The associated services must be additionally written to the files. Only " "writing the host configuration is not sufficient because the modification is " @@ -2636,245 +2673,208 @@ msgstr "" "writing the host configuration is not sufficient because the modification is " "stored inside the service files!" -#: config/fieldvars.php:273 +#: config/fieldvars.php:278 msgid "Monday" msgstr "Monday" -#: config/fieldvars.php:274 +#: config/fieldvars.php:279 msgid "Tuesday" msgstr "Tuesday" -#: config/fieldvars.php:275 +#: config/fieldvars.php:280 msgid "Wednesday" msgstr "Wednesday" -#: config/fieldvars.php:276 +#: config/fieldvars.php:281 msgid "Thursday" msgstr "Thursday" -#: config/fieldvars.php:277 +#: config/fieldvars.php:282 msgid "Friday" msgstr "Friday" -#: config/fieldvars.php:278 +#: config/fieldvars.php:283 msgid "Saturday" msgstr "Saturday" -#: config/fieldvars.php:279 +#: config/fieldvars.php:284 msgid "Sunday" msgstr "Sunday" -#: config/fieldvars.php:291 +#: config/fieldvars.php:295 msgid "Main page" msgstr "Main page" -#: config/fieldvars.php:292 +#: config/fieldvars.php:296 msgid "Supervision" msgstr "Supervision" -#: config/fieldvars.php:295 +#: config/fieldvars.php:299 msgid "Commands" msgstr "Commands" -#: config/fieldvars.php:296 +#: config/fieldvars.php:300 msgid "Specialties" msgstr "Specialties" -#: config/fieldvars.php:297 +#: config/fieldvars.php:301 msgid "Tools" msgstr "Tools" -#: config/fieldvars.php:308 +#: config/fieldvars.php:312 msgid "Service dependency" msgstr "Service dependency" -#: config/fieldvars.php:309 +#: config/fieldvars.php:313 msgid "Service escalation" msgstr "Service escalation" -#: config/fieldvars.php:310 +#: config/fieldvars.php:314 msgid "Host dependency" msgstr "Host dependency" -#: config/fieldvars.php:311 +#: config/fieldvars.php:315 msgid "Host escalation" msgstr "Host escalation" -#: config/fieldvars.php:312 +#: config/fieldvars.php:316 msgid "Extended Host" msgstr "Extended Host" -#: config/fieldvars.php:313 +#: config/fieldvars.php:317 msgid "Extended Service" msgstr "Extended Service" -#: config/fieldvars.php:314 +#: config/fieldvars.php:318 msgid "Data import" msgstr "Data import" -#: config/fieldvars.php:317 +#: config/fieldvars.php:321 msgid "User admin" msgstr "User admin" -#: config/fieldvars.php:318 +#: config/fieldvars.php:322 msgid "Group admin" msgstr "Group admin" -#: config/fieldvars.php:319 +#: config/fieldvars.php:323 msgid "Nagios control" msgstr "Nagios control" -#: config/fieldvars.php:321 +#: config/fieldvars.php:325 msgid "Logbook" msgstr "Logbook" -#: config/fieldvars.php:322 +#: config/fieldvars.php:326 msgid "Nagios config" msgstr "Nagios config" -#: config/fieldvars.php:323 +#: config/fieldvars.php:327 msgid "Settings" msgstr "Settings" -#: config/fieldvars.php:324 +#: config/fieldvars.php:328 msgid "Definitions" msgstr "Definitions" -#: config/fieldvars.php:325 +#: config/fieldvars.php:329 msgid "CGI config" msgstr "CGI config" -#: config/fieldvars.php:326 +#: config/fieldvars.php:330 msgid "Menu access" msgstr "Menu access" -#: config/fieldvars.php:327 +#: config/fieldvars.php:331 msgid "Domains" msgstr "Domains" -#: config/fieldvars.php:331 +#: config/fieldvars.php:335 msgid "Help editor" msgstr "Help editor" # fieldvars.php -#: config/fieldvars.php:332 +#: config/fieldvars.php:336 msgid "Data domains" msgstr "Data domains" -#: config/fieldvars.php:333 +#: config/fieldvars.php:337 msgid "Config targets" msgstr "Config targets" -#: config/fieldvars.php:334 +#: config/fieldvars.php:338 msgid "Support" msgstr "Support" -#: functions/MysqliDbClass.php:291 +#: functions/MysqliDbClass.php:132 msgid "Missing server connection parameter!" msgstr "Missing server connection parameter!" -#: functions/MysqliDbClass.php:310 +#: functions/MysqliDbClass.php:151 msgid "Connection to the database server has failed by reason:" msgstr "Connection to the database server has failed by reason:" -#: functions/MysqliDbClass.php:338 +#: functions/MysqliDbClass.php:194 msgid "Missing database connection parameter!" msgstr "Missing database connection parameter!" -#: functions/MysqliDbClass.php:347 +#: functions/MysqliDbClass.php:206 msgid "Connection to the database has failed by reason:" msgstr "Connection to the database has failed by reason:" -#: functions/NagConfigClass.php:336 functions/NagConfigClass.php:338 +#: functions/MysqliDbClass.php:404 +msgid "Missing MySQL SSL parameter!" +msgstr "Missing MySQL SSL parameter!" + +#: functions/NagConfigClass.php:331 functions/NagConfigClass.php:333 msgid "Connection to remote system failed (FTP connection):" msgstr "Connection to remote system failed (FTP connection):" -#: functions/NagConfigClass.php:387 functions/NagConfigClass.php:389 +#: functions/NagConfigClass.php:407 functions/NagConfigClass.php:409 msgid "SSH public key does not exist or is not readable" msgstr "SSH public key does not exist or is not readable" -#: functions/NagConfigClass.php:394 functions/NagConfigClass.php:396 +#: functions/NagConfigClass.php:414 functions/NagConfigClass.php:416 msgid "SSH private key does not exist or is not readable" msgstr "SSH private key does not exist or is not readable" -#: functions/NagConfigClass.php:430 functions/NagConfigClass.php:432 -#: functions/NagConfigClass.php:441 functions/NagConfigClass.php:443 +#: functions/NagConfigClass.php:449 functions/NagConfigClass.php:451 +#: functions/NagConfigClass.php:460 functions/NagConfigClass.php:462 msgid "Connection to remote system failed (SSH2 connection):" msgstr "Connection to remote system failed (SSH2 connection):" -#: functions/NagConfigClass.php:600 -msgid "" -"Cannot backup the old file because the permissions are wrong - destination " -"file: " -msgstr "" -"Cannot backup the old file because the permissions are wrong - destination " -"file: " +#: functions/NagConfigClass.php:450 functions/NagConfigClass.php:452 +#: functions/NagConfigClass.php:461 functions/NagConfigClass.php:463 +msgid "port" +msgstr "port" -#: functions/NagConfigClass.php:605 -msgid "" -"Cannot backup the old file because the source file is missing - source file: " -msgstr "" -"Cannot backup the old file because the source file is missing - source file: " - -#: functions/NagConfigClass.php:623 -msgid "" -"Cannot backup the old file because the source file is missing (remote FTP) - " -"source file: " -msgstr "" -"Cannot backup the old file because the source file is missing (remote FTP) - " -"source file: " - -#: functions/NagConfigClass.php:629 -msgid "" -"Cannot backup the old file because the permissions are wrong (remote FTP) - " -"destination file: " -msgstr "" -"Cannot backup the old file because the permissions are wrong (remote FTP) - " -"destination file: " - -#: functions/NagConfigClass.php:648 -msgid "" -"Cannot backup the old file because the source file is missing (remote SFTP) " -"- source file: " -msgstr "" -"Cannot backup the old file because the source file is missing (remote SFTP) " -"- source file: " - -#: functions/NagConfigClass.php:654 -msgid "" -"Cannot backup the old file because the permissions are wrong (remote SFTP) - " -"destination file: " -msgstr "" -"Cannot backup the old file because the permissions are wrong (remote SFTP) - " -"destination file: " - -#: functions/NagConfigClass.php:685 +#: functions/NagConfigClass.php:552 msgid "Cannot delete the file (wrong permissions)!" msgstr "Cannot delete the file (wrong permissions)!" -#: functions/NagConfigClass.php:690 +#: functions/NagConfigClass.php:557 msgid "Cannot delete the file (file does not exist)!" msgstr "Cannot delete the file (file does not exist)!" -#: functions/NagConfigClass.php:706 +#: functions/NagConfigClass.php:573 msgid "Cannot delete file because it does not exists (remote FTP)!" msgstr "Cannot delete file because it does not exists (remote FTP)!" -#: functions/NagConfigClass.php:712 +#: functions/NagConfigClass.php:579 msgid "Cannot delete file because the permissions are incorrect (remote FTP)!" msgstr "Cannot delete file because the permissions are incorrect (remote FTP)!" -#: functions/NagConfigClass.php:724 +#: functions/NagConfigClass.php:591 msgid "Cannot delete file because it does not exists (remote SSH/SFTP)!" msgstr "Cannot delete file because it does not exists (remote SSH/SFTP)!" -#: functions/NagConfigClass.php:730 +#: functions/NagConfigClass.php:597 msgid "" "Cannot delete file because the permissions are incorrect (remote SSH/SFTP)!" msgstr "" "Cannot delete file because the permissions are incorrect (remote SSH/SFTP)!" -#: functions/NagConfigClass.php:822 functions/NagConfigClass.php:846 +#: functions/NagConfigClass.php:692 functions/NagConfigClass.php:716 msgid "" "Cannot get the remote file (it does not exist or is not readable) - remote " "file: " @@ -2882,23 +2882,23 @@ msgstr "" "Cannot get the remote file (it does not exist or is not readable) - remote " "file: " -#: functions/NagConfigClass.php:831 +#: functions/NagConfigClass.php:701 msgid "" "Cannot write the remote file (remote file is not writeable)- remote file: " msgstr "" "Cannot write the remote file (remote file is not writeable)- remote file: " -#: functions/NagConfigClass.php:849 +#: functions/NagConfigClass.php:719 msgid "Remote file is not readable - remote file: " msgstr "Remote file is not readable - remote file: " -#: functions/NagConfigClass.php:860 +#: functions/NagConfigClass.php:730 msgid "" "Cannot write a remote file (remote file is not writeable) - remote file: " msgstr "" "Cannot write a remote file (remote file is not writeable) - remote file: " -#: functions/NagConfigClass.php:866 +#: functions/NagConfigClass.php:736 msgid "" "Cannot copy a local file to remote because the local file does not exist or " "is not readable - local file: " @@ -2907,67 +2907,113 @@ msgstr "" "is not readable - local file: " # contacts.php -#: functions/NagConfigClass.php:894 +#: functions/NagConfigClass.php:764 msgid "Could not open directory" msgstr "Could not open directory" # config_class.php -#: functions/NagConfigClass.php:1003 functions/NagConfigClass.php:1006 +#: functions/NagConfigClass.php:873 functions/NagConfigClass.php:876 msgid "Warning: configuration file is out of date!" msgstr "Warning: configuration file is out of date!" -#: functions/NagConfigClass.php:1010 functions/NagConfigClass.php:1042 -#: functions/NagConfigClass.php:1108 +#: functions/NagConfigClass.php:880 functions/NagConfigClass.php:995 +#: functions/NagConfigClass.php:2499 msgid "Warning: no configuration target defined!" msgstr "Warning: no configuration target defined!" -#: functions/NagConfigClass.php:1030 functions/NagConfigClass.php:1076 +#: functions/NagConfigClass.php:983 functions/NagConfigClass.php:2466 msgid "" "It is not possible to write config files directly from the common domain!" msgstr "" "It is not possible to write config files directly from the common domain!" -#: functions/NagConfigClass.php:2069 +#: functions/NagConfigClass.php:2288 +msgid "" +"Cannot backup the old file because the permissions are wrong - destination " +"file: " +msgstr "" +"Cannot backup the old file because the permissions are wrong - destination " +"file: " + +#: functions/NagConfigClass.php:2293 +msgid "" +"Cannot backup the old file because the source file is missing - source file: " +msgstr "" +"Cannot backup the old file because the source file is missing - source file: " + +#: functions/NagConfigClass.php:2311 +msgid "" +"Cannot backup the old file because the source file is missing (remote FTP) - " +"source file: " +msgstr "" +"Cannot backup the old file because the source file is missing (remote FTP) - " +"source file: " + +#: functions/NagConfigClass.php:2317 +msgid "" +"Cannot backup the old file because the permissions are wrong (remote FTP) - " +"destination file: " +msgstr "" +"Cannot backup the old file because the permissions are wrong (remote FTP) - " +"destination file: " + +#: functions/NagConfigClass.php:2336 +msgid "" +"Cannot backup the old file because the source file is missing (remote SFTP) " +"- source file: " +msgstr "" +"Cannot backup the old file because the source file is missing (remote SFTP) " +"- source file: " + +#: functions/NagConfigClass.php:2342 +msgid "" +"Cannot backup the old file because the permissions are wrong (remote SFTP) - " +"destination file: " +msgstr "" +"Cannot backup the old file because the permissions are wrong (remote SFTP) - " +"destination file: " + +#: functions/NagConfigClass.php:2395 msgid "Cannot open/overwrite the configuration file (FTP connection failed)!" msgstr "Cannot open/overwrite the configuration file (FTP connection failed)!" -#: functions/NagConfigClass.php:2091 +#: functions/NagConfigClass.php:2417 msgid "Cannot open/overwrite the configuration file (remote SFTP)!" msgstr "Cannot open/overwrite the configuration file (remote SSH/SFTP)!" -#: functions/NagContentClass.php:251 +#: functions/NagContentClass.php:246 msgid "out-of-date" msgstr "out-of-date" -#: functions/NagContentClass.php:253 +#: functions/NagContentClass.php:248 msgid "no target" msgstr "no target" -#: functions/NagContentClass.php:256 functions/NagContentClass.php:259 +#: functions/NagContentClass.php:251 functions/NagContentClass.php:254 msgid "missed" msgstr "missed" -#: functions/NagContentClass.php:262 install/functions/NagInstallClass.php:479 +#: functions/NagContentClass.php:257 install/functions/NagInstallClass.php:323 msgid "up-to-date" msgstr "up-to-date" -#: functions/NagContentClass.php:355 +#: functions/NagContentClass.php:476 msgid "Last database update:" msgstr "Last database update:" -#: functions/NagContentClass.php:359 +#: functions/NagContentClass.php:480 msgid "Last file change of the configuration target " msgstr "Last file change of the configuration target " -#: functions/NagDataClass.php:267 functions/NagDataClass.php:269 +#: functions/NagDataClass.php:176 functions/NagDataClass.php:178 msgid "Data set copy failed - table [new name]:" msgstr "Data set copy failed - table [new name]:" -#: functions/NagDataClass.php:273 functions/NagDataClass.php:275 +#: functions/NagDataClass.php:182 functions/NagDataClass.php:184 msgid "Data set copied - table [new name]:" msgstr "Data set copied - table [new name]:" -#: functions/NagDataClass.php:295 functions/NagDataClass.php:300 +#: functions/NagDataClass.php:204 functions/NagDataClass.php:209 msgid "" "No dataset copied. Maybe the dataset does not exist or you do not have write " "permission." @@ -2976,11 +3022,11 @@ msgstr "" "permission." # data_class.php -#: functions/NagDataClass.php:393 functions/NagDataClass.php:422 +#: functions/NagDataClass.php:790 functions/NagDataClass.php:821 msgid "Delete failed because a database error:" msgstr "Delete failed due to a database error:" -#: functions/NagDataClass.php:397 +#: functions/NagDataClass.php:794 msgid "" "No data deleted. The dataset probably does not exist or is protected from " "deletion." @@ -2988,21 +3034,21 @@ msgstr "" "No data deleted. The dataset probably does not exist or is protected from " "deletion." -#: functions/NagDataClass.php:403 +#: functions/NagDataClass.php:800 msgid "Delete dataset id:" msgstr "Delete dataset id:" -#: functions/NagDataClass.php:403 +#: functions/NagDataClass.php:800 msgid "- from table:" msgstr "- from table:" -#: functions/NagDataClass.php:404 functions/NagDataClass.php:439 -#: functions/NagDataClass.php:614 functions/NagDataClass.php:963 -#: functions/NagDataClass.php:1020 +#: functions/NagDataClass.php:801 functions/NagDataClass.php:838 +#: functions/NagDataClass.php:1020 functions/NagDataClass.php:1379 +#: functions/NagDataClass.php:1437 msgid "- with affected rows:" msgstr "- with affected rows:" -#: functions/NagDataClass.php:432 functions/NagDataClass.php:443 +#: functions/NagDataClass.php:831 functions/NagDataClass.php:842 msgid "" "No data deleted. Probably the dataset does not exist or it is protected from " "delete." @@ -3010,11 +3056,11 @@ msgstr "" "No data deleted. The dataset probably does not exist or is protected from " "deletion." -#: functions/NagDataClass.php:438 functions/NagDataClass.php:613 +#: functions/NagDataClass.php:837 functions/NagDataClass.php:1019 msgid "Deleted data from table:" msgstr "Deleted data from table:" -#: functions/NagDataClass.php:603 +#: functions/NagDataClass.php:1009 msgid "" "No data deleted. Probably the dataset does not exist, it is protected from " "deletion, you do not have write permission or it has relations to other " @@ -3026,7 +3072,7 @@ msgstr "" "configurations which cannot be deleted. Use the \"info\" function for " "detailed informations about relations!" -#: functions/NagDataClass.php:619 +#: functions/NagDataClass.php:1025 msgid "" "No data deleted. Probably the dataset does not exist, it is protected from " "deletion or you do not have write permission." @@ -3034,36 +3080,36 @@ msgstr "" "No data deleted. Probably the dataset does not exist, it is protected from " "deletion or you do not have write permission." -#: functions/NagDataClass.php:691 +#: functions/NagDataClass.php:1097 msgid "Relation information for " msgstr "Relation information for " -#: functions/NagDataClass.php:692 +#: functions/NagDataClass.php:1098 msgid " of table " msgstr " of table " -#: functions/NagDataClass.php:747 functions/NagDataClass.php:752 -#: functions/NagDataClass.php:759 functions/NagDataClass.php:778 -#: functions/NagDataClass.php:784 +#: functions/NagDataClass.php:1157 functions/NagDataClass.php:1162 +#: functions/NagDataClass.php:1169 functions/NagDataClass.php:1189 +#: functions/NagDataClass.php:1195 msgid "Relation to " msgstr "Relation to " -#: functions/NagDataClass.php:748 functions/NagDataClass.php:753 -#: functions/NagDataClass.php:760 functions/NagDataClass.php:779 -#: functions/NagDataClass.php:785 +#: functions/NagDataClass.php:1158 functions/NagDataClass.php:1163 +#: functions/NagDataClass.php:1170 functions/NagDataClass.php:1190 +#: functions/NagDataClass.php:1196 msgid ", entry " msgstr ", entry " -#: functions/NagDataClass.php:749 functions/NagDataClass.php:761 -#: functions/NagDataClass.php:787 +#: functions/NagDataClass.php:1159 functions/NagDataClass.php:1171 +#: functions/NagDataClass.php:1198 msgid "deletion possible" msgstr "deletion possible" -#: functions/NagDataClass.php:755 functions/NagDataClass.php:781 +#: functions/NagDataClass.php:1165 functions/NagDataClass.php:1192 msgid "deletion not possible" msgstr "deletion not possible" -#: functions/NagDataClass.php:954 +#: functions/NagDataClass.php:1370 msgid "" "No dataset deactivated. Maybe the dataset does not exist, it is protected " "from deactivation, no dataset was selected or you do not have write " @@ -3075,15 +3121,15 @@ msgstr "" "permission. Use the \"info\" function for detailed informations about " "relations!" -#: functions/NagDataClass.php:960 +#: functions/NagDataClass.php:1376 msgid "Dataset successfully deactivated. Affected rows:" msgstr "Dataset successfully deactivated. Affected rows:" -#: functions/NagDataClass.php:962 +#: functions/NagDataClass.php:1378 msgid "Deactivate dataset from table:" msgstr "Deactivate dataset from table:" -#: functions/NagDataClass.php:967 +#: functions/NagDataClass.php:1383 msgid "" "No dataset deactivated. Maybe the dataset does not exist or you do not have " "write permission." @@ -3091,7 +3137,7 @@ msgstr "" "No dataset deactivated. Maybe the dataset does not exist or you do not have " "write permission." -#: functions/NagDataClass.php:1013 +#: functions/NagDataClass.php:1430 msgid "" "No dataset activated. Maybe the dataset does not exist, no dataset was " "selected or you do not have write permission." @@ -3099,15 +3145,15 @@ msgstr "" "No dataset activated. Maybe the dataset does not exist, no dataset was " "selected or you do not have write permission." -#: functions/NagDataClass.php:1017 +#: functions/NagDataClass.php:1434 msgid "Dataset successfully activated. Affected rows:" msgstr "Dataset successfully activated. Affected rows:" -#: functions/NagDataClass.php:1019 +#: functions/NagDataClass.php:1436 msgid "Activate dataset from table:" msgstr "Activate dataset from table:" -#: functions/NagDataClass.php:1024 +#: functions/NagDataClass.php:1441 msgid "" "No dataset activated. Maybe the dataset does not exist or you do not have " "write permission." @@ -3115,95 +3161,95 @@ msgstr "" "No dataset activated. Maybe the dataset does not exist or you do not have " "write permission." -#: functions/NagImportClass.php:162 +#: functions/NagImportClass.php:158 msgid "No valid configuration found:" msgstr "No valid configuration found:" -#: functions/NagImportClass.php:170 +#: functions/NagImportClass.php:166 msgid "Import file does not exist or is not readable:" msgstr "Import file does not exist or is not readable:" -#: functions/NagImportClass.php:202 +#: functions/NagImportClass.php:199 msgid "Unable to get configuration data:" msgstr "Unable to get configuration data:" -#: functions/NagImportClass.php:229 +#: functions/NagImportClass.php:226 msgid "Cannot receive the configuration file (FTP connection)!" msgstr "Cannot receive the configuration file (FTP connection)!" -#: functions/NagImportClass.php:252 +#: functions/NagImportClass.php:249 msgid "Cannot receive the configuration file (SSH connection)!" msgstr "Cannot receive the configuration file (SSH connection)!" -#: functions/NagImportClass.php:351 functions/NagImportClass.php:356 -#: functions/NagImportClass.php:420 functions/NagImportClass.php:426 -#: functions/NagImportClass.php:433 functions/NagImportClass.php:438 +#: functions/NagImportClass.php:355 functions/NagImportClass.php:360 +#: functions/NagImportClass.php:426 functions/NagImportClass.php:432 +#: functions/NagImportClass.php:439 functions/NagImportClass.php:444 msgid "inside" msgstr "inside" -#: functions/NagImportClass.php:352 +#: functions/NagImportClass.php:356 msgid "exists and were not overwritten" msgstr "exists and were not overwritten" -#: functions/NagImportClass.php:357 +#: functions/NagImportClass.php:361 msgid "were not written" msgstr "were not written" # contacts.php -#: functions/NagImportClass.php:421 functions/NagImportClass.php:427 +#: functions/NagImportClass.php:427 functions/NagImportClass.php:433 msgid "could not be inserted:" msgstr "could not be inserted:" -#: functions/NagImportClass.php:434 functions/NagImportClass.php:439 +#: functions/NagImportClass.php:440 functions/NagImportClass.php:445 msgid "successfully inserted" msgstr "successfully inserted" -#: functions/NagImportClass.php:564 +#: functions/NagImportClass.php:572 msgid "Table for import definition" msgstr "Table for import definition" # mutdialog.php -#: functions/NagImportClass.php:565 +#: functions/NagImportClass.php:573 msgid "is not available!" msgstr "is not available!" -#: functions/NagImportClass.php:1640 +#: functions/NagImportClass.php:1678 msgid "" "Error: incorrect number of arguments - cannot import service group members" msgstr "" "Error: incorrect number of arguments - cannot import service group members" -#: functions/NagImportClass.php:1868 +#: functions/NagImportClass.php:1918 msgid "" "Error: incorrect number of arguments - cannot import service parent members" msgstr "" "Error: incorrect number of arguments - cannot import service parent members" -#: functions/NagImportClass.php:1929 functions/NagImportClass.php:1934 +#: functions/NagImportClass.php:1980 functions/NagImportClass.php:1985 msgid "Error: cannot import the service parent member " msgstr "Error: cannot import the service parent member " -#: functions/NagImportClass.php:1931 +#: functions/NagImportClass.php:1982 msgid "This combination is not unique!" msgstr "This combination is not unique!" -#: functions/NagImportClass.php:1936 +#: functions/NagImportClass.php:1987 msgid "This combination is not unique or does not exist!" msgstr "This combination is not unique or does not exist!" -#: functions/NagVisualClass.php:227 +#: functions/NagVisualClass.php:131 msgid "Hide menu" msgstr "Hide menu" -#: functions/NagVisualClass.php:237 +#: functions/NagVisualClass.php:140 msgid "Show menu" msgstr "Show menu" -#: functions/NagVisualClass.php:272 +#: functions/NagVisualClass.php:316 msgid "Page" msgstr "Page" -#: functions/NagVisualClass.php:805 +#: functions/NagVisualClass.php:524 msgid "Unrestricted access" msgstr "Unrestricted access" @@ -3215,7 +3261,7 @@ msgstr "" "Error setting the correct locale. Please report this error with the " "associated output of 'locale -a' to bugs@nagiosql.org" -#: functions/prepend_adm.php:306 +#: functions/prepend_adm.php:305 msgid "Webserver login successfull" msgstr "Webserver login successfull" @@ -3231,23 +3277,23 @@ msgstr "Login failed!" msgid "Session timeout reached - Seconds:" msgstr "Session timeout reached - Seconds:" -#: functions/prepend_adm.php:402 +#: functions/prepend_adm.php:401 msgid "Restricted site accessed:" msgstr "Restricted site accessed:" -#: functions/prepend_adm.php:419 +#: functions/prepend_adm.php:418 msgid "User not found in database" msgstr "User not found in database" -#: functions/prepend_adm.php:548 +#: functions/prepend_adm.php:543 msgid "Logged in:" msgstr "Logged in:" -#: functions/prepend_adm.php:550 +#: functions/prepend_adm.php:545 msgid "Logout" msgstr "Logout" -#: functions/prepend_adm.php:573 +#: functions/prepend_adm.php:568 msgid "" "Warning - template file not found or not readable, please check your file " "permissions! - File: " @@ -3255,8 +3301,8 @@ msgstr "" "Warning - template file not found or not readable, please check your file " "permissions! - File: " -#: functions/prepend_content.php:258 functions/prepend_content.php:265 -#: functions/prepend_content.php:288 functions/prepend_content.php:295 +#: functions/prepend_content.php:301 functions/prepend_content.php:308 +#: functions/prepend_content.php:331 functions/prepend_content.php:338 msgid "" "Some configuration files were not written. Dataset not activated, not found " "or you do not have write permission!" @@ -3264,71 +3310,71 @@ msgstr "" "Some configuration files were not written. Dataset not activated, not found " "or you do not have write permission!" -#: functions/prepend_content.php:262 functions/prepend_content.php:292 +#: functions/prepend_content.php:305 functions/prepend_content.php:335 msgid "Configuration files successfully written!" msgstr "Configuration files successfully written!" -#: functions/prepend_content.php:321 +#: functions/prepend_content.php:364 msgid "Admin cannot be deleted" msgstr "Admin cannot be deleted" -#: functions/prepend_content.php:325 +#: functions/prepend_content.php:368 msgid "Localhost can't be deleted" msgstr "Localhost can't be deleted" -#: functions/prepend_content.php:502 +#: functions/prepend_content.php:548 msgid "No permission to open configuration!" msgstr "No permission to open configuration!" -#: functions/translator.php:63 install/functions/NagInstallClass.php:99 +#: functions/translator.php:56 install/functions/NagInstallClass.php:111 msgid "English" msgstr "English" -#: functions/translator.php:67 install/functions/NagInstallClass.php:103 +#: functions/translator.php:60 install/functions/NagInstallClass.php:115 msgid "German" msgstr "German" -#: functions/translator.php:71 install/functions/NagInstallClass.php:107 +#: functions/translator.php:64 install/functions/NagInstallClass.php:119 msgid "Chinese (Simplified)" msgstr "Chinese (Simplified)" -#: functions/translator.php:75 install/functions/NagInstallClass.php:111 +#: functions/translator.php:68 install/functions/NagInstallClass.php:123 msgid "Italian" msgstr "Italian" -#: functions/translator.php:79 install/functions/NagInstallClass.php:115 +#: functions/translator.php:72 install/functions/NagInstallClass.php:127 msgid "French" msgstr "French" -#: functions/translator.php:83 install/functions/NagInstallClass.php:119 +#: functions/translator.php:76 install/functions/NagInstallClass.php:131 msgid "Russian" msgstr "Russian" -#: functions/translator.php:87 install/functions/NagInstallClass.php:123 +#: functions/translator.php:80 install/functions/NagInstallClass.php:135 msgid "Spanish" msgstr "Spanish" -#: functions/translator.php:91 install/functions/NagInstallClass.php:127 +#: functions/translator.php:84 install/functions/NagInstallClass.php:139 msgid "Portuguese (Brazilian)" msgstr "Portuguese (Brazilian)" -#: functions/translator.php:95 install/functions/NagInstallClass.php:131 +#: functions/translator.php:88 install/functions/NagInstallClass.php:143 msgid "Dutch" msgstr "Dutch" -#: functions/translator.php:99 install/functions/NagInstallClass.php:135 +#: functions/translator.php:92 install/functions/NagInstallClass.php:147 msgid "Danish" msgstr "Danish" -#: index.php:47 +#: index.php:49 msgid "Welcome to" msgstr "Welcome to" -#: index.php:48 +#: index.php:50 msgid "Welcome" msgstr "Welcome" -#: index.php:49 +#: index.php:51 msgid "" "Please enter your username and password to access NagiosQL.
If you forgot " "one of them, please contact your Administrator." @@ -3336,41 +3382,41 @@ msgstr "" "Please enter your username and password to access NagiosQL.
If you forgot " "one of them, please contact your Administrator." -#: index.php:53 +#: index.php:55 msgid "Login" msgstr "Login" -#: install/functions/NagInstallClass.php:75 +#: install/functions/NagInstallClass.php:67 msgid "Template file not found" msgstr "Template file not found" -#: install/functions/NagInstallClass.php:336 -#: install/functions/NagInstallClass.php:368 +#: install/functions/NagInstallClass.php:182 +#: install/functions/NagInstallClass.php:214 msgid "passed" msgstr "passed" # prepend.adm -#: install/functions/NagInstallClass.php:358 +#: install/functions/NagInstallClass.php:204 msgid "Error while connecting to database:" msgstr "Error while connecting to database:" -#: install/functions/NagInstallClass.php:399 -#: install/functions/NagInstallClass.php:474 +#: install/functions/NagInstallClass.php:245 +#: install/functions/NagInstallClass.php:318 msgid "supported" msgstr "supported" -#: install/functions/NagInstallClass.php:401 +#: install/functions/NagInstallClass.php:247 msgid "not supported" msgstr "not supported" -#: install/functions/NagInstallClass.php:477 +#: install/functions/NagInstallClass.php:321 msgid "" "Your NagiosQL installation is up to date - no further actions are needed!" msgstr "" "Your NagiosQL installation is up to date - no further actions are needed!" -#: install/functions/NagInstallClass.php:483 -#: install/functions/NagInstallClass.php:491 +#: install/functions/NagInstallClass.php:327 +#: install/functions/NagInstallClass.php:335 msgid "" "Updates to NagiosQL 3.2 and above are only supported from NagiosQL 3.0.0 and " "above!" @@ -3379,116 +3425,116 @@ msgstr "" "above!" # prepend.adm -#: install/functions/NagInstallClass.php:489 +#: install/functions/NagInstallClass.php:333 msgid "Error while selecting settings table." msgstr "Error while selecting settings table." -#: install/functions/NagInstallClass.php:511 -#: install/functions/NagInstallClass.php:547 -#: install/functions/NagInstallClass.php:610 -#: install/functions/NagInstallClass.php:614 -#: install/functions/NagInstallClass.php:655 -#: install/functions/NagInstallClass.php:736 -#: install/functions/NagInstallClass.php:819 -#: install/functions/NagInstallClass.php:870 -#: install/functions/NagInstallClass.php:935 -#: install/functions/NagInstallClass.php:945 -#: install/functions/NagInstallClass.php:967 -#: install/functions/NagInstallClass.php:1015 -#: install/functions/NagInstallClass.php:1067 +#: install/functions/NagInstallClass.php:355 +#: install/functions/NagInstallClass.php:391 +#: install/functions/NagInstallClass.php:454 +#: install/functions/NagInstallClass.php:458 +#: install/functions/NagInstallClass.php:500 +#: install/functions/NagInstallClass.php:580 +#: install/functions/NagInstallClass.php:660 +#: install/functions/NagInstallClass.php:712 +#: install/functions/NagInstallClass.php:777 +#: install/functions/NagInstallClass.php:787 +#: install/functions/NagInstallClass.php:809 +#: install/functions/NagInstallClass.php:858 +#: install/functions/NagInstallClass.php:910 msgid "done" msgstr "done" -#: install/functions/NagInstallClass.php:538 +#: install/functions/NagInstallClass.php:382 msgid "Unsupported database type." msgstr "Unsupported database type." -#: install/functions/NagInstallClass.php:611 +#: install/functions/NagInstallClass.php:455 msgid "Only added rights to existing user" msgstr "Only added rights to existing user" # mutdialog.php -#: install/functions/NagInstallClass.php:641 +#: install/functions/NagInstallClass.php:486 msgid "No SQL update files available" msgstr "No SQL update files available" -#: install/functions/NagInstallClass.php:650 -#: install/functions/NagInstallClass.php:707 +#: install/functions/NagInstallClass.php:495 +#: install/functions/NagInstallClass.php:552 msgid "SQL file is not readable or empty" msgstr "SQL file is not readable or empty" -#: install/functions/NagInstallClass.php:778 -#: install/functions/NagInstallClass.php:785 -#: install/functions/NagInstallClass.php:813 +#: install/functions/NagInstallClass.php:619 +#: install/functions/NagInstallClass.php:626 +#: install/functions/NagInstallClass.php:653 msgid "Inserting initial data to settings database has failed:" msgstr "Inserting initial data to settings database has failed:" -#: install/functions/NagInstallClass.php:873 -msgid "Connot open/write to config/settings.php" -msgstr "Connot open/write to config/settings.php" +#: install/functions/NagInstallClass.php:715 +msgid "Cannot open/write to config/settings.php" +msgstr "Cannot open/write to config/settings.php" -#: install/functions/NagInstallClass.php:905 +#: install/functions/NagInstallClass.php:747 msgid "Inserting path data to database has failed:" msgstr "Inserting path data to database has failed:" -#: install/functions/NagInstallClass.php:936 +#: install/functions/NagInstallClass.php:778 msgid "Check the permissions of the created paths!" msgstr "Check the permissions of the created paths!" -#: install/functions/NagInstallClass.php:939 +#: install/functions/NagInstallClass.php:781 msgid "NagiosQL config path is not writeable - only database values updated" msgstr "NagiosQL config path is not writeable - only database values updated" # prepend.adm -#: install/functions/NagInstallClass.php:969 -#: install/functions/NagInstallClass.php:1017 -#: install/functions/NagInstallClass.php:1069 +#: install/functions/NagInstallClass.php:811 +#: install/functions/NagInstallClass.php:860 +#: install/functions/NagInstallClass.php:912 msgid "Database errors while converting to utf-8:" msgstr "Database errors while converting to utf-8:" -#: install/functions/NagInstallClass.php:1008 -#: install/functions/NagInstallClass.php:1060 install/step3.php:88 -#: install/step3.php:177 +#: install/functions/NagInstallClass.php:851 +#: install/functions/NagInstallClass.php:903 install/step3.php:96 +#: install/step3.php:185 msgid "Database type not defined!" msgstr "Database type not defined!" -#: install/index.php:69 +#: install/index.php:74 msgid "Online Documentation" msgstr "Online Documentation" -#: install/index.php:115 +#: install/index.php:119 msgid "Database connection failed. Upgrade not available!" msgstr "Database connection failed. Upgrade not available!" -#: install/index.php:122 +#: install/index.php:126 msgid "Settings table not available or wrong. Upgrade not available!" msgstr "Settings table not available or wrong. Upgrade not available!" -#: install/index.php:133 -msgid "" -"Invalid database type in settings file (config/settings.php). Upgrade not " -"available!" -msgstr "" -"Invalid database type in settings file (config/settings.php). Upgrade not " -"available!" - #: install/index.php:137 msgid "" -"Database values in settings file are missing (config/settings.php). Upgrade " -"not available!" +"Invalid database type in settings file (config/settings.php). Upgrade not " +"available!" msgstr "" -"Database values in settings file are missing (config/settings.php). Upgrade " -"not available!" +"Invalid database type in settings file (config/settings.php). Upgrade not " +"available!" #: install/index.php:141 msgid "" +"Database values in settings file are missing (config/settings.php). Upgrade " +"not available!" +msgstr "" +"Database values in settings file are missing (config/settings.php). Upgrade " +"not available!" + +#: install/index.php:145 +msgid "" "Settings file not found or not readable (config/settings.php). Upgrade not " "available!" msgstr "" "Settings file not found or not readable (config/settings.php). Upgrade not " "available!" -#: install/index.php:152 +#: install/index.php:156 msgid "" "Default values file is not available or not readable (install/functions/" "initial_settings.php). Installation possible, but without predefined data!" @@ -3496,23 +3542,23 @@ msgstr "" "Default values file is not available or not readable (install/functions/" "initial_settings.php). Installation possible, but without predefined data!" -#: install/index.php:159 +#: install/index.php:162 msgid "Installation wizard" msgstr "Installation wizard" -#: install/index.php:160 +#: install/index.php:163 msgid "Welcome to the NagiosQL installation wizard" msgstr "Welcome to the NagiosQL installation wizard" -#: install/index.php:161 +#: install/index.php:164 msgid "This wizard will help you to install and configure NagiosQL." msgstr "This wizard will help you to install and configure NagiosQL." -#: install/index.php:163 +#: install/index.php:165 msgid "For questions please visit" msgstr "For questions please visit" -#: install/index.php:164 +#: install/index.php:166 msgid "" "First let's check your local environment and find out if everything NagiosQL " "needs is available." @@ -3520,121 +3566,125 @@ msgstr "" "First let's check your local environment and find out if everything NagiosQL " "needs is available." -#: install/index.php:166 +#: install/index.php:167 msgid "The basic requirements are:" msgstr "The basic requirements are:" -#: install/index.php:167 -msgid "PHP 5.5.0 or greater including:" -msgstr "PHP 5.5.0 or greater including:" - #: install/index.php:168 +msgid "PHP 7.2.0 or above (PHP 8 is recommended) including:" +msgstr "PHP 7.2.0 or above (PHP 8 is recommended) including:" + +#: install/index.php:169 msgid "PHP database module:" msgstr "PHP database module:" -#: install/index.php:169 +#: install/index.php:170 msgid "supported types are" msgstr "supported types are" -#: install/index.php:174 install/index.php:176 +#: install/index.php:175 install/index.php:177 msgid "(optional)" msgstr "(optional)" -#: install/index.php:175 +#: install/index.php:176 msgid "PECL extension:" msgstr "PECL extension:" -#: install/index.php:177 +#: install/index.php:178 msgid "php.ini options" msgstr "php.ini options" -#: install/index.php:178 +#: install/index.php:179 msgid "file_uploads on (for upload features)" msgstr "file_uploads on (for upload features)" -#: install/index.php:179 +#: install/index.php:180 msgid "session.auto_start needs to be off" msgstr "session.auto_start needs to be off" -#: install/index.php:180 +#: install/index.php:181 +msgid "date.timezone should be set to your local timezone" +msgstr "date.timezone should be set to your local timezone" + +#: install/index.php:182 msgid "A database server" msgstr "A database server" -#: install/index.php:181 +#: install/index.php:183 msgid "Nagios 2.x/3.x/4.x" msgstr "Nagios 2.x/3.x/4.x" -#: install/index.php:182 +#: install/index.php:184 msgid "NagiosQL version" msgstr "NagiosQL version" -#: install/index.php:184 +#: install/index.php:186 msgid "Online documentation" msgstr "Online documentation" -#: install/index.php:188 +#: install/index.php:190 msgid "START INSTALLATION" msgstr "START INSTALLATION" -#: install/index.php:189 +#: install/index.php:191 msgid "START UPDATE" msgstr "START UPDATE" -#: install/install.php:214 +#: install/install.php:196 msgid "Welcome to the NagiosQL Installation Wizard" msgstr "Welcome to the NagiosQL Installation Wizard" -#: install/step1.php:74 install/step2.php:34 install/step3.php:38 +#: install/step1.php:79 install/step2.php:39 install/step3.php:47 msgid "Requirements" msgstr "Requirements" -#: install/step1.php:75 install/step1.php:77 install/step2.php:35 -#: install/step2.php:37 install/step3.php:39 install/step3.php:41 +#: install/step1.php:80 install/step1.php:82 install/step2.php:40 +#: install/step2.php:42 install/step3.php:48 install/step3.php:50 msgid "Installation" msgstr "Installation" -#: install/step1.php:76 install/step2.php:36 install/step3.php:40 -#: install/step3.php:301 +#: install/step1.php:81 install/step2.php:41 install/step3.php:49 +#: install/step3.php:308 msgid "Finish" msgstr "Finish" -#: install/step1.php:78 +#: install/step1.php:83 msgid "Checking requirements" msgstr "Checking requirements" -#: install/step1.php:79 +#: install/step1.php:84 msgid "Checking Client" msgstr "Checking Client" -#: install/step1.php:80 +#: install/step1.php:85 msgid "Checking PHP version" msgstr "Checking PHP version" -#: install/step1.php:81 +#: install/step1.php:86 msgid "Checking PHP extensions" msgstr "Checking PHP extensions" -#: install/step1.php:82 +#: install/step1.php:87 msgid "Checking available database interfaces" msgstr "Checking available database interfaces" -#: install/step1.php:83 +#: install/step1.php:88 msgid "Checking php.ini/.htaccess settings" msgstr "Checking php.ini/.htaccess settings" -#: install/step1.php:84 +#: install/step1.php:89 msgid "Checking System Permission" msgstr "Checking System Permissions" -#: install/step1.php:85 +#: install/step1.php:90 msgid "The following modules/extensions are required to run NagiosQL" msgstr "The following modules/extensions are required to run NagiosQL" -#: install/step1.php:87 +#: install/step1.php:91 msgid "The next couple of extensions are optional but recommended" msgstr "The next couple of extensions are optional but recommended" -#: install/step1.php:89 +#: install/step1.php:92 msgid "" "Check which of the supported extensions are installed. At least one of them " "is required." @@ -3642,19 +3692,19 @@ msgstr "" "Check which of the supported extensions are installed. At least one of them " "is required." -#: install/step1.php:91 +#: install/step1.php:93 msgid "The following settings are required to run NagiosQL" msgstr "The following settings are required to run NagiosQL" -#: install/step1.php:109 +#: install/step1.php:110 msgid "ENABLED" msgstr "ENABLED" -#: install/step1.php:114 +#: install/step1.php:115 msgid "NOT ENABLED" msgstr "NOT ENABLED" -#: install/step1.php:115 +#: install/step1.php:116 msgid "" "After enabling Javascript, the page must be updated twice so that the status " "changes" @@ -3662,36 +3712,37 @@ msgstr "" "After enabling Javascript, the page must be updated twice so that the status " "changes" -#: install/step1.php:120 +#: install/step1.php:121 msgid "Version" msgstr "Version" -#: install/step1.php:124 install/step1.php:140 install/step1.php:155 -#: install/step1.php:180 install/step1.php:208 install/step1.php:212 -#: install/step1.php:226 install/step1.php:236 install/step1.php:239 -#: install/step1.php:252 install/step1.php:261 install/step1.php:270 -#: install/step1.php:279 install/step1.php:288 install/step1.php:297 +#: install/step1.php:125 install/step1.php:149 install/step1.php:159 +#: install/step1.php:174 install/step1.php:199 install/step1.php:227 +#: install/step1.php:230 install/step1.php:243 install/step1.php:253 +#: install/step1.php:256 install/step1.php:269 install/step1.php:278 +#: install/step1.php:287 install/step1.php:296 install/step1.php:305 +#: install/step1.php:314 msgid "OK" msgstr "OK" -#: install/step1.php:125 install/step1.php:129 +#: install/step1.php:126 install/step1.php:130 msgid "detected" msgstr "detected" -#: install/step1.php:130 +#: install/step1.php:131 msgid "or greater is required" msgstr "or greater is required" -#: install/step1.php:143 install/step1.php:158 install/step1.php:187 -msgid "Could be loaded. Please add in php.ini" -msgstr "Could be loaded. Please add in php.ini" - -#: install/step1.php:145 install/step1.php:160 install/step1.php:189 -#: install/step1.php:204 +#: install/step1.php:152 install/step1.php:164 install/step1.php:179 +#: install/step1.php:208 install/step1.php:223 msgid "NOT AVAILABLE" msgstr "NOT AVAILABLE" -#: install/step1.php:177 +#: install/step1.php:162 install/step1.php:177 install/step1.php:206 +msgid "Could be loaded. Please add in php.ini" +msgstr "Could be loaded. Please add in php.ini" + +#: install/step1.php:196 msgid "" "New installation only - updates are only supported using the same database " "interface!" @@ -3699,60 +3750,60 @@ msgstr "" "New installation only - updates are only supported using the same database " "interface!" -#: install/step1.php:205 +#: install/step1.php:224 msgid "cannot be empty and needs to be set" msgstr "cannot be empty and needs to be set" -#: install/step1.php:214 +#: install/step1.php:232 msgid "should be" msgstr "should be" -#: install/step1.php:225 install/step1.php:228 +#: install/step1.php:242 install/step1.php:245 msgid "Read test on settings file (config/settings.php)" msgstr "Read test on settings file (config/settings.php)" -#: install/step1.php:231 +#: install/step1.php:248 msgid "Settings file does not exists (config/settings.php)" msgstr "Settings file does not exist (config/settings.php)" -#: install/step1.php:232 +#: install/step1.php:249 msgid "will be created" msgstr "will be created" -#: install/step1.php:235 install/step1.php:241 +#: install/step1.php:252 install/step1.php:258 msgid "Write test on settings file (config/settings.php)" msgstr "Write test on settings file (config/settings.php)" -#: install/step1.php:238 install/step1.php:245 +#: install/step1.php:255 install/step1.php:262 msgid "Write test on settings directory (config/)" msgstr "Write test on settings directory (config/)" -#: install/step1.php:251 install/step1.php:254 +#: install/step1.php:268 install/step1.php:271 msgid "Read test on one class file (functions/NagVisualClass.php)" msgstr "Read test on one class file (functions/NagVisualClass.php)" -#: install/step1.php:260 install/step1.php:263 +#: install/step1.php:277 install/step1.php:280 msgid "Read test on home page file (admin.php)" msgstr "Read test on home page file (admin.php)" -#: install/step1.php:269 install/step1.php:272 +#: install/step1.php:286 install/step1.php:289 msgid "Read test on one template file (templates/index.tpl.htm)" msgstr "Read test on one template file (templates/index.tpl.htm)" -#: install/step1.php:278 install/step1.php:281 +#: install/step1.php:295 install/step1.php:298 msgid "Read test on one admin template file (templates/admin/datalist.htm.tpl)" msgstr "" "Read test on one admin template file (templates/admin/datalist.htm.tpl)" -#: install/step1.php:287 install/step1.php:290 +#: install/step1.php:304 install/step1.php:307 msgid "Read test on one file template (templates/files/contacts.tpl.dat)" msgstr "Read test on one file template (templates/files/contacts.tpl.dat)" -#: install/step1.php:296 install/step1.php:299 +#: install/step1.php:313 install/step1.php:316 msgid "Read test on one image file (images/pixel.gif)" msgstr "Read test on one image file (images/pixel.gif)" -#: install/step1.php:304 +#: install/step1.php:321 msgid "" "There are some errors - please check your system settings and read the " "requirements of NagiosQL!" @@ -3760,7 +3811,7 @@ msgstr "" "There are some errors - please check your system settings and read the " "requirements for NagiosQL!" -#: install/step1.php:306 +#: install/step1.php:323 msgid "" "Read the INSTALLATION file in the NagiosQL doc directory or the installation " "PDF file on our" @@ -3768,123 +3819,123 @@ msgstr "" "Read the INSTALLATION file in the NagiosQL doc directory or the installation " "PDF file on our" -#: install/step1.php:310 +#: install/step1.php:327 msgid "online documentation" msgstr "online documentation" -#: install/step1.php:311 +#: install/step1.php:328 msgid "site to find out, how to fix them." msgstr "site to find out, how to fix them." -#: install/step1.php:312 +#: install/step1.php:329 msgid "After that - refresh this page to proceed" msgstr "After that - refresh this page to proceed" -#: install/step1.php:316 +#: install/step1.php:333 msgid "Refresh" msgstr "Refresh" -#: install/step1.php:318 +#: install/step1.php:335 msgid "Environment test completed successfully" msgstr "Environment test completed successfully" -#: install/step1.php:323 install/step2.php:94 +#: install/step1.php:340 install/step2.php:99 msgid "Next" msgstr "Next" -#: install/step2.php:32 +#: install/step2.php:37 msgid "The NagiosQL first passwords are not equal!" msgstr "The NagiosQL first passwords are not equal!" -#: install/step2.php:38 +#: install/step2.php:43 msgid "Setup" msgstr "Setup" -#: install/step2.php:39 +#: install/step2.php:44 msgid "Please complete the form below. Mandatory fields marked *" msgstr "Please complete the form below. Mandatory fields marked *" -#: install/step2.php:41 +#: install/step2.php:46 msgid "Database Configuration" msgstr "Database Configuration" -#: install/step2.php:42 +#: install/step2.php:47 msgid "Database Type" msgstr "Database Type" -#: install/step2.php:56 +#: install/step2.php:61 msgid "Database Server" msgstr "Database Server" -#: install/step2.php:58 +#: install/step2.php:63 msgid "Local hostname or IP address" msgstr "Local hostname or IP address" -#: install/step2.php:64 +#: install/step2.php:69 msgid "Database Server Port" msgstr "Database Server Port" -#: install/step2.php:68 +#: install/step2.php:73 msgid "NagiosQL DB User" msgstr "NagiosQL DB User" -#: install/step2.php:70 +#: install/step2.php:75 msgid "NagiosQL DB Password" msgstr "NagiosQL DB Password" -#: install/step2.php:72 +#: install/step2.php:77 msgid "Administrative Database User" msgstr "Administrative Database User" -#: install/step2.php:74 +#: install/step2.php:79 msgid "Administrative Database Password" msgstr "Administrative Database Password" -#: install/step2.php:75 +#: install/step2.php:80 msgid "Drop database if already exists?" msgstr "Drop database if already exists?" -#: install/step2.php:81 +#: install/step2.php:86 msgid "NagiosQL User Setup" msgstr "NagiosQL User Setup" -#: install/step2.php:82 +#: install/step2.php:87 msgid "Initial NagiosQL User" msgstr "Initial NagiosQL User" -#: install/step2.php:84 +#: install/step2.php:89 msgid "Initial NagiosQL Password" msgstr "Initial NagiosQL Password" -#: install/step2.php:86 +#: install/step2.php:91 msgid "Please repeat the password" msgstr "Please repeat the password" -#: install/step2.php:87 +#: install/step2.php:92 msgid "Nagios Configuration" msgstr "Nagios Configuration" -#: install/step2.php:88 +#: install/step2.php:93 msgid "Import Nagios sample config?" msgstr "Import Nagios sample config?" -#: install/step2.php:95 +#: install/step2.php:100 msgid "NagiosQL path values" msgstr "NagiosQL path values" -#: install/step2.php:96 +#: install/step2.php:101 msgid "Create NagiosQL config paths?" msgstr "Create NagiosQL config paths?" -#: install/step2.php:102 +#: install/step2.php:107 msgid "NagiosQL config path" msgstr "NagiosQL config path" -#: install/step2.php:104 +#: install/step2.php:109 msgid "Nagios config path" msgstr "Nagios config path" -#: install/step2.php:106 +#: install/step2.php:111 msgid "" "Both path values were stored in your configuration target settings for " "localhost." @@ -3892,7 +3943,7 @@ msgstr "" "Both path values were stored in your configuration target settings for " "localhost." -#: install/step2.php:108 +#: install/step2.php:113 msgid "" "If you select the create path option, be sure that the NagiosQL base path " "exist and the webserver demon has write access to it. So the installer will " @@ -3904,103 +3955,103 @@ msgstr "" "create the required subdirectories in your localhost's filesystem (hosts, " "services, backup etc.)" -#: install/step2.php:120 +#: install/step2.php:125 msgid "Please backup your database before proceeding!" msgstr "Please backup your database before proceeding!" -#: install/step3.php:42 +#: install/step3.php:51 msgid "Finishing Setup" msgstr "Finishing Setup" -#: install/step3.php:44 +#: install/step3.php:53 msgid "Deploy NagiosQL settings" msgstr "Deploy NagiosQL settings" -#: install/step3.php:45 +#: install/step3.php:54 msgid "Database server connection (privileged user)" msgstr "Database server connection (privileged user)" -#: install/step3.php:46 +#: install/step3.php:55 msgid "Database server version" msgstr "Database server version" -#: install/step3.php:47 +#: install/step3.php:56 msgid "Database server support" msgstr "Database server support" -#: install/step3.php:48 +#: install/step3.php:57 msgid "Delete existing NagiosQL database" msgstr "Delete existing NagiosQL database" -#: install/step3.php:49 +#: install/step3.php:58 msgid "Creating new database" msgstr "Creating new database" -#: install/step3.php:50 +#: install/step3.php:59 msgid "Installing NagiosQL database tables" msgstr "Installing NagiosQL database tables" -#: install/step3.php:51 +#: install/step3.php:60 msgid "Create NagiosQL database user" msgstr "Create NagiosQL database user" -#: install/step3.php:52 +#: install/step3.php:61 msgid "Set initial NagiosQL Administrator" msgstr "Set initial NagiosQL Administrator" -#: install/step3.php:53 +#: install/step3.php:62 msgid "Database server connection (NagiosQL user)" msgstr "Database server connection (NagiosQL user)" -#: install/step3.php:54 +#: install/step3.php:63 msgid "Writing global settings to database" msgstr "Writing global settings to database" -#: install/step3.php:55 +#: install/step3.php:64 msgid "Writing database configuration to settings.php" msgstr "Writing database configuration to settings.php" -#: install/step3.php:56 +#: install/step3.php:65 msgid "Import Nagios sample data" msgstr "Import Nagios sample data" -#: install/step3.php:57 +#: install/step3.php:66 msgid "Create and/or store NagiosQL path settings" msgstr "Create and/or store NagiosQL path settings" -#: install/step3.php:80 +#: install/step3.php:88 msgid "Updating existing NagiosQL database" msgstr "Updating existing NagiosQL database" -#: install/step3.php:113 +#: install/step3.php:121 msgid "Installed NagiosQL version" msgstr "Installed NagiosQL version" -#: install/step3.php:124 +#: install/step3.php:132 msgid "Upgrading from version" msgstr "Upgrading from version" -#: install/step3.php:125 +#: install/step3.php:133 msgid "to" msgstr "to" -#: install/step3.php:132 +#: install/step3.php:140 msgid "Converting database to utf8 character set" msgstr "Converting database to utf8 character set" -#: install/step3.php:138 +#: install/step3.php:146 msgid "Converting database tables to utf8 character set" msgstr "Converting database tables to utf8 character set" -#: install/step3.php:145 +#: install/step3.php:153 msgid "Converting database fields to utf8 character set" msgstr "Converting database fields to utf8 character set" -#: install/step3.php:169 +#: install/step3.php:177 msgid "Create new NagiosQL database" msgstr "Create new NagiosQL database" -#: install/step3.php:202 +#: install/step3.php:210 msgid "" "Database already exists and drop database was not selected, please correct " "or manage manually" @@ -4008,18 +4059,24 @@ msgstr "" "Database already exists and drop database was not selected, please correct " "or manage manually" -#: install/step3.php:218 +#: install/step3.php:226 msgid "unknown" msgstr "unknown" -#: install/step3.php:293 +#: install/step3.php:301 msgid "Back" msgstr "Back" -#: install/step3.php:298 +#: install/step3.php:305 msgid "Please delete the install directory to continue!" msgstr "Please delete the install directory to continue!" +#~ msgid "Restart failed - Nagios daemon was not running" +#~ msgstr "Restart failed - Nagios daemon was not running" + +#~ msgid "Nagios daemon is not running, cannot send restart command!" +#~ msgstr "Nagios daemon is not running, cannot send restart command!" + #~ msgid "Cgi config file" #~ msgstr "Cgi config file" diff --git a/config/locale/fr_FR/LC_MESSAGES/fr_FR.po b/config/locale/fr_FR/LC_MESSAGES/fr_FR.po index cd39f3f..eb43e57 100644 --- a/config/locale/fr_FR/LC_MESSAGES/fr_FR.po +++ b/config/locale/fr_FR/LC_MESSAGES/fr_FR.po @@ -3,7 +3,7 @@ # # Project : NagiosQL # # Component : Translation File English # # Website : https://sourceforge.net/projects/nagiosql/ -# # Version : 3.4.0 +# # Version : 3.4.1 # # GIT Repo : https://gitlab.com/wizonet/NagiosQL # # # ############################################################################# diff --git a/config/locale/it_IT/LC_MESSAGES/it_IT.po b/config/locale/it_IT/LC_MESSAGES/it_IT.po index 68792b1..6d3c024 100644 --- a/config/locale/it_IT/LC_MESSAGES/it_IT.po +++ b/config/locale/it_IT/LC_MESSAGES/it_IT.po @@ -3,7 +3,7 @@ # # Project : NagiosQL # # Component : Translation File English # # Website : https://sourceforge.net/projects/nagiosql/ -# # Version : 3.4.0 +# # Version : 3.4.1 # # GIT Repo : https://gitlab.com/wizonet/NagiosQL # # # ############################################################################# diff --git a/config/locale/ja_JP/LC_MESSAGES/ja_JP.po b/config/locale/ja_JP/LC_MESSAGES/ja_JP.po index 69e098f..446fe41 100644 --- a/config/locale/ja_JP/LC_MESSAGES/ja_JP.po +++ b/config/locale/ja_JP/LC_MESSAGES/ja_JP.po @@ -3,7 +3,7 @@ # # Project : NagiosQL # # Component : Translation File English # # Website : https://sourceforge.net/projects/nagiosql/ -# # Version : 3.4.0 +# # Version : 3.4.1 # # GIT Repo : https://gitlab.com/wizonet/NagiosQL # # # ############################################################################# diff --git a/config/main.css b/config/main.css index 93528a9..71ba369 100644 --- a/config/main.css +++ b/config/main.css @@ -1,230 +1,262 @@ @charset "utf-8"; -/*///////////////////////////////////////////////////////////////////////////// -// -// NagiosQL -// -/////////////////////////////////////////////////////////////////////////////// -// -// (c) 2005-2018 by Martin Willisegger -// -// Project : NagiosQL -// Component : CSS Main definition -// Website : https://sourceforge.net/projects/nagiosql/ -// Version : 3.4.0 -// GIT Repo : https://gitlab.com/wizonet/NagiosQL -// -/////////////////////////////////////////////////////////////////////////////*/ +/* ---------------------------------------------------------------------------- + NagiosQL +------------------------------------------------------------------------------- + (c) 2005-2022 by Martin Willisegger + + Project : NagiosQL + Component : CSS Main definition + Website : https://sourceforge.net/projects/nagiosql/ + Version : 3.5.0 + GIT Repo : https://gitlab.com/wizonet/NagiosQL +-----------------------------------------------------------------------------*/ body { - font-family: Arial, Helvetica, sans-serif; - background-color: #FFFFFF; - margin: 0; - padding: 0; - font-size: 12px; + font-family: Arial, Helvetica, sans-serif; + background-color: #FFFFFF; + margin: 0; + padding: 0; + font-size: 12px; } + #login { - text-align: center; - margin:0 auto; - max-width:80em; - min-width:740px; + text-align: center; + margin: 0 auto; + max-width: 80em; + min-width: 740px; } + /************************/ /** HEADER definitions */ /************************/ .header { - background: #FFFFFF url(../images/bg_top.png) repeat-x right top; + background: #FFFFFF url(../images/bg_top.png) repeat-x right top; } + .headerleft { - vertical-align: bottom; - text-align: left; - padding-left: 10px; + vertical-align: bottom; + text-align: left; + padding-left: 10px; } + .headerleft a { - color: #002C52; - background-color: #FFFFFF; -} + color: #002C52; + background-color: #FFFFFF; +} + .headerleft a:hover { - color: #002C52; - background-color: #E5E9ED ; + color: #002C52; + background-color: #E5E9ED; } + .headerleft a:active { - color: #002C52; - background-color: #E5E9ED ; -} + color: #002C52; + background-color: #E5E9ED; +} + .top-link { - color: #002C52; - font-size: 10pt; - text-decoration: none; - font-weight: bold; - background-color: #FFFFFF; - padding: 2px 3px 0 3px; - border-top:1px solid #002C52; - border-left:1px solid #002C52; - border-right:1px solid #002C52; -} + color: #002C52; + font-size: 10pt; + text-decoration: none; + font-weight: bold; + background-color: #FFFFFF; + padding: 2px 3px 0 3px; + border-top: 1px solid #002C52; + border-left: 1px solid #002C52; + border-right: 1px solid #002C52; +} + .headermiddle { - vertical-align: bottom; - height: 40px; - width: 200px; + vertical-align: bottom; + height: 40px; + width: 200px; } + .headerright { - text-align: right; - vertical-align: bottom; - padding-right: 20px; + text-align: right; + vertical-align: bottom; + padding-right: 20px; } + .infoleft { - vertical-align: middle; - text-align: left; - font-size: 10px ; - padding-left: 20px; + vertical-align: middle; + text-align: left; + font-size: 10px; + padding-left: 20px; } + .inforight { - width:200px; - vertical-align: middle; - text-align: right; - font-size: 10px; - padding: 4px 20px 4px 4px; + width: 200px; + vertical-align: middle; + text-align: right; + font-size: 10px; + padding: 4px 20px 4px 4px; } + .inforight2 { - vertical-align: middle; - text-align: right; - font-size: 10px; -} + vertical-align: middle; + text-align: right; + font-size: 10px; +} + /********************/ /** Formatierungen */ /********************/ -h1,h2,h3 { - color: #0c4271; - margin-top: 0; +h1, h2, h3 { + color: #0c4271; + margin-top: 0; } + h1 { - text-align: left; - font-size: 22px; + text-align: left; + font-size: 22px; } + h2 { - font-size: 14px; + font-size: 14px; } + h3 { - font-size: 14px; - font-style:italic; + font-size: 14px; + font-style: italic; } + /********************/ /** Menu **********/ /********************/ .menutable { - margin: 0; - padding: 0; - border: none; - text-align:left; + margin: 0; + padding: 0; + border: none; + text-align: left; } + .menutable a { - text-decoration: none; - color: #666666; + text-decoration: none; + color: #666666; } + .menutable a:hover { - color: #FF00FF; + color: #FF00FF; } /*noinspection ALL*/ .menutable .menu_act { - color: #FF0000; - font-size: 12px; - font-weight: bold; - padding-left: 20px; - height: 20px; - background: url(../images/bg_menu_aktiv.png) repeat-x left top; - width: 140px; + color: #FF0000; + font-size: 12px; + font-weight: bold; + padding-left: 20px; + height: 20px; + background: url(../images/bg_menu_aktiv.png) repeat-x left top; + width: 140px; } + .menutable .menu_act a { - color: #00396a; + color: #00396a; } + .menutable .menu_act a:hover { - color: #00396a; + color: #00396a; } + .menutable .menu { - color: #FFFFFF; - font-size: 12px; - font-weight: bold; - padding-left: 20px; - height: 20px; - background: url(../images/bg_menu_inaktiv.png) repeat-x left top; - width: 140px; + color: #FFFFFF; + font-size: 12px; + font-weight: bold; + padding-left: 20px; + height: 20px; + background: url(../images/bg_menu_inaktiv.png) repeat-x left top; + width: 140px; } + .menutable .menu a { - color: #d6d6d6; + color: #d6d6d6; } + .menutable .menu a:hover { - color: #FFFFFF; + color: #FFFFFF; } /*noinspection ALL*/ .menutable .menu_sub { - font-size: 11px; - color: #666666; - text-decoration: none; - height: 5px; - padding-left: 30px; - background: #FFFFFF url(../images/bg_submenu.png) repeat-y left top; + font-size: 11px; + color: #666666; + text-decoration: none; + height: 5px; + padding-left: 30px; + background: #FFFFFF url(../images/bg_submenu.png) repeat-y left top; } + .menutable .menu_sub a { - color: #666666; + color: #666666; } + .menutable .menu_sub a:hover { - color: #666666; - text-decoration: underline; + color: #666666; + text-decoration: underline; } /*noinspection ALL*/ .menutable .menu_sub_act { - font-size: 11px; - font-weight: bold; - color: #666666; - text-decoration: none; - height: 5px; - padding-left: 30px; - background: #FFFFFF url(../images/bg_submenu.png) repeat-y left top; + font-size: 11px; + font-weight: bold; + color: #666666; + text-decoration: none; + height: 5px; + padding-left: 30px; + background: #FFFFFF url(../images/bg_submenu.png) repeat-y left top; } + .menutable .menu_sub_act a { - color: #666666; + color: #666666; } + .menutable .menu_sub_act a:hover { - color: #666666; - text-decoration: underline; + color: #666666; + text-decoration: underline; } + .menulinksmall { - font-size: 10px; - color: #666666; - text-decoration: none; + font-size: 10px; + color: #666666; + text-decoration: none; } + /************************/ /** YUI definitions */ /************************/ #cal-cont .bd:after { - content:"."; - display:block; - clear:left; - height:0; - visibility:hidden; + content: "."; + display: block; + clear: left; + height: 0; + visibility: hidden; } + #cal-cont .bd { - padding:0; + padding: 0; } + #cal-cont2 .bd:after { - content:"."; - display:block; - clear:left; - height:0; - visibility:hidden; + content: "."; + display: block; + clear: left; + height: 0; + visibility: hidden; } + #cal-cont2 .bd { - padding:0; + padding: 0; } + #cal { - border:none; - padding:1em + border: none; + padding: 1em } + .yui-content input[type="radio"] { - background-color:#EDF5FF; + background-color: #EDF5FF; } + .yui-content input[type="checkbox"] { - background-color:#EDF5FF; + background-color: #EDF5FF; } \ No newline at end of file diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 785d58e..1f55e4d 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -1,3 +1,37 @@ +CHANGELOG 3.5.0 +--------------- +- Support for PHP 8.x +- Support for PHP < 7.2 dropped +- [Bugfix] hosttemplate don't use "importance" in Nagios configuration version < 4.0 + +CHANGELOG 3.4.1 +--------------- +- New setting to disable parent objects to optimize performance +- New filter function for active and registered in supervision objects +- New optional help text for command arguments ARG1 - ARG8 +- A config target now supports different port numbers for SSH/SFTP +- [Bugfix] error page after installation and login when using https protocol +- [Bugfix] timeperiod exclude and include function +- [Bugfix] free variables supports special chars +- [Bugfix] misc- and check commands now support special chars +- Include all 3.4.0 hotfixes from GIT up to 2019-12-04 + o Add GIT version number on support page and version check + o Nagios 4.0 update for mandatory fields + o [Bugfix] Missing PEAR path in scripting interface + o [Bugfix] Allowing special characters in ARG fields + o [Bugfix] Object copy after changing domain (config_id not set correctly) + o [Bugfix] Quote settings data für special chars in database password + o [Bugfix] Inserting time definitions when Nagios 3.x is selected in data domain + o [Bugfix] Object search and row sorting + o [Bugfix] Page numbers in service extinfo + o [Bugfix] Fixed some ancient bug in an error message of time periods + o [Bugfix] Nagios 4.0 update for mandatory fields + o [Bugfix] PHP5 compatibility update + o [Bugfix] Allowing quotes in arguments + o [Bugfix] Variable bug in downloads.php + o [Bugfix] Host copy bug fixed + o [Bugfix] Additional security hardening + CHANGELOG 3.4.0 --------------- - Support for PHP 7.x (developped and tested with PHP 7.2.4) @@ -13,22 +47,22 @@ CHANGELOG 3.4.0 CHANGELOG 3.3.0 --------------- -- [OK] Support for PHP version 7.0 (not 7.1 or higher) -- [OK] Database interface changed from mysql to mysqli +- Support for PHP version 7.0 (not 7.1 or higher) +- Database interface changed from mysql to mysqli CHANGELOG 3.2.0 --------------- -- [OK] Enable/Disable regardless of register -- [OK] HTML reworking -- [OK] Domain separation (Data / Configuration) -- [OK] Additional user settings +- Enable/Disable regardless of register +- HTML reworking +- Domain separation (Data / Configuration) +- Additional user settings o Language o Standard domain -- [OK] Better HTML/CSS implementation for IE (scroll fields) -- [OK] Configuration name is stored as free variable inside the configuration file -- [OK] New support page with additional checks -- [OK] New/reworked installer -- [OK] Servicegroup support for servicedependencies and serviceescalations -- [OK][BUG] Reworked service selection in servicedependencies and serviceescalations -- [OK][BUG] Reworked right management (menu access / read rights) +- Better HTML/CSS implementation for IE (scroll fields) +- Configuration name is stored as free variable inside the configuration file +- New support page with additional checks +- New/reworked installer +- Servicegroup support for servicedependencies and serviceescalations +- [Bugfix] Reworked service selection in servicedependencies and serviceescalations +- [Bugfix] Reworked right management (menu access / read rights) diff --git a/doc/INSTALLATION_deDE.txt b/doc/INSTALLATION_deDE.txt index 0da2e39..fca46f7 100644 --- a/doc/INSTALLATION_deDE.txt +++ b/doc/INSTALLATION_deDE.txt @@ -4,12 +4,12 @@ // /////////////////////////////////////////////////////////////////////////////// // -// (c) 2005-2018 by Martin Willisegger +// (c) 2005-2022 by Martin Willisegger // // Project : NagiosQL // Component : Installations HowTo // Website : https://sourceforge.net/projects/nagiosql/ -// Version : 3.4.0 +// Version : 3.5.0 // GIT Repo : https://gitlab.com/wizonet/NagiosQL // /////////////////////////////////////////////////////////////////////////////// @@ -21,7 +21,7 @@ * Webserver z.B. Apache 2.x * MySQL/MariaDB 5.x oder neuer * Nagios 2.x/3.x/4.x oder Nagios kompatible Monitoringsoftware - * PHP 5.5.0 oder groesser, inklusive: + * PHP 7.2.0 oder groesser, inklusive: * PHP Module: Session * PHP Module: MySQLi * PHP Module: gettext @@ -31,11 +31,26 @@ * Javascript im Webbrowser zugelassen * Empfohlener Webbrowser: Mozilla Firefox +============================================== += Installation der ssh2 Erweiterung mit PHP8 = +============================================== +Benötigte RPM/Software: + * php8-pecl + * php8-devel + * libssh2-devel + * make + +Installation mit: +# pecl install ssh2-1.3.1 + +Konfiguration in php.ini: +extension=ssh2 + =================== = Neuinstallation = =================== - 1. Download und entpacken von NagiosQL 3.4 in einem Apache zugaenglichen Verzeichnis. + 1. Download und entpacken von NagiosQL 3.5 in einem Apache zugaenglichen Verzeichnis. 2. Der Installationsassistent wird automatisch durch Eingabe von install/index.php gestartet. 3. Die gewuenschte Sprache auswaehlen (siehe Appendix 2.) 4. Zum Installieren von NagiosQL den Anweisungen folgen. @@ -47,11 +62,11 @@ 1. Aktualisierungen von NagiosQL 1.x und 2.x sind leider nicht moeglich, bitte einfach eine neue Installation starten und dann die Nagios Konfiguration durch den Import einbinden. 2. Aktualisierungen von NagiosQL 3.x - a. Download und entpacken von NagiosQL 3.4 in ein NEUES Apache zugaenglichen Verzeichnis (DocumentRoot auf neues Verzeichnis + a. Download und entpacken von NagiosQL 3.5 in ein NEUES Apache zugaenglichen Verzeichnis (DocumentRoot auf neues Verzeichnis aendern) b. Wird dieselbe Apachekonfiguration verwendet (altes NagiosQL Verzeichnis wegkopieren, neues NagiosQL Verzeichnis bekommt denselben Namen), sollte der Apache Demon vor dem Upgrade neu gestartet werden. - c. Verschiebe die alte config/settings.php Datei in das neue NagiosQL 3.4 Verzeichnis config/ + c. Verschiebe die alte config/settings.php Datei in das neue NagiosQL 3.5 Verzeichnis config/ d. Die alte Datenbank manuell sichern (z.Bsp. mit mysqldump) e. Der Installationsassistent wird durch den Aufruf von install/index.php gestartet f. Die gewuenschte Sprache waehlen (siehe auch Appendix 1.) und den Anweisungen folgen diff --git a/doc/INSTALLATION_enGB.txt b/doc/INSTALLATION_enGB.txt index 0a87d5b..02da545 100644 --- a/doc/INSTALLATION_enGB.txt +++ b/doc/INSTALLATION_enGB.txt @@ -4,12 +4,12 @@ // /////////////////////////////////////////////////////////////////////////////// // -// (c) 2005-2018 by Martin Willisegger +// (c) 2005-2022 by Martin Willisegger // // Project : NagiosQL // Component : Installation HowTo // Website : https://sourceforge.net/projects/nagiosql/ -// Version : 3.4.0 +// Version : 3.5.0 // GIT Repo : https://gitlab.com/wizonet/NagiosQL // /////////////////////////////////////////////////////////////////////////////// @@ -21,7 +21,7 @@ * Webserver like Apache 2.x * MySQL/MariaDB 5.x or greater * Nagios 2.x/3.x/4.x or Nagios compatible monitoring software - * PHP 5.5.0 or greater including: + * PHP 7.2.0 or greater including: * PHP Module: Session * PHP Module: MySQLi * PHP Module: gettext @@ -31,11 +31,26 @@ * Javascript activated in Webbrowser * Recommended Webbrowser: Mozilla Firefox +============================================ += Installation of ssh2 Extension with PHP8 = +============================================ +Needed RPMs/Software: + * php8-pecl + * php8-devel + * libssh2-devel + * make + +Installation command: +# pecl install ssh2-1.3.1 + +Configuration in php.ini: +extension=ssh2 + ================ NEW INSTALLATION ================ - 1. Download and extract NagiosQL 3.4 to a directory within your Apache Document Root + 1. Download and extract NagiosQL 3.5 to a directory within your Apache Document Root 2. Start the Installation Wizard by opening install/index.php 3. Switch to your preferred language (see Appendix 1.) 4. Follow the instructions to install NagiosQL @@ -47,10 +62,10 @@ NEW INSTALLATION 1. Upgrade from NagiosQL 1.x and 2.x are not possible, you should better start at "New Installation" and after the installation is done, import Nagios configuration files with NagiosQL 2. Upgrade from NagiosQL 3.x - a. Download and extract NagiosQL 3.4 to a NEW directory and change your Apache DocumentRoot to the new directory + a. Download and extract NagiosQL 3.5 to a NEW directory and change your Apache DocumentRoot to the new directory b. If the same Apache configuration is used (old NagiosQL directory moved away and new NagiosQL directory moved to the old DocumentRoot), you should restart the apache demon before upgrade - b. Move your old config/settings.php file to the new NagiosQL 3.4 config/ folder + b. Move your old config/settings.php file to the new NagiosQL 3.5 config/ folder c. Backup your old NagiosQL database (as example with mysqldump) d. Start the Installation Wizard by opening install/index.php e. Switch to your preferred language (see Appendix) and follow the instructions diff --git a/doc/README_SSH_KEY b/doc/README_SSH_KEY index 2d4d6df..658416f 100644 --- a/doc/README_SSH_KEY +++ b/doc/README_SSH_KEY @@ -8,7 +8,7 @@ Local system 2. Create a path for the ssh keys # mkdir /etc/nagiosql/ssh 2. Create a key pair (only rsa is supported!) -# ssh-keygen -t rsa -b 4096 +# ssh-keygen -t rsa -m PEM -b 4096 Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): /etc/nagiosql/ssh/id_rsa -> empty passphrase! @@ -29,6 +29,15 @@ Enter file in which to save the key (/root/.ssh/id_rsa): /etc/nagiosql/ssh/id_rs 6.3. Fill in /etc/nagiosql/ssh/ as Directory of the key pair (without id_rsa)! +Callback Error +============== + +If you get a callback error when connecting to the remote system (variant SSH public key), the file +id_rsa may not be in PEM format. Try a conversion with: +# ssh-keygen -p -m PEM -f /etc/nagiosql/ssh/id_rsa +-> empty passphrase! + + Using passwort authentication (not recommended) =============================================== diff --git a/functions/Autoloader.php b/functions/Autoloader.php index fb634e8..ca157c8 100644 --- a/functions/Autoloader.php +++ b/functions/Autoloader.php @@ -1,18 +1,16 @@ preBasePath = $strBasePath; @@ -39,21 +38,21 @@ class Autoloader /** * Load class from path - * @param string $strClassName Class name + * @param string $strClassName Class name */ - public function loadClass($strClassName) + public function loadClass(string $strClassName): void { $className = ltrim($strClassName, '\\'); - $fileName = ''; + $fileName = ''; $lastNsPos = strrpos($className, '\\'); - if ($lastNsPos != 0) { - $namespace = substr($className, 0, $lastNsPos); - $className = substr($className, $lastNsPos + 1); - $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; + if ($lastNsPos !== 0) { + $namespace = substr($className, 0, $lastNsPos); + $className = substr($className, $lastNsPos + 1); + $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; } - $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; - $strFilePath1 = $this->preBasePath.$fileName; - $strFilePath2 = $this->preBasePath.'install/'.$fileName; + $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; + $strFilePath1 = $this->preBasePath . $fileName; + $strFilePath2 = $this->preBasePath . 'install/' . $fileName; if (file_exists($strFilePath1) && is_readable($strFilePath1)) { require_once $strFilePath1; } @@ -61,4 +60,4 @@ class Autoloader require_once $strFilePath2; } } -} +} \ No newline at end of file diff --git a/functions/MysqliDbClass.php b/functions/MysqliDbClass.php index a941a4b..f8cd913 100644 --- a/functions/MysqliDbClass.php +++ b/functions/MysqliDbClass.php @@ -1,68 +1,60 @@ DB server name -// ----------- $arrParams['port'] -> DB server port -// $arrParams['user'] -> DB server username -// $arrParams['password'] -> DB server password -// $arrParams['database'] -> DB server database name -// -/////////////////////////////////////////////////////////////////////////////////////////////// + +/* ---------------------------------------------------------------------------- + NagiosQL +------------------------------------------------------------------------------- + (c) 2005-2022 by Martin Willisegger + + Project : NagiosQL + Component : MySQLi data processing class + Website : https://sourceforge.net/projects/nagiosql/ + Version : 3.5.0 + GIT Repo : https://gitlab.com/wizonet/NagiosQL +-----------------------------------------------------------------------------*/ + +/* ---------------------------------------------------------------------------- + Class: Common database functions for MySQL (mysqli database module) +------------------------------------------------------------------------------- + Includes any functions to communicate with an MySQL database server + Name: MysqliDbClass + Class variables: $arrParams Array including the server settings + $strErrorMessage Database error string + $error Boolean - Error true/false + $strDBId Database connection id + $intLastId ID of last dataset + $intAffectedRows Counter variable of all affected data dows + $booSSLuse Use SSL connection + + Parameters: $arrParams['server'] -> DB server name + $arrParams['port'] -> DB server port + $arrParams['user'] -> DB server username + $arrParams['password'] -> DB server password + $arrParams['database'] -> DB server database name +-----------------------------------------------------------------------------*/ + namespace functions; class MysqliDbClass { - // Define class variables - public $error = false; // Will be filled in functions - public $strDBId; // Will be filled in functions - public $intLastId = 0; // Will be filled in functions - public $intAffectedRows = 0; // Will be filled in functions - public $strErrorMessage = ''; // Will be filled in functions - public $booSSLuse = false; // Defines if SSL is used or not - public $arrParams = array(); // Must be filled in while initialization + /* Define class variables */ + public $error = false; /* Will be filled in functions */ + public $strDBId; /* Will be filled in functions */ + public $intLastId = 0; /* Will be filled in functions */ + public $intAffectedRows = 0; /* Will be filled in functions */ + public $strErrorMessage = ''; /* Will be filled in functions */ + public $booSSLuse = false; /* Defines if SSL is used or not */ + public $arrParams = array(); /* Must be filled in while initialization */ /** * MysqliDbClass constructor. */ public function __construct() { - $this->arrParams['server'] = ''; - $this->arrParams['port'] = 0; - $this->arrParams['username'] = ''; - $this->arrParams['password'] = ''; - $this->arrParams['database'] = ''; + $this->arrParams['server'] = ''; + $this->arrParams['port'] = 0; + $this->arrParams['username'] = ''; + $this->arrParams['password'] = ''; + $this->arrParams['database'] = ''; } /** @@ -74,21 +66,162 @@ class MysqliDbClass } /** - * Opens a connection to the database server and select a database - * @param int $intMode 1 = connect only / 0 = connect + dbselect - * @return bool true = successful / false = error - * Status messages are stored in class variable + * Close database server connectuon + * @return bool true = successful / false = error + * @noinspection PhpReturnValueOfMethodIsNeverUsedInspection */ - public function hasDBConnection($intMode = 0) + private function dbDisconnect(): bool + { + return mysqli_close($this->strDBId); + } + + /** + * Opens a connection to the database server and select a database + * @param int $intMode 1 = connect only / 0 = connect + dbselect + * @return bool true = successful / false = error + * Status messages are stored in class variable + */ + public function hasDBConnection(int $intMode = 0): bool { $booReturn = true; $this->dbconnect(); - if ($this->error == true) { + if ($this->error === true) { $booReturn = false; } - if (($booReturn == true) && ($intMode == 0)) { + if (($booReturn === true) && ($intMode === 0)) { $this->dbselect(); - if ($this->error == true) { + if ($this->error === true) { + $booReturn = false; + } + } + return $booReturn; + } + + /** + * Connect to database server + * @param string $dbserver Server name + * @param int $dbport TCP port + * @param string $dbuser Database user + * @param string $dbpasswd Database password + * @return void true = successful / false = error + * Status messages are stored in class variable + * @noinspection PhpMissingParamTypeInspection + * @noinspection PhpSameParameterValueInspection + */ + private function dbconnect($dbserver = null, int $dbport = 0, $dbuser = null, $dbpasswd = null): void + { + /* Reset error variables */ + $this->strErrorMessage = ''; + $this->error = false; + $booReturn = true; + /* Get parameters */ + if ($dbserver === null) { + $dbserver = $this->arrParams['server']; + } + if ($dbport === 0) { + $dbport = $this->arrParams['port']; + } + if ($dbuser === null) { + $dbuser = $this->arrParams['username']; + } + if ($dbpasswd === null) { + $dbpasswd = $this->arrParams['password']; + } + /* Not all parameters available */ + if (($dbserver === '') || ($dbuser === '') || ($dbpasswd === '')) { + $this->strErrorMessage .= gettext('Missing server connection parameter!') . '::'; + $this->error = true; + $booReturn = false; + } + if ($booReturn === true) { + $this->dbinit(); + /* if ($this->booSSLuse === true) { + TODO: TO BE DEFINED + }*/ + $intErrorReporting = error_reporting(); + error_reporting(0); + if ($dbport === 0) { + $booReturn = mysqli_real_connect($this->strDBId, $dbserver, $dbuser, $dbpasswd); + } else { + $booReturn = mysqli_real_connect($this->strDBId, $dbserver, $dbuser, $dbpasswd, null, $dbport); + } + error_reporting($intErrorReporting); + // Connection fails + if ($booReturn === false) { + $this->strErrorMessage = '[' . $dbserver . '] ' . gettext('Connection to the database server has failed ' + . 'by reason:') . ' ::'; + $strError = mysqli_connect_error(); + $this->strErrorMessage .= $strError . '::'; + $this->error = true; + } + /** PHP8 exception handling */ + mysqli_report(MYSQLI_REPORT_ERROR); + } + } + + /** + * Initialize a mysql database connection + * @return bool true = successful / false = error + * @noinspection PhpReturnValueOfMethodIsNeverUsedInspection + */ + private function dbinit(): bool + { + $this->strDBId = mysqli_init(); + return true; + } + + /** + * Select a database + * @param string $database Database name + * @return bool true = successful / false = error + * Status messages are stored in class variable + * @noinspection PhpReturnValueOfMethodIsNeverUsedInspection + * @noinspection PhpMissingParamTypeInspection + * @noinspection PhpSameParameterValueInspection + */ + private function dbselect($database = null): bool + { + /* Reset error variables */ + $this->strErrorMessage = ''; + $this->error = false; + $booReturn = true; + /* Get parameters */ + if ($database === null) { + $database = $this->arrParams['database']; + } + /* Not all parameters available */ + if ($database === '') { + $this->strErrorMessage .= gettext('Missing database connection parameter!') . '::'; + $this->error = true; + $booReturn = false; + } + if ($booReturn === true) { + $intErrorReporting = error_reporting(); + error_reporting(0); + $bolConnect = mysqli_select_db($this->strDBId, $database); + error_reporting($intErrorReporting); + /* Session cannot be etablished */ + if (!$bolConnect) { + $this->strErrorMessage .= '[' . $database . '] ' . + gettext('Connection to the database has failed by reason:') . ' ::'; + $this->strErrorMessage .= mysqli_error($this->strDBId) . '::'; + $this->error = true; + $booReturn = false; + } + } + if ($booReturn === true) { + mysqli_query($this->strDBId, "set names 'utf8'"); + if (mysqli_error($this->strDBId) !== '') { + $this->strErrorMessage .= mysqli_error($this->strDBId) . '::'; + $this->error = true; + $booReturn = false; + } + } + if ($booReturn === true) { + mysqli_query($this->strDBId, "set session sql_mode = 'NO_ENGINE_SUBSTITUTION'"); + if (mysqli_error($this->strDBId) !== '') { + $this->strErrorMessage .= mysqli_error($this->strDBId) . '::'; + $this->error = true; $booReturn = false; } } @@ -97,112 +230,115 @@ class MysqliDbClass /** * Sends an SQL statement to the server and returns the result of the first data field - * @param string $strSQL SQL Statement - * @return string = successful / = error - * Status messages are stored in class variable + * @param string $strSQL SQL Statement + * @return string = successful / = error + * Status messages are stored in class variable */ - public function getFieldData($strSQL) + public function getFieldData(string $strSQL): string { - // Reset error variables + /* Reset error variables */ $this->strErrorMessage = ''; - $this->error = false; - $strReturn = ''; - // Send the SQL statement to the server + $this->error = false; + $strReturn = ''; + /* Send the SQL statement to the server */ $resQuery = mysqli_query($this->strDBId, $strSQL); - // Error processing - if ($resQuery && (mysqli_num_rows($resQuery) != 0) && (mysqli_error($this->strDBId) == '')) { - // Return the field value from position 0/0 + /* Error processing */ + if ($resQuery && (mysqli_num_rows($resQuery) !== 0) && (mysqli_error($this->strDBId) === '')) { + /* Return the field value from position 0/0 */ $arrDataset = mysqli_fetch_array($resQuery, MYSQLI_NUM); $strReturn = $arrDataset[0]; - } elseif (mysqli_error($this->strDBId) != '') { - $this->strErrorMessage .= mysqli_error($this->strDBId). '::'; - $this->error = true; + if ($strReturn === null) { + $strReturn = ''; + } + } elseif (mysqli_error($this->strDBId) !== '') { + $this->strErrorMessage .= mysqli_error($this->strDBId) . '::'; + $this->error = true; } return $strReturn; } /** * Sends an SQL statement to the server and returns the result of the first data set - * @param string $strSQL SQL Statement - * @param array|null $arrDataset Result array (by reference) - * @return bool true = successful / false = error - * Status messages are stored in class variable + * @param string $strSQL SQL Statement + * @param array|null $arrDataset Result array (by reference) + * @return bool true = successful / false = error + * Status messages are stored in class variable */ - public function hasSingleDataset($strSQL, &$arrDataset) + public function hasSingleDataset(string $strSQL, ?array &$arrDataset): bool { - //$arrDataset = array(); - $booReturn = true; - // Reset error variables + $arrDataset = array(); + $booReturn = true; + /* Reset error variables */ $this->strErrorMessage = ''; - $this->error = false; - // Send the SQL statement to the server + $this->error = false; + /* Send the SQL statement to the server */ $resQuery = mysqli_query($this->strDBId, $strSQL); - // Error processing - if ($resQuery && (mysqli_num_rows($resQuery) != 0) && (mysqli_error($this->strDBId) == '')) { - // Put the values into the array + /* Error processing */ + if ($resQuery && (mysqli_num_rows($resQuery) !== 0) && (mysqli_error($this->strDBId) === '')) { + /* Put the values into the array */ $arrDataset = mysqli_fetch_array($resQuery, MYSQLI_ASSOC); - } elseif (mysqli_error($this->strDBId) != '') { - $this->strErrorMessage .= mysqli_error($this->strDBId). '::'; - $this->error = true; - $booReturn = false; + } elseif (mysqli_error($this->strDBId) !== '') { + $this->strErrorMessage .= mysqli_error($this->strDBId) . '::'; + $this->error = true; + $booReturn = false; } return $booReturn; } /** * Sends an SQL statement to the server and returns the result of all dataset in a data array - * @param string $strSQL SQL Statement - * @param array $arrDataset Result array (by reference) - * @param int $intDataCount Number of data result sets - * @return bool true = successful / false = error - * Status messages are stored in class variable + * @param string $strSQL SQL Statement + * @param array|null $arrDataset Result array (by reference) + * @param int|null $intDataCount Number of data result sets + * @return bool true = successful / false = error + * Status messages are stored in class variable */ - public function hasDataArray($strSQL, &$arrDataset, &$intDataCount) + public function hasDataArray(string $strSQL, array &$arrDataset = null, int &$intDataCount = null): bool { - $arrDataset = array(); + $arrDataset = array(); $intDataCount = 0; - $booReturn = true; - // Reset error variables + $booReturn = true; + /* Reset error variables */ $this->strErrorMessage = ''; - $this->error = false; - // Send the SQL statement to the server + $this->error = false; + /* Send the SQL statement to the server */ $resQuery = mysqli_query($this->strDBId, $strSQL); - // Error processing - if ($resQuery && (mysqli_num_rows($resQuery) != 0) && (mysqli_error($this->strDBId) == '')) { - $intDataCount = mysqli_num_rows($resQuery); + /* Error processing */ + if ($resQuery && (mysqli_num_rows($resQuery) !== 0) && (mysqli_error($this->strDBId) === '')) { + $intDataCount = (int)mysqli_num_rows($resQuery); $intCount = 0; - // Put the values into the array + /* Put the values into the array */ while ($arrDataTemp = mysqli_fetch_array($resQuery, MYSQLI_ASSOC)) { foreach ($arrDataTemp as $key => $value) { $arrDataset[$intCount][$key] = $value; } $intCount++; } - } elseif (mysqli_error($this->strDBId) != '') { - $this->strErrorMessage .= mysqli_error($this->strDBId). '::'; - $this->error = true; - $booReturn = false; + } elseif (mysqli_error($this->strDBId) !== '') { + $this->strErrorMessage .= mysqli_error($this->strDBId) . '::'; + $this->error = true; + $booReturn = false; } return $booReturn; } /** * Insert/update or delete data - * @param string $strSQL SQL Statement - * @return bool true = successful / false = error - * Status messages are stored in class variable + * @param string $strSQL SQL Statement + * @return bool true = successful / false = error + * Status messages are stored in class variable */ - public function insertData($strSQL) + public function insertData(string $strSQL): bool { - // Reset error variables + /* Reset error variables */ $this->strErrorMessage = ''; - $this->error = false; - $booReturn = false; - // Send the SQL statement to the server - if ($strSQL != '') { + $this->error = false; + $booReturn = false; + /* Send the SQL statement to the server */ + if ($strSQL !== '') { mysqli_query($this->strDBId, $strSQL); - // Error processing - if (mysqli_error($this->strDBId) == '') { + /* Error processing */ + if (mysqli_error($this->strDBId) === '') { $this->intLastId = mysqli_insert_id($this->strDBId); $this->intAffectedRows = mysqli_affected_rows($this->strDBId); $booReturn = true; @@ -216,197 +352,65 @@ class MysqliDbClass /** * Count the sum of data records - * @param string $strSQL SQL Statement - * @return int = successful / 0 = no dataset or error - * Status messages are stored in class variable + * @param string $strSQL SQL Statement + * @return int = successful / 0 = no dataset or error + * Status messages are stored in class variable */ - public function countRows($strSQL) + public function countRows(string $strSQL): int { - // Reset error variables + /* Reset error variables */ $this->strErrorMessage = ''; - $this->error = false; - $intReturn = 0; - // Send the SQL statement to the server + $this->error = false; + $intReturn = 0; + /* Send the SQL statement to the server */ $resQuery = mysqli_query($this->strDBId, $strSQL); - // Error processing - if ($resQuery && (mysqli_error($this->strDBId) == '')) { + /* Error processing */ + if ($resQuery && (mysqli_error($this->strDBId) === '')) { $intReturn = mysqli_num_rows($resQuery); } else { $this->strErrorMessage .= mysqli_error($this->strDBId); - $this->error = true; + $this->error = true; } return $intReturn; } /** * Returns a safe insert string for database manipulations - * @param string $strInput Input String - * @return string Output String + * @param string $strInput Input String + * @return string Output String */ - public function realEscape($strInput) + public function realEscape(string $strInput): string { return mysqli_real_escape_string($this->strDBId, $strInput); } - /** - * Initialize a mysql database connection - * @return bool true = successful / false = error - */ - private function dbinit() - { - $this->strDBId = mysqli_init(); - return true; - } - - /** - * Connect to database server - * @param string $dbserver Server name - * @param int $dbport TCP port - * @param string $dbuser Database user - * @param string $dbpasswd Database password - * @return bool true = successful / false = error - * Status messages are stored in class variable - */ - private function dbconnect($dbserver = null, $dbport = null, $dbuser = null, $dbpasswd = null) - { - // Reset error variables - $this->strErrorMessage = ''; - $this->error = false; - $booReturn = true; - // Get parameters - if ($dbserver == null) { - $dbserver = $this->arrParams['server']; - } - if ($dbport == null) { - $dbport = $this->arrParams['port']; - } - if ($dbuser == null) { - $dbuser = $this->arrParams['username']; - } - if ($dbpasswd == null) { - $dbpasswd = $this->arrParams['password']; - } - // Not all parameters available - if (($dbserver == '') || ($dbuser == '') || ($dbpasswd == '')) { - $this->strErrorMessage .= gettext('Missing server connection parameter!'). '::'; - $this->error = true; - $booReturn = false; - } - if ($booReturn == true) { - $this->dbinit(); - //if ($this->booSSLuse == true) { - // TO BE DEFINED - //} - $intErrorReporting = error_reporting(); - error_reporting(0); - if ($dbport == 0) { - $booReturn = mysqli_real_connect($this->strDBId, $dbserver, $dbuser, $dbpasswd); - } else { - $booReturn = mysqli_real_connect($this->strDBId, $dbserver, $dbuser, $dbpasswd, null, $dbport); - } - error_reporting($intErrorReporting); - // Connection fails - if ($booReturn == false) { - $this->strErrorMessage = '[' .$dbserver. '] ' .gettext('Connection to the database server has failed ' - . 'by reason:'). ' ::'; - $strError = mysqli_connect_error(); - $this->strErrorMessage .= $strError. '::'; - $this->error = true; - } - } - return $booReturn; - } - - /** - * Select a database - * @param string $database Database name - * @return bool true = successful / false = error - * Status messages are stored in class variable - */ - private function dbselect($database = null) - { - // Reset error variables - $this->strErrorMessage = ''; - $this->error = false; - $booReturn = true; - // Get parameters - if ($database == null) { - $database = $this->arrParams['database']; - } - // Not all parameters available - if ($database == '') { - $this->strErrorMessage .= gettext('Missing database connection parameter!'). '::'; - $this->error = true; - $booReturn = false; - } - if ($booReturn == true) { - $bolConnect = mysqli_select_db($this->strDBId, $database); - // Session cannot be etablished - if (!$bolConnect) { - $this->strErrorMessage .= '[' .$database. '] ' . - gettext('Connection to the database has failed by reason:'). ' ::'; - $this->strErrorMessage .= mysqli_error($this->strDBId). '::'; - $this->error = true; - $booReturn = false; - } - } - if ($booReturn == true) { - mysqli_query($this->strDBId, "set names 'utf8'"); - if (mysqli_error($this->strDBId) != '') { - $this->strErrorMessage .= mysqli_error($this->strDBId). '::'; - $this->error = true; - $booReturn = false; - } - } - if ($booReturn == true) { - mysqli_query($this->strDBId, "set session sql_mode = 'NO_ENGINE_SUBSTITUTION'"); - if (mysqli_error($this->strDBId) != '') { - $this->strErrorMessage .= mysqli_error($this->strDBId). '::'; - $this->error = true; - $booReturn = false; - } - } - return $booReturn; - } - - /* /** * Set SSL connection parameters - * @param string $sslkey SSL key - * @param string $sslcert SSL certificate - * @param string $sslca SSL CA file (optional) - * @param string $sslpath SSL certificate path (optional) - * @param string $sslcypher SSL cypher (optional) - * @return bool true = successful - * Status messages are stored in class variable + * @param string $sslkey SSL key + * @param string $sslcert SSL certificate + * @param string|null $sslca SSL CA file (optional) + * @param string|null $sslpath SSL certificate path (optional) + * @param string|null $sslcypher SSL cypher (optional) + * @return bool true = successful + * Status messages are stored in class variable + * @noinspection PhpSameParameterValueInspection + * @noinspection PhpUnusedPrivateMethodInspection */ - /* - private function dbsetssl($sslkey, $sslcert, $sslca = null, $sslpath = null, $sslcypher = null) + private function dbsetssl(string $sslkey, string $sslcert, string $sslca = null, string $sslpath = null, string $sslcypher = null): bool { - // Reset error variables + /* Reset error variables */ $this->strErrorMessage = ""; - $this->error = false; - $booReturn = true; - // Values are missing - if (($sslkey == "") || ($sslcert == "")) { - $this->strErrorMessage = gettext("Missing MySQL SSL parameter!")."::"; - $this->error = true; - $booReturn = false; + $this->error = false; + $booReturn = true; + /* Values are missing */ + if (($sslkey === "") || ($sslcert === "")) { + $this->strErrorMessage = gettext("Missing MySQL SSL parameter!") . "::"; + $this->error = true; + $booReturn = false; } - if ($booReturn == true) { + if ($booReturn === true) { mysqli_ssl_set($this->strDBId, $sslkey, $sslcert, $sslca, $sslpath, $sslcypher); } - return($booReturn); + return ($booReturn); } - */ - - /** - * Close database server connectuon - * @return bool true = successful / false = error - */ - private function dbDisconnect() - { - mysqli_close($this->strDBId); - return true; - } -} +} \ No newline at end of file diff --git a/functions/NagConfigClass.php b/functions/NagConfigClass.php index b9b5d92..d177d10 100644 --- a/functions/NagConfigClass.php +++ b/functions/NagConfigClass.php @@ -1,160 +1,147 @@ arrSettings = $arrSession['SETS']; } if (isset($arrSession['domain'])) { - $this->intDomainId = $arrSession['domain']; + $this->intDomainId = (int)$arrSession['domain']; } $this->arrSession = $arrSession; } - /** - * Get domain configuration parameters. - * @param string $strConfigItem Configuration key - * @param string $strValue Configuration value (by reference) - * @return int 0 = successful / 1 = error - */ - public function getDomainData($strConfigItem, &$strValue) - { - // Variable definition - $intReturn = 0; - // Request domain data from database - $strSQL = 'SELECT `' .$strConfigItem. '` FROM `tbl_datadomain` WHERE `id` = ' .$this->intDomainId; - $strValue = $this->myDBClass->getFieldData($strSQL); - if ($strValue == '') { - $intReturn = 1; - } - return $intReturn; - } - /** * Get last modification date of a database table and any configuration files inside a directory. - * @param string $strTableName Name of the database table - * @param string $strConfigName Name of the configuration file - * @param int $intDataId ID of the dataset for service table - * @param array $arrTimeData Array with the timestamps of the files and the DB table (by reference) - * @param int $intTimeInfo Time status value (by reference) - * 0 = all files are newer than the database item - * 1 = some file are older than the database item - * 2 = one file is missing - * 3 = any files are missing - * 4 = no configuration targets defined - * @return int 0 = successful / 1 = error - * Status messages are stored in class variables + * @param string $strTableName Name of the database table + * @param string $strConfigName Name of the configuration file + * @param int $intDataId ID of the dataset for service table + * @param array|null $arrTimeData Array with the timestamps of the files and the DB table (by reference) + * @param int|null $intTimeInfo Time status value (by reference) + * 0 = all files are newer than the database item + * 1 = some files are older than the database item + * 2 = one file is missing + * 3 = any files are missing + * 4 = no configuration targets defined + * @return int 0 = successful / 1 = error + * Status messages are stored in class variables */ - public function lastModifiedDir($strTableName, $strConfigName, $intDataId, &$arrTimeData, &$intTimeInfo) + public function lastModifiedDir(string $strTableName, string $strConfigName, int $intDataId, array &$arrTimeData = null, int &$intTimeInfo = null): int { - // Variable definitions - $intReturn = 0; - // Create file name - $strFileName = $strConfigName. '.cfg'; - // Get table times - $strActive = 0; - $arrTimeData = array(); + /* Variable definitions */ + $intReturn = 0; + /* Create file name */ + $strFileName = $strConfigName . '.cfg'; + /* Get table times */ + $strActive = 0; + $arrTimeData = array(); $arrTimeData['table'] = 'unknown'; - // Clear status cache + /* Clear status cache */ clearstatcache(); - // Get last change on dataset - if ($strTableName == 'tbl_host') { - $strSQL1 = "SELECT DATE_FORMAT(`last_modified`,'%Y-%m-%d %H:%i:%s') FROM `tbl_host` ". - "WHERE `host_name`='$strConfigName' AND `config_id`=".$this->intDomainId; - $strSQL2 = "SELECT `active` FROM `tbl_host` WHERE `host_name`='$strConfigName' ". - 'AND `config_id`=' .$this->intDomainId; + /* Get last change on dataset */ + if ($strTableName === 'tbl_host') { + $strSQL1 = "SELECT DATE_FORMAT(`last_modified`,'%Y-%m-%d %H:%i:%s') FROM `tbl_host` " . + "WHERE `host_name`='$strConfigName' AND `config_id`=" . $this->intDomainId; + $strSQL2 = "SELECT `active` FROM `tbl_host` WHERE `host_name`='$strConfigName' " . + 'AND `config_id`=' . $this->intDomainId; $arrTimeData['table'] = $this->myDBClass->getFieldData($strSQL1); - $strActive = $this->myDBClass->getFieldData($strSQL2); - } elseif ($strTableName == 'tbl_service') { - $strSQL1 = "SELECT DATE_FORMAT(`last_modified`,'%Y-%m-%d %H:%i:%s') FROM `tbl_service` ". - "WHERE `id`='$intDataId' AND `config_id`=".$this->intDomainId; - $strSQL2 = "SELECT * FROM `$strTableName` WHERE `config_name`='$strConfigName' ". - 'AND `config_id`=' .$this->intDomainId." AND `active`='1'"; + $strActive = $this->myDBClass->getFieldData($strSQL2); + } elseif ($strTableName === 'tbl_service') { + $strSQL1 = "SELECT DATE_FORMAT(`last_modified`,'%Y-%m-%d %H:%i:%s') FROM `tbl_service` " . + "WHERE `id`='$intDataId' AND `config_id`=" . $this->intDomainId; + /** @noinspection SqlResolve */ + $strSQL2 = "SELECT * FROM `$strTableName` WHERE `config_name`='$strConfigName' " . + 'AND `config_id`=' . $this->intDomainId . " AND `active`='1'"; $arrTimeData['table'] = $this->myDBClass->getFieldData($strSQL1); - $intServiceCount = $this->myDBClass->countRows($strSQL2); - if ($intServiceCount != 0) { + $intServiceCount = $this->myDBClass->countRows($strSQL2); + if ($intServiceCount !== 0) { $strActive = 1; } } else { $intReturn = 1; } - // Get config sets - $arrConfigId = array(); - $strTarget = ''; - $strBaseDir = ''; - $intTimeInfo = -1; - $intRetVal2 = $this->getConfigTargets($arrConfigId); - if ($intRetVal2 == 0) { + /* Get config sets */ + $arrConfigId = array(); + $strTarget = ''; + $strBaseDir = ''; + $intTimeInfo = -1; + $intRetVal2 = $this->getConfigTargets($arrConfigId); + if ($intRetVal2 === 0) { foreach ($arrConfigId as $intConfigId) { - // Get configuration file data + /* Get configuration file data */ $this->getConfigValues($intConfigId, 'target', $strTarget); - // Get last change on dataset - if ($strTableName == 'tbl_host') { + /* Get last change on dataset */ + if ($strTableName === 'tbl_host') { $this->getConfigValues($intConfigId, 'hostconfig', $strBaseDir); - } elseif ($strTableName == 'tbl_service') { + } elseif ($strTableName === 'tbl_service') { $this->getConfigValues($intConfigId, 'serviceconfig', $strBaseDir); } $arrTimeData[$strTarget] = 'unknown'; - $intFileStampTemp = -1; - // Get time data + $intFileStampTemp = -1; + /* Get time data */ $intReturn = $this->getFileDate( $intConfigId, $strFileName, @@ -162,28 +149,28 @@ class NagConfigClass $intFileStampTemp, $arrTimeData[$strTarget] ); - if (($intFileStampTemp == 0) && ($strActive == '1')) { + if (($intFileStampTemp === 0) && ($strActive === '1')) { $intTimeInfo = 2; } - if (($strActive == '1') && (strtotime($arrTimeData['table']) > $intFileStampTemp)) { + if (($strActive === '1') && (strtotime($arrTimeData['table']) > $intFileStampTemp)) { $intTimeInfo = 1; } } - $intItems = \count($arrTimeData) - 1; - $intUnknown = 0; + $intItems = count($arrTimeData) - 1; + $intUnknown = 0; $intUpToDate = 0; foreach ($arrTimeData as $key) { - if ($key == 'unknown') { + if ($key === 'unknown') { $intUnknown++; } if (strtotime($arrTimeData['table']) < strtotime($key)) { $intUpToDate++; } } - if ($intUnknown == $intItems) { + if ($intUnknown === $intItems) { $intTimeInfo = 3; } - if ($intUpToDate == $intItems) { + if ($intUpToDate === $intItems) { $intTimeInfo = 0; } } else { @@ -194,20 +181,20 @@ class NagConfigClass /** * Get configuration target IDs - * @param array $arrConfigId Configuration target IDs (by reference) - * @return int 0 = successful / 1 = error + * @param array|null $arrConfigId Configuration target IDs (by reference) + * @return int 0 = successful / 1 = error */ - public function getConfigTargets(&$arrConfigId) + public function getConfigTargets(array &$arrConfigId = null): int { - // Variable definition - $arrData = array(); - $arrConfigId = array(); + /* Variable definition */ + $arrData = array(); + $arrConfigId = array(); $intDataCount = 0; - $intReturn = 1; - // Request target ID - $strSQL = 'SELECT `targets` FROM `tbl_datadomain` WHERE `id`=' .$this->intDomainId; + $intReturn = 1; + /* Request target ID */ + $strSQL = 'SELECT `targets` FROM `tbl_datadomain` WHERE `id`=' . $this->intDomainId; $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($booReturn && ($intDataCount != 0)) { + if ($booReturn && ($intDataCount !== 0)) { foreach ($arrData as $elem) { $arrConfigId[] = $elem['targets']; } @@ -218,19 +205,19 @@ class NagConfigClass /** * Get configuration domain values - * @param int $intConfigId Configuration ID - * @param string $strConfigKey Configuration key - * @param string $strValue Configuration value (by reference) - * @return int 0 = successful / 1 = error + * @param int $intConfigId Configuration ID + * @param string $strConfigKey Configuration key + * @param string|null $strValue Configuration value (by reference) + * @return int 0 = successful / 1 = error */ - public function getConfigValues($intConfigId, $strConfigKey, &$strValue) + public function getConfigValues(int $intConfigId, string $strConfigKey, string &$strValue = null): int { - // Define variables + /* Define variables */ $intReturn = 1; - // Read database - $strSQL = 'SELECT `' .$strConfigKey. '` FROM `tbl_configtarget` WHERE `id`=' .$intConfigId; - $strValue = $this->myDBClass->getFieldData($strSQL); - if ($strValue != '') { + /* Read database */ + $strSQL = 'SELECT `' . $strConfigKey . '` FROM `tbl_configtarget` WHERE `id`=' . $intConfigId; + $strValue = $this->myDBClass->getFieldData($strSQL); + if ($strValue !== '') { $intReturn = 0; } return $intReturn; @@ -238,46 +225,48 @@ class NagConfigClass /** * Get last modification date of a configuration file. - * @param int $intConfigId Configuration ID - * @param string $strFile Configuration file name - * @param string $strBaseDir Base directory with configuration file - * @param int|bool $intFileStamp File timestamp (by reference) - * @param string $strTimeData Human readable string of file time stamp (by reference) - * @return int 0 = successful / 1 = error + * @param int $intConfigId Configuration ID + * @param string $strFile Configuration file name + * @param string $strBaseDir Base directory with configuration file + * @param bool|int $intFileStamp File timestamp (by reference) + * @param string|null $strTimeData Human-readable string of file time stamp (by reference) + * @return int 0 = successful / 1 = error */ - public function getFileDate($intConfigId, $strFile, $strBaseDir, &$intFileStamp, &$strTimeData) + public function getFileDate(int $intConfigId, string $strFile, string $strBaseDir, bool &$intFileStamp, string &$strTimeData = null): int { - $strMethod = 1; - $intReturn = 0; - // Get configuration file data - $this->getConfigValues($intConfigId, 'method', $strMethod); - $strTimeData = 'unknown'; + $intMethod = 1; + $intReturn = 0; + /* Get configuration file data */ + if ($this->getConfigValues($intConfigId, 'method', $strMethod) === 0) { + $intMethod = (int)$strMethod; + } + $strTimeData = 'unknown'; $intFileStamp = -1; - // Lokal file system - if (($strMethod == 1) && file_exists($strBaseDir. '/' .$strFile)) { - $intFileStamp = filemtime($strBaseDir. '/' .$strFile); + /* Lokal file system */ + if (($intMethod === 1) && file_exists($strBaseDir . '/' . $strFile)) { + $intFileStamp = filemtime($strBaseDir . '/' . $strFile); $strTimeData = date('Y-m-d H:i:s', $intFileStamp); - } elseif ($strMethod == 2) { // FTP file system - // Check connection + } elseif ($intMethod === 2) { // FTP file system + /* Check connection */ $intReturn = $this->getFTPConnection($intConfigId); - if ($intReturn == 0) { - $intFileStamp = ftp_mdtm($this->resConnectId, $strBaseDir . '/' . $strFile); - if ($intFileStamp != -1) { + if ($intReturn === 0) { + $intFileStamp = ftp_mdtm($this->conFTPConId, $strBaseDir . '/' . $strFile); + if ($intFileStamp !== -1) { $strTimeData = date('Y-m-d H:i:s', $intFileStamp); } } - } elseif ($strMethod == 3) { // SSH file system - // Check connection + } elseif ($intMethod === 3) { // SSH file system + /* Check connection */ $intReturn = $this->getSSHConnection($intConfigId); - // Check file date - $strFilePath = str_replace('//', '/', $strBaseDir.'/'.$strFile); - $strCommand = 'ls '.$strFilePath; - $arrResult = array(); - if (($intReturn == 0) && ($this->sendSSHCommand($strCommand, $arrResult) == 0) && - isset($arrResult[0]) && ($arrResult[0] == $strFilePath)) { - $arrInfo = ssh2_sftp_stat($this->resSFTP, $strFilePath); + /* Check file date */ + $strFilePath = str_replace('//', '/', $strBaseDir . '/' . $strFile); + $strCommand = 'ls ' . $strFilePath; + $arrResult = array(); + if (($intReturn === 0) && ($this->sendSSHCommand($strCommand, $arrResult) === 0) && + isset($arrResult[0]) && ($arrResult[0] === $strFilePath)) { + $arrInfo = ssh2_sftp_stat($this->resSFTP, $strFilePath); $intFileStamp = $arrInfo['mtime']; - if ($intFileStamp != -1) { + if ($intFileStamp !== -1) { $strTimeData = date('Y-m-d H:i:s', $intFileStamp); } } @@ -287,57 +276,63 @@ class NagConfigClass /** * Open an FTP connection - * @param int $intConfigID Configuration ID - * @return int 0 = successful / 1 = error - * Status messages are stored in class variables + * @param int $intConfigID Configuration ID + * @return int 0 = successful / 1 = error + * Status messages are stored in class variables */ - public function getFTPConnection($intConfigID) + public function getFTPConnection(int $intConfigID): int { - // Define variables + /* Define variables */ $intReturn = 0; - $arrError = array(); - // Already connected? - if (empty($this->resConnectId) || !\is_resource($this->resConnectId) || ($this->resConnectType != 'FTP')) { - // Define variables + $arrError = array(); + $strServer = ''; + $intFtpSecure = 0; + /* Already connected? */ + if (empty($this->conFTPConId) || !is_resource($this->conFTPConId) || ($this->resConnectType !== 'FTP')) { + /* Define variables */ $booLogin = false; - $this->getConfigValues($intConfigID, 'server', $strServer); - $this->getConfigValues($intConfigID, 'ftp_secure', $intFtpSecure); - // Set up basic connection + if ($this->getConfigValues($intConfigID, 'server', $strServerVal) === 0) { + $strServer = $strServerVal; + } + if ($this->getConfigValues($intConfigID, 'ftp_secure', $strFtpSecure) === 0) { + $intFtpSecure = (int)$strFtpSecure; + } + /* Set up basic connection */ $this->resConnectServer = $strServer; $this->resConnectType = 'FTP'; - // Secure FTP? - if ($intFtpSecure == 1) { - $this->resConnectId = ftp_ssl_connect($strServer); + /* Secure FTP? */ + if ($intFtpSecure === 1) { + $this->conFTPConId = ftp_ssl_connect($strServer); } else { - $this->resConnectId = ftp_connect($strServer); + $this->conFTPConId = ftp_connect($strServer); } - // Login with username and password - if ($this->resConnectId) { + /* Login with username and password */ + if ($this->conFTPConId) { $this->getConfigValues($intConfigID, 'user', $strUser); $this->getConfigValues($intConfigID, 'password', $strPasswd); $intErrorReporting = error_reporting(); error_reporting('0'); - $booLogin = ftp_login($this->resConnectId, $strUser, $strPasswd); + $booLogin = ftp_login($this->conFTPConId, $strUser, $strPasswd); $arrError = error_get_last(); error_reporting($intErrorReporting); - if ($booLogin == false) { - ftp_close($this->resConnectId); + if ($booLogin === false) { + ftp_close($this->conFTPConId); $this->resConnectServer = ''; - $this->resConnectType = 'none'; - $this->resConnectId = null; + $this->resConnectType = 'none'; + $this->conFTPConId = null; $intReturn = 1; } else { - // Change to PASV mode - ftp_pasv($this->resConnectId, true); + /* Change to PASV mode */ + ftp_pasv($this->conFTPConId, true); } } - // Check connection - if ((!$this->resConnectId) || (!$booLogin)) { + /* Check connection */ + if ((!$this->conFTPConId) || (!$booLogin)) { $this->myDataClass->writeLog(translate('Connection to remote system failed (FTP connection):') . ' ' . $strServer); $this->processClassMessage(translate('Connection to remote system failed (FTP connection):') . ' ' . $strServer . '::', $this->strErrorMessage); - if ($arrError !== null && ($arrError['message'] != '')) { + if ($arrError !== null && ((string)$arrError['message'] !== '')) { $this->processClassMessage($arrError['message'] . '::', $this->strErrorMessage); } } @@ -346,115 +341,139 @@ class NagConfigClass } /** - * Open an SSH connection - * @param int $intConfigID Configuration ID - * @return int 0 = successful / 1 = error - * Status messages are stored in class variables + * Merge message strings and check for duplicate messages + * @param string $strNewMessage New message to add + * @param string|null $strOldMessage Modified message string (by reference) */ - public function getSSHConnection($intConfigID) + public function processClassMessage(string $strNewMessage, string &$strOldMessage = null): void { - // Define variables - $intReturn = 0; + $strNewMessage = str_replace('::::', '::', $strNewMessage); + if (($strOldMessage !== '') && ($strNewMessage !== '') && (substr_count($strOldMessage, $strNewMessage) === 0)) { + $strOldMessage .= $strNewMessage; + } elseif ($strOldMessage === '') { + $strOldMessage .= $strNewMessage; + } + } + + /** + * Open an SSH connection + * @param int $intConfigID Configuration ID + * @return int 0 = successful / 1 = error + * Status messages are stored in class variables + */ + public function getSSHConnection(int $intConfigID): int + { + /* Define variables */ + $intReturn = 0; $strPasswordNote = ''; - // Already connected? - if (empty($this->resConnectId) || !\is_resource($this->resConnectId) || ($this->resConnectType != 'SSH')) { - // SSH Possible - if (!\function_exists('ssh2_connect')) { - $this->processClassMessage(translate('SSH module not loaded!'). '::', $this->strErrorMessage); + $strServer = ''; + $intPort = 22; + /* Already connected? */ + if (empty($this->resSSHConId) || !is_resource($this->resSSHConId) || ($this->resConnectType !== 'SSH')) { + /* SSH Possible */ + if (!function_exists('ssh2_connect')) { + $this->processClassMessage(translate('SSH module not loaded!') . '::', $this->strErrorMessage); return 1; } - // Define variables + /* Define variables */ $booLogin = false; - $this->getConfigValues($intConfigID, 'server', $strServer); + if ($this->getConfigValues($intConfigID, 'server', $strServerVal) === 0) { + $strServer = $strServerVal; + } + if ($this->getConfigValues($intConfigID, 'port', $strPort) === 0) { + $intPort = (int)$strPort; + if ($intPort === 0) { + $intPort = 22; + } + } $this->resConnectServer = $strServer; - $this->resConnectType = 'SSH'; - $intErrorReporting = error_reporting(); + $this->resConnectType = 'SSH'; + $intErrorReporting = error_reporting(); error_reporting(0); - $this->resConnectId = ssh2_connect($strServer); + $this->resSSHConId = ssh2_connect($strServer, $intPort); $arrError = error_get_last(); error_reporting($intErrorReporting); - // Check connection - if ($this->resConnectId) { - // Login with username and password + /* Check connection */ + if ($this->resSSHConId) { + /* Login with username and password */ $this->getConfigValues($intConfigID, 'user', $strUser); $this->getConfigValues($intConfigID, 'password', $strPasswd); $this->getConfigValues($intConfigID, 'ssh_key_path', $strSSHKeyPath); - if ($strSSHKeyPath != '') { - $strPublicKey = str_replace('//', '/', $strSSHKeyPath.'/id_rsa.pub'); - $strPrivatKey = str_replace('//', '/', $strSSHKeyPath.'/id_rsa'); - // Check if ssh key file are readable + if ($strSSHKeyPath !== '') { + $strPublicKey = str_replace('//', '/', $strSSHKeyPath . '/id_rsa.pub'); + $strPrivatKey = str_replace('//', '/', $strSSHKeyPath . '/id_rsa'); + /* Check if ssh key file are readable */ if (!file_exists($strPublicKey) || !is_readable($strPublicKey)) { $this->myDataClass->writeLog(translate('SSH public key does not exist or is not readable') - . ' ' . $strSSHKeyPath.$strPublicKey); + . ' ' . $strSSHKeyPath . $strPublicKey); $this->processClassMessage(translate('SSH public key does not exist or is not readable') - . ' ' . $strSSHKeyPath.$strPublicKey. '::', $this->strErrorMessage); + . ' ' . $strSSHKeyPath . $strPublicKey . '::', $this->strErrorMessage); $intReturn = 1; } if (!file_exists($strPrivatKey) || !is_readable($strPrivatKey)) { $this->myDataClass->writeLog(translate('SSH private key does not exist or is not readable') . ' ' . $strPrivatKey); - $this->processClassMessage(translate('SSH private key does not exist or is not readable'). ' ' . - $strPrivatKey. '::', $this->strErrorMessage); + $this->processClassMessage(translate('SSH private key does not exist or is not readable') . ' ' . + $strPrivatKey . '::', $this->strErrorMessage); $intReturn = 1; } - $intErrorReporting = error_reporting(); + $intErrorReporting = error_reporting(); error_reporting(0); - if ($strPasswd == '') { + if ($strPasswd === '') { $booLogin = ssh2_auth_pubkey_file( - $this->resConnectId, + $this->resSSHConId, $strUser, - $strSSHKeyPath. '/id_rsa.pub', - $strSSHKeyPath. '/id_rsa' + $strSSHKeyPath . '/id_rsa.pub', + $strSSHKeyPath . '/id_rsa' ); } else { $booLogin = ssh2_auth_pubkey_file( - $this->resConnectId, + $this->resSSHConId, $strUser, - $strSSHKeyPath. '/id_rsa.pub', - $strSSHKeyPath. '/id_rsa', + $strSSHKeyPath . '/id_rsa.pub', + $strSSHKeyPath . '/id_rsa', $strPasswd ); } $arrError = error_get_last(); - error_reporting($intErrorReporting); } else { - $intErrorReporting = error_reporting(); + $intErrorReporting = error_reporting(); error_reporting(0); - $booLogin = ssh2_auth_password($this->resConnectId, $strUser, $strPasswd); - $arrError = error_get_last(); + $booLogin = ssh2_auth_password($this->resSSHConId, $strUser, $strPasswd); + $arrError = error_get_last(); $strPasswordNote = 'If you are using ssh2 with user/password - you have to enable ' . 'PasswordAuthentication in your sshd_config'; - error_reporting($intErrorReporting); } + error_reporting($intErrorReporting); } else { - $this->myDataClass->writeLog(translate('Connection to remote system failed (SSH2 connection):'). - ' ' .$strServer); - $this->processClassMessage(translate('Connection to remote system failed (SSH2 connection):'). - ' ' .$strServer. '::', $this->strErrorMessage); - if ($arrError['message'] != '') { - $this->processClassMessage($arrError['message']. '::', $this->strErrorMessage); + $this->myDataClass->writeLog(translate('Connection to remote system failed (SSH2 connection):') . + ' ' . $strServer . ' / ' . translate('port') . ' : ' . $intPort); + $this->processClassMessage(translate('Connection to remote system failed (SSH2 connection):') . + ' ' . $strServer . ' / ' . translate('port') . ' : ' . $intPort . '::', $this->strErrorMessage); + if ((string)$arrError['message'] !== '') { + $this->processClassMessage($arrError['message'] . '::', $this->strErrorMessage); } $intReturn = 1; } - // Check connection - if ((!$this->resConnectId) || (!$booLogin)) { - $this->myDataClass->writeLog(translate('Connection to remote system failed (SSH2 connection):'). - ' ' .$strServer); + /* Check connection */ + if ((!$this->resSSHConId) || (!$booLogin)) { + $this->myDataClass->writeLog(translate('Connection to remote system failed (SSH2 connection):') . + ' ' . $strServer . ' / ' . translate('port') . ' : ' . $intPort); $this->processClassMessage(translate('Connection to remote system failed (SSH2 connection):') - . ' ' .$strServer. '::', $this->strErrorMessage); - if ($arrError['message'] != '') { - $this->processClassMessage($arrError['message']. '::', $this->strErrorMessage); + . ' ' . $strServer . ' / ' . translate('port') . ' : ' . $intPort . '::', $this->strErrorMessage); + if ((string)$arrError['message'] !== '') { + $this->processClassMessage($arrError['message'] . '::', $this->strErrorMessage); } if ($strPasswordNote !== null) { - $this->processClassMessage($strPasswordNote. '::', $this->strErrorMessage); + $this->processClassMessage($strPasswordNote . '::', $this->strErrorMessage); } $this->resConnectServer = ''; - $this->resConnectType = 'none'; - $this->resConnectId = null; + $this->resConnectType = 'none'; + $this->resSSHConId = null; $intReturn = 1; } else { - // Etablish an SFTP connection ressource - $this->resSFTP = ssh2_sftp($this->resConnectId); + /* Etablish an SFTP connection ressource */ + $this->resSFTP = ssh2_sftp($this->resSSHConId); } } return $intReturn; @@ -462,83 +481,484 @@ class NagConfigClass /** * Sends a command via SSH and stores the result in an array - * @param string $strCommand Command string - * @param array $arrResult Output as array (by reference) - * @param int $intLines Maximal length of output to read - * @return int 0 = successful / 1 = error + * @param string $strCommand Command string + * @param array|null $arrResult Output as array (by reference) + * @param int $intLines Maximal length of output to read + * @return int 0 = successful / 1 = error */ - public function sendSSHCommand($strCommand, &$arrResult, $intLines = 100) + public function sendSSHCommand(string $strCommand, array &$arrResult = null, int $intLines = 100): int { - // Define variables - $intCount1 = 0; // empty lines - $intCount2 = 0; // data lines + /* Define variables */ + $intCount1 = 0; /* empty lines */ + $intCount2 = 0; /* data lines */ $booBreak = false; $this->getConfigTargets($arrConfigSet); - // Check connection + /* Check connection */ $intReturn = $this->getSSHConnection($arrConfigSet[0]); - if (\is_resource($this->resConnectId)) { - // Send command - $resStream = ssh2_exec($this->resConnectId, $strCommand.'; echo __END__'); + if (is_resource($this->resSSHConId)) { + /* Send command */ + $resStream = ssh2_exec($this->resSSHConId, $strCommand . '; echo __END__'); if ($resStream) { - // read result + /* Read result */ stream_set_blocking($resStream, true); stream_set_timeout($resStream, 2); do { $strLine = stream_get_line($resStream, 1024, "\n"); - if ($strLine == '') { + if ($strLine === '') { $intCount1++; - } elseif (substr_count($strLine, '__END__') != 1) { + } elseif (substr_count($strLine, '__END__') !== 1) { $arrResult[] = $strLine; - $intReturn = 0; - } elseif (substr_count($strLine, '__END__') == 1) { + $intReturn = 0; + } elseif (substr_count($strLine, '__END__') === 1) { $booBreak = true; } $intCount2++; $arrStatus = stream_get_meta_data($resStream); } while ($resStream && !feof($resStream) && ($intCount1 <= 10) && ($intCount2 <= $intLines) && - ($arrStatus['timed_out'] != true) && $booBreak == false); + ((bool)$arrStatus['timed_out'] !== true) && $booBreak === false); fclose($resStream); - // Close SSH connection because of timing problems - unset($this->resConnectId); - //sleep(1); + /* Close SSH connection because of timing problems */ + unset($this->resSSHConId); } } return $intReturn; } /** - * Merge message strings and check for duplicate messages - * @param string $strNewMessage New message to add - * @param string $strOldMessage Modified message string (by reference) + * Remove a file + * @param string $strFileName Filename including path to remove + * @param int $intConfigID Configuration target ID + * @return int 0 = successful / 1 = error + * Status message is stored in message class variables */ - public function processClassMessage($strNewMessage, &$strOldMessage) + public function removeFile(string $strFileName, int $intConfigID): int { - $strNewMessage = str_replace('::::', '::', $strNewMessage); - if (($strOldMessage != '') && ($strNewMessage != '') && (substr_count($strOldMessage, $strNewMessage) == 0)) { - $strOldMessage .= $strNewMessage; - } elseif ($strOldMessage == '') { - $strOldMessage .= $strNewMessage; + /* Variable definitions */ + $intMethod = 1; + $intReturn = 0; + $booRetVal = false; + $strMethod = ''; + /* Get connection method */ + if ($this->getConfigData($intConfigID, 'method', $strMethod) === 0) { + $intMethod = (int)$strMethod; + } + /* Local file system */ + if ($intMethod === 1) { + /* Save configuration file */ + if (file_exists($strFileName)) { + if (is_writable($strFileName)) { + unlink($strFileName); + } else { + $this->processClassMessage(translate('Cannot delete the file (wrong permissions)!') . '::' . + $strFileName . '::', $this->strErrorMessage); + $intReturn = 1; + } + } else { + $this->processClassMessage(translate('Cannot delete the file (file does not exist)!') . '::' . + $strFileName . '::', $this->strErrorMessage); + $intReturn = 1; + } + } elseif ($intMethod === 2) { /* Remote file (FTP) */ + /* Check connection */ + $intReturn = $this->getFTPConnection($intConfigID); + if ($intReturn === 0) { + /* Save configuration file */ + $intFileStamp = ftp_mdtm($this->conFTPConId, $strFileName); + if ($intFileStamp > -1) { + $intErrorReporting = error_reporting(); + error_reporting(0); + $booRetVal = ftp_delete($this->conFTPConId, $strFileName); + error_reporting($intErrorReporting); + } else { + $this->processClassMessage(translate('Cannot delete file because it does not exists (remote ' + . 'FTP)!') . '::', $this->strErrorMessage); + $intReturn = 1; + } + } + if ($booRetVal === false) { + $this->processClassMessage(translate('Cannot delete file because the permissions are incorrect ' + . '(remote FTP)!') . '::', $this->strErrorMessage); + $intReturn = 1; + } + } elseif ($intMethod === 3) { /* Remote file (SFTP) */ + /* Check connection */ + $intReturn = $this->getSSHConnection($intConfigID); + /* Save configuration file */ + if (($intReturn === 0) && ($this->sendSSHCommand('ls ' . $strFileName, $arrResult) === 0)) { + if (isset($arrResult[0])) { + $booRetVal = ssh2_sftp_unlink($this->resSFTP, $strFileName); + } else { + $this->processClassMessage(translate('Cannot delete file because it does not exists (remote ' + . 'SSH/SFTP)!') . '::', $this->strErrorMessage); + $intReturn = 1; + } + } + if (($intReturn === 0) && ($booRetVal === false)) { + $this->processClassMessage(translate('Cannot delete file because the permissions are incorrect ' + . '(remote SSH/SFTP)!') . '::', $this->strErrorMessage); + $intReturn = 1; + } + } + return $intReturn; + } + + /** + * Get configuration domain parameters + * @param int $intConfigId Configuration ID + * @param string $strConfigItem Configuration key + * @param string $strValue Configuration value (by reference) + * @return int 0 = successful / 1 = error + */ + public function getConfigData(int $intConfigId, string $strConfigItem, string &$strValue): int + { + $intReturn = 1; + $strSQL = 'SELECT `' . $strConfigItem . '` FROM `tbl_configtarget` WHERE `id` = ' . $intConfigId; + $strValue = $this->myDBClass->getFieldData($strSQL); + if ($strValue !== '') { + $intReturn = 0; + } + return $intReturn; + } + + /** + * Check a directory for write access + * @param string $strPath Physical path + * @return int 0 = successful / 1 = error + */ + public function isDirWriteable(string $strPath): int + { + /* Define variables */ + $intReturnFile = 1; + $intReturnDir = 1; + $intReturn = 1; + /* Is input path a file? */ + if (file_exists($strPath) && is_file($strPath)) { + $resFile = fopen($strPath, 'ab'); + if ($resFile) { + $intReturnFile = 0; + } + } else { + $intReturnFile = 0; + } + if (is_file($strPath)) { + $strDirectory = dirname($strPath); + } else { + $strDirectory = $strPath; + } + $strFile = $strDirectory . '/' . uniqid(mt_rand(), true) . '.tmp'; + /* Check writing in directory directly */ + if (is_dir($strDirectory) && is_writable($strDirectory)) { + $resFile = fopen($strFile, 'wb'); + if ($resFile) { + $intReturnDir = 0; + unlink($strFile); + } + } else { + $intReturnDir = 0; + } + if (($intReturnDir === 0) && ($intReturnFile === 0)) { + $intReturn = 0; + } + return $intReturn; + } + + /** + * Copy a remote file + * @param string $strFileRemote Remote file name + * @param int $intConfigID Configuration target id + * @param string $strFileLocal Local file name + * @param int $intDirection 0 = from remote to local / 1 = from local to remote + * @return int 0 = successful / 1 = error + * Status message is stored in message class variables + */ + public function remoteFileCopy(string $strFileRemote, int $intConfigID, string $strFileLocal, int $intDirection = 0): int + { + /* Variable definitions */ + $intMethod = 3; + $intReturn = 0; + $strMethod = ''; + $arrTemp = array(); + /* Get method */ + if ($this->getConfigData($intConfigID, 'method', $strMethod) === 0) { + $intMethod = (int)$strMethod; + } + if ($intMethod === 2) { + /* Check connection */ + $intReturn = $this->getFTPConnection($intConfigID); + if (($intReturn === 0) && ($intDirection === 0)) { + $intErrorReporting = error_reporting(); + error_reporting(0); + if (!ftp_get($this->conFTPConId, $strFileLocal, $strFileRemote, FTP_ASCII)) { + $this->processClassMessage(translate('Cannot get the remote file (it does not exist or is not ' + . 'readable) - remote file: ') . $strFileRemote . '::', $this->strErrorMessage); + $intReturn = 1; + } + error_reporting($intErrorReporting); + } elseif (($intReturn === 0) && ($intDirection === 1)) { + $intErrorReporting = error_reporting(); + error_reporting(0); + if (!ftp_put($this->conFTPConId, $strFileRemote, $strFileLocal, FTP_ASCII)) { + $this->processClassMessage(translate('Cannot write the remote file (remote file is not writeable)' + . '- remote file: ') . $strFileRemote . '::', $this->strErrorMessage); + $intReturn = 1; + } + error_reporting($intErrorReporting); + } + ftp_close($this->conFTPConId); + } elseif ($intMethod === 3) { /* Remote file (SFTP) */ + $intReturn = $this->getSSHConnection($intConfigID); + if (($intReturn === 0) && ($intDirection === 0)) { + /* Copy file */ + $intErrorReporting = error_reporting(); + error_reporting(0); + if (!ssh2_scp_recv($this->resSSHConId, $strFileRemote, $strFileLocal)) { + if ($this->sendSSHCommand('ls ' . $strFileRemote, $arrTemp) !== 0) { + $this->processClassMessage(translate('Cannot get the remote file (it does not exist or is not ' + . 'readable) - remote file: ') . $strFileRemote . '::', $this->strErrorMessage); + } else { + $this->processClassMessage(translate('Remote file is not readable - remote file: ') + . $strFileRemote . '::', $this->strErrorMessage); + } + $intReturn = 1; + } + error_reporting($intErrorReporting); + } elseif (($intReturn === 0) && ($intDirection === 1)) { + if (file_exists($strFileLocal) && is_readable($strFileLocal)) { + $intErrorReporting = error_reporting(); + error_reporting(0); + if (!ssh2_scp_send($this->resSSHConId, $strFileLocal, $strFileRemote, 0644)) { + $this->processClassMessage(translate('Cannot write a remote file (remote file is not writeable)' + . ' - remote file: ') . $strFileRemote . '::', $this->strErrorMessage); + $intReturn = 1; + } + error_reporting($intErrorReporting); + } else { + $this->processClassMessage(translate('Cannot copy a local file to remote because the local file ' . + 'does not exist or is not readable - local file: ') . + $strFileLocal . '::', $this->strErrorMessage); + $intReturn = 1; + } + } + } + return $intReturn; + } + + /** + * Add files of a given directory to an array + * @param string $strSourceDir Source directory + * @param string $strIncPattern Include file pattern + * @param string $strExcPattern Exclude file pattern + * @param array|null $arrOutput Output array (by reference) + * @param string|null $strErrorMessage Error messages (by reference) + */ + public function storeDirToArray(string $strSourceDir, string $strIncPattern, string $strExcPattern, array &$arrOutput = null, string &$strErrorMessage = null): void + { + /* Define variables */ + $arrDir = array(); + while (substr($strSourceDir, -1) === '/' or substr($strSourceDir, -1) === "\\") { + $strSourceDir = substr($strSourceDir, 0, -1); + } + $resHandle = opendir($strSourceDir); + if ($resHandle === false) { + if ($this->intDomainId !== 0) { + $strErrorMessage .= translate('Could not open directory') . ': ' . $strSourceDir; + } + } else { + $booBreak = true; + while ($booBreak) { + if (!$arrDir[] = readdir($resHandle)) { + $booBreak = false; + } + } + closedir($resHandle); + sort($arrDir); + /** @var string $file */ + foreach ($arrDir as $file) { + /** @noinspection StrlenInEmptyStringCheckContextInspection */ + if (!preg_match("/^\.{1,2}/", $file) && strlen($file)) { + if (is_dir($strSourceDir . '/' . $file)) { + $this->storeDirToArray( + $strSourceDir . '/' . $file, + $strIncPattern, + $strExcPattern, + $arrOutput, + $strErrorMessage + ); + } else if (preg_match('/' . $strIncPattern . '/', $file) && (($strExcPattern === '') || + !preg_match('/' . $strExcPattern . '/', $file))) { + if (0 === stripos(PHP_OS_FAMILY, 'Windows')) { + $strSourceDir = str_replace('/', "\\", $strSourceDir); + $arrOutput [] = $strSourceDir . "\\" . $file; + } else { + $arrOutput [] = $strSourceDir . '/' . $file; + } + } + } + } } } /** - * Get configuration target IDs - * @param array $arrConfigId Configuration target IDs (by reference) - * @return int 0 = successful / 1 = error + * Determines the dates of the last data table change and the last modification to the configuration files + * @param string $strTableName Name of the data table + * @param array|null $arrTimeData Array with time data of table and all config files + * @param string|null $strCheckConfig Information string (text message) + * @return int 0 = successful / 1 = error + * Status message is stored in message class variables */ - public function getConfigSets(&$arrConfigId) + public function lastModifiedFile(string $strTableName, array &$arrTimeData = null, string &$strCheckConfig = null): int { - // Variable definition - $arrData = array(); - $arrConfigId = array(); + /* Variable definitions */ + /** @noinspection PhpUnusedLocalVariableInspection */ + $intEnableCommon = 0; + $arrDataset = array(); + $strFileName = ''; + $strCheckConfig = ''; + $intReturn = 0; + // Get configuration filename based on table name + $arrConfigData = $this->getConfData(); + if (isset($arrConfigData[$strTableName])) { + $strFileName = $arrConfigData[$strTableName]['filename']; + } else { + $intReturn = 1; + } + /* Get table times */ + $arrTimeData = array(); + $arrTimeData['table'] = 'unknown'; + $strConfigValue = ''; + /* Clear status cache */ + clearstatcache(); + if ($this->getDomainData('enable_common', $strConfigValue) === 0) { + $intEnableCommon = (int)$strConfigValue; + $strSQLAdd = ''; + if ($intEnableCommon === 1) { + $strSQLAdd = 'OR `domainId`=0'; + } + $strSQL = 'SELECT `updateTime` FROM `tbl_tablestatus` ' + . 'WHERE (`domainId`=' . $this->intDomainId . " $strSQLAdd) AND `tableName`='" . $strTableName . "' " + . 'ORDER BY `updateTime` DESC LIMIT 1'; + $booReturn = $this->myDBClass->hasSingleDataset($strSQL, $arrDataset); + if ($booReturn && isset($arrDataset['updateTime'])) { + $arrTimeData['table'] = $arrDataset['updateTime']; + } else { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `last_modified` FROM `' . $strTableName . '` ' + . 'WHERE `config_id`=' . $this->intDomainId . ' ORDER BY `last_modified` DESC LIMIT 1'; + $booReturn = $this->myDBClass->hasSingleDataset($strSQL, $arrDataset); + if (($booReturn === true) && isset($arrDataset['last_modified'])) { + $arrTimeData['table'] = $arrDataset['last_modified']; + } + } + } + /* Get config sets */ + $arrConfigId = array(); + $strTarget = ''; + $strBaseDir = ''; + $intFileStampTemp = 0; + $intRetVal2 = $this->getConfigSets($arrConfigId); + if ($intRetVal2 === 0) { + foreach ($arrConfigId as $intConfigId) { + /* Get configuration file data */ + $this->getConfigData($intConfigId, 'target', $strTarget); + $this->getConfigData($intConfigId, 'basedir', $strBaseDir); + /* Get time data */ + $intReturn = $this->getFileDate( + $intConfigId, + $strFileName, + $strBaseDir, + $intFileStampTemp, + $arrTimeData[$strTarget] + ); + if ($intFileStampTemp !== 0 && strtotime($arrTimeData['table']) > $intFileStampTemp) { + $strCheckConfig = translate('Warning: configuration file is out of date!'); + } + if ((string)$arrTimeData[$strTarget] === 'unknown') { + $strCheckConfig = translate('Warning: configuration file is out of date!'); + } + } + } else { + $strCheckConfig = translate('Warning: no configuration target defined!'); + } + return $intReturn; + } + + /** + * Determines the configuration data for each database table + * @return array filename (configuration file name) + * order_field (database order field) + */ + public function getConfData(): array + { + $arrConfData['tbl_timeperiod'] = array('filename' => 'timeperiods.cfg', + 'order_field' => 'timeperiod_name'); + $arrConfData['tbl_command'] = array('filename' => 'commands.cfg', + 'order_field' => 'command_name'); + $arrConfData['tbl_contact'] = array('filename' => 'contacts.cfg', + 'order_field' => 'contact_name'); + $arrConfData['tbl_contacttemplate'] = array('filename' => 'contacttemplates.cfg', + 'order_field' => 'template_name'); + $arrConfData['tbl_contactgroup'] = array('filename' => 'contactgroups.cfg', + 'order_field' => 'contactgroup_name'); + $arrConfData['tbl_hosttemplate'] = array('filename' => 'hosttemplates.cfg', + 'order_field' => 'template_name'); + $arrConfData['tbl_servicetemplate'] = array('filename' => 'servicetemplates.cfg', + 'order_field' => 'template_name'); + $arrConfData['tbl_hostgroup'] = array('filename' => 'hostgroups.cfg', + 'order_field' => 'hostgroup_name'); + $arrConfData['tbl_servicegroup'] = array('filename' => 'servicegroups.cfg', + 'order_field' => 'servicegroup_name'); + $arrConfData['tbl_hostdependency'] = array('filename' => 'hostdependencies.cfg', + 'order_field' => 'dependent_host_name'); + $arrConfData['tbl_servicedependency'] = array('filename' => 'servicedependencies.cfg', + 'order_field' => 'config_name'); + $arrConfData['tbl_hostescalation'] = array('filename' => 'hostescalations.cfg', + 'order_field' => 'host_name`,`hostgroup_name'); + $arrConfData['tbl_serviceescalation'] = array('filename' => 'serviceescalations.cfg', + 'order_field' => 'config_name'); + $arrConfData['tbl_hostextinfo'] = array('filename' => 'hostextinfo.cfg', + 'order_field' => 'host_name'); + $arrConfData['tbl_serviceextinfo'] = array('filename' => 'serviceextinfo.cfg', + 'order_field' => 'host_name'); + return $arrConfData; + } + + /** + * Get domain configuration parameters. + * @param string $strConfigItem Configuration key + * @param string|null $strValue Configuration value (by reference) + * @return int 0 = successful / 1 = error + */ + public function getDomainData(string $strConfigItem, string &$strValue = null): int + { + /* Variable definition */ + $intReturn = 0; + /* Request domain data from database */ + $strSQL = 'SELECT `' . $strConfigItem . '` FROM `tbl_datadomain` WHERE `id` = ' . $this->intDomainId; + $strValue = $this->myDBClass->getFieldData($strSQL); + if ($strValue === '') { + $intReturn = 1; + } + return $intReturn; + } + + /** + * Get configuration target IDs + * @param array|null $arrConfigId Configuration target IDs (by reference) + * @return int 0 = successful / 1 = error + */ + public function getConfigSets(array &$arrConfigId = null): int + { + /* Variable definition */ + $arrData = array(); + $arrConfigId = array(); $intDataCount = 0; - $intReturn = 1; - // Request target ID - $strSQL = 'SELECT `targets` FROM `tbl_datadomain` WHERE `id`=' .$this->intDomainId; + $intReturn = 1; + /* Request target ID */ + $strSQL = 'SELECT `targets` FROM `tbl_datadomain` WHERE `id`=' . $this->intDomainId; $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($booReturn && ($intDataCount != 0)) { + if ($booReturn && ($intDataCount !== 0)) { foreach ($arrData as $elem) { - $arrConfigId[] = $elem['targets']; + $arrConfigId[] = (int)$elem['targets']; } $intReturn = 0; } @@ -546,20 +966,1287 @@ class NagConfigClass } /** - * Moves an existing configuration file to the backup directory and removes then the original file - * @param string $strType Type of the configuration file - * @param string $strName Name of the configuration file - * @param int $intConfigID Configuration target ID - * @return int 0 = successful / 1 = error - * Status message is stored in message class variables + * Writes a configuration file including all datasets of a configuration table or returns the output as a text + * file for download. (Public master function) + * @param string $strTableName Table name + * @param int $intMode 0 = Write file to filesystem + * 1 = Return Textfile for download test + * @return int 0 = successful / 1 = error + * Status message is stored in message class variables */ - public function moveFile($strType, $strName, $intConfigID) + public function createConfig(string $strTableName, int $intMode = 0): int { - // Variable definitions + /* Define variables */ + $intReturn = 0; + /* Do not create configs in common domain */ + if ($this->intDomainId === 0) { + $this->processClassMessage(translate('It is not possible to write config files directly from the common ' + . 'domain!') . '::', $this->strErrorMessage); + $intReturn = 1; + } + if ($intReturn === 0) { + /* Get configuration targets */ + $this->getConfigSets($arrConfigID); + if (is_array($arrConfigID)) { + foreach ($arrConfigID as $intConfigID) { + $intReturn = $this->writeConfTemplate($intConfigID, $strTableName, $intMode); + } + } else { + $this->processClassMessage(translate('Warning: no configuration target defined!') . + '::', $this->strErrorMessage); + $intReturn = 1; + } + } + return $intReturn; + } + + /** + * Writes a configuration file including all datasets of a configuration table or returns the output as a text + * file for download. (Private worker function) + * @param int $intConfigID Configuration target ID + * @param string $strTableName Table name + * @param int $intMode 0 = Write file to filesystem + * 1 = Return Textfile for download test + * @param array $arrTableData Dataset array for host and services only + * @param int $intID Key for dataset array + * @return int 0 = successful / 1 = error + * Status message is stored in message class variables + */ + private function writeConfTemplate(int $intConfigID, string $strTableName, int $intMode, array $arrTableData = array(), int $intID = 0): int + { + /* Variable definitions */ + $strSQL = ''; + $strOrderField = ''; + $strFileString = ''; + $arrTplOptions = array('use_preg' => false); + $strDomainWhere = ' (`config_id`=' . $this->intDomainId . ') '; + $intType = 0; + $intReturn = 0; + $setUTF8Decode = 0; + $intNagiosVersion = 0; + $setEnableCommon = 0; + $strConfigValue = ''; + /* Read some settings and information */ + if ($this->getDomainData('utf8_decode', $strConfigValue) === 0) { + $setUTF8Decode = (int)$strConfigValue; + } + if ($this->getConfigData($intConfigID, 'version', $strConfigValue) === 0) { + $intNagiosVersion = (int)$strConfigValue; + } + if ($this->getDomainData('enable_common', $strConfigValue) === 0) { + $setEnableCommon = (int)$strConfigValue; + } + $arrConfigData = $this->getConfData(); + if (isset($arrConfigData[$strTableName])) { + $strFileString = str_replace('.cfg', '', $arrConfigData[$strTableName]['filename']); + $strOrderField = $arrConfigData[$strTableName]['order_field']; + } + /* Variable rewritting */ + if ($setEnableCommon !== 0) { + $strDomainWhere = str_replace(')', ' OR `config_id`=0)', $strDomainWhere); + } + /* Special processing for table host and service */ + $setTemplate = $strFileString . '.tpl.dat'; + if (($strTableName === 'tbl_host') || ($strTableName === 'tbl_service')) { + // Define variable names based on table name + switch ($strTableName) { + case 'tbl_host': + $strFileString = $arrTableData[$intID]['host_name']; + $intDomainId = $arrTableData[$intID]['config_id']; + $setTemplate = 'hosts.tpl.dat'; + $intType = 1; + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $strTableName . "` WHERE `host_name`='$strFileString' " + . "AND `active`='1' AND `config_id`=$intDomainId"; + break; + case 'tbl_service': + $strFileString = $arrTableData[$intID]['config_name']; + $intDomainId = $arrTableData[$intID]['config_id']; + $setTemplate = 'services.tpl.dat'; + $intType = 2; + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $strTableName . "` WHERE `config_name`='$strFileString' " + . "AND `active`='1' AND `config_id`=$intDomainId ORDER BY `service_description`"; + break; + } + } else { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $strTableName . "` WHERE $strDomainWhere AND `active`='1' " . + 'ORDER BY `' . $strOrderField . '`'; + } + $strFile = $strFileString . '.cfg'; + /* Load configuration template file */ + $tplConf = new HTML_Template_IT($this->arrSettings['path']['base_path'] . '/templates/files/'); + $tplConf->loadTemplatefile($setTemplate); + $tplConf->setOptions($arrTplOptions); + $tplConf->setVariable('CREATE_DATE', date('Y-m-d H:i:s')); + $tplConf->setVariable('NAGIOS_QL_VERSION', $this->arrSettings['db']['version']); + $tplConf->setVariable('VERSION', $this->getVersionString($intConfigID)); + /* Write data from configuration table */ + $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); + if ($booReturn && ($intDataCount !== 0) && ($strFileString !== '')) { + /* Process every data set */ + for ($i = 0; $i < $intDataCount; $i++) { + $intDataId = 0; + foreach ($arrData[$i] as $key => $value) { + if ((string)$key === 'id') { + $intDataId = $value; + } + if ((string)$key === 'config_name') { + $key = '#NAGIOSQL_CONFIG_NAME'; + } + /* UTF8 decoded vaules */ + if ($setUTF8Decode === 1) { + $value = mb_convert_encoding($value, 'UTF-8'); + } + /* Pass special fields (NagiosQL data fields not used by Nagios itselves) */ + if ($value === null) { + $value = ''; + } + if ($this->skipEntries($strTableName, $intNagiosVersion, $key, $value) === 1) { + continue; + } + /* Get relation data */ + $intSkip = $this->getRelationData($strTableName, $tplConf, $arrData[$i], $key, $value); + /* Rename field names */ + $this->renameFields($strTableName, $intConfigID, $intDataId, $key, $value, $intSkip); + /* Inset data field */ + if ($intSkip !== 1) { + /* Insert fill spaces */ + $strFillLen = (30 - strlen($key)); + $strSpace = ' '; + $strSpace .= str_repeat(' ', $strFillLen); + /* Write key and value to template */ + $tplConf->setVariable('ITEM_TITLE', $key . $strSpace); + /* Short values */ + if (($intNagiosVersion !== 3) || (strlen($value) < 800)) { + $tplConf->setVariable('ITEM_VALUE', $value); + $tplConf->parse('configline'); + } else { /* Long values */ + $arrValueTemp = explode(',', $value); + $strValueNew = ''; + $intArrCount = count($arrValueTemp); + $intCounter = 0; + $strSpace = ' '; + $strSpace .= str_repeat(' ', 30); + foreach ($arrValueTemp as $elem) { + if (strlen($strValueNew) < 800) { + $strValueNew .= $elem . ','; + } else { + if (substr($strValueNew, -1) === ',') { + $strValueNew = substr($strValueNew, 0, -1); + } + if ($intCounter < $intArrCount) { + $strValueNew .= ",\\"; + } + $tplConf->setVariable('ITEM_VALUE', $strValueNew); + $tplConf->parse('configline'); + $tplConf->setVariable('ITEM_TITLE', $strSpace); + $strValueNew = $elem . ','; + } + $intCounter++; + } + if ($strValueNew !== '') { + if (substr($strValueNew, -1) === ',') { + $strValueNew = substr($strValueNew, 0, -1); + } + $tplConf->setVariable('ITEM_VALUE', $strValueNew); + $tplConf->parse('configline'); + } + } + } + } + /* Special processing for time periods */ + if ($strTableName === 'tbl_timeperiod') { + $arrDataTime = array(); + $strSQLTime = 'SELECT `definition`, `range` ' + . 'FROM `tbl_timedefinition` WHERE `tipId` = ' . $arrData[$i]['id']; + $booReturn = $this->myDBClass->hasDataArray($strSQLTime, $arrDataTime, $intDataCountTime); + if ($booReturn && $intDataCountTime !== 0) { + foreach ($arrDataTime as $data) { + /* Skip other values than weekdays in nagios version below 3 */ + if ($intNagiosVersion < 3) { + $arrWeekdays = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', + 'sunday'); + if (!in_array($data['definition'], $arrWeekdays, true)) { + continue; + } + } + /* Insert fill spaces */ + $strFillLen = (30 - strlen($data['definition'])); + $strSpace = ' '; + $strSpace .= str_repeat(' ', $strFillLen); + /* Write key and value */ + $tplConf->setVariable('ITEM_TITLE', $data['definition'] . $strSpace); + $tplConf->setVariable('ITEM_VALUE', $data['range']); + /** @noinspection DisconnectedForeachInstructionInspection */ + $tplConf->parse('configline'); + } + } + } + /* Write configuration set */ + $tplConf->parse('configset'); + } + } elseif ($booReturn && ($intDataCount === 0) && ($strFileString !== '')) { + $this->processClassMessage(translate('Error while selecting data from database:') + . '::', $this->strErrorMessage); + $this->processClassMessage($this->myDBClass->strErrorMessage, $this->strErrorMessage); + $intReturn = 1; + } else { + $this->myDataClass->writeLog(translate('Writing of the configuration failed - no dataset ' + . 'or not activated dataset found')); + $this->processClassMessage(translate('Writing of the configuration failed - no dataset ' + . 'or not activated dataset found') . '::', $this->strErrorMessage); + $intReturn = 1; + } + if ($intMode === 0) { + $strCfgFile = ''; + $intReturn = $this->getConfigFile($strFile, $intConfigID, $intType, $resCfgFile, $strCfgFile); + if ($intReturn === 0) { + $tplConf->parse(); + $strContent = $tplConf->get(); + $intReturn = $this->writeConfigFile( + $strContent, + $strFile, + $intType, + $intConfigID, + $resCfgFile, + $strCfgFile + ); + } + } elseif ($intMode === 1) { + $tplConf->show(); + } + return $intReturn; + } + + /* PRIVATE functions */ + + /** + * Get Nagios version string + * @param int $intConfigID Configuration target ID + * @return string Version string + */ + private function getVersionString(int $intConfigID): string + { + $strConfigValue = ''; + $intVersion = 0; + $arrVersion = array( + 'Nagios 2.x config file', + 'Nagios 2.9 config file', + 'Nagios 3.x config file', + 'Nagios 4.x config file' + ); + if ($this->getConfigData($intConfigID, 'version', $strConfigValue) === 0) { + $intVersion = (int)$strConfigValue; + } + if (($intVersion >= 1) && ($intVersion <= count($arrVersion))) { + $strVersion = $arrVersion[$intVersion - 1]; + } else { + $strVersion = ''; + } + return $strVersion; + } + + /** + * Skip database values based on Nagios version + * @param string $strTableName Table name + * @param int $intVersionValue Nagios version value + * @param string $key Data key + * @param string $value Data value + * @return int 1 = Skip entry / 0 = Pass entry + */ + private function skipEntries(string $strTableName, int $intVersionValue, string $key, string &$value): int + { + /* Define variables */ + $arrOption = array(); + $intReturn = 0; + /* Skip common fields */ + $strSpecial = 'id,active,last_modified,access_rights,access_group,config_id,template,nodelete,command_type,'; + $strSpecial .= 'import_hash'; + + /* Skip fields of special tables */ + if ($strTableName === 'tbl_hosttemplate') { + $strSpecial .= ',parents_tploptions,hostgroups_tploptions,contacts_tploptions'; + $strSpecial .= ',contact_groups_tploptions,use_template_tploptions'; + } + if ($strTableName === 'tbl_servicetemplate') { + $strSpecial .= ',host_name_tploptions,hostgroup_name_tploptions,parents_tploptions,contacts_tploptions'; + $strSpecial .= ',servicegroups_tploptions,contact_groups_tploptions,use_template_tploptions'; + } + if ($strTableName === 'tbl_contact') { + $strSpecial .= ',use_template_tploptions,contactgroups_tploptions'; + $strSpecial .= ',host_notification_commands_tploptions,service_notification_commands_tploptions'; + } + if ($strTableName === 'tbl_contacttemplate') { + $strSpecial .= ',use_template_tploptions,contactgroups_tploptions'; + $strSpecial .= ',host_notification_commands_tploptions,service_notification_commands_tploptions'; + } + if ($strTableName === 'tbl_host') { + $strSpecial .= ',parents_tploptions,hostgroups_tploptions,contacts_tploptions'; + $strSpecial .= ',contact_groups_tploptions,use_template_tploptions'; + } + if ($strTableName === 'tbl_service') { + $strSpecial .= ',host_name_tploptions,hostgroup_name_tploptions,parents_tploptions'; + $strSpecial .= ',servicegroups_tploptions,contacts_tploptions,contact_groups_tploptions'; + $strSpecial .= ',use_template_tploptions'; + } + if ($strTableName === 'tbl_command') { + $strSpecial .= ',arg1_info,arg2_info,arg3_info,arg4_info,arg5_info,arg6_info,arg7_info,arg8_info'; + } + + /* Pass fields based on nagios version lower than 3.x */ + if ($intVersionValue < 3) { + if ($strTableName === 'tbl_timeperiod') { + $strSpecial .= ',use_template,exclude,name'; + } + if (($strTableName === 'tbl_contact') || ($strTableName === 'tbl_contacttemplate')) { + $strSpecial .= ',host_notifications_enabled,service_notifications_enabled,can_submit_commands'; + $strSpecial .= ',retain_status_information,retain_nonstatus_information'; + $arrOption['host_notification_options'] = ',s'; + $arrOption['service_notification_options'] = ',s'; + } + if ($strTableName === 'tbl_contactgroup') { + $strSpecial .= ',contactgroup_members'; + } + if ($strTableName === 'tbl_hostgroup') { + $strSpecial .= ',hostgroup_members,notes,notes_url,action_url'; + } + if ($strTableName === 'tbl_servicegroup') { + $strSpecial .= ',servicegroup_members,notes,notes_url,action_url'; + } + if ($strTableName === 'tbl_hostdependency') { + $strSpecial .= ',dependent_hostgroup_name,hostgroup_name,dependency_period'; + } + if ($strTableName === 'tbl_hostescalation') { + $strSpecial .= ',contacts'; + } + if ($strTableName === 'tbl_servicedependency') { + $strSpecial .= ',dependent_hostgroup_name,hostgroup_name,dependency_period,dependent_servicegroup_name'; + $strSpecial .= ',servicegroup_name'; + } + if ($strTableName === 'tbl_serviceescalation') { + $strSpecial .= ',hostgroup_name,contacts,servicegroup_name'; + } + if (($strTableName === 'tbl_host') || ($strTableName === 'tbl_hosttemplate')) { + $strSpecial .= ',initial_state,flap_detection_options,contacts,notes,notes_url,action_url'; + $strSpecial .= ',icon_image,icon_image_alt,vrml_image,statusmap_image,2d_coords,3d_coords'; + $arrOption['notification_options'] = ',s'; + } + /* Services */ + if (($strTableName === 'tbl_service') || ($strTableName === 'tbl_servicetemplate')) { + $strSpecial .= ',initial_state,flap_detection_options,contacts,notes,notes_url,action_url'; + $strSpecial .= ',icon_image,icon_image_alt'; + $arrOption['notification_options'] = ',s'; + } + } + /* Pass fields based on nagios version higher than 2.x */ + if ($intVersionValue > 2) { + if ($strTableName === 'tbl_servicetemplate') { + $strSpecial .= ',parallelize_check '; + } + if ($strTableName === 'tbl_service') { + $strSpecial .= ',parallelize_check'; + } + } + /* Pass fields based on nagios version lower than 4.x */ + if ($intVersionValue < 4) { + if (($strTableName === 'tbl_contact') || ($strTableName === 'tbl_contacttemplate')) { + $strSpecial .= ',minimum_importance'; + } + if (($strTableName === 'tbl_host') || ($strTableName === 'tbl_hosttemplate')) { + $strSpecial .= ',importance'; + } + if (($strTableName === 'tbl_service') || ($strTableName === 'tbl_servicetemplate')) { + $strSpecial .= ',importance,parents'; + } + } + if ($intVersionValue === 1) { + $strSpecial .= ''; + } + /* Reduce option values */ + if (array_key_exists($key, $arrOption) && (count($arrOption) !== 0)) { + $value = str_replace(array($arrOption[$key], str_replace(',', '', $arrOption[$key])), '', $value); + if ($value === '') { + $intReturn = 1; + } + } + if ($intReturn === 0) { + /* Skip entries */ + $arrSpecial = explode(',', $strSpecial); + if (((string)$value === '') || in_array($key, $arrSpecial, true)) { + $intReturn = 1; + } + } + if ($intReturn === 0) { + /* Do not write config data (based on 'skip' option) */ + $strNoTwo = 'active_checks_enabled,passive_checks_enabled,obsess_over_host,check_freshness,'; + $strNoTwo .= 'event_handler_enabled,flap_detection_enabled,process_perf_data,retain_status_information,'; + $strNoTwo .= 'retain_nonstatus_information,notifications_enabled,parallelize_check,is_volatile,'; + $strNoTwo .= 'host_notifications_enabled,service_notifications_enabled,can_submit_commands,'; + $strNoTwo .= 'obsess_over_service'; + foreach (explode(',', $strNoTwo) as $elem) { + if (($key === $elem) && ((string)$value === '2')) { + $intReturn = 1; + } + if (($intVersionValue < 3) && ($key === $elem) && ((string)$value === '3')) { + $intReturn = 1; + } + } + } + return $intReturn; + } + + /** + * Get related data + * @param string $strTableName Table name + * @param HTML_Template_IT $resTemplate Template ressource + * @param array $arrData Dataset array + * @param string $strDataKey Data key + * @param string|null $strDataValue Data value + * @return int 0 = use data / 1 = skip data + * Status message is stored in message class variables + */ + private function getRelationData(string $strTableName, HTML_Template_IT $resTemplate, array $arrData, string $strDataKey, string &$strDataValue = null): int + { + /* Define variables */ + $intReturn = 0; + $intSkipProc = 0; + $arrRelations = array(); + /* Pass function for tbl_command */ + if ($strTableName === 'tbl_command') { + $intSkipProc = 1; + } + /* Get relation info and store the value in a class variable (speedup export) */ + if (($intSkipProc === 0) && ($this->strRelTable !== $strTableName)) { + $intReturn = $this->myDataClass->tableRelations($strTableName, $arrRelations); + $this->strRelTable = $strTableName; + $this->arrRelData = $arrRelations; + } elseif ($intSkipProc === 0) { + $arrRelations = $this->arrRelData; + $intReturn = 0; + } + if (($intSkipProc === 0) && (!is_array($arrRelations))) { + $intSkipProc = 1; + $intReturn = 1; + } + if ($intSkipProc === 0) { + /* Common domain is enabled? */ + $this->getDomainData('enable_common', $strCommonEnable); + $intCommonEnable = (int)$strCommonEnable; + if ($intCommonEnable === 1) { + $strDomainWhere1 = ' (`config_id`=' . $this->intDomainId . ' OR `config_id`=0) '; + } else { + $strDomainWhere1 = ' `config_id`=' . $this->intDomainId . ' '; + } + /* Process relations */ + foreach ($arrRelations as $elem) { + if ($elem['fieldName'] === $strDataKey) { + /* Process normal 1:n relations (1 = only data / 2 = including a * value) */ + if (((int)$elem['type'] === 2) && (((int)$strDataValue === 1) || ((int)$strDataValue === 2))) { + $intReturn = $this->processRelation1($arrData, $strDataValue, $elem, $strDomainWhere1); + /* Process normal 1:1 relations */ + } elseif ((int)$elem['type'] === 1) { + $intReturn = $this->processRelation2($arrData, $strDataValue, $elem, $strDomainWhere1); + /* Process normal 1:n relations with special table and idSort (template tables) */ + } elseif (((int)$elem['type'] === 3) && ((int)$strDataValue === 1)) { + $intReturn = $this->processRelation3($arrData, $strDataValue, $elem, $strDomainWhere1); + /* Process special 1:n:str relations with string values (servicedependencies) */ + } elseif (((int)$elem['type'] === 6) && (((int)$strDataValue === 1) || ((int)$strDataValue === 2))) { + $intReturn = $this->processRelation4($arrData, $strDataValue, $elem, $strDomainWhere1); + /* Process special relations for free variables */ + } elseif (((int)$elem['type'] === 4) && ((int)$strDataValue === 1) && ($this->intNagVersion >= 3)) { + $intReturn = $this->processRelation5($resTemplate, $arrData, $elem); + /* Process special relations for service groups */ + } elseif (((int)$elem['type'] === 5) && ((int)$strDataValue === 1)) { + $intReturn = $this->processRelation6($arrData, $strDataValue, $elem, $strDomainWhere1); + /* Process special relations for service parents */ + } elseif (((int)$elem['type'] === 7) && ((int)$strDataValue === 1)) { + $intReturn = $this->processRelation7($arrData, $strDataValue, $elem); + /* Process "*" */ + } elseif ((int)$strDataValue === 2) { + $strDataValue = '*'; + } else { + $intReturn = 1; + } + } + } + } + return $intReturn; + } + + /** + * @param array $arrData Dataset array + * @param string $strDataValue Data value + * @param array $elem Relation data array + * @param string $strDomainWhere1 SQL WHERE add-in + * @return int 0 = use data / 1 = skip data + */ + private function processRelation1(array $arrData, string &$strDataValue, array $elem, string $strDomainWhere1): int + { + /* Define variables */ + $arrDataRel = array(); + $intDataCountRel = 0; + $intReturn = 0; + /* Get relation data */ + $strSQLRel = 'SELECT `' . $elem['tableName1'] . '`.`' . $elem['target1'] . '`, `' . $elem['linkTable'] . + '`.`exclude` FROM `' . $elem['linkTable'] . '` LEFT JOIN `' . $elem['tableName1'] . + '` ON `' . $elem['linkTable'] . '`.`idSlave` = `' . $elem['tableName1'] . '`.`id`' . + 'WHERE `idMaster`=' . $arrData['id'] . " AND `active`='1' AND $strDomainWhere1" . + 'ORDER BY `' . $elem['tableName1'] . '`.`' . $elem['target1'] . '`'; + $booReturn = $this->myDBClass->hasDataArray($strSQLRel, $arrDataRel, $intDataCountRel); + if ($booReturn && ($intDataCountRel !== 0)) { + /* Rewrite $strDataValue with returned relation data */ + if ((int)$strDataValue === 2) { + $strDataValue = '*,'; + } else { + $strDataValue = ''; + } + foreach ($arrDataRel as $data) { + if ((int)$data['exclude'] === 0) { + $strDataValue .= $data[$elem['target1']] . ','; + } elseif ($this->intNagVersion >= 3) { + $strDataValue .= '!' . $data[$elem['target1']] . ','; + } + } + $strDataValue = substr($strDataValue, 0, -1); + if ($strDataValue === '') { + $intReturn = 1; + } + } else if ((int)$strDataValue === 2) { + $strDataValue = '*'; + } else { + $intReturn = 1; + } + return $intReturn; + } + + /** + * @param array $arrData Dataset array + * @param string $strDataValue Data value + * @param array $elem Relation data array + * @param string $strDomainWhere1 SQL WHERE add-in + * @return int 0 = use data / 1 = skip data + */ + private function processRelation2(array $arrData, string &$strDataValue, array $elem, string $strDomainWhere1): int + { + /* Define variables */ + $arrDataRel = array(); + $arrField = array(); + $intDataCountRel = 0; + $intReturn = 0; + $strCommand = ''; + /* Get relation data */ + if (((string)$elem['tableName1'] === 'tbl_command') && + (substr_count($arrData[$elem['fieldName']], '!') !== 0)) { + $arrField = explode('!', $arrData[$elem['fieldName']]); + $strCommand = strstr($arrData[$elem['fieldName']], '!'); + $strSQLRel = 'SELECT `' . $elem['target1'] . '` FROM `' . $elem['tableName1'] . '`' . + 'WHERE `id`=' . $arrField[0] . " AND `active`='1' AND $strDomainWhere1"; + } else { + $strSQLRel = 'SELECT `' . $elem['target1'] . '` FROM `' . $elem['tableName1'] . '`' . + 'WHERE `id`=' . $arrData[$elem['fieldName']] . " AND `active`='1' AND $strDomainWhere1"; + } + $booReturn = $this->myDBClass->hasDataArray($strSQLRel, $arrDataRel, $intDataCountRel); + if ($booReturn && ($intDataCountRel !== 0)) { + /* Rewrite $strDataValue with returned relation data */ + if (((string)$elem['tableName1'] === 'tbl_command') && (substr_count($strDataValue, '!') !== 0)) { + $strDataValue = $arrDataRel[0][$elem['target1']] . $strCommand; + } else { + $strDataValue = $arrDataRel[0][$elem['target1']]; + } + } else if (((string)$elem['tableName1'] === 'tbl_command') && (substr_count($strDataValue, '!') !== 0) && + ((int)$arrField[0] === -1)) { + $strDataValue = 'null'; + } else { + $intReturn = 1; + } + return $intReturn; + } + + /** + * @param array $arrData Dataset array + * @param string $strDataValue Data value + * @param array $elem Relation data array + * @param string $strDomainWhere1 SQL WHERE add-in + * @return int 0 = use data / 1 = skip data + */ + private function processRelation3(array $arrData, string &$strDataValue, array $elem, string $strDomainWhere1): int + { + /* Define variables */ + $arrDataRel = array(); + $intDataCountRel = 0; + $intReturn = 0; + /* Get relation data */ + /** @noinspection SqlResolve */ + $strSQLRel = 'SELECT * FROM `' . $elem['linkTable'] . '` WHERE `idMaster`=' . $arrData['id'] . ' ORDER BY idSort'; + $booReturn = $this->myDBClass->hasDataArray($strSQLRel, $arrDataRel, $intDataCountRel); + if ($booReturn && ($intDataCountRel !== 0)) { + /* Rewrite $strDataValue with returned relation data */ + $strDataValue = ''; + foreach ($arrDataRel as $data) { + if ((int)$data['idTable'] === 1) { + $strSQLName = 'SELECT `' . $elem['target1'] . '` FROM `' . $elem['tableName1'] . '`' . + "WHERE `active`='1' AND $strDomainWhere1 AND `id`=" . $data['idSlave']; + } else { + $strSQLName = 'SELECT `' . $elem['target2'] . '` FROM `' . $elem['tableName2'] . '`' . + "WHERE `active`='1' AND $strDomainWhere1 AND `id`=" . $data['idSlave']; + } + $strDataValue .= $this->myDBClass->getFieldData($strSQLName) . ','; + } + $strDataValue = substr($strDataValue, 0, -1); + } else { + $intReturn = 1; + } + return $intReturn; + } + + /** + * @param array $arrData Dataset array + * @param string $strDataValue Data value + * @param array $elem Relation data array + * @param string $strDomainWhere1 SQL WHERE add-in + * @return int 0 = use data / 1 = skip data + */ + private function processRelation4(array $arrData, string &$strDataValue, array $elem, string $strDomainWhere1): int + { + /* Define variables */ + $arrDataRel = array(); + $intDataCountRel = 0; + $intReturn = 0; + /* Get relation data */ + $strSQLRel = 'SELECT `' . $elem['linkTable'] . '`.`strSlave`, `' . $elem['linkTable'] . '`.`exclude` ' . + 'FROM `' . $elem['linkTable'] . '` ' . + 'LEFT JOIN `tbl_service` ON `' . $elem['linkTable'] . '`.`idSlave`=`tbl_service`.`id` ' . + 'WHERE `' . $elem['linkTable'] . '`.`idMaster`=' . $arrData['id'] . " AND `active`='1' AND " . + $strDomainWhere1 . ' ' . + 'ORDER BY `' . $elem['linkTable'] . '`.`strSlave`'; + $booReturn = $this->myDBClass->hasDataArray($strSQLRel, $arrDataRel, $intDataCountRel); + if ($booReturn && ($intDataCountRel !== 0)) { + /* Rewrite $strDataValue with returned relation data */ + if ((int)$strDataValue === 2) { + $strDataValue = '*,'; + } else { + $strDataValue = ''; + } + foreach ($arrDataRel as $data) { + if ((int)$data['exclude'] === 0) { + $strDataValue .= $data['strSlave'] . ','; + } elseif ($this->intNagVersion >= 3) { + $strDataValue .= '!' . $data['strSlave'] . ','; + } + } + $strDataValue = substr($strDataValue, 0, -1); + if ($strDataValue === '') { + $intReturn = 1; + } + } else if ((int)$strDataValue === 2) { + $strDataValue = '*'; + } else { + $intReturn = 1; + } + return $intReturn; + } + + /** + * @param HTML_Template_IT $resTemplate Template object + * @param array $arrData Dataset array + * @param array $elem Relation data array + * @return int 0 = use data / 1 = skip data + */ + private function processRelation5(HTML_Template_IT $resTemplate, array $arrData, array $elem): int + { + /* Define variables */ + $arrDataRel = array(); + $intDataCountRel = 0; + /** @noinspection SqlResolve */ + $strSQLRel = 'SELECT * FROM `tbl_variabledefinition` LEFT JOIN `' . $elem['linkTable'] . '` ' . + 'ON `id`=`idSlave` WHERE `idMaster`=' . $arrData['id'] . ' ORDER BY `name`'; + $booReturn = $this->myDBClass->hasDataArray($strSQLRel, $arrDataRel, $intDataCountRel); + if ($booReturn && ($intDataCountRel !== 0)) { + foreach ($arrDataRel as $vardata) { + /* Insert fill spaces */ + $strFillLen = (30 - strlen($vardata['name'])); + $strSpace = ' '; + $strSpace .= str_repeat(' ', $strFillLen); + $resTemplate->setVariable('ITEM_TITLE', $vardata['name'] . $strSpace); + $resTemplate->setVariable('ITEM_VALUE', html_entity_decode($vardata['value'], ENT_QUOTES | ENT_XML1, 'UTF-8')); + /** @noinspection DisconnectedForeachInstructionInspection */ + $resTemplate->parse('configline'); + } + } + return 1; + } + + /** + * @param array $arrData Dataset array + * @param string $strDataValue Data value + * @param array $elem Relation data array + * @param string $strDomainWhere1 SQL WHERE add-in + * @return int 0 = use data / 1 = skip data + */ + private function processRelation6(array $arrData, string &$strDataValue, array $elem, string $strDomainWhere1): int + { + /* Define variables */ + $arrDataRel = array(); + $arrHG1 = array(); + $arrHG2 = array(); + $intDataCountRel = 0; + $intHG1 = 0; + $intHG2 = 0; + $intReturn = 0; + /* Get relation data */ + /** @noinspection SqlResolve */ + $strSQLMaster = 'SELECT * FROM `' . $elem['linkTable'] . '` WHERE `idMaster`=' . $arrData['id']; + $booReturn = $this->myDBClass->hasDataArray($strSQLMaster, $arrDataRel, $intDataCountRel); + if ($booReturn && ($intDataCountRel !== 0)) { + /* Rewrite $strDataValue with returned relation data */ + $strDataValue = ''; + foreach ($arrDataRel as $data) { + /* Get excluded hosts */ + $arrExclude = array(); + $strSQLEx = 'SELECT `idSlave` FROM `tbl_lnkServiceToHost` WHERE `exclude`=1 AND `idMaster`=' . + $data['idSlaveS']; + $booReturn = $this->myDBClass->hasDataArray($strSQLEx, $arrEx, $intEx); + if ($booReturn && ($intEx !== 0)) { + foreach ($arrEx as $elemEx) { + $arrExclude[] = $elemEx['idSlave']; + } + } + if ((int)$data['idSlaveHG'] !== 0) { + /* Get Sevices */ + $strSQLSrv = 'SELECT `' . $elem['target2'] . '` FROM `' . $elem['tableName2'] . + '` WHERE `id`=' . $data['idSlaveS']; + $strService = $this->myDBClass->getFieldData($strSQLSrv); + $strSQLHG1 = 'SELECT `host_name`, `idSlave` FROM `tbl_host` ' . + 'LEFT JOIN `tbl_lnkHostgroupToHost` ON `id`=`idSlave` ' . + 'WHERE `idMaster`=' . $data['idSlaveHG'] . " AND `active`='1' AND `exclude`=0 " . + "AND $strDomainWhere1"; + $booReturn = $this->myDBClass->hasDataArray($strSQLHG1, $arrHG1, $intHG1); + if ($booReturn && ($intHG1 !== 0)) { + foreach ($arrHG1 as $elemHG1) { + if (!in_array($elemHG1['idSlave'], $arrExclude, true) && + substr_count($strDataValue, $elemHG1['host_name'] . ',' . $strService) === 0) { + $strDataValue .= $elemHG1['host_name'] . ',' . $strService . ','; + } + } + } + $strSQLHG2 = 'SELECT `host_name`, `idMaster` FROM `tbl_host` ' . + 'LEFT JOIN `tbl_lnkHostToHostgroup` ON `id`=`idMaster` ' . + 'WHERE `idSlave`=' . $data['idSlaveHG'] . " AND `active`='1' AND `exclude`=0 " . + "AND $strDomainWhere1"; + $booReturn = $this->myDBClass->hasDataArray($strSQLHG2, $arrHG2, $intHG2); + if ($booReturn && ($intHG2 !== 0)) { + foreach ($arrHG2 as $elemHG2) { + if (!in_array($elemHG2['idMaster'], $arrExclude, true) && + substr_count($strDataValue, $elemHG2['host_name'] . ',' . $strService) === 0) { + $strDataValue .= $elemHG2['host_name'] . ',' . $strService . ','; + } + } + } + } else { + $strSQLHost = 'SELECT `' . $elem['target1'] . '` FROM `' . $elem['tableName1'] . '` ' . + 'WHERE `id`=' . $data['idSlaveH'] . " AND `active`='1' AND $strDomainWhere1"; + $strHost = $this->myDBClass->getFieldData($strSQLHost); + $strSQLSrv = 'SELECT `' . $elem['target2'] . '` FROM `' . $elem['tableName2'] . '` ' . + 'WHERE `id`=' . $data['idSlaveS'] . " AND `active`='1' AND $strDomainWhere1"; + $strService = $this->myDBClass->getFieldData($strSQLSrv); + if (($strHost !== '') && ($strService !== '') && + substr_count($strDataValue, $strHost . ',' . $strService) === 0 && + !in_array($data['idSlaveH'], $arrExclude, true)) { + $strDataValue .= $strHost . ',' . $strService . ','; + } + } + } + $strDataValue = substr($strDataValue, 0, -1); + if ($strDataValue === '') { + $intReturn = 1; + } + } else { + $intReturn = 1; + } + return $intReturn; + } + + /** + * @param array $arrData Dataset array + * @param string $strDataValue Data value + * @param array $elem Relation data array + * @return int 0 = use data / 1 = skip data + */ + private function processRelation7(array $arrData, string &$strDataValue, array $elem): int + { + $intReturn = 1; + /* Get relation data */ + /** @noinspection SqlResolve */ + $strSQLMaster = 'SELECT * FROM `' . $elem['linkTable'] . '` WHERE `idMaster`=' . $arrData['id']; + $booReturn = $this->myDBClass->hasDataArray($strSQLMaster, $arrDataRel, $intDataCountRel); + if ($booReturn && ($intDataCountRel !== 0)) { + /* Rewrite $strDataValue with returned relation data */ + $strDataValue = ''; + /** @var array $arrDataRel */ + foreach ($arrDataRel as $data) { + $strSQL = 'SELECT host_name FROM tbl_host WHERE id=' . $data['idHost']; + $strHost = $this->myDBClass->getFieldData($strSQL); + $strSQL = 'SELECT service_description FROM tbl_service WHERE id=' . $data['idSlave']; + $strService = $this->myDBClass->getFieldData($strSQL); + $strDataValue .= $strHost . ',' . $strService . ','; + $intReturn = 0; + } + $strDataValue = substr($strDataValue, 0, -1); + } + return $intReturn; + } + + /** + * Rename field names + * @param string $strTableName Table name + * @param int $intConfigID Configuration target ID + * @param int $intDataId Data ID + * @param string $key Data key (by reference) + * @param string $value Data value (by reference) + * @param int $intSkip Skip value (by reference) 1 = skip / 0 = pass + */ + private function renameFields(string $strTableName, int $intConfigID, int $intDataId, string &$key, string &$value, int &$intSkip): void + { + if ($this->intNagVersion === 0) { + $this->getConfigData($intConfigID, 'version', $this->intNagVersion); + } + /* Picture path */ + if ($this->strPicPath === 'none') { + $this->getConfigData($intConfigID, 'picturedir', $this->strPicPath); + } + if ($key === 'icon_image') { + $value = $this->strPicPath . $value; + } + if ($key === 'vrml_image') { + $value = $this->strPicPath . $value; + } + if ($key === 'statusmap_image') { + $value = $this->strPicPath . $value; + } + /* Tables */ + if ($strTableName === 'tbl_host') { + if ($key === 'use_template') { + $key = 'use'; + } + $strVIValues = 'active_checks_enabled,passive_checks_enabled,check_freshness,obsess_over_host,'; + $strVIValues .= 'event_handler_enabled,flap_detection_enabled,process_perf_data,retain_status_information,'; + $strVIValues .= 'retain_nonstatus_information,notifications_enabled'; + if (in_array($key, explode(',', $strVIValues), true)) { + if ((int)$value === -1) { + $value = 'null'; + } + if ((int)$value === 3) { + $value = 'null'; + } + } + if ($key === 'parents') { + $value = $this->checkTpl($value, 'parents_tploptions', 'tbl_host', $intDataId, $intSkip); + } + if ($key === 'hostgroups') { + $value = $this->checkTpl($value, 'hostgroups_tploptions', 'tbl_host', $intDataId, $intSkip); + } + if ($key === 'contacts') { + $value = $this->checkTpl($value, 'contacts_tploptions', 'tbl_host', $intDataId, $intSkip); + } + if ($key === 'contact_groups') { + $value = $this->checkTpl($value, 'contact_groups_tploptions', 'tbl_host', $intDataId, $intSkip); + } + if ($key === 'use') { + $value = $this->checkTpl($value, 'use_template_tploptions', 'tbl_host', $intDataId, $intSkip); + } + if ($key === 'check_command') { + $value = str_replace("\::bang::", "\!", $value); + } + if ($key === 'check_command') { + $value = str_replace('::bang::', "\!", $value); + } + } + if ($strTableName === 'tbl_service') { + if ($key === 'use_template') { + $key = 'use'; + } + if ($this->intNagVersion < 2) { + if ($key === 'check_interval') { + $key = 'normal_check_interval'; + } + if ($key === 'retry_interval') { + $key = 'retry_check_interval'; + } + } + $strVIValues = 'is_volatile,active_checks_enabled,passive_checks_enabled,parallelize_check,'; + $strVIValues .= 'obsess_over_service,check_freshness,event_handler_enabled,flap_detection_enabled,'; + $strVIValues .= 'process_perf_data,retain_status_information,retain_nonstatus_information,'; + $strVIValues .= 'notifications_enabled'; + if (in_array($key, explode(',', $strVIValues), true)) { + if ((int)$value === -1) { + $value = 'null'; + } + if ((int)$value === 3) { + $value = 'null'; + } + } + if ($key === 'host_name') { + $value = $this->checkTpl($value, 'host_name_tploptions', 'tbl_service', $intDataId, $intSkip); + } + if ($key === 'hostgroup_name') { + $value = $this->checkTpl($value, 'hostgroup_name_tploptions', 'tbl_service', $intDataId, $intSkip); + } + if ($key === 'parents') { + $value = $this->checkTpl($value, 'parents_tploptions', 'tbl_service', $intDataId, $intSkip); + } + if ($key === 'servicegroups') { + $value = $this->checkTpl($value, 'servicegroups_tploptions', 'tbl_service', $intDataId, $intSkip); + } + if ($key === 'contacts') { + $value = $this->checkTpl($value, 'contacts_tploptions', 'tbl_service', $intDataId, $intSkip); + } + if ($key === 'contact_groups') { + $value = $this->checkTpl($value, 'contact_groups_tploptions', 'tbl_service', $intDataId, $intSkip); + } + if ($key === 'use') { + $value = $this->checkTpl($value, 'use_template_tploptions', 'tbl_service', $intDataId, $intSkip); + } + if ($key === 'check_command') { + $value = str_replace("\::bang::", "\!", $value); + } + if ($key === 'check_command') { + $value = str_replace('::bang::', "\!", $value); + } + } + if ($strTableName === 'tbl_hosttemplate') { + if ($key === 'template_name') { + $key = 'name'; + } + if ($key === 'use_template') { + $key = 'use'; + } + $strVIValues = 'active_checks_enabled,passive_checks_enabled,check_freshness,obsess_over_host,'; + $strVIValues .= 'event_handler_enabled,flap_detection_enabled,process_perf_data,retain_status_information,'; + $strVIValues .= 'retain_nonstatus_information,notifications_enabled'; + if (in_array($key, explode(',', $strVIValues), true)) { + if ((int)$value === -1) { + $value = 'null'; + } + if ((int)$value === 3) { + $value = 'null'; + } + } + if ($key === 'parents') { + $value = $this->checkTpl($value, 'parents_tploptions', 'tbl_hosttemplate', $intDataId, $intSkip); + } + if ($key === 'hostgroups') { + $value = $this->checkTpl($value, 'hostgroups_tploptions', 'tbl_hosttemplate', $intDataId, $intSkip); + } + if ($key === 'contacts') { + $value = $this->checkTpl($value, 'contacts_tploptions', 'tbl_hosttemplate', $intDataId, $intSkip); + } + if ($key === 'contact_groups') { + $value = $this->checkTpl($value, 'contact_groups_tploptions', 'tbl_hosttemplate', $intDataId, $intSkip); + } + if ($key === 'use') { + $value = $this->checkTpl($value, 'use_template_tploptions', 'tbl_hosttemplate', $intDataId, $intSkip); + } + } + if ($strTableName === 'tbl_servicetemplate') { + if ($key === 'template_name') { + $key = 'name'; + } + if ($key === 'use_template') { + $key = 'use'; + } + if ($this->intNagVersion < 2) { + if ($key === 'check_interval') { + $key = 'normal_check_interval'; + } + if ($key === 'retry_interval') { + $key = 'retry_check_interval'; + } + } + $strVIValues = 'is_volatile,active_checks_enabled,passive_checks_enabled,parallelize_check,'; + $strVIValues .= 'obsess_over_service,check_freshness,event_handler_enabled,flap_detection_enabled,'; + $strVIValues .= 'process_perf_data,retain_status_information,retain_nonstatus_information,'; + $strVIValues .= 'notifications_enabled'; + if (in_array($key, explode(',', $strVIValues), true)) { + if ((int)$value === -1) { + $value = 'null'; + } + if ((int)$value === 3) { + $value = 'null'; + } + } + if ($key === 'host_name') { + $value = $this->checkTpl($value, 'host_name_tploptions', 'tbl_servicetemplate', $intDataId, $intSkip); + } + if ($key === 'hostgroup_name') { + $value = $this->checkTpl( + $value, + 'hostgroup_name_tploptions', + 'tbl_servicetemplate', + $intDataId, + $intSkip + ); + } + if ($key === 'parents') { + $value = $this->checkTpl($value, 'parents_tploptions', 'tbl_servicetemplate', $intDataId, $intSkip); + } + if ($key === 'servicegroups') { + $value = $this->checkTpl( + $value, + 'servicegroups_tploptions', + 'tbl_servicetemplate', + $intDataId, + $intSkip + ); + } + if ($key === 'contacts') { + $value = $this->checkTpl($value, 'contacts_tploptions', 'tbl_servicetemplate', $intDataId, $intSkip); + } + if ($key === 'contact_groups') { + $value = $this->checkTpl( + $value, + 'contact_groups_tploptions', + 'tbl_servicetemplate', + $intDataId, + $intSkip + ); + } + if ($key === 'use') { + $value = $this->checkTpl( + $value, + 'use_template_tploptions', + 'tbl_servicetemplate', + $intDataId, + $intSkip + ); + } + } + if ($strTableName === 'tbl_contact') { + if ($key === 'use_template') { + $key = 'use'; + } + $strVIValues = 'host_notifications_enabled,service_notifications_enabled,can_submit_commands,'; + $strVIValues .= 'retain_status_information,retain_nonstatus_information'; + if (in_array($key, explode(',', $strVIValues), true)) { + if ((int)$value === -1) { + $value = 'null'; + } + if ((int)$value === 3) { + $value = 'null'; + } + } + if ($key === 'contactgroups') { + $value = $this->checkTpl($value, 'contactgroups_tploptions', 'tbl_contact', $intDataId, $intSkip); + } + if ($key === 'host_notification_commands') { + $value = $this->checkTpl( + $value, + 'host_notification_commands_tploptions', + 'tbl_contact', + $intDataId, + $intSkip + ); + } + if ($key === 'service_notification_commands') { + $value = $this->checkTpl( + $value, + 'service_notification_commands_tploptions', + 'tbl_contact', + $intDataId, + $intSkip + ); + } + if ($key === 'use') { + $value = $this->checkTpl($value, 'use_template_tploptions', 'tbl_contact', $intDataId, $intSkip); + } + } + if ($strTableName === 'tbl_contacttemplate') { + if ($key === 'template_name') { + $key = 'name'; + } + if ($key === 'use_template') { + $key = 'use'; + } + $strVIValues = 'host_notifications_enabled,service_notifications_enabled,can_submit_commands,'; + $strVIValues .= 'retain_status_information,retain_nonstatus_information'; + if (in_array($key, explode(',', $strVIValues), true)) { + if ((int)$value === -1) { + $value = 'null'; + } + if ((int)$value === 3) { + $value = 'null'; + } + } + if ($key === 'contactgroups') { + $value = $this->checkTpl( + $value, + 'contactgroups_tploptions', + 'tbl_contacttemplate', + $intDataId, + $intSkip + ); + } + if ($key === 'host_notification_commands') { + $value = $this->checkTpl( + $value, + 'host_notification_commands_tploptions', + 'tbl_contacttemplate', + $intDataId, + $intSkip + ); + } + if ($key === 'service_notification_commands') { + $value = $this->checkTpl( + $value, + 'service_notification_commands_tploptions', + 'tbl_contacttemplate', + $intDataId, + $intSkip + ); + } + if ($key === 'use') { + $value = $this->checkTpl( + $value, + 'use_template_tploptions', + 'tbl_contacttemplate', + $intDataId, + $intSkip + ); + } + } + if ((($strTableName === 'tbl_hosttemplate') || ($strTableName === 'tbl_servicetemplate') || + ($strTableName === 'tbl_contacttemplate')) && $key === 'register') { + $value = '0'; + } + if ($strTableName === 'tbl_timeperiod' && $key === 'use_template') { + $key = 'use'; + } + } + + /** + * Process special settings based on template option + * @param string $strValue Original data value + * @param string $strKeyField Template option field name + * @param string $strTable Table name + * @param int $intId Dataset ID + * @param int $intSkip Skip value (by reference) + * @return string Manipulated data value + */ + public function checkTpl(string $strValue, string $strKeyField, string $strTable, int $intId, int &$intSkip): string + { + if ($this->intNagVersion < 3) { + return $strValue; + } + $strSQL = 'SELECT `' . $strKeyField . '` FROM `' . $strTable . "` WHERE `id` = $intId"; + $intValue = $this->myDBClass->getFieldData($strSQL); + if ((int)$intValue === 0) { + return ('+' . $strValue); + } + if ((int)$intValue === 1) { + $intSkip = 0; + return 'null'; + } + return $strValue; + } + + /** + * Open configuration file + * @param string $strFile File name + * @param int $intConfigID Configuration ID + * @param int $intType Type ID + * @param resource $resConfigFile Temporary or configuration file ressource (by reference) + * @param string $strConfigFile Configuration file name (by reference) + * @return int 0 = successful / 1 = error + */ + private function getConfigFile(string $strFile, int $intConfigID, int $intType, &$resConfigFile, string &$strConfigFile): int + { + /* Variable definitions */ + $strBaseDir = ''; + $intMethod = 1; + $intReturn = 0; + $strConfigValue = ''; + /* Get config data */ + if ($intType === 1) { + $this->getConfigData($intConfigID, 'hostconfig', $strBaseDir); + $strType = 'host'; + } elseif ($intType === 2) { + $this->getConfigData($intConfigID, 'serviceconfig', $strBaseDir); + $strType = 'service'; + } else { + $this->getConfigData($intConfigID, 'basedir', $strBaseDir); + $strType = 'basic'; + } + if ($this->getConfigData($intConfigID, 'method', $strConfigValue) === 0) { + $intMethod = (int)$strConfigValue; + } + /* Backup config file */ + $this->moveFile($strType, $strFile, $intConfigID); + /* Variable definition */ + $strConfigFile = $strBaseDir . '/' . $strFile; + /* Local file system */ + if ($intMethod === 1) { + /* Save configuration file */ + if (is_writable($strConfigFile) || (!file_exists($strConfigFile) && is_writable($strBaseDir))) { + /** @noinspection CallableParameterUseCaseInTypeContextInspection */ + $resConfigFile = fopen($strConfigFile, 'wb'); + chmod($strConfigFile, 0644); + } else { + $this->myDataClass->writeLog(translate('Configuration write failed:') . ' ' . $strFile); + $this->processClassMessage(translate('Cannot open/overwrite the configuration file (check the ' + . 'permissions)!') . '::', $this->strErrorMessage); + $intReturn = 1; + } + } elseif ($intMethod === 2) { /* Remote file (FTP) */ + /* Check connection */ + if (empty($this->conFTPConId) || !is_resource($this->conFTPConId) || + ($this->resConnectType !== 'FTP')) { + $intReturn = $this->getFTPConnection($intConfigID); + } + if ($intReturn === 0) { + /* Open the config file */ + if (isset($this->arrSettings['path']['tempdir'])) { + $strConfigFile = tempnam($this->arrSettings['path']['tempdir'], 'nagiosql'); + } else { + $strConfigFile = tempnam(sys_get_temp_dir(), 'nagiosql'); + } + /** @noinspection CallableParameterUseCaseInTypeContextInspection */ + $resConfigFile = fopen($strConfigFile, 'wb'); + } + } elseif ($intMethod === 3) { /* Remote file (SFTP) */ + /* Check connection */ + if (empty($this->resSSHConId) || !is_resource($this->resSSHConId) || + ($this->resConnectType !== 'SSH')) { + $intReturn = $this->getSSHConnection($intConfigID); + } + if ($intReturn === 0) { + if (isset($this->arrSettings['path']['tempdir'])) { + $strConfigFile = tempnam($this->arrSettings['path']['tempdir'], 'nagiosql'); + } else { + $strConfigFile = tempnam(sys_get_temp_dir(), 'nagiosql'); + } + /** @noinspection CallableParameterUseCaseInTypeContextInspection */ + $resConfigFile = fopen($strConfigFile, 'wb'); + } + } + return $intReturn; + } + + /** + * Moves an existing configuration file to the backup directory and removes then the original file + * @param string $strType Type of the configuration file + * @param string $strName Name of the configuration file + * @param int $intConfigID Configuration target ID + * @return int 0 = successful / 1 = error + * Status message is stored in message class variables + */ + public function moveFile(string $strType, string $strName, int $intConfigID): int + { + /* Variable definitions */ $strConfigDir = ''; $strBackupDir = ''; - $intReturn = 0; - // Get directories + $intReturn = 0; + /* Get directories */ switch ($strType) { case 'host': $this->getConfigData($intConfigID, 'hostconfig', $strConfigDir); @@ -580,25 +2267,27 @@ class NagConfigClass default: $intReturn = 1; } - if ($intReturn == 0) { - // Variable definition - $intMethod = 1; - $strDate = date('YmdHis'); - $strSourceFile = $strConfigDir. '/' .$strName; - $strDestinationFile = $strBackupDir. '/' .$strName. '_old_' .$strDate; - $booRetVal = false; - // Get connection method - $this->getConfigData($intConfigID, 'method', $intMethod); - // Local file system - if ($intMethod == 1) { - // Save configuration file + if ($intReturn === 0) { + /* Variable definition */ + $intMethod = 1; + $strDate = date('YmdHis'); + $strSourceFile = $strConfigDir . '/' . $strName; + $strDestinationFile = $strBackupDir . '/' . $strName . '_old_' . $strDate; + $booRetVal = false; + /* Get connection method */ + if ($this->getConfigValues($intConfigID, 'method', $strMethod) === 0) { + $intMethod = (int)$strMethod; + } + /* Local file system */ + if ($intMethod === 1) { + /* Save configuration file */ if (file_exists($strSourceFile)) { if (is_writable($strBackupDir) && is_writable($strConfigDir)) { copy($strSourceFile, $strDestinationFile); unlink($strSourceFile); } else { $this->processClassMessage(translate('Cannot backup the old file because the permissions are ' - .'wrong - destination file: ').$strDestinationFile. '::', $this->strErrorMessage); + . 'wrong - destination file: ') . $strDestinationFile . '::', $this->strErrorMessage); $intReturn = 1; } } else { @@ -606,53 +2295,53 @@ class NagConfigClass . 'missing - source file: ') . $strSourceFile . '::', $this->strErrorMessage); $intReturn = 1; } - } elseif ($intMethod == 2) { // Remote file (FTP) - // Check connection + } elseif ($intMethod === 2) { /* Remote file (FTP) */ + /* Check connection */ $intReturn = $this->getFTPConnection($intConfigID); - if ($intReturn == 0) { - $strSourceFile = str_replace('//', '/', $strSourceFile); + if ($intReturn === 0) { + $strSourceFile = str_replace('//', '/', $strSourceFile); $strDestinationFile = str_replace('//', '/', $strDestinationFile); - // Save configuration file - $intFileStamp = ftp_mdtm($this->resConnectId, $strSourceFile); + /* Save configuration file */ + $intFileStamp = ftp_mdtm($this->conFTPConId, $strSourceFile); if ($intFileStamp > -1) { $intErrorReporting = error_reporting(); error_reporting(0); - $booRetVal = ftp_rename($this->resConnectId, $strSourceFile, $strDestinationFile); + $booRetVal = ftp_rename($this->conFTPConId, $strSourceFile, $strDestinationFile); error_reporting($intErrorReporting); } else { $this->processClassMessage(translate('Cannot backup the old file because the source file is ' - .'missing (remote FTP) - source file: '). $strSourceFile. '::', $this->strErrorMessage); + . 'missing (remote FTP) - source file: ') . $strSourceFile . '::', $this->strErrorMessage); $intReturn = 1; } } - if (($booRetVal == false) && ($intReturn == 0)) { + if (($booRetVal === false) && ($intReturn === 0)) { $this->processClassMessage(translate('Cannot backup the old file because the permissions are ' - .'wrong (remote FTP) - destination file: ').$strDestinationFile. '::', $this->strErrorMessage); + . 'wrong (remote FTP) - destination file: ') . $strDestinationFile . '::', $this->strErrorMessage); $intReturn = 1; } - } elseif ($intMethod == 3) { // Remote file (SFTP) - // Check connection + } elseif ($intMethod === 3) { /* Remote file (SFTP) */ + /* Check connection */ $intReturn = $this->getSSHConnection($intConfigID); - // Save configuration file - $arrResult = array(); - $strSourceFile = str_replace('//', '/', $strSourceFile); + /* Save configuration file */ + $arrResult = array(); + $strSourceFile = str_replace('//', '/', $strSourceFile); $strDestinationFile = str_replace('//', '/', $strDestinationFile); - $strCommand = 'ls '.$strSourceFile; - if (($intReturn == 0) && ($this->sendSSHCommand($strCommand, $arrResult) == 0)) { - if (isset($arrResult[0]) && $arrResult[0] == $strSourceFile) { - $arrInfo = ssh2_sftp_stat($this->resSFTP, $strSourceFile); + $strCommand = 'ls ' . $strSourceFile; + if (($intReturn === 0) && ($this->sendSSHCommand($strCommand, $arrResult) === 0)) { + if (isset($arrResult[0]) && $arrResult[0] === $strSourceFile) { + $arrInfo = ssh2_sftp_stat($this->resSFTP, $strSourceFile); if ($arrInfo['mtime'] > -1) { $booRetVal = ssh2_sftp_rename($this->resSFTP, $strSourceFile, $strDestinationFile); } } else { $this->processClassMessage(translate('Cannot backup the old file because the source file is ' - .'missing (remote SFTP) - source file: '). $strSourceFile. '::', $this->strErrorMessage); + . 'missing (remote SFTP) - source file: ') . $strSourceFile . '::', $this->strErrorMessage); $intReturn = 1; } } - if (($booRetVal == false) && ($intReturn == 0)) { + if (($booRetVal === false) && ($intReturn === 0)) { $this->processClassMessage(translate('Cannot backup the old file because the permissions are ' - .'wrong (remote SFTP) - destination file: ').$strDestinationFile. '::', $this->strErrorMessage); + . 'wrong (remote SFTP) - destination file: ') . $strDestinationFile . '::', $this->strErrorMessage); $intReturn = 1; } } @@ -661,388 +2350,88 @@ class NagConfigClass } /** - * Remove a file - * @param string $strFileName Filename including path to remove - * @param int $intConfigID Configuration target ID - * @return int 0 = successful / 1 = error - * Status message is stored in message class variables + * Write configuration file + * @param string $strData Data string + * @param string $strFile File name + * @param int $intType Type ID + * @param int $intConfigID Configuration target ID + * @param resource $resConfigFile Temporary or configuration file ressource + * @param string $strConfigFile Configuration file name + * @return int 0 = successful / 1 = error */ - public function removeFile($strFileName, $intConfigID) + private function writeConfigFile(string $strData, string $strFile, int $intType, int $intConfigID, $resConfigFile, string $strConfigFile): int { - // Variable definitions + /* Variable definitions */ + $intReturn = 0; $intMethod = 1; - $intReturn = 0; - $booRetVal = false; - // Get connection method - $this->getConfigData($intConfigID, 'method', $intMethod); - // Local file system - if ($intMethod == 1) { - // Save configuration file - if (file_exists($strFileName)) { - if (is_writable($strFileName)) { - unlink($strFileName); - } else { - $this->processClassMessage(translate('Cannot delete the file (wrong permissions)!').'::'. - $strFileName. '::', $this->strErrorMessage); - $intReturn = 1; - } - } else { - $this->processClassMessage(translate('Cannot delete the file (file does not exist)!').'::'. - $strFileName. '::', $this->strErrorMessage); + $strBaseDir = ''; + $strConfigValue = ''; + /* Get config data */ + if ($intType === 1) { + $this->getConfigData($intConfigID, 'hostconfig', $strBaseDir); + } elseif ($intType === 2) { + $this->getConfigData($intConfigID, 'serviceconfig', $strBaseDir); + } else { + $this->getConfigData($intConfigID, 'basedir', $strBaseDir); + } + if ($this->getConfigData($intConfigID, 'method', $strConfigValue) === 0) { + $intMethod = (int)$strConfigValue; + } + $strData = str_replace("\r\n", "\n", $strData); + fwrite($resConfigFile, $strData); + /* Local filesystem */ + if ($intMethod === 1) { + fclose($resConfigFile); + } elseif ($intMethod === 2) { /* FTP access */ + /* SSH Possible */ + if (!function_exists('ftp_put')) { + $this->processClassMessage(translate('FTP module not loaded!') . '::', $this->strErrorMessage); $intReturn = 1; - } - } elseif ($intMethod == 2) { // Remote file (FTP) - // Check connection - $intReturn = $this->getFTPConnection($intConfigID); - if ($intReturn == 0) { - // Save configuration file - $intFileStamp = ftp_mdtm($this->resConnectId, $strFileName); - if ($intFileStamp > -1) { - $intErrorReporting = error_reporting(); - error_reporting(0); - $booRetVal = ftp_delete($this->resConnectId, $strFileName); + } else { + $intErrorReporting = error_reporting(); + error_reporting(0); + if (!ftp_put($this->conFTPConId, $strBaseDir . '/' . $strFile, $strConfigFile, FTP_ASCII)) { + $arrError = error_get_last(); error_reporting($intErrorReporting); - } else { - $this->processClassMessage(translate('Cannot delete file because it does not exists (remote ' - . 'FTP)!'). '::', $this->strErrorMessage); - $intReturn = 1; - } - } - if ($booRetVal == false) { - $this->processClassMessage(translate('Cannot delete file because the permissions are incorrect ' - . '(remote FTP)!'). '::', $this->strErrorMessage); - $intReturn = 1; - } - } elseif ($intMethod == 3) { // Remote file (SFTP) - // Check connection - $intReturn = $this->getSSHConnection($intConfigID); - // Save configuration file - if (($intReturn == 0) && ($this->sendSSHCommand('ls '.$strFileName, $arrResult) == 0)) { - if (isset($arrResult[0])) { - $booRetVal = ssh2_sftp_unlink($this->resSFTP, $strFileName); - } else { - $this->processClassMessage(translate('Cannot delete file because it does not exists (remote ' - . 'SSH/SFTP)!'). '::', $this->strErrorMessage); - $intReturn = 1; - } - } - if (($intReturn == 0) && ($booRetVal == false)) { - $this->processClassMessage(translate('Cannot delete file because the permissions are incorrect ' - . '(remote SSH/SFTP)!'). '::', $this->strErrorMessage); - $intReturn = 1; - } - } - return $intReturn; - } - - /** - * Get configuration domain parameters - * @param int $intConfigId Configuration ID - * @param string $strConfigItem Configuration key - * @param string $strValue Configuration value (by reference) - * @return int 0 = successful / 1 = error - */ - public function getConfigData($intConfigId, $strConfigItem, &$strValue) - { - $intReturn = 1; - $strSQL = 'SELECT `' .$strConfigItem. '` FROM `tbl_configtarget` WHERE `id` = ' .$intConfigId; - $strValue = $this->myDBClass->getFieldData($strSQL); - if ($strValue != '') { - $intReturn = 0; - } - return $intReturn; - } - - /** - * Check a directory for write access - * @param string $strPath Physical path - * @return int 0 = successful / 1 = error - */ - public function isDirWriteable($strPath) - { - // Define variables - $intReturnFile = 1; - $intReturnDir = 1; - $intReturn = 1; - // Is input path a file? - if (file_exists($strPath) && is_file($strPath)) { - $resFile = fopen($strPath, 'ab'); - if ($resFile) { - $intReturnFile = 0; - } - } else { - $intReturnFile = 0; - } - if (is_file($strPath)) { - $strDirectory = \dirname($strPath); - } else { - $strDirectory = $strPath; - } - $strFile = $strDirectory.'/'.uniqid(mt_rand(), true).'.tmp'; - // Check writing in directory directly - if (is_dir($strDirectory) && is_writable($strDirectory)) { - $resFile = fopen($strFile, 'wb'); - if ($resFile) { - $intReturnDir = 0; - unlink($strFile); - } - } else { - $intReturnDir = 0; - } - if (($intReturnDir == 0) && ($intReturnFile == 0)) { - $intReturn = 0; - } - return $intReturn; - } - - /** - * Copy a remote file - * @param string $strFileRemote Remote file name - * @param int $intConfigID Configuration target id - * @param string $strFileLocal Local file name - * @param int $intDirection 0 = from remote to local / 1 = from local to remote - * @return int 0 = successful / 1 = error - * Status message is stored in message class variables - */ - public function remoteFileCopy($strFileRemote, $intConfigID, $strFileLocal, $intDirection = 0) - { - // Variable definitions - $intMethod = 3; - $intReturn = 0; - $arrTemp = array(); - // Get method - $this->getConfigData($intConfigID, 'method', $intMethod); - if ($intMethod == 2) { - // Check connection - $intReturn = $this->getFTPConnection($intConfigID); - if (($intReturn == 0) && ($intDirection == 0)) { - $intErrorReporting = error_reporting(); - error_reporting(0); - if (!ftp_get($this->resConnectId, $strFileLocal, $strFileRemote, FTP_ASCII)) { - $this->processClassMessage(translate('Cannot get the remote file (it does not exist or is not ' - . 'readable) - remote file: '). $strFileRemote. '::', $this->strErrorMessage); - $intReturn = 1; - } - error_reporting($intErrorReporting); - } elseif (($intReturn == 0) && ($intDirection == 1)) { - $intErrorReporting = error_reporting(); - error_reporting(0); - if (!ftp_put($this->resConnectId, $strFileRemote, $strFileLocal, FTP_ASCII)) { - $this->processClassMessage(translate('Cannot write the remote file (remote file is not writeable)' - . '- remote file: ').$strFileRemote. '::', $this->strErrorMessage); - $intReturn = 1; - } - error_reporting($intErrorReporting); - } - ftp_close($this->resConnectId); - } elseif ($intMethod == 3) { // Remote file (SFTP) - $intReturn = $this->getSSHConnection($intConfigID); - if (($intReturn == 0) && ($intDirection == 0)) { - // Copy file - $intErrorReporting = error_reporting(); - error_reporting(0); - if (!ssh2_scp_recv($this->resConnectId, $strFileRemote, $strFileLocal)) { - if ($this->sendSSHCommand('ls ' . $strFileRemote, $arrTemp) != 0) { - $this->processClassMessage(translate('Cannot get the remote file (it does not exist or is not ' - . 'readable) - remote file: ') .$strFileRemote. '::', $this->strErrorMessage); - } else { - $this->processClassMessage(translate('Remote file is not readable - remote file: ') - . $strFileRemote. '::', $this->strErrorMessage); + $this->processClassMessage(translate('Cannot open/overwrite the configuration file (FTP connection ' + . 'failed)!') . '::', $this->strErrorMessage); + if ((string)$arrError['message'] !== '') { + $this->processClassMessage($arrError['message'] . '::', $this->strErrorMessage); } $intReturn = 1; } error_reporting($intErrorReporting); - } elseif (($intReturn == 0) && ($intDirection == 1)) { - if (file_exists($strFileLocal) && is_readable($strFileLocal)) { - $intErrorReporting = error_reporting(); - error_reporting(0); - if (!ssh2_scp_send($this->resConnectId, $strFileLocal, $strFileRemote, 0644)) { - $this->processClassMessage(translate('Cannot write a remote file (remote file is not writeable)' - .' - remote file: '). $strFileRemote . '::', $this->strErrorMessage); - $intReturn = 1; - } + ftp_close($this->conFTPConId); + fclose($resConfigFile); + } + } elseif ($intMethod === 3) { /* SSH access */ + /* SSH Possible */ + if (!function_exists('ssh2_scp_send')) { + $this->processClassMessage(translate('SSH module not loaded!') . '::', $this->strErrorMessage); + $intReturn = 1; + } else { + $intErrorReporting = error_reporting(); + error_reporting(0); + if (!ssh2_scp_send($this->resSSHConId, $strConfigFile, $strBaseDir . '/' . $strFile, 0644)) { + $arrError = error_get_last(); error_reporting($intErrorReporting); - } else { - $this->processClassMessage(translate('Cannot copy a local file to remote because the local file '. - 'does not exist or is not readable - local file: '). - $strFileLocal . '::', $this->strErrorMessage); + $this->processClassMessage(translate('Cannot open/overwrite the configuration file (remote SFTP)!') . + '::', $this->strErrorMessage); + if ((string)$arrError['message'] !== '') { + $this->processClassMessage($arrError['message'] . '::', $this->strErrorMessage); + } $intReturn = 1; } + error_reporting($intErrorReporting); + fclose($resConfigFile); + unlink($strConfigFile); + $this->resSSHConId = null; } } - return $intReturn; - } - - /** - * Add files of a given directory to an array - * @param string $strSourceDir Source directory - * @param string $strIncPattern Include file pattern - * @param string $strExcPattern Exclude file pattern - * @param array $arrOutput Output array (by reference) - * @param string $strErrorMessage Error messages (by reference) - */ - public function storeDirToArray($strSourceDir, $strIncPattern, $strExcPattern, &$arrOutput, &$strErrorMessage) - { - // Define variables - $arrDir = array(); - while (substr($strSourceDir, -1) == '/' or substr($strSourceDir, -1) == "\\") { - $strSourceDir = substr($strSourceDir, 0, -1); - } - $resHandle = opendir($strSourceDir); - if ($resHandle === false) { - if ($this->intDomainId != 0) { - $strErrorMessage .= translate('Could not open directory'). ': ' .$strSourceDir; - } - } else { - $booBreak = true; - while ($booBreak) { - if (!$arrDir[] = readdir($resHandle)) { - $booBreak = false; - } - } - closedir($resHandle); - sort($arrDir); - /** @var string $file */ - foreach ($arrDir as $file) { - /** @noinspection StrlenInEmptyStringCheckContextInspection */ - if (!preg_match("/^\.{1,2}/", $file) && \strlen($file)) { - if (is_dir($strSourceDir. '/' .$file)) { - $this->storeDirToArray( - $strSourceDir. '/' .$file, - $strIncPattern, - $strExcPattern, - $arrOutput, - $strErrorMessage - ); - } else { - if (preg_match('/' .$strIncPattern. '/', $file) && (($strExcPattern == '') || - !preg_match('/' .$strExcPattern. '/', $file))) { - if (0 === stripos(PHP_OS, 'WIN')) { - $strSourceDir=str_replace('/', "\\", $strSourceDir); - $arrOutput [] = $strSourceDir."\\".$file; - } else { - $arrOutput [] = $strSourceDir. '/' .$file; - } - } - } - } - } - } - } - - /** - * Determines the dates of the last data table change and the last modification to the configuration files - * @param string $strTableName Name of the data table - * @param array $arrTimeData Array with time data of table and all config files - * @param string $strCheckConfig Information string (text message) - * @return int 0 = successful / 1 = error - * Status message is stored in message class variables - */ - public function lastModifiedFile($strTableName, &$arrTimeData, &$strCheckConfig) - { - // Variable definitions - $intEnableCommon = 0; - $arrDataset = array(); - $strFileName = ''; - $strCheckConfig = ''; - $intReturn = 0; - // Get configuration filename based on table name - $arrConfigData = $this->getConfData(); - if (isset($arrConfigData[$strTableName])) { - $strFileName = $arrConfigData[$strTableName]['filename']; - } else { - $intReturn = 1; - } - // Get table times - $arrTimeData = array(); - $arrTimeData['table'] = 'unknown'; - // Clear status cache - clearstatcache(); - $intRetVal1 = $this->getDomainData('enable_common', $intEnableCommon); - // Get last change of date table - if ($intRetVal1 == 0) { - $strSQLAdd = ''; - if ($intEnableCommon == 1) { - $strSQLAdd = 'OR `domainId`=0'; - } - $strSQL = 'SELECT `updateTime` FROM `tbl_tablestatus` ' - . 'WHERE (`domainId`=' .$this->intDomainId." $strSQLAdd) AND `tableName`='".$strTableName."' " - . 'ORDER BY `updateTime` DESC LIMIT 1'; - $booReturn = $this->myDBClass->hasSingleDataset($strSQL, $arrDataset); - if ($booReturn && isset($arrDataset['updateTime'])) { - $arrTimeData['table'] = $arrDataset['updateTime']; - } else { - $strSQL = 'SELECT `last_modified` FROM `' .$strTableName. '` ' - . 'WHERE `config_id`=' .$this->intDomainId. ' ORDER BY `last_modified` DESC LIMIT 1'; - $booReturn = $this->myDBClass->hasSingleDataset($strSQL, $arrDataset); - if (($booReturn == true) && isset($arrDataset['last_modified'])) { - $arrTimeData['table'] = $arrDataset['last_modified']; - } - } - } - // Get config sets - $arrConfigId = array(); - $strTarget = ''; - $strBaseDir = ''; - $intFileStampTemp = 0; - $intRetVal2 = $this->getConfigSets($arrConfigId); - if ($intRetVal2 == 0) { - foreach ($arrConfigId as $intConfigId) { - // Get configuration file data - $this->getConfigData($intConfigId, 'target', $strTarget); - $this->getConfigData($intConfigId, 'basedir', $strBaseDir); - // Get time data - $intReturn = $this->getFileDate( - $intConfigId, - $strFileName, - $strBaseDir, - $intFileStampTemp, - $arrTimeData[$strTarget] - ); - if ($intFileStampTemp != 0 && strtotime($arrTimeData['table']) > $intFileStampTemp) { - $strCheckConfig = translate('Warning: configuration file is out of date!'); - } - if ($arrTimeData[$strTarget] == 'unknown') { - $strCheckConfig = translate('Warning: configuration file is out of date!'); - } - } - } else { - $strCheckConfig = translate('Warning: no configuration target defined!'); - } - return $intReturn; - } - - /** - * Writes a configuration file including all datasets of a configuration table or returns the output as a text - * file for download. (Public master function) - * @param string $strTableName Table name - * @param int $intMode 0 = Write file to filesystem - * 1 = Return Textfile for download test - * @return int 0 = successful / 1 = error - * Status message is stored in message class variables - */ - public function createConfig($strTableName, $intMode = 0) - { - // Define Variables - $intReturn = 0; - // Do not create configs in common domain - if ($this->intDomainId == 0) { - $this->processClassMessage(translate('It is not possible to write config files directly from the common ' - . 'domain!'). '::', $this->strErrorMessage); - $intReturn = 1; - } - if ($intReturn == 0) { - // Get configuration targets - $this->getConfigSets($arrConfigID); - if (($arrConfigID != 1) && \is_array($arrConfigID)) { - foreach ($arrConfigID as $intConfigID) { - $intReturn = $this->writeConfTemplate($intConfigID, $strTableName, $intMode); - } - } else { - $this->processClassMessage(translate('Warning: no configuration target defined!'). - '::', $this->strErrorMessage); - $intReturn = 1; - } + if ($intReturn === 0) { + $this->myDataClass->writeLog(translate('Configuration successfully written:') . ' ' . $strFile); + $this->processClassMessage(translate('Configuration file successfully written!') . + '::', $this->strInfoMessage); } return $intReturn; } @@ -1050,51 +2439,54 @@ class NagConfigClass /** * Writes a configuration file including one single datasets of a configuration table or returns the output as * a text file for download. - * @param string $strTableName Table name - * @param int $intDbId Data ID - * @param int $intMode 0 = Write file to filesystem - * 1 = Return Textfile for download test - * @return int 0 = successful / 1 = error - * Status message is stored in message class variables + * @param string $strTableName Table name + * @param int $intDbId Data ID + * @param int $intMode 0 = Write file to filesystem + * 1 = Return Textfile for download test + * @return int 0 = successful / 1 = error + * Status message is stored in message class variables */ - public function createConfigSingle($strTableName, $intDbId = 0, $intMode = 0) + public function createConfigSingle(string $strTableName, int $intDbId = 0, int $intMode = 0): int { - // Define Variables - $arrData = array(); - $intDataCount = 0; - $setEnableCommon = 0; - $intReturn = 0; - $strDomainWhere = ' (`config_id`=' .$this->intDomainId. ') '; - // Read some settings and informations - $this->getDomainData('enable_common', $setEnableCommon); - // Variable rewritting - if ($setEnableCommon != 0) { + /* Define variables */ + $arrData = array(); + $intDataCount = 0; + $setEnableCommon = 0; + $intReturn = 0; + $strDomainWhere = ' (`config_id`=' . $this->intDomainId . ') '; + /* Read some settings and information */ + if ($this->getDomainData('enable_common', $strEnableCommon) === 0) { + $setEnableCommon = (int)$strEnableCommon; + } + /* Variable rewriting */ + if ($setEnableCommon !== 0) { $strDomainWhere = str_replace(')', ' OR `config_id`=0)', $strDomainWhere); } - // Do not create configs in common domain - if ($this->intDomainId == 0) { + /* Do not create configs in common domain */ + if ($this->intDomainId === 0) { $this->processClassMessage(translate('It is not possible to write config files directly from the common ' - . 'domain!'). '::', $this->strErrorMessage); + . 'domain!') . '::', $this->strErrorMessage); $intReturn = 1; } - if ($intReturn == 0) { - if ($intDbId == 0) { - $strSQL = 'SELECT * FROM `' .$strTableName."` WHERE $strDomainWhere AND `active`='1' ORDER BY `id`"; + if ($intReturn === 0) { + if ($intDbId === 0) { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $strTableName . "` WHERE $strDomainWhere AND `active`='1' ORDER BY `id`"; } else { - $strSQL = 'SELECT * FROM `' .$strTableName."` WHERE $strDomainWhere AND `active`='1' AND `id`=$intDbId"; + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $strTableName . "` WHERE $strDomainWhere AND `active`='1' AND `id`=$intDbId"; } $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if (($booReturn != false) && ($intDataCount != 0)) { - /** @noinspection ForeachInvariantsInspection */ + if (($booReturn !== false) && ($intDataCount !== 0)) { for ($i = 0; $i < $intDataCount; $i++) { - // Process form POST variable - $strChbName = 'chbId_' .$arrData[$i]['id']; - // Check if this POST variable exists or the data ID parameter matches - if ((($intDbId != 0) && ($intDbId == $arrData[$i]['id'])) || + /* Process form POST variable */ + $strChbName = 'chbId_' . $arrData[$i]['id']; + /* Check if this POST variable exists or the data ID parameter matches */ + if ((($intDbId !== 0) && ($intDbId === (int)$arrData[$i]['id'])) || (filter_input(INPUT_POST, $strChbName) !== null)) { - // Get configuration targets + /* Get configuration targets */ $this->getConfigSets($arrConfigID); - if (($arrConfigID != 1) && \is_array($arrConfigID)) { + if (($arrConfigID !== 1) && is_array($arrConfigID)) { foreach ($arrConfigID as $intConfigID) { $intReturn = $this->writeConfTemplate( $intConfigID, @@ -1105,7 +2497,7 @@ class NagConfigClass ); } } else { - $this->processClassMessage(translate('Warning: no configuration target defined!'). + $this->processClassMessage(translate('Warning: no configuration target defined!') . '::', $this->strErrorMessage); $intReturn = 1; } @@ -1115,1334 +2507,10 @@ class NagConfigClass $this->myDataClass->writeLog(translate('Writing of the configuration failed - no dataset or not ' . 'activated dataset found')); $this->processClassMessage(translate('Writing of the configuration failed - no dataset or not ' - . 'activated dataset found'). '::', $this->strErrorMessage); + . 'activated dataset found') . '::', $this->strErrorMessage); $intReturn = 1; } } return $intReturn; } - - - // PRIVATE functions - - /** - * Determines the configuration data for each database table - * @return array filename (configuration file name) - * order_field (database order field) - */ - public function getConfData() - { - $arrConfData['tbl_timeperiod'] = array('filename' => 'timeperiods.cfg', - 'order_field' => 'timeperiod_name'); - $arrConfData['tbl_command'] = array('filename' => 'commands.cfg', - 'order_field' => 'command_name'); - $arrConfData['tbl_contact'] = array('filename' => 'contacts.cfg', - 'order_field' => 'contact_name'); - $arrConfData['tbl_contacttemplate'] = array('filename' => 'contacttemplates.cfg', - 'order_field' => 'template_name'); - $arrConfData['tbl_contactgroup'] = array('filename' => 'contactgroups.cfg', - 'order_field' => 'contactgroup_name'); - $arrConfData['tbl_hosttemplate'] = array('filename' => 'hosttemplates.cfg', - 'order_field' => 'template_name'); - $arrConfData['tbl_servicetemplate'] = array('filename' => 'servicetemplates.cfg', - 'order_field' => 'template_name'); - $arrConfData['tbl_hostgroup'] = array('filename' => 'hostgroups.cfg', - 'order_field' => 'hostgroup_name'); - $arrConfData['tbl_servicegroup'] = array('filename' => 'servicegroups.cfg', - 'order_field' => 'servicegroup_name'); - $arrConfData['tbl_hostdependency'] = array('filename' => 'hostdependencies.cfg', - 'order_field' => 'dependent_host_name'); - $arrConfData['tbl_servicedependency'] = array('filename' => 'servicedependencies.cfg', - 'order_field' => 'config_name'); - $arrConfData['tbl_hostescalation'] = array('filename' => 'hostescalations.cfg', - 'order_field' => 'host_name`,`hostgroup_name'); - $arrConfData['tbl_serviceescalation'] = array('filename' => 'serviceescalations.cfg', - 'order_field' => 'config_name'); - $arrConfData['tbl_hostextinfo'] = array('filename' => 'hostextinfo.cfg', - 'order_field' => 'host_name'); - $arrConfData['tbl_serviceextinfo'] = array('filename' => 'serviceextinfo.cfg', - 'order_field' => 'host_name'); - return $arrConfData; - } - - /** - * Writes a configuration file including all datasets of a configuration table or returns the output as a text - * file for download. (Private worker function) - * @param int $intConfigID Configuration target ID - * @param string $strTableName Table name - * @param int $intMode 0 = Write file to filesystem - * 1 = Return Textfile for download test - * @param array $arrTableData Dataset array for host and services only - * @param int $intID Key for dataset array - * @return int 0 = successful / 1 = error - * Status message is stored in message class variables - */ - /** @noinspection ArrayTypeOfParameterByDefaultValueInspection */ - private function writeConfTemplate($intConfigID, $strTableName, $intMode, $arrTableData = array(), $intID = 0) - { - // Variable definitions - $strSQL = ''; - $strOrderField = ''; - $strFileString = ''; - $arrTplOptions = array('use_preg' => false); - $strDomainWhere = ' (`config_id`=' . $this->intDomainId . ') '; - $intType = 0; - $intReturn = 0; - // Read some settings and informations - $this->getConfigData($intConfigID, 'utf8_decode', $setUTF8Decode); - $this->getDomainData('enable_common', $setEnableCommon); - $this->getConfigData($intConfigID, 'version', $intNagiosVersion); - $arrConfigData = $this->getConfData(); - if (isset($arrConfigData[$strTableName])) { - $strFileString = str_replace('.cfg', '', $arrConfigData[$strTableName]['filename']); - $strOrderField = $arrConfigData[$strTableName]['order_field']; - } - // Variable rewritting - if ($setEnableCommon != 0) { - $strDomainWhere = str_replace(')', ' OR `config_id`=0)', $strDomainWhere); - } - // Special processing for table host and service - $setTemplate = $strFileString. '.tpl.dat'; - if (($strTableName == 'tbl_host') || ($strTableName == 'tbl_service')) { - // Define variable names based on table name - switch ($strTableName) { - case 'tbl_host': - $strFileString = $arrTableData[$intID]['host_name']; - $intDomainId = $arrTableData[$intID]['config_id']; - $setTemplate = 'hosts.tpl.dat'; - $intType = 1; - $strSQL = 'SELECT * FROM `' . $strTableName . "` WHERE `host_name`='$strFileString' " - . "AND `active`='1' AND `config_id`=$intDomainId"; - break; - case 'tbl_service': - $strFileString = $arrTableData[$intID]['config_name']; - $intDomainId = $arrTableData[$intID]['config_id']; - $setTemplate = 'services.tpl.dat'; - $intType = 2; - $strSQL = 'SELECT * FROM `' . $strTableName . "` WHERE `config_name`='$strFileString' " - . "AND `active`='1' AND `config_id`=$intDomainId ORDER BY `service_description`"; - break; - } - } else { - $strSQL = 'SELECT * FROM `' .$strTableName."` WHERE $strDomainWhere AND `active`='1' ". - 'ORDER BY `' .$strOrderField. '`'; - } - $strFile = $strFileString. '.cfg'; - // Load configuration template file - $tplConf = new \HTML_Template_IT($this->arrSettings['path']['base_path']. '/templates/files/'); - $tplConf->loadTemplatefile($setTemplate, true, true); - $tplConf->setOptions($arrTplOptions); - $tplConf->setVariable('CREATE_DATE', date('Y-m-d H:i:s')); - $tplConf->setVariable('NAGIOS_QL_VERSION', $this->arrSettings['db']['version']); - $tplConf->setVariable('VERSION', $this->getVersionString($intConfigID)); - // Write data from configuration table - $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($booReturn && ($intDataCount != 0) && ($strFileString != '')) { - // Process every data set - /** @noinspection ForeachInvariantsInspection */ - for ($i = 0; $i < $intDataCount; $i++) { - $intDataId = 0; - /** @noinspection ForeachSourceInspection */ - foreach ($arrData[$i] as $key => $value) { - if ($key == 'id') { - $intDataId = $value; - } - if ($key == 'config_name') { - $key = '#NAGIOSQL_CONFIG_NAME'; - } - // UTF8 decoded vaules - if ($setUTF8Decode == 1) { - $value = utf8_decode($value); - } - // Pass special fields (NagiosQL data fields not used by Nagios itselves) - if ($this->skipEntries($strTableName, $intNagiosVersion, $key, $value) == 1) { - continue; - } - // Get relation data - $intSkip = $this->getRelationData($strTableName, $tplConf, $arrData[$i], $key, $value); - // Rename field names - $this->renameFields($strTableName, $intConfigID, $intDataId, $key, $value, $intSkip); - // Inset data field - if ($intSkip != 1) { - // Insert fill spaces - $strFillLen = (30- \strlen($key)); - $strSpace = ' '; - for ($f = 0; $f < $strFillLen; $f++) { - $strSpace .= ' '; - } - // Write key and value to template - $tplConf->setVariable('ITEM_TITLE', $key.$strSpace); - // Short values - if (($intNagiosVersion != 3) || (\strlen($value) < 800)) { - $tplConf->setVariable('ITEM_VALUE', $value); - $tplConf->parse('configline'); - } else { // Long values - $arrValueTemp = explode(',', $value); - $strValueNew = ''; - $intArrCount = \count($arrValueTemp); - $intCounter = 0; - $strSpace = ' '; - for ($f = 0; $f < 30; $f++) { - $strSpace .= ' '; - } - foreach ($arrValueTemp as $elem) { - if (\strlen($strValueNew) < 800) { - $strValueNew .= $elem. ','; - } else { - if (substr($strValueNew, -1) == ',') { - $strValueNew = substr($strValueNew, 0, -1); - } - if ($intCounter < $intArrCount) { - $strValueNew .= ",\\"; - $tplConf->setVariable('ITEM_VALUE', $strValueNew); - $tplConf->parse('configline'); - $tplConf->setVariable('ITEM_TITLE', $strSpace); - } else { - $tplConf->setVariable('ITEM_VALUE', $strValueNew); - $tplConf->parse('configline'); - $tplConf->setVariable('ITEM_TITLE', $strSpace); - } - $strValueNew = $elem. ','; - } - $intCounter++; - } - if ($strValueNew != '') { - if (substr($strValueNew, -1) == ',') { - $strValueNew = substr($strValueNew, 0, -1); - } - $tplConf->setVariable('ITEM_VALUE', $strValueNew); - $tplConf->parse('configline'); - } - } - } - } - // Special processing for time periods - if ($strTableName == 'tbl_timeperiod') { - $arrDataTime = array(); - $strSQLTime = 'SELECT `definition`, `range` ' - . 'FROM `tbl_timedefinition` WHERE `tipId` = ' .$arrData[$i]['id']; - $booReturn = $this->myDBClass->hasDataArray($strSQLTime, $arrDataTime, $intDataCountTime); - if ($booReturn && $intDataCountTime != 0) { - foreach ($arrDataTime as $data) { - // Skip other values than weekdays in nagios version below 3 - if ($intNagiosVersion < 3) { - $arrWeekdays = array('monday','tuesday','wednesday','thursday','friday','saturday', - 'sunday'); - if (!\in_array($data['definition'], $arrWeekdays, true)) { - continue; - } - } - // Insert fill spaces - $strFillLen = (30- \strlen($data['definition'])); - $strSpace = ' '; - for ($f = 0; $f < $strFillLen; $f++) { - $strSpace .= ' '; - } - // Write key and value - $tplConf->setVariable('ITEM_TITLE', $data['definition'].$strSpace); - $tplConf->setVariable('ITEM_VALUE', $data['range']); - $tplConf->parse('configline'); - } - } - } - // Write configuration set - $tplConf->parse('configset'); - } - } elseif ($booReturn && ($intDataCount == 0) && ($strFileString != '')) { - $this->processClassMessage(translate('Error while selecting data from database:') - . '::', $this->strErrorMessage); - $this->processClassMessage($this->myDBClass->strErrorMessage, $this->strErrorMessage); - $intReturn = 1; - } else { - $this->myDataClass->writeLog(translate('Writing of the configuration failed - no dataset ' - . 'or not activated dataset found')); - $this->processClassMessage(translate('Writing of the configuration failed - no dataset ' - . 'or not activated dataset found'). '::', $this->strErrorMessage); - $intReturn = 1; - } - if ($intMode == 0) { - $intReturn = $this->getConfigFile($strFile, $intConfigID, $intType, $resCfgFile, $strCfgFile); - if ($intReturn == 0) { - $tplConf->parse(); - $strContent = $tplConf->get(); - $intReturn = $this->writeConfigFile( - $strContent, - $strFile, - $intType, - $intConfigID, - $resCfgFile, - $strCfgFile - ); - } - } elseif ($intMode == 1) { - $tplConf->show(); - } - return $intReturn; - } - - /** - * Get Nagios version string - * @param int $intConfigID Configuration target ID - * @return string Version string - */ - private function getVersionString($intConfigID) - { - $arrVersion = array( - 'Nagios 2.x config file', - 'Nagios 2.9 config file', - 'Nagios 3.x config file', - 'Nagios 4.x config file' - ); - $this->getConfigData($intConfigID, 'version', $intVersion); - if (($intVersion >= 1) && ($intVersion <= \count($arrVersion))) { - $strVersion = $arrVersion[$intVersion - 1]; - } else { - $strVersion = ''; - } - return $strVersion; - } - - /** - * Skip database values based on Nagios version - * @param string $strTableName Table name - * @param int $intVersionValue Nagios version value - * @param string $key Data key - * @param string $value Data value - * @return int - */ - private function skipEntries($strTableName, $intVersionValue, $key, &$value) - { - // Define variables - $arrOption = array(); - $intReturn = 0; - // Skip common fields - $strSpecial = 'id,active,last_modified,access_rights,access_group,config_id,template,nodelete,command_type,'; - $strSpecial .= 'import_hash'; - - // Skip fields of special tables - if ($strTableName == 'tbl_hosttemplate') { - $strSpecial .= ',parents_tploptions,hostgroups_tploptions,contacts_tploptions'; - $strSpecial .= ',contact_groups_tploptions,use_template_tploptions'; - } - if ($strTableName == 'tbl_servicetemplate') { - $strSpecial .= ',host_name_tploptions,hostgroup_name_tploptions,parents_tploptions,contacts_tploptions'; - $strSpecial .= ',servicegroups_tploptions,contact_groups_tploptions,use_template_tploptions'; - } - if ($strTableName == 'tbl_contact') { - $strSpecial .= ',use_template_tploptions,contactgroups_tploptions'; - $strSpecial .= ',host_notification_commands_tploptions,service_notification_commands_tploptions'; - } - if ($strTableName == 'tbl_contacttemplate') { - $strSpecial .= ',use_template_tploptions,contactgroups_tploptions'; - $strSpecial .= ',host_notification_commands_tploptions,service_notification_commands_tploptions'; - } - if ($strTableName == 'tbl_host') { - $strSpecial .= ',parents_tploptions,hostgroups_tploptions,contacts_tploptions'; - $strSpecial .= ',contact_groups_tploptions,use_template_tploptions'; - } - if ($strTableName == 'tbl_service') { - $strSpecial .= ',host_name_tploptions,hostgroup_name_tploptions,parents_tploptions'; - $strSpecial .= ',servicegroups_tploptions,contacts_tploptions,contact_groups_tploptions'; - $strSpecial .= ',use_template_tploptions'; - } - - // Pass fields based on nagios version lower than 3.x - if ($intVersionValue < 3) { - if ($strTableName == 'tbl_timeperiod') { - $strSpecial .= ',use_template,exclude,name'; - } - if (($strTableName == 'tbl_contact') || ($strTableName == 'tbl_contacttemplate')) { - $strSpecial .= ',host_notifications_enabled,service_notifications_enabled,can_submit_commands'; - $strSpecial .= ',retain_status_information,retain_nonstatus_information'; - $arrOption['host_notification_options'] = ',s'; - $arrOption['service_notification_options'] = ',s'; - } - if ($strTableName == 'tbl_contactgroup') { - $strSpecial .= ',contactgroup_members'; - } - if ($strTableName == 'tbl_hostgroup') { - $strSpecial .= ',hostgroup_members,notes,notes_url,action_url'; - } - if ($strTableName == 'tbl_servicegroup') { - $strSpecial .= ',servicegroup_members,notes,notes_url,action_url'; - } - if ($strTableName == 'tbl_hostdependency') { - $strSpecial .= ',dependent_hostgroup_name,hostgroup_name,dependency_period'; - } - if ($strTableName == 'tbl_hostescalation') { - $strSpecial .= ',contacts'; - } - if ($strTableName == 'tbl_servicedependency') { - $strSpecial .= ',dependent_hostgroup_name,hostgroup_name,dependency_period,dependent_servicegroup_name'; - $strSpecial .= ',servicegroup_name'; - } - if ($strTableName == 'tbl_serviceescalation') { - $strSpecial .= ',hostgroup_name,contacts,servicegroup_name'; - } - if (($strTableName == 'tbl_host') || ($strTableName == 'tbl_hosttemplate')) { - $strSpecial .= ',initial_state,flap_detection_options,contacts,notes,notes_url,action_url'; - $strSpecial .= ',icon_image,icon_image_alt,vrml_image,statusmap_image,2d_coords,3d_coords'; - $arrOption['notification_options'] = ',s'; - } - // Services - if (($strTableName == 'tbl_service') || ($strTableName == 'tbl_servicetemplate')) { - $strSpecial .= ',initial_state,flap_detection_options,contacts,notes,notes_url,action_url'; - $strSpecial .= ',icon_image,icon_image_alt'; - $arrOption['notification_options'] = ',s'; - } - } - // Pass fields based on nagios version higher than 2.x - if ($intVersionValue > 2) { - if ($strTableName == 'tbl_servicetemplate') { - $strSpecial .= ',parallelize_check '; - } - if ($strTableName == 'tbl_service') { - $strSpecial .= ',parallelize_check'; - } - } - // Pass fields based on nagios version lower than 4.x - if ($intVersionValue < 4) { - if (($strTableName == 'tbl_contact') || ($strTableName == 'tbl_contacttemplate')) { - $strSpecial .= ',minimum_importance'; - } - if ($strTableName == 'tbl_host') { - $strSpecial .= ',importance'; - } - if (($strTableName == 'tbl_service') || ($strTableName == 'tbl_servicetemplate')) { - $strSpecial .= ',importance,parents'; - } - } - if ($intVersionValue == 1) { - $strSpecial .= ''; - } - // Reduce option values - if (array_key_exists($key, $arrOption) && (\count($arrOption) != 0)) { - $value = str_replace(array($arrOption[$key], str_replace(',', '', $arrOption[$key])), '', $value); - if ($value == '') { - $intReturn = 1; - } - } - if ($intReturn == 0) { - // Skip entries - $arrSpecial = explode(',', $strSpecial); - if (($value == '') || \in_array($key, $arrSpecial, true)) { - $intReturn = 1; - } - } - if ($intReturn == 0) { - // Do not write config data (based on 'skip' option) - $strNoTwo = 'active_checks_enabled,passive_checks_enabled,obsess_over_host,check_freshness,'; - $strNoTwo .= 'event_handler_enabled,flap_detection_enabled,process_perf_data,retain_status_information,'; - $strNoTwo .= 'retain_nonstatus_information,notifications_enabled,parallelize_check,is_volatile,'; - $strNoTwo .= 'host_notifications_enabled,service_notifications_enabled,can_submit_commands,'; - $strNoTwo .= 'obsess_over_service'; - foreach (explode(',', $strNoTwo) as $elem) { - if (($key == $elem) && ($value == '2')) { - $intReturn = 1; - } - if (($intVersionValue < 3) && ($key == $elem) && ($value == '3')) { - $intReturn = 1; - } - } - } - return $intReturn; - } - - /** - * Get related data - * @param string $strTableName Table name - * @param \HTML_Template_IT $resTemplate Template ressource - * @param array $arrData Dataset array - * @param string $strDataKey Data key - * @param string $strDataValue Data value - * @return int 0 = use data / 1 = skip data - * Status message is stored in message class variables - */ - private function getRelationData($strTableName, $resTemplate, $arrData, $strDataKey, &$strDataValue) - { - // Define Variables - $intReturn = 0; - $intSkipProc = 0; - $arrRelations = array(); - // Pass function for tbl_command - if ($strTableName == 'tbl_command') { - $intSkipProc = 1; - } - // Get relation info and store the value in a class variable (speedup export) - if (($intSkipProc == 0) && ($this->strRelTable != $strTableName)) { - $intReturn = $this->myDataClass->tableRelations($strTableName, $arrRelations); - $this->strRelTable = $strTableName; - $this->arrRelData = $arrRelations; - } elseif ($intSkipProc == 0) { - $arrRelations = $this->arrRelData; - $intReturn = 0; - } - if (($intSkipProc == 0) && (!\is_array($arrRelations)) && (\count($arrRelations) == 0)) { - $intSkipProc = 1; - $intReturn = 1; - } - if ($intSkipProc == 0) { - // Common domain is enabled? - $this->getDomainData('enable_common', $intCommonEnable); - if ($intCommonEnable == 1) { - $strDomainWhere1 = ' (`config_id`=' . $this->intDomainId . ' OR `config_id`=0) '; - } else { - $strDomainWhere1 = ' `config_id`=' . $this->intDomainId . ' '; - } - // Process relations - foreach ($arrRelations as $elem) { - if ($elem['fieldName'] == $strDataKey) { - // Process normal 1:n relations (1 = only data / 2 = including a * value) - if (($elem['type'] == 2) && (($strDataValue == 1) || ($strDataValue == 2))) { - $intReturn = $this->processRelation1($arrData, $strDataValue, $elem, $strDomainWhere1); - // Process normal 1:1 relations - } elseif ($elem['type'] == 1) { - $intReturn = $this->processRelation2($arrData, $strDataValue, $elem, $strDomainWhere1); - // Process normal 1:n relations with special table and idSort (template tables) - } elseif (($elem['type'] == 3) && ($strDataValue == 1)) { - $intReturn = $this->processRelation3($arrData, $strDataValue, $elem, $strDomainWhere1); - // Process special 1:n:str relations with string values (servicedependencies) - } elseif (($elem['type'] == 6) && (($strDataValue == 1) || ($strDataValue == 2))) { - $intReturn = $this->processRelation4($arrData, $strDataValue, $elem, $strDomainWhere1); - // Process special relations for free variables - } elseif (($elem['type'] == 4) && ($strDataValue == 1) && ($this->intNagVersion >= 3)) { - $intReturn = $this->processRelation5($resTemplate, $arrData, $elem); - // Process special relations for service groups - } elseif (($elem['type'] == 5) && ($strDataValue == 1)) { - $intReturn = $this->processRelation6($arrData, $strDataValue, $elem, $strDomainWhere1); - // Process special relations for service parents - } elseif (($elem['type'] == 7) && ($strDataValue == 1)) { - $intReturn = $this->processRelation7($arrData, $strDataValue, $elem); - // Process "*" - } elseif ($strDataValue == 2) { - $strDataValue = '*'; - } else { - $intReturn = 1; - } - } - } - } - return $intReturn; - } - - /** - * Rename field names - * @param string $strTableName Table name - * @param int $intConfigID Configuration target ID - * @param int $intDataId Data ID - * @param string $key Data key (by reference) - * @param string $value Data value (by reference) - * @param int $intSkip Skip value (by reference) 1 = skip / 0 = pass - */ - private function renameFields($strTableName, $intConfigID, $intDataId, &$key, &$value, &$intSkip) - { - if ($this->intNagVersion == 0) { - $this->getConfigData($intConfigID, 'version', $this->intNagVersion); - } - // Picture path - if ($this->strPicPath == 'none') { - $this->getConfigData($intConfigID, 'picturedir', $this->strPicPath); - } - if ($key == 'icon_image') { - $value = $this->strPicPath.$value; - } - if ($key == 'vrml_image') { - $value = $this->strPicPath.$value; - } - if ($key == 'statusmap_image') { - $value = $this->strPicPath.$value; - } - // Tables - if ($strTableName == 'tbl_host') { - if ($key == 'use_template') { - $key = 'use'; - } - $strVIValues = 'active_checks_enabled,passive_checks_enabled,check_freshness,obsess_over_host,'; - $strVIValues .= 'event_handler_enabled,flap_detection_enabled,process_perf_data,retain_status_information,'; - $strVIValues .= 'retain_nonstatus_information,notifications_enabled'; - if (\in_array($key, explode(',', $strVIValues), true)) { - if ($value == -1) { - $value = 'null'; - } - if ($value == 3) { - $value = 'null'; - } - } - if ($key == 'parents') { - $value = $this->checkTpl($value, 'parents_tploptions', 'tbl_host', $intDataId, $intSkip); - } - if ($key == 'hostgroups') { - $value = $this->checkTpl($value, 'hostgroups_tploptions', 'tbl_host', $intDataId, $intSkip); - } - if ($key == 'contacts') { - $value = $this->checkTpl($value, 'contacts_tploptions', 'tbl_host', $intDataId, $intSkip); - } - if ($key == 'contact_groups') { - $value = $this->checkTpl($value, 'contact_groups_tploptions', 'tbl_host', $intDataId, $intSkip); - } - if ($key == 'use') { - $value = $this->checkTpl($value, 'use_template_tploptions', 'tbl_host', $intDataId, $intSkip); - } - if ($key == 'check_command') { - $value = str_replace("\::bang::", "\!", $value); - } - if ($key == 'check_command') { - $value = str_replace('::bang::', "\!", $value); - } - } - if ($strTableName == 'tbl_service') { - if ($key == 'use_template') { - $key = 'use'; - } - if ($this->intNagVersion < 2) { - if ($key == 'check_interval') { - $key = 'normal_check_interval'; - } - if ($key == 'retry_interval') { - $key = 'retry_check_interval'; - } - } - $strVIValues = 'is_volatile,active_checks_enabled,passive_checks_enabled,parallelize_check,'; - $strVIValues .= 'obsess_over_service,check_freshness,event_handler_enabled,flap_detection_enabled,'; - $strVIValues .= 'process_perf_data,retain_status_information,retain_nonstatus_information,'; - $strVIValues .= 'notifications_enabled'; - if (\in_array($key, explode(',', $strVIValues), true)) { - if ($value == -1) { - $value = 'null'; - } - if ($value == 3) { - $value = 'null'; - } - } - if ($key == 'host_name') { - $value = $this->checkTpl($value, 'host_name_tploptions', 'tbl_service', $intDataId, $intSkip); - } - if ($key == 'hostgroup_name') { - $value = $this->checkTpl($value, 'hostgroup_name_tploptions', 'tbl_service', $intDataId, $intSkip); - } - if ($key == 'parents') { - $value = $this->checkTpl($value, 'parents_tploptions', 'tbl_service', $intDataId, $intSkip); - } - if ($key == 'servicegroups') { - $value = $this->checkTpl($value, 'servicegroups_tploptions', 'tbl_service', $intDataId, $intSkip); - } - if ($key == 'contacts') { - $value = $this->checkTpl($value, 'contacts_tploptions', 'tbl_service', $intDataId, $intSkip); - } - if ($key == 'contact_groups') { - $value = $this->checkTpl($value, 'contact_groups_tploptions', 'tbl_service', $intDataId, $intSkip); - } - if ($key == 'use') { - $value = $this->checkTpl($value, 'use_template_tploptions', 'tbl_service', $intDataId, $intSkip); - } - if ($key == 'check_command') { - $value = str_replace("\::bang::", "\!", $value); - } - if ($key == 'check_command') { - $value = str_replace('::bang::', "\!", $value); - } - } - if ($strTableName == 'tbl_hosttemplate') { - if ($key == 'template_name') { - $key = 'name'; - } - if ($key == 'use_template') { - $key = 'use'; - } - $strVIValues = 'active_checks_enabled,passive_checks_enabled,check_freshness,obsess_over_host,'; - $strVIValues .= 'event_handler_enabled,flap_detection_enabled,process_perf_data,retain_status_information,'; - $strVIValues .= 'retain_nonstatus_information,notifications_enabled'; - if (\in_array($key, explode(',', $strVIValues), true)) { - if ($value == -1) { - $value = 'null'; - } - if ($value == 3) { - $value = 'null'; - } - } - if ($key == 'parents') { - $value = $this->checkTpl($value, 'parents_tploptions', 'tbl_hosttemplate', $intDataId, $intSkip); - } - if ($key == 'hostgroups') { - $value = $this->checkTpl($value, 'hostgroups_tploptions', 'tbl_hosttemplate', $intDataId, $intSkip); - } - if ($key == 'contacts') { - $value = $this->checkTpl($value, 'contacts_tploptions', 'tbl_hosttemplate', $intDataId, $intSkip); - } - if ($key == 'contact_groups') { - $value = $this->checkTpl($value, 'contact_groups_tploptions', 'tbl_hosttemplate', $intDataId, $intSkip); - } - if ($key == 'use') { - $value = $this->checkTpl($value, 'use_template_tploptions', 'tbl_hosttemplate', $intDataId, $intSkip); - } - } - if ($strTableName == 'tbl_servicetemplate') { - if ($key == 'template_name') { - $key = 'name'; - } - if ($key == 'use_template') { - $key = 'use'; - } - if ($this->intNagVersion < 2) { - if ($key == 'check_interval') { - $key = 'normal_check_interval'; - } - if ($key == 'retry_interval') { - $key = 'retry_check_interval'; - } - } - $strVIValues = 'is_volatile,active_checks_enabled,passive_checks_enabled,parallelize_check,'; - $strVIValues .= 'obsess_over_service,check_freshness,event_handler_enabled,flap_detection_enabled,'; - $strVIValues .= 'process_perf_data,retain_status_information,retain_nonstatus_information,'; - $strVIValues .= 'notifications_enabled'; - if (\in_array($key, explode(',', $strVIValues), true)) { - if ($value == -1) { - $value = 'null'; - } - if ($value == 3) { - $value = 'null'; - } - } - if ($key == 'host_name') { - $value = $this->checkTpl($value, 'host_name_tploptions', 'tbl_servicetemplate', $intDataId, $intSkip); - } - if ($key == 'hostgroup_name') { - $value = $this->checkTpl( - $value, - 'hostgroup_name_tploptions', - 'tbl_servicetemplate', - $intDataId, - $intSkip - ); - } - if ($key == 'parents') { - $value = $this->checkTpl($value, 'parents_tploptions', 'tbl_servicetemplate', $intDataId, $intSkip); - } - if ($key == 'servicegroups') { - $value = $this->checkTpl( - $value, - 'servicegroups_tploptions', - 'tbl_servicetemplate', - $intDataId, - $intSkip - ); - } - if ($key == 'contacts') { - $value = $this->checkTpl($value, 'contacts_tploptions', 'tbl_servicetemplate', $intDataId, $intSkip); - } - if ($key == 'contact_groups') { - $value = $this->checkTpl( - $value, - 'contact_groups_tploptions', - 'tbl_servicetemplate', - $intDataId, - $intSkip - ); - } - if ($key == 'use') { - $value = $this->checkTpl( - $value, - 'use_template_tploptions', - 'tbl_servicetemplate', - $intDataId, - $intSkip - ); - } - } - if ($strTableName == 'tbl_contact') { - if ($key == 'use_template') { - $key = 'use'; - } - $strVIValues = 'host_notifications_enabled,service_notifications_enabled,can_submit_commands,'; - $strVIValues .= 'retain_status_information,retain_nonstatus_information'; - if (\in_array($key, explode(',', $strVIValues), true)) { - if ($value == -1) { - $value = 'null'; - } - if ($value == 3) { - $value = 'null'; - } - } - if ($key == 'contactgroups') { - $value = $this->checkTpl($value, 'contactgroups_tploptions', 'tbl_contact', $intDataId, $intSkip); - } - if ($key == 'host_notification_commands') { - $value = $this->checkTpl( - $value, - 'host_notification_commands_tploptions', - 'tbl_contact', - $intDataId, - $intSkip - ); - } - if ($key == 'service_notification_commands') { - $value = $this->checkTpl( - $value, - 'service_notification_commands_tploptions', - 'tbl_contact', - $intDataId, - $intSkip - ); - } - if ($key == 'use') { - $value = $this->checkTpl($value, 'use_template_tploptions', 'tbl_contact', $intDataId, $intSkip); - } - } - if ($strTableName == 'tbl_contacttemplate') { - if ($key == 'template_name') { - $key = 'name'; - } - if ($key == 'use_template') { - $key = 'use'; - } - $strVIValues = 'host_notifications_enabled,service_notifications_enabled,can_submit_commands,'; - $strVIValues .= 'retain_status_information,retain_nonstatus_information'; - if (in_array($key, explode(',', $strVIValues), true)) { - if ($value == -1) { - $value = 'null'; - } - if ($value == 3) { - $value = 'null'; - } - } - if ($key == 'contactgroups') { - $value = $this->checkTpl( - $value, - 'contactgroups_tploptions', - 'tbl_contacttemplate', - $intDataId, - $intSkip - ); - } - if ($key == 'host_notification_commands') { - $value = $this->checkTpl( - $value, - 'host_notification_commands_tploptions', - 'tbl_contacttemplate', - $intDataId, - $intSkip - ); - } - if ($key == 'service_notification_commands') { - $value = $this->checkTpl( - $value, - 'service_notification_commands_tploptions', - 'tbl_contacttemplate', - $intDataId, - $intSkip - ); - } - if ($key == 'use') { - $value = $this->checkTpl( - $value, - 'use_template_tploptions', - 'tbl_contacttemplate', - $intDataId, - $intSkip - ); - } - } - if ((($strTableName == 'tbl_hosttemplate') || ($strTableName == 'tbl_servicetemplate') || - ($strTableName == 'tbl_contacttemplate')) && $key == 'register') { - $value = '0'; - } - if ($strTableName == 'tbl_timeperiod' && $key == 'use_template') { - $key = 'use'; - } - } - - /** - * Open configuration file - * @param string $strFile File name - * @param int $intConfigID Configuration ID - * @param int $intType Type ID - * @param resource|bool $resConfigFile Temporary or configuration file ressource (by reference) - * @param string $strConfigFile Configuration file name (by reference) - * @return int 0 = successful / 1 = error - */ - private function getConfigFile($strFile, $intConfigID, $intType, &$resConfigFile, &$strConfigFile) - { - // Variable definitions - $strBaseDir = ''; - $intMethod = 1; - $intReturn = 0; - // Get config data - if ($intType == 1) { - $this->getConfigData($intConfigID, 'hostconfig', $strBaseDir); - $strType = 'host'; - } elseif ($intType == 2) { - $this->getConfigData($intConfigID, 'serviceconfig', $strBaseDir); - $strType = 'service'; - } else { - $this->getConfigData($intConfigID, 'basedir', $strBaseDir); - $strType = 'basic'; - } - $this->getConfigData($intConfigID, 'method', $intMethod); - // Backup config file - $this->moveFile($strType, $strFile, $intConfigID); - // Variable definition - $strConfigFile = $strBaseDir. '/' .$strFile; - // Local file system - if ($intMethod == 1) { - // Save configuration file - if (is_writable($strConfigFile) || (!file_exists($strConfigFile) && is_writable($strBaseDir))) { - $resConfigFile = fopen($strConfigFile, 'wb'); - chmod($strConfigFile, 0644); - } else { - $this->myDataClass->writeLog(translate('Configuration write failed:'). ' ' .$strFile); - $this->processClassMessage(translate('Cannot open/overwrite the configuration file (check the ' - .'permissions)!'). '::', $this->strErrorMessage); - $intReturn = 1; - } - } elseif ($intMethod == 2) { // Remote file (FTP) - // Check connection - if (empty($this->resConnectId) || !\is_resource($this->resConnectId) || - ($this->resConnectType != 'FTP')) { - $intReturn = $this->getFTPConnection($intConfigID); - } - if ($intReturn == 0) { - // Open the config file - if (isset($this->arrSettings['path']) && isset($this->arrSettings['path']['tempdir'])) { - $strConfigFile = tempnam($this->arrSettings['path']['tempdir'], 'nagiosql'); - } else { - $strConfigFile = tempnam(sys_get_temp_dir(), 'nagiosql'); - } - $resConfigFile = fopen($strConfigFile, 'wb'); - } - } elseif ($intMethod == 3) { // Remote file (SFTP) - // Check connection - if (empty($this->resConnectId) || !\is_resource($this->resConnectId) || - ($this->resConnectType != 'SSH')) { - $intReturn = $this->getSSHConnection($intConfigID); - } - if ($intReturn == 0) { - if (isset($this->arrSettings['path']) && isset($this->arrSettings['path']['tempdir'])) { - $strConfigFile = tempnam($this->arrSettings['path']['tempdir'], 'nagiosql'); - } else { - $strConfigFile = tempnam(sys_get_temp_dir(), 'nagiosql'); - } - $resConfigFile = fopen($strConfigFile, 'wb'); - } - } - return $intReturn; - } - - /** - * Write configuration file - * @param string $strData Data string - * @param string $strFile File name - * @param int $intType Type ID - * @param int $intConfigID Configuration target ID - * @param resource $resConfigFile Temporary or configuration file ressource - * @param string $strConfigFile Configuration file name - * @return int 0 = successful / 1 = error - */ - private function writeConfigFile($strData, $strFile, $intType, $intConfigID, $resConfigFile, $strConfigFile) - { - // Variable definitions - $intReturn = 0; - // Get config data - if ($intType == 1) { - $this->getConfigData($intConfigID, 'hostconfig', $strBaseDir); - } elseif ($intType == 2) { - $this->getConfigData($intConfigID, 'serviceconfig', $strBaseDir); - } else { - $this->getConfigData($intConfigID, 'basedir', $strBaseDir); - } - $this->getConfigData($intConfigID, 'method', $intMethod); - $strData = str_replace("\r\n", "\n", $strData); - fwrite($resConfigFile, $strData); - // Local filesystem - if ($intMethod == 1) { - fclose($resConfigFile); - } elseif ($intMethod == 2) { // FTP access - // SSH Possible - if (!\function_exists('ftp_put')) { - $this->processClassMessage(translate('FTP module not loaded!'). '::', $this->strErrorMessage); - $intReturn = 1; - } else { - $intErrorReporting = error_reporting(); - error_reporting(0); - if (!ftp_put($this->resConnectId, $strBaseDir . '/' . $strFile, $strConfigFile, FTP_ASCII)) { - $arrError = error_get_last(); - error_reporting($intErrorReporting); - $this->processClassMessage(translate('Cannot open/overwrite the configuration file (FTP connection ' - .'failed)!') . '::', $this->strErrorMessage); - if ($arrError['message'] != '') { - $this->processClassMessage($arrError['message'] . '::', $this->strErrorMessage); - } - $intReturn = 1; - } - error_reporting($intErrorReporting); - ftp_close($this->resConnectId); - fclose($resConfigFile); - } - } elseif ($intMethod == 3) { // SSH access - // SSH Possible - if (!\function_exists('ssh2_scp_send')) { - $this->processClassMessage(translate('SSH module not loaded!'). '::', $this->strErrorMessage); - $intReturn = 1; - } else { - $intErrorReporting = error_reporting(); - error_reporting(0); - if (!ssh2_scp_send($this->resConnectId, $strConfigFile, $strBaseDir . '/' . $strFile, 0644)) { - $arrError = error_get_last(); - error_reporting($intErrorReporting); - $this->processClassMessage(translate('Cannot open/overwrite the configuration file (remote SFTP)!'). - '::', $this->strErrorMessage); - if ($arrError['message'] != '') { - $this->processClassMessage($arrError['message'] . '::', $this->strErrorMessage); - } - $this->resConnectId = null; - $intReturn = 1; - } - error_reporting($intErrorReporting); - fclose($resConfigFile); - unlink($strConfigFile); - $this->resConnectId = null; - } - } - if ($intReturn == 0) { - $this->myDataClass->writeLog(translate('Configuration successfully written:') . ' ' . $strFile); - $this->processClassMessage(translate('Configuration file successfully written!'). - '::', $this->strInfoMessage); - } - return $intReturn; - } - - /** - * Process special settings based on template option - * @param string $strValue Original data value - * @param string $strKeyField Template option field name - * @param string $strTable Table name - * @param int $intId Dataset ID - * @param int $intSkip Skip value (by reference) - * @return string Manipulated data value - */ - public function checkTpl($strValue, $strKeyField, $strTable, $intId, &$intSkip) - { - if ($this->intNagVersion < 3) { - return $strValue; - } - $strSQL = 'SELECT `' .$strKeyField. '` FROM `' .$strTable."` WHERE `id` = $intId"; - $intValue = $this->myDBClass->getFieldData($strSQL); - if ($intValue == 0) { - return('+' .$strValue); - } - if ($intValue == 1) { - $intSkip = 0; - return 'null'; - } - return $strValue; - } - - /** - * @param array $arrData Dataset array - * @param string $strDataValue Data value - * @param array $elem Relation data array - * @param string $strDomainWhere1 SQL WHERE add-in - * @return int 0 = use data / 1 = skip data - */ - private function processRelation1($arrData, &$strDataValue, $elem, $strDomainWhere1) - { - // Define variables - $arrDataRel = array(); - $intDataCountRel = 0; - $intReturn = 0; - // Get relation data - $strSQLRel = 'SELECT `' . $elem['tableName1'] . '`.`' . $elem['target1'] . '`, `' . $elem['linkTable'] . - '`.`exclude` FROM `' . $elem['linkTable'] . '` LEFT JOIN `' . $elem['tableName1'] . - '` ON `' . $elem['linkTable'] . '`.`idSlave` = `' . $elem['tableName1'] . '`.`id`' . - 'WHERE `idMaster`=' . $arrData['id'] . " AND `active`='1' AND $strDomainWhere1" . - 'ORDER BY `' . $elem['tableName1'] . '`.`' . $elem['target1'] . '`'; - $booReturn = $this->myDBClass->hasDataArray($strSQLRel, $arrDataRel, $intDataCountRel); - if ($booReturn && ($intDataCountRel != 0)) { - // Rewrite $strDataValue with returned relation data - if ($strDataValue == 2) { - $strDataValue = '*,'; - } else { - $strDataValue = ''; - } - foreach ($arrDataRel as $data) { - if ($data['exclude'] == 0) { - $strDataValue .= $data[$elem['target1']] . ','; - } elseif ($this->intNagVersion >= 3) { - $strDataValue .= '!' . $data[$elem['target1']] . ','; - } - } - $strDataValue = substr($strDataValue, 0, -1); - if ($strDataValue == '') { - $intReturn = 1; - } - } else { - if ($strDataValue == 2) { - $strDataValue = '*'; - } else { - $intReturn = 1; - } - } - return $intReturn; - } - - /** - * @param array $arrData Dataset array - * @param string $strDataValue Data value - * @param array $elem Relation data array - * @param string $strDomainWhere1 SQL WHERE add-in - * @return int 0 = use data / 1 = skip data - */ - private function processRelation2($arrData, &$strDataValue, $elem, $strDomainWhere1) - { - // Define variables - $arrDataRel = array(); - $arrField = array(); - $intDataCountRel = 0; - $intReturn = 0; - $strCommand = ''; - // Get relation data - if (($elem['tableName1'] == 'tbl_command') && - (substr_count($arrData[$elem['fieldName']], '!') != 0)) { - $arrField = explode('!', $arrData[$elem['fieldName']]); - $strCommand = strstr($arrData[$elem['fieldName']], '!'); - $strSQLRel = 'SELECT `' . $elem['target1'] . '` FROM `' . $elem['tableName1'] . '`' . - 'WHERE `id`=' . $arrField[0] . " AND `active`='1' AND $strDomainWhere1"; - } else { - $strSQLRel = 'SELECT `' . $elem['target1'] . '` FROM `' . $elem['tableName1'] . '`' . - 'WHERE `id`=' . $arrData[$elem['fieldName']] . " AND `active`='1' AND $strDomainWhere1"; - } - $booReturn = $this->myDBClass->hasDataArray($strSQLRel, $arrDataRel, $intDataCountRel); - if ($booReturn && ($intDataCountRel != 0)) { - // Rewrite $strDataValue with returned relation data - if (($elem['tableName1'] == 'tbl_command') && (substr_count($strDataValue, '!') != 0)) { - $strDataValue = $arrDataRel[0][$elem['target1']] . $strCommand; - } else { - $strDataValue = $arrDataRel[0][$elem['target1']]; - } - } else { - if (($elem['tableName1'] == 'tbl_command') && (substr_count($strDataValue, '!') != 0) && - ($arrField[0] == -1)) { - $strDataValue = 'null'; - } else { - $intReturn = 1; - } - } - return $intReturn; - } - - /** - * @param array $arrData Dataset array - * @param string $strDataValue Data value - * @param array $elem Relation data array - * @param string $strDomainWhere1 SQL WHERE add-in - * @return int 0 = use data / 1 = skip data - */ - private function processRelation3($arrData, &$strDataValue, $elem, $strDomainWhere1) - { - // Define variables - $arrDataRel = array(); - $intDataCountRel = 0; - $intReturn = 0; - // Get relation data - $strSQLRel = 'SELECT * FROM `' .$elem['linkTable']. '` WHERE `idMaster`=' .$arrData['id']. ' ORDER BY idSort'; - $booReturn = $this->myDBClass->hasDataArray($strSQLRel, $arrDataRel, $intDataCountRel); - if ($booReturn && ($intDataCountRel != 0)) { - // Rewrite $strDataValue with returned relation data - $strDataValue = ''; - foreach ($arrDataRel as $data) { - if ($data['idTable'] == 1) { - $strSQLName = 'SELECT `' .$elem['target1']. '` FROM `' .$elem['tableName1']. '`' . - "WHERE `active`='1' AND $strDomainWhere1 AND `id`=".$data['idSlave']; - } else { - $strSQLName = 'SELECT `' .$elem['target2']. '` FROM `' .$elem['tableName2']. '`' . - "WHERE `active`='1' AND $strDomainWhere1 AND `id`=".$data['idSlave']; - } - $strDataValue .= $this->myDBClass->getFieldData($strSQLName) . ','; - } - $strDataValue = substr($strDataValue, 0, -1); - } else { - $intReturn = 1; - } - return $intReturn; - } - - /** - * @param array $arrData Dataset array - * @param string $strDataValue Data value - * @param array $elem Relation data array - * @param string $strDomainWhere1 SQL WHERE add-in - * @return int 0 = use data / 1 = skip data - */ - private function processRelation4($arrData, &$strDataValue, $elem, $strDomainWhere1) - { - // Define variables - $arrDataRel = array(); - $intDataCountRel = 0; - $intReturn = 0; - // Get relation data - $strSQLRel = 'SELECT `' .$elem['linkTable']. '`.`strSlave`, `' .$elem['linkTable']. '`.`exclude` ' . - 'FROM `' .$elem['linkTable']. '` ' . - 'LEFT JOIN `tbl_service` ON `' .$elem['linkTable']. '`.`idSlave`=`tbl_service`.`id` ' . - 'WHERE `' .$elem['linkTable']. '`.`idMaster`=' .$arrData['id']." AND `active`='1' AND ". - $strDomainWhere1. ' ' . - 'ORDER BY `' .$elem['linkTable']. '`.`strSlave`'; - $booReturn = $this->myDBClass->hasDataArray($strSQLRel, $arrDataRel, $intDataCountRel); - if ($booReturn && ($intDataCountRel != 0)) { - // Rewrite $strDataValue with returned relation data - if ($strDataValue == 2) { - $strDataValue = '*,'; - } else { - $strDataValue = ''; - } - foreach ($arrDataRel as $data) { - if ($data['exclude'] == 0) { - $strDataValue .= $data['strSlave'] . ','; - } elseif ($this->intNagVersion >= 3) { - $strDataValue .= '!' . $data['strSlave'] . ','; - } - } - $strDataValue = substr($strDataValue, 0, -1); - if ($strDataValue == '') { - $intReturn = 1; - } - } else { - if ($strDataValue == 2) { - $strDataValue = '*'; - } else { - $intReturn = 1; - } - } - return $intReturn; - } - - /** - * @param \HTML_Template_IT $resTemplate Template object - * @param array $arrData Dataset array - * @param array $elem Relation data array - * @return int 0 = use data / 1 = skip data - */ - private function processRelation5($resTemplate, $arrData, $elem) - { - // Define variables - $arrDataRel = array(); - $intDataCountRel = 0; - $strSQLRel = 'SELECT * FROM `tbl_variabledefinition` LEFT JOIN `' .$elem['linkTable']. '` ' . - 'ON `id`=`idSlave` WHERE `idMaster`=' .$arrData['id']. ' ORDER BY `name`'; - $booReturn = $this->myDBClass->hasDataArray($strSQLRel, $arrDataRel, $intDataCountRel); - if ($booReturn && ($intDataCountRel != 0)) { - foreach ($arrDataRel as $vardata) { - // Insert fill spaces - $strFillLen = (30 - \strlen($vardata['name'])); - $strSpace = ' '; - for ($f = 0; $f < $strFillLen; $f++) { - $strSpace .= ' '; - } - $resTemplate->setVariable('ITEM_TITLE', $vardata['name'] . $strSpace); - $resTemplate->setVariable('ITEM_VALUE', $vardata['value']); - $resTemplate->parse('configline'); - } - } - return 1; - } - - /** - * @param array $arrData Dataset array - * @param string $strDataValue Data value - * @param array $elem Relation data array - * @param string $strDomainWhere1 SQL WHERE add-in - * @return int 0 = use data / 1 = skip data - */ - private function processRelation6($arrData, &$strDataValue, $elem, $strDomainWhere1) - { - // Define variables - $arrDataRel = array(); - $arrHG1 = array(); - $arrHG2 = array(); - $intDataCountRel = 0; - $intHG1 = 0; - $intHG2 = 0; - $intReturn = 0; - // Get relation data - $strSQLMaster = 'SELECT * FROM `' . $elem['linkTable'] . '` WHERE `idMaster`=' . $arrData['id']; - $booReturn = $this->myDBClass->hasDataArray($strSQLMaster, $arrDataRel, $intDataCountRel); - if ($booReturn && ($intDataCountRel != 0)) { - // Rewrite $strDataValue with returned relation data - $strDataValue = ''; - foreach ($arrDataRel as $data) { - if ($data['idSlaveHG'] != 0) { - $strSQLSrv = 'SELECT `' . $elem['target2'] . '` FROM `' . $elem['tableName2'] . - '` WHERE `id`=' . $data['idSlaveS']; - $strService = $this->myDBClass->getFieldData($strSQLSrv); - $strSQLHG1 = 'SELECT `host_name` FROM `tbl_host` ' . - 'LEFT JOIN `tbl_lnkHostgroupToHost` ON `id`=`idSlave` ' . - 'WHERE `idMaster`=' . $data['idSlaveHG'] . " AND `active`='1' AND $strDomainWhere1"; - $booReturn = $this->myDBClass->hasDataArray($strSQLHG1, $arrHG1, $intHG1); - if ($booReturn && ($intHG1 != 0)) { - foreach ($arrHG1 as $elemHG1) { - if (substr_count($strDataValue, $elemHG1['host_name'] . ',' . $strService) == 0) { - $strDataValue .= $elemHG1['host_name'] . ',' . $strService . ','; - } - } - } - $strSQLHG2 = 'SELECT `host_name` FROM `tbl_host` ' . - 'LEFT JOIN `tbl_lnkHostToHostgroup` ON `id`=`idMaster` ' . - 'WHERE `idSlave`=' . $data['idSlaveHG'] . " AND `active`='1' AND $strDomainWhere1"; - $booReturn = $this->myDBClass->hasDataArray($strSQLHG2, $arrHG2, $intHG2); - if ($booReturn && ($intHG2 != 0)) { - foreach ($arrHG2 as $elemHG2) { - if (substr_count($strDataValue, $elemHG2['host_name'] . ',' . $strService) == 0) { - $strDataValue .= $elemHG2['host_name'] . ',' . $strService . ','; - } - } - } - } else { - $strSQLHost = 'SELECT `' . $elem['target1'] . '` FROM `' . $elem['tableName1'] . '` ' . - 'WHERE `id`=' . $data['idSlaveH'] . " AND `active`='1' AND $strDomainWhere1"; - $strHost = $this->myDBClass->getFieldData($strSQLHost); - $strSQLSrv = 'SELECT `' . $elem['target2'] . '` FROM `' . $elem['tableName2'] . '` ' . - 'WHERE `id`=' . $data['idSlaveS'] . " AND `active`='1' AND $strDomainWhere1"; - $strService = $this->myDBClass->getFieldData($strSQLSrv); - if (($strHost != '') && ($strService != '') && - substr_count($strDataValue, $strHost . ',' . $strService) == 0) { - $strDataValue .= $strHost . ',' . $strService . ','; - } - } - } - $strDataValue = substr($strDataValue, 0, -1); - if ($strDataValue == '') { - $intReturn = 1; - } - } else { - $intReturn = 1; - } - return $intReturn; - } - - /** - * @param array $arrData Dataset array - * @param string $strDataValue Data value - * @param array $elem Relation data array - * @return int 0 = use data / 1 = skip data - */ - private function processRelation7($arrData, &$strDataValue, $elem) - { - $intReturn = 1; - // Get relation data - $strSQLMaster = 'SELECT * FROM `' . $elem['linkTable'] . '` WHERE `idMaster`=' . $arrData['id']; - $booReturn = $this->myDBClass->hasDataArray($strSQLMaster, $arrDataRel, $intDataCountRel); - if ($booReturn && ($intDataCountRel != 0)) { - // Rewrite $strDataValue with returned relation data - $strDataValue = ''; - /** @var array $arrDataRel */ - foreach ($arrDataRel as $data) { - $strSQL = 'SELECT host_name FROM tbl_host WHERE id=' .$data['idHost']; - $strHost = $this->myDBClass->getFieldData($strSQL); - $strSQL = 'SELECT service_description FROM tbl_service WHERE id=' .$data['idSlave']; - $strService = $this->myDBClass->getFieldData($strSQL); - $strDataValue .= $strHost . ',' . $strService . ','; - $intReturn = 0; - } - $strDataValue = substr($strDataValue, 0, -1); - } - return $intReturn; - } -} +} \ No newline at end of file diff --git a/functions/NagContentClass.php b/functions/NagContentClass.php index bd57d43..a35ae9f 100644 --- a/functions/NagContentClass.php +++ b/functions/NagContentClass.php @@ -1,90 +1,84 @@ arrSettings = $arrSession['SETS']; } if (isset($arrSession['domain'])) { - $this->intDomainId = $arrSession['domain']; + $this->intDomainId = (int)$arrSession['domain']; } - $this->arrSession = $arrSession; + $this->arrSession = $arrSession; } /** * Data list view - form initialization - * @param \HTML_Template_IT $objTemplate Form template object + * @param HTML_Template_IT $objTemplate Form template object */ - public function listViewInit($objTemplate) + public function listViewInit(HTML_Template_IT $objTemplate): void { - // Language text replacements from fieldvars.php file + /* Language text replacements from fieldvars.php file */ foreach ($this->arrDescription as $elem) { $objTemplate->setVariable($elem['name'], $elem['string']); } - // Some single replacements + /* Some single replacements */ $objTemplate->setVariable('LIMIT', $this->intLimit); - $objTemplate->setVariable('ACTION_MODIFY', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); + $objTemplate->setVariable('ACTION_MODIFY', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_UNSAFE_RAW)); $objTemplate->setVariable('TABLE_NAME', $this->strTableName); if (isset($this->arrSession['search'][$this->strSearchSession])) { $objTemplate->setVariable('DAT_SEARCH', $this->arrSession['search'][$this->strSearchSession]); @@ -95,41 +89,42 @@ class NagContentClass /** * Data list view - value insertions - * @param \HTML_Template_IT $objTemplate Form template object - * @param array $arrData Database values - * @param int $intDLCount1 Total count of data lines for one page - * @param int $intDLCount2 Total count of data lines (all data) - * @param string $strField1 Field name for data field 1 - * @param string $strField2 Field name for data field 2 - * @param int $intLimit Actual data char limit for field 2 + * @param HTML_Template_IT $objTemplate Form template object + * @param array $arrData Database values + * @param int $intDLCount1 Total count of data lines for one page + * @param int $intDLCount2 Total count of data lines (all data) + * @param string $strField1 Fieldname for data field 1 + * @param string $strField2 Fieldname for data field 2 + * @param int $intLimit Actual data char limit for field 2 */ public function listData( - $objTemplate, - $arrData, - $intDLCount1, - $intDLCount2, - $strField1, - $strField2, - $intLimit = 0 - ) { - // Template block names + HTML_Template_IT $objTemplate, + array $arrData, + int $intDLCount1, + int $intDLCount2, + string $strField1, + string $strField2, + int $intLimit = 0 + ): void + { + /* Template block names */ $strTplPart = 'datatable'; - $strTplRow = 'datarow'; - if ($this->strTableName == 'tbl_host') { + $strTplRow = 'datarow'; + if ($this->strTableName === 'tbl_host') { $strTplPart = 'datatablehost'; - $strTplRow = 'datarowhost'; + $strTplRow = 'datarowhost'; } - if ($this->strTableName == 'tbl_service') { + if ($this->strTableName === 'tbl_service') { $strTplPart = 'datatableservice'; - $strTplRow = 'datarowservice'; + $strTplRow = 'datarowservice'; } - if (($this->strTableName == 'tbl_user') || ($this->strTableName == 'tbl_group') || - ($this->strTableName == 'tbl_datadomain') || ($this->strTableName == 'tbl_configtarget')) { + if (($this->strTableName === 'tbl_user') || ($this->strTableName === 'tbl_group') || + ($this->strTableName === 'tbl_datadomain') || ($this->strTableName === 'tbl_configtarget')) { $strTplPart = 'datatablecommon'; - $strTplRow = 'datarowcommon'; + $strTplRow = 'datarowcommon'; } - // Some single replacements - $objTemplate->setVariable('IMAGE_PATH_HEAD', $this->arrSettings['path']['base_url']. 'images/'); + /* Some single replacements */ + $objTemplate->setVariable('IMAGE_PATH_HEAD', $this->arrSettings['path']['base_url'] . 'images/'); $objTemplate->setVariable('CELLCLASS_L', 'tdlb'); $objTemplate->setVariable('CELLCLASS_M', 'tdmb'); $objTemplate->setVariable('DISABLED', 'disabled'); @@ -141,13 +136,13 @@ class NagContentClass $objTemplate->setVariable('PICTURE_CLASS', 'elementHide'); $objTemplate->setVariable('DOMAIN_SPECIAL', ' '); $objTemplate->setVariable('SORT_BY', $this->intSortBy); - // Inserting data values - if ($intDLCount1 != 0) { + /* Inserting data values */ + if ($intDLCount1 !== 0) { $intMinID = 0; $intMaxID = 0; - for ($i=0; $i<$intDLCount1; $i++) { - // Get biggest and smalest value - if ($i == 0) { + for ($i = 0; $i < $intDLCount1; $i++) { + /* Get biggest and smalest value */ + if ($i === 0) { $intMinID = $arrData[$i]['id']; $intMaxID = $arrData[$i]['id']; } @@ -159,27 +154,27 @@ class NagContentClass } $objTemplate->setVariable('MAX_ID', $intMaxID); $objTemplate->setVariable('MIN_ID', $intMinID); - // Line colours + /* Line colours */ $strClassL = 'tdld'; $strClassM = 'tdmd'; - if ($i%2 == 1) { + if ($i % 2 === 1) { $strClassL = 'tdlb'; $strClassM = 'tdmb'; } - if (isset($arrData[$i]['register']) && ($arrData[$i]['register'] == 0)) { + if (isset($arrData[$i]['register']) && ((int)$arrData[$i]['register'] === 0)) { $strRegister = translate('No'); } else { $strRegister = translate('Yes'); } - if ($arrData[$i]['active'] == 0) { - $strActive = translate('No'); + if ((int)$arrData[$i]['active'] === 0) { + $strActive = translate('No'); } else { - $strActive = translate('Yes'); + $strActive = translate('Yes'); } - // Get file date for hosts and services + /* Get file date for hosts and services */ $intTimeInfo = 0; $arrTimeData = array(); - if ($this->strTableName == 'tbl_host') { + if ($this->strTableName === 'tbl_host') { $intReturn = $this->myConfigClass->lastModifiedDir( $this->strTableName, $arrData[$i]['host_name'], @@ -187,11 +182,11 @@ class NagContentClass $arrTimeData, $intTimeInfo ); - if ($intReturn == 1) { + if ($intReturn === 1) { $this->strErrorMessage = $this->myConfigClass->strErrorMessage; } } - if ($this->strTableName == 'tbl_service') { + if ($this->strTableName === 'tbl_service') { $intReturn = $this->myConfigClass->lastModifiedDir( $this->strTableName, $arrData[$i]['config_name'], @@ -199,16 +194,16 @@ class NagContentClass $arrTimeData, $intTimeInfo ); - if ($intReturn == 1) { + if ($intReturn === 1) { $this->strErrorMessage = $this->myConfigClass->strErrorMessage; } } - // Set datafields + /* Set datafields */ foreach ($this->arrDescription as $elem) { $objTemplate->setVariable($elem['name'], $elem['string']); } - if ($arrData[$i][$strField1] == '') { - $arrData[$i][$strField1] = 'NOT DEFINED - ' .$arrData[$i]['id']; + if ((string)$arrData[$i][$strField1] === '') { + $arrData[$i][$strField1] = 'NOT DEFINED - ' . $arrData[$i]['id']; } $objTemplate->setVariable('DATA_FIELD_1', htmlentities($arrData[$i][$strField1], ENT_COMPAT, 'UTF-8')); $objTemplate->setVariable('DATA_FIELD_1S', addslashes(htmlentities( @@ -216,7 +211,7 @@ class NagContentClass ENT_COMPAT, 'UTF-8' ))); - if ($strField2 == 'process_field') { + if ($strField2 === 'process_field') { $arrData[$i]['process_field'] = $this->processField($arrData[$i], $this->strTableName); } else { $objTemplate->setVariable('DATA_FIELD_2S', addslashes(htmlentities( @@ -225,8 +220,8 @@ class NagContentClass 'UTF-8' ))); } - if ($intLimit != 0) { - if (\strlen($arrData[$i][$strField2]) > $intLimit) { + if ($intLimit !== 0) { + if (strlen($arrData[$i][$strField2]) > $intLimit) { $strAdd = ' ...'; } else { $strAdd = ''; @@ -235,7 +230,7 @@ class NagContentClass $arrData[$i][$strField2], 0, $intLimit - ), ENT_COMPAT, 'UTF-8').$strAdd); + ), ENT_COMPAT, 'UTF-8') . $strAdd); } else { $objTemplate->setVariable('DATA_FIELD_2', htmlentities( $arrData[$i][$strField2], @@ -244,130 +239,256 @@ class NagContentClass )); } $objTemplate->setVariable('DATA_REGISTERED', $strRegister); - if (substr_count($this->strTableName, 'template') != 0) { + if (substr_count($this->strTableName, 'template') !== 0) { $objTemplate->setVariable('DATA_REGISTERED', '-'); } $objTemplate->setVariable('DATA_ACTIVE', $strActive); - $objTemplate->setVariable('DATA_FILE', ''.translate('out-of-date').''); - if ($intTimeInfo == 4) { + $objTemplate->setVariable('DATA_FILE', '' . translate('out-of-date') . ''); + if ($intTimeInfo === 4) { $objTemplate->setVariable('DATA_FILE', translate('no target')); } - if ($intTimeInfo == 3) { - $objTemplate->setVariable('DATA_FILE', ''.translate('missed').''); + if ($intTimeInfo === 3) { + $objTemplate->setVariable('DATA_FILE', '' . translate('missed') . ''); } - if ($intTimeInfo == 2) { - $objTemplate->setVariable('DATA_FILE', ''.translate('missed').''); + if ($intTimeInfo === 2) { + $objTemplate->setVariable('DATA_FILE', '' . translate('missed') . ''); } - if ($intTimeInfo == 0) { + if ($intTimeInfo === 0) { $objTemplate->setVariable('DATA_FILE', translate('up-to-date')); } $objTemplate->setVariable('LINE_ID', $arrData[$i]['id']); $objTemplate->setVariable('CELLCLASS_L', $strClassL); $objTemplate->setVariable('CELLCLASS_M', $strClassM); - $objTemplate->setVariable('IMAGE_PATH', $this->arrSettings['path']['base_url']. 'images/'); + $objTemplate->setVariable('IMAGE_PATH', $this->arrSettings['path']['base_url'] . 'images/'); $objTemplate->setVariable('PICTURE_CLASS', 'elementShow'); - $objTemplate->setVariable('DOMAIN_SPECIAL', ''); - $objTemplate->setVariable('DISABLED', ''); - // Disable common domain objects + $objTemplate->setVariable('DOMAIN_SPECIAL'); + $objTemplate->setVariable('DISABLED'); + /* Disable common domain objects */ if (isset($arrData[$i]['config_id'])) { - if ($arrData[$i]['config_id'] != $this->intDomainId) { + if ((int)$arrData[$i]['config_id'] !== $this->intDomainId) { $objTemplate->setVariable('PICTURE_CLASS', 'elementHide'); $objTemplate->setVariable('DOMAIN_SPECIAL', ' [common]'); $objTemplate->setVariable('DISABLED', 'disabled'); - } else { - // Inactive items should not be written/downloaded - if ($arrData[$i]['active'] == 0) { - $objTemplate->setVariable('ACTIVE_CONTROL', 'elementHide'); - } + } else if ((int)$arrData[$i]['active'] === 0) { + $objTemplate->setVariable('ACTIVE_CONTROL', 'elementHide'); } } - // Check access rights for list objects + /* Check access rights for list objects */ if (isset($arrData[$i]['access_group'])) { - if ($this->myVisClass->checkAccountGroup($arrData[$i]['access_group'], 'write') != 0) { - $objTemplate->setVariable('LINE_CONTROL', 'elementHide'); - } - } else { - if ($this->intGlobalWriteAccess != 0) { + if ($this->myVisClass->checkAccountGroup($arrData[$i]['access_group'], 'write') !== 0) { $objTemplate->setVariable('LINE_CONTROL', 'elementHide'); } + } else if ($this->intGlobalWriteAccess !== 0) { + $objTemplate->setVariable('LINE_CONTROL', 'elementHide'); } - // Check global access rights for list objects - if ($this->intGlobalWriteAccess != 0) { + /* Check global access rights for list objects */ + if ($this->intGlobalWriteAccess !== 0) { $objTemplate->setVariable('LINE_CONTROL', 'elementHide'); } $objTemplate->parse($strTplRow); } } else { - $objTemplate->setVariable('IMAGE_PATH', $this->arrSettings['path']['base_url']. 'images/'); + $objTemplate->setVariable('IMAGE_PATH', $this->arrSettings['path']['base_url'] . 'images/'); $objTemplate->parse($strTplRow); } $objTemplate->setVariable('BUTTON_CLASS', 'elementShow'); - if ($this->intDomainId == 0) { + if ($this->intDomainId === 0) { $objTemplate->setVariable('BUTTON_CLASS', 'elementHide'); } - // Check access rights for adding new objects - if ($this->intGlobalWriteAccess != 0) { + /* Check access rights for adding new objects */ + if ($this->intGlobalWriteAccess !== 0) { $objTemplate->setVariable('ADD_CONTROL', 'disabled="disabled"'); } - // Show page numbers + /* Show page numbers */ $objTemplate->setVariable('PAGES', $this->myVisClass->buildPageLinks(filter_input( INPUT_SERVER, 'PHP_SELF', - FILTER_SANITIZE_STRING + FILTER_UNSAFE_RAW ), $intDLCount2, $this->intLimit, $this->intSortBy, $this->strSortDir)); $objTemplate->parse($strTplPart); $objTemplate->show($strTplPart); } + /** + * Process field view + * @param array $arrData Data array + * @param string $strTableName Table name + * @return string String includung field data + */ + public function processField(array $arrData, string $strTableName): string + { + $strField = ''; + $arrDataHosts = array(); + $arrDataHostgroups = array(); + $arrDataService = array(); + $arrDataServices = array(); + /* Hostdependency table */ + if ($strTableName === 'tbl_hostdependency') { + if ((int)$arrData['dependent_host_name'] !== 0) { + $strSQLHost = 'SELECT `host_name`, `exclude` FROM `tbl_host` ' . + 'LEFT JOIN `tbl_lnkHostdependencyToHost_DH` ON `id`=`idSlave` ' . + 'WHERE `idMaster`=' . $arrData['id'] . ' ORDER BY `host_name`'; + $this->myDBClass->hasDataArray($strSQLHost, $arrDataHosts, $intDCHost); + if ($intDCHost !== 0) { + foreach ($arrDataHosts as $elem) { + if ((int)$elem['exclude'] === 1) { + $strField .= 'H:!' . $elem['host_name'] . ','; + } else { + $strField .= 'H:' . $elem['host_name'] . ','; + } + } + } + } + if ((int)$arrData['dependent_hostgroup_name'] !== 0) { + $strSQLHost = 'SELECT `hostgroup_name`, `exclude` FROM `tbl_hostgroup` ' . + 'LEFT JOIN `tbl_lnkHostdependencyToHostgroup_DH` ON `id`=`idSlave` ' . + 'WHERE `idMaster`=' . $arrData['id'] . ' ORDER BY `hostgroup_name`'; + $this->myDBClass->hasDataArray($strSQLHost, $arrDataHostgroups, $intDCHostgroup); + if ($intDCHostgroup !== 0) { + foreach ($arrDataHostgroups as $elem) { + if ((int)$elem['exclude'] === 1) { + $strField .= 'HG:!' . $elem['hostgroup_name'] . ','; + } else { + $strField .= 'HG:' . $elem['hostgroup_name'] . ','; + } + } + } + } + } + /* Hostescalation table */ + if ($strTableName === 'tbl_hostescalation') { + if ((int)$arrData['host_name'] !== 0) { + $strSQLHost = 'SELECT `host_name` FROM `tbl_host` ' . + 'LEFT JOIN `tbl_lnkHostescalationToHost` ON `id`=`idSlave` ' . + 'WHERE `idMaster`=' . $arrData['id'] . ' ORDER BY `host_name`'; + $this->myDBClass->hasDataArray($strSQLHost, $arrDataHosts, $intDCHost); + if ($intDCHost !== 0) { + foreach ($arrDataHosts as $elem) { + $strField .= 'H:' . $elem['host_name'] . ','; + } + } + } + if ((int)$arrData['hostgroup_name'] !== 0) { + $strSQLHost = 'SELECT `hostgroup_name` FROM `tbl_hostgroup` ' . + 'LEFT JOIN `tbl_lnkHostescalationToHostgroup` ON `id`=`idSlave` ' . + 'WHERE `idMaster`=' . $arrData['id'] . ' ORDER BY `hostgroup_name`'; + $this->myDBClass->hasDataArray($strSQLHost, $arrDataHostgroups, $intDCHostgroup); + if ($intDCHostgroup !== 0) { + foreach ($arrDataHostgroups as $elem) { + $strField .= 'HG:' . $elem['hostgroup_name'] . ','; + } + } + } + } + /* Servicedependency table */ + if ($strTableName === 'tbl_servicedependency') { + if ((int)$arrData['dependent_service_description'] === 2) { + $strField .= '*'; + } elseif ((int)$arrData['dependent_service_description'] !== 0) { + $strSQLService = 'SELECT `strSlave` FROM `tbl_lnkServicedependencyToService_DS` ' . + 'WHERE `idMaster`=' . $arrData['id'] . ' ORDER BY `strSlave`'; + $this->myDBClass->hasDataArray($strSQLService, $arrDataService, $intDCService); + if ($intDCService !== 0) { + foreach ($arrDataService as $elem) { + $strField .= $elem['strSlave'] . ','; + } + } + } + if ($strField === '') { + $strSQLService = 'SELECT `servicegroup_name` FROM `tbl_servicegroup` ' . + 'LEFT JOIN `tbl_lnkServicedependencyToServicegroup_DS` ON `idSlave`=`id` ' . + 'WHERE `idMaster`=' . $arrData['id'] . ' ORDER BY `servicegroup_name`'; + $this->myDBClass->hasDataArray($strSQLService, $arrDataService, $intDCService); + if ($intDCService !== 0) { + foreach ($arrDataService as $elem) { + $strField .= $elem['servicegroup_name'] . ','; + } + } + } + } + /* Serviceescalation table */ + if ($strTableName === 'tbl_serviceescalation') { + if ((int)$arrData['service_description'] === 2) { + $strField .= '*'; + } elseif ((int)$arrData['service_description'] !== 0) { + $strSQLService = 'SELECT `strSlave` FROM `tbl_lnkServiceescalationToService` ' . + 'WHERE `idMaster`=' . $arrData['id']; + $this->myDBClass->hasDataArray($strSQLService, $arrDataServices, $intDCServices); + if ($intDCServices !== 0) { + foreach ($arrDataServices as $elem) { + $strField .= $elem['strSlave'] . ','; + } + } + } + if ($strField === '') { + $strSQLService = 'SELECT `servicegroup_name` FROM `tbl_servicegroup` ' . + 'LEFT JOIN `tbl_lnkServiceescalationToServicegroup` ON `idSlave`=`id` ' . + 'WHERE `idMaster`=' . $arrData['id'] . ' ORDER BY `servicegroup_name`'; + $this->myDBClass->hasDataArray($strSQLService, $arrDataService, $intDCService); + if ($intDCService !== 0) { + foreach ($arrDataService as $elem) { + $strField .= $elem['servicegroup_name'] . ','; + } + } + } + } + /* Some string manipulations - remove comma at line end */ + if (substr($strField, -1) === ',') { + $strField = substr($strField, 0, -1); + } + return $strField; + } + /** * Display information messages - * @param \HTML_Template_IT $objTemplate Form template object - * @param string $strErrorMessage Error messages - * @param string $strInfoMessage Information messages - * @param string $strConsistMessage Consistency messages - * @param array $arrTimeData Time data array - * @param string $strTimeInfoString Time information message - * @param int $intNoTime Status value for showing time information (0 = show time) + * @param HTML_Template_IT $objTemplate Form template object + * @param string $strErrorMessage Error messages + * @param string $strInfoMessage Information messages + * @param string $strConsistMessage Consistency messages + * @param array $arrTimeData Time data array + * @param string $strTimeInfoString Time information message + * @param int $intNoTime Status value for showing time information (0 = show time) */ public function showMessages( - $objTemplate, - $strErrorMessage, - $strInfoMessage, - $strConsistMessage, - $arrTimeData, - $strTimeInfoString, - $intNoTime = 0 - ) { - // Display info messages - if ($strInfoMessage != '') { + HTML_Template_IT $objTemplate, + string $strErrorMessage, + string $strInfoMessage, + string $strConsistMessage, + array $arrTimeData, + string $strTimeInfoString, + int $intNoTime = 0 + ): void + { + /* Display info messages */ + if ($strInfoMessage !== '') { $objTemplate->setVariable('INFOMESSAGE', $strInfoMessage); $objTemplate->parse('infomessage'); } - // Display error messages - if ($strErrorMessage != '') { + /* Display error messages */ + if ($strErrorMessage !== '') { $objTemplate->setVariable('ERRORMESSAGE', $strErrorMessage); $objTemplate->parse('errormessage'); } - // Display time informations - if (($this->intDomainId != 0) && ($intNoTime == 0)) { + /* Display time information */ + if (($this->intDomainId !== 0) && ($intNoTime === 0)) { foreach ($arrTimeData as $key => $elem) { - if ($key == 'table') { - $objTemplate->setVariable('LAST_MODIFIED_TABLE', translate('Last database update:'). ' ' . - $elem. ''); + if ($key === 'table') { + $objTemplate->setVariable('LAST_MODIFIED_TABLE', translate('Last database update:') . ' ' . + $elem . ''); $objTemplate->parse('table_time'); } else { - $objTemplate->setVariable('LAST_MODIFIED_FILE', translate('Last file change of the configuration '. - 'target '). ' ' .$key. ': ' .$elem. ''); + $objTemplate->setVariable('LAST_MODIFIED_FILE', translate('Last file change of the configuration ' . + 'target ') . ' ' . $key . ': ' . $elem . ''); $objTemplate->parse('file_time'); } } - if ($strTimeInfoString != '') { + if ($strTimeInfoString !== '') { $objTemplate->setVariable('MODIFICATION_STATUS', $strTimeInfoString); $objTemplate->parse('modification_status'); } } - // Display consistency messages - if ($strConsistMessage != '') { + /* Display consistency messages */ + if ($strConsistMessage !== '') { $objTemplate->setVariable('CONSIST_USAGE', $strConsistMessage); $objTemplate->parse('consistency'); } @@ -377,12 +498,12 @@ class NagContentClass /** * Display page footer - * @param \HTML_Template_IT $objTemplate Form template object - * @param string $setFileVersion NagiosQL version + * @param HTML_Template_IT $objTemplate Form template object + * @param string $setFileVersion NagiosQL version */ - public function showFooter($objTemplate, $setFileVersion) + public function showFooter(HTML_Template_IT $objTemplate, string $setFileVersion): void { - $objTemplate->setVariable('VERSION_INFO', "setVariable('VERSION_INFO', "NagiosQL $setFileVersion"); $objTemplate->parse('footer'); $objTemplate->show('footer'); @@ -390,18 +511,18 @@ class NagContentClass /** * Single data form initialization - * @param \HTML_Template_IT $objTemplate Form template object - * @param string $strChbFields Comma separated string of checkbox value names + * @param HTML_Template_IT $objTemplate Form template object + * @param string $strChbFields Comma separated string of checkbox value names */ - public function addFormInit($objTemplate, $strChbFields = '') + public function addFormInit(HTML_Template_IT $objTemplate, string $strChbFields = ''): void { - // Language text replacements from fieldvars.php file + /* Language text replacements from fieldvars.php file */ foreach ($this->arrDescription as $elem) { $objTemplate->setVariable($elem['name'], $elem['string']); } - // Some single replacements - $objTemplate->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); - $objTemplate->setVariable('IMAGE_PATH', $this->arrSettings['path']['base_url']. 'images/'); + /* Some single replacements */ + $objTemplate->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_UNSAFE_RAW)); + $objTemplate->setVariable('IMAGE_PATH', $this->arrSettings['path']['base_url'] . 'images/'); $objTemplate->setVariable('DOCUMENT_ROOT', $this->arrSettings['path']['base_url']); $objTemplate->setVariable('ACT_CHECKED', 'checked'); $objTemplate->setVariable('REG_CHECKED', 'checked'); @@ -409,31 +530,31 @@ class NagContentClass $objTemplate->setVariable('VERSION', $this->intVersion); $objTemplate->setVariable('LIMIT', $this->intLimit); $objTemplate->setVariable('RELATION_CLASS', 'elementHide'); - $objTemplate->setVariable('IFRAME_SRC', $this->arrSettings['path']['base_url']. 'admin/commandline.php'); - // Some conditional replacements - if ($this->strBrowser != 'msie') { + $objTemplate->setVariable('IFRAME_SRC', $this->arrSettings['path']['base_url'] . 'admin/commandline.php'); + /* Some conditional replacements */ + if ($this->strBrowser !== 'msie') { $objTemplate->setVariable('MSIE_DISABLED', 'disabled="disabled"'); } - if ($this->intGroupAdm == 0) { + if ($this->intGroupAdm === 0) { $objTemplate->setVariable('RESTRICT_GROUP_ADMIN', 'class="elementHide"'); } - if ($this->arrSettings['common']['seldisable'] == 0) { - $objTemplate->setVariable('MSIE_DISABLED', ''); + if ((int)$this->arrSettings['common']['seldisable'] === 0) { + $objTemplate->setVariable('MSIE_DISABLED'); } - if ($this->arrSettings['common']['tplcheck'] == 0) { + if ((int)$this->arrSettings['common']['tplcheck'] === 0) { $objTemplate->setVariable('CHECK_BYPASS', 'return true;'); $objTemplate->setVariable('CHECK_BYPASS_NEW', '1'); } else { $objTemplate->setVariable('CHECK_BYPASS_NEW', '0'); } - // Some replacements based on nagios version + /* Some replacements based on nagios version */ if ($this->intVersion < 3) { $objTemplate->setVariable('VERSION_20_VISIBLE', 'elementShow'); $objTemplate->setVariable('VERSION_30_VISIBLE', 'elementHide'); $objTemplate->setVariable('VERSION_40_VISIBLE', 'elementHide'); $objTemplate->setVariable('VERSION_20_MUST', 'inpmust'); - $objTemplate->setVariable('VERSION_30_MUST', ''); - $objTemplate->setVariable('VERSION_40_MUST', ''); + $objTemplate->setVariable('VERSION_30_MUST'); + $objTemplate->setVariable('VERSION_40_MUST'); $objTemplate->setVariable('VERSION_20_STAR', '*'); $objTemplate->setVariable('NAGIOS_VERSION', '2'); } @@ -441,10 +562,10 @@ class NagContentClass $objTemplate->setVariable('VERSION_20_VISIBLE', 'elementHide'); $objTemplate->setVariable('VERSION_30_VISIBLE', 'elementShow'); $objTemplate->setVariable('VERSION_40_VISIBLE', 'elementHide'); - $objTemplate->setVariable('VERSION_20_MUST', ''); + $objTemplate->setVariable('VERSION_20_MUST'); $objTemplate->setVariable('VERSION_30_MUST', 'inpmust'); - $objTemplate->setVariable('VERSION_40_MUST', ''); - $objTemplate->setVariable('VERSION_20_STAR', ''); + $objTemplate->setVariable('VERSION_40_MUST'); + $objTemplate->setVariable('VERSION_20_STAR'); $objTemplate->setVariable('NAGIOS_VERSION', '3'); } if ($this->intVersion >= 4) { @@ -452,194 +573,64 @@ class NagContentClass $objTemplate->setVariable('VERSION_40_MUST', 'inpmust'); $objTemplate->setVariable('NAGIOS_VERSION', '4'); } - // Checkbox and radio field value replacements - if ($strChbFields != '') { + /* Checkbox and radio field value replacements */ + if ($strChbFields !== '') { foreach (explode(',', $strChbFields) as $elem) { - $objTemplate->setVariable('DAT_' .$elem. '0_CHECKED', ''); - $objTemplate->setVariable('DAT_' .$elem. '1_CHECKED', ''); - $objTemplate->setVariable('DAT_' .$elem. '2_CHECKED', 'checked'); + $objTemplate->setVariable('DAT_' . $elem . '0_CHECKED'); + $objTemplate->setVariable('DAT_' . $elem . '1_CHECKED'); + $objTemplate->setVariable('DAT_' . $elem . '2_CHECKED', 'checked'); } } } /** * Single data form - value insertion - * @param \HTML_Template_IT $objTemplate Form template object - * @param array $arrModifyData Database values - * @param int $intLocked Data is locked (0 = no / 1 = yes) - * @param string $strInfo Information string - * @param string $strChbFields Comma separated string of checkbox value names + * @param HTML_Template_IT $objTemplate Form template object + * @param array $arrModifyData Database values + * @param int $intLocked Data is locked (0 = no / 1 = yes) + * @param string $strInfo Information string + * @param string $strChbFields Comma separated string of checkbox value names */ - public function addInsertData($objTemplate, $arrModifyData, $intLocked, $strInfo, $strChbFields = '') + public function addInsertData(HTML_Template_IT $objTemplate, array $arrModifyData, int $intLocked, string $strInfo, string $strChbFields = ''): void { - // Insert text data values + /* Insert text data values */ foreach ($arrModifyData as $key => $value) { - if (($key == 'active') || ($key == 'register') || ($key == 'last_modified') || ($key == 'access_rights')) { + if (($key === 'active') || ($key === 'register') || ($key === 'last_modified') || ($key === 'access_rights')) { continue; } - $objTemplate->setVariable('DAT_' .strtoupper($key), htmlentities($value, ENT_QUOTES, 'UTF-8')); + $objTemplate->setVariable('DAT_' . strtoupper($key), htmlentities($value, ENT_QUOTES, 'UTF-8')); } - // Insert checkbox data values - if (isset($arrModifyData['active']) && ($arrModifyData['active'] != 1)) { - $objTemplate->setVariable('ACT_CHECKED', ''); + /* Insert checkbox data values */ + if (isset($arrModifyData['active']) && ((int)$arrModifyData['active'] !== 1)) { + $objTemplate->setVariable('ACT_CHECKED'); } - if (isset($arrModifyData['register']) && ($arrModifyData['register'] != 1)) { - $objTemplate->setVariable('REG_CHECKED', ''); + if (isset($arrModifyData['register']) && ((int)$arrModifyData['register'] !== 1)) { + $objTemplate->setVariable('REG_CHECKED'); } - // Deselect any checkboxes - if ($strChbFields != '') { + /* Deselect any checkboxes */ + if ($strChbFields !== '') { foreach (explode(',', $strChbFields) as $elem) { - $objTemplate->setVariable('DAT_' .$elem. '0_CHECKED', ''); - $objTemplate->setVariable('DAT_' .$elem. '1_CHECKED', ''); - $objTemplate->setVariable('DAT_' .$elem. '2_CHECKED', ''); + $objTemplate->setVariable('DAT_' . $elem . '0_CHECKED'); + $objTemplate->setVariable('DAT_' . $elem . '1_CHECKED'); + $objTemplate->setVariable('DAT_' . $elem . '2_CHECKED'); } } - // Change some status values in locked data sets - if ($intLocked != 0) { + /* Change some status values in locked data sets */ + if ($intLocked !== 0) { $objTemplate->setVariable('ACT_DISABLED', 'disabled'); $objTemplate->setVariable('ACT_CHECKED', 'checked'); $objTemplate->setVariable('ACTIVE', '1'); $objTemplate->setVariable('CHECK_MUST_DATA', $strInfo); $objTemplate->setVariable('RELATION_CLASS', 'elementShow'); } - // Change mode to modify + /* Change mode to modify */ $objTemplate->setVariable('MODUS', 'modify'); - // Check write permission - if ($this->intWriteAccessId == 1) { + /* Check write permission */ + if ($this->intWriteAccessId === 1) { $objTemplate->setVariable('DISABLE_SAVE', 'disabled="disabled"'); } - if ($this->intGlobalWriteAccess == 1) { + if ($this->intGlobalWriteAccess === 1) { $objTemplate->setVariable('DISABLE_SAVE', 'disabled="disabled"'); } } - - /** - * Process field view - * @param array $arrData Data array - * @param string $strTableName Table name - * @return string String includung field data - */ - public function processField($arrData, $strTableName) - { - $strField = ''; - $arrDataHosts = array(); - $arrDataHostgroups = array(); - $arrDataService = array(); - $arrDataServices = array(); - // Hostdependency table - if ($strTableName == 'tbl_hostdependency') { - if ($arrData['dependent_host_name'] != 0) { - $strSQLHost = 'SELECT `host_name`, `exclude` FROM `tbl_host` ' . - 'LEFT JOIN `tbl_lnkHostdependencyToHost_DH` ON `id`=`idSlave` ' . - 'WHERE `idMaster`=' .$arrData['id']. ' ORDER BY `host_name`'; - $this->myDBClass->hasDataArray($strSQLHost, $arrDataHosts, $intDCHost); - if ($intDCHost != 0) { - foreach ($arrDataHosts as $elem) { - if ($elem['exclude'] == 1) { - $strField .= 'H:!' .$elem['host_name']. ','; - } else { - $strField .= 'H:' .$elem['host_name']. ','; - } - } - } - } - if ($arrData['dependent_hostgroup_name'] != 0) { - $strSQLHost = 'SELECT `hostgroup_name`, `exclude` FROM `tbl_hostgroup` ' . - 'LEFT JOIN `tbl_lnkHostdependencyToHostgroup_DH` ON `id`=`idSlave` ' . - 'WHERE `idMaster`=' .$arrData['id']. ' ORDER BY `hostgroup_name`'; - $this->myDBClass->hasDataArray($strSQLHost, $arrDataHostgroups, $intDCHostgroup); - if ($intDCHostgroup != 0) { - foreach ($arrDataHostgroups as $elem) { - if ($elem['exclude'] == 1) { - $strField .= 'HG:!' .$elem['hostgroup_name']. ','; - } else { - $strField .= 'HG:' .$elem['hostgroup_name']. ','; - } - } - } - } - } - // Hostescalation table - if ($strTableName == 'tbl_hostescalation') { - if ($arrData['host_name'] != 0) { - $strSQLHost = 'SELECT `host_name` FROM `tbl_host` ' . - 'LEFT JOIN `tbl_lnkHostescalationToHost` ON `id`=`idSlave` ' . - 'WHERE `idMaster`=' .$arrData['id']. ' ORDER BY `host_name`'; - $this->myDBClass->hasDataArray($strSQLHost, $arrDataHosts, $intDCHost); - if ($intDCHost != 0) { - foreach ($arrDataHosts as $elem) { - $strField .= 'H:' .$elem['host_name']. ','; - } - } - } - if ($arrData['hostgroup_name'] != 0) { - $strSQLHost = 'SELECT `hostgroup_name` FROM `tbl_hostgroup` ' . - 'LEFT JOIN `tbl_lnkHostescalationToHostgroup` ON `id`=`idSlave` ' . - 'WHERE `idMaster`=' .$arrData['id']. ' ORDER BY `hostgroup_name`'; - $this->myDBClass->hasDataArray($strSQLHost, $arrDataHostgroups, $intDCHostgroup); - if ($intDCHostgroup != 0) { - foreach ($arrDataHostgroups as $elem) { - $strField .= 'HG:' .$elem['hostgroup_name']. ','; - } - } - } - } - // Servicedependency table - if ($strTableName == 'tbl_servicedependency') { - if ($arrData['dependent_service_description'] == 2) { - $strField .= '*'; - } elseif ($arrData['dependent_service_description'] != 0) { - $strSQLService = 'SELECT `strSlave` FROM `tbl_lnkServicedependencyToService_DS` ' . - 'WHERE `idMaster`=' .$arrData['id']. ' ORDER BY `strSlave`'; - $this->myDBClass->hasDataArray($strSQLService, $arrDataService, $intDCService); - if ($intDCService != 0) { - foreach ($arrDataService as $elem) { - $strField .= $elem['strSlave']. ','; - } - } - } - if ($strField == '') { - $strSQLService = 'SELECT `servicegroup_name` FROM `tbl_servicegroup` ' . - 'LEFT JOIN `tbl_lnkServicedependencyToServicegroup_DS` ON `idSlave`=`id` ' . - 'WHERE `idMaster`=' .$arrData['id']. ' ORDER BY `servicegroup_name`'; - $this->myDBClass->hasDataArray($strSQLService, $arrDataService, $intDCService); - if ($intDCService != 0) { - foreach ($arrDataService as $elem) { - $strField .= $elem['servicegroup_name']. ','; - } - } - } - } - // Serviceescalation table - if ($strTableName == 'tbl_serviceescalation') { - if ($arrData['service_description'] == 2) { - $strField .= '*'; - } elseif ($arrData['service_description'] != 0) { - $strSQLService = 'SELECT `strSlave` FROM `tbl_lnkServiceescalationToService` ' . - 'WHERE `idMaster`=' .$arrData['id']; - $this->myDBClass->hasDataArray($strSQLService, $arrDataServices, $intDCServices); - if ($intDCServices != 0) { - foreach ($arrDataServices as $elem) { - $strField .= $elem['strSlave']. ','; - } - } - } - if ($strField == '') { - $strSQLService = 'SELECT `servicegroup_name` FROM `tbl_servicegroup` ' . - 'LEFT JOIN `tbl_lnkServiceescalationToServicegroup` ON `idSlave`=`id` ' . - 'WHERE `idMaster`=' .$arrData['id']. ' ORDER BY `servicegroup_name`'; - $this->myDBClass->hasDataArray($strSQLService, $arrDataService, $intDCService); - if ($intDCService != 0) { - foreach ($arrDataService as $elem) { - $strField .= $elem['servicegroup_name']. ','; - } - } - } - } - // Some string manipulations - remove comma on line end - if (substr($strField, -1) == ',') { - $strField = substr($strField, 0, -1); - } - return $strField; - } -} +} \ No newline at end of file diff --git a/functions/NagDataClass.php b/functions/NagDataClass.php index 0b5eb81..34ad462 100644 --- a/functions/NagDataClass.php +++ b/functions/NagDataClass.php @@ -1,59 +1,54 @@ intDomainId = $arrSession['domain']; + $this->intDomainId = (int)$arrSession['domain']; } if (isset($arrSession['username'])) { $this->strUserName = $arrSession['username']; @@ -61,152 +56,57 @@ class NagDataClass $this->arrSession = $arrSession; } - /** - * Saving a given string to the logbook - * @param string $strLogMessage Message string - * @return int 0 = successful / 1 = error - */ - public function writeLog($strLogMessage) - { - // Variable definition - $strRemoteAdress = filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP); - $intReturn = 0; - // Write log message to database - if ($strRemoteAdress != null) { - // Webinterface - $strUserName = $this->strUserName; - $strDomain = $this->myDBClass->getFieldData('SELECT `domain` FROM `tbl_datadomain` ' . - 'WHERE `id`=' .$this->intDomainId); - $booReturn = $this->myDBClass->insertData("INSERT INTO `tbl_logbook` SET `user`='".$strUserName."',". - "`time`=NOW(), `ipadress`='".$strRemoteAdress."', `domain`='$strDomain',". - "`entry`='".addslashes($strLogMessage)."'"); - if ($booReturn == false) { - $intReturn = 1; - } - } else { - // Scriptinginterface - $strUserName = 'scripting'; - $strRemoteUser = filter_input(INPUT_SERVER, 'REMOTE_USER', FILTER_SANITIZE_STRING); - $strHostname = filter_input(INPUT_SERVER, 'REMOTE_HOST', FILTER_SANITIZE_STRING); - $strSSHClient = filter_input(INPUT_SERVER, 'SSH_CLIENT', FILTER_SANITIZE_STRING); - if ($strRemoteUser != null) { - $strUserName .= ' - ' .$strRemoteUser; - } - $strDomain = $this->myDBClass->getFieldData('SELECT `domain` FROM `tbl_datadomain` ' . - 'WHERE `id`=' .$this->intDomainId); - if ($strHostname != null) { - $booReturn = $this->myDBClass->insertData("INSERT INTO `tbl_logbook` SET `user`='".$strUserName."',". - "`time`=NOW(), `ipadress`='".$strHostname."', `domain`='$strDomain', ". - "`entry`='".addslashes($strLogMessage)."'"); - } elseif ($strSSHClient != null) { - $arrSSHClient = explode(' ', $strSSHClient); - $booReturn = $this->myDBClass->insertData("INSERT INTO `tbl_logbook` SET `user`='".$strUserName."',". - "`time`=NOW(), `ipadress`='".$arrSSHClient[0]."', `domain`='$strDomain', ". - "`entry`='".addslashes($strLogMessage)."'"); - } else { - $booReturn = $this->myDBClass->insertData("INSERT INTO `tbl_logbook` SET `user`='".$strUserName."',". - "`time`=NOW(), `ipadress`='unknown', `domain`='$strDomain', ". - "`entry`='".addslashes($strLogMessage)."'"); - } - if ($booReturn == false) { - $intReturn = 1; - } - } - return $intReturn; - } - - /** - * Sends an SQL string to the database server - * @param string $strSQL SQL Command - * @param int $intDataID Data ID of last inserted dataset (by reference) - * @return int 0 = successful / 1 = error - * Status message is stored in message class variables - */ - public function dataInsert($strSQL, &$intDataID) - { - //Define variables - $intReturn = 0; - // Send the SQL command to the database server - $booReturn = $this->myDBClass->insertData($strSQL); - $intDataID = $this->myDBClass->intLastId; - // Was the SQL command processed successfully? - if ($booReturn) { - $this->processClassMessage(translate('Data were successfully inserted to the data base!'). - '::', $this->strInfoMessage); - } else { - $this->processClassMessage(translate('Error while inserting the data into the database:'). - '::' .$this->myDBClass->strErrorMessage. '::', $this->strErrorMessage); - $intReturn = 1; - } - return $intReturn; - } - - /** - * Merge message strings and check for duplicate messages - * @param string $strNewMessage New message to add - * @param string $strOldMessage Modified message string (by reference) - */ - public function processClassMessage($strNewMessage, &$strOldMessage) - { - $strNewMessage = str_replace('::::', '::', $strNewMessage); - if (($strOldMessage != '') && ($strNewMessage != '')) { - if (substr_count($strOldMessage, $strNewMessage) == 0) { - $strOldMessage .= $strNewMessage; - } - } else { - $strOldMessage .= $strNewMessage; - } - } - /** * Copies one or more records in a data table. Alternatively, an individual record ID * are specified, or the values of the $_POST['chbId_n'] variable is used where n * is the record ID. - * @param string $strTableName Table name - * @param string $strKeyField Key field of the table - * @param int $intDataId Single data ID to copy - * @param int $intDomainId Target domain ID - * @return int 0 = successful / 1 = error - * Status message is stored in message class variables + * @param string $strTableName Table name + * @param string $strKeyField Key field of the table + * @param int $intDataId Single data ID to copy + * @param int $intDomainId Target domain ID + * @return int 0 = successful / 1 = error + * Status message is stored in message class variables */ - public function dataCopyEasy($strTableName, $strKeyField, $intDataId = 0, $intDomainId = -1) + public function dataCopyEasy(string $strTableName, string $strKeyField, int $intDataId = 0, int $intDomainId = -1): int { - // Define variables + /* Define variables */ $arrRelations = array(); - $intError = 0; - $intNumber = 0; - $intReturn = 0; - $strAccess = $this->myVisClass->getAccessGroups('write'); - if ($intDomainId == -1) { + $intError = 0; + $intNumber = 0; + $intReturn = 0; + $strAccess = $this->myVisClass->getAccessGroups('write'); + if ($intDomainId === -1) { $intDomainId = $this->intDomainId; } - // Get all data ID from target table + /* Get all data ID from target table */ $strAccWhere = "WHERE `access_group` IN ($strAccess)"; - if (($strTableName == 'tbl_user') || ($strTableName == 'tbl_group')) { + if (($strTableName === 'tbl_user') || ($strTableName === 'tbl_group')) { $strAccWhere = ''; } - $strSQL = 'SELECT `id` FROM `' .$strTableName."` $strAccWhere ORDER BY `id`"; + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $strTableName . "` $strAccWhere ORDER BY `id`"; $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($booReturn == false) { - $this->processClassMessage(translate('Error while selecting data from database:'). - '::' .$this->myDBClass->strErrorMessage. '::', $this->strErrorMessage); + if ($booReturn === false) { + $this->processClassMessage(translate('Error while selecting data from database:') . + '::' . $this->myDBClass->strErrorMessage . '::', $this->strErrorMessage); return 1; } - if ($intDataCount != 0) { - for ($i=0; $i<$intDataCount; $i++) { - // Skip common domain value - if ($arrData[$i]['id'] == 0) { + if ($intDataCount !== 0) { + for ($i = 0; $i < $intDataCount; $i++) { + /* Skip common domain value */ + if ((int)$arrData[$i]['id'] === 0) { continue; } - // Build the name of the form variable - $strChbName = 'chbId_' .$arrData[$i]['id']; - // If a form variable with this name exists or a matching single data ID was passed - if (((filter_input(INPUT_POST, $strChbName, FILTER_SANITIZE_STRING) != null) && ($intDataId == 0)) || - ($intDataId == $arrData[$i]['id'])) { - // Get all data of this data ID - $strSQL = 'SELECT * FROM `' .$strTableName. '` WHERE `id`=' .$arrData[$i]['id']; + /* Build the name of the form variable */ + $strChbName = 'chbId_' . $arrData[$i]['id']; + /* If a form variable with this name exists or a matching single data ID was passed */ + if (((filter_input(INPUT_POST, $strChbName, FILTER_UNSAFE_RAW) !== null) && ($intDataId === 0)) || + ($intDataId === (int)$arrData[$i]['id'])) { + /* Get all data of this data ID */ + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $strTableName . '` WHERE `id`=' . $arrData[$i]['id']; $this->myDBClass->hasSingleDataset($strSQL, $arrData[$i]); - // Build a temporary config name + /* Build a temporary config name */ $strNewName = $this->buildTempConfigName( $strTableName, $strKeyField, @@ -215,1078 +115,295 @@ class NagDataClass $arrData, $i ); - // Build the INSERT command based on the table name - $strSQLInsert = $this->buildInsertSQL( - $strTableName, - $strKeyField, - $intDomainId, - $strNewName, - $arrData, - $i - ); - // Insert the master dataset - $intCheck = 0; - $booReturn = $this->myDBClass->insertData($strSQLInsert); + /* Build the INSERT command based on the table name */ + if ($strTableName === 'tbl_service') { + $strSQLInsert = $this->buildInsertSQL( + $strTableName, + 'service_description', + $intDomainId, + $strNewName, + $arrData, + $i); + } else { + $strSQLInsert = $this->buildInsertSQL( + $strTableName, + $strKeyField, + $intDomainId, + $strNewName, + $arrData, + $i); + } + /* Insert the master dataset */ + $intCheck = 0; + $booReturn = $this->myDBClass->insertData($strSQLInsert); $intMasterId = $this->myDBClass->intLastId; - if ($booReturn == false) { + if ($booReturn === false) { $intCheck++; } - // Copy relations - if (($this->tableRelations($strTableName, $arrRelations) == 0) && ($intCheck == 0)) { + /* Copy relations */ + if (($this->tableRelations($strTableName, $arrRelations) === 0) && ($intCheck === 0)) { foreach ($arrRelations as $elem) { - // Normal 1:n relation - if ($elem['type'] == '2') { + /* Normal 1:n relation */ + if ((int)$elem['type'] === 2) { $intCheck = $this->insertRelationType2($arrData, $i, $elem, $intMasterId, $intCheck); - } elseif ($elem['type'] == '3') { // 1:n relation for templates + } elseif ((int)$elem['type'] === 3) { /* 1:n relation for templates */ $intCheck = $this->insertRelationType3($arrData, $i, $elem, $intMasterId, $intCheck); - } elseif ($elem['type'] == '4') { // Special relation for free variables + } elseif ((int)$elem['type'] === 4) { /* Special relation for free variables */ $intCheck = $this->insertRelationType4($arrData, $i, $elem, $intMasterId, $intCheck); - } elseif ($elem['type'] == '5') { // 1:n relation for tbl_lnkServicegroupToService + } elseif ((int)$elem['type'] === 5) { /* 1:n relation for tbl_lnkServicegroupToService */ $intCheck = $this->insertRelationType5($arrData, $i, $elem, $intMasterId, $intCheck); - } elseif ($elem['type'] == '6') { // 1:n relation for services + } elseif ((int)$elem['type'] === 6) { /* 1:n relation for services */ $intCheck = $this->insertRelationType6($arrData, $i, $elem, $intMasterId, $intCheck); } } - // 1:n relation for time definitions - if ($strTableName == 'tbl_timeperiod') { + /* 1:n relation for time definitions */ + if ($strTableName === 'tbl_timeperiod') { $intCheck = $this->insertRelationTimedefinition($arrData, $i, $intMasterId, $intCheck); } - // 1:n relation for groups - if ($strTableName == 'tbl_group') { + /* 1:n relation for groups */ + if ($strTableName === 'tbl_group') { $intCheck = $this->insertRelationGroup($arrData, $i, $intMasterId, $intCheck); } - // 1:n relation fot service to host connections - if ($strTableName == 'tbl_host') { + /* 1:n relation for service to host connections */ + if ($strTableName === 'tbl_host') { $intCheck = $this->insertRelationHost($arrData, $i, $intMasterId, $intCheck); } } - // Write logfile - if ($intCheck != 0) { - // Error + /* Write logfile */ + if ($intCheck !== 0) { + /* Error */ $intError++; - $this->writeLog(translate('Data set copy failed - table [new name]:'). ' ' .$strTableName - . ' [' .$strNewName. ']'); - $this->processClassMessage(translate('Data set copy failed - table [new name]:'). ' ' . - $strTableName. ' [' .$strNewName. ']::', $this->strInfoMessage); + $this->writeLog(translate('Data set copy failed - table [new name]:') . ' ' . $strTableName + . ' [' . $strNewName . ']'); + $this->processClassMessage(translate('Data set copy failed - table [new name]:') . ' ' . + $strTableName . ' [' . $strNewName . ']::', $this->strInfoMessage); } else { - // Success - $this->writeLog(translate('Data set copied - table [new name]:'). ' ' .$strTableName. - ' [' .$strNewName. ']'); - $this->processClassMessage(translate('Data set copied - table [new name]:'). ' ' . - $strTableName. ' [' .$strNewName. ']::', $this->strInfoMessage); + /* Success */ + $this->writeLog(translate('Data set copied - table [new name]:') . ' ' . $strTableName . + ' [' . $strNewName . ']'); + $this->processClassMessage(translate('Data set copied - table [new name]:') . ' ' . + $strTableName . ' [' . $strNewName . ']::', $this->strInfoMessage); } $intNumber++; } } - // Error processing + /* Error processing */ if ($intNumber > 0) { - if ($intError == 0) { - // Success + if ($intError === 0) { + /* Success */ $this->processClassMessage(translate('Data were successfully inserted to the data base!') . '::', $this->strInfoMessage); $this->updateStatusTable($strTableName); } else { - // Error + /* Error */ $this->processClassMessage(translate('Error while inserting the data into the database:') - . '::' .$this->myDBClass->strErrorMessage, $this->strInfoMessage); + . '::' . $this->myDBClass->strErrorMessage, $this->strInfoMessage); $intReturn = 1; } } else { - $this->processClassMessage(translate('No dataset copied. Maybe the dataset does not exist or you do '. - 'not have write permission.'). '::', $this->strErrorMessage); + $this->processClassMessage(translate('No dataset copied. Maybe the dataset does not exist or you do ' . + 'not have write permission.') . '::', $this->strErrorMessage); $intReturn = 1; } } else { - $this->processClassMessage(translate('No dataset copied. Maybe the dataset does not exist or you do not '. - 'have write permission.'). '::', $this->strErrorMessage); + $this->processClassMessage(translate('No dataset copied. Maybe the dataset does not exist or you do not ' . + 'have write permission.') . '::', $this->strErrorMessage); $intReturn = 1; } return $intReturn; } + /** + * Merge message strings and check for duplicate messages + * @param string $strNewMessage New message to add + * @param string|null $strOldMessage Modified message string (by reference) + */ + public function processClassMessage(string $strNewMessage, string &$strOldMessage = null): int + { + $strNewMessage = str_replace('::::', '::', $strNewMessage); + if (($strOldMessage !== '') && ($strNewMessage !== '')) { + if (substr_count($strOldMessage, $strNewMessage) === 0) { + $strOldMessage .= $strNewMessage; + } + } else { + $strOldMessage .= $strNewMessage; + } + return 0; + } + + /** + * Build a temporary configuration name + * @param string $strTableName Table name + * @param string $strKeyField Configuration field name + * @param int $intDomainId Domain ID + * @param int $intCount Dataset counter + * @param array $arrData Data array + * @param int $intID Data array key + * @return string Temporary configuration name + */ + private function buildTempConfigName(string $strTableName, string $strKeyField, int $intDomainId, int $intCount, array $arrData, int $intID): string + { + /* Define variables */ + $strNewName = ''; + for ($y = 1; $y <= $intCount; $y++) { + $strNewName = $arrData[$intID][$strKeyField] . " ($y)"; + if (($strTableName === 'tbl_user') || ($strTableName === 'tbl_group') || + ($strTableName === 'tbl_datadomain') || ($strTableName === 'tbl_configtarget')) { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $strTableName . '` WHERE `' . $strKeyField . "`='$strNewName'"; + } else if ($strTableName === 'tbl_service') { + $strNewName = $arrData[$intID]['service_description'] . " ($y)"; + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $strTableName . '` WHERE `' . $strKeyField . "`='" . + $arrData[$intID][$strKeyField] . "' AND `service_description`='$strNewName'"; + } else { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $strTableName . '` ' . + 'WHERE `' . $strKeyField . "`='$strNewName' AND `config_id`=$intDomainId"; + } + $strFieldData = $this->myDBClass->getFieldData($strSQL); + /* If the name is unused -> break the loop */ + if ($strFieldData === '') { + break; + } + } + /* Manually overwrite new name for extinfo tables */ + if ($strTableName === 'tbl_hostextinfo') { + $strNewName = '0'; + } + if ($strTableName === 'tbl_serviceextinfo') { + $strNewName = '0'; + } + return $strNewName; + } + + /** + * Build an INSERT command based on the table name + * @param string $strTableName Table name + * @param string $strKeyField Configuration field name + * @param int $intDomainId Domain ID + * @param string $strNewName New configuration name + * @param array $arrData Data array + * @param int $intID Data array key + * @return string SQL INSERT command + */ + private function buildInsertSQL(string $strTableName, string $strKeyField, int $intDomainId, string $strNewName, array $arrData, int $intID): string + { + /** @noinspection SqlResolve */ + $strSQLInsert = 'INSERT INTO `' . $strTableName . '` SET `' . $strKeyField . "`='" . $strNewName . "'"; + foreach ($arrData[$intID] as $key => $value) { + if ($value === null) { + $value = ''; + } + if (($key !== $strKeyField) && ($key !== 'active') && ($key !== 'last_modified') && + ($key !== 'id') && ($key !== 'config_id')) { + /* Manually set some NULL values based on field names */ + $value = $this->setNullValues($strTableName, $key, $value); + /* If the data value is not "NULL", add single quotes to the value */ + if ($value !== 'NULL') { + $strSQLInsert .= ',`' . $key . "`='" . addslashes($value) . "'"; + } else { + $strSQLInsert .= ',`' . $key . '`=' . $value; + } + } + } + if (($strTableName === 'tbl_user') || ($strTableName === 'tbl_group') || + ($strTableName === 'tbl_datadomain') || ($strTableName === 'tbl_configtarget')) { + $strSQLInsert .= ",`active`='0', `last_modified`=NOW()"; + } else { + $strSQLInsert .= ",`active`='0', `config_id`=$intDomainId, `last_modified`=NOW()"; + } + return $strSQLInsert; + } + + /** + * Manually set some NULL values based on field names (key) + * @param string $strTableName Table name + * @param string $key Data key (field name) + * @param string $value Data value (field key) + * @return NULL|string Manipulated data value + */ + private function setNullValues(string $strTableName, string $key, string $value): ?string + { + $arrNull = array('normal_check_interval', 'retry_check_interval', 'max_check_attempts', 'low_flap_threshold', + 'high_flap_threshold', 'freshness_threshold', 'notification_interval', 'first_notification_delay', + 'check_interval', 'retry_interval'); + if (in_array($key, $arrNull, true) && ($value === '')) { + $value = 'NULL'; + } + /* manually set some NULL values based on table name */ + if (($strTableName === 'tbl_serviceextinfo') && ($key === 'service_description')) { + $value = '0'; + } + /* Do not copy the password in tbl_user */ + if (($strTableName === 'tbl_user') && ($key === 'password')) { + $value = 'xxxxxxx'; + } + /* Do not copy nodelete and webserver authentification values in tbl_user */ + if ($key === 'nodelete') { + $value = '0'; + } + if ($key === 'wsauth') { + $value = '0'; + } + return $value; + } + /** * Returns an array of all datafields of a table, which has an 1:1 or 1:n relation * to another table. - * @param string $strTable Table name - * @param array $arrRelations Array with relations - * @return int 0 = successful / 1 = error + * @param string $strTable Table name + * @param array|null $arrRelations Array with relations + * @return int 0 = successful / 1 = error */ - public function tableRelations($strTable, &$arrRelations) + public function tableRelations(string $strTable, array &$arrRelations = null): int { - // Define variable + /* Define variable */ $arrRelations = array(); - $arrData = array(); - $intDC = 0; - $intReturn = 1; - // Get relation data - $strSQL = "SELECT * FROM `tbl_relationinformation` WHERE `master`='$strTable' AND `fullRelation`=0"; + $arrData = array(); + $intDC = 0; + $intReturn = 1; + /* Get relation data */ + $strSQL = "SELECT * FROM `tbl_relationinformation` WHERE `master`='$strTable' AND `fullRelation`=0"; $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); - if ($booReturn && ($intDC != 0)) { + if ($booReturn && ($intDC !== 0)) { foreach ($arrData as $elem) { $arrRelations[] = array('tableName1' => $elem['tableName1'], 'tableName2' => $elem['tableName2'], - 'fieldName' => $elem['fieldName'], 'linkTable' => $elem['linkTable'], - 'target1' => $elem['target1'], 'target2' => $elem['target2'], - 'type' => $elem['type']); + 'fieldName' => $elem['fieldName'], 'linkTable' => $elem['linkTable'], + 'target1' => $elem['target1'], 'target2' => $elem['target2'], + 'type' => $elem['type']); } $intReturn = 0; } return $intReturn; } - /** - * Update the date inside the status table (used for last modified date) - * @param string $strTable Table name - * @return int 0 = successful / 1 = error - */ - public function updateStatusTable($strTable) - { - // Define variable - $arrData = array(); - $intDC = 0; - $intReturn = 1; - // Does the entry exist? - $strSQL = "SELECT * FROM `tbl_tablestatus` WHERE `tableName`='$strTable' AND `domainId`=".$this->intDomainId; - $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); - if ($booReturn && ($intDC != 0)) { - $strSQL = 'UPDATE `tbl_tablestatus` SET `updateTime`=NOW() ' . - "WHERE `tableName`='$strTable' AND `domainId`=".$this->intDomainId; - $booReturn = $this->dataInsert($strSQL, $intDataID); - if ($booReturn) { - $intReturn = 0; - } - } elseif ($booReturn) { - $strSQL = 'INSERT INTO `tbl_tablestatus` ' . - "SET `updateTime`=NOW(), `tableName`='$strTable', `domainId`=".$this->intDomainId; - $booReturn = $this->dataInsert($strSQL, $intDataID); - if ($booReturn) { - $intReturn = 0; - } - } - return $intReturn; - } - - /** - * Removes one or more dataset(s) from a table. Optinal a single data ID can be passed or the values will be - * processed through the POST variable $_POST['chbId_n'] where 'n' represents the data ID. - * -> This function does not delete any relation data! <- - * @param string $strTableName Table name - * @param int $intDataId Single data ID - * @return int 0 = successful / 1 = error - * Status message is stored in message class variables - */ - public function dataDeleteEasy($strTableName, $intDataId = 0) - { - // Define variables - $strNoDelete = ''; - $intReturn = 0; - $arrData = array(); - // Special rule for tables with "nodelete" cells - if (($strTableName == 'tbl_datadomain') || ($strTableName == 'tbl_configtarget') || - ($strTableName == 'tbl_user')) { - $strNoDelete = "AND `nodelete` <> '1'"; - } - // Delete a single data set - if ($intDataId != 0) { - $strSQL = 'DELETE FROM `' .$strTableName."` WHERE `id` = $intDataId $strNoDelete"; - $booReturn = $this->myDBClass->insertData($strSQL); - if ($booReturn == false) { - $this->processClassMessage(translate('Delete failed because a database error:'). - '::' .$this->myDBClass->strErrorMessage. '::', $this->strInfoMessage); - $intReturn = 1; - } elseif ($this->myDBClass->intAffectedRows == 0) { - $this->processClassMessage(translate('No data deleted. The dataset probably does not exist or '. - 'is protected from deletion.'). '::', $this->strErrorMessage); - $intReturn = 1; - } else { - $this->strInfoMessage .= translate('Dataset successfully deleted. Affected rows:'). ' ' . - $this->myDBClass->intAffectedRows. '::'; - $this->writeLog(translate('Delete dataset id:')." $intDataId ".translate('- from table:'). - " $strTableName ".translate('- with affected rows:'). ' ' .$this->myDBClass->intAffectedRows); - $this->updateStatusTable($strTableName); - } - // Delete data sets based on form POST parameter - } else { - $strSQL = 'SELECT `id` FROM `' .$strTableName. '` WHERE 1=1 '; - $strSQL .= $strNoDelete; - $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($booReturn && ($intDataCount != 0)) { - $intDeleteCount = 0; - foreach ($arrData as $elem) { - $strChbName = 'chbId_' .$elem['id']; - // Should this data id to be deleted? - if ((filter_input(INPUT_POST, $strChbName) != null) && - (filter_input(INPUT_POST, $strChbName, FILTER_SANITIZE_STRING) == 'on')) { - $strSQL = 'DELETE FROM `' .$strTableName. '` WHERE `id` = ' .$elem['id']; - $booReturn = $this->myDBClass->insertData($strSQL); - if ($booReturn == false) { - $this->processClassMessage(translate('Delete failed because a database error:'). - '::' .$this->myDBClass->strErrorMessage. '::', $this->strInfoMessage); - $intReturn = 1; - } else { - $intDeleteCount += $this->myDBClass->intAffectedRows; - } - } - } - // Process messsages - if ($intDeleteCount == 0) { - $this->processClassMessage(translate('No data deleted. Probably the dataset does not exist or '. - 'it is protected from delete.'). '::', $this->strErrorMessage); - $intReturn = 1; - } elseif ($intReturn == 0) { - $this->processClassMessage(translate('Dataset successfully deleted. Affected rows:'). ' ' . - $intDeleteCount. '::', $this->strInfoMessage); - $this->writeLog(translate('Deleted data from table:')." $strTableName ". - translate('- with affected rows:'). ' ' .$this->myDBClass->intAffectedRows); - $this->updateStatusTable($strTableName); - } - } else { - $this->processClassMessage(translate('No data deleted. Probably the dataset does not exist or it is '. - 'protected from delete.'). '::', $this->strErrorMessage); - $intReturn = 1; - } - } - return $intReturn; - } - - /** - * Removes one or more dataset(s) from a table. Optinal a single data ID can be passed or the values will be - * processed through the POST variable $_POST['chbId_n'] where 'n' represents the data ID. - * -> This function does also delete relation data! <- - * @param string $strTableName Table name - * @param int $intDataId Single data ID - * @param int $intForce Force deletion (1 = force, 1 = no force) - * @return int 0 = successful / 1 = error - * Status message is stored in message class variables - */ - public function dataDeleteFull($strTableName, $intDataId = 0, $intForce = 0) - { - // Define variables - $arrRelations = array(); - $arrData = array(); - $arrConfigId = array(); - // Get write access groups - $strAccess = $this->myVisClass->getAccessGroups('write'); - // Get all relations - $this->fullTableRelations($strTableName, $arrRelations); - // Get all datasets - if ($strTableName == 'tbl_group') { - $strSQL = 'SELECT `id` FROM `' .$strTableName. '`'; - } else { - $strSQL = 'SELECT `id` FROM `' .$strTableName. '` ' . - 'WHERE `config_id`=' .$this->intDomainId." AND `access_group` IN ($strAccess)"; - } - $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($booReturn && ($intDataCount != 0)) { - $intDeleteCount = 0; - $strInfoMessage = ''; - $strErrorMessage = ''; - - foreach ($arrData as $elem) { - $strChbName = 'chbId_' .$elem['id']; - // Single ID - if (($intDataId != 0) && ($intDataId != $elem['id'])) { - continue; - } - // Should this data id to be deleted? - if ((($intDataId == $elem['id']) || ((filter_input(INPUT_POST, $strChbName) != null) && - (filter_input(INPUT_POST, $strChbName, FILTER_SANITIZE_STRING) == 'on'))) && - (($this->infoRelation($strTableName, $elem['id'], 'id', 1) == 0) || ($intForce == 1))) { - // Delete relations - if (!\is_array($arrRelations)) { - $arrRelations = array(); - } - foreach ($arrRelations as $rel) { - $strSQL = ''; - // Process flags - $arrFlags = explode(',', $rel['flags']); - // Simple 1:n relation - if ($arrFlags[3] == 1) { - $strSQL = 'DELETE FROM `' .$rel['tableName1']. '` ' . - 'WHERE `' .$rel['fieldName']. '`=' .$elem['id']; - } - // Simple 1:1 relation - if ($arrFlags[3] == 0) { - // Delete relation - if ($arrFlags[2] == 0) { - $strSQL = 'DELETE FROM `' .$rel['tableName1']. '` ' . - 'WHERE `' .$rel['fieldName']. '`=' .$elem['id']; - // Set slave to 0 - } elseif ($arrFlags[2] == 2) { - $strSQL = 'UPDATE `' .$rel['tableName1']. '` SET `' .$rel['fieldName']. '`=0 ' . - 'WHERE `' .$rel['fieldName']. '`=' .$elem['id']; - } - } - // Special 1:n relation for variables - if ($arrFlags[3] == 2) { - $strSQL = 'SELECT * FROM `' .$rel['tableName1']. '` WHERE `idMaster`=' .$elem['id']; - $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($booReturn && ($intDataCount != 0)) { - foreach ($arrData as $vardata) { - $strSQL = 'DELETE FROM `tbl_variabledefinition` ' . - 'WHERE `id`=' .$vardata['idSlave']; - $this->myDBClass->insertData($strSQL); - } - } - $strSQL = 'DELETE FROM `' .$rel['tableName1']. '` WHERE `idMaster`=' .$elem['id']; - } - // Special 1:n relation for time definitions - if ($arrFlags[3] == 3) { - $strSQL = 'DELETE FROM `tbl_timedefinition` WHERE `tipId`=' .$elem['id']; - $this->myDBClass->insertData($strSQL); - } - if ($strSQL != '') { - $this->myDBClass->insertData($strSQL); - } - } - // Delete host configuration file - if (($strTableName == 'tbl_host') && ($this->intDomainId != 0)) { - $strSQL = 'SELECT `host_name` FROM `tbl_host` WHERE `id`=' .$elem['id']; - $strHost = $this->myDBClass->getFieldData($strSQL); - $this->myConfigClass->getConfigSets($arrConfigId); - if ($arrConfigId != 1) { - $intReturn = 0; - foreach ($arrConfigId as $intConfigId) { - $intReturn += $this->myConfigClass->moveFile( - 'host', - $strHost. '.cfg', - $intConfigId - ); - } - if ($intReturn == 0) { - $this->processClassMessage(translate('The assigned, no longer used configuration '. - 'files were deleted successfully!'). '::', $strInfoMessage); - $this->writeLog(translate('Host file deleted:'). ' ' .$strHost. '.cfg'); - } else { - $strErrorMessage .= translate('Errors while deleting the old configuration file - '. - 'please check!:'). ' ::' .$this->myConfigClass->strErrorMessage . '::'; - } - } - } - // Delete service configuration file - if (($strTableName == 'tbl_service') && ($this->intDomainId != 0)) { - $strSQL = 'SELECT `config_name` FROM `tbl_service` WHERE `id`=' .$elem['id']; - $strService = $this->myDBClass->getFieldData($strSQL); - $strSQL = "SELECT * FROM `tbl_service` WHERE `config_name` = '$strService'"; - $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($intDataCount == 1) { - $this->myConfigClass->getConfigSets($arrConfigId); - if ($arrConfigId != 1) { - $intReturn = 0; - foreach ($arrConfigId as $intConfigId) { - $intReturn += $this->myConfigClass->moveFile( - 'service', - $strService. '.cfg', - $intConfigId - ); - } - if ($intReturn == 0) { - $this->processClassMessage(translate('The assigned, no longer used '. - 'configuration files were deleted successfully!'). - '::', $strInfoMessage); - $this->writeLog(translate('Host file deleted:'). ' ' .$strService. '.cfg'); - } else { - $strErrorMessage .= translate('Errors while deleting the old configuration '. - 'file - please check!:'). '::' . - $this->myConfigClass->strErrorMessage. '::'; - } - } - } - } - // Delete main entry - $strSQL = 'DELETE FROM `' .$strTableName. '` WHERE `id`=' .$elem['id']; - $this->myDBClass->insertData($strSQL); - $intDeleteCount++; - } - } - // Process messages - if ($intDeleteCount == 0) { - $this->processClassMessage(translate('No data deleted. Probably the dataset does not exist, it is '. - 'protected from deletion, you do not have write permission or it has relations to other '. - 'configurations which cannot be deleted. Use the "info" function for detailed informations '. - 'about relations!'). '::', $this->strErrorMessage); - return 1; - } - - $this->updateStatusTable($strTableName); - $this->processClassMessage(translate('Dataset successfully deleted. Affected rows:'). ' ' . - $intDeleteCount. '::', $this->strInfoMessage); - $this->writeLog(translate('Deleted data from table:')." $strTableName ". - translate('- with affected rows:'). ' ' .$intDeleteCount); - $this->processClassMessage($strInfoMessage, $this->strInfoMessage); - $this->processClassMessage($strErrorMessage, $this->strErrorMessage); - return 0; - } - $this->processClassMessage(translate('No data deleted. Probably the dataset does not exist, it is '. - 'protected from deletion or you do not have write permission.'). '::' . - $this->myDBClass->strErrorMessage, $this->strErrorMessage); - return 1; - } - - /** - * Returns an array with any data fields from a table with existing relations to another table. This function - * returns also passive relations which are not used in configurations. - * This function is used for a full deletion of a configuration entry or to find out if a configuration is used - * in another way. - * @param string $strTable Table name - * @param array $arrRelations Array with relations - * @return int 0 = no field with relation / 1 = at least one field with relation - * Status message is stored in message class variables - * Data array: tableName Table include the relation data - * fieldName Field name include the relation data - * flags Pos 1 -> 0=Normal field / 1=Required field (field type) - * Pos 2 -> 0=delete / 1=keep data / 2=set to 0 (normal deletion option) - * Pos 3 -> 0=delete / 2=set to 0 (force deletion option) - * Pos 4 -> 0=1:1 / 1=1:n / (relation type) - * 2=1:n (variables) / 3=1:n (timedef) - */ - public function fullTableRelations($strTable, &$arrRelations) - { - // Define variable - $arrRelations = array(); - $arrData = array(); - $intDC = 0; - $intReturn = 0; - // Get relation data - $strSQL = "SELECT * FROM `tbl_relationinformation` WHERE `master`='$strTable' AND `fullRelation`=1"; - $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); - if ($booReturn && ($intDC != 0)) { - foreach ($arrData as $elem) { - $arrRelations[] = array('tableName1' => $elem['tableName1'], 'fieldName' => $elem['fieldName'], - 'target1' => $elem['target1'], 'targetKey' => $elem['targetKey'], - 'flags' => $elem['flags']); - } - $intReturn = 1; - } - return $intReturn; - } - - /** - * Searches any relation in the database and returns them as relation information - * @param string $strTable Database table name - * @param int $intMasterId Data ID from master table - * @param string $strMasterfield Info field name from master table - * @param int $intReporting Output as text - 0=yes, 1=no - * @return int 0 = successful / 1 = error - * Status message is stored in message class variables - */ - public function infoRelation($strTable, $intMasterId, $strMasterfield, $intReporting = 0) - { - $intDeletion = 0; - $arrDSCount = array(); - $arrRelations = array(); - $arrData = array(); - $arrDataCheck = array(); - $intReturn = $this->fullTableRelations($strTable, $arrRelations); - if ($intReturn == 1) { - // Get master field data - $strNewMasterfield = str_replace(',', '`,`', $strMasterfield); - $strSQL = 'SELECT `' .$strNewMasterfield. '` FROM `' .$strTable."` WHERE `id` = $intMasterId"; - $this->myDBClass->hasSingleDataset($strSQL, $arrSource); - if (substr_count($strMasterfield, ',') != 0) { - $arrTarget = explode(',', $strMasterfield); - $strName = $arrSource[$arrTarget[0]]. '-' .$arrSource[$arrTarget[1]]; - } else { - $strName = $arrSource[$strMasterfield]; - } - $this->strInfoMessage .= '' .translate('Relation information for '). - $strName.translate(' of table ').$strTable. ':::'; - $this->strInfoMessage .= ''; - // Walk through relations - foreach ($arrRelations as $elem) { - // Process flags - $arrFlags = explode(',', $elem['flags']); - if ($elem['fieldName'] == 'check_command') { - $strSQL = 'SELECT * FROM `' .$elem['tableName1']. '` ' . - 'WHERE SUBSTRING_INDEX(`' .$elem['fieldName']."`,'!',1)= $intMasterId"; - } else { - $strSQL = 'SELECT * FROM `' .$elem['tableName1']. '` WHERE `' .$elem['fieldName']."`= $intMasterId"; - } - $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - // Take only used relations - if ($booReturn && ($intDataCount != 0)) { - // Relation type - if ($arrFlags[3] == 1) { - foreach ($arrData as $data) { - if ($elem['fieldName'] == 'idMaster') { - $strRef = 'idSlave'; - // Process special tables - if ($elem['target1'] == 'tbl_service') { - if ($elem['tableName1'] == 'tbl_lnkServicegroupToService') { - $strRef = 'idSlaveS'; - } - } elseif ($elem['target1'] == 'tbl_host') { - if ($elem['tableName1'] == 'tbl_lnkServicegroupToService') { - $strRef = 'idSlaveH'; - } - } elseif ($elem['target1'] == 'tbl_hostgroup') { - if ($elem['tableName1'] == 'tbl_lnkServicegroupToService') { - $strRef = 'idSlaveHG'; - } - } - } else { - $strRef = 'idMaster'; - } - // Get data - $strSQL = 'SELECT * FROM `' .$elem['tableName1']. '` ' . - 'LEFT JOIN `' .$elem['target1']. '` ON `' .$strRef. '` = `id` ' . - 'WHERE `' .$elem['fieldName']. '` = ' .$data[$elem['fieldName']]. ' ' . - 'AND `' .$strRef. '`=' .$data[$strRef]; - $this->myDBClass->hasSingleDataset($strSQL, $arrDSTarget); - if (substr_count($elem['targetKey'], ',') != 0) { - $arrTarget = explode(',', $elem['targetKey']); - $strTarget = $arrDSTarget[$arrTarget[0]]. '-' .$arrDSTarget[$arrTarget[1]]; - } else { - $strTarget = $arrDSTarget[$elem['targetKey']]; - } - // If the field is market as "required", check for any other entries - if ($arrFlags[0] == 1) { - $strSQL = 'SELECT * FROM `' .$elem['tableName1']. '` ' . - 'WHERE `' .$strRef. '` = ' .$arrDSTarget[$strRef]; - $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrDSCount, $intDCCount); - if ($booReturn && ($intDCCount > 1)) { - $this->strInfoMessage .= translate('Relation to ').$elem['target1']. - translate(', entry ').$strTarget. - ' - ' .translate('deletion possible'). - '::'; - } else { - $this->strInfoMessage .= translate('Relation to ').$elem['target1']. - translate(', entry ').$strTarget. - ' - ' . - translate('deletion not possible'). '::'; - $intDeletion = 1; - } - } else { - $this->strInfoMessage .= translate('Relation to ').$elem['target1']. - translate(', entry ').$strTarget. ' - ' . - translate('deletion possible'). '::'; - } - } - } elseif ($arrFlags[3] == 0) { - // Fetch remote entry - $strSQL = 'SELECT * FROM `' .$elem['tableName1']. '` ' - . 'WHERE `' .$elem['fieldName']."`=$intMasterId"; - $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrDataCheck, $intDCCheck); - if ($booReturn && ($intDCCheck != 0)) { - foreach ($arrDataCheck as $data) { - if (substr_count($elem['targetKey'], ',') != 0) { - $arrTarget = explode(',', $elem['targetKey']); - $strTarget = $data[$arrTarget[0]]. '-' .$data[$arrTarget[1]]; - } else { - $strTarget = $data[$elem['targetKey']]; - } - if ($arrFlags[0] == 1) { - $this->strInfoMessage .= translate('Relation to ').$elem['tableName1']. - translate(', entry ').$strTarget. - ' - ' . - translate('deletion not possible'). '::'; - $intDeletion = 1; - } else { - $this->strInfoMessage .= translate('Relation to ').$elem['tableName1']. - translate(', entry ').$strTarget. - ' - ' . - translate('deletion possible'). '::'; - } - } - } - } - } - } - $this->strInfoMessage .= '::'; - } - if ($intReporting == 1) { - $this->strInfoMessage = ''; - } - return $intDeletion; - } - - /** - * Inserts any necessary dataset for an 1:n (optional 1:n:n) relation to the database table - * @param string $strTable Database table name - * @param int $intMasterId Data ID from master table - * @param array $arrSlaveId Array with all data IDs from slave table - * @param int $intMulti 0 = for 1:n relations - * 1 = for 1:n:n relations - * @return int 0 = successful / 1 = error - */ - public function dataInsertRelation($strTable, $intMasterId, $arrSlaveId, $intMulti = 0) - { - // Define variables - $intReturn = 0; - $intDataId = 0; - $strSQL = ''; - // Walk through the slave data ID array - foreach ($arrSlaveId as $elem) { - // Pass empty and '*' values - if ($elem == '0') { - continue; - } - if ($elem == '*') { - continue; - } - // Process exclude values - if (0 === strpos($elem, 'e')) { - $elem = str_replace('e', '', $elem); - $intExclude = 1; - } else { - $intExclude = 0; - } - // Define the SQL statement - if ($intMulti != 0) { - $arrValues = explode('::', $elem); - $strSQL = 'INSERT INTO `' .$strTable."` SET `idMaster`=$intMasterId, `idSlaveH`=".$arrValues[0] - . ', `idSlaveHG`=' .$arrValues[1]. ', `idSlaveS`=' .$arrValues[2].", `exclude`=$intExclude"; - } else { - if (($strTable == 'tbl_lnkServicedependencyToService_DS') || - ($strTable == 'tbl_lnkServicedependencyToService_S') || - ($strTable == 'tbl_lnkServiceescalationToService')) { - // Get service description - $strSQLSrv = "SELECT `service_description` FROM `tbl_service` WHERE id=$elem"; - $strService = $this->myDBClass->getFieldData($strSQLSrv); - $strSQL = 'INSERT INTO `' .$strTable."` SET `idMaster`=$intMasterId, `idSlave`=$elem, ". - "`strSlave`='".addslashes($strService)."', `exclude`=$intExclude"; - } elseif (($strTable == 'tbl_lnkServiceToService') || - ($strTable == 'tbl_lnkServicetemplateToService')) { - $arrValues = explode('-', $elem); - if (isset($arrValues[0]) && isset($arrValues[1])) { - $strSQL = 'INSERT INTO `' .$strTable."` SET `idMaster`=$intMasterId, `idSlave`=$arrValues[0], " - ." `idHost`=$arrValues[1]"; - } - } elseif (($strTable != 'tbl_lnkTimeperiodToTimeperiod') && - ($strTable != 'tbl_lnkDatadomainToConfigtarget')) { - $strSQL = 'INSERT INTO `' . $strTable . '` ' . - "SET `idMaster`=$intMasterId, `idSlave`=$elem, `exclude`=$intExclude"; - } else { - $strSQL = 'INSERT INTO `' .$strTable."` SET `idMaster`=$intMasterId, `idSlave`=$elem"; - } - } - // Insert data - $intReturn = $this->dataInsert($strSQL, $intDataId); - if ($intReturn != 0) { - $intReturn = 1; - } - } - return $intReturn; - } - - /** - * Update the datasets for 1:n (optional 1:n:m) relations in the database table - * @param string $strTable Database table name - * @param int $intMasterId Data ID from master table - * @param array $arrSlaveId Array with all data IDs from slave table - * @param int $intMulti 0 = for 1:n relations - * 1 = for 1:n:n relations - * @return int 0 = successful / 1 = error - */ - public function dataUpdateRelation($strTable, $intMasterId, $arrSlaveId, $intMulti = 0) - { - $intReturn = 0; - // Remove any old relations - $intReturn1 = $this->dataDeleteRelation($strTable, $intMasterId); - if ($intReturn1 != 0) { - $intReturn = 1; - } - // Insert the new relations - if ($intReturn == 0) { - $intReturn2 = $this->dataInsertRelation($strTable, $intMasterId, $arrSlaveId, $intMulti); - if ($intReturn2 != 0) { - $intReturn = 1; - } - } - return $intReturn; - } - - /** - * Removes any relation from the database - * @param string $strTable Database table name - * @param int $intMasterId Data ID from master table - * @return int 0 = successful / 1 = error - */ - public function dataDeleteRelation($strTable, $intMasterId) - { - // Define variables - $intDataId = 0; - // Define the SQL statement - $strSQL = 'DELETE FROM `' .$strTable."` WHERE `idMaster`=$intMasterId"; - return $this->dataInsert($strSQL, $intDataId); - } - - /** - * Deactivates one or many datasets in the table be setting 'active' to '0'. Alternatively, a single record - * ID can be specified or evaluated by the values of $_POST['chbId_n'] passed parameters, where n is the - * record ID must match. - * @param string $strTableName Table name - * @param int $intDataId Individual record ID, which is to be activate - * @return int 0 = successful / 1 = error - * Status message is stored in message class variables - */ - public function dataDeactivate($strTableName, $intDataId = 0) - { - // Define variables - $intReturn = 1; - $arrData = array(); - // Get write access groups - $strAccess = $this->myVisClass->getAccessGroups('write'); - // Activate datasets - $strSQL = 'SELECT `id` FROM `' .$strTableName. '` ' . - 'WHERE `config_id`=' .$this->intDomainId." AND `access_group` IN ($strAccess)"; - $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($booReturn && ($intDataCount != 0)) { - $intActivateCount = 0; - foreach ($arrData as $elem) { - $strChbName = 'chbId_' .$elem['id']; - // was the current record is marked for activate? - if ((($intDataId == $elem['id']) || ((filter_input(INPUT_POST, $strChbName) != null) && - (filter_input(INPUT_POST, $strChbName, FILTER_SANITIZE_STRING) == 'on'))) && - $this->infoRelation($strTableName, $elem['id'], 'id', 1) == 0) { - // Update dataset - if (($strTableName == 'tbl_service') || ($strTableName == 'tbl_host')) { - $strSQL = 'UPDATE `' .$strTableName."` SET `active`='0', `last_modified`=now() ". - 'WHERE `id`=' .$elem['id']; - } else { - $strSQL = 'UPDATE `' .$strTableName."` SET `active`='0' WHERE `id`=".$elem['id']; - } - $this->myDBClass->insertData($strSQL); - $intActivateCount++; - } - } - // Process informations - if ($intActivateCount == 0) { - $this->processClassMessage(translate('No dataset deactivated. Maybe the dataset does not exist, it '. - 'is protected from deactivation, no dataset was selected or you do not have write permission. '. - 'Use the "info" function for detailed informations about relations!'). - '::', $this->strErrorMessage); - } else { - $this->updateStatusTable($strTableName); - $this->processClassMessage(translate('Dataset successfully deactivated. Affected rows:'). ' ' . - $intActivateCount. '::', $this->strInfoMessage); - $this->writeLog(translate('Deactivate dataset from table:')." $strTableName ". - translate('- with affected rows:'). ' ' .$this->myDBClass->intAffectedRows); - $intReturn = 0; - } - } else { - $this->processClassMessage(translate('No dataset deactivated. Maybe the dataset does not exist or you '. - 'do not have write permission.'). '::', $this->strErrorMessage); - } - return $intReturn; - } - - /** - * Activates one or many datasets in the table be setting 'active' to '1'. Alternatively, a single record ID can - * be specified or evaluated by the values of $_POST['chbId_n'] passed parameters, where n is the record ID must - * match. - * @param string $strTableName Table name - * @param int $intDataId Individual record ID, which is to be activate - * @return int 0 = successful / 1 = error - * Status message is stored in message class variables - */ - public function dataActivate($strTableName, $intDataId = 0) - { - // Define variables - $intReturn = 1; - $arrData = array(); - // Get write access groups - $strAccess = $this->myVisClass->getAccessGroups('write'); - // Activate datasets - $strSQL = 'SELECT `id` FROM `' .$strTableName. '` ' . - 'WHERE `config_id`=' .$this->intDomainId." AND `access_group` IN ($strAccess)"; - $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($booReturn && ($intDataCount != 0)) { - $intActivateCount = 0; - foreach ($arrData as $elem) { - $strChbName = 'chbId_' .$elem['id']; - // was the current record is marked for activate? - if (($intDataId == $elem['id']) || ((filter_input(INPUT_POST, $strChbName) != null) && - (filter_input(INPUT_POST, $strChbName, FILTER_SANITIZE_STRING) == 'on'))) { - // Update dataset - if (($strTableName == 'tbl_service') || ($strTableName == 'tbl_host')) { - $strSQL = 'UPDATE `' .$strTableName."` SET `active`='1', `last_modified`=now() ". - 'WHERE `id`=' .$elem['id']; - } else { - $strSQL = 'UPDATE `' .$strTableName."` SET `active`='1' WHERE `id`=".$elem['id']; - } - $this->myDBClass->insertData($strSQL); - $intActivateCount++; - } - } - // Process informations - if ($intActivateCount == 0) { - $this->processClassMessage(translate('No dataset activated. Maybe the dataset does not exist, no '. - 'dataset was selected or you do not have write permission.'). '::', $this->strErrorMessage); - } else { - $this->updateStatusTable($strTableName); - $this->processClassMessage(translate('Dataset successfully activated. Affected rows:'). ' ' . - $intActivateCount. '::', $this->strInfoMessage); - $this->writeLog(translate('Activate dataset from table:')." $strTableName ". - translate('- with affected rows:'). ' ' .$this->myDBClass->intAffectedRows); - $intReturn = 0; - } - } else { - $this->processClassMessage(translate('No dataset activated. Maybe the dataset does not exist or you do '. - 'not have write permission.'). '::', $this->strErrorMessage); - } - return $intReturn; - } - - /** - * Updates the hash field im some configuration objects - * @param string $strTable Table name - * @param int $intId Data ID - * @return int 0 = successful / 1 = error - * Status message is stored in message class variables - */ - public function updateHash($strTable, $intId) - { - // Define variables - $strRawString = ''; - $arrData = array(); - $intDC = 0; - $intDataID = 0; - // Service table - if ($strTable == 'tbl_service') { - // Get any hosts and host_groups - $strSQL = 'SELECT `host_name` AS `item_name` FROM `tbl_host` ' . - "LEFT JOIN `tbl_lnkServiceToHost` ON `idSlave`=`id` WHERE `idMaster`=$intId ". - 'UNION SELECT `hostgroup_name` AS `item_name` FROM `tbl_hostgroup` ' . - 'LEFT JOIN `tbl_lnkServiceToHostgroup` ON `idSlave`=`id` ' . - 'WHERE `idMaster`=' .$intId. ' ORDER BY `item_name`'; - $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); - if ($booRet && ($intDC != 0)) { - foreach ($arrData as $elem) { - $strRawString .= $elem['item_name']. ','; - } - } - $strSQL = 'SELECT * FROM `tbl_service` WHERE `id`=' .$intId; - $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); - if ($booRet && ($intDC != 0)) { - if ($arrData[0]['service_description'] != '') { - $strRawString .= $arrData[0]['service_description']. ','; - } - if ($arrData[0]['display_name'] != '') { - $strRawString .= $arrData[0]['display_name']. ','; - } - if ($arrData[0]['check_command'] != '') { - $arrField = explode('!', $arrData[0]['check_command']); - $strCommand = strstr($arrData[0]['check_command'], '!'); - $strSQLRel = 'SELECT `command_name` FROM `tbl_command` WHERE `id`=' .$arrField[0]; - $strName = $this->myDBClass->getFieldData($strSQLRel); - $strRawString .= $strName.$strCommand. ','; - } - } - } - if (($strTable == 'tbl_hostdependency') || ($strTable == 'tbl_servicedependency')) { - // Get * values - $strSQL = 'SELECT * FROM `' .$strTable. '` WHERE `id`=' .$intId; - $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); - if ($booRet && ($intDC != 0)) { - if (isset($arrData[0]['dependent_host_name']) && ($arrData[0]['dependent_host_name'] == 2)) { - $strRawString .= 'any,'; - } - if (isset($arrData[0]['dependent_hostgroup_name']) && ($arrData[0]['dependent_hostgroup_name'] == 2)) { - $strRawString .= 'any,'; - } - if (isset($arrData[0]['host_name']) && ($arrData[0]['host_name'] == 2)) { - $strRawString .= 'any,'; - } - if (isset($arrData[0]['hostgroup_name']) && ($arrData[0]['hostgroup_name'] == 2)) { - $strRawString .= 'any,'; - } - if (isset($arrData[0]['dependent_service_description']) && - ($arrData[0]['dependent_service_description'] == 2)) { - $strRawString .= 'any,'; - } - if (isset($arrData[0]['service_description']) && ($arrData[0]['service_description'] == 2)) { - $strRawString .= 'any,'; - } - } - if ($strTable == 'tbl_hostdependency') { - // Get any hosts and host_groups - $strSQL = 'SELECT `host_name` AS `item_name`, exclude FROM `tbl_host` ' . - "LEFT JOIN `tbl_lnkHostdependencyToHost_DH` ON `idSlave`=`id` WHERE `idMaster`=$intId ". - 'UNION ALL SELECT `hostgroup_name` AS `item_name`, exclude FROM `tbl_hostgroup` ' . - "LEFT JOIN `tbl_lnkHostdependencyToHostgroup_DH` ON `idSlave`=`id` WHERE `idMaster`=$intId ". - 'UNION ALL SELECT `host_name` AS `item_name`, exclude FROM `tbl_host` ' . - "LEFT JOIN `tbl_lnkHostdependencyToHost_H` ON `idSlave`=`id` WHERE `idMaster`=$intId ". - 'UNION ALL SELECT `hostgroup_name` AS `item_name`, exclude FROM `tbl_hostgroup` ' . - 'LEFT JOIN `tbl_lnkHostdependencyToHostgroup_H` ON `idSlave`=`id` WHERE `idMaster`=' .$intId; - } - if ($strTable == 'tbl_servicedependency') { - // Get any hosts and host_groups - $strSQL = 'SELECT `host_name` AS `item_name`, exclude FROM `tbl_host` ' . - "LEFT JOIN `tbl_lnkServicedependencyToHost_DH` ON `idSlave`=`id` WHERE `idMaster`=$intId ". - 'UNION ALL SELECT `hostgroup_name` AS `item_name`, exclude FROM `tbl_hostgroup` ' . - 'LEFT JOIN `tbl_lnkServicedependencyToHostgroup_DH` ON `idSlave`=`id` ' . - "WHERE `idMaster`=$intId ". - 'UNION ALL SELECT `host_name` AS `item_name`, exclude FROM `tbl_host` ' . - "LEFT JOIN `tbl_lnkServicedependencyToHost_H` ON `idSlave`=`id` WHERE `idMaster`=$intId ". - 'UNION ALL SELECT `hostgroup_name` AS `item_name`, exclude FROM `tbl_hostgroup` ' . - 'LEFT JOIN `tbl_lnkServicedependencyToHostgroup_H` ON `idSlave`=`id` ' . - "WHERE `idMaster`=$intId ". - 'UNION ALL SELECT `strSlave` AS `item_name`, exclude ' . - "FROM `tbl_lnkServicedependencyToService_DS` WHERE `idMaster`=$intId ". - 'UNION ALL SELECT `strSlave` AS `item_name`, exclude ' . - "FROM `tbl_lnkServicedependencyToService_S` WHERE `idMaster`=$intId"; - } - $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); - if ($booRet && ($intDC != 0)) { - foreach ($arrData as $elem) { - if ($elem['exclude'] == 0) { - $strRawString .= $elem['item_name']. ','; - } else { - $strRawString .= 'not_' .$elem['item_name']. ','; - } - } - $strRawString = substr($strRawString, 0, -1); - } - } - if (($strTable == 'tbl_hostescalation') || ($strTable == 'tbl_serviceescalation')) { - // Get * values - $strSQL = 'SELECT * FROM `' .$strTable. '` WHERE `id`=' .$intId; - $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); - if ($booRet && ($intDC != 0)) { - if (isset($arrData[0]['host_name']) && ($arrData[0]['host_name'] == 2)) { - $strRawString .= 'any,'; - } - if (isset($arrData[0]['hostgroup_name']) && ($arrData[0]['hostgroup_name'] == 2)) { - $strRawString .= 'any,'; - } - if (isset($arrData[0]['contacts']) && ($arrData[0]['contacts'] == 2)) { - $strRawString .= 'any,'; - } - if (isset($arrData[0]['contact_groups']) && ($arrData[0]['contact_groups'] == 2)) { - $strRawString .= 'any,'; - } - if (isset($arrData[0]['service_description']) && ($arrData[0]['service_description'] == 2)) { - $strRawString .= 'any,'; - } - } - // Get any hosts, host_groups, contacts and contact_groups - if ($strTable == 'tbl_hostescalation') { - $strSQL = 'SELECT `host_name` AS `item_name`, exclude FROM `tbl_host` ' . - "LEFT JOIN `tbl_lnkHostescalationToHost` ON `idSlave`=`id` WHERE `idMaster`=$intId ". - 'UNION ALL SELECT `hostgroup_name` AS `item_name`, exclude FROM `tbl_hostgroup` ' . - "LEFT JOIN `tbl_lnkHostescalationToHostgroup` ON `idSlave`=`id` WHERE `idMaster`=$intId ". - 'UNION ALL SELECT `contact_name` AS `item_name`, exclude FROM `tbl_contact` ' . - "LEFT JOIN `tbl_lnkHostescalationToContact` ON `idSlave`=`id` WHERE `idMaster`=$intId ". - 'UNION ALL SELECT `contactgroup_name` AS `item_name`, exclude FROM `tbl_contactgroup` ' . - "LEFT JOIN `tbl_lnkHostescalationToContactgroup` ON `idSlave`=`id` WHERE `idMaster`=$intId"; - } - if ($strTable == 'tbl_serviceescalation') { - $strSQL = 'SELECT `host_name` AS `item_name`, exclude FROM `tbl_host` ' . - "LEFT JOIN `tbl_lnkServiceescalationToHost` ON `idSlave`=`id` WHERE `idMaster`=$intId ". - 'UNION ALL SELECT `hostgroup_name` AS `item_name`, exclude FROM `tbl_hostgroup` ' . - "LEFT JOIN `tbl_lnkServiceescalationToHostgroup` ON `idSlave`=`id` WHERE `idMaster`=$intId ". - 'UNION ALL SELECT `contact_name` AS `item_name`, exclude FROM `tbl_contact` ' . - "LEFT JOIN `tbl_lnkServiceescalationToContact` ON `idSlave`=`id` WHERE `idMaster`=$intId ". - 'UNION ALL SELECT `contactgroup_name` AS `item_name`, exclude FROM `tbl_contactgroup` ' . - 'LEFT JOIN `tbl_lnkServiceescalationToContactgroup` ON `idSlave`=`id` ' . - "WHERE `idMaster`=$intId ". - 'UNION ALL SELECT `strSlave` AS `item_name`, exclude ' . - "FROM `tbl_lnkServiceescalationToService` WHERE `idMaster`=$intId"; - } - $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); - if ($booRet && ($intDC != 0)) { - foreach ($arrData as $elem) { - if ($elem['exclude'] == 0) { - $strRawString .= $elem['item_name']. ','; - } else { - $strRawString .= 'not_' .$elem['item_name']. ','; - } - } - $strRawString = substr($strRawString, 0, -1); - } - } - if ($strTable == 'tbl_serviceextinfo') { - // Get any hosts and host_groups - $strSQL = 'SELECT `tbl_host`.`host_name` AS `item_name` FROM `tbl_host` ' . - 'LEFT JOIN `tbl_serviceextinfo` ON `tbl_host`.`id`=`tbl_serviceextinfo`.`host_name` ' . - "WHERE `tbl_serviceextinfo`.`id`=$intId ". - 'UNION SELECT `tbl_service`.`service_description` AS `item_name` FROM `tbl_service` ' . - 'LEFT JOIN `tbl_serviceextinfo` ON ' . - '`tbl_service`.`id`=`tbl_serviceextinfo`.`service_description` ' . - "WHERE `tbl_serviceextinfo`.`id`=$intId ORDER BY `item_name`"; - $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); - if ($booRet && ($intDC != 0)) { - foreach ($arrData as $elem) { - $strRawString .= $elem['item_name']. ','; - } - $strRawString = substr($strRawString, 0, -1); - } - } - // Remove blanks - while (substr_count($strRawString, ' ') != 0) { - $strRawString = str_replace(' ', '', $strRawString); - } - // Sort hash string - $arrTemp = explode(',', $strRawString); - sort($arrTemp); - $strRawString = implode(',', $arrTemp); - // Update has in database - $strSQL = 'UPDATE `' .$strTable."` SET `import_hash`='".sha1($strRawString)."' WHERE `id`='$intId'"; - //echo "Hash: ".$strRawString." --> ".sha1($strRawString)."
"; - return $this->dataInsert($strSQL, $intDataID); - } - - /** - * PRIVATE functions - */ - - /** - * Manually set some NULL values based on field names (key) - * @param string $strTableName Table name - * @param string $key Data key (field name) - * @param string $value Data value (field key) - * @return NULL|string Manipulated data value - */ - private function setNullValues($strTableName, $key, $value) - { - $arrNull = array('normal_check_interval', 'retry_check_interval', 'max_check_attempts', 'low_flap_threshold', - 'high_flap_threshold', 'freshness_threshold', 'notification_interval', 'first_notification_delay', - 'check_interval', 'retry_interval'); - if (\in_array($key, $arrNull, true) && ($value == '')) { - $value = 'NULL'; - } - // manually set some NULL values based on table name - if (($strTableName == 'tbl_serviceextinfo') && ($key == 'service_description')) { - $value = '0'; - } - // Do not copy the password in tbl_user - if (($strTableName == 'tbl_user') && ($key == 'password')) { - $value = 'xxxxxxx'; - } - // Do not copy nodelete and webserver authentification values in tbl_user - if ($key == 'nodelete') { - $value = '0'; - } - if ($key == 'wsauth') { - $value = '0'; - } - return $value; - } - /** * Insert a normal 1:n relation - * @param array $arrData Database value array - * @param integer $intID Database array key - * @param array $elem Link table information - * @param integer $intMasterId Data ID of master table - * @param integer $intCheck Check error counter (before processing) - * @return integer Check error counter (after processing) + * @param array $arrData Database value array + * @param integer $intID Database array key + * @param array $elem Link table information + * @param integer $intMasterId Data ID of master table + * @param integer $intCheck Check error counter (before processing) + * @return integer Check error counter (after processing) */ - private function insertRelationType2($arrData, $intID, $elem, $intMasterId, $intCheck) + private function insertRelationType2(array $arrData, int $intID, array $elem, int $intMasterId, int $intCheck): int { - $arrRelData = array(); + $arrRelData = array(); $intRelDataCount = 0; - if ($arrData[$intID][$elem['fieldName']] != 0) { - $strSQL = 'SELECT `idSlave`, `exclude` FROM `' .$elem['linkTable']. '` ' . - 'WHERE `idMaster`=' .$arrData[$intID]['id']; + if ((int)$arrData[$intID][$elem['fieldName']] !== 0) { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `idSlave`, `exclude` FROM `' . $elem['linkTable'] . '` ' . + 'WHERE `idMaster`=' . $arrData[$intID]['id']; $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrRelData, $intRelDataCount); - if ($booReturn && ($intRelDataCount != 0)) { + if ($booReturn && ($intRelDataCount !== 0)) { foreach ($arrRelData as $elem2) { + /** @noinspection SqlResolve */ $strSQLRel = 'INSERT INTO `' . $elem['linkTable'] . '` ' . "SET `idMaster`=$intMasterId, `idSlave`=" . $elem2['idSlave'] . ', ' . '`exclude`=' . $elem2['exclude']; $booReturn = $this->myDBClass->insertData($strSQLRel); - if ($booReturn == false) { + if ($booReturn === false) { $intCheck++; } } @@ -1297,28 +414,30 @@ class NagDataClass /** * Insert a 1:n relation for templates - * @param array $arrData Database value array - * @param integer $intID Database array key - * @param array $elem Link table information - * @param integer $intMasterId Data ID of master table - * @param integer $intCheck Check error counter (before processing) - * @return integer Check error counter (after processing) + * @param array $arrData Database value array + * @param integer $intID Database array key + * @param array $elem Link table information + * @param integer $intMasterId Data ID of master table + * @param integer $intCheck Check error counter (before processing) + * @return integer Check error counter (after processing) */ - private function insertRelationType3($arrData, $intID, $elem, $intMasterId, $intCheck) + private function insertRelationType3(array $arrData, int $intID, array $elem, int $intMasterId, int $intCheck): int { - $arrRelData = array(); + $arrRelData = array(); $intRelDataCount = 0; - if ($arrData[$intID][$elem['fieldName']] == 1) { + if ((int)$arrData[$intID][$elem['fieldName']] === 1) { + /** @noinspection SqlResolve */ $strSQL = 'SELECT `idSlave`,`idSort`,`idTable` FROM `' . $elem['linkTable'] . '` ' . 'WHERE `idMaster`=' . $arrData[$intID]['id']; $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrRelData, $intRelDataCount); - if ($booReturn && ($intRelDataCount != 0)) { + if ($booReturn && ($intRelDataCount !== 0)) { foreach ($arrRelData as $elem2) { + /** @noinspection SqlResolve */ $strSQLRel = 'INSERT INTO `' . $elem['linkTable'] . '` ' . "SET `idMaster`=$intMasterId, `idSlave`=" . $elem2['idSlave'] . ', ' . '`idTable`=' . $elem2['idTable'] . ', `idSort`=' . $elem2['idSort']; $booReturn = $this->myDBClass->insertData($strSQLRel); - if ($booReturn == false) { + if ($booReturn === false) { $intCheck++; } } @@ -1329,42 +448,44 @@ class NagDataClass /** * Insert a special relation for free variables - * @param array $arrData Database value array - * @param integer $intID Database array key - * @param array $elem Link table information - * @param integer $intMasterId Data ID of master table - * @param integer $intCheck Check error counter (before processing) - * @return integer Check error counter (after processing) + * @param array $arrData Database value array + * @param integer $intID Database array key + * @param array $elem Link table information + * @param integer $intMasterId Data ID of master table + * @param integer $intCheck Check error counter (before processing) + * @return integer Check error counter (after processing) */ - private function insertRelationType4($arrData, $intID, $elem, $intMasterId, $intCheck) + private function insertRelationType4(array $arrData, int $intID, array $elem, int $intMasterId, int $intCheck): int { - $arrRelData = array(); - $arrDataVar = array(); + $arrRelData = array(); + $arrDataVar = array(); $intRelDataCount = 0; - $intDCVar = 0; - if ($arrData[$intID][$elem['fieldName']] != 0) { + $intDCVar = 0; + if ((int)$arrData[$intID][$elem['fieldName']] !== 0) { + /** @noinspection SqlResolve */ $strSQL = 'SELECT `idSlave` FROM `' . $elem['linkTable'] . '` ' . 'WHERE `idMaster` = ' . $arrData[$intID]['id']; $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrRelData, $intRelDataCount); - if ($booReturn && ($intRelDataCount != 0)) { + if ($booReturn && ($intRelDataCount !== 0)) { foreach ($arrRelData as $elem2) { - // Copy variables and link them to the new master + /* Copy variables and link them to the new master */ $strSQLVar = 'SELECT * FROM `tbl_variabledefinition` WHERE `id`=' . $elem2['idSlave']; $booReturn = $this->myDBClass->hasDataArray($strSQLVar, $arrDataVar, $intDCVar); - if ($booReturn && ($intDCVar != 0)) { + if ($booReturn && ($intDCVar !== 0)) { $strSQLInsVar = 'INSERT INTO `tbl_variabledefinition` ' . "SET `name`='" . addslashes($arrDataVar[0]['name']) . "', " . "`value`='" . addslashes($arrDataVar[0]['value']) . "', " . '`last_modified`=NOW()'; $booReturn = $this->myDBClass->insertData($strSQLInsVar); - if ($booReturn == false) { + if ($booReturn === false) { $intCheck++; } + /** @noinspection SqlResolve */ $strSQLRel = 'INSERT INTO `' . $elem['linkTable'] . '` ' . "SET `idMaster`=$intMasterId, " . '`idSlave`=' . $this->myDBClass->intLastId; $booReturn = $this->myDBClass->insertData($strSQLRel); - if ($booReturn == false) { + if ($booReturn === false) { $intCheck++; } } @@ -1376,28 +497,30 @@ class NagDataClass /** * Insert a 1:n relation for tbl_lnkServicegroupToService - * @param array $arrData Database value array - * @param integer $intID Database array key - * @param array $elem Link table information - * @param integer $intMasterId Data ID of master table - * @param integer $intCheck Check error counter (before processing) - * @return integer Check error counter (after processing) + * @param array $arrData Database value array + * @param integer $intID Database array key + * @param array $elem Link table information + * @param integer $intMasterId Data ID of master table + * @param integer $intCheck Check error counter (before processing) + * @return integer Check error counter (after processing) */ - private function insertRelationType5($arrData, $intID, $elem, $intMasterId, $intCheck) + private function insertRelationType5(array $arrData, int $intID, array $elem, int $intMasterId, int $intCheck): int { - $arrRelData = array(); + $arrRelData = array(); $intRelDataCount = 0; - if ($arrData[$intID][$elem['fieldName']] != 0) { - $strSQL = 'SELECT `idSlaveH`,`idSlaveHG`,`idSlaveS` ' . + if ((int)$arrData[$intID][$elem['fieldName']] !== 0) { + $strSQL = 'SELECT `idSlaveH`,`idSlaveHG`,`idSlaveS`,`exclude` ' . 'FROM `' . $elem['linkTable'] . '` WHERE `idMaster`=' . $arrData[$intID]['id']; $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrRelData, $intRelDataCount); - if ($booReturn && ($intRelDataCount != 0)) { + if ($booReturn && ($intRelDataCount !== 0)) { foreach ($arrRelData as $elem2) { + /** @noinspection SqlResolve */ $strSQLRel = 'INSERT INTO `' . $elem['linkTable'] . '` ' . "SET `idMaster`=$intMasterId, `idSlaveH`=" . $elem2['idSlaveH'] . ', ' . - '`idSlaveHG`=' . $elem2['idSlaveHG'] . ', `idSlaveS`=' . $elem2['idSlaveS']; + '`idSlaveHG`=' . $elem2['idSlaveHG'] . ', `idSlaveS`=' . $elem2['idSlaveS'] . ', `exclude`=' . + $elem2['exclude']; $booReturn = $this->myDBClass->insertData($strSQLRel); - if ($booReturn == false) { + if ($booReturn === false) { $intCheck++; } } @@ -1408,29 +531,30 @@ class NagDataClass /** * Insert a 1:n relation for services - * @param array $arrData Database value array - * @param integer $intID Database array key - * @param array $elem Link table information - * @param integer $intMasterId Data ID of master table - * @param integer $intCheck Check error counter (before processing) - * @return integer Check error counter (after processing) + * @param array $arrData Database value array + * @param integer $intID Database array key + * @param array $elem Link table information + * @param integer $intMasterId Data ID of master table + * @param integer $intCheck Check error counter (before processing) + * @return integer Check error counter (after processing) */ - private function insertRelationType6($arrData, $intID, $elem, $intMasterId, $intCheck) + private function insertRelationType6(array $arrData, int $intID, array $elem, int $intMasterId, int $intCheck): int { - $arrRelData = array(); + $arrRelData = array(); $intRelDataCount = 0; - if ($arrData[$intID][$elem['fieldName']] != 0) { + if ((int)$arrData[$intID][$elem['fieldName']] !== 0) { $strSQL = 'SELECT `idSlave`, `strSlave`, `exclude` ' . 'FROM `' . $elem['linkTable'] . '` WHERE `idMaster`=' . $arrData[$intID]['id']; $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrRelData, $intRelDataCount); - if ($booReturn && ($intRelDataCount != 0)) { + if ($booReturn && ($intRelDataCount !== 0)) { foreach ($arrRelData as $elem2) { + /** @noinspection SqlResolve */ $strSQLRel = 'INSERT INTO `' . $elem['linkTable'] . '` ' . "SET `idMaster`=$intMasterId, `idSlave`=" . $elem2['idSlave'] . ', ' . "`strSlave`='" . addslashes($elem2['strSlave']) . "', " . '`exclude`=' . $elem2['exclude']; $booReturn = $this->myDBClass->insertData($strSQLRel); - if ($booReturn == false) { + if ($booReturn === false) { $intCheck++; } } @@ -1441,25 +565,25 @@ class NagDataClass /** * Insert a 1:n relation for time definitions - * @param array $arrData Database value array - * @param integer $intID Database array key - * @param integer $intMasterId Data ID of master table - * @param integer $intCheck Check error counter (before processing) - * @return integer Check error counter (after processing) + * @param array $arrData Database value array + * @param integer $intID Database array key + * @param integer $intMasterId Data ID of master table + * @param integer $intCheck Check error counter (before processing) + * @return integer Check error counter (after processing) */ - private function insertRelationTimedefinition($arrData, $intID, $intMasterId, $intCheck) + private function insertRelationTimedefinition(array $arrData, int $intID, int $intMasterId, int $intCheck): int { $arrRelDataTP = array(); $intRelDataCountTP = 0; $strSQL = 'SELECT * FROM `tbl_timedefinition` WHERE `tipId`=' . $arrData[$intID]['id']; $this->myDBClass->hasDataArray($strSQL, $arrRelDataTP, $intRelDataCountTP); - if ($intRelDataCountTP != 0) { + if ($intRelDataCountTP !== 0) { foreach ($arrRelDataTP as $elem) { $strSQLRel = 'INSERT INTO `tbl_timedefinition` (`tipId`,`definition`,`range`,' . "`last_modified`) VALUES ($intMasterId,'" . addslashes($elem['definition']) . "'," . "'" . addslashes($elem['range']) . "',now())"; $booReturn = $this->myDBClass->insertData($strSQLRel); - if ($booReturn == false) { + if ($booReturn === false) { $intCheck++; } } @@ -1469,25 +593,25 @@ class NagDataClass /** * Insert a 1:n relation for user groups - * @param array $arrData Database value array - * @param integer $intID Database array key - * @param integer $intMasterId Data ID of master table - * @param integer $intCheck Check error counter (before processing) - * @return integer Check error counter (after processing) + * @param array $arrData Database value array + * @param integer $intID Database array key + * @param integer $intMasterId Data ID of master table + * @param integer $intCheck Check error counter (before processing) + * @return integer Check error counter (after processing) */ - private function insertRelationGroup($arrData, $intID, $intMasterId, $intCheck) + private function insertRelationGroup(array $arrData, int $intID, int $intMasterId, int $intCheck): int { $arrRelDataTP = array(); $intRelDataCountTP = 0; $strSQL = 'SELECT * FROM `tbl_lnkGroupToUser` WHERE `idMaster`=' . $arrData[$intID]['id']; $this->myDBClass->hasDataArray($strSQL, $arrRelDataTP, $intRelDataCountTP); - if ($intRelDataCountTP != 0) { + if ($intRelDataCountTP !== 0) { foreach ($arrRelDataTP as $elem2) { $strSQLRel = 'INSERT INTO `tbl_lnkGroupToUser` (`idMaster`,`idSlave`,`read`,`write`,`link`) ' . - "VALUES ($intMasterId,'" . $elem2['idSlave'] . "','" . $elem2['read'] . "',". + "VALUES ($intMasterId,'" . $elem2['idSlave'] . "','" . $elem2['read'] . "'," . "'" . $elem2['write'] . "','" . $elem2['link'] . "')"; $booReturn = $this->myDBClass->insertData($strSQLRel); - if ($booReturn == false) { + if ($booReturn === false) { $intCheck++; } } @@ -1497,24 +621,24 @@ class NagDataClass /** * Insert a 1:n relation fot service to host connections - * @param array $arrData Database value array - * @param integer $intID Database array key - * @param integer $intMasterId Data ID of master table - * @param integer $intCheck Check error counter (before processing) - * @return integer Check error counter (after processing) + * @param array $arrData Database value array + * @param integer $intID Database array key + * @param integer $intMasterId Data ID of master table + * @param integer $intCheck Check error counter (before processing) + * @return integer Check error counter (after processing) */ - private function insertRelationHost($arrData, $intID, $intMasterId, $intCheck) + private function insertRelationHost(array $arrData, int $intID, int $intMasterId, int $intCheck): int { $arrRelDataSH = array(); $intRelDataCountSH = 0; $strSQL = 'SELECT * FROM `tbl_lnkServiceToHost` WHERE `idSlave`=' . $arrData[$intID]['id']; $this->myDBClass->hasDataArray($strSQL, $arrRelDataSH, $intRelDataCountSH); - if ($intRelDataCountSH != 0) { + if ($intRelDataCountSH !== 0) { foreach ($arrRelDataSH as $elem2) { $strSQLRel = 'INSERT INTO `tbl_lnkServiceToHost` (`idMaster`,`idSlave`,`exclude`) ' . "VALUES ('" . $elem2['idMaster'] . "',$intMasterId,'" . $elem2['exclude'] . "')"; $booReturn = $this->myDBClass->insertData($strSQLRel); - if ($booReturn == false) { + if ($booReturn === false) { $intCheck++; } } @@ -1523,78 +647,1000 @@ class NagDataClass } /** - * Build an INSERT command based on the table name - * @param string $strTableName Table name - * @param string $strKeyField Configuration field name - * @param int $intDomainId Domain ID - * @param string $strNewName New configuration name - * @param array $arrData Data array - * @param int $intID Data array key - * @return string SQL INSERT command + * Saving a given string to the logbook + * @param string $strLogMessage Message string + * @return int 0 = successful / 1 = error */ - private function buildInsertSQL($strTableName, $strKeyField, $intDomainId, $strNewName, $arrData, $intID) + public function writeLog(string $strLogMessage): int { - $strSQLInsert = 'INSERT INTO `' . $strTableName . '` SET `' . $strKeyField . "`='" . $strNewName . "'"; - /** @noinspection ForeachSourceInspection */ - foreach ($arrData[$intID] as $key => $value) { - if (($key != $strKeyField) && ($key != 'active') && ($key != 'last_modified') && - ($key != 'id') && ($key != 'config_id')) { - // manually set some NULL values based on field names - $value = $this->setNullValues($strTableName, $key, $value); - // If the data value is not "NULL", add single quotes to the value - if ($value != 'NULL') { - $strSQLInsert .= ',`' . $key . "`='" . addslashes($value) . "'"; - } else { - $strSQLInsert .= ',`' . $key . '`=' . $value; - } + /* Variable definition */ + $strRemoteAdress = filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP); + $intReturn = 0; + /* Write log message to database */ + if ($strRemoteAdress !== null) { + /* Webinterface */ + $strUserName = $this->strUserName; + $strDomain = $this->myDBClass->getFieldData('SELECT `domain` FROM `tbl_datadomain` ' . + 'WHERE `id`=' . $this->intDomainId); + $booReturn = $this->myDBClass->insertData("INSERT INTO `tbl_logbook` SET `user`='" . $strUserName . "'," . + "`time`=NOW(), `ipadress`='" . $strRemoteAdress . "', `domain`='$strDomain'," . + "`entry`='" . addslashes($strLogMessage) . "'"); + } else { + /* Scriptinginterface */ + $strUserName = 'scripting'; + $strRemoteUser = filter_input(INPUT_SERVER, 'REMOTE_USER', FILTER_UNSAFE_RAW); + $strHostname = filter_input(INPUT_SERVER, 'REMOTE_HOST', FILTER_UNSAFE_RAW); + $strSSHClient = filter_input(INPUT_SERVER, 'SSH_CLIENT', FILTER_UNSAFE_RAW); + if ($strRemoteUser !== null) { + $strUserName .= ' - ' . $strRemoteUser; + } + $strDomain = $this->myDBClass->getFieldData('SELECT `domain` FROM `tbl_datadomain` ' . + 'WHERE `id`=' . $this->intDomainId); + if ($strHostname !== null) { + $booReturn = $this->myDBClass->insertData("INSERT INTO `tbl_logbook` SET `user`='" . $strUserName . "'," . + "`time`=NOW(), `ipadress`='" . $strHostname . "', `domain`='$strDomain', " . + "`entry`='" . addslashes($strLogMessage) . "'"); + } elseif ($strSSHClient !== null) { + $arrSSHClient = explode(' ', $strSSHClient); + $booReturn = $this->myDBClass->insertData("INSERT INTO `tbl_logbook` SET `user`='" . $strUserName . "'," . + "`time`=NOW(), `ipadress`='" . $arrSSHClient[0] . "', `domain`='$strDomain', " . + "`entry`='" . addslashes($strLogMessage) . "'"); + } else { + $booReturn = $this->myDBClass->insertData("INSERT INTO `tbl_logbook` SET `user`='" . $strUserName . "'," . + "`time`=NOW(), `ipadress`='unknown', `domain`='$strDomain', " . + "`entry`='" . addslashes($strLogMessage) . "'"); } } - if (($strTableName == 'tbl_user') || ($strTableName == 'tbl_group') || - ($strTableName == 'tbl_datadomain') || ($strTableName == 'tbl_configtarget')) { - $strSQLInsert .= ",`active`='0', `last_modified`=NOW()"; - } else { - $strSQLInsert .= ",`active`='0', `config_id`=$intDomainId, `last_modified`=NOW()"; + if ($booReturn === false) { + $intReturn = 1; } - return $strSQLInsert; + return $intReturn; } /** - * Build a temporary configuration name - * @param string $strTableName Table name - * @param string $strKeyField Configuration field name - * @param int $intDomainId Domain ID - * @param int $intCount Dataset counter - * @param array $arrData Data array - * @param int $intID Data array key - * @return string Temporary configuration name + * Update the date inside the status table (used for last modified date) + * @param string $strTable Table name + * @return int 0 = successful / 1 = error */ - private function buildTempConfigName($strTableName, $strKeyField, $intDomainId, $intCount, $arrData, $intID) + public function updateStatusTable(string $strTable): int { - // Define variables - $strNewName = ''; - for ($y = 1; $y <= $intCount; $y++) { - $strNewName = $arrData[$intID][$strKeyField] . " ($y)"; - if (($strTableName == 'tbl_user') || ($strTableName == 'tbl_group') || - ($strTableName == 'tbl_datadomain') || ($strTableName == 'tbl_configtarget')) { - $strSQL = 'SELECT `id` FROM `' . $strTableName . '` WHERE `' . $strKeyField . "`='$strNewName'"; - $booReturn = $this->myDBClass->getFieldData($strSQL); - } else { - $strSQL = 'SELECT `id` FROM `' . $strTableName . '` ' . - 'WHERE `' . $strKeyField . "`='$strNewName' AND `config_id`=$intDomainId"; - $booReturn = $this->myDBClass->getFieldData($strSQL); + /* Define variable */ + $arrData = array(); + $intDC = 0; + $intReturn = 1; + /* Does the entry exist? */ + $strSQL = "SELECT * FROM `tbl_tablestatus` WHERE `tableName`='$strTable' AND `domainId`=" . $this->intDomainId; + $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); + if ($booReturn && ($intDC !== 0)) { + $strSQL = 'UPDATE `tbl_tablestatus` SET `updateTime`=NOW() ' . + "WHERE `tableName`='$strTable' AND `domainId`=" . $this->intDomainId; + $booReturn = $this->dataInsert($strSQL, $intDataID); + if ($booReturn) { + $intReturn = 0; } - // If the name is unused -> break the loop - if ($booReturn == false) { - break; + } elseif ($booReturn) { + $strSQL = 'INSERT INTO `tbl_tablestatus` ' . + "SET `updateTime`=NOW(), `tableName`='$strTable', `domainId`=" . $this->intDomainId; + $booReturn = $this->dataInsert($strSQL, $intDataID); + if ($booReturn) { + $intReturn = 0; } } - // Manually overwrite new name for extinfo tables - if ($strTableName == 'tbl_hostextinfo') { - $strNewName = '0'; - } - if ($strTableName == 'tbl_serviceextinfo') { - $strNewName = '0'; - } - return $strNewName; + return $intReturn; } -} + + /** + * PRIVATE functions + */ + + /** + * Sends an SQL string to the database server + * @param string $strSQL SQL Command + * @param int|null $intDataID Data ID of last inserted dataset (by reference) + * @return int 0 = successful / 1 = error + * Status message is stored in message class variables + */ + public function dataInsert(string $strSQL, int &$intDataID = null): int + { + /* Define variables */ + $intReturn = 0; + /* Send the SQL command to the database server */ + $booReturn = $this->myDBClass->insertData($strSQL); + $intDataID = $this->myDBClass->intLastId; + /* Was the SQL command processed successfully? */ + if ($booReturn) { + $this->processClassMessage(translate('Data were successfully inserted to the data base!') . + '::', $this->strInfoMessage); + } else { + $this->processClassMessage(translate('Error while inserting the data into the database:') . + '::' . $this->myDBClass->strErrorMessage . '::', $this->strErrorMessage); + $intReturn = 1; + } + return $intReturn; + } + + /** + * Removes one or more dataset(s) from a table. Optinal a single data ID can be passed or the values will be + * processed through the POST variable $_POST['chbId_n'] where 'n' represents the data ID. + * -> This function does not delete any relation data! <- + * @param string $strTableName Table name + * @param int $intDataId Single data ID + * @return int 0 = successful / 1 = error + * Status message is stored in message class variables + */ + public function dataDeleteEasy(string $strTableName, int $intDataId = 0): int + { + /* Define variables */ + $strNoDelete1 = ''; + $strNoDelete2 = ''; + $intReturn = 0; + $arrData = array(); + /* Special rule for tables with "nodelete" cells */ + if (($strTableName === 'tbl_datadomain') || ($strTableName === 'tbl_configtarget') || + ($strTableName === 'tbl_user')) { + $strNoDelete1 = "AND `nodelete` <> '1'"; + $strNoDelete2 = "WHERE `nodelete` <> '1'"; + } + /* Delete a single data set */ + if ($intDataId !== 0) { + /** @noinspection SqlResolve */ + $strSQL = 'DELETE FROM `' . $strTableName . "` WHERE `id` = $intDataId $strNoDelete1"; + $booReturn = $this->myDBClass->insertData($strSQL); + if ($booReturn === false) { + $this->processClassMessage(translate('Delete failed because a database error:') . + '::' . $this->myDBClass->strErrorMessage . '::', $this->strInfoMessage); + $intReturn = 1; + } elseif ($this->myDBClass->intAffectedRows === 0) { + $this->processClassMessage(translate('No data deleted. The dataset probably does not exist or ' . + 'is protected from deletion.') . '::', $this->strErrorMessage); + $intReturn = 1; + } else { + $this->strInfoMessage .= translate('Dataset successfully deleted. Affected rows:') . ' ' . + $this->myDBClass->intAffectedRows . '::'; + $this->writeLog(translate('Delete dataset id:') . " $intDataId " . translate('- from table:') . + " $strTableName " . translate('- with affected rows:') . ' ' . $this->myDBClass->intAffectedRows); + $this->updateStatusTable($strTableName); + } + /* Delete data sets based on form POST parameter */ + } else { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $strTableName . '` '; + $strSQL .= $strNoDelete2; + $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); + if ($booReturn && ($intDataCount !== 0)) { + $intDeleteCount = 0; + foreach ($arrData as $elem) { + $strChbName = 'chbId_' . $elem['id']; + /* Should this data id to be deleted? */ + if ((filter_input(INPUT_POST, $strChbName) !== null) && + (filter_input(INPUT_POST, $strChbName, FILTER_UNSAFE_RAW) === 'on')) { + /** @noinspection SqlResolve */ + $strSQL = 'DELETE FROM `' . $strTableName . '` WHERE `id` = ' . $elem['id']; + $booReturn = $this->myDBClass->insertData($strSQL); + if ($booReturn === false) { + $this->processClassMessage(translate('Delete failed because a database error:') . + '::' . $this->myDBClass->strErrorMessage . '::', $this->strInfoMessage); + $intReturn = 1; + } else { + $intDeleteCount += $this->myDBClass->intAffectedRows; + } + } + } + /* Process messsages */ + if ($intDeleteCount === 0) { + $this->processClassMessage(translate('No data deleted. Probably the dataset does not exist or ' . + 'it is protected from delete.') . '::', $this->strErrorMessage); + $intReturn = 1; + } elseif ($intReturn === 0) { + $this->processClassMessage(translate('Dataset successfully deleted. Affected rows:') . ' ' . + $intDeleteCount . '::', $this->strInfoMessage); + $this->writeLog(translate('Deleted data from table:') . " $strTableName " . + translate('- with affected rows:') . ' ' . $this->myDBClass->intAffectedRows); + $this->updateStatusTable($strTableName); + } + } else { + $this->processClassMessage(translate('No data deleted. Probably the dataset does not exist or it is ' . + 'protected from delete.') . '::', $this->strErrorMessage); + $intReturn = 1; + } + } + return $intReturn; + } + + /** + * Removes one or more dataset(s) from a table. Optinal a single data ID can be passed or the values will be + * processed through the POST variable $_POST['chbId_n'] where 'n' represents the data ID. + * -> This function does also delete relation data! <- + * @param string $strTableName Table name + * @param int $intDataId Single data ID + * @param int $intForce Force deletion (1 = force, 1 = no force) + * @return int 0 = successful / 1 = error + * Status message is stored in message class variables + */ + public function dataDeleteFull(string $strTableName, int $intDataId = 0, int $intForce = 0): int + { + /* Define variables */ + $arrRelations = array(); + $arrData = array(); + $arrConfigId = array(); + /* Get write access groups */ + $strAccess = $this->myVisClass->getAccessGroups('write'); + /* Get all relations */ + $this->fullTableRelations($strTableName, $arrRelations); + /* Get all datasets */ + if ($strTableName === 'tbl_group') { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $strTableName . '`'; + } else { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $strTableName . '` ' . + 'WHERE `config_id`=' . $this->intDomainId . " AND `access_group` IN ($strAccess)"; + } + $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); + if ($booReturn && ($intDataCount !== 0)) { + $intDeleteCount = 0; + $strInfoMessage = ''; + $strErrorMessage = ''; + + foreach ($arrData as $elem) { + $strChbName = 'chbId_' . $elem['id']; + /* Single ID */ + if (($intDataId !== 0) && ($intDataId !== (int)$elem['id'])) { + continue; + } + /* Should this data id to be deleted? */ + if ((($intDataId === (int)$elem['id']) || ((filter_input(INPUT_POST, $strChbName) !== null) && + (filter_input(INPUT_POST, $strChbName, FILTER_UNSAFE_RAW) === 'on'))) && + (($this->infoRelation($strTableName, $elem['id'], 'id', 1) === 0) || ($intForce === 1))) { + /* Delete relations */ + if (!is_array($arrRelations)) { + $arrRelations = array(); + } + foreach ($arrRelations as $rel) { + $strSQL = ''; + /* Process flags */ + $arrFlags = explode(',', $rel['flags']); + /* Simple 1:n relation */ + if ((int)$arrFlags[3] === 1) { + /** @noinspection SqlResolve */ + $strSQL = 'DELETE FROM `' . $rel['tableName1'] . '` ' . + 'WHERE `' . $rel['fieldName'] . '`=' . $elem['id']; + } + /* Simple 1:1 relation */ + if ((int)$arrFlags[3] === 0) { + /* Delete relation */ + if ((int)$arrFlags[2] === 0) { + /** @noinspection SqlResolve */ + $strSQL = 'DELETE FROM `' . $rel['tableName1'] . '` ' . + 'WHERE `' . $rel['fieldName'] . '`=' . $elem['id']; + /* Set slave to 0 */ + } elseif ((int)$arrFlags[2] === 2) { + $strSQL = 'UPDATE `' . $rel['tableName1'] . '` SET `' . $rel['fieldName'] . '`=0 ' . + 'WHERE `' . $rel['fieldName'] . '`=' . $elem['id']; + } + } + /* Special 1:n relation for variables */ + if ((int)$arrFlags[3] === 2) { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $rel['tableName1'] . '` WHERE `idMaster`=' . $elem['id']; + $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); + if ($booReturn && ($intDataCount !== 0)) { + foreach ($arrData as $vardata) { + $strSQL = 'DELETE FROM `tbl_variabledefinition` ' . + 'WHERE `id`=' . $vardata['idSlave']; + $this->myDBClass->insertData($strSQL); + } + } + /** @noinspection SqlResolve */ + $strSQL = 'DELETE FROM `' . $rel['tableName1'] . '` WHERE `idMaster`=' . $elem['id']; + } + /* Special 1:n relation for time definitions */ + if ((int)$arrFlags[3] === 3) { + $strSQL = 'DELETE FROM `tbl_timedefinition` WHERE `tipId`=' . $elem['id']; + $this->myDBClass->insertData($strSQL); + } + if ($strSQL !== '') { + $this->myDBClass->insertData($strSQL); + } + } + /* Delete host configuration file */ + if (($strTableName === 'tbl_host') && ($this->intDomainId !== 0)) { + $strSQL = 'SELECT `host_name` FROM `tbl_host` WHERE `id`=' . $elem['id']; + $strHost = $this->myDBClass->getFieldData($strSQL); + $intRetConf = $this->myConfigClass->getConfigSets($arrConfigId); + if ($intRetConf !== 1) { + $intReturn = 0; + foreach ($arrConfigId as $intConfigId) { + $intReturn += $this->myConfigClass->moveFile( + 'host', + $strHost . '.cfg', + $intConfigId + ); + } + if ($intReturn === 0) { + $this->processClassMessage(translate('The assigned, no longer used configuration ' . + 'files were deleted successfully!') . '::', $strInfoMessage); + $this->writeLog(translate('Host file deleted:') . ' ' . $strHost . '.cfg'); + } else { + $strErrorMessage .= translate('Errors while deleting the old configuration file - ' . + 'please check!:') . ' ::' . $this->myConfigClass->strErrorMessage . '::'; + } + } + } + /* Delete service configuration file */ + if (($strTableName === 'tbl_service') && ($this->intDomainId !== 0)) { + $strSQL = 'SELECT `config_name` FROM `tbl_service` WHERE `id`=' . $elem['id']; + $strService = $this->myDBClass->getFieldData($strSQL); + $strSQL = "SELECT * FROM `tbl_service` WHERE `config_name` = '$strService'"; + $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); + if ($intDataCount === 1) { + $intRetConf = $this->myConfigClass->getConfigSets($arrConfigId); + if ($intRetConf !== 1) { + $intReturn = 0; + foreach ($arrConfigId as $intConfigId) { + $intReturn += $this->myConfigClass->moveFile( + 'service', + $strService . '.cfg', + $intConfigId + ); + } + if ($intReturn === 0) { + $this->processClassMessage(translate('The assigned, no longer used ' . + 'configuration files were deleted successfully!') . + '::', $strInfoMessage); + $this->writeLog(translate('Host file deleted:') . ' ' . $strService . '.cfg'); + } else { + $strErrorMessage .= translate('Errors while deleting the old configuration ' . + 'file - please check!:') . '::' . + $this->myConfigClass->strErrorMessage . '::'; + } + } + } + } + /* Delete main entry */ + /** @noinspection SqlResolve */ + $strSQL = 'DELETE FROM `' . $strTableName . '` WHERE `id`=' . $elem['id']; + $this->myDBClass->insertData($strSQL); + $intDeleteCount++; + } + } + /* Process messages */ + if ($intDeleteCount === 0) { + $this->processClassMessage(translate('No data deleted. Probably the dataset does not exist, it is ' . + 'protected from deletion, you do not have write permission or it has relations to other ' . + 'configurations which cannot be deleted. Use the "info" function for detailed informations ' . + 'about relations!') . '::', $this->strErrorMessage); + return 1; + } + + $this->updateStatusTable($strTableName); + $this->processClassMessage(translate('Dataset successfully deleted. Affected rows:') . ' ' . + $intDeleteCount . '::', $this->strInfoMessage); + $this->writeLog(translate('Deleted data from table:') . " $strTableName " . + translate('- with affected rows:') . ' ' . $intDeleteCount); + $this->processClassMessage($strInfoMessage, $this->strInfoMessage); + $this->processClassMessage($strErrorMessage, $this->strErrorMessage); + return 0; + } + $this->processClassMessage(translate('No data deleted. Probably the dataset does not exist, it is ' . + 'protected from deletion or you do not have write permission.') . '::' . + $this->myDBClass->strErrorMessage, $this->strErrorMessage); + return 1; + } + + /** + * Returns an array with any data fields from a table with existing relations to another table. This function + * returns also passive relations which are not used in configurations. + * This function is used for a full deletion of a configuration entry or to find out if a configuration is used + * in another way. + * @param string $strTable Table name + * @param array|null $arrRelations Array with relations + * @return int 0 = no field with relation / 1 = at least one field with relation + * Status message is stored in message class variables + * Data array: tableName Table include the relation data + * fieldName Field name include the relation data + * flags Pos 1 -> 0=Normal field / 1=Required field (field type) + * Pos 2 -> 0=delete / 1=keep data / 2=set to 0 (normal deletion option) + * Pos 3 -> 0=delete / 2=set to 0 (force deletion option) + * Pos 4 -> 0=1:1 / 1=1:n / (relation type) + * 2=1:n (variables) / 3=1:n (timedef) + */ + public function fullTableRelations(string $strTable, array &$arrRelations = null): int + { + /* Define variable */ + $arrRelations = array(); + $arrData = array(); + $intDC = 0; + $intReturn = 0; + /* Get relation data */ + $strSQL = "SELECT * FROM `tbl_relationinformation` WHERE `master`='$strTable' AND `fullRelation`=1"; + $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); + if ($booReturn && ($intDC !== 0)) { + foreach ($arrData as $elem) { + $arrRelations[] = array('tableName1' => $elem['tableName1'], 'fieldName' => $elem['fieldName'], + 'target1' => $elem['target1'], 'targetKey' => $elem['targetKey'], + 'flags' => $elem['flags']); + } + $intReturn = 1; + } + return $intReturn; + } + + /** + * Searches any relation in the database and returns them as relation information + * @param string $strTable Database table name + * @param int $intMasterId Data ID from master table + * @param string $strMasterfield Info field name from master table + * @param int $intReporting Output as text - 0=yes, 1=no + * @return int 0 = successful / 1 = error + * Status message is stored in message class variables + */ + public function infoRelation(string $strTable, int $intMasterId, string $strMasterfield, int $intReporting = 0): int + { + $intDeletion = 0; + $arrDSCount = array(); + $arrRelations = array(); + $arrData = array(); + $arrDataCheck = array(); + $intReturn = $this->fullTableRelations($strTable, $arrRelations); + if (($intReturn === 1) && ($intMasterId !== 0)) { + /* Get master field data */ + $strNewMasterfield = str_replace(',', '`,`', $strMasterfield); + $strSQL = 'SELECT `' . $strNewMasterfield . '` FROM `' . $strTable . "` WHERE `id` = $intMasterId"; + $this->myDBClass->hasSingleDataset($strSQL, $arrSource); + if (substr_count($strMasterfield, ',') !== 0) { + $arrTarget = explode(',', $strMasterfield); + $strName = $arrSource[$arrTarget[0]] . '-' . $arrSource[$arrTarget[1]]; + } else { + $strName = $arrSource[$strMasterfield]; + } + $this->strInfoMessage .= '' . translate('Relation information for ') . + $strName . translate(' of table ') . $strTable . ':::'; + $this->strInfoMessage .= ''; + /* Walk through relations */ + foreach ($arrRelations as $elem) { + /* Process flags */ + $arrFlags = explode(',', $elem['flags']); + if ($elem['fieldName'] === 'check_command') { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $elem['tableName1'] . '` ' . + 'WHERE SUBSTRING_INDEX(`' . $elem['fieldName'] . "`,'!',1)= $intMasterId"; + } else { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $elem['tableName1'] . '` WHERE `' . $elem['fieldName'] . "`= $intMasterId"; + } + $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); + /* Take only used relations */ + if ($booReturn && ($intDataCount !== 0)) { + /* Relation type */ + if ((int)$arrFlags[3] === 1) { + foreach ($arrData as $data) { + if ($elem['fieldName'] === 'idMaster') { + $strRef = 'idSlave'; + /* Process special tables */ + if ($elem['target1'] === 'tbl_service') { + if ($elem['tableName1'] === 'tbl_lnkServicegroupToService') { + $strRef = 'idSlaveS'; + } + } elseif ($elem['target1'] === 'tbl_host') { + if ($elem['tableName1'] === 'tbl_lnkServicegroupToService') { + $strRef = 'idSlaveH'; + } + } elseif ($elem['target1'] === 'tbl_hostgroup') { + if ($elem['tableName1'] === 'tbl_lnkServicegroupToService') { + $strRef = 'idSlaveHG'; + } + } + } else { + $strRef = 'idMaster'; + } + /* Get data */ + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $elem['tableName1'] . '` ' . + 'LEFT JOIN `' . $elem['target1'] . '` ON `' . $strRef . '` = `id` ' . + 'WHERE `' . $elem['fieldName'] . '` = ' . $data[$elem['fieldName']] . ' ' . + 'AND `' . $strRef . '`=' . $data[$strRef]; + $this->myDBClass->hasSingleDataset($strSQL, $arrDSTarget); + if (substr_count($elem['targetKey'], ',') !== 0) { + $arrTarget = explode(',', $elem['targetKey']); + $strTarget = $arrDSTarget[$arrTarget[0]] . '-' . $arrDSTarget[$arrTarget[1]]; + } else { + $strTarget = $arrDSTarget[$elem['targetKey']]; + } + /* If the field is market as "required", check for any other entries */ + if ((int)$arrFlags[0] === 1) { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $elem['tableName1'] . '` ' . + 'WHERE `' . $strRef . '` = ' . $arrDSTarget[$strRef]; + $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrDSCount, $intDCCount); + if ($booReturn && ($intDCCount > 1)) { + $this->strInfoMessage .= translate('Relation to ') . $elem['target1'] . + translate(', entry ') . $strTarget . + ' - ' . translate('deletion possible') . + '::'; + } else { + $this->strInfoMessage .= translate('Relation to ') . $elem['target1'] . + translate(', entry ') . $strTarget . + ' - ' . + translate('deletion not possible') . '::'; + $intDeletion = 1; + } + } else { + $this->strInfoMessage .= translate('Relation to ') . $elem['target1'] . + translate(', entry ') . $strTarget . ' - ' . + translate('deletion possible') . '::'; + } + } + } elseif ((int)$arrFlags[3] === 0) { + /* Fetch remote entry */ + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $elem['tableName1'] . '` ' + . 'WHERE `' . $elem['fieldName'] . "`=$intMasterId"; + $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrDataCheck, $intDCCheck); + if ($booReturn && ($intDCCheck !== 0)) { + foreach ($arrDataCheck as $data) { + if (substr_count($elem['targetKey'], ',') !== 0) { + $arrTarget = explode(',', $elem['targetKey']); + $strTarget = $data[$arrTarget[0]] . '-' . $data[$arrTarget[1]]; + } else { + $strTarget = $data[$elem['targetKey']]; + } + if ((int)$arrFlags[0] === 1) { + $this->strInfoMessage .= translate('Relation to ') . $elem['tableName1'] . + translate(', entry ') . $strTarget . + ' - ' . + translate('deletion not possible') . '::'; + $intDeletion = 1; + } else { + $this->strInfoMessage .= translate('Relation to ') . $elem['tableName1'] . + translate(', entry ') . $strTarget . + ' - ' . + translate('deletion possible') . '::'; + } + } + } + } + } + } + $this->strInfoMessage .= '::'; + } + if ($intReporting === 1) { + $this->strInfoMessage = ''; + } + return $intDeletion; + } + + /** + * Update the datasets for 1:n (optional 1:n:m) relations in the database table + * @param string $strTable Database table name + * @param int $intMasterId Data ID from master table + * @param array $arrSlaveId Array with all data IDs from slave table + * @param int $intMulti 0 = for 1:n relations + * 1 = for 1:n:n relations + * @return int 0 = successful / 1 = error + */ + public function dataUpdateRelation(string $strTable, int $intMasterId, array $arrSlaveId, int $intMulti = 0): int + { + $intReturn = 0; + /* Remove any old relations */ + $intReturn1 = $this->dataDeleteRelation($strTable, $intMasterId); + if ($intReturn1 !== 0) { + $intReturn = 1; + } + /* Insert the new relations */ + if ($intReturn === 0) { + $intReturn2 = $this->dataInsertRelation($strTable, $intMasterId, $arrSlaveId, $intMulti); + if ($intReturn2 !== 0) { + $intReturn = 1; + } + } + return $intReturn; + } + + /** + * Removes any relation from the database + * @param string $strTable Database table name + * @param int $intMasterId Data ID from master table + * @return int 0 = successful / 1 = error + */ + public function dataDeleteRelation(string $strTable, int $intMasterId): int + { + /* Define variables */ + $intDataId = 0; + /* Define the SQL statement */ + /** @noinspection SqlResolve */ + $strSQL = 'DELETE FROM `' . $strTable . "` WHERE `idMaster`=$intMasterId"; + return $this->dataInsert($strSQL, $intDataId); + } + + /** + * Inserts any necessary dataset for an 1:n (optional 1:n:n) relation to the database table + * @param string $strTable Database table name + * @param int $intMasterId Data ID from master table + * @param array $arrSlaveId Array with all data IDs from slave table + * @param int $intMulti 0 = for 1:n relations + * 1 = for 1:n:n relations + * @return int 0 = successful / 1 = error + */ + public function dataInsertRelation(string $strTable, int $intMasterId, array $arrSlaveId, int $intMulti = 0): int + { + /* Define variables */ + $intReturn = 0; + $intDataId = 0; + $strSQL = ''; + /* Walk through the slave data ID array */ + foreach ($arrSlaveId as $elem) { + /* Pass empty and '*' values */ + if ($elem === '0') { + continue; + } + if ($elem === '*') { + continue; + } + /* Process exclude values */ + if (0 === strpos($elem, 'e')) { + $elem = str_replace('e', '', $elem); + $intExclude = 1; + } else { + $intExclude = 0; + } + /* Define the SQL statement */ + if ($intMulti !== 0) { + $arrValues = explode('::', $elem); + /** @noinspection SqlResolve */ + $strSQL = 'INSERT INTO `' . $strTable . "` SET `idMaster`=$intMasterId, `idSlaveH`=" . $arrValues[0] + . ', `idSlaveHG`=' . $arrValues[1] . ', `idSlaveS`=' . $arrValues[2] . ", `exclude`=$intExclude"; + } else if (($strTable === 'tbl_lnkServicedependencyToService_DS') || + ($strTable === 'tbl_lnkServicedependencyToService_S') || + ($strTable === 'tbl_lnkServiceescalationToService')) { + /* Get service description */ + $strSQLSrv = "SELECT `service_description` FROM `tbl_service` WHERE id=$elem"; + $strService = $this->myDBClass->getFieldData($strSQLSrv); + /** @noinspection SqlResolve */ + $strSQL = 'INSERT INTO `' . $strTable . "` SET `idMaster`=$intMasterId, `idSlave`=$elem, " . + "`strSlave`='" . addslashes($strService) . "', `exclude`=$intExclude"; + } elseif (($strTable === 'tbl_lnkServiceToService') || + ($strTable === 'tbl_lnkServicetemplateToService')) { + $arrValues = explode('-', $elem); + if (isset($arrValues[0], $arrValues[1])) { + /** @noinspection SqlResolve */ + $strSQL = 'INSERT INTO `' . $strTable . "` SET `idMaster`=$intMasterId, `idSlave`=$arrValues[0], " + . " `idHost`=$arrValues[1]"; + } + } elseif (($strTable !== 'tbl_lnkTimeperiodToTimeperiod') && + ($strTable !== 'tbl_lnkDatadomainToConfigtarget')) { + /** @noinspection SqlResolve */ + $strSQL = 'INSERT INTO `' . $strTable . '` ' . + "SET `idMaster`=$intMasterId, `idSlave`=$elem, `exclude`=$intExclude"; + } else { + /** @noinspection SqlResolve */ + $strSQL = 'INSERT INTO `' . $strTable . "` SET `idMaster`=$intMasterId, `idSlave`=$elem"; + } + /* Insert data */ + $intReturn = $this->dataInsert($strSQL, $intDataId); + if ($intReturn !== 0) { + $intReturn = 1; + } + } + return $intReturn; + } + + /** + * Deactivates one or many datasets in the table be setting 'active' to '0'. Alternatively, a single record + * ID can be specified or evaluated by the values of $_POST['chbId_n'] passed parameters, where n is the + * record ID must match. + * @param string $strTableName Table name + * @param int $intDataId Individual record ID, which is to be activated + * @return int 0 = successful / 1 = error + * Status message is stored in message class variables + */ + public function dataDeactivate(string $strTableName, int $intDataId = 0): int + { + /* Define variables */ + $intReturn = 1; + $arrData = array(); + /* Get write access groups */ + $strAccess = $this->myVisClass->getAccessGroups('write'); + /* Activate datasets */ + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $strTableName . '` ' . + 'WHERE `config_id`=' . $this->intDomainId . " AND `access_group` IN ($strAccess)"; + $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); + if ($booReturn && ($intDataCount !== 0)) { + $intActivateCount = 0; + foreach ($arrData as $elem) { + $strChbName = 'chbId_' . $elem['id']; + /* was the current record is marked for activate? */ + if ((($intDataId === (int)$elem['id']) || ((filter_input(INPUT_POST, $strChbName) !== null) && + (filter_input(INPUT_POST, $strChbName, FILTER_UNSAFE_RAW) === 'on'))) && + $this->infoRelation($strTableName, $elem['id'], 'id', 1) === 0) { + /* Update dataset */ + if (($strTableName === 'tbl_service') || ($strTableName === 'tbl_host')) { + $strSQL = 'UPDATE `' . $strTableName . "` SET `active`='0', `last_modified`=now() " . + 'WHERE `id`=' . $elem['id']; + } else { + $strSQL = 'UPDATE `' . $strTableName . "` SET `active`='0' WHERE `id`=" . $elem['id']; + } + $this->myDBClass->insertData($strSQL); + $intActivateCount++; + } + } + /* Process information */ + if ($intActivateCount === 0) { + $this->processClassMessage(translate('No dataset deactivated. Maybe the dataset does not exist, it ' . + 'is protected from deactivation, no dataset was selected or you do not have write permission. ' . + 'Use the "info" function for detailed informations about relations!') . + '::', $this->strErrorMessage); + } else { + $this->updateStatusTable($strTableName); + $this->processClassMessage(translate('Dataset successfully deactivated. Affected rows:') . ' ' . + $intActivateCount . '::', $this->strInfoMessage); + $this->writeLog(translate('Deactivate dataset from table:') . " $strTableName " . + translate('- with affected rows:') . ' ' . $this->myDBClass->intAffectedRows); + $intReturn = 0; + } + } else { + $this->processClassMessage(translate('No dataset deactivated. Maybe the dataset does not exist or you ' . + 'do not have write permission.') . '::', $this->strErrorMessage); + } + return $intReturn; + } + + /** + * Activates one or many datasets in the table be setting 'active' to '1'. Alternatively, a single record ID can + * be specified or evaluated by the values of $_POST['chbId_n'] passed parameters, where n is the record ID must + * match. + * @param string $strTableName Table name + * @param int $intDataId Individual record ID, which is to be activated + * @return int 0 = successful / 1 = error + * Status message is stored in message class variables + */ + public function dataActivate(string $strTableName, int $intDataId = 0): int + { + /* Define variables */ + $intReturn = 1; + $arrData = array(); + /* Get write access groups */ + $strAccess = $this->myVisClass->getAccessGroups('write'); + /* Activate datasets */ + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $strTableName . '` ' . + 'WHERE `config_id`=' . $this->intDomainId . " AND `access_group` IN ($strAccess)"; + $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); + if ($booReturn && ($intDataCount !== 0)) { + $intActivateCount = 0; + foreach ($arrData as $elem) { + $strChbName = 'chbId_' . $elem['id']; + /* was the current record marked for activate? */ + if (($intDataId === (int)$elem['id']) || ((filter_input(INPUT_POST, $strChbName) !== null) && + (filter_input(INPUT_POST, $strChbName, FILTER_UNSAFE_RAW) === 'on'))) { + /* Update dataset */ + if (($strTableName === 'tbl_service') || ($strTableName === 'tbl_host')) { + $strSQL = 'UPDATE `' . $strTableName . "` SET `active`='1', `last_modified`=now() " . + 'WHERE `id`=' . $elem['id']; + } else { + $strSQL = 'UPDATE `' . $strTableName . "` SET `active`='1' WHERE `id`=" . $elem['id']; + } + $this->myDBClass->insertData($strSQL); + $intActivateCount++; + } + } + /* Process information */ + if ($intActivateCount === 0) { + $this->processClassMessage(translate('No dataset activated. Maybe the dataset does not exist, no ' . + 'dataset was selected or you do not have write permission.') . '::', $this->strErrorMessage); + } else { + $this->updateStatusTable($strTableName); + $this->processClassMessage(translate('Dataset successfully activated. Affected rows:') . ' ' . + $intActivateCount . '::', $this->strInfoMessage); + $this->writeLog(translate('Activate dataset from table:') . " $strTableName " . + translate('- with affected rows:') . ' ' . $this->myDBClass->intAffectedRows); + $intReturn = 0; + } + } else { + $this->processClassMessage(translate('No dataset activated. Maybe the dataset does not exist or you do ' . + 'not have write permission.') . '::', $this->strErrorMessage); + } + return $intReturn; + } + + /** + * Updates the hash field im some configuration objects + * @param string $strTable Table name + * @param int $intId Data ID + * @return int 0 = successful / 1 = error + * Status message is stored in message class variables + */ + public function updateHash(string $strTable, int $intId): int + { + /* Define variables */ + $strRawString = ''; + $arrData = array(); + $intDC = 0; + $intDataID = 0; + /* Service table */ + if ($strTable === 'tbl_service') { + /* Get any hosts and host_groups */ + $strSQL = 'SELECT `host_name` AS `item_name` FROM `tbl_host` ' . + "LEFT JOIN `tbl_lnkServiceToHost` ON `idSlave`=`id` WHERE `idMaster`=$intId " . + 'UNION SELECT `hostgroup_name` AS `item_name` FROM `tbl_hostgroup` ' . + 'LEFT JOIN `tbl_lnkServiceToHostgroup` ON `idSlave`=`id` ' . + 'WHERE `idMaster`=' . $intId . ' ORDER BY `item_name`'; + $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); + if ($booRet && ($intDC !== 0)) { + foreach ($arrData as $elem) { + $strRawString .= $elem['item_name'] . ','; + } + } + $strSQL = 'SELECT * FROM `tbl_service` WHERE `id`=' . $intId; + $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); + if ($booRet && ($intDC !== 0)) { + if ($arrData[0]['service_description'] !== '') { + $strRawString .= $arrData[0]['service_description'] . ','; + } + if ($arrData[0]['display_name'] !== '') { + $strRawString .= $arrData[0]['display_name'] . ','; + } + if ($arrData[0]['check_command'] !== '') { + $arrField = explode('!', $arrData[0]['check_command']); + $strCommand = strstr($arrData[0]['check_command'], '!'); + $strSQLRel = 'SELECT `command_name` FROM `tbl_command` WHERE `id`=' . $arrField[0]; + $strName = $this->myDBClass->getFieldData($strSQLRel); + $strRawString .= $strName . $strCommand . ','; + } + } + } + if (($strTable === 'tbl_hostdependency') || ($strTable === 'tbl_servicedependency')) { + /* Get * values */ + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $strTable . '` WHERE `id`=' . $intId; + $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); + if ($booRet && ($intDC !== 0)) { + if (isset($arrData[0]['dependent_host_name']) && ((int)$arrData[0]['dependent_host_name'] === 2)) { + $strRawString .= 'any,'; + } + if (isset($arrData[0]['dependent_hostgroup_name']) && ((int)$arrData[0]['dependent_hostgroup_name'] === 2)) { + $strRawString .= 'any,'; + } + if (isset($arrData[0]['host_name']) && ((int)$arrData[0]['host_name'] === 2)) { + $strRawString .= 'any,'; + } + if (isset($arrData[0]['hostgroup_name']) && ((int)$arrData[0]['hostgroup_name'] === 2)) { + $strRawString .= 'any,'; + } + if (isset($arrData[0]['dependent_service_description']) && + ((int)$arrData[0]['dependent_service_description'] === 2)) { + $strRawString .= 'any,'; + } + if (isset($arrData[0]['service_description']) && ((int)$arrData[0]['service_description'] === 2)) { + $strRawString .= 'any,'; + } + } + if ($strTable === 'tbl_hostdependency') { + /* Get any hosts and host_groups */ + $strSQL = 'SELECT `host_name` AS `item_name`, exclude FROM `tbl_host` ' . + "LEFT JOIN `tbl_lnkHostdependencyToHost_DH` ON `idSlave`=`id` WHERE `idMaster`=$intId " . + 'UNION ALL SELECT `hostgroup_name` AS `item_name`, exclude FROM `tbl_hostgroup` ' . + "LEFT JOIN `tbl_lnkHostdependencyToHostgroup_DH` ON `idSlave`=`id` WHERE `idMaster`=$intId " . + 'UNION ALL SELECT `host_name` AS `item_name`, exclude FROM `tbl_host` ' . + "LEFT JOIN `tbl_lnkHostdependencyToHost_H` ON `idSlave`=`id` WHERE `idMaster`=$intId " . + 'UNION ALL SELECT `hostgroup_name` AS `item_name`, exclude FROM `tbl_hostgroup` ' . + 'LEFT JOIN `tbl_lnkHostdependencyToHostgroup_H` ON `idSlave`=`id` WHERE `idMaster`=' . $intId; + } + if ($strTable === 'tbl_servicedependency') { + /* Get any hosts and host_groups */ + $strSQL = 'SELECT `host_name` AS `item_name`, exclude FROM `tbl_host` ' . + "LEFT JOIN `tbl_lnkServicedependencyToHost_DH` ON `idSlave`=`id` WHERE `idMaster`=$intId " . + 'UNION ALL SELECT `hostgroup_name` AS `item_name`, exclude FROM `tbl_hostgroup` ' . + 'LEFT JOIN `tbl_lnkServicedependencyToHostgroup_DH` ON `idSlave`=`id` ' . + "WHERE `idMaster`=$intId " . + 'UNION ALL SELECT `host_name` AS `item_name`, exclude FROM `tbl_host` ' . + "LEFT JOIN `tbl_lnkServicedependencyToHost_H` ON `idSlave`=`id` WHERE `idMaster`=$intId " . + 'UNION ALL SELECT `hostgroup_name` AS `item_name`, exclude FROM `tbl_hostgroup` ' . + 'LEFT JOIN `tbl_lnkServicedependencyToHostgroup_H` ON `idSlave`=`id` ' . + "WHERE `idMaster`=$intId " . + 'UNION ALL SELECT `strSlave` AS `item_name`, exclude ' . + "FROM `tbl_lnkServicedependencyToService_DS` WHERE `idMaster`=$intId " . + 'UNION ALL SELECT `strSlave` AS `item_name`, exclude ' . + "FROM `tbl_lnkServicedependencyToService_S` WHERE `idMaster`=$intId"; + } + $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); + if ($booRet && ($intDC !== 0)) { + foreach ($arrData as $elem) { + if ((int)$elem['exclude'] === 0) { + $strRawString .= $elem['item_name'] . ','; + } else { + $strRawString .= 'not_' . $elem['item_name'] . ','; + } + } + $strRawString = substr($strRawString, 0, -1); + } + } + if (($strTable === 'tbl_hostescalation') || ($strTable === 'tbl_serviceescalation')) { + /* Get * values */ + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $strTable . '` WHERE `id`=' . $intId; + $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); + if ($booRet && ($intDC !== 0)) { + if (isset($arrData[0]['host_name']) && ((int)$arrData[0]['host_name'] === 2)) { + $strRawString .= 'any,'; + } + if (isset($arrData[0]['hostgroup_name']) && ((int)$arrData[0]['hostgroup_name'] === 2)) { + $strRawString .= 'any,'; + } + if (isset($arrData[0]['contacts']) && ((int)$arrData[0]['contacts'] === 2)) { + $strRawString .= 'any,'; + } + if (isset($arrData[0]['contact_groups']) && ((int)$arrData[0]['contact_groups'] === 2)) { + $strRawString .= 'any,'; + } + if (isset($arrData[0]['service_description']) && ((int)$arrData[0]['service_description'] === 2)) { + $strRawString .= 'any,'; + } + } + /* Get any hosts, host_groups, contacts and contact_groups */ + if ($strTable === 'tbl_hostescalation') { + $strSQL = 'SELECT `host_name` AS `item_name`, exclude FROM `tbl_host` ' . + "LEFT JOIN `tbl_lnkHostescalationToHost` ON `idSlave`=`id` WHERE `idMaster`=$intId " . + 'UNION ALL SELECT `hostgroup_name` AS `item_name`, exclude FROM `tbl_hostgroup` ' . + "LEFT JOIN `tbl_lnkHostescalationToHostgroup` ON `idSlave`=`id` WHERE `idMaster`=$intId " . + 'UNION ALL SELECT `contact_name` AS `item_name`, exclude FROM `tbl_contact` ' . + "LEFT JOIN `tbl_lnkHostescalationToContact` ON `idSlave`=`id` WHERE `idMaster`=$intId " . + 'UNION ALL SELECT `contactgroup_name` AS `item_name`, exclude FROM `tbl_contactgroup` ' . + "LEFT JOIN `tbl_lnkHostescalationToContactgroup` ON `idSlave`=`id` WHERE `idMaster`=$intId"; + } + if ($strTable === 'tbl_serviceescalation') { + $strSQL = 'SELECT `host_name` AS `item_name`, exclude FROM `tbl_host` ' . + "LEFT JOIN `tbl_lnkServiceescalationToHost` ON `idSlave`=`id` WHERE `idMaster`=$intId " . + 'UNION ALL SELECT `hostgroup_name` AS `item_name`, exclude FROM `tbl_hostgroup` ' . + "LEFT JOIN `tbl_lnkServiceescalationToHostgroup` ON `idSlave`=`id` WHERE `idMaster`=$intId " . + 'UNION ALL SELECT `contact_name` AS `item_name`, exclude FROM `tbl_contact` ' . + "LEFT JOIN `tbl_lnkServiceescalationToContact` ON `idSlave`=`id` WHERE `idMaster`=$intId " . + 'UNION ALL SELECT `contactgroup_name` AS `item_name`, exclude FROM `tbl_contactgroup` ' . + 'LEFT JOIN `tbl_lnkServiceescalationToContactgroup` ON `idSlave`=`id` ' . + "WHERE `idMaster`=$intId " . + 'UNION ALL SELECT `strSlave` AS `item_name`, exclude ' . + "FROM `tbl_lnkServiceescalationToService` WHERE `idMaster`=$intId"; + } + $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); + if ($booRet && ($intDC !== 0)) { + foreach ($arrData as $elem) { + if ((int)$elem['exclude'] === 0) { + $strRawString .= $elem['item_name'] . ','; + } else { + $strRawString .= 'not_' . $elem['item_name'] . ','; + } + } + $strRawString = substr($strRawString, 0, -1); + } + } + if ($strTable === 'tbl_serviceextinfo') { + /* Get any hosts and host_groups */ + $strSQL = 'SELECT `tbl_host`.`host_name` AS `item_name` FROM `tbl_host` ' . + 'LEFT JOIN `tbl_serviceextinfo` ON `tbl_host`.`id`=`tbl_serviceextinfo`.`host_name` ' . + "WHERE `tbl_serviceextinfo`.`id`=$intId " . + 'UNION SELECT `tbl_service`.`service_description` AS `item_name` FROM `tbl_service` ' . + 'LEFT JOIN `tbl_serviceextinfo` ON ' . + '`tbl_service`.`id`=`tbl_serviceextinfo`.`service_description` ' . + "WHERE `tbl_serviceextinfo`.`id`=$intId ORDER BY `item_name`"; + $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); + if ($booRet && ($intDC !== 0)) { + foreach ($arrData as $elem) { + $strRawString .= $elem['item_name'] . ','; + } + $strRawString = substr($strRawString, 0, -1); + } + } + /* Remove blanks */ + while (substr_count($strRawString, ' ') !== 0) { + $strRawString = str_replace(' ', '', $strRawString); + } + /* Sort hash string */ + $arrTemp = explode(',', $strRawString); + sort($arrTemp); + $strRawString = implode(',', $arrTemp); + /* Update has in database */ + $strSQL = 'UPDATE `' . $strTable . "` SET `import_hash`='" . sha1($strRawString) . "' WHERE `id`='$intId'"; + return $this->dataInsert($strSQL, $intDataID); + } +} \ No newline at end of file diff --git a/functions/NagImportClass.php b/functions/NagImportClass.php index 5ae3a55..2617ba4 100644 --- a/functions/NagImportClass.php +++ b/functions/NagImportClass.php @@ -1,268 +1,265 @@ arrSettings = $arrSession['SETS']; } if (isset($arrSession['domain'])) { - $this->intDomainId = $arrSession['domain']; + $this->intDomainId = (int)$arrSession['domain']; } } /** * Import a config file and writes the values to the database - * @param string $strFileNameRaw Import file name - * @param int $intConfigId Configuration set id - * @param int $intOverwrite 0 = Do not replace existing data - * 1 = Replace existing data in tables - * @return int 0 = successful / 1 = error - * Status messages are stored in class variables + * @param string $strFileNameRaw Import file name + * @param int $intConfigId Configuration set id + * @param int $intOverwrite 0 = Do not replace existing data + * 1 = Replace existing data in tables + * @return int 0 = successful / 1 = error + * Status messages are stored in class variables */ - public function fileImport($strFileNameRaw, $intConfigId, $intOverwrite = 0) + public function fileImport(string $strFileNameRaw, int $intConfigId, int $intOverwrite = 0): int { - // Define variables - $intBlock = 0; - $intRemoveTmp = 0; - $strImportFile = ''; + /* Define variables */ + $intBlock = 0; + $intRemoveTmp = 0; + $strImportFile = ''; $strConfLineTemp = ''; - $strBlockKey = ''; - $arrData = array(); - $strFileName = trim($strFileNameRaw); - // Get file + $strBlockKey = ''; + $arrData = array(); + $strFileName = trim($strFileNameRaw); + /* Get file */ $intReturn = $this->getImportFile($intConfigId, $strFileName, $strImportFile, $intRemoveTmp); - // Open and read config file - if ($intReturn == 0) { - $resFile = fopen($strImportFile, 'rb'); + /* Open and read config file */ + if ($intReturn === 0) { + $resFile = fopen($strImportFile, 'rb'); $intMultiple = 0; while ($resFile && !feof($resFile)) { - // Read line and remove blank chars + /* Read line and remove blank chars */ $strConfLine = trim(fgets($resFile)); - // Process multi-line configuration instructions - if (substr($strConfLine, -1) == '\\') { - if ($intMultiple == 0) { + /* Process multi-line configuration instructions */ + if (substr($strConfLine, -1) === '\\') { + if ($intMultiple === 0) { $strConfLineTemp = str_replace("\\", ',', $strConfLine); - $intMultiple = 1; + $intMultiple = 1; } else { $strConfLineTemp .= str_replace("\\", ',', $strConfLine); } continue; } - if ($intMultiple == 1) { - $strConfLine = $strConfLineTemp.$strConfLine; + if ($intMultiple === 1) { + $strConfLine = $strConfLineTemp . $strConfLine; $intMultiple = 0; } - // Find NAGIOSQL variable - if (substr_count($strConfLine, '#NAGIOSQL_') != 0) { + /* Find NAGIOSQL variable */ + if (substr_count($strConfLine, '#NAGIOSQL_') !== 0) { $strConfLine = str_replace('#NAGIOSQL_CONFIG_NAME', '_NAGIOSQL_CONFIG_NAME', $strConfLine); } - // Pass comments and empty lines + /* Pass comments and empty lines */ if (0 === strpos($strConfLine, '#')) { continue; } - if ($strConfLine == '') { + if ($strConfLine === '') { continue; } - if (($intBlock == 1) && ($strConfLine == '{')) { + if (($intBlock === 1) && ($strConfLine === '{')) { continue; } - // Process line (remove blanks and cut comments) - $strLineTmp = str_replace("\;", ':semi:', $strConfLine); - $arrLine = preg_split("/[\s]+/", $strLineTmp); - $arrTemp = explode(';', implode(' ', $arrLine)); - $strNewLine = str_replace(':semi:', "\;", trim($arrTemp[0])); - // Find block begin - if ($arrLine[0] == 'define') { - $intBlock = 1; + /* Process line (remove blanks and cut comments) */ + $strLineTmp = str_replace("\;", ':semi:', $strConfLine); + $arrLine = preg_split("/\s+/", $strLineTmp); + $arrTemp = explode(';', implode(' ', $arrLine)); + $strNewLine = str_replace(':semi:', "\;", trim($arrTemp[0])); + /* Find block begin */ + if ($arrLine[0] === 'define') { + $intBlock = 1; $strBlockKey = str_replace('{', '', $arrLine[1]); - $arrData = array(); + $arrData = array(); continue; } - // Store the block data to an array - if (($intBlock == 1) && ($arrLine[0] != '}')) { + /* Store the block data to an array */ + if (($intBlock === 1) && ($arrLine[0] !== '}')) { $strExclude = 'template_name,alias,name,use'; - if (($strBlockKey == 'timeperiod') && (!\in_array($arrLine[0], explode(',', $strExclude), true))) { + if (($strBlockKey === 'timeperiod') && (!in_array($arrLine[0], explode(',', $strExclude), true))) { $arrNewLine = explode(' ', $strNewLine); - $strTPKey = str_replace(' ' .$arrNewLine[\count($arrNewLine)-1], '', $strNewLine); - $strTPValue = $arrNewLine[\count($arrNewLine)-1]; + $strTPKey = str_replace(' ' . $arrNewLine[count($arrNewLine) - 1], '', $strNewLine); + $strTPValue = $arrNewLine[count($arrNewLine) - 1]; $arrData[$strTPKey] = array('key' => $strTPKey, 'value' => $strTPValue); } else { - $key = $arrLine[0]; - $value = str_replace($arrLine[0]. ' ', '', $strNewLine); - // Special retry_check_interval, normal_check_interval - if ($key == 'retry_check_interval') { + $key = $arrLine[0]; + $value = str_replace($arrLine[0] . ' ', '', $strNewLine); + /* Special retry_check_interval, normal_check_interval */ + if ($key === 'retry_check_interval') { $key = 'retry_interval'; } - if ($key == 'normal_check_interval') { + if ($key === 'normal_check_interval') { $key = 'check_interval'; } $arrData[$arrLine[0]] = array('key' => $key, 'value' => $value); } } - // Process data at end of block - if ((substr_count($strConfLine, '}') == 1) && ($arrData !== null) && \is_array($arrData)) { - $intBlock = 0; + /* Process data at end of block */ + if ((substr_count($strConfLine, '}') === 1) && is_array($arrData)) { + $intBlock = 0; $intRetVal = $this->importTable($strBlockKey, $arrData, $intOverwrite); - if ($intRetVal != 0) { + if ($intRetVal !== 0) { $intReturn = 1; } } elseif ($arrData === null) { - $this->strErrorMessage .= translate('No valid configuration found:'). ' ' .$strFileName. '::'; + $this->strErrorMessage .= translate('No valid configuration found:') . ' ' . $strFileName . '::'; $intReturn = 1; } } - if ($intRemoveTmp == 1) { + if ($intRemoveTmp === 1) { unlink($strImportFile); } } else { - $this->strErrorMessage .= translate('Import file does not exist or is not readable:'). ' ' .$strFileName + $this->strErrorMessage .= translate('Import file does not exist or is not readable:') . ' ' . $strFileName . '::'; $intReturn = 1; } return $intReturn; } - // PRIVATE functions - + /* PRIVATE functions */ /** - * @param int $intConfigId Configuration set id - * @param string $strFileName Configuration file name - * @param string|bool $strImportFile Temporary file for data import (by reference) - * @param int $intRemoveTmp Remove temporary file (1 = yes / 0 = no) (by reference) - * @return int 0 = successful / 1 = error - * Status messages are stored in class variables + * @param int $intConfigId Configuration set id + * @param string $strFileName Configuration file name + * @param string $strImportFile Temporary file for data import (by reference) + * @param int $intRemoveTmp Remove temporary file (1 = yes / 0 = no) (by reference) + * @return int 0 = successful / 1 = error + * Status messages are stored in class variables */ - private function getImportFile($intConfigId, $strFileName, &$strImportFile, &$intRemoveTmp) + private function getImportFile(int $intConfigId, string $strFileName, string &$strImportFile, int &$intRemoveTmp): int { - $intMethod = 1; - $intReturn = 0; - $intRemoveTmp = 0; - $strImportFile = ''; + $intMethod = 1; + $intReturn = 0; + $intRemoveTmp = 0; + $strImportFile = ''; $strImportFileTmp = ''; - // File transfer method - if (substr_count($strFileName, 'nagiosql_local_imp') == 1) { + $strConfigValue = ''; + /* File transfer method */ + if (substr_count($strFileName, 'nagiosql_local_imp') === 1) { $intMethod = 1; $intRetVal = 0; } else { - $intRetVal = $this->myConfigClass->getConfigData($intConfigId, 'method', $intMethod); + $intRetVal = $this->myConfigClass->getConfigData($intConfigId, 'method', $strConfigValue); + $intMethod = (int)$strConfigValue; } - if ($intRetVal != 0) { - $this->strErrorMessage .= translate('Unable to get configuration data:'). ' method::'; + if ($intRetVal !== 0) { + $this->strErrorMessage .= translate('Unable to get configuration data:') . ' method::'; $intReturn = 1; } - if ($intReturn == 0) { - // Read import file - if ($intMethod == 1) { // Local file system + if ($intReturn === 0) { + /* Read import file */ + if ($intMethod === 1) { /* Local file system */ if (!is_readable($strFileName)) { - $this->strErrorMessage .= translate('Cannot open the data file (check the permissions)!'). ' ' . - $strFileName. '::'; + $this->strErrorMessage .= translate('Cannot open the data file (check the permissions)!') . ' ' . + $strFileName . '::'; $intReturn = 1; } else { $strImportFileTmp = $strFileName; } - } elseif ($intMethod == 2) { // FTP access - // Open ftp connection + } elseif ($intMethod === 2) { /* FTP access */ + /* Open ftp connection */ $intRetVal = $this->myConfigClass->getFTPConnection($intConfigId); - if ($intRetVal != 0) { + if ($intRetVal !== 0) { $this->strErrorMessage .= $this->myConfigClass->strErrorMessage; $intReturn = 1; } else { - // Transfer file from remote server to a local temp file - if (isset($this->arrSettings['path']) && isset($this->arrSettings['path']['tempdir'])) { + /* Transfer file from remote server to a local temp file */ + if (isset($this->arrSettings['path']['tempdir'])) { $strConfigFile = tempnam($this->arrSettings['path']['tempdir'], 'nagiosql_imp'); } else { $strConfigFile = tempnam(sys_get_temp_dir(), 'nagiosql_imp'); } - if (!ftp_get($this->myConfigClass->resConnectId, $strConfigFile, $strFileName, FTP_ASCII)) { - $this->strErrorMessage .= translate('Cannot receive the configuration file (FTP connection)!'). + if (!ftp_get($this->myConfigClass->conFTPConId, $strConfigFile, $strFileName, FTP_ASCII)) { + $this->strErrorMessage .= translate('Cannot receive the configuration file (FTP connection)!') . '::'; - ftp_close($this->myConfigClass->resConnectId); + ftp_close($this->myConfigClass->conFTPConId); $intReturn = 1; } else { - $intRemoveTmp = 1; + $intRemoveTmp = 1; $strImportFileTmp = $strConfigFile; } } - } elseif ($intMethod == 3) { // SSH Access - // Open ssh connection + } elseif ($intMethod === 3) { /* SSH Access */ + /* Open ssh connection */ $intRetVal = $this->myConfigClass->getSSHConnection($intConfigId); - if ($intRetVal != 0) { + if ($intRetVal !== 0) { $this->strErrorMessage .= $this->myConfigClass->strErrorMessage; $intReturn = 1; } else { - // Transfer file from remote server to a local temp file - if (isset($this->arrSettings['path']) && isset($this->arrSettings['path']['tempdir'])) { + /* Transfer file from remote server to a local temp file */ + if (isset($this->arrSettings['path']['tempdir'])) { $strConfigFile = tempnam($this->arrSettings['path']['tempdir'], 'nagiosql_imp'); } else { $strConfigFile = tempnam(sys_get_temp_dir(), 'nagiosql_imp'); } - if (!ssh2_scp_recv($this->myConfigClass->resConnectId, $strFileName, $strConfigFile)) { - $this->strErrorMessage .= translate('Cannot receive the configuration file (SSH connection)!'). + if (!ssh2_scp_recv($this->myConfigClass->resSSHConId, $strFileName, $strConfigFile)) { + $this->strErrorMessage .= translate('Cannot receive the configuration file (SSH connection)!') . '::'; $intReturn = 1; } else { - $intRemoveTmp = 1; + $intRemoveTmp = 1; $strImportFileTmp = $strConfigFile; } } } - // Open and read config file + /* Open and read config file */ if (file_exists($strImportFileTmp) && is_readable($strImportFileTmp)) { - $strImportFile = $strImportFileTmp; + $strImportFile = (string)$strImportFileTmp; } else { - $intReturn = 1; + $intReturn = 1; $intRemoveTmp = 0; } } @@ -271,92 +268,101 @@ class NagImportClass /** * Writes the block data to the database - * @param string $strBlockKey Config key (from define) - * @param array $arrImportData Imported block data - * @param int $intOverwrite 0 = Do not replace existing data - * 1 = Replace existing data in tables - * @return int 0 = successful / 1 = error - * Status messages are stored in class variables + * @param string $strBlockKey Config key (from define) + * @param array $arrImportData Imported block data + * @param int $intOverwrite 0 = Do not replace existing data + * 1 = Replace existing data in tables + * @return int 0 = successful / 1 = error + * Status messages are stored in class variables */ - private function importTable($strBlockKey, $arrImportData, $intOverwrite) + private function importTable(string $strBlockKey, array $arrImportData, int $intOverwrite): int { - // Define variables - $intIsTemplate = 0; - $intExists = 0; + /* Define variables */ + $intIsTemplate = 0; + $intExists = 0; $intInsertRelations = 0; $intInsertVariables = 0; - $strHash = ''; - $strConfigName = ''; + $strHash = ''; + $strConfigName = ''; $arrImportRelations = array(); - $arrFreeVariables = array(); - $arrRelations = array(); - // Block data from template or real configuration? + $arrFreeVariables = array(); + $arrRelations = array(); + $strTable = ''; + $strKeyField = ''; + /* Block data from template or real configuration? */ if (array_key_exists('name', $arrImportData) && (isset($arrImportData['register']) && - ($arrImportData['register']['value'] == 0))) { + ((int)$arrImportData['register']['value'] === 0))) { $intIsTemplate = 1; } - // Get table name and key for import + /* Get table name and key for import */ $intReturn = $this->getTableData($strBlockKey, $intIsTemplate, $strTable, $strKeyField); - if ($intReturn == 0) { - // Create an import hash if no key field is available - if ($strKeyField == '') { + if ($intReturn === 0) { + /* Create an import hash if no key field is available */ + if ($strKeyField === '') { $this->createHash($strTable, $arrImportData, $strHash, $strConfigName); - $arrImportData['config_name']['key'] = 'config_name'; - $arrImportData['config_name']['value'] = $strConfigName; + $arrImportData['config_name']['key'] = 'config_name'; + $arrImportData['config_name']['value'] = $strConfigName; $strKeyField = 'config_name'; } else { $strHash = ''; } - // Get relation data + /* Get relation data */ $intRelation = $this->myDataClass->tableRelations($strTable, $arrRelations); - // Does this entry already exist? - if (($intIsTemplate == 0) && ($strKeyField != '') && isset($arrImportData[$strKeyField])) { - if ($strHash == '') { - // Special key field values - if ($strBlockKey == 'hostextinfo') { - $strSQL = 'SELECT `id`FROM `tbl_host` ' . - "WHERE `host_name`='".$arrImportData[$strKeyField]['value']."'"; + /* Does this entry already exist? */ + if (($intIsTemplate === 0) && ($strKeyField !== '') && isset($arrImportData[$strKeyField])) { + if ($strHash === '') { + /* Special key field values */ + if ($strBlockKey === 'hostextinfo') { + $strSQL = 'SELECT `id`FROM `tbl_host` ' . + "WHERE `host_name`='" . $arrImportData[$strKeyField]['value'] . "'"; $intHost = (int)$this->myDBClass->getFieldData($strSQL); - $strSQL = 'SELECT `id` FROM `' .$strTable. '` ' . - 'WHERE `config_id`=' .$this->intDomainId. ' AND `' .$strKeyField."`='".$intHost."'"; + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $strTable . '` ' . + 'WHERE `config_id`=' . $this->intDomainId . ' AND `' . $strKeyField . "`='" . $intHost . "'"; } else { - $strSQL = 'SELECT `id` FROM `' .$strTable. '` ' . - 'WHERE `config_id`=' .$this->intDomainId. ' AND ' . - '`' .$strKeyField."`='".$arrImportData[$strKeyField]['value']."'"; + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $strTable . '` ' . + 'WHERE `config_id`=' . $this->intDomainId . ' AND ' . + '`' . $strKeyField . "`='" . $arrImportData[$strKeyField]['value'] . "'"; } } else { - $strSQL = 'SELECT `id` FROM `' .$strTable. '` ' . - 'WHERE `config_id`=' .$this->intDomainId." AND `import_hash`='".$strHash."'"; + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $strTable . '` ' . + 'WHERE `config_id`=' . $this->intDomainId . " AND `import_hash`='" . $strHash . "'"; } $intExists = $this->myDBClass->getFieldData($strSQL); - if ($intExists == false) { + if ($intExists === '') { $intExists = 0; } - } elseif (($intIsTemplate == 1) && ($strKeyField != '') && isset($arrImportData['name'])) { - $strSQL = 'SELECT `id` FROM `' .$strTable. '` ' . - 'WHERE `config_id`=' .$this->intDomainId. ' AND ' . - "`template_name`='".$arrImportData['name']['value']."'"; + } elseif (($intIsTemplate === 1) && ($strKeyField !== '') && isset($arrImportData['name'])) { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $strTable . '` ' . + 'WHERE `config_id`=' . $this->intDomainId . ' AND ' . + "`template_name`='" . $arrImportData['name']['value'] . "'"; $intExists = $this->myDBClass->getFieldData($strSQL); - if ($intExists == false) { + if ($intExists === '') { $intExists = 0; } } - // Entry exsists but should not be overwritten - if (($intExists != 0) && ($intOverwrite == 0)) { - if ($strKeyField == 'config_name') { - $strSQLConfig = 'SELECT `config_name` FROM `' .$strTable. '` WHERE `id`=' .$intExists; + /* Entry exsists but should not be overwritten */ + if (($intExists !== 0) && ($intOverwrite === 0)) { + if ($strKeyField === 'config_name') { + /** @noinspection SqlResolve */ + $strSQLConfig = 'SELECT `config_name` FROM `' . $strTable . '` WHERE `id`=' . $intExists; $arrImportData[$strKeyField]['value'] = $this->myDBClass->getFieldData($strSQLConfig); } - $this->strInfoMessage .= translate('Entry'). ' ' .$strKeyField. ' -> ' . - $arrImportData[$strKeyField]['value']. ' ' .translate('inside'). ' ' . - $strTable. ' ' .translate('exists and were not overwritten'). '::'; - } elseif (isset($arrImportData[$strKeyField]) && ($arrImportData[$strKeyField] == '*')) { - // Do not write "*" values - $this->strInfoMessage .= translate('Entry'). ' ' .$strKeyField. ' -> ' . - $arrImportData[$strKeyField]['value']. ' ' .translate('inside'). ' ' . - $strTable. ' ' .translate('were not written'). '::'; + $this->strInfoMessage .= translate('Entry') . ' ' . $strKeyField . ' -> ' . + $arrImportData[$strKeyField]['value'] . ' ' . translate('inside') . ' ' . + $strTable . ' ' . translate('exists and were not overwritten') . '::'; + } elseif (isset($arrImportData[$strKeyField]) && ($arrImportData[$strKeyField] === '*')) { + /* Do not write "*" values */ + $this->strInfoMessage .= translate('Entry') . ' ' . $strKeyField . ' -> ' . + $arrImportData[$strKeyField]['value'] . ' ' . translate('inside') . ' ' . + $strTable . ' ' . translate('were not written') . '::'; } else { - // Define SQL statement - part 1 + $strSQL1 = ''; + $strSQL2 = ''; + /* Define SQL statement - part 1 */ $this->getSQLPart1( $arrImportData, $strHash, @@ -368,15 +374,15 @@ class NagImportClass $strSQL1, $strSQL2 ); - // Read command configurations - list($strVCValues, $intWriteConfig, $strVIValues, $strRLValues, $strVWValues) = + /* Read command configurations */ + [$strVCValues, $intWriteConfig, $strVIValues, $strRLValues, $strVWValues] = $this->getImportValues($arrImportData, $strKeyField, $strSQL1, $strTable); - // Build value statemets + /* Build value statemets */ foreach ($arrImportData as $elem) { - // Write text values - $intCheckVC = $this->writeTextValues( + /* Write text values */ + $intCheckVC = $this->writeTextValues( $elem, $strVCValues, $strSQL1, @@ -384,76 +390,76 @@ class NagImportClass $intExists, $strTable ); - // Write status values - $intCheckVI = $this->writeStatusValues($elem, $strVIValues, $strSQL1); - // Write integer values - $intCheckVW = $this->writeIntegerValues($elem, $strVWValues, $strSQL1); - // Write relations + /* Write status values */ + $intCheckVI = $this->writeStatusValues($elem, $strVIValues, $strSQL1); + /* Write integer values */ + $intCheckVW = $this->writeIntegerValues($elem, $strVWValues, $strSQL1); + /* Write relations */ $intCheckRel = $this->writeRelations($elem, $strRLValues, $arrImportRelations, $intInsertRelations); - // Write free variables - $intCheck = $intCheckVC+$intCheckVI+$intCheckVW+$intCheckRel; - if ($intCheck == 0) { - $arrTemp = array(); - $arrTemp['key'] = $elem['key']; - $arrTemp['value'] = $elem['value']; + /* Write free variables */ + $intCheck = $intCheckVC + $intCheckVI + $intCheckVW + $intCheckRel; + if ($intCheck === 0) { + $arrTemp = array(); + $arrTemp['key'] = $elem['key']; + $arrTemp['value'] = $elem['value']; $arrFreeVariables[] = $arrTemp; $intInsertVariables = 1; } } $strTemp1 = ''; $strTemp2 = ''; - // Update database - if ($intWriteConfig == 1) { - $booResult = $this->myDBClass->insertData($strSQL1.$strSQL2); + /* Update database */ + if ($intWriteConfig === 1) { + $booResult = $this->myDBClass->insertData($strSQL1 . $strSQL2); } else { $booResult = false; } - if ($strKeyField == '') { + if ($strKeyField === '') { $strKey = $strConfigName; } else { $strKey = $strKeyField; } - if ($booResult != true) { + if ($booResult !== true) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; - if ($strKeyField != '') { - $this->strErrorMessage .= translate('Entry'). ' ' .$strKey. ' -> ' . - $arrImportData[$strKeyField]['value']. ' ' .translate('inside'). - ' ' .$strTable. ' ' .translate('could not be inserted:'). ' ' . - $this->myDBClass->strErrorMessage. '::'; + if ($strKeyField !== '') { + $this->strErrorMessage .= translate('Entry') . ' ' . $strKey . ' -> ' . + $arrImportData[$strKeyField]['value'] . ' ' . translate('inside') . + ' ' . $strTable . ' ' . translate('could not be inserted:') . ' ' . + $this->myDBClass->strErrorMessage . '::'; } - if ($strKeyField == '') { - $this->strErrorMessage .= translate('Entry'). ' ' .$strTemp1. ' -> ' . - $strTemp2.translate('inside'). ' ' .$strTable. ' ' .$strTable. - ' ' .translate('could not be inserted:'). ' ' .$this->myDBClass->strErrorMessage. '::'; + if ($strKeyField === '') { + $this->strErrorMessage .= translate('Entry') . ' ' . $strTemp1 . ' -> ' . + $strTemp2 . translate('inside') . ' ' . $strTable . ' ' . $strTable . + ' ' . translate('could not be inserted:') . ' ' . $this->myDBClass->strErrorMessage . '::'; } return 1; } - if ($strKeyField != '') { - $this->strInfoMessage .= translate('Entry'). ' ' .$strKey. ' -> ' . - $arrImportData[$strKeyField]['value']. ' ' .translate('inside'). - ' ' .$strTable. ' ' .translate('successfully inserted'). '::'; + if ($strKeyField !== '') { + $this->strInfoMessage .= translate('Entry') . ' ' . $strKey . ' -> ' . + $arrImportData[$strKeyField]['value'] . ' ' . translate('inside') . + ' ' . $strTable . ' ' . translate('successfully inserted') . '::'; } - if ($strKeyField == '') { - $this->strInfoMessage .= translate('Entry'). ' ' .$strTemp1. ' -> ' . - $strTemp2. ' ' .translate('inside'). ' ' .$strTable. - ' ' .translate('successfully inserted'). '::'; + if ($strKeyField === '') { + $this->strInfoMessage .= translate('Entry') . ' ' . $strTemp1 . ' -> ' . + $strTemp2 . ' ' . translate('inside') . ' ' . $strTable . + ' ' . translate('successfully inserted') . '::'; } - // Define data ID - if ($intExists != 0) { + /* Define data ID */ + if ($intExists !== 0) { $intDataId = $intExists; } else { $intDataId = $this->myDBClass->intLastId; } - // Are there any relations to be filled in? - if ($intInsertRelations == 1) { + /* Are there any relations to be filled in? */ + if ($intInsertRelations === 1) { foreach ($arrImportRelations as $elem) { foreach ($arrRelations as $reldata) { - if ($reldata['fieldName'] == $elem['key']) { + if ($reldata['fieldName'] === $elem['key']) { $strValue = $elem['value']; - $strKey = $elem['key']; - if ($elem['key'] == 'check_command') { + $strKey = $elem['key']; + if ($elem['key'] === 'check_command') { $this->writeRelation5($strValue, $intDataId, $strTable, $reldata); - } elseif ($reldata['type'] == 1) { + } elseif ((int)$reldata['type'] === 1) { $this->writeRelation1( $strKey, $strValue, @@ -462,58 +468,61 @@ class NagImportClass $reldata, $arrImportData ); - } elseif ($reldata['type'] == 2) { + } elseif ((int)$reldata['type'] === 2) { $this->writeRelation2($strKey, $strValue, $intDataId, $strTable, $reldata); - } elseif ($reldata['type'] == 3) { + } elseif ((int)$reldata['type'] === 3) { $this->writeRelation3($strValue, $intDataId, $strTable, $reldata); - } elseif ($reldata['type'] == 4) { - $this->writeRelation4($strKey, $strValue, $intDataId, $strTable, $reldata); - } elseif ($reldata['type'] == 5) { + } elseif ((int)$reldata['type'] === 4) { + $this->writeRelation4($strKey, $strValue, $intDataId, 0, $strTable, $reldata); + } elseif ((int)$reldata['type'] === 5) { $this->writeRelation6($strValue, $intDataId, $strTable, $reldata); - } elseif ($reldata['type'] == 6) { + } elseif ((int)$reldata['type'] === 6) { $this->writeRelation7($strValue, $intDataId, $strTable, $reldata); - } elseif ($reldata['type'] == 7) { + } elseif ((int)$reldata['type'] === 7) { $this->writeRelation8($strValue, $intDataId, $strTable, $reldata); } } } } } - // Are there any free variables ore time definitions to be filled in? - if ($intInsertVariables == 1) { - if ($strTable == 'tbl_timeperiod') { - // Remove old values - $strSQL = "DELETE FROM `tbl_timedefinition` WHERE `tipId` = $intDataId"; + /* Are there any free variables ore time definitions to be filled in? */ + if ($intInsertVariables === 1) { + if ($strTable === 'tbl_timeperiod') { + /* Remove old values */ + $strSQL = "DELETE FROM `tbl_timedefinition` WHERE `tipId` = $intDataId"; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } foreach ($arrFreeVariables as $elem) { - $strSQL = "INSERT INTO `tbl_timedefinition` SET `tipId` = $intDataId, ". - "`definition` = '".addslashes($elem['key'])."', ". - "`range` = '".addslashes($elem['value'])."'"; + $strSQL = "INSERT INTO `tbl_timedefinition` SET `tipId` = $intDataId, " . + "`definition` = '" . addslashes($elem['key']) . "', " . + "`range` = '" . addslashes($elem['value']) . "'"; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } } } else { + $intRemoveOldVariables = 1; foreach ($arrFreeVariables as $elem) { foreach ($arrRelations as $reldata) { - if ($reldata['type'] == 4) { + if ((int)$reldata['type'] === 4) { $this->writeRelation4( $elem['key'], $elem['value'], $intDataId, + $intRemoveOldVariables, $strTable, $reldata ); + $intRemoveOldVariables = 0; } } } } } - // Update Table times + /* Update Table times */ $this->myDataClass->updateStatusTable($strTable); } } @@ -522,46 +531,45 @@ class NagImportClass /** * Get table name and key for import - * @param string $strBlockKey Block data key - * @param int $intIsTemplate Template data 1 = yes / 0 - no - * @param string $strTable Template name - * @param string $strKeyField Table key name - * @return int 0 = successful / 1 = error + * @param string $strBlockKey Block data key + * @param int $intIsTemplate Template data 1 = yes / 0 - no + * @param string $strTable Template name + * @param string $strKeyField Table key name + * @return int 0 = successful / 1 = error */ - private function getTableData($strBlockKey, $intIsTemplate, &$strTable, &$strKeyField) + private function getTableData(string $strBlockKey, int $intIsTemplate, string &$strTable, string &$strKeyField): int { - // Define variables + /* Define variables */ $intReturn = 0; - $arrTableData['command'] = array('tbl_command', 'command_name'); - $arrTableData['contactgroup'] = array('tbl_contactgroup', 'contactgroup_name'); - $arrTableData['contact'] = array('tbl_contact', 'contact_name'); - $arrTableData['timeperiod'] = array('tbl_timeperiod', 'timeperiod_name'); - $arrTableData['host'] = array('tbl_host', 'host_name'); - $arrTableData['service'] = array('tbl_service', ''); - $arrTableData['hostgroup'] = array('tbl_hostgroup', 'hostgroup_name'); - $arrTableData['servicegroup'] = array('tbl_servicegroup', 'servicegroup_name'); - $arrTableData['hostescalation'] = array('tbl_hostescalation', ''); - $arrTableData['serviceescalation'] = array('tbl_serviceescalation', ''); - $arrTableData['hostdependency'] = array('tbl_hostdependency', ''); - $arrTableData['servicedependency'] = array('tbl_servicedependency', ''); - $arrTableData['hostextinfo'] = array('tbl_hostextinfo', 'host_name'); - $arrTableData['serviceextinfo'] = array('tbl_serviceextinfo', ''); - $arrTableData['contactgroup'] = array('tbl_contactgroup', 'contactgroup_name'); - $arrTableDataTpl['contact'] = array('tbl_contacttemplate', 'name'); - $arrTableDataTpl['host'] = array('tbl_hosttemplate', 'name'); - $arrTableDataTpl['service'] = array('tbl_servicetemplate', 'name'); + $arrTableData['command'] = array('tbl_command', 'command_name'); + $arrTableData['contactgroup'] = array('tbl_contactgroup', 'contactgroup_name'); + $arrTableData['contact'] = array('tbl_contact', 'contact_name'); + $arrTableData['timeperiod'] = array('tbl_timeperiod', 'timeperiod_name'); + $arrTableData['host'] = array('tbl_host', 'host_name'); + $arrTableData['service'] = array('tbl_service', ''); + $arrTableData['hostgroup'] = array('tbl_hostgroup', 'hostgroup_name'); + $arrTableData['servicegroup'] = array('tbl_servicegroup', 'servicegroup_name'); + $arrTableData['hostescalation'] = array('tbl_hostescalation', ''); + $arrTableData['serviceescalation'] = array('tbl_serviceescalation', ''); + $arrTableData['hostdependency'] = array('tbl_hostdependency', ''); + $arrTableData['servicedependency'] = array('tbl_servicedependency', ''); + $arrTableData['hostextinfo'] = array('tbl_hostextinfo', 'host_name'); + $arrTableData['serviceextinfo'] = array('tbl_serviceextinfo', ''); + $arrTableDataTpl['contact'] = array('tbl_contacttemplate', 'name'); + $arrTableDataTpl['host'] = array('tbl_hosttemplate', 'name'); + $arrTableDataTpl['service'] = array('tbl_servicetemplate', 'name'); - // Define table name and key - if (($intIsTemplate == 0) && isset($arrTableData[$strBlockKey])) { - $strTable = $arrTableData[$strBlockKey][0]; + /* Define table name and key */ + if (($intIsTemplate === 0) && isset($arrTableData[$strBlockKey])) { + $strTable = $arrTableData[$strBlockKey][0]; /** @noinspection MultiAssignmentUsageInspection */ $strKeyField = $arrTableData[$strBlockKey][1]; - } elseif (($intIsTemplate == 1) && isset($arrTableDataTpl[$strBlockKey])) { - $strTable = $arrTableDataTpl[$strBlockKey][0]; + } elseif (($intIsTemplate === 1) && isset($arrTableDataTpl[$strBlockKey])) { + $strTable = $arrTableDataTpl[$strBlockKey][0]; /** @noinspection MultiAssignmentUsageInspection */ - $strKeyField = $arrTableDataTpl[$strBlockKey][1]; + $strKeyField = $arrTableDataTpl[$strBlockKey][1]; } else { - $this->strErrorMessage .= translate('Table for import definition').$strBlockKey. + $this->strErrorMessage .= translate('Table for import definition') . $strBlockKey . translate('is not available!') . '::'; $intReturn = 1; } @@ -570,206 +578,210 @@ class NagImportClass /** * Create a unique data hash from table data - * @param $strTable - * @param $arrBlockData - * @param $strHash - * @param $strConfigName + * @param string $strTable + * @param array $arrBlockData + * @param string $strHash + * @param string $strConfigName */ - public function createHash($strTable, $arrBlockData, &$strHash, &$strConfigName) + public function createHash(string $strTable, array $arrBlockData, string &$strHash, string &$strConfigName): void { - $strRawString = ''; + $strRawString = ''; $strConfigName = 'imp_temporary'; - if ($strTable == 'tbl_service') { - // HASH from any host, any hostgroup and service description - step 1 + if ($strTable === 'tbl_service') { + /* HASH from any host, any hostgroup and service description - step 1 */ if (isset($arrBlockData['host_name'])) { - $strRawString .= $arrBlockData['host_name']['value']. ','; + $strRawString .= $arrBlockData['host_name']['value'] . ','; } if (isset($arrBlockData['hostgroup_name'])) { - $strRawString .= $arrBlockData['hostgroup_name']['value']. ','; + $strRawString .= $arrBlockData['hostgroup_name']['value'] . ','; } - // Replace *, + and ! in HASH raw string + /* Replace *, + and ! in HASH raw string */ $strRawString = str_replace(array('*,', '!', '+'), array('any,', 'not_', ''), $strRawString); - // Create configuration name from NagiosQL variable if exists + /* Create configuration name from NagiosQL variable if exists */ if (isset($arrBlockData['_NAGIOSQL_CONFIG_NAME'])) { - $strConfigName = $arrBlockData['_NAGIOSQL_CONFIG_NAME']['value']; + $strConfigName = $arrBlockData['_NAGIOSQL_CONFIG_NAME']['value']; } else { - // Create configuration name from first two hosts / hostgroups - $arrConfig = explode(',', $strRawString); - if (isset($arrConfig[0]) && ($arrConfig[0] != '')) { - $strConfigName = 'imp_' .$arrConfig[0]; + /* Create configuration name from first two hosts / hostgroups */ + $arrConfig = explode(',', $strRawString); + if (isset($arrConfig[0]) && ($arrConfig[0] !== '')) { + $strConfigName = 'imp_' . $arrConfig[0]; } - if (isset($arrConfig[1]) && ($arrConfig[1] != '')) { - $strConfigName .= '_' .$arrConfig[1]; + if (isset($arrConfig[1]) && ($arrConfig[1] !== '')) { + $strConfigName .= '_' . $arrConfig[1]; } } - // HASH from any host, any hostgroup and service description - step 2 + /* HASH from any host, any hostgroup and service description - step 2 */ if (isset($arrBlockData['service_description'])) { - $strRawString .= $arrBlockData['service_description']['value']. ','; + $strRawString .= $arrBlockData['service_description']['value'] . ','; } if (isset($arrBlockData['display_name'])) { - $strRawString .= $arrBlockData['display_name']['value']. ','; + $strRawString .= $arrBlockData['display_name']['value'] . ','; } if (isset($arrBlockData['check_command'])) { - $strRawString .= $arrBlockData['check_command']['value']. ','; + $strRawString .= $arrBlockData['check_command']['value'] . ','; } } - if (($strTable == 'tbl_hostdependency') || ($strTable == 'tbl_servicedependency')) { + if (($strTable === 'tbl_hostdependency') || ($strTable === 'tbl_servicedependency')) { $strRawString1 = ''; $strRawString2 = ''; $strRawString3 = ''; - // HASH from any dependent host and any dependent hostgroup + /* HASH from any dependent host and any dependent hostgroup */ if (isset($arrBlockData['dependent_host_name'])) { - $strRawString1 .= $arrBlockData['dependent_host_name']['value']. ','; + $strRawString1 .= $arrBlockData['dependent_host_name']['value'] . ','; } if (isset($arrBlockData['dependent_hostgroup_name'])) { - $strRawString1 .= $arrBlockData['dependent_hostgroup_name']['value']. ','; + $strRawString1 .= $arrBlockData['dependent_hostgroup_name']['value'] . ','; } if (isset($arrBlockData['host_name'])) { - $strRawString2 .= $arrBlockData['host_name']['value']. ','; + $strRawString2 .= $arrBlockData['host_name']['value'] . ','; } if (isset($arrBlockData['hostgroup_name'])) { - $strRawString2 .= $arrBlockData['hostgroup_name']['value']. ','; + $strRawString2 .= $arrBlockData['hostgroup_name']['value'] . ','; } if (isset($arrBlockData['dependent_service_description'])) { - $strRawString3 .= $arrBlockData['dependent_service_description']['value']. ','; + $strRawString3 .= $arrBlockData['dependent_service_description']['value'] . ','; } if (isset($arrBlockData['service_description'])) { - $strRawString3 .= $arrBlockData['service_description']['value']. ','; + $strRawString3 .= $arrBlockData['service_description']['value'] . ','; } if (isset($arrBlockData['dependent_servicegroup_name'])) { - $strRawString3 .= $arrBlockData['dependent_servicegroup_name']['value']. ','; + $strRawString3 .= $arrBlockData['dependent_servicegroup_name']['value'] . ','; } if (isset($arrBlockData['servicegroup_name'])) { - $strRawString3 .= $arrBlockData['servicegroup_name']['value']. ','; + $strRawString3 .= $arrBlockData['servicegroup_name']['value'] . ','; } - // Replace *, + and ! in HASH raw string + /* Replace *, + and ! in HASH raw string */ $strRawString1 = str_replace('*,', 'any,', $strRawString1); $strRawString2 = str_replace('*,', 'any,', $strRawString2); $strRawString3 = str_replace('*,', 'any,', $strRawString3); $strRawString1 = str_replace('!', 'not_', $strRawString1); $strRawString2 = str_replace('!', 'not_', $strRawString2); $strRawString3 = str_replace('!', 'not_', $strRawString3); - // Create configuration name from NagiosQL variable if exists + /* Create configuration name from NagiosQL variable if exists */ if (isset($arrBlockData['_NAGIOSQL_CONFIG_NAME'])) { - $strConfigName = $arrBlockData['_NAGIOSQL_CONFIG_NAME']['value']; + $strConfigName = $arrBlockData['_NAGIOSQL_CONFIG_NAME']['value']; } else { - $arrConfig1 = explode(',', $strRawString1); - $arrConfig2 = explode(',', $strRawString2); - $arrConfig3 = explode(',', $strRawString3); + $arrConfig1 = explode(',', $strRawString1); + $arrConfig2 = explode(',', $strRawString2); + $arrConfig3 = explode(',', $strRawString3); if (isset($arrConfig1[0])) { - $strConfigName = 'imp_' .$arrConfig1[0]; + $strConfigName = 'imp_' . $arrConfig1[0]; } if (isset($arrConfig2[0])) { - $strConfigName .= '_' .$arrConfig2[0]; + $strConfigName .= '_' . $arrConfig2[0]; } if (isset($arrConfig3[0])) { - $strConfigName .= '_' .$arrConfig3[0]; + $strConfigName .= '_' . $arrConfig3[0]; } - $strSQL = 'SELECT * FROM `' .$strTable."` WHERE `config_name`='$strConfigName'"; - $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); - if ($booRet && ($intDC != 0)) { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $strTable . "` WHERE `config_name`='$strConfigName'"; + $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); + if ($booRet && ($intDC !== 0)) { $intCounter = 1; do { - $strConfigNameTemp = $strConfigName. '_' .$intCounter; - $strSQL = 'SELECT * FROM `' .$strTable."` WHERE `config_name`='$strConfigNameTemp'"; - $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); + $strConfigNameTemp = $strConfigName . '_' . $intCounter; + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $strTable . "` WHERE `config_name`='$strConfigNameTemp'"; + $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); $intCounter++; - } while ($booRet && ($intDC != 0)); + } while ($booRet && ($intDC !== 0)); $strConfigName = $strConfigNameTemp; } } - // HASH string - $strRawString = $strRawString1.$strRawString2.$strRawString3; + /* HASH string */ + $strRawString = $strRawString1 . $strRawString2 . $strRawString3; $strRawString = substr($strRawString, 0, -1); } - if (($strTable == 'tbl_hostescalation') || ($strTable == 'tbl_serviceescalation')) { + if (($strTable === 'tbl_hostescalation') || ($strTable === 'tbl_serviceescalation')) { $strRawString1 = ''; $strRawString2 = ''; $strRawString3 = ''; - // HASH from any host and any hostgroup + /* HASH from any host and any hostgroup */ if (isset($arrBlockData['host_name'])) { - $strRawString1 .= $arrBlockData['host_name']['value']. ','; + $strRawString1 .= $arrBlockData['host_name']['value'] . ','; } if (isset($arrBlockData['hostgroup_name'])) { - $strRawString1 .= $arrBlockData['hostgroup_name']['value']. ','; + $strRawString1 .= $arrBlockData['hostgroup_name']['value'] . ','; } if (isset($arrBlockData['contacts'])) { - $strRawString2 .= $arrBlockData['contacts']['value']. ','; + $strRawString2 .= $arrBlockData['contacts']['value'] . ','; } if (isset($arrBlockData['contact_groups'])) { - $strRawString2 .= $arrBlockData['contact_groups']['value']. ','; + $strRawString2 .= $arrBlockData['contact_groups']['value'] . ','; } if (isset($arrBlockData['service_description'])) { - $strRawString3 .= $arrBlockData['service_description']['value']. ','; + $strRawString3 .= $arrBlockData['service_description']['value'] . ','; } - // Replace *, + and ! in HASH raw string + /* Replace *, + and ! in HASH raw string */ $strRawString1 = str_replace('*,', 'any,', $strRawString1); $strRawString2 = str_replace('*,', 'any,', $strRawString2); $strRawString3 = str_replace('*,', 'any,', $strRawString3); $strRawString1 = str_replace('!', 'not_', $strRawString1); $strRawString2 = str_replace('!', 'not_', $strRawString2); $strRawString3 = str_replace('!', 'not_', $strRawString3); - // Create configuration name from NagiosQL variable if exists + /* Create configuration name from NagiosQL variable if exists */ if (isset($arrBlockData['_NAGIOSQL_CONFIG_NAME'])) { - $strConfigName = $arrBlockData['_NAGIOSQL_CONFIG_NAME']['value']; + $strConfigName = $arrBlockData['_NAGIOSQL_CONFIG_NAME']['value']; } else { - $arrConfig1 = explode(',', $strRawString1); - $arrConfig2 = explode(',', $strRawString2); - $arrConfig3 = explode(',', $strRawString3); + $arrConfig1 = explode(',', $strRawString1); + $arrConfig2 = explode(',', $strRawString2); + $arrConfig3 = explode(',', $strRawString3); if (isset($arrConfig1[0])) { - $strConfigName = 'imp_' .$arrConfig1[0]; + $strConfigName = 'imp_' . $arrConfig1[0]; } if (isset($arrConfig2[0])) { - $strConfigName .= '_' .$arrConfig2[0]; + $strConfigName .= '_' . $arrConfig2[0]; } if (isset($arrConfig3[0])) { - $strConfigName .= '_' .$arrConfig3[0]; + $strConfigName .= '_' . $arrConfig3[0]; } - $strSQL = 'SELECT * FROM `' .$strTable."` WHERE `config_name`='$strConfigName'"; - $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); - if ($booRet && ($intDC != 0)) { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $strTable . "` WHERE `config_name`='$strConfigName'"; + $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); + if ($booRet && ($intDC !== 0)) { $intCounter = 1; do { - $strConfigNameTemp = $strConfigName. '_' .$intCounter; - $strSQL = 'SELECT * FROM `' .$strTable."` WHERE `config_name`='$strConfigNameTemp'"; - $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); + $strConfigNameTemp = $strConfigName . '_' . $intCounter; + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $strTable . "` WHERE `config_name`='$strConfigNameTemp'"; + $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDC); $intCounter++; - } while ($booRet && ($intDC != 0)); + } while ($booRet && ($intDC !== 0)); $strConfigName = $strConfigNameTemp; } } - // HASH string - $strRawString = $strRawString1.$strRawString2.$strRawString3; + /* HASH string */ + $strRawString = $strRawString1 . $strRawString2 . $strRawString3; $strRawString = substr($strRawString, 0, -1); } - if ($strTable == 'tbl_serviceextinfo') { - // HASH from any host, any hostgroup and service description - step 1 + if ($strTable === 'tbl_serviceextinfo') { + /* HASH from any host, any hostgroup and service description - step 1 */ if (isset($arrBlockData['host_name'])) { - $strRawString .= $arrBlockData['host_name']['value']. ','; + $strRawString .= $arrBlockData['host_name']['value'] . ','; } if (isset($arrBlockData['service_description'])) { - $strRawString .= $arrBlockData['service_description']['value']. ','; + $strRawString .= $arrBlockData['service_description']['value'] . ','; } - // HASH string + /* HASH string */ $strRawString = substr($strRawString, 0, -1); - // Create configuration name from NagiosQL variable if exists + /* Create configuration name from NagiosQL variable if exists */ if (isset($arrBlockData['_NAGIOSQL_CONFIG_NAME'])) { - $strConfigName = $arrBlockData['_NAGIOSQL_CONFIG_NAME']['value']; + $strConfigName = $arrBlockData['_NAGIOSQL_CONFIG_NAME']['value']; } else { - // Create configuration name from first two items - $arrConfig = explode(',', $strRawString); - if (isset($arrConfig[0]) && ($arrConfig[0] != '')) { - $strConfigName = 'imp_' .$arrConfig[0]; + /* Create configuration name from first two items */ + $arrConfig = explode(',', $strRawString); + if (isset($arrConfig[0]) && ($arrConfig[0] !== '')) { + $strConfigName = 'imp_' . $arrConfig[0]; } - if (isset($arrConfig[1]) && ($arrConfig[1] != '')) { - $strConfigName .= '_' .$arrConfig[1]; + if (isset($arrConfig[1]) && ($arrConfig[1] !== '')) { + $strConfigName .= '_' . $arrConfig[1]; } } } - while (substr_count($strRawString, ' ') != 0) { + while (substr_count($strRawString, ' ') !== 0) { $strRawString = str_replace(' ', '', $strRawString); } - // Sort hash string + /* Sort hash string */ $arrTemp = explode(',', $strRawString); sort($arrTemp); $strRawString = implode(',', $arrTemp); @@ -778,100 +790,106 @@ class NagImportClass } /** - * @param array $arrImportData Imported block data - * @param string $strHash Unique data hash - * @param int $intExists Does the dataset already exist? - * @param string $strTable Table name - * @param string $strKeyField Table key file - * @param int $intRelation Relation type - * @param array $arrRelations Relation array - * @param string $strSQL1 SQL statement part 1 - * @param string $strSQL2 SQL statement part 2 + * @param array $arrImportData Imported block data + * @param string $strHash Unique data hash + * @param int $intExists Does the dataset already exist? + * @param string $strTable Table name + * @param string $strKeyField Table key file + * @param int $intRelation Relation type + * @param array $arrRelations Relation array + * @param string $strSQL1 SQL statement part 1 + * @param string $strSQL2 SQL statement part 2 */ private function getSQLPart1( - $arrImportData, - $strHash, - $intExists, - $strTable, - $strKeyField, - $intRelation, - $arrRelations, - &$strSQL1, - &$strSQL2 - ) { - // Define variables + array &$arrImportData, + string $strHash, + int $intExists, + string $strTable, + string $strKeyField, + int $intRelation, + array $arrRelations, + string &$strSQL1, + string &$strSQL2 + ): void + { + /* Define variables */ $intActive = 1; - $arrData = array(); + $arrData = array(); $intDataCount = 0; - if ($strHash != '') { + if ($strHash !== '') { $strHash = " `import_hash`='" . $strHash . "', "; } - if ($intExists != 0) { - // Update database - $strSQL1 = 'UPDATE `' .$strTable. '` SET '; - $strSQL2 = ' `config_id`=' .$this->intDomainId.", $strHash `active`='$intActive', ". + if ($intExists !== 0) { + /* Update database */ + $strSQL1 = 'UPDATE `' . $strTable . '` SET '; + $strSQL2 = ' `config_id`=' . $this->intDomainId . ", $strHash `active`='$intActive', " . "`last_modified`=NOW() WHERE `id`=$intExists"; - // Keep config name while update - if (($strKeyField == 'config_name') && !isset($arrImportData['_NAGIOSQL_CONFIG_NAME'])) { - $strSQLConfig = 'SELECT `config_name` FROM `' .$strTable. '` WHERE `id`=' . $intExists; + /* Keep config name while update */ + if (($strKeyField === 'config_name') && !isset($arrImportData['_NAGIOSQL_CONFIG_NAME'])) { + /** @noinspection SqlResolve */ + $strSQLConfig = 'SELECT `config_name` FROM `' . $strTable . '` WHERE `id`=' . $intExists; $arrImportData['config_name']['value'] = $this->myDBClass->getFieldData($strSQLConfig); } - // Remove free variables - if ($intRelation != 0) { + /* Remove free variables */ + if ($intRelation !== 0) { foreach ($arrRelations as $relVar) { - if ($relVar['type'] == 4) { - $strSQL = 'SELECT * FROM `' .$relVar['linkTable']."` WHERE `idMaster`=$intExists"; + if ((int)$relVar['type'] === 4) { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $relVar['linkTable'] . "` WHERE `idMaster`=$intExists"; $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($booReturn && ($intDataCount != 0)) { + if ($booReturn && ($intDataCount !== 0)) { foreach ($arrData as $elem) { - $strSQL = 'DELETE FROM `tbl_variabledefinition` WHERE `id`=' .$elem['idSlave']; + $strSQL = 'DELETE FROM `tbl_variabledefinition` WHERE `id`=' . $elem['idSlave']; $this->myDataClass->dataInsert($strSQL, $intInsertId); } } - $strSQL = 'DELETE FROM `' .$relVar['linkTable']."` WHERE `idMaster`=$intExists"; + /** @noinspection SqlResolve */ + $strSQL = 'DELETE FROM `' . $relVar['linkTable'] . "` WHERE `idMaster`=$intExists"; $this->myDataClass->dataInsert($strSQL, $intInsertId); } } } } else { - // DB Eintrag einfügen - $test=''; - $strSQL1 = 'INSERT INTO `' .$strTable."` SET $test"; - $strSQL2 = ' `config_id`=' .$this->intDomainId.", $strHash `active`='$intActive', `last_modified`=NOW()"; + /* DB Eintrag einfügen */ + $test = ''; + /** @noinspection SqlResolve */ + $strSQL1 = 'INSERT INTO `' . $strTable . "` SET $test"; + $strSQL2 = ' `config_id`=' . $this->intDomainId . ", $strHash `active`='$intActive', `last_modified`=NOW()"; } } /** - * @param array $arrImportData Imported block data - * @param string $strKeyField Table key file - * @param string $strSQL1 SQL statement part 1 - * @param string $strTable Table name - * @return array List of import values + * @param array $arrImportData Imported block data + * @param string $strKeyField Table key file + * @param string $strSQL1 SQL statement part 1 + * @param string $strTable Table name + * @return array List of import values */ - private function getImportValues($arrImportData, $strKeyField, &$strSQL1, $strTable) + private function getImportValues(array $arrImportData, string $strKeyField, string &$strSQL1, string $strTable): array { - // Description for the values - // -------------------------- - // $strVCValues = Simple text values, will be stored as varchar / null = 'null' as text value / empty = '' - // $strRLValues = Relations - values with relations to other tables - // $strVWValues = Integer values - will be stored as INT values / null = -1, / empty values as NULL - // $strVIValues = Decision values 0 = no, 1 = yes, 2 = skip, 3 = null + /* Description for the values + * -------------------------- + * $strVCValues = Simple text values, will be stored as varchar / null = 'null' as text value / empty = '' + * $strRLValues = Relations - values with relations to other tables + * $strVWValues = Integer values - will be stored as INT values / null = -1, / empty values as NULL + * $strVIValues = Decision values 0 = no, 1 = yes, 2 = skip, 3 = null + */ - // Define variables - $strVCValues = ''; - $strVIValues = ''; - $strRLValues = ''; - $strVWValues = ''; + /* Define variables */ + $strVCValues = ''; + $strVIValues = ''; + $strRLValues = ''; + $strVWValues = ''; $intWriteConfig = 0; - // Read command configurations - if ($strKeyField == 'command_name') { + /* Read command configurations */ + if ($strKeyField === 'command_name') { $strVCValues = 'command_name,command_line'; - // Find out command type + /* Find out command type */ if (isset($arrImportData['command_line'])) { - if ((substr_count($arrImportData['command_line']['value'], 'ARG1') != 0) || - (substr_count($arrImportData['command_line']['value'], 'USER1') != 0)) { + if ((substr_count($arrImportData['command_line']['value'], 'ARG1') !== 0) || + (substr_count($arrImportData['command_line']['value'], 'USER1') !== 0)) { $strSQL1 .= '`command_type` = 1,'; } else { $strSQL1 .= '`command_type` = 2,'; @@ -879,58 +897,58 @@ class NagImportClass } $intWriteConfig = 1; - // Read contact configurations - } elseif ($strKeyField == 'contact_name') { - $strVCValues = 'contact_name,alias,host_notification_options,service_notification_options,email,'; + /* Read contact configurations */ + } elseif ($strKeyField === 'contact_name') { + $strVCValues = 'contact_name,alias,host_notification_options,service_notification_options,email,'; $strVCValues .= 'pager,address1,address2,address3,address4,address5,address6,name'; - $strVWValues = 'minimum_importance'; + $strVWValues = 'minimum_importance'; - $strVIValues = 'host_notifications_enabled,service_notifications_enabled,can_submit_commands,'; + $strVIValues = 'host_notifications_enabled,service_notifications_enabled,can_submit_commands,'; $strVIValues .= 'retain_status_information,retain_nonstatus_information'; - $strRLValues = 'contactgroups,host_notification_period,service_notification_period,'; + $strRLValues = 'contactgroups,host_notification_period,service_notification_period,'; $strRLValues .= 'host_notification_commands,service_notification_commands,use'; $intWriteConfig = 1; - // Read contactgroup configurations - } elseif ($strKeyField == 'contactgroup_name') { + /* Read contactgroup configurations */ + } elseif ($strKeyField === 'contactgroup_name') { $strVCValues = 'contactgroup_name,alias'; $strRLValues = 'members,contactgroup_members'; $intWriteConfig = 1; - // Read timeperiod configurations - } elseif ($strKeyField == 'timeperiod_name') { + /* Read timeperiod configurations */ + } elseif ($strKeyField === 'timeperiod_name') { $strVCValues = 'timeperiod_name,alias,name'; $strRLValues = 'use,exclude'; $intWriteConfig = 1; - // Read contacttemplate configurations - } elseif (($strKeyField == 'name') && ($strTable == 'tbl_contacttemplate')) { - $strVCValues = 'contact_name,alias,host_notification_options,service_notification_options,email,'; + /* Read contacttemplate configurations */ + } elseif (($strKeyField === 'name') && ($strTable === 'tbl_contacttemplate')) { + $strVCValues = 'contact_name,alias,host_notification_options,service_notification_options,email,'; $strVCValues .= 'pager,address1,address2,address3,address4,address5,address6,name'; - $strVWValues = 'minimum_importance'; + $strVWValues = 'minimum_importance'; - $strVIValues = 'host_notifications_enabled,service_notifications_enabled,can_submit_commands,'; + $strVIValues = 'host_notifications_enabled,service_notifications_enabled,can_submit_commands,'; $strVIValues .= 'retain_status_information,retain_nonstatus_information'; - $strRLValues = 'contactgroups,host_notification_period,service_notification_period,'; + $strRLValues = 'contactgroups,host_notification_period,service_notification_period,'; $strRLValues .= 'host_notification_commands,service_notification_commands,use'; $intWriteConfig = 1; - // Read host configurations - } elseif ($strTable == 'tbl_host') { - $strVCValues = 'host_name,alias,display_name,address,initial_state,flap_detection_options,'; + /* Read host configurations */ + } elseif ($strTable === 'tbl_host') { + $strVCValues = 'host_name,alias,display_name,address,initial_state,flap_detection_options,'; $strVCValues .= 'notification_options,stalking_options,notes,notes_url,action_url,icon_image,'; $strVCValues .= 'icon_image_alt,vrml_image,statusmap_image,2d_coords,3d_coords,name'; - $strVWValues = 'max_check_attempts,retry_interval,check_interval,freshness_threshold,low_flap_threshold,'; + $strVWValues = 'max_check_attempts,retry_interval,check_interval,freshness_threshold,low_flap_threshold,'; $strVWValues .= 'high_flap_threshold,notification_interval,first_notification_delay,importance'; - $strVIValues = 'active_checks_enabled,passive_checks_enabled,check_freshness,obsess_over_host,'; + $strVIValues = 'active_checks_enabled,passive_checks_enabled,check_freshness,obsess_over_host,'; $strVIValues .= 'event_handler_enabled,flap_detection_enabled,process_perf_data,retain_status_information,'; $strVIValues .= 'retain_nonstatus_information,notifications_enabled'; @@ -938,75 +956,75 @@ class NagImportClass $strRLValues .= 'notification_period'; $intWriteConfig = 1; - // Read hosttemplate configurations - } elseif (($strKeyField == 'name') && ($strTable == 'tbl_hosttemplate')) { - $strVCValues = 'template_name,alias,initial_state,flap_detection_options,notification_options,'; + /* Read hosttemplate configurations */ + } elseif (($strKeyField === 'name') && ($strTable === 'tbl_hosttemplate')) { + $strVCValues = 'template_name,alias,initial_state,flap_detection_options,notification_options,'; $strVCValues .= 'stalking_options,notes,notes_url,action_url,icon_image,icon_image_alt,vrml_image,'; $strVCValues .= 'statusmap_image,2d_coords,3d_coords,name'; - $strVWValues = 'max_check_attempts,retry_interval,check_interval,freshness_threshold,low_flap_threshold,'; + $strVWValues = 'max_check_attempts,retry_interval,check_interval,freshness_threshold,low_flap_threshold,'; $strVWValues .= 'high_flap_threshold,notification_interval,first_notification_delay,importance'; - $strVIValues = 'active_checks_enabled,passive_checks_enabled,check_freshness,obsess_over_host,'; + $strVIValues = 'active_checks_enabled,passive_checks_enabled,check_freshness,obsess_over_host,'; $strVIValues .= 'event_handler_enabled,flap_detection_enabled,process_perf_data,retain_status_information,'; $strVIValues .= 'retain_nonstatus_information,notifications_enabled'; - $strRLValues = 'parents,hostgroups,check_command,use,check_period,event_handler,contacts,contact_groups,'; + $strRLValues = 'parents,hostgroups,check_command,use,check_period,event_handler,contacts,contact_groups,'; $strRLValues .= 'notification_period'; $intWriteConfig = 1; - // Read hostgroup configurations - } elseif ($strKeyField == 'hostgroup_name') { + /* Read hostgroup configurations */ + } elseif ($strKeyField === 'hostgroup_name') { $strVCValues = 'hostgroup_name,alias,notes,notes_url,action_url'; $strRLValues = 'members,hostgroup_members'; $intWriteConfig = 1; - // Read service configurations - } elseif ($strTable == 'tbl_service') { - $strVCValues = 'service_description,display_name,initial_state,flap_detection_options,stalking_options,'; + /* Read service configurations */ + } elseif ($strTable === 'tbl_service') { + $strVCValues = 'service_description,display_name,initial_state,flap_detection_options,stalking_options,'; $strVCValues .= 'notes,notes_url,action_url,icon_image,icon_image_alt,name,config_name,'; $strVCValues .= 'notification_options'; - $strVWValues = 'max_check_attempts,check_interval,retry_interval,freshness_threshold,low_flap_threshold,'; + $strVWValues = 'max_check_attempts,check_interval,retry_interval,freshness_threshold,low_flap_threshold,'; $strVWValues .= 'high_flap_threshold,notification_interval,first_notification_delay,importance'; - $strVIValues = 'is_volatile,active_checks_enabled,passive_checks_enabled,parallelize_check,'; + $strVIValues = 'is_volatile,active_checks_enabled,passive_checks_enabled,parallelize_check,'; $strVIValues .= 'obsess_over_service,check_freshness,event_handler_enabled,flap_detection_enabled,'; $strVIValues .= 'process_perf_data,retain_status_information,retain_nonstatus_information,'; $strVIValues .= 'notifications_enabled'; - $strRLValues = 'host_name,hostgroup_name,servicegroups,use,check_command,check_period,event_handler,'; + $strRLValues = 'host_name,hostgroup_name,servicegroups,use,check_command,check_period,event_handler,'; $strRLValues .= 'notification_period,contacts,contact_groups,parents'; $intWriteConfig = 1; - // Read servicetemplate configurations - } elseif (($strKeyField == 'name') && ($strTable == 'tbl_servicetemplate')) { - $strVCValues = 'template_name,service_description,display_name,initial_state,flap_detection_options,'; + /* Read servicetemplate configurations */ + } elseif (($strKeyField === 'name') && ($strTable === 'tbl_servicetemplate')) { + $strVCValues = 'template_name,service_description,display_name,initial_state,flap_detection_options,'; $strVCValues .= 'stalking_options,notes,notes_url,action_url,icon_image,icon_image_alt,name,'; $strVCValues .= 'notification_options'; - $strVWValues = 'max_check_attempts,check_interval,retry_interval,freshness_threshold,low_flap_threshold,'; + $strVWValues = 'max_check_attempts,check_interval,retry_interval,freshness_threshold,low_flap_threshold,'; $strVWValues .= 'high_flap_threshold,notification_interval,first_notification_delay,importance'; - $strVIValues = 'is_volatile,active_checks_enabled,passive_checks_enabled,parallelize_check,'; + $strVIValues = 'is_volatile,active_checks_enabled,passive_checks_enabled,parallelize_check,'; $strVIValues .= 'obsess_over_service,check_freshness,event_handler_enabled,flap_detection_enabled,'; $strVIValues .= 'process_perf_data,retain_status_information,retain_nonstatus_information,'; $strVIValues .= 'notifications_enabled'; - $strRLValues = 'host_name,hostgroup_name,servicegroups,use,check_command,check_period,event_handler,'; + $strRLValues = 'host_name,hostgroup_name,servicegroups,use,check_command,check_period,event_handler,'; $strRLValues .= 'notification_period,contacts,contact_groups,parents'; $intWriteConfig = 1; - // Read servicegroup configurations - } elseif ($strKeyField == 'servicegroup_name') { + /* Read servicegroup configurations */ + } elseif ($strKeyField === 'servicegroup_name') { $strVCValues = 'servicegroup_name,alias,notes,notes_url,action_url'; $strRLValues = 'members,servicegroup_members'; $intWriteConfig = 1; - // Read hostdependency configurations - } elseif ($strTable == 'tbl_hostdependency') { + /* Read hostdependency configurations */ + } elseif ($strTable === 'tbl_hostdependency') { $strVCValues = 'config_name,execution_failure_criteria,notification_failure_criteria'; $strVIValues = 'inherits_parent'; @@ -1014,8 +1032,8 @@ class NagImportClass $strRLValues = 'dependent_host_name,dependent_hostgroup_name,host_name,hostgroup_name,dependency_period'; $intWriteConfig = 1; - // Read hostescalation configurations - } elseif ($strTable == 'tbl_hostescalation') { + /* Read hostescalation configurations */ + } elseif ($strTable === 'tbl_hostescalation') { $strVCValues = 'config_name,escalation_options'; $strVWValues = 'first_notification,last_notification,notification_interval'; @@ -1023,45 +1041,45 @@ class NagImportClass $strRLValues = 'host_name,hostgroup_name,contacts,contact_groups,escalation_period'; $intWriteConfig = 1; - // Read hostextinfo configurations - } elseif ($strTable == 'tbl_hostextinfo') { - $strVCValues = 'notes,notes_url,action_url,icon_image,icon_image_alt,vrml_image,statusmap_image,'; + /* Read hostextinfo configurations */ + } elseif ($strTable === 'tbl_hostextinfo') { + $strVCValues = 'notes,notes_url,action_url,icon_image,icon_image_alt,vrml_image,statusmap_image,'; $strVCValues .= '2d_coords,3d_coords'; $strRLValues = 'host_name'; $intWriteConfig = 1; - // Read servicedependency configurations - } elseif ($strTable == 'tbl_servicedependency') { - $strVCValues = 'config_name,execution_failure_criteria,notification_failure_criteria'; + /* Read servicedependency configurations */ + } elseif ($strTable === 'tbl_servicedependency') { + $strVCValues = 'config_name,execution_failure_criteria,notification_failure_criteria'; - $strVIValues = 'inherits_parent'; + $strVIValues = 'inherits_parent'; - $strRLValues = 'dependent_host_name,dependent_hostgroup_name,dependent_service_description,host_name,'; + $strRLValues = 'dependent_host_name,dependent_hostgroup_name,dependent_service_description,host_name,'; $strRLValues .= 'hostgroup_name,dependency_period,service_description,dependent_servicegroup_name,'; $strRLValues .= 'servicegroup_name'; $intWriteConfig = 1; - // Read serviceescalation configurations - } elseif ($strTable == 'tbl_serviceescalation') { - $strVCValues = 'config_name,escalation_options'; + /* Read serviceescalation configurations */ + } elseif ($strTable === 'tbl_serviceescalation') { + $strVCValues = 'config_name,escalation_options'; - $strVIValues = 'first_notification,last_notification,notification_interval'; + $strVIValues = 'first_notification,last_notification,notification_interval'; - $strRLValues = 'host_name,hostgroup_name,contacts,contact_groups,service_description,escalation_period,'; + $strRLValues = 'host_name,hostgroup_name,contacts,contact_groups,service_description,escalation_period,'; $strRLValues .= 'servicegroup_name'; $intWriteConfig = 1; - // Serviceextinfo configurations - } elseif ($strTable == 'tbl_serviceextinfo') { + /* Serviceextinfo configurations */ + } elseif ($strTable === 'tbl_serviceextinfo') { $strVCValues = 'notes,notes_url,action_url,icon_image,icon_image_alt'; $strRLValues = 'host_name,service_description'; $intWriteConfig = 1; } - // Common values (all configurations) - if ($strVWValues == '') { + /* Common values (all configurations) */ + if ($strVWValues === '') { $strVWValues = 'register'; } else { $strVWValues .= ',register'; @@ -1070,27 +1088,28 @@ class NagImportClass } /** - * @param $elem - * @param $strVCValues - * @param $strSQL1 - * @param $intIsTemplate - * @param $intExists - * @param $strTable + * @param array $elem + * @param string $strVCValues + * @param string $strSQL1 + * @param int $intIsTemplate + * @param int $intExists + * @param string $strTable * @return int */ - private function writeTextValues($elem, $strVCValues, &$strSQL1, $intIsTemplate, $intExists, $strTable) + private function writeTextValues(array $elem, string $strVCValues, string &$strSQL1, int $intIsTemplate, int $intExists, string $strTable): int { $intCheck = 0; - if (\in_array($elem['key'], explode(',', $strVCValues), true)) { - if (strtolower(trim($elem['value'])) == 'null') { + if (in_array($elem['key'], explode(',', $strVCValues), true)) { + if (strtolower(trim($elem['value'])) === 'null') { $strSQL1 .= '`' . $elem['key'] . "` = 'null',"; } else { $elem['value'] = addslashes($elem['value']); - if ($intIsTemplate == 1) { - if ($elem['key'] == 'name') { + if ($intIsTemplate === 1) { + if ($elem['key'] === 'name') { $strSQL1 .= "template_name = '" . $elem['value'] . "',"; - } elseif (($elem['key'] == 'config_name') && ($intExists != 0)) { - // Do not overwrite config_names during an update! + } elseif (($elem['key'] === 'config_name') && ($intExists !== 0)) { + /* Do not overwrite config_names during an update! */ + /** @noinspection SqlResolve */ $strSQLConfig = 'SELECT `config_name` FROM `' . $strTable . '` WHERE `id`=' . $intExists; $elem['value'] = $this->myDBClass->getFieldData($strSQLConfig); $strSQL1 .= '`' . $elem['key'] . "` = '" . $elem['value'] . "',"; @@ -1107,16 +1126,16 @@ class NagImportClass } /** - * @param $elem - * @param $strVIValues - * @param $strSQL1 + * @param array $elem + * @param string $strVIValues + * @param string $strSQL1 * @return int */ - private function writeStatusValues($elem, $strVIValues, &$strSQL1) + private function writeStatusValues(array $elem, string $strVIValues, string &$strSQL1): int { $intCheck = 0; - if (\in_array($elem['key'], explode(',', $strVIValues), true)) { - if (strtolower(trim($elem['value'])) == 'null') { + if (in_array($elem['key'], explode(',', $strVIValues), true)) { + if (strtolower(trim($elem['value'])) === 'null') { $strSQL1 .= '`' . $elem['key'] . '` = 3,'; } else { $strSQL1 .= '`' . $elem['key'] . "` = '" . $elem['value'] . "',"; @@ -1127,16 +1146,16 @@ class NagImportClass } /** - * @param $elem - * @param $strVWValues - * @param $strSQL1 + * @param array $elem + * @param string $strVWValues + * @param string $strSQL1 * @return int */ - private function writeIntegerValues($elem, $strVWValues, &$strSQL1) + private function writeIntegerValues(array $elem, string $strVWValues, string &$strSQL1): int { $intCheck = 0; - if (\in_array($elem['key'], explode(',', $strVWValues), true)) { - if (strtolower(trim($elem['value'])) == 'null') { + if (in_array($elem['key'], explode(',', $strVWValues), true)) { + if (strtolower(trim($elem['value'])) === 'null') { $strSQL1 .= '`' . $elem['key'] . '` = -1,'; } else { $strSQL1 .= '`' . $elem['key'] . "` = '" . $elem['value'] . "',"; @@ -1150,14 +1169,14 @@ class NagImportClass * @param array $elem * @param string $strRLValues * @param array $arrImportRelations - * @param $intInsertRelations + * @param int $intInsertRelations * @return int */ - private function writeRelations(&$elem, $strRLValues, &$arrImportRelations, &$intInsertRelations) + private function writeRelations(array &$elem, string $strRLValues, array &$arrImportRelations, int &$intInsertRelations): int { $intCheck = 0; - if (($intCheck == 0) && \in_array($elem['key'], explode(',', $strRLValues), true)) { - if ($elem['key'] == 'use') { + if (($intCheck === 0) && in_array($elem['key'], explode(',', $strRLValues), true)) { + if ($elem['key'] === 'use') { $elem['key'] = 'use_template'; } $arrTemp = array(); @@ -1171,89 +1190,151 @@ class NagImportClass } /** - * Inserts a relation type 1 (1:1) - * @param string $strKey Data field name - * @param string $strValue Data value - * @param int $intDataId Data ID - * @param string $strDataTable Data table (Master) - * @param array $arrRelData Relation data - * @param array $arrImportData Import Data + * Inserts a relation type 5 (1:1 check command) + * @param string $strValue Data value + * @param int $intDataId Data ID + * @param string $strDataTable Data table (Master) + * @param array $arrRelData Relation data */ - public function writeRelation1($strKey, $strValue, $intDataId, $strDataTable, $arrRelData, $arrImportData) + public function writeRelation5(string $strValue, int $intDataId, string $strDataTable, array $arrRelData): void { - // Define variables + /* Extract data values */ + $arrCommand = explode('!', $strValue); + $strValue = $arrCommand[0]; + /* Define variables */ $intSlaveId = 0; - if (strtolower(trim($strValue)) == 'null') { - // Update data in master table - $strSQL = 'UPDATE `' .$strDataTable. '` SET `' .$arrRelData['fieldName']. '` = -1 WHERE `id` = ' - .$intDataId; - $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if (strtolower(trim($strValue)) === 'null') { + /* Update data in master table */ + $strSQL = 'UPDATE `' . $strDataTable . '` SET `' . $arrRelData['fieldName'] . '` = -1 WHERE `id` = ' . + $intDataId; + $booResult = $this->myDBClass->insertData($strSQL); + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } } else { - // Decompose data value + /* Decompose data values */ $arrValues = explode(',', $strValue); - // Process data values + /* Process data values */ foreach ($arrValues as $elem) { - $strWhere = ''; - $strLink = ''; - $strAdd = ''; - // Special processing for serviceextinfo - if (($strDataTable == 'tbl_serviceextinfo') && ($strKey == 'service_description')) { - $strLink = 'LEFT JOIN `tbl_lnkServiceToHost` on `tbl_service`.`id`=`idMaster` ' . - 'LEFT JOIN `tbl_host` ON `idSlave`=`tbl_host`.`id`'; - $strWhere = "AND `tbl_host`.`host_name`='".$arrImportData['host_name']['value']."'"; - } - // Does the value already exist? - $strSQL = 'SELECT `' .$arrRelData['tableName1']. '`.`id` FROM `' .$arrRelData['tableName1']. - "` $strLink " . 'WHERE `' .$arrRelData['target1']."` = '".$elem."' $strWhere AND ". - '`' .$arrRelData['tableName1']."`.`active`='1' AND ". - '`' .$arrRelData['tableName1']. '`.`config_id`=' .$this->intDomainId; - $strId = $this->myDBClass->getFieldData($strSQL); - if ($strId != '') { + /* Does the entry already exist? */ + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $arrRelData['tableName1'] . '` ' . + 'WHERE `' . $arrRelData['target1'] . "` = '" . $elem . "' AND `config_id`=" . $this->intDomainId; + $strId = $this->myDBClass->getFieldData($strSQL); + if ($strId !== '') { $intSlaveId = (int)$strId; } - if ($intSlaveId == 0) { - // Insert a temporary value - if (($strDataTable == 'tbl_serviceextinfo') && ($arrRelData['tableName1'] == 'tbl_service')) { + if ($intSlaveId === 0) { + /* Insert a temporary value in target table */ + /** @noinspection SqlResolve */ + $strSQL = 'INSERT INTO `' . $arrRelData['tableName1'] . '` ' . + 'SET `' . $arrRelData['target1'] . "` = '" . $elem . "', `config_id`=" . $this->intDomainId . ', ' . + "`active`='0', `last_modified`=NOW()"; + $booResult = $this->myDBClass->insertData($strSQL); + if ($booResult === false) { + $this->strErrorMessage .= $this->myDBClass->strErrorMessage; + } + $intSlaveId = $this->myDBClass->intLastId; + } + /* Update data in master table */ + $arrCommand[0] = $intSlaveId; + $strValue = implode('!', $arrCommand); + $strSQL = 'UPDATE `' . $strDataTable . '` ' . + 'SET `' . $arrRelData['fieldName'] . "`='" . $this->myDBClass->realEscape($strValue) . "' " . + 'WHERE `id` = ' . $intDataId; + $booResult = $this->myDBClass->insertData($strSQL); + if ($booResult === false) { + $this->strErrorMessage .= $this->myDBClass->strErrorMessage; + } + } + } + } + + /** + * Inserts a relation type 1 (1:1) + * @param string $strKey Data field name + * @param string $strValue Data value + * @param int $intDataId Data ID + * @param string $strDataTable Data table (Master) + * @param array $arrRelData Relation data + * @param array $arrImportData Import Data + */ + public function writeRelation1(string $strKey, string $strValue, int $intDataId, string $strDataTable, array $arrRelData, array $arrImportData): void + { + /* Define variables */ + $intSlaveId = 0; + if (strtolower(trim($strValue)) === 'null') { + /* Update data in master table */ + $strSQL = 'UPDATE `' . $strDataTable . '` SET `' . $arrRelData['fieldName'] . '` = -1 WHERE `id` = ' + . $intDataId; + $booResult = $this->myDBClass->insertData($strSQL); + if ($booResult === false) { + $this->strErrorMessage .= $this->myDBClass->strErrorMessage; + } + } else { + /* Decompose data value */ + $arrValues = explode(',', $strValue); + /* Process data values */ + foreach ($arrValues as $elem) { + $strWhere = ''; + $strLink = ''; + $strAdd = ''; + /* Special processing for serviceextinfo */ + if (($strDataTable === 'tbl_serviceextinfo') && ($strKey === 'service_description')) { + $strLink = 'LEFT JOIN `tbl_lnkServiceToHost` on `tbl_service`.`id`=`idMaster` ' . + 'LEFT JOIN `tbl_host` ON `idSlave`=`tbl_host`.`id`'; + $strWhere = "AND `tbl_host`.`host_name`='" . $arrImportData['host_name']['value'] . "'"; + } + /* Does the value already exist? */ + $strSQL = 'SELECT `' . $arrRelData['tableName1'] . '`.`id` FROM `' . $arrRelData['tableName1'] . + "` $strLink " . 'WHERE `' . $arrRelData['target1'] . "` = '" . $elem . "' $strWhere AND " . + '`' . $arrRelData['tableName1'] . "`.`active`='1' AND " . + '`' . $arrRelData['tableName1'] . '`.`config_id`=' . $this->intDomainId; + $strId = $this->myDBClass->getFieldData($strSQL); + if ($strId !== '') { + $intSlaveId = (int)$strId; + } + if ($intSlaveId === 0) { + /* Insert a temporary value */ + if (($strDataTable === 'tbl_serviceextinfo') && ($arrRelData['tableName1'] === 'tbl_service')) { $strAdd = "`config_name`='imp_tmp_by_serviceextinfo',"; } - $strSQL = 'INSERT INTO `' .$arrRelData['tableName1']. '` ' . - 'SET `' .$arrRelData['target1']."` = '".$elem."', ". - "$strAdd `config_id`=".$this->intDomainId.", `active`='0', ". + /** @noinspection SqlResolve */ + $strSQL = 'INSERT INTO `' . $arrRelData['tableName1'] . '` ' . + 'SET `' . $arrRelData['target1'] . "` = '" . $elem . "', " . + "$strAdd `config_id`=" . $this->intDomainId . ", `active`='0', " . '`last_modified`=NOW()'; - $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + $booResult = $this->myDBClass->insertData($strSQL); + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } $intSlaveId = $this->myDBClass->intLastId; - // Special processing for serviceextinfo - if (($strDataTable == 'tbl_serviceextinfo') && ($strKey == 'service_description')) { + /* Special processing for serviceextinfo */ + if (($strDataTable === 'tbl_serviceextinfo') && ($strKey === 'service_description')) { $strSQL = 'SELECT `id` FROM `tbl_host` ' . - "WHERE `host_name`='".$arrImportData['host_name']['value']."'"; - $strId = $this->myDBClass->getFieldData($strSQL); - if ($strId != '') { - $strSQL = 'INSERT INTO `tbl_lnkServiceToHost` ' . - "SET `idMaster` = '".$intSlaveId."', `idSlave` = '".$strId."'"; - $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + "WHERE `host_name`='" . $arrImportData['host_name']['value'] . "'"; + $strId = $this->myDBClass->getFieldData($strSQL); + if ($strId !== '') { + $strSQL = 'INSERT INTO `tbl_lnkServiceToHost` ' . + "SET `idMaster` = '" . $intSlaveId . "', `idSlave` = '" . $strId . "'"; + $booResult = $this->myDBClass->insertData($strSQL); + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } - $strSQL = "UPDATE `tbl_service` SET `host_name`=0 WHERE `id`='".$intSlaveId."'"; - $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + $strSQL = "UPDATE `tbl_service` SET `host_name`=0 WHERE `id`='" . $intSlaveId . "'"; + $booResult = $this->myDBClass->insertData($strSQL); + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } } } } - // Update data in master table - $strSQL = 'UPDATE `' .$strDataTable. '` SET `' .$arrRelData['fieldName']. '` = ' .$intSlaveId. ' ' . - 'WHERE `id` = ' .$intDataId; - $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + /* Update data in master table */ + $strSQL = 'UPDATE `' . $strDataTable . '` SET `' . $arrRelData['fieldName'] . '` = ' . $intSlaveId . ' ' . + 'WHERE `id` = ' . $intDataId; + $booResult = $this->myDBClass->insertData($strSQL); + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } } @@ -1262,37 +1343,39 @@ class NagImportClass /** * Inserts a relation type 2 (1:n) - * @param string $strKey Data field name - * @param string $strValue Data value - * @param int $intDataId Data ID - * @param string $strDataTable Data table (Master) - * @param array $arrRelData Relation data + * @param string $strKey Data field name + * @param string $strValue Data value + * @param int $intDataId Data ID + * @param string $strDataTable Data table (Master) + * @param array $arrRelData Relation data */ - public function writeRelation2($strKey, $strValue, $intDataId, $strDataTable, $arrRelData) + public function writeRelation2(string $strKey, string $strValue, int $intDataId, string $strDataTable, array $arrRelData): void { - // Does a tploption field exist? - $strSQL = 'SELECT * FROM `' .$strDataTable. '` WHERE `id` = ' .$intDataId; + /* Does a tploption field exist? */ + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $strDataTable . '` WHERE `id` = ' . $intDataId; $this->myDBClass->hasSingleDataset($strSQL, $arrDataset); - $strFieldName = $arrRelData['fieldName']. '_tploptions'; + $strFieldName = $arrRelData['fieldName'] . '_tploptions'; if (isset($arrDataset[$strFieldName])) { $intTplOption = 1; } else { $intTplOption = 0; } - // Delete data from link table - $strSQL = 'DELETE FROM `' .$arrRelData['linkTable']. '` WHERE `idMaster` = ' .$intDataId; + /* Delete data from link table */ + /** @noinspection SqlResolve */ + $strSQL = 'DELETE FROM `' . $arrRelData['linkTable'] . '` WHERE `idMaster` = ' . $intDataId; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } - // Define variables - if (strtolower(trim($strValue)) == 'null') { - // Update data in master table - if ($intTplOption == 1) { - $strSQL = 'UPDATE `' .$strDataTable. '` SET `' .$arrRelData['fieldName']. '` = 0, ' . - '`' .$arrRelData['fieldName']. '_tploptions` = 1 WHERE `id` = ' .$intDataId; + /* Define variables */ + if (strtolower(trim($strValue)) === 'null') { + /* Update data in master table */ + if ($intTplOption === 1) { + $strSQL = 'UPDATE `' . $strDataTable . '` SET `' . $arrRelData['fieldName'] . '` = 0, ' . + '`' . $arrRelData['fieldName'] . '_tploptions` = 1 WHERE `id` = ' . $intDataId; } else { - $strSQL = 'UPDATE `' .$strDataTable. '` SET `' .$arrRelData['fieldName']. '` = 0 WHERE `id` = ' . + $strSQL = 'UPDATE `' . $strDataTable . '` SET `' . $arrRelData['fieldName'] . '` = 0 WHERE `id` = ' . $intDataId; } $this->myDBClass->insertData($strSQL); @@ -1303,101 +1386,103 @@ class NagImportClass } else { $intOption = 2; } - // Decompose data value + /* Decompose data value */ $arrValues = explode(',', $strValue); - // Process data values + if (substr_count($strValue, '*') !== 0) { + $intRelValue = 2; + } else { + $intRelValue = 1; + } + /* Process data values */ foreach ($arrValues as $elem) { - if ($elem != '*') { + if ($elem !== '*') { $strWhere = ''; - $strLink = ''; - // Exclude values + $strLink = ''; + /* Exclude values */ if (0 === strpos($elem, '!')) { $intExclude = 1; $elem = substr($elem, 1); } else { $intExclude = 0; } - if ((($strDataTable == 'tbl_servicedependency') || ($strDataTable == 'tbl_serviceescalation')) && - (substr_count($strKey, 'service') != 0) && (substr_count($strKey, 'group') == 0)) { - if (substr_count($strKey, 'depend') != 0) { - $strLink = 'LEFT JOIN `tbl_lnkServiceToHost` on `id`=`idMaster`'; - $strWhere = 'AND `idSlave` IN (' .substr($this->strList1, 0, -1). ')'; + if ((($strDataTable === 'tbl_servicedependency') || ($strDataTable === 'tbl_serviceescalation')) && + (substr_count($strKey, 'service') !== 0) && (substr_count($strKey, 'group') === 0)) { + $strLink = 'LEFT JOIN `tbl_lnkServiceToHost` on `id`=`idMaster`'; + if (substr_count($strKey, 'depend') !== 0) { + $strWhere = 'AND `idSlave` IN (' . substr($this->strList1, 0, -1) . ')'; } else { - $strLink = 'LEFT JOIN `tbl_lnkServiceToHost` on `id`=`idMaster`'; - $strWhere = 'AND `idSlave` IN (' .substr($this->strList2, 0, -1). ')'; + $strWhere = 'AND `idSlave` IN (' . substr($this->strList2, 0, -1) . ')'; } } - // Does the entry already exist? - $strSQL = 'SELECT `id` FROM `' .$arrRelData['tableName1']."` $strLink ". - 'WHERE `' .$arrRelData['target1']."` = '".$elem."' $strWhere AND ". - '`config_id`=' .$this->intDomainId; - $strId = $this->myDBClass->getFieldData($strSQL); - if ($strId != '') { + /* Does the entry already exist? */ + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $arrRelData['tableName1'] . "` $strLink " . + 'WHERE `' . $arrRelData['target1'] . "` = '" . $elem . "' $strWhere AND " . + '`config_id`=' . $this->intDomainId; + $strId = $this->myDBClass->getFieldData($strSQL); + if ($strId !== '') { $intSlaveId = (int)$strId; } else { $intSlaveId = 0; } - if (($intSlaveId == 0) && ($elem != '*')) { - // Insert a temporary value to the target table - $strSQL = 'INSERT INTO `' .$arrRelData['tableName1']. '` ' . - 'SET `' .$arrRelData['target1']."`='".$elem."', ". - '`config_id`=' .$this->intDomainId.", `active`='0', `last_modified`=NOW()"; + if (($intSlaveId === 0) && ($elem !== '*')) { + /* Insert a temporary value to the target table */ + /** @noinspection SqlResolve */ + $strSQL = 'INSERT INTO `' . $arrRelData['tableName1'] . '` ' . + 'SET `' . $arrRelData['target1'] . "`='" . $elem . "', " . + '`config_id`=' . $this->intDomainId . ", `active`='0', `last_modified`=NOW()"; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } $intSlaveId = $this->myDBClass->intLastId; } - // Insert relations - $strSQL = 'INSERT INTO `' .$arrRelData['linkTable']. '` ' . - 'SET `idMaster` = ' .$intDataId. ', `idSlave` = ' .$intSlaveId. ', `exclude`=' .$intExclude; + /* Insert relations */ + /** @noinspection SqlResolve */ + $strSQL = 'INSERT INTO `' . $arrRelData['linkTable'] . '` ' . + 'SET `idMaster` = ' . $intDataId . ', `idSlave` = ' . $intSlaveId . ', `exclude`=' . $intExclude; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } - // Keep values - if (($strDataTable == 'tbl_servicedependency') || ($strDataTable == 'tbl_serviceescalation')) { + /* Keep values */ + if (($strDataTable === 'tbl_servicedependency') || ($strDataTable === 'tbl_serviceescalation')) { $strTemp = ''; - if (($strKey == 'dependent_host_name') || ($strKey == 'host_name')) { - $strTemp .= $intSlaveId. ','; - } elseif (($strKey == 'dependent_hostgroup_name') || ($strKey == 'hostgroup_name')) { + if (($strKey === 'dependent_host_name') || ($strKey === 'host_name')) { + $strTemp .= $intSlaveId . ','; + } elseif (($strKey === 'dependent_hostgroup_name') || ($strKey === 'hostgroup_name')) { $arrDataHostgroups = array(); - $intDCHostgroups = 0; + $intDCHostgroups = 0; $strSQL = 'SELECT DISTINCT `id` FROM `tbl_host` ' . 'LEFT JOIN `tbl_lnkHostToHostgroup` ON `id`=`tbl_lnkHostToHostgroup`.`idMaster` ' . 'LEFT JOIN `tbl_lnkHostgroupToHost` ON `id`=`tbl_lnkHostgroupToHost`.`idSlave` ' . - "WHERE (`tbl_lnkHostgroupToHost`.`idMaster` = $intSlaveId ". - "OR `tbl_lnkHostToHostgroup`.`idSlave` = $intSlaveId) ". - "AND `active`='1' AND `config_id`=".$this->intDomainId; + "WHERE (`tbl_lnkHostgroupToHost`.`idMaster` = $intSlaveId " . + "OR `tbl_lnkHostToHostgroup`.`idSlave` = $intSlaveId) " . + "AND `active`='1' AND `config_id`=" . $this->intDomainId; $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrDataHostgroups, $intDCHostgroups); - if ($booReturn && ($intDCHostgroups != 0)) { + if ($booReturn && ($intDCHostgroups !== 0)) { foreach ($arrDataHostgroups as $elem2) { - $strTemp .= $elem2['id']. ','; + $strTemp .= $elem2['id'] . ','; } } } - if (substr_count($strKey, 'dependent') != 0) { + if (substr_count($strKey, 'dependent') !== 0) { $this->strList1 .= $strTemp; } else { $this->strList2 .= $strTemp; } } } - // Update field values in master table - if (substr_count($strValue, '*') != 0) { - $intRelValue = 2; + /* Update field values in master table */ + if ($intTplOption === 1) { + $strSQL = 'UPDATE `' . $strDataTable . '` SET `' . $arrRelData['fieldName'] . "`=$intRelValue, " . + '`' . $arrRelData['fieldName'] . '_tploptions` = ' . $intOption . ' WHERE `id` = ' . $intDataId; } else { - $intRelValue = 1; + $strSQL = 'UPDATE `' . $strDataTable . '` SET `' . $arrRelData['fieldName'] . "`=$intRelValue " . + 'WHERE `id` = ' . $intDataId; } - if ($intTplOption == 1) { - $strSQL = 'UPDATE `' .$strDataTable. '` SET `' .$arrRelData['fieldName']."`=$intRelValue, ". - '`' .$arrRelData['fieldName']. '_tploptions` = ' .$intOption. ' WHERE `id` = ' .$intDataId; - } else { - $strSQL = 'UPDATE `' .$strDataTable. '` SET `' .$arrRelData['fieldName']."`=$intRelValue ". - 'WHERE `id` = ' .$intDataId; - } - $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + $booResult = $this->myDBClass->insertData($strSQL); + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } } @@ -1406,21 +1491,21 @@ class NagImportClass /** * Inserts a relation type 3 (templates) - * @param string $strValue Data value - * @param int $intDataId Data ID - * @param string $strDataTable Data table (Master) - * @param array $arrRelData Relation data + * @param string $strValue Data value + * @param int $intDataId Data ID + * @param string $strDataTable Data table (Master) + * @param array $arrRelData Relation data */ - public function writeRelation3($strValue, $intDataId, $strDataTable, $arrRelData) + public function writeRelation3(string $strValue, int $intDataId, string $strDataTable, array $arrRelData): void { - // Define variables + /* Define variables */ $intSlaveId = 0; - $intTable = 0; - $intSortNr = 1; - if (strtolower(trim($strValue)) == 'null') { - // Update data in master table - $strSQL = 'UPDATE `' .$strDataTable. '` SET `' .$arrRelData['fieldName']. '` = 0, ' . - '`' .$arrRelData['fieldName']. '_tploptions` = 1 WHERE `id` = ' .$intDataId; + $intTable = 0; + $intSortNr = 1; + if (strtolower(trim($strValue)) === 'null') { + /* Update data in master table */ + $strSQL = 'UPDATE `' . $strDataTable . '` SET `' . $arrRelData['fieldName'] . '` = 0, ' . + '`' . $arrRelData['fieldName'] . '_tploptions` = 1 WHERE `id` = ' . $intDataId; $this->myDBClass->insertData($strSQL); } else { if (0 === strpos(trim($strValue), '+')) { @@ -1429,61 +1514,66 @@ class NagImportClass } else { $intOption = 2; } - // Remove old relations - $strSQL = 'DELETE FROM `' .$arrRelData['linkTable']. '` WHERE `idMaster` = ' .$intDataId; + /* Remove old relations */ + /** @noinspection SqlResolve */ + $strSQL = 'DELETE FROM `' . $arrRelData['linkTable'] . '` WHERE `idMaster` = ' . $intDataId; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } - // Decompose data value + /* Decompose data value */ $arrValues = explode(',', $strValue); - // Process data values + /* Process data values */ foreach ($arrValues as $elem) { - // Does the template already exist? (table 1) - $strSQL = 'SELECT `id` FROM `' .$arrRelData['tableName1']. '` ' . - 'WHERE `' .$arrRelData['target1']."` = '".$elem."' AND `config_id`=".$this->intDomainId; - $strId = $this->myDBClass->getFieldData($strSQL); - if ($strId != '') { + /* Does the template already exist? (table 1) */ + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $arrRelData['tableName1'] . '` ' . + 'WHERE `' . $arrRelData['target1'] . "` = '" . $elem . "' AND `config_id`=" . $this->intDomainId; + $strId = $this->myDBClass->getFieldData($strSQL); + if ($strId !== '') { $intSlaveId = (int)$strId; $intTable = 1; } - if ($intSlaveId == 0) { - // Does the template already exist? (table 2) - $strSQL = 'SELECT `id` FROM `' .$arrRelData['tableName2']. '` ' . - 'WHERE `' .$arrRelData['target2']."` = '".$elem."' AND `config_id`=".$this->intDomainId; - $strId = $this->myDBClass->getFieldData($strSQL); - if ($strId != '') { + if ($intSlaveId === 0) { + /* Does the template already exist? (table 2) */ + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $arrRelData['tableName2'] . '` ' . + 'WHERE `' . $arrRelData['target2'] . "` = '" . $elem . "' AND `config_id`=" . $this->intDomainId; + $strId = $this->myDBClass->getFieldData($strSQL); + if ($strId !== '') { $intSlaveId = (int)$strId; - $intTable = 2; + $intTable = 2; } } - if ($intSlaveId == 0) { - // Insert a temporary value to the target table - $strSQL = 'INSERT INTO `' .$arrRelData['tableName1']. '` ' . - 'SET `' .$arrRelData['target1']."` = '".$elem."', `config_id`=".$this->intDomainId. ', ' . + if ($intSlaveId === 0) { + /* Insert a temporary value to the target table */ + /** @noinspection SqlResolve */ + $strSQL = 'INSERT INTO `' . $arrRelData['tableName1'] . '` ' . + 'SET `' . $arrRelData['target1'] . "` = '" . $elem . "', `config_id`=" . $this->intDomainId . ', ' . "`active`='0', `last_modified`=NOW()"; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } $intSlaveId = $this->myDBClass->intLastId; - $intTable = 1; + $intTable = 1; } - // Insert relations - $strSQL = 'INSERT INTO `' .$arrRelData['linkTable']. '` ' . - 'SET `idMaster` = ' .$intDataId. ', `idSlave`=' .$intSlaveId. ', `idSort`=' .$intSortNr. ', ' . - '`idTable` = ' .$intTable; + /* Insert relations */ + /** @noinspection SqlResolve */ + $strSQL = 'INSERT INTO `' . $arrRelData['linkTable'] . '` ' . + 'SET `idMaster` = ' . $intDataId . ', `idSlave`=' . $intSlaveId . ', `idSort`=' . $intSortNr . ', ' . + '`idTable` = ' . $intTable; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } $intSortNr++; $intSlaveId = 0; - // Update field data in master table - $strSQL = 'UPDATE `' .$strDataTable. '` SET `' .$arrRelData['fieldName']. '` = 1, ' . - '`' .$arrRelData['fieldName']. '_tploptions` = ' .$intOption. ' WHERE `id` = ' .$intDataId; + /* Update field data in master table */ + $strSQL = 'UPDATE `' . $strDataTable . '` SET `' . $arrRelData['fieldName'] . '` = 1, ' . + '`' . $arrRelData['fieldName'] . '_tploptions` = ' . $intOption . ' WHERE `id` = ' . $intDataId; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } } @@ -1492,275 +1582,231 @@ class NagImportClass /** * Inserts a relation type 4 (free variables) - * @param string $strKey Data field name - * @param string $strValue Data value - * @param int $intDataId Data ID - * @param string $strDataTable Data table (Master) - * @param array $arrRelData Relation data - * @return int 0 = successful / 1 = error + * @param string $strKey Data field name + * @param string $strValue Data value + * @param int $intDataId Data ID + * @param int $intRemoveData 0 = do not remove data / 1 = do remove data + * @param string $strDataTable Data table (Master) + * @param array $arrRelData Relation data + * @return int 0 = successful / 1 = error */ - public function writeRelation4($strKey, $strValue, $intDataId, $strDataTable, $arrRelData) + public function writeRelation4(string $strKey, string $strValue, int $intDataId, int $intRemoveData, string $strDataTable, array $arrRelData): int { - // Define variables + /* Define variables */ $intReturn = 0; - // Remove empty variables - if (($strKey == '') || ($strValue == '')) { + /* Remove empty variables */ + if (($strKey === '') || ($strValue === '')) { $intReturn = 1; } - // Remove NagiosQL variables - if ($strKey == '_NAGIOSQL_CONFIG_NAME') { + /* Remove NagiosQL variables */ + if ($strKey === '_NAGIOSQL_CONFIG_NAME') { $intReturn = 1; } - if ($intReturn == 0) { - // Remove old variables - $strSQL = 'SELECT * FROM '.$arrRelData['linkTable'].' WHERE idMaster='.$intDataId; + /* Remove old variables */ + if ($intRemoveData === 1) { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM ' . $arrRelData['linkTable'] . ' WHERE idMaster=' . $intDataId; $booResult = $this->myDBClass->hasDataArray($strSQL, $arrLinkData, $intLinkCount); - if ($booResult && ($intLinkCount != 0)) { + if ($booResult && ($intLinkCount !== 0)) { /** @var array $arrLinkData */ foreach ($arrLinkData as $elem) { - $strSQL1 = 'DELETE FROM tbl_variabledefinition WHERE id=' .$elem['idSlave']; + $strSQL1 = 'DELETE FROM tbl_variabledefinition WHERE id=' . $elem['idSlave']; $booResult = $this->myDBClass->insertData($strSQL1); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } - $strSQL2 = 'DELETE FROM '.$arrRelData['linkTable'].' WHERE idMaster='.$elem['idMaster']; + /** @noinspection SqlResolve */ + $strSQL2 = 'DELETE FROM ' . $arrRelData['linkTable'] . ' WHERE idMaster=' . $elem['idMaster']; $booResult = $this->myDBClass->insertData($strSQL2); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } } } - // Insert values to the table + } + /* Insert free Variables */ + if ($intReturn === 0) { + /* Insert values to the table */ $strSQL = "INSERT INTO `tbl_variabledefinition` SET `name` = '" . addslashes($strKey) . "', " . "`value` = '" . addslashes($strValue) . "', `last_modified`=now()"; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } $intSlaveId = $this->myDBClass->intLastId; - // Insert relations to the table + /* Insert relations to the table */ + /** @noinspection SqlResolve */ $strSQL = 'INSERT INTO `' . $arrRelData['linkTable'] . '` ' . 'SET `idMaster` = ' . $intDataId . ', `idSlave` = ' . $intSlaveId; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } - // Update data in master table + /* Update data in master table */ $strSQL = 'UPDATE `' . $strDataTable . '` SET `use_variables` = 1 WHERE `id` = ' . $intDataId; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } } return $intReturn; } - /** - * Inserts a relation type 5 (1:1 check command) - * @param string $strValue Data value - * @param int $intDataId Data ID - * @param string $strDataTable Data table (Master) - * @param array $arrRelData Relation data - */ - public function writeRelation5($strValue, $intDataId, $strDataTable, $arrRelData) - { - // Extract data values - $arrCommand = explode('!', $strValue); - $strValue = $arrCommand[0]; - // Define variables - $intSlaveId = 0; - if (strtolower(trim($strValue)) == 'null') { - // Update data in master table - $strSQL = 'UPDATE `' .$strDataTable. '` SET `' .$arrRelData['fieldName']. '` = -1 WHERE `id` = ' . - $intDataId; - $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { - $this->strErrorMessage .= $this->myDBClass->strErrorMessage; - } - } else { - // Decompose data values - $arrValues = explode(',', $strValue); - // Process data values - foreach ($arrValues as $elem) { - // Does the entry already exist? - $strSQL = 'SELECT `id` FROM `' .$arrRelData['tableName1']. '` ' . - 'WHERE `' .$arrRelData['target1']."` = '".$elem."' AND `config_id`=".$this->intDomainId; - $strId = $this->myDBClass->getFieldData($strSQL); - if ($strId != '') { - $intSlaveId = (int)$strId; - } - if ($intSlaveId == 0) { - // Insert a temporary value in target table - $strSQL = 'INSERT INTO `' .$arrRelData['tableName1']. '` ' . - 'SET `' .$arrRelData['target1']."` = '".$elem."', `config_id`=".$this->intDomainId. ', ' . - "`active`='0', `last_modified`=NOW()"; - $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { - $this->strErrorMessage .= $this->myDBClass->strErrorMessage; - } - $intSlaveId = $this->myDBClass->intLastId; - } - // Update data in master table - $arrCommand[0] = $intSlaveId; - $strValue = implode('!', $arrCommand); - $strSQL = 'UPDATE `' .$strDataTable. '` ' . - 'SET `' .$arrRelData['fieldName']."`='".$this->myDBClass->realEscape($strValue)."' ". - 'WHERE `id` = ' .$intDataId; - $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { - $this->strErrorMessage .= $this->myDBClass->strErrorMessage; - } - } - } - } - - /////////////////////////////////////////////////////////////////////////////////////////// /** * Inserts a relation type 5 (1:n:n service groups) - * @param string $strValue Data value - * @param int $intDataId Data ID - * @param string $strDataTable Data table (Master) - * @param array $arrRelData Relation data + * @param string $strValue Data value + * @param int $intDataId Data ID + * @param string $strDataTable Data table (Master) + * @param array $arrRelData Relation data */ - public function writeRelation6($strValue, $intDataId, $strDataTable, $arrRelData) + public function writeRelation6(string $strValue, int $intDataId, string $strDataTable, array $arrRelData): void { - // Define variables - $intSlaveIdH = 0; + /* Define variables */ + $intSlaveIdH = 0; $intSlaveIdHG = 0; - // Decompose data value - $arrValues = explode(',', $strValue); - // Remove data from link table - $strSQL = 'DELETE FROM `' .$arrRelData['linkTable']. '` WHERE `idMaster` = ' .$intDataId; + /* Decompose data value */ + $arrValues = explode(',', $strValue); + /* Remove data from link table */ + /** @noinspection SqlResolve */ + $strSQL = 'DELETE FROM `' . $arrRelData['linkTable'] . '` WHERE `idMaster` = ' . $intDataId; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } - // Check the sum of elements - if (\count($arrValues) % 2 != 0) { + /* Check the sum of elements */ + if (count($arrValues) % 2 !== 0) { $this->strErrorMessage .= translate('Error: incorrect number of arguments - cannot import service group ' . - 'members'). '::'; + 'members') . '::'; } else { - // Process data values + /* Process data values */ $intCounter = 1; foreach ($arrValues as $elem) { - if ($intCounter % 2 == 0) { - // Does the host entry already exist? - $strSQL = 'SELECT `id` FROM `' .$arrRelData['tableName1']. '` ' . - 'WHERE `' .$arrRelData['target1']."` = '".$strValue."' AND `active`='1' ". - 'AND `config_id`=' .$this->intDomainId; - $strId = $this->myDBClass->getFieldData($strSQL); - if ($strId != '') { + if ($intCounter % 2 === 0) { + /* Does the host entry already exist? */ + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $arrRelData['tableName1'] . '` ' . + 'WHERE `' . $arrRelData['target1'] . "` = '" . $strValue . "' AND `active`='1' " . + 'AND `config_id`=' . $this->intDomainId; + $strId = $this->myDBClass->getFieldData($strSQL); + if ($strId !== '') { $intSlaveIdH = (int)$strId; } - // Does a hostgroup entry already exist? - if ($intSlaveIdH == 0) { - $strSQL = "SELECT `id` FROM `tbl_hostgroup` WHERE `hostgroup_name` = '".$strValue."' ". - "AND `active`='1' AND `config_id`=".$this->intDomainId; - $strId = $this->myDBClass->getFieldData($strSQL); - if ($strId != '') { + /* Does a hostgroup entry already exist? */ + if ($intSlaveIdH === 0) { + $strSQL = "SELECT `id` FROM `tbl_hostgroup` WHERE `hostgroup_name` = '" . $strValue . "' " . + "AND `active`='1' AND `config_id`=" . $this->intDomainId; + $strId = $this->myDBClass->getFieldData($strSQL); + if ($strId !== '') { $intSlaveIdHG = (int)$strId; } } - if (($intSlaveIdH == 0) && ($intSlaveIdHG == 0)) { - // Insert a temporary value in table - $strSQL = 'INSERT INTO `' .$arrRelData['tableName1']. '` ' . - 'SET `' .$arrRelData['target1']."` = '".$strValue."', ". - '`config_id`=' .$this->intDomainId.", `active`='0', `last_modified`=NOW()"; + if (($intSlaveIdH === 0) && ($intSlaveIdHG === 0)) { + /* Insert a temporary value in table */ + /** @noinspection SqlResolve */ + $strSQL = 'INSERT INTO `' . $arrRelData['tableName1'] . '` ' . + 'SET `' . $arrRelData['target1'] . "` = '" . $strValue . "', " . + '`config_id`=' . $this->intDomainId . ", `active`='0', `last_modified`=NOW()"; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } - $intSlaveIdH = $this->myDBClass->intLastId; + $intSlaveIdH = $this->myDBClass->intLastId; } - // Does the service entry already exist? - if ($intSlaveIdH != 0) { - $strSQL = 'SELECT `id` FROM `' .$arrRelData['tableName2']. '` ' . + /* Does the service entry already exist? */ + if ($intSlaveIdH !== 0) { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $arrRelData['tableName2'] . '` ' . 'LEFT JOIN `tbl_lnkServiceToHost` ON `id` = `idMaster` ' . - 'WHERE `' .$arrRelData['target2']."` = '".$elem."' AND `idSlave` = ".$intSlaveIdH. ' ' . - 'AND `config_id`=' .$this->intDomainId; - $strId = $this->myDBClass->getFieldData($strSQL); - if ($strId == '') { - $strSQL = 'SELECT `id` FROM `' .$arrRelData['tableName2']. '` ' . + 'WHERE `' . $arrRelData['target2'] . "` = '" . $elem . "' AND `idSlave` = " . $intSlaveIdH . ' ' . + 'AND `config_id`=' . $this->intDomainId; + $strId = $this->myDBClass->getFieldData($strSQL); + if ($strId === '') { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $arrRelData['tableName2'] . '` ' . 'LEFT JOIN `tbl_lnkServiceToHostgroup` ON ' . '`id`=`tbl_lnkServiceToHostgroup`.`idMaster` ' . 'LEFT JOIN `tbl_lnkHostgroupToHost` ON ' . '`tbl_lnkHostgroupToHost`.`idMaster`=`tbl_lnkServiceToHostgroup`.`idSlave` ' . - 'WHERE `' .$arrRelData['target2']."` = '".$elem."' AND ". - '`tbl_lnkHostgroupToHost`.`idSlave` = ' .$intSlaveIdH. ' AND ' . - "`active`='1' AND `config_id`=".$this->intDomainId; - $strId = $this->myDBClass->getFieldData($strSQL); + 'WHERE `' . $arrRelData['target2'] . "` = '" . $elem . "' AND " . + '`tbl_lnkHostgroupToHost`.`idSlave` = ' . $intSlaveIdH . ' AND ' . + "`active`='1' AND `config_id`=" . $this->intDomainId; + $strId = $this->myDBClass->getFieldData($strSQL); } - if ($strId == '') { - $strSQL = 'SELECT `id` FROM `' .$arrRelData['tableName2']. '` ' . + if ($strId === '') { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $arrRelData['tableName2'] . '` ' . 'LEFT JOIN `tbl_lnkServiceToHostgroup` ON ' . '`id` = `tbl_lnkServiceToHostgroup`.`idMaster` ' . 'LEFT JOIN `tbl_lnkHostToHostgroup` ON ' . '`tbl_lnkHostToHostgroup`.`idSlave`=`tbl_lnkServiceToHostgroup`.`idSlave` ' . - 'WHERE `' .$arrRelData['target2']."` = '".$elem."' AND ". - '`tbl_lnkHostToHostgroup`.`idMaster` = ' .$intSlaveIdH. ' AND ' . - "`active`='1' AND `config_id`=".$this->intDomainId; - $strId = $this->myDBClass->getFieldData($strSQL); + 'WHERE `' . $arrRelData['target2'] . "` = '" . $elem . "' AND " . + '`tbl_lnkHostToHostgroup`.`idMaster` = ' . $intSlaveIdH . ' AND ' . + "`active`='1' AND `config_id`=" . $this->intDomainId; + $strId = $this->myDBClass->getFieldData($strSQL); } - } elseif ($intSlaveIdHG != 0) { - $strSQL = 'SELECT `id` FROM `' .$arrRelData['tableName2']. '` ' . + } elseif ($intSlaveIdHG !== 0) { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $arrRelData['tableName2'] . '` ' . 'LEFT JOIN `tbl_lnkServiceToHostgroup` ON `id` = `idMaster` ' . - 'WHERE `' .$arrRelData['target2']."` = '".$elem."' AND `idSlave`=".$intSlaveIdHG. ' ' . - "AND `active`='1' AND `config_id`=".$this->intDomainId; - $strId = $this->myDBClass->getFieldData($strSQL); + 'WHERE `' . $arrRelData['target2'] . "` = '" . $elem . "' AND `idSlave`=" . $intSlaveIdHG . ' ' . + "AND `active`='1' AND `config_id`=" . $this->intDomainId; + $strId = $this->myDBClass->getFieldData($strSQL); } - if ($strId != '') { + if ($strId !== '') { $intSlaveIdS = (int)$strId; } else { $intSlaveIdS = 0; } - if ($intSlaveIdS == 0) { - // Insert a temporary value in table - $intHostName = 0; + if ($intSlaveIdS === 0) { + /* Insert a temporary value in table */ + $intHostName = 0; $intHostgroupName = 0; - if ($intSlaveIdH != 0) { - $intHostName = 1; - } elseif ($intSlaveIdHG != 0) { - $intHostgroupName = 1; + if ($intSlaveIdH !== 0) { + $intHostName = 1; + } elseif ($intSlaveIdHG !== 0) { + $intHostgroupName = 1; } - $strSQL = 'INSERT INTO `' .$arrRelData['tableName2']. '` ' . - "SET `config_name`='imp_tmp_by_servicegroup', `host_name`=$intHostName, ". - "`hostgroup_name`=$intHostgroupName, `".$arrRelData['target2']."` = '".$elem."', ". - '`config_id`=' .$this->intDomainId.", `active`='0', `last_modified`=NOW()"; + /** @noinspection SqlResolve */ + $strSQL = 'INSERT INTO `' . $arrRelData['tableName2'] . '` ' . + "SET `config_name`='imp_tmp_by_servicegroup', `host_name`=$intHostName, " . + "`hostgroup_name`=$intHostgroupName, `" . $arrRelData['target2'] . "` = '" . $elem . "', " . + '`config_id`=' . $this->intDomainId . ", `active`='0', `last_modified`=NOW()"; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } $intSlaveIdS = $this->myDBClass->intLastId; - // Make a relation from temp service to host / hostgroup - if ($intSlaveIdH != 0) { - $strSQL = 'INSERT INTO `tbl_lnkServiceToHost` ' . - "SET `idMaster`='".$intSlaveIdS."', `idSlave`=".$intSlaveIdH.", `exclude`='0'"; + /* Make a relation from temp service to host / hostgroup */ + if ($intSlaveIdH !== 0) { + $strSQL = 'INSERT INTO `tbl_lnkServiceToHost` ' . + "SET `idMaster`='" . $intSlaveIdS . "', `idSlave`=" . $intSlaveIdH . ", `exclude`='0'"; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } - } elseif ($intSlaveIdHG != 0) { - $strSQL = 'INSERT INTO `tbl_lnkServiceToHostgroup` ' . - "SET `idMaster`='".$intSlaveIdS."', `idSlave`=".$intSlaveIdHG. ', ' . + } elseif ($intSlaveIdHG !== 0) { + $strSQL = 'INSERT INTO `tbl_lnkServiceToHostgroup` ' . + "SET `idMaster`='" . $intSlaveIdS . "', `idSlave`=" . $intSlaveIdHG . ', ' . "`exclude`='0'"; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } } } - // Insert relation - $strSQL = 'INSERT INTO `' .$arrRelData['linkTable']. '` ' . - 'SET `idMaster`=' .$intDataId. ', `idSlaveH`=' .$intSlaveIdH. ', `idSlaveS`=' .$intSlaveIdS; + /* Insert relation */ + /** @noinspection SqlResolve */ + $strSQL = 'INSERT INTO `' . $arrRelData['linkTable'] . '` ' . + 'SET `idMaster`=' . $intDataId . ', `idSlaveH`=' . $intSlaveIdH . ', `idSlaveS`=' . $intSlaveIdS; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } - // Update data in master table - $strSQL = 'UPDATE `' .$strDataTable. '` ' . - 'SET `' .$arrRelData['fieldName']. '` = 1 WHERE `id` = ' .$intDataId; + /* Update data in master table */ + $strSQL = 'UPDATE `' . $strDataTable . '` ' . + 'SET `' . $arrRelData['fieldName'] . '` = 1 WHERE `id` = ' . $intDataId; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } } else { @@ -1772,109 +1818,113 @@ class NagImportClass } /** - * Inserts a relation type 6 (1:n:str) - * @param string $strValue Data value - * @param int $intDataId Data ID - * @param string $strDataTable Data table (Master) - * @param array $arrRelData Relation data + * Inserts a relation type 7 (1:n:str) + * @param string $strValue Data value + * @param int $intDataId Data ID + * @param string $strDataTable Data table (Master) + * @param array $arrRelData Relation data */ - public function writeRelation7($strValue, $intDataId, $strDataTable, $arrRelData) + public function writeRelation7(string $strValue, int $intDataId, string $strDataTable, array $arrRelData): void { - // Delete data from link table - $strSQL = 'DELETE FROM `' .$arrRelData['linkTable']. '` WHERE `idMaster` = ' .$intDataId; - $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + /* Delete data from link table */ + /** @noinspection SqlResolve */ + $strSQL = 'DELETE FROM `' . $arrRelData['linkTable'] . '` WHERE `idMaster` = ' . $intDataId; + $booResult = $this->myDBClass->insertData($strSQL); + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } - // Decompose data value + /* Decompose data value */ $arrValues = explode(',', $strValue); - // Process data values + if (substr_count($strValue, '*') !== 0) { + $intRelValue = 2; + } else { + $intRelValue = 1; + } + /* Process data values */ foreach ($arrValues as $elem) { - if ($elem != '*') { + if ($elem !== '*') { $strWhere = ''; - // Exclude values + /* Exclude values */ if (0 === strpos($elem, '!')) { $intExclude = 1; $elem = substr($elem, 1); } else { $intExclude = 0; } - // Does the entry already exist? - $strSQL = 'SELECT `id` FROM `' .$arrRelData['tableName1']. '` ' . - 'WHERE `' .$arrRelData['target1']."`='".$elem."' $strWhere ". - 'AND `config_id`=' .$this->intDomainId; - $strId = $this->myDBClass->getFieldData($strSQL); - if ($strId != '') { + /* Does the entry already exist? */ + /** @noinspection SqlResolve */ + $strSQL = 'SELECT `id` FROM `' . $arrRelData['tableName1'] . '` ' . + 'WHERE `' . $arrRelData['target1'] . "`='" . $elem . "' $strWhere " . + 'AND `config_id`=' . $this->intDomainId; + $strId = $this->myDBClass->getFieldData($strSQL); + if ($strId !== '') { $intSlaveId = (int)$strId; } else { $intSlaveId = 0; } - if (($intSlaveId == 0) && ($elem != '*')) { - // Insert a temporary value to the target table - $strSQL = 'INSERT INTO `' .$arrRelData['tableName1']. '` ' . - 'SET `' .$arrRelData['target1']."` = '".$elem."', `host_name`=2, `hostgroup_name`=2, ". - "`config_name`='imp_tmp_by_servicedependency', `config_id`=".$this->intDomainId. ', ' . + if (($intSlaveId === 0) && ($elem !== '*')) { + /* Insert a temporary value to the target table */ + /** @noinspection SqlResolve */ + $strSQL = 'INSERT INTO `' . $arrRelData['tableName1'] . '` ' . + 'SET `' . $arrRelData['target1'] . "` = '" . $elem . "', `host_name`=2, `hostgroup_name`=2, " . + "`config_name`='imp_tmp_by_servicedependency', `config_id`=" . $this->intDomainId . ', ' . "`active`='0', `last_modified`=NOW()"; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } $intSlaveId = $this->myDBClass->intLastId; } - // Insert relations - $strSQL = 'INSERT INTO `' .$arrRelData['linkTable']. '` ' . - 'SET `idMaster` = ' .$intDataId. ', `idSlave` = ' .$intSlaveId.", `strSlave`='".$elem."', ". - '`exclude`=' .$intExclude; + /* Insert relations */ + /** @noinspection SqlResolve */ + $strSQL = 'INSERT INTO `' . $arrRelData['linkTable'] . '` ' . + 'SET `idMaster` = ' . $intDataId . ', `idSlave` = ' . $intSlaveId . ", `strSlave`='" . $elem . "', " . + '`exclude`=' . $intExclude; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } } - // Update field values in master table - if (substr_count($strValue, '*') != 0) { - $intRelValue = 2; - } else { - $intRelValue = 1; - } - $strSQL = 'UPDATE `' .$strDataTable. '` ' . - 'SET `' .$arrRelData['fieldName']."` = $intRelValue WHERE `id` = ".$intDataId; + /* Update field values in master table */ + $strSQL = 'UPDATE `' . $strDataTable . '` ' . + 'SET `' . $arrRelData['fieldName'] . "` = $intRelValue WHERE `id` = " . $intDataId; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } } } /** - * Inserts a relation type 6 (service and servicetemplate parents - 1:service:host) - * @param string $strValue Data value - * @param int $intDataId Data ID - * @param string $strDataTable Data table (Master) - * @param array $arrRelData Relation data + * Inserts a relation type 8 (service and servicetemplate parents - 1:service:host) + * @param string $strValue Data value + * @param int $intDataId Data ID + * @param string $strDataTable Data table (Master) + * @param array $arrRelData Relation data */ - public function writeRelation8($strValue, $intDataId, $strDataTable, $arrRelData) + public function writeRelation8(string $strValue, int $intDataId, string $strDataTable, array $arrRelData): void { - // Decompose data value + /* Decompose data value */ $arrValues = explode(',', $strValue); - // Delete data from link table - $strSQL = 'DELETE FROM `' .$arrRelData['linkTable']. '` WHERE `idMaster` = ' .$intDataId; - $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + /* Delete data from link table */ + /** @noinspection SqlResolve */ + $strSQL = 'DELETE FROM `' . $arrRelData['linkTable'] . '` WHERE `idMaster` = ' . $intDataId; + $booResult = $this->myDBClass->insertData($strSQL); + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } - // Check the sum of elements - /** @noinspection ExplodeMissUseInspection */ - if (count($arrValues) % 2 != 0) { + /* Check the sum of elements */ + if (count($arrValues) % 2 !== 0) { $this->strErrorMessage .= translate('Error: incorrect number of arguments - cannot import service parent ' . - 'members'). '::'; + 'members') . '::'; } else { - // Process data values - $intCounter = 1; + /* Process data values */ + $intCounter = 1; $strHostName = ''; foreach ($arrValues as $elem) { - if ($intCounter % 2 == 0) { + if ($intCounter % 2 === 0) { $strServiceName = $elem; - if (($strServiceName != '') && ($strHostName != '')) { + if (($strServiceName !== '') && ($strHostName !== '')) { $strSQL = 'SELECT tbl_service.id AS id_1, C.id AS id_2, D.id AS id_3, E.id AS id_4 ' . 'FROM tbl_service ' . 'LEFT JOIN tbl_lnkServiceToHost ON tbl_service.id=tbl_lnkServiceToHost.idMaster ' @@ -1885,44 +1935,45 @@ class NagImportClass . 'LEFT JOIN tbl_host AS C ON A.idSlave=C.id ' . 'LEFT JOIN tbl_host AS D ON B.idMaster=D.id ' . 'LEFT JOIN tbl_host AS E ON tbl_lnkServiceToHost.idSlave=E.id ' - . "WHERE tbl_service.service_description='".$strServiceName."' " - . "AND (C.host_name='".$strHostName."' OR D.host_name='".$strHostName."' " - . "OR E.host_name='".$strHostName."')"; + . "WHERE tbl_service.service_description='" . $strServiceName . "' " + . "AND (C.host_name='" . $strHostName . "' OR D.host_name='" . $strHostName . "' " + . "OR E.host_name='" . $strHostName . "')"; $booResult = $this->myDBClass->hasDataArray($strSQL, $arrDataset, $intCount); - if ($booResult && ($intCount == 1)) { + if ($booResult && ($intCount === 1)) { $intServiceId = 0; - $intHostId = 0; - $intId1 = $arrDataset[0]['id_1']; - $intId2 = $arrDataset[0]['id_2']; - $intId3 = $arrDataset[0]['id_3']; - $intId4 = $arrDataset[0]['id_4']; - if (($intId1!= null) && ($intId1 != 0) && ($intServiceId == 0)) { + $intHostId = 0; + $intId1 = $arrDataset[0]['id_1']; + $intId2 = $arrDataset[0]['id_2']; + $intId3 = $arrDataset[0]['id_3']; + $intId4 = $arrDataset[0]['id_4']; + if (($intId1 !== null) && ($intId1 !== 0) && ($intServiceId === 0)) { $intServiceId = (int)$intId1; } $intHostSum = 0; - if (($intId2 != null) && ($intId2 != 0) && ($intHostId == 0)) { - $intHostId = (int)$intId2; + if (($intId2 !== null) && ($intId2 !== 0) && ($intHostId === 0)) { + $intHostId = (int)$intId2; $intHostSum += $intHostId; } - if (($intId3 != null) && ($intId3 != 0) && ($intHostId == 0)) { - $intHostId = (int)$intId3; + if (($intId3 !== null) && ($intId3 !== 0) && ($intHostId === 0)) { + $intHostId = (int)$intId3; $intHostSum += $intHostId; } - if (($intId4 != null) && ($intId4 != 0) && ($intHostId == 0)) { - $intHostId = (int)$intId4; + if (($intId4 !== null) && ($intId4 !== 0) && ($intHostId === 0)) { + $intHostId = (int)$intId4; $intHostSum += $intHostId; } - if (($intHostId == $intHostSum) && ($intServiceId != 0) && ($intHostId != 0)) { - $strSQL = 'INSERT INTO ' .$arrRelData['linkTable']. ' ' + if (($intHostId === $intHostSum) && ($intServiceId !== 0) && ($intHostId !== 0)) { + /** @noinspection SqlResolve */ + $strSQL = 'INSERT INTO ' . $arrRelData['linkTable'] . ' ' . "SET idMaster=$intDataId, idSlave=$intServiceId, idHost=$intHostId"; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } - $strSQL = 'UPDATE `' .$strDataTable. '` ' . - 'SET `' .$arrRelData['fieldName']. '` = 1 WHERE `id` = ' .$intDataId; + $strSQL = 'UPDATE `' . $strDataTable . '` ' . + 'SET `' . $arrRelData['fieldName'] . '` = 1 WHERE `id` = ' . $intDataId; $booResult = $this->myDBClass->insertData($strSQL); - if ($booResult == false) { + if ($booResult === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } } else { @@ -1932,8 +1983,8 @@ class NagImportClass } } else { $this->strErrorMessage .= translate('Error: cannot import the service parent member ') - . $strServiceName. '-' .$strHostName. '. ' - . translate('This combination is not unique or does not exist!').'::'; + . $strServiceName . '-' . $strHostName . '. ' + . translate('This combination is not unique or does not exist!') . '::'; } } } else { @@ -1943,4 +1994,4 @@ class NagImportClass } } } -} +} \ No newline at end of file diff --git a/functions/NagVisualClass.php b/functions/NagVisualClass.php index 6deb6fd..1016825 100644 --- a/functions/NagVisualClass.php +++ b/functions/NagVisualClass.php @@ -1,644 +1,253 @@ arrSettings = $arrSession['SETS']; } if (isset($arrSession['domain'])) { - $this->intDomainId = $arrSession['domain']; + $this->intDomainId = (int)$arrSession['domain']; } $this->arrSession = $arrSession; } - /** - * Search for browser type - * @return string Browser String - */ - public function browserCheck() - { - $strUserAgent = filter_input(INPUT_SERVER, 'HTTP_USER_AGENT', FILTER_SANITIZE_STRING); - // Define variables - $strBrowserString = 'unknown'; - if (false !== stripos($strUserAgent, 'msie')) { - $strBrowserString = 'msie'; - } elseif (false !== stripos($strUserAgent, 'firefox')) { - $strBrowserString = 'firefox'; - } elseif (false !== stripos($strUserAgent, 'opera')) { - $strBrowserString = 'opera'; - } elseif (false !== stripos($strUserAgent, 'chrome')) { - $strBrowserString = 'chrome'; - } - return $strBrowserString; - } - - /** - * Checks if an user has acces to an account group - * @param int $intGroupId Group ID - * @param string $strType Access type (read,write,link) - * @return int 0 = access granted / 1 = no access - */ - public function checkAccountGroup($intGroupId, $strType) - { - // Define variables - $intReturn = 0; - // Admin user or member og group 0 do not need permissions - if (($this->arrSession['userid'] != 1) && ($intGroupId != 0)) { - // Define variables - $arrDataMain = array(); - // Read database values - $strTypeValue = $this->getGroupValue($strType); - if ($strTypeValue != '') { - $strSQL = "SELECT * FROM `tbl_lnkGroupToUser` WHERE `idMaster`=$intGroupId AND ". - '`idSlave`=' .$this->arrSession['userid']." AND $strTypeValue"; - $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrDataMain, $intDataCount); - if ($booReturn == false) { - $this->strErrorMessage .= $this->myDBClass->strErrorMessage; - } - if (($booReturn == false) || ($intDataCount == 0)) { - $intReturn = 1; - } - } - } - return $intReturn; - } - /** * Find out the actual position inside the menu tree and returns it as an info line - * @param int $intPageId Current content id - * @param string $strTop Label string for the root node - * @return string HTML info string + * @param int $intPageId Current content id + * @param string $strTop Label string for the root node + * @return string HTML info string */ - public function getPosition($intPageId, $strTop = '') + public function getPosition(int $intPageId, string $strTop = ''): string { - // Define variables - $arrData = array(); + /* Define variables */ + $arrData = array(); $intDataCount = 0; - $strPosition = ''; - // Read database values - $strSQL = 'SELECT B.`mnuName` AS `mainitem`, B.`mnuLink` AS `mainlink`, A.`mnuName` AS `subitem`, ' + $strPosition = ''; + /* Read database values */ + $strSQL = 'SELECT B.`mnuName` AS `mainitem`, B.`mnuLink` AS `mainlink`, A.`mnuName` AS `subitem`, ' . 'A.`mnuLink` AS `sublink` FROM `tbl_menu` AS A ' - . 'LEFT JOIN `tbl_menu` AS B ON A.`mnuTopId` = B.`mnuId` WHERE A.`mnuId`=' .$intPageId; + . 'LEFT JOIN `tbl_menu` AS B ON A.`mnuTopId` = B.`mnuId` WHERE A.`mnuId`=' . $intPageId; $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($booReturn == false) { + if ($booReturn === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; - } elseif ($intDataCount != 0) { - $strMainLink = $this->arrSettings['path']['base_url'].$arrData[0]['mainlink']; - $strMain = $arrData[0]['mainitem']; - $strSubLink = $this->arrSettings['path']['base_url'].$arrData[0]['sublink']; - $strSub = $arrData[0]['subitem']; - if ($strTop != '') { - $strPosition .= "".$strTop. ' -> '; + } elseif ($intDataCount !== 0) { + $strMainLink = $this->arrSettings['path']['base_url'] . $arrData[0]['mainlink']; + $strMain = $arrData[0]['mainitem']; + $strSubLink = $this->arrSettings['path']['base_url'] . $arrData[0]['sublink']; + $strSub = $arrData[0]['subitem']; + if ($strTop !== '') { + $strPosition .= "" . $strTop . ' -> '; } - if ($strMain != '') { - $strPosition .= "".translate($strMain)." -> ". - translate($strSub). ''; + if (($strMain !== '') && ($strMain !== null)) { + $strPosition .= "" . translate($strMain) . " -> " . + translate($strSub) . ''; } else { - $strPosition .= "".translate($strSub). ''; + $strPosition .= "" . translate($strSub) . ''; } } return $strPosition; } /** - * Returns any group ID with the requested access type - * @param string $strType Access type (read,write,link) - * @return string Comma separated string with group id's + * Generate the main menu HTML + * @param int $intPageId Current content id + * @param int $intCntId Menu group ID + * @return string HTML menu string */ - public function getAccessGroups($strType) + public function getMenu(int $intPageId, int $intCntId = 1): string + { + /* Define variables */ + $strQueryString = filter_input(INPUT_SERVER, 'QUERY_STRING', FILTER_UNSAFE_RAW); + $strPHPSelf = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_UNSAFE_RAW); + + /* Modify URL for visible/invisible menu */ + $strQuery = str_replace( + array('menu=visible&', 'menu=invisible&', 'menu=visible', 'menu=invisible'), + '', + $strQueryString + ); + if ($strQuery !== '') { + $strVisible = str_replace('&', '&', $strPHPSelf . '?menu=visible&' . $strQuery); + $strInvisible = str_replace('&', '&', $strPHPSelf . '?menu=invisible&' . $strQuery); + } else { + $strVisible = $strPHPSelf . '?menu=visible'; + $strInvisible = $strPHPSelf . '?menu=invisible'; + } + $this->intPageId = $intPageId; + if (!isset($this->arrSession['menu']) || ($this->arrSession['menu'] !== 'invisible')) { + /* Menu visible */ + $strHTML = '' . "\n"; + $strHTML .= '' . "\n"; + $this->hasMenuRecursive(0, 'menu', $intCntId, $strHTML); + $strHTML .= '' . "\n"; + $strHTML .= '
[' . translate('Hide menu') . ']' . "\n"; + $strHTML .= ''; + } else { + /* Menu invisible */ + $strHTML = '' . "\n"; + $strHTML .= '' . translate('Show menu') . '' . "\n"; + } + $strHTML .= '' . "\n"; + return $strHTML; + } + + /** + * Recursive function to build the main menu + * @param int $intTopId ID of top menu point + * @param string $strCSS CSS class + * @param int $intCntId Menu group ID + * @param string $strMenuHTML HTML menu string (by Reference) + * @return bool + */ + private function hasMenuRecursive(int $intTopId, string $strCSS, int $intCntId, string &$strMenuHTML): bool + { + /* Define variables */ + $intLevel = substr_count($strCSS, '_sub') + 1; + $booReturn = false; + $arrData = array(); + /* Define SQL */ + $strSQL = 'SELECT mnuId, mnuName, mnuTopId, mnuLink FROM tbl_menu ' . + "WHERE mnuTopId=$intTopId AND mnuCntId=$intCntId AND mnuActive <> 0 AND " . + 'mnuGrpId IN (' . $this->getAccessGroups('read') . ') ORDER BY mnuOrderId'; + $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); + if (($booRet !== false) && ($intDataCount !== 0)) { + $strTemp = ''; + /* Menu items */ + foreach ($arrData as $elem) { + $strName = translate($elem['mnuName']); + $strLink = $this->arrSettings['path']['base_url'] . $elem['mnuLink']; + $intMenuId = (int)$elem['mnuId']; + $strTemp .= ' ' . "\n"; + if (($intMenuId === $this->intPageId) || ($this->isMenuActive($intMenuId) === true)) { + $strTemp .= ' '; + $strTemp .= '' . $strName . '' . "\n"; + $booReturn = true; + } else { + $strTemp .= ' '; + $strTemp .= '' . $strName . '' . "\n"; + } + $strTemp .= ' ' . "\n"; + /* Recursive call to get submenu items */ + if ((($intMenuId === $this->intPageId) || ($this->isMenuActive($intMenuId) === true)) && + $this->hasMenuRecursive($intMenuId, $strCSS . '_sub', $intCntId, $strTemp) === true) { + $booReturn = true; + } + if ($intTopId === $this->intPageId) { + $booReturn = true; + } + } + if ($booReturn === true) { + $strMenuHTML .= $strTemp; + } elseif ($intLevel === 1) { + $strMenuHTML .= $strTemp; + } + } else { + $this->strErrorMessage .= $this->myDBClass->strErrorMessage; + } + return $booReturn; + } + + /** + * Returns any group ID with the requested access type + * @param string $strType Access type (read,write,link) + * @return string Comma separated string with group id's + */ + public function getAccessGroups(string $strType): string { $strReturn = '0,'; - $arrData = array(); - // Admin has rights for all groups - if ($this->arrSession['userid'] == 1) { - $strSQL = 'SELECT `id` FROM `tbl_group`'; + $arrData = array(); + /* Admin has rights for all groups */ + if ((int)$this->arrSession['userid'] === 1) { + $strSQL = 'SELECT `id` FROM `tbl_group`'; $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intCount); - if ($booReturn == false) { + if ($booReturn === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; - } elseif ($intCount != 0) { + } elseif ($intCount !== 0) { foreach ($arrData as $elem) { - $strReturn .= $elem['id']. ','; + $strReturn .= $elem['id'] . ','; } } } else { $strTypeValue = $this->getGroupValue($strType); - $strSQL = 'SELECT `idMaster` FROM `tbl_lnkGroupToUser` ' . + $strSQL = 'SELECT `idMaster` FROM `tbl_lnkGroupToUser` ' . 'WHERE `idSlave`=' . $this->arrSession['userid'] . " AND $strTypeValue"; $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrData, $intCount); - if ($booReturn == false) { + if ($booReturn === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; - } elseif ($intCount != 0) { + } elseif ($intCount !== 0) { foreach ($arrData as $elem) { $strReturn .= $elem['idMaster'] . ','; } } } - if (substr($strReturn, -1) == ',') { + if (substr($strReturn, -1) === ',') { $strReturn = substr($strReturn, 0, -1); } return $strReturn; } - /** - * Generate the main menu HTML - * @param int $intPageId Current content id - * @param int $intCntId Menu group ID - * @return string HTML menu string - */ - public function getMenu($intPageId, $intCntId = 1) - { - // Define variables - $strQueryString = filter_input(INPUT_SERVER, 'QUERY_STRING', FILTER_SANITIZE_STRING); - $strPHPSelf = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING); - - // Modify URL for visible/invisible menu - $strQuery = str_replace( - array('menu=visible&', 'menu=invisible&', 'menu=visible', 'menu=invisible'), - '', - $strQueryString - ); - if ($strQuery != '') { - $strVisible = str_replace('&', '&', $strPHPSelf. '?menu=visible&' .$strQuery); - $strInvisible = str_replace('&', '&', $strPHPSelf. '?menu=invisible&' .$strQuery); - } else { - $strVisible = $strPHPSelf. '?menu=visible'; - $strInvisible = $strPHPSelf. '?menu=invisible'; - } - $this->intPageId = $intPageId; - if (!isset($this->arrSession['menu']) || ($this->arrSession['menu'] != 'invisible')) { - // Menu visible - $strHTML = ''."\n"; - $strHTML .= ''."\n"; - $this->hasMenuRecursive(0, 'menu', $intCntId, $strHTML); - $strHTML .= ''."\n"; - $strHTML .= '
['.translate('Hide menu').']'."\n"; - $strHTML .= ''; - $strHTML .= ''."\n"; - } else { - // Menu invisible - $strHTML = ''."\n"; - $strHTML .= ''.translate('Show menu').''."\n"; - $strHTML .= ''."\n"; - } - return $strHTML; - } - - /** - * Add security features to text values - * @param string $strKey Process string - * @return string Modified process string - */ - public function tfSecure($strKey) - { - $strKey = stripslashes($strKey); - $strKey = $this->myDBClass->realEscape($strKey); - return $strKey; - } - - /** - * Build a string which contains links for additional pages. This is used in data lists - * with more items then defined in settings "lines per page limit" - * @param string $strSite Link to page - * @param int $intDataCount Sum of all data lines - * @param int $chkLimit Actual data limit - * @param string $strOrderBy OrderBy Field - * @param string $strOrderDir Order direction - * @return string Page site number string (HTML) - */ - public function buildPageLinks($strSite, $intDataCount, $chkLimit, $strOrderBy = '', $strOrderDir = '') - { - $intMaxLines = $this->arrSettings['common']['pagelines']; - $intCount = 1; - $intCheck = 0; - $strReturn = ''; - $strSiteHTML = "\n\n\n"; - } else { - $strSiteHTML .= "\n"; - } - $intCheck = 0; - } elseif ($intCheck == 0) { - $strSiteHTML .= "\n"; - $intCheck = 1; - } - $intCount++; - } - $strSiteHTML .= "\n
\n"; - for ($i=0; $i<$intDataCount; $i += $intMaxLines) { - $strLink1 = ""; - $strLink2 = "onclick=\"location.href='$strSite?limit=$i&orderby=$strOrderBy&orderdir=". - "$strOrderDir'\""; - if ((!(($chkLimit >= ($i+($intMaxLines*5))) || ($chkLimit <= ($i-($intMaxLines*5))))) || ($i==0) || - ($i>=($intDataCount-$intMaxLines))) { - if ($chkLimit == $i) { - $strSiteHTML .= "$intCount".$strLink1.$intCount."...
\n"; - if ($intCount > 2) { - $strReturn = $strSiteHTML; - } - return $strReturn; - } - - /** - * Builds a simple selection field inside a template - * @param string $strTable Table name (source data) - * @param string $strTabField Field name (source data) - * @param string $strTemplKey Template key - * @param int $intModeId 0=only data, 1=with empty line at the beginning, - * 2=with empty line and 'null' line at the beginning - * @param int $intSelId Selected data ID (from master table) - * @param int $intExclId Exclude ID - * @return int 0 = successful / 1 = error - */ - public function parseSelectSimple( - $strTable, - $strTabField, - $strTemplKey, - $intModeId = 0, - $intSelId = -9, - $intExclId = -9 - ) { - // Define variables - $intOption = 0; - $arrData = array(); - $intReturn = 1; - // Compute option value - if (($strTemplKey == 'hostcommand') || ($strTemplKey == 'servicecommand')) { - $intOption = 1; - } - if ($strTemplKey == 'eventhandler') { - $intOption = 2; - } - if ($strTemplKey == 'service_extinfo') { - $intOption = 7; - } - // Get version - $this->myConfigClass->getDomainData('version', $intVersion); - // Get raw data - $booRaw = $this->getSelectRawdata($strTable, $strTabField, $arrData, $intOption); - if ($booRaw == 0) { - // Insert an empty line in mode 1 - if (($intModeId == 1) || ($intModeId == 2)) { - $this->myContentTpl->setVariable('SPECIAL_STYLE', ''); - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey), ' '); - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey).'_ID', 0); - if ($intVersion < 3) { - $this->myContentTpl->setVariable('VERSION_20_MUST', 'inpmust'); - } - $this->myContentTpl->parse($strTemplKey); - } - // Insert a 'null' line in mode 2 - if ($intModeId == 2) { - $this->myContentTpl->setVariable('SPECIAL_STYLE', ''); - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey), 'null'); - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey).'_ID', -1); - if ($intVersion < 3) { - $this->myContentTpl->setVariable('VERSION_20_MUST', 'inpmust'); - } - if ($intSelId == -1) { - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey). '_SEL', 'selected'); - } - $this->myContentTpl->parse($strTemplKey); - } - // Insert data sets - foreach ($arrData as $elem) { - $this->myContentTpl->setVariable('SPECIAL_STYLE', ''); - if ($elem['key'] == $intExclId) { - continue; - } - if (isset($elem['active']) && $elem['active'] == 0) { - $strActive=' [inactive]'; - $this->myContentTpl->setVariable('SPECIAL_STYLE', 'inactive_option'); - } else { - $strActive = ''; - } - if (isset($elem['config_id']) && $elem['config_id'] == 0) { - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey), htmlspecialchars( - $elem['value'], - ENT_QUOTES, - 'UTF-8' - ).' [common]'.$strActive); - } else { - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey), htmlspecialchars( - $elem['value'], - ENT_QUOTES, - 'UTF-8' - ).$strActive); - } - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey). '_ID', $elem['key']); - if ($intVersion < 3) { - $this->myContentTpl->setVariable('VERSION_20_MUST', 'inpmust'); - } - if ($intSelId == $elem['key']) { - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey). '_SEL', 'selected'); - } - $this->myContentTpl->parse($strTemplKey); - } - $intReturn = 0; - } - return $intReturn; - } - - /** - * Builds a multi selection field inside a template - * @param string $strTable Table name (source data) - * @param string $strTabField Field name (source data) - * @param string $strTemplKey Template key - * @param string $strLinkTable Name of link table - * @param int $intModeId 0 = only data - * 1 = with empty line at the beginning - * 2 = with * line at the beginning - * @param int $intTypeId Type ID (from master table) - * @param int $intExclId Exclude ID - * @param string $strRefresh Session token for refresh mode - * @return int 0 = successful / 1 = error - */ - public function parseSelectMulti( - $strTable, - $strTabField, - $strTemplKey, - $strLinkTable, - $intModeId = 0, - $intTypeId = -9, - $intExclId = -9, - $strRefresh = '' - ) { - // Compute option value - $intOption = 2; - $intRefresh = 0; - $intReturn = 1; - $arrSelectedAdd = array(); - $arrData = array(); - $booSelAdd = false; - if ($strLinkTable == 'tbl_lnkServicegroupToService') { - $intOption = 3; - } - if ($strLinkTable == 'tbl_lnkServicedependencyToService_DS') { - $intOption = 4; - } - if ($strLinkTable == 'tbl_lnkServicedependencyToService_S') { - $intOption = 5; - } - if ($strLinkTable == 'tbl_lnkServiceescalationToService') { - $intOption = 6; - } - if ($strTemplKey == 'host_services') { - $intOption = 8; - } - if ($strTemplKey == 'service_parents') { - $intOption = 9; - } - if (($strLinkTable == 'tbl_lnkServiceToService') || ($strLinkTable == 'tbl_lnkServicetemplateToService')) { - $intOption = 10; - } - // Get version - $this->myConfigClass->getDomainData('version', $intVersion); - // Get raw data - $booRaw = $this->getSelectRawdata($strTable, $strTabField, $arrData, $intOption); - // Get selected data - $booSel = $this->getSelectedItems($strLinkTable, $arrSelected, $intOption); - // Get additional selected data - if ($strLinkTable == 'tbl_lnkHostToHostgroup') { - $booSelAdd = $this->getSelectedItems('tbl_lnkHostgroupToHost', $arrSelectedAdd, 8); - } - if ($strLinkTable == 'tbl_lnkHostgroupToHost') { - $booSelAdd = $this->getSelectedItems('tbl_lnkHostToHostgroup', $arrSelectedAdd, 8); - } - // Get browser - $strBrowser = $this->browserCheck(); - // Refresh processing (replaces selection array) - if ($strRefresh != '' && isset($this->arrSession['refresh']) && - isset($this->arrSession['refresh'][$strRefresh]) && - \is_array($this->arrSession['refresh'][$strRefresh])) { - $arrSelected = $this->arrSession['refresh'][$strRefresh]; - $intRefresh = 1; - $booSel = 0; - } - if ($booRaw == 0) { - $intCount = 0; - // Insert an empty line in mode 1 - if ($intModeId == 1) { - $this->myContentTpl->setVariable('SPECIAL_STYLE', ''); - $this->myContentTpl->setVariable('OPTION_DISABLED', ''); - if (($strBrowser == 'msie') && ($this->arrSettings['common']['seldisable'] != 0)) { - $this->myContentTpl->setVariable('OPTION_DISABLED', 'disabled="disabled"'); - } - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey), ' '); - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey).'_ID', 0); - if ($intVersion < 3) { - $this->myContentTpl->setVariable('VERSION_20_MUST', 'inpmust'); - } - $this->myContentTpl->parse($strTemplKey); - $intCount++; - } - // Insert an * line in mode 2 - if ($intModeId == 2) { - $this->myContentTpl->setVariable('SPECIAL_STYLE', ''); - $this->myContentTpl->setVariable('OPTION_DISABLED', ''); - if (($strBrowser == 'msie') && ($this->arrSettings['common']['seldisable'] != 0)) { - $this->myContentTpl->setVariable('OPTION_DISABLED', 'disabled="disabled"'); - } - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey), '*'); - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey).'_ID', '*'); - if ($intVersion < 3) { - $this->myContentTpl->setVariable('VERSION_20_MUST', 'inpmust'); - } - if ($intTypeId == 2) { - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey). '_SEL', 'selected'); - } - if (($intRefresh == 1) && \in_array('*', $arrSelected, true)) { - $this->myContentTpl->setVariable('DAT_' .strtoupper($strTemplKey). '_SEL', 'selected'); - $this->myContentTpl->setVariable('IE_' .strtoupper($strTemplKey). '_SEL', 'ieselected'); - } - $intCount++; - $this->myContentTpl->parse($strTemplKey); - } - // Insert data sets - foreach ($arrData as $elem) { - if ($elem['key'] == $intExclId) { - continue; - } - if (( $intOption == 10) && (strstr($elem['key'], '-', true) == $intExclId)) { - continue; - } - if ($elem['value'] == '') { - continue; - } - $intIsSelected = 0; - $intIsExcluded = 0; - $intIsForeign = 0; - $this->myContentTpl->setVariable('SPECIAL_STYLE', ''); - $this->myContentTpl->setVariable('OPTION_DISABLED', ''); - if (($strBrowser == 'msie') && ($this->arrSettings['common']['seldisable'] != 0)) { - $this->myContentTpl->setVariable('OPTION_DISABLED', 'disabled="disabled"'); - } - if (isset($elem['active']) && $elem['active'] == 0) { - $strActive=' [inactive]'; - $this->myContentTpl->setVariable('SPECIAL_STYLE', 'inactive_option'); - } else { - $strActive = ''; - } - if (isset($elem['config_id']) && $elem['config_id'] == 0) { - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey), htmlspecialchars( - $elem['value'], - ENT_QUOTES, - 'UTF-8' - ).' [common]'.$strActive); - } else { - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey), htmlspecialchars( - $elem['value'], - ENT_QUOTES, - 'UTF-8' - ).$strActive); - } - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey). '_ID', $elem['key']); - $this->myContentTpl->setVariable('CLASS_SEL', ''); - if ($intVersion < 3) { - $this->myContentTpl->setVariable('VERSION_20_MUST', 'inpmust'); - } - if (($booSel == 0) && \in_array($elem['key'], $arrSelected, true)) { - $intIsSelected = 1; - } - if (($booSel == 0) && \in_array($elem['value'], $arrSelected, true)) { - $intIsSelected = 1; - } - if ($booSelAdd !== null && ($booSelAdd == 0) && \in_array($elem['key'], $arrSelectedAdd, true)) { - $intIsForeign = 1; - } - if ($booSelAdd !== null && ($booSelAdd == 0) && \in_array($elem['value'], $arrSelectedAdd, true)) { - $intIsForeign = 1; - } - if (($intIsForeign == 1) && ($strActive == '')) { - $this->myContentTpl->setVariable('SPECIAL_STYLE', 'foreign_option'); - } - // Exclude rule - if (($booSel == 0) && \in_array('e' . $elem['key'], $arrSelected, true)) { - $intIsExcluded = 1; - } - if (($booSel == 0) && \in_array('e' . '::' . $elem['value'], $arrSelected, true)) { - $intIsExcluded = 1; - } - if ($intIsExcluded == 1) { - if (isset($elem['config_id']) && $elem['config_id'] == 0) { - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey), '!'. - htmlspecialchars($elem['value'], ENT_QUOTES, 'UTF-8').' [common]'.$strActive); - } else { - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey), '!'. - htmlspecialchars($elem['value'], ENT_QUOTES, 'UTF-8').$strActive); - } - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey). '_ID', 'e'.$elem['key']); - } - if (($intIsSelected == 1) || ($intIsExcluded == 1)) { - $this->myContentTpl->setVariable('DAT_' .strtoupper($strTemplKey). '_SEL', 'selected'); - $this->myContentTpl->setVariable('IE_' .strtoupper($strTemplKey). '_SEL', 'ieselected'); - } - $intCount++; - $this->myContentTpl->parse($strTemplKey); - } - if ($intCount == 0) { - // Insert an empty line to create valid HTML select fields - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey), ' '); - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey).'_ID', 0); - $this->myContentTpl->parse($strTemplKey); - } - $intReturn = 0; - } else { - // Insert an empty line to create valid HTML select fields - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey), ' '); - $this->myContentTpl->setVariable('DAT_'.strtoupper($strTemplKey).'_ID', 0); - $this->myContentTpl->parse($strTemplKey); - } - return $intReturn; - } - - /** - * Merge message strings and check for duplicate messages - * @param string $strNewMessage Message to add - * @param string $strOldMessage Modified message string (by reference) - * @param string $strSeparate Separate string (
or \n) - */ - public function processMessage($strNewMessage, &$strOldMessage, $strSeparate = '
') - { - $strNewMessage = str_replace(array('::::', '::'), array('::', $strSeparate), $strNewMessage); - if (($strOldMessage != '') && ($strNewMessage != '')) { - if (substr_count($strOldMessage, $strNewMessage) == 0) { - if (substr_count(substr($strOldMessage, -5), $strSeparate) == 0) { - $strOldMessage .= $strSeparate.$strNewMessage; - } else { - $strOldMessage .= $strNewMessage; - } - } - } else { - $strOldMessage .= $strNewMessage; - } - } - /** * Returns an SQL fragment based on group access type - * @param string $strType Access type (read,write,link) - * @return string SQL fragment for group selection + * @param string $strType Access type (read,write,link) + * @return string SQL fragment for group selection */ - private function getGroupValue($strType) + private function getGroupValue(string $strType): string { - // Define variables + /* Define variables */ $strTypeValue = ''; - // Select SQL by type + /* Select SQL by type */ switch ($strType) { case 'read': $strTypeValue = "`read`='1'"; @@ -654,53 +263,22 @@ class NagVisualClass } /** - * Recursive function to build the main menu - * @param int intTopId ID of top menu point - * @param string $strCSS CSS class - * @param int $intCntId Menu group ID - * @param string $strMenuHTML HTML menu string (by Reference) - * @return bool + * Check if menu point is selected + * @param int $intMenuId Menu ID + * @return bool true if active */ - private function hasMenuRecursive($intTopId, $strCSS, $intCntId, &$strMenuHTML) + public function isMenuActive(int $intMenuId): bool { - // Define variables - $intLevel = substr_count($strCSS, '_sub') + 1; $booReturn = false; - $arrData = array(); - // Define SQL - $strSQL = 'SELECT mnuId, mnuName, mnuTopId, mnuLink FROM tbl_menu ' . - "WHERE mnuTopId=$intTopId AND mnuCntId=$intCntId AND mnuActive <> 0 AND ". - 'mnuGrpId IN (' .$this->getAccessGroups('read'). ') ORDER BY mnuOrderId'; + $arrData = array(); + $strSQL = 'SELECT mnuTopId FROM tbl_menu WHERE mnuId=' . $this->intPageId . ' AND mnuActive <> 0 ' . + 'AND mnuGrpId IN (' . $this->getAccessGroups('read') . ')'; $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if (($booRet != false) && ($intDataCount != 0)) { - $strTemp = ''; - // Menu items + if (($booRet !== false) && ($intDataCount !== 0)) { foreach ($arrData as $elem) { - $strName = translate($elem['mnuName']); - $strLink = $this->arrSettings['path']['base_url'].$elem['mnuLink']; - $strTemp .= ' '."\n"; - if (($elem['mnuId'] == $this->intPageId) || ($this->isMenuActive($elem['mnuId']) == true)) { - $strTemp .= ' '; - $strTemp .= ''.$strName.''."\n"; - $booReturn = true; - } else { - $strTemp .= ' '; - $strTemp .= ''.$strName.''."\n"; - } - $strTemp .= ' '."\n"; - // Recursive call to get submenu items - if ((($elem['mnuId'] == $this->intPageId) || ($this->isMenuActive($elem['mnuId']) == true)) && - $this->hasMenuRecursive($elem['mnuId'], $strCSS . '_sub', $intCntId, $strTemp) == true) { + if ((int)$elem['mnuTopId'] === $intMenuId) { $booReturn = true; } - if ($intTopId == $this->intPageId) { - $booReturn = true; - } - } - if ($booReturn == true) { - $strMenuHTML .= $strTemp; - } elseif ($intLevel == 1) { - $strMenuHTML .= $strTemp; } } else { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; @@ -709,255 +287,322 @@ class NagVisualClass } /** - * Check if menu point is selected - * @param int $intMenuId Menu ID - * @return bool true if active + * Add security features to text values + * @param string $strKey Process string + * @return string Modified process string */ - public function isMenuActive($intMenuId) + public function tfSecure(string $strKey): string { - $booReturn = false; - $arrData = array(); - $strSQL = 'SELECT mnuTopId FROM tbl_menu WHERE mnuId=' .$this->intPageId. ' AND mnuActive <> 0 ' . - 'AND mnuGrpId IN (' .$this->getAccessGroups('read'). ')'; - $booRet = $this->myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if (($booRet != false) && ($intDataCount != 0)) { - foreach ($arrData as $elem) { - if ($elem['mnuTopId'] == $intMenuId) { - $booReturn = true; + return $this->myDBClass->realEscape(stripslashes($strKey)); + } + + /** + * Build a string which contains links for additional pages. This is used in data lists + * with more items than defined in settings "lines per page limit" + * @param string $strSite Link to page + * @param int $intDataCount Sum of all data lines + * @param int $chkLimit Actual data limit + * @param string $strOrderBy OrderBy Field + * @param string $strOrderDir Order direction + * @return string Page site number string (HTML) + */ + public function buildPageLinks(string $strSite, int $intDataCount, int $chkLimit, string $strOrderBy = '', string $strOrderDir = ''): string + { + $intMaxLines = (int)$this->arrSettings['common']['pagelines']; + $intCount = 1; + $intCheck = 0; + $strReturn = ''; + $strSiteHTML = "\n\n\n"; + } else { + $strSiteHTML .= "\n"; } + $intCheck = 0; + } elseif ($intCheck === 0) { + $strSiteHTML .= "\n"; + $intCheck = 1; } - } else { - $this->strErrorMessage .= $this->myDBClass->strErrorMessage; + $intCount++; } - return $booReturn; + $strSiteHTML .= "\n
\n"; + for ($i = 0; $i < $intDataCount; $i += $intMaxLines) { + $strLink1 = ""; + $strLink2 = "onclick=\"location.href='$strSite?limit=$i&orderby=$strOrderBy&orderdir=" . + "$strOrderDir'\""; + if ((!(($chkLimit >= ($i + ($intMaxLines * 5))) || ($chkLimit <= ($i - ($intMaxLines * 5))))) || ($i === 0) || + ($i >= ($intDataCount - $intMaxLines))) { + if ($chkLimit === $i) { + $strSiteHTML .= "$intCount" . $strLink1 . $intCount . "...
\n"; + if ($intCount > 2) { + $strReturn = $strSiteHTML; + } + return $strReturn; + } + + /** + * Builds a simple selection field inside a template + * @param string $strTable Table name (source data) + * @param string $strTabField Field name (source data) + * @param string $strTemplKey Template key + * @param int $intModeId 0=only data, 1=with empty line at the beginning, 2=with empty line and 'null' line at the beginning + * @param int $intSelId Selected data ID (from master table) + * @param int $intExclId Exclude ID + * @return int 0 = successful / 1 = error + */ + public function parseSelectSimple( + string $strTable, + string $strTabField, + string $strTemplKey, + int $intModeId = 0, + int $intSelId = -9, + int $intExclId = -9 + ): int + { + /* Define variables */ + $intOption = 0; + $arrData = array(); + $intReturn = 1; + /* Compute option value */ + if (($strTemplKey === 'hostcommand') || ($strTemplKey === 'servicecommand')) { + $intOption = 1; + } + if ($strTemplKey === 'eventhandler') { + $intOption = 2; + } + if ($strTemplKey === 'service_extinfo') { + $intOption = 7; + } + /* Get version */ + $this->myConfigClass->getDomainData('version', $strVersion); + $intVersion = (int)$strVersion; + /* Get raw data */ + $intRaw = $this->getSelectRawdata($strTable, $strTabField, $arrData, $intOption); + if ($intRaw === 0) { + /* Insert an empty line in mode 1 */ + if (($intModeId === 1) || ($intModeId === 2)) { + $this->myContentTpl->setVariable('SPECIAL_STYLE'); + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey), ' '); + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey) . '_ID', 0); + if ($intVersion < 3) { + $this->myContentTpl->setVariable('VERSION_20_MUST', 'inpmust'); + } + $this->myContentTpl->parse($strTemplKey); + } + /* Insert a 'null' line in mode 2 */ + if ($intModeId === 2) { + $this->myContentTpl->setVariable('SPECIAL_STYLE'); + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey), 'null'); + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey) . '_ID', -1); + if ($intVersion < 3) { + $this->myContentTpl->setVariable('VERSION_20_MUST', 'inpmust'); + } + if ($intSelId === -1) { + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey) . '_SEL', 'selected'); + } + $this->myContentTpl->parse($strTemplKey); + } + /* Insert data sets */ + foreach ($arrData as $elem) { + if ((int)$elem['key'] === $intExclId) { + continue; + } + if (isset($elem['active']) && (int)$elem['active'] === 0) { + $strActive = ' [inactive]'; + $this->myContentTpl->setVariable('SPECIAL_STYLE', 'inactive_option'); + } else { + $this->myContentTpl->setVariable('SPECIAL_STYLE'); + $strActive = ''; + } + if (isset($elem['config_id']) && (int)$elem['config_id'] === 0) { + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey), htmlspecialchars( + $elem['value'], + ENT_QUOTES + ) . ' [common]' . $strActive); + } else { + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey), htmlspecialchars( + $elem['value'], + ENT_QUOTES + ) . $strActive); + } + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey) . '_ID', $elem['key']); + /** @noinspection DisconnectedForeachInstructionInspection */ + if ($intVersion < 3) { + $this->myContentTpl->setVariable('VERSION_20_MUST', 'inpmust'); + } + if ($intSelId === (int)$elem['key']) { + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey) . '_SEL', 'selected'); + } + /** @noinspection DisconnectedForeachInstructionInspection */ + $this->myContentTpl->parse($strTemplKey); + } + $intReturn = 0; + } + return $intReturn; } /** * Get raw table data - * @param string $strTable Data table name - * @param string $strTabField Data field name - * @param array $arrData Raw data array (by reference) - * @param int $intOption Option value - * @return int 0 = successful / 1 = error + * @param string $strTable Data table name + * @param string $strTabField Data field name + * @param array $arrData Raw data array (by reference) + * @param int $intOption Option value + * @return int 0 = successful / 1 = error */ - public function getSelectRawdata($strTable, $strTabField, &$arrData, $intOption = 0) + public function getSelectRawdata(string $strTable, string $strTabField, array &$arrData, int $intOption = 0): int { - // Define variables - $arrDataRaw = array(); + /* Define variables */ + $arrDataRaw = array(); $intDataCount = 0; - $intReturn = 0; - // Get link rights + $intReturn = 0; + $intDouble = 0; + /* Get link rights */ $strAccess = $this->getAccessGroups('link'); - // Common domain is enabled? - $this->myConfigClass->getDomainData('enable_common', $intCommonEnable); - if ($intCommonEnable == 1) { - $strDomainWhere1 = ' (`config_id`=' .$this->intDomainId. ' OR `config_id`=0) '; - $strDomainWhere2 = ' (`tbl_service`.`config_id`=' .$this->intDomainId. ' OR `tbl_service`.`config_id`=0) '; + /* Common domain is enabled? */ + $this->myConfigClass->getDomainData('enable_common', $strCommonEnable); + $intCommonEnable = (int)$strCommonEnable; + if ($intCommonEnable === 1) { + $strDomainWhere1 = ' (`config_id`=' . $this->intDomainId . ' OR `config_id`=0) '; + $strDomainWhere2 = ' (`tbl_service`.`config_id`=' . $this->intDomainId . ' OR `tbl_service`.`config_id`=0) '; } else { - $strDomainWhere1 = ' `config_id`=' .$this->intDomainId. ' '; - $strDomainWhere2 = ' `tbl_service`.`config_id`=' .$this->intDomainId. ' '; + $strDomainWhere1 = ' `config_id`=' . $this->intDomainId . ' '; + $strDomainWhere2 = ' `tbl_service`.`config_id`=' . $this->intDomainId . ' '; } - // Define SQL commands - if ($strTable == 'tbl_group') { + /* Define SQL commands */ + if ($strTable === 'tbl_group') { $strSQL = $this->getRawDataSQLGroup($strTabField); - } elseif (($strTable == 'tbl_configtarget') || ($strTable == 'tbl_datadomain') || - ($strTable == 'tbl_language')) { + } elseif (($strTable === 'tbl_configtarget') || ($strTable === 'tbl_datadomain') || + ($strTable === 'tbl_language')) { $strSQL = $this->getRawDataSQLDomain($strTable, $strTabField); - } elseif ($strTable == 'tbl_command') { + } elseif ($strTable === 'tbl_command') { $strSQL = $this->getRawDataSQLCommand($strTabField, $strDomainWhere1, $strAccess, $intOption); - } elseif (($strTable == 'tbl_timeperiod') && ($strTabField == 'name')) { + } elseif (($strTable === 'tbl_timeperiod') && ($strTabField === 'name')) { $strSQL = $this->getRawDataSQLTimeperiod($strDomainWhere1, $strAccess); - } elseif (($strTable == 'tbl_service') && ($intOption == 3)) { + } elseif (($strTable === 'tbl_service') && ($intOption === 3)) { $strSQL = $this->getRawDataSQLService3($strDomainWhere2, $strAccess); - } elseif (($strTable == 'tbl_service') && (($intOption == 4) || ($intOption == 5) || ($intOption == 6))) { + $intDouble = 1; + } elseif (($strTable === 'tbl_service') && (($intOption === 4) || ($intOption === 5) || ($intOption === 6))) { $strSQL = $this->getRawDataSQLService456($strTabField, $intOption, $strDomainWhere1, $strAccess); - } elseif (($strTable == 'tbl_service') && ($intOption == 7)) { - if (isset($this->arrSession['refresh']) && isset($this->arrSession['refresh']['se_host'])) { + } elseif (($strTable === 'tbl_service') && ($intOption === 7)) { + if (isset($this->arrSession['refresh']['se_host'])) { $intHostId = $this->arrSession['refresh']['se_host']; $strSQL = $this->getRawDataSQLService7($strTabField, $strDomainWhere1, $intHostId, $strAccess); } else { $strSQL = ''; } - } elseif ((($strTable == 'tbl_service') || ($strTable == 'tbl_servicetemplate')) && - (($intOption == 8) || ($intOption == 9))) { - // Service selection inside Host definition + } elseif ((($strTable === 'tbl_service') || ($strTable === 'tbl_servicetemplate')) && + (($intOption === 8) || ($intOption === 9))) { + /* Service selection inside Host definition */ $strSQL = $this->getRawDataSQLService89($strDomainWhere1, $strAccess); - } elseif ((($strTable == 'tbl_service') || ($strTable == 'tbl_servicetemplate')) && - - ($intOption == 10)) { - // Service selection inside Host definition + } elseif ((($strTable === 'tbl_service') || ($strTable === 'tbl_servicetemplate')) && + ($intOption === 10)) { + /* Service selection inside Host definition */ $strSQL = $this->getRawDataSQLService10($strDomainWhere2, $strAccess); } else { - // Common statement + /* Common statement */ $strSQL = $this->getRawDataSQLCommon($strTable, $strTabField, $strDomainWhere1, $strAccess); } - // Process data - if ($strSQL != '') { + /* Process data */ + if ($strSQL !== '') { $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrDataRaw, $intDataCount); - if ($booReturn == false) { + if ($booReturn === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; $intReturn = 1; } + if ($intDouble === 1) { + $arrDataRawTemp = array(); + $arrKey = array(); + foreach ($arrDataRaw as $elem) { + if (!isset($arrKey[$elem['key']])) { + $arrKey[$elem['key']] = 1; + $arrDataRawTemp[] = $elem; + } + } + $arrDataRaw = $arrDataRawTemp; + } } - if ($strTable == 'tbl_group') { + if ($strTable === 'tbl_group') { $arrTemp = array(); - $arrTemp['key'] = 0; + $arrTemp['key'] = 0; $arrTemp['value'] = translate('Unrestricted access'); $arrData[] = $arrTemp; } - if (($intReturn == 0) && ($intDataCount != 0)) { + if (($intReturn === 0) && ($intDataCount !== 0)) { foreach ($arrDataRaw as $elem) { $arrData[] = $elem; } - } elseif ($strTable != 'tbl_group') { + } elseif ($strTable !== 'tbl_group') { $arrData = array('key' => 0, 'value' => 'no data'); $intReturn = 1; } return $intReturn; } - /** - * Inserts the domain list to the list view template (host and services only) - * @param \HTML_Template_IT $resTemplate Template object - */ - public function insertDomainList($resTemplate) - { - $arrDataDomain = array(); - $strSQL = "SELECT * FROM `tbl_datadomain` WHERE `active` <> '0' ORDER BY `domain`"; - $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrDataDomain, $intDataCount); - if ($booReturn && ($intDataCount != 0)) { - foreach ($arrDataDomain as $elem) { - // Check access rights - if ($this->checkAccountGroup($elem['access_group'], 'read') == 0) { - $resTemplate->setVariable('DOMAIN_ID', $elem['id']); - $resTemplate->setVariable('DOMAIN_NAME', $elem['domain']); - if ($this->arrSession['domain'] == $elem['id']) { - $resTemplate->setVariable('DOMAIN_SEL', 'selected'); - } - $resTemplate->parse('domainlist'); - } - } - } elseif (!$booReturn) { - $this->strErrorMessage .= translate('Error while selecting data from database:'). - '::' .$this->myDBClass->strErrorMessage; - } - } - - /** - * Adds a "/" after a parh string and replaces double "//" with "/" - * @param string $strPath Path string - * @return string Modified path string - */ - public function addSlash($strPath) - { - if ($strPath == '') { - return ''; - } - $strPath .= '/'; - while (substr_count($strPath, '//') != 0) { - $strPath = str_replace('//', '/', $strPath); - } - return $strPath; - } - - /////////////////////////////////////////////////////////////////////////////////////////// - // Function: Process "null" values - /////////////////////////////////////////////////////////////////////////////////////////// - // - // Replaces "NULL" with -1 - // - // Parameters: $strKey Process string - // - // Return value: Modified process string - // - /////////////////////////////////////////////////////////////////////////////////////////// - /** - * Replaces "NULL" with -1 - * @param string $strKey Process string - * @return string Modified process string - */ - public function checkNull($strKey) - { - $strReturn = $strKey; - if (strtoupper($strKey) == 'NULL') { - $strReturn = -1; - } - return $strReturn; - } - - - // PRIVATE functions - /** * Define SQL commands for group table - * @param string $strTabField Table field - * @return string SQL Statement + * @param string $strTabField Table field + * @return string SQL Statement */ - private function getRawDataSQLGroup($strTabField) + private function getRawDataSQLGroup(string $strTabField): string { - $strSQL = 'SELECT `id` AS `key`, `' . $strTabField . '` AS `value`, `active` ' . - "FROM `tbl_group` WHERE `active`='1' AND `" . $strTabField . "` <> '' ". + return 'SELECT `id` AS `key`, `' . $strTabField . '` AS `value`, `active` ' . + "FROM `tbl_group` WHERE `active`='1' AND `" . $strTabField . "` <> '' " . 'AND `' . $strTabField . '` IS NOT NULL ORDER BY `' . $strTabField . '`'; - return $strSQL; } /** * Define SQL commands for configtarget, datadomain and language table - * @param string $strTable Table name - * @param string $strTabField Table field - * @return string SQL Statement + * @param string $strTable Table name + * @param string $strTabField Table field + * @return string SQL Statement */ - private function getRawDataSQLDomain($strTable, $strTabField) + private function getRawDataSQLDomain(string $strTable, string $strTabField): string { - $strSQL = 'SELECT `id` AS `key`, `' . $strTabField . '` AS `value`, `active` ' . + return 'SELECT `id` AS `key`, `' . $strTabField . '` AS `value`, `active` ' . 'FROM `' . $strTable . '` WHERE `' . $strTabField . "` <> '' AND `" . $strTabField . '` IS NOT NULL ORDER BY `' . $strTabField . '`'; - return $strSQL; } /** * Define SQL commands for command table - * @param string $strTabField Table field - * @param string $strDomainWhere1 WHERE SQL domain part - * @param string $strAccess Access groups - * @param int $intOption Command type option - * @return string SQL Statement + * @param string $strTabField Table field + * @param string $strDomainWhere1 WHERE SQL domain part + * @param string $strAccess Access groups + * @param int $intOption Command type option + * @return string SQL Statement */ - private function getRawDataSQLCommand($strTabField, $strDomainWhere1, $strAccess, $intOption) + private function getRawDataSQLCommand(string $strTabField, string $strDomainWhere1, string $strAccess, int $intOption): string { - $strSQL = 'SELECT `id` AS `key`, `' . $strTabField . '` AS `value`, `config_id`, `active` ' . + return 'SELECT `id` AS `key`, `' . $strTabField . '` AS `value`, `config_id`, `active` ' . "FROM `tbl_command` WHERE $strDomainWhere1 AND `" . $strTabField . "` <> '' AND `" . - $strTabField . "` IS NOT NULL AND `access_group` IN ($strAccess) AND (`command_type` = 0 ". + $strTabField . "` IS NOT NULL AND `access_group` IN ($strAccess) AND (`command_type` = 0 " . 'OR `command_type` = ' . $intOption . ') ORDER BY `' . $strTabField . '`'; - return $strSQL; } /** * Define SQL commands for timeperiod table - * @param string $strDomainWhere1 WHERE SQL domain part - * @param string $strAccess Access groups - * @return string SQL Statement + * @param string $strDomainWhere1 WHERE SQL domain part + * @param string $strAccess Access groups + * @return string SQL Statement */ - private function getRawDataSQLTimeperiod($strDomainWhere1, $strAccess) + private function getRawDataSQLTimeperiod(string $strDomainWhere1, string $strAccess): string { - $strSQL = 'SELECT `id` AS `key`, `name` AS `value`, `config_id`, `active` ' . - "FROM `tbl_timeperiod` WHERE $strDomainWhere1 AND `name` <> '' AND `name` IS NOT NULL ". + return 'SELECT `id` AS `key`, `name` AS `value`, `config_id`, `active` ' . + "FROM `tbl_timeperiod` WHERE $strDomainWhere1 AND `name` <> '' AND `name` IS NOT NULL " . "AND `access_group` IN ($strAccess) ORDER BY value"; - return $strSQL; } /** * Define SQL commands for service table - * @param string $strDomainWhere2 WHERE SQL domain part - * @param string $strAccess Access groups - * @return string SQL Statement + * @param string $strDomainWhere2 WHERE SQL domain part + * @param string $strAccess Access groups + * @return string SQL Statement */ - private function getRawDataSQLService3($strDomainWhere2, $strAccess) + private function getRawDataSQLService3(string $strDomainWhere2, string $strAccess): string { $strSQLPart1 = "WHERE $strDomainWhere2 AND `tbl_service`.`service_description` <> '' " . 'AND `tbl_service`.`service_description` IS NOT NULL AND `tbl_service`.`hostgroup_name` <> 0 ' . "AND `tbl_service`.`access_group` IN ($strAccess) "; - $strSQL = "SELECT CONCAT_WS('::',`tbl_host`.`id`,'0',`tbl_service`.`id`) AS `key`, " . + return "SELECT CONCAT_WS('::',`tbl_host`.`id`,'0',`tbl_service`.`id`) AS `key`, " . "CONCAT('H:',`tbl_host`.`host_name`,',',`tbl_service`.`service_description`) AS `value`, " . '`tbl_service`.`active` FROM `tbl_service` ' . 'LEFT JOIN `tbl_lnkServiceToHost` ON `tbl_service`.`id` = `tbl_lnkServiceToHost`.`idMaster` ' . @@ -989,223 +634,61 @@ class NagVisualClass 'LEFT JOIN `tbl_host` ON `tbl_lnkHostToHostgroup`.`idMaster` = `tbl_host`.`id` ' . $strSQLPart1 . 'ORDER BY value'; - return $strSQL; } /** * Define SQL commands for service table - * @param string $strDomainWhere1 WHERE SQL domain part - * @param string $elem Host array - * @param string $strAccess Access groups - * @return string SQL Statement + * @param string $strTabField Table field + * @param int $intOption Option ID + * @param string $strDomainWhere1 WHERE SQL domain part + * @param string $strAccess Access groups + * @return string SQL Statement */ - private function getRawDataSQLService4($strDomainWhere1, $elem, $strAccess) + private function getRawDataSQLService456(string $strTabField, int $intOption, string $strDomainWhere1, string $strAccess): string { - $strSQL = 'SELECT `id`, `service_description` FROM `tbl_service` ' . - 'LEFT JOIN `tbl_lnkServiceToHost` ON `tbl_service`.`id` = `tbl_lnkServiceToHost`.`idMaster` ' . - "WHERE $strDomainWhere1 AND `tbl_lnkServiceToHost`.`idSlave` = $elem AND `service_description`<>'' ". - "AND `service_description` IS NOT NULL AND `access_group` IN ($strAccess) " . - 'UNION ' . - 'SELECT `id`, `service_description` FROM `tbl_service` ' . - 'LEFT JOIN `tbl_lnkServiceToHostgroup` ON `tbl_service`.`id`=`tbl_lnkServiceToHostgroup`.`idMaster` ' . - 'LEFT JOIN `tbl_lnkHostToHostgroup` ON `tbl_lnkServiceToHostgroup`.`idSlave` = ' . - '`tbl_lnkHostToHostgroup`.`idSlave` ' . - "WHERE $strDomainWhere1 AND `tbl_lnkHostToHostgroup`.`idMaster`=$elem AND `service_description`<>'' ". - " AND `service_description` IS NOT NULL AND `access_group` IN ($strAccess) ". - 'UNION ' . - 'SELECT `id`, `service_description` FROM `tbl_service` ' . - 'LEFT JOIN `tbl_lnkServiceToHostgroup` ON `tbl_service`.`id`=`tbl_lnkServiceToHostgroup`.`idMaster` ' . - 'LEFT JOIN `tbl_lnkHostgroupToHost` ON `tbl_lnkServiceToHostgroup`.`idSlave` = ' . - '`tbl_lnkHostgroupToHost`.`idMaster` ' . - "WHERE $strDomainWhere1 AND `tbl_lnkHostgroupToHost`.`idSlave`=$elem AND `service_description`<>'' ". - "AND `service_description` IS NOT NULL AND `access_group` IN ($strAccess)"; - return $strSQL; - } - - /** - * Define SQL commands for service table - * @param string $strDomainWhere1 WHERE SQL domain part - * @param string $elem Hostgroup array - * @param string $strAccess Access groups - * @return string SQL Statement - */ - private function getRawDataSQLService5($strDomainWhere1, $elem, $strAccess) - { - $strSQL = 'SELECT `id`, `service_description` FROM `tbl_service` ' . - 'LEFT JOIN `tbl_lnkServiceToHostgroup` ON `tbl_service`.`id`=`tbl_lnkServiceToHostgroup`.`idMaster` ' . - "WHERE $strDomainWhere1 AND `tbl_lnkServiceToHostgroup`.`idSlave` = $elem ". - "AND `service_description` <> '' AND `service_description` IS NOT NULL AND `access_group` ". - "IN ($strAccess)"; - return $strSQL; - } - - /** - * Define SQL commands for service table - * @param string $strTabField Table field - * @param string $strWhere WHERE SQL domain part - * @param string $strServices Comma separated list of services - * @param string $strServicesId Comma separated list of services IDs - * @param string $strAccess Access groups - * @return string SQL Statement - */ - private function getRawDataSQLService6($strTabField, $strWhere, $strServices, $strServicesId, $strAccess) - { - $strSQL = 'SELECT `id` AS `key`, `' . $strTabField . '` AS `value`, `active` FROM `tbl_service` ' . - 'LEFT JOIN `tbl_lnkServiceToHost` ON `tbl_service`.`id` = `tbl_lnkServiceToHost`.`idMaster` ' . - "WHERE $strWhere AND `tbl_service`.`service_description` IN ($strServices) ". - "AND `tbl_service`.`id` IN ($strServicesId) AND `" . $strTabField . "` <> '' AND `" . - $strTabField . "` IS NOT NULL AND `access_group` IN ($strAccess) GROUP BY `value` ". - 'UNION ' . - 'SELECT `id` AS `key`, `' . $strTabField . '` AS `value`, `active` FROM `tbl_service` ' . - 'LEFT JOIN `tbl_lnkServiceToHostgroup` ON `tbl_service`.`id`=`tbl_lnkServiceToHostgroup`.`idMaster` ' . - "WHERE $strWhere AND `tbl_service`.`service_description` IN ($strServices) ". - "AND `tbl_service`.`id` IN ($strServicesId) AND `" . $strTabField . "` <> '' AND `" . - $strTabField . "` IS NOT NULL AND `access_group` IN ($strAccess) GROUP BY `value` ". - 'UNION ' . - 'SELECT `id` AS `key`, `' . $strTabField . '` AS `value`, `active` FROM `tbl_service` ' . - "WHERE $strWhere AND `host_name`=2 OR `hostgroup_name`=2 AND `" . $strTabField . "` <> '' ". - 'AND `' . $strTabField . "` IS NOT NULL AND `access_group` IN ($strAccess) ". - 'GROUP BY `value` ORDER BY `value`'; - return $strSQL; - } - - /** - * Define SQL commands for service table - * @param string $strTabField Table field - * @param string $strDomainWhere1 WHERE SQL domain part - * @param int $intHostId Host ID - * @param string $strAccess Access groups - * @return string SQL Statement - */ - private function getRawDataSQLService7($strTabField, $strDomainWhere1, $intHostId, $strAccess) - { - $strSQL = 'SELECT `tbl_service`.`id` AS `key`, `tbl_service`.`' . $strTabField . '` AS `value`, ' . - '`tbl_service`.`active` FROM `tbl_service` ' . - 'LEFT JOIN `tbl_lnkServiceToHost` ON `tbl_service`.`id` = `tbl_lnkServiceToHost`.`idMaster` ' . - "WHERE $strDomainWhere1 AND `tbl_lnkServiceToHost`.`idSlave` = $intHostId AND `" . $strTabField . - "` <> '' AND `" . $strTabField . "` IS NOT NULL AND `access_group` IN ($strAccess) ". - 'ORDER BY `' . $strTabField . '`'; - return $strSQL; - } - - /** - * Define SQL commands for service table - * @param string $strDomainWhere1 WHERE SQL domain part - * @param string $strAccess Access groups - * @return string SQL Statement - */ - private function getRawDataSQLService89($strDomainWhere1, $strAccess) - { - $strSQL = "SELECT `tbl_service`.`id` AS `key`, CONCAT(`tbl_service`.`config_name`, ' - ', ". - '`tbl_service`.`service_description`) AS `value`, `active` ' . - "FROM `tbl_service` WHERE $strDomainWhere1 AND `tbl_service`.`config_name` <> '' ". - "AND `tbl_service`.`config_name` IS NOT NULL AND `tbl_service`.`service_description` <> '' ". - "AND `tbl_service`.`service_description` IS NOT NULL AND `access_group` IN ($strAccess) ". - 'ORDER BY `value`'; - return $strSQL; - } - - /** - * Define SQL commands for service table - * @param string $strDomainWhere2 WHERE SQL domain part for services - * @param string $strAccess Access groups - * @return string SQL Statement - */ - private function getRawDataSQLService10($strDomainWhere2, $strAccess) - { - $strSQL = 'SELECT CONCAT(tbl_service.id, "-", tbl_host.id) AS `key`, CONCAT(tbl_host.host_name, " - ", ' - . 'tbl_service.service_description) AS `value`, tbl_service.active ' - . 'FROM tbl_service ' - . 'LEFT JOIN tbl_lnkServiceToHost ON tbl_service.id=tbl_lnkServiceToHost.idMaster ' - . 'LEFT JOIN tbl_host ON tbl_lnkServiceToHost.idSlave=tbl_host.id ' - . 'WHERE '.$strDomainWhere2.' AND tbl_service.service_description <> "" ' - . 'AND tbl_service.service_description IS NOT NULL AND tbl_host.host_name IS NOT NULL ' - . 'AND tbl_service.access_group IN ('.$strAccess.') ' - . 'UNION ' - . 'SELECT CONCAT(tbl_service.id, "-", tbl_host.id) AS `key`, CONCAT(tbl_host.host_name, " - ", ' - . 'tbl_service.service_description) AS `value`, tbl_service.active ' - . 'FROM tbl_service ' - . 'LEFT JOIN tbl_lnkServiceToHostgroup ON tbl_service.id=tbl_lnkServiceToHostgroup.idMaster ' - . 'LEFT JOIN tbl_lnkHostgroupToHost ON tbl_lnkServiceToHostgroup.idSlave = ' - . 'tbl_lnkHostgroupToHost.idMaster ' - . 'LEFT JOIN tbl_host ON tbl_lnkHostgroupToHost.idSlave=tbl_host.id ' - . 'WHERE '.$strDomainWhere2.' AND tbl_service.service_description <> "" ' - . 'AND tbl_service.service_description IS NOT NULL AND tbl_host.host_name IS NOT NULL ' - . 'AND tbl_service.access_group IN ('.$strAccess.') ' - . 'ORDER BY `value`'; - return $strSQL; - } - - /** - * Define SQL commands for common tables - * @param string $strTable Table name - * @param string $strTabField Table field - * @param string $strDomainWhere1 WHERE SQL domain part - * @param string $strAccess Access groups - * @return string SQL Statement - */ - private function getRawDataSQLCommon($strTable, $strTabField, $strDomainWhere1, $strAccess) - { - $strSQL = 'SELECT `id` AS `key`, `' . $strTabField . '` AS `value`, `config_id`, `active` ' . - 'FROM `' . $strTable . "` WHERE $strDomainWhere1 AND `" . $strTabField . "` <> '' ". - 'AND `' . $strTabField . "` IS NOT NULL AND `access_group` IN ($strAccess) ". - 'ORDER BY `' . $strTabField . '`'; - return $strSQL; - } - - /** - * Define SQL commands for service table - * @param string $strTabField Table field - * @param int $intOption Option ID - * @param string $strDomainWhere1 WHERE SQL domain part - * @param string $strAccess Access groups - * @return string SQL Statement - */ - private function getRawDataSQLService456($strTabField, $intOption, $strDomainWhere1, $strAccess) - { - // Define variables - if ($intOption == 6) { - $strHostVar = 'se_host'; + /* Define variables */ + if ($intOption === 6) { + $strHostVar = 'se_host'; $strHostGroupVar = 'se_hostgroup'; - } elseif ($intOption == 4) { - $strHostVar = 'sd_dependent_host'; + } elseif ($intOption === 4) { + $strHostVar = 'sd_dependent_host'; $strHostGroupVar = 'sd_dependent_hostgroup'; } else { - $strHostVar = 'sd_host'; + $strHostVar = 'sd_host'; $strHostGroupVar = 'sd_hostgroup'; } if (!isset($this->arrSession['refresh'])) { $this->arrSession['refresh'] = array(); } - $arrHosts = array(); - $arrHostgroups = array(); - $arrServices = array(); - $arrDataHost = array(); - $arrDataTmp = array(); - $arrHostTemp = array(); + $arrHosts = array(); + $arrHostgroups = array(); + $arrServices = array(); + $arrDataHost = array(); + $arrDataTmp = array(); + $arrHostTemp = array(); $arrHostgroupTemp = array(); - $arrServicesId = array(); - $intDCHost = 0; - $intDataTmp = 0; - // Refresh mode - fill arrays + $arrServicesId = array(); + $intDCHost = 0; + $intDataTmp = 0; + /* Refresh mode - fill arrays */ if (isset($this->arrSession['refresh'][$strHostVar]) && - \is_array($this->arrSession['refresh'][$strHostVar])) { + is_array($this->arrSession['refresh'][$strHostVar])) { $arrHosts = $this->arrSession['refresh'][$strHostVar]; } else { - if ($intOption == 4) { + if ($intOption === 4) { $strSQL = 'SELECT `idSlave` FROM `tbl_lnkServicedependencyToHost_DH` ' . 'WHERE `idMaster`=' . $this->intDataId; - } elseif ($intOption == 6) { + } elseif ($intOption === 6) { $strSQL = 'SELECT `idSlave` FROM `tbl_lnkServiceescalationToHost` ' . 'WHERE `idMaster`=' . $this->intDataId; } else { $strSQL = 'SELECT `idSlave` FROM `tbl_lnkServicedependencyToHost_H` ' - . 'WHERE `idMaster`=' .$this->intDataId; + . 'WHERE `idMaster`=' . $this->intDataId; } $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrDataHost, $intDCHost); - if ($booReturn == false) { + if ($booReturn === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; - } elseif ($intDCHost != 0) { + } elseif ($intDCHost !== 0) { $arrHostTemp = array(); foreach ($arrDataHost as $elem) { $arrHostTemp[] = $elem['idSlave']; @@ -1214,23 +697,23 @@ class NagVisualClass } } if (isset($this->arrSession['refresh'][$strHostGroupVar]) && - \is_array($this->arrSession['refresh'][$strHostGroupVar])) { + is_array($this->arrSession['refresh'][$strHostGroupVar])) { $arrHostgroups = $this->arrSession['refresh'][$strHostGroupVar]; } else { - if ($intOption == 4) { + if ($intOption === 4) { $strSQL = 'SELECT `idSlave` FROM `tbl_lnkServicedependencyToHostgroup_DH` ' - . 'WHERE `idMaster`=' .$this->intDataId; - } elseif ($intOption == 6) { + . 'WHERE `idMaster`=' . $this->intDataId; + } elseif ($intOption === 6) { $strSQL = 'SELECT `idSlave` FROM `tbl_lnkServiceescalationToHostgroup` ' . 'WHERE `idMaster`=' . $this->intDataId; } else { $strSQL = 'SELECT `idSlave` FROM `tbl_lnkServicedependencyToHostgroup_H` ' - . 'WHERE `idMaster`=' .$this->intDataId; + . 'WHERE `idMaster`=' . $this->intDataId; } $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrDataHost, $intDCHost); - if ($booReturn == false) { + if ($booReturn === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; - } elseif ($intDCHost != 0) { + } elseif ($intDCHost !== 0) { $arrHostgroupTemp = array(); foreach ($arrDataHost as $elem) { $arrHostgroupTemp[] = $elem['idSlave']; @@ -1238,81 +721,81 @@ class NagVisualClass $arrHostgroups = $arrHostgroupTemp; } } - if (\is_array($arrHosts) && (\count($arrHosts) == 1) && $arrHosts[0] == '') { + if (is_array($arrHosts) && (count($arrHosts) === 1) && (string)$arrHosts[0] === '') { $arrHosts = array(); } - if (\is_array($arrHostgroups) && (\count($arrHostgroups) == 1) && $arrHostgroups[0] == '') { + if (is_array($arrHostgroups) && (count($arrHostgroups) === 1) && (string)$arrHostgroups[0] === '') { $arrHostgroups = array(); } - if (\in_array('*', $arrHosts, true)) { + if (in_array('*', $arrHosts, true)) { $strSQL = "SELECT id FROM tbl_host WHERE $strDomainWhere1 AND `access_group` IN ($strAccess)"; $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrDataHost, $intDCHost); - if ($booReturn == false) { + if ($booReturn === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } - if ($booReturn && ($intDCHost != 0)) { + if ($booReturn && ($intDCHost !== 0)) { $arrHostTemp = array(); foreach ($arrDataHost as $elem) { - if (\in_array('e' . $elem['id'], $this->arrSession['refresh'][$strHostVar], true)) { + if (in_array('e' . $elem['id'], $this->arrSession['refresh'][$strHostVar], true)) { continue; } $arrHostTemp[] = $elem['id']; } } - $strHosts = 1; + $intHosts = 1; $arrHosts = $arrHostTemp; } else { - $strHosts = \count($arrHosts) + 0; + $intHosts = count($arrHosts); } - // * Value in host groups -> disabled in NagiosQL 3.2 - if (\in_array('*', $arrHostgroups, true)) { + /* Value in host groups -> disabled in NagiosQL 3.2 */ + if (in_array('*', $arrHostgroups, true)) { $strSQL = "SELECT id FROM tbl_hostgroup WHERE $strDomainWhere1 AND `access_group` " . "IN ($strAccess)"; $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrDataHost, $intDCHost); - if ($booReturn == false) { + if ($booReturn === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } - if ($booReturn && ($intDCHost != 0)) { + if ($booReturn && ($intDCHost !== 0)) { $arrHostgroupTemp = array(); foreach ($arrDataHost as $elem) { - if (\in_array('e' . $elem['id'], $this->arrSession['refresh'][$strHostGroupVar], true)) { + if (in_array('e' . $elem['id'], $this->arrSession['refresh'][$strHostGroupVar], true)) { continue; } $arrHostgroupTemp[] = $elem['id']; } } - $strHostsGroup = 1; + $intHostsGroup = 1; $arrHostgroups = $arrHostgroupTemp; } else { - $strHostsGroup = \count($arrHostgroups) + 0; + $intHostsGroup = count($arrHostgroups); } - // Special method - only host_name or hostgroup_name selected - if (($strHostVar == 'sd_dependent_host') && ($strHosts == 0) && ($strHostsGroup == 0)) { - if (\is_array($this->arrSession['refresh']['sd_host'])) { + /* Special method - only host_name or hostgroup_name selected */ + if (($strHostVar === 'sd_dependent_host') && ($intHosts === 0) && ($intHostsGroup === 0)) { + if (is_array($this->arrSession['refresh']['sd_host'])) { $arrHosts = $this->arrSession['refresh']['sd_host']; } - if (\is_array($this->arrSession['refresh']['sd_hostgroup'])) { + if (is_array($this->arrSession['refresh']['sd_hostgroup'])) { $arrHostgroups = $this->arrSession['refresh']['sd_hostgroup']; } - if ((\count($arrHosts) == 1) && $arrHosts[0] == '') { + if ((count($arrHosts) === 1) && (string)$arrHosts[0] === '') { $arrHosts = array(); } - if ((\count($arrHostgroups) == 1) && $arrHostgroups[0] == '') { + if ((count($arrHostgroups) === 1) && (string)$arrHostgroups[0] === '') { $arrHostgroups = array(); } - $strHosts = \count($arrHosts) + 0; - $strHostsGroup = \count($arrHostgroups) + 0; + $intHosts = count($arrHosts); + $intHostsGroup = count($arrHostgroups); } - // If no hosts and hostgroups are selected show any service - if (($strHosts == 0) && ($strHostsGroup == 0)) { + /* If no hosts and hostgroups are selected show any service */ + if (($intHosts === 0) && ($intHostsGroup === 0)) { $strSQL = 'SELECT `id` AS `key`, `' . $strTabField . '` AS `value`, `active` FROM `tbl_service` ' . "WHERE $strDomainWhere1 AND `" . $strTabField . "` <> '' AND `" . $strTabField . '` ' . "IS NOT NULL AND `access_group` IN ($strAccess) GROUP BY `value` ORDER BY `value`"; } else { - if ($strHosts != 0) { + if ($intHosts !== 0) { $intCounter = 0; foreach ($arrHosts as $elem) { - if (($intCounter != 0) && (\count($arrServices) == 0)) { + if (($intCounter !== 0) && (count($arrServices) === 0)) { continue; } $arrTempServ = array(); @@ -1320,13 +803,13 @@ class NagVisualClass $elem = str_replace('e', '', $elem); $strSQLTmp = $this->getRawDataSQLService4($strDomainWhere1, $elem, $strAccess); $booReturn = $this->myDBClass->hasDataArray($strSQLTmp, $arrDataTmp, $intDataTmp); - if ($booReturn && ($intDataTmp != 0)) { + if ($booReturn && ($intDataTmp !== 0)) { foreach ($arrDataTmp as $elem2) { - if ($intCounter == 0) { + if ($intCounter === 0) { $arrTempServ[] = $elem2['service_description']; $arrTempServId[] = $elem2['id']; - } elseif (\in_array($elem2['service_description'], $arrServices, true) && - !\in_array($elem2['service_description'], $arrTempServ, true)) { + } elseif (in_array($elem2['service_description'], $arrServices, true) && + !in_array($elem2['service_description'], $arrTempServ, true)) { $arrTempServ[] = $elem2['service_description']; $arrTempServId[] = $elem2['id']; } @@ -1337,10 +820,10 @@ class NagVisualClass $intCounter++; } } - if ($strHostsGroup != 0) { + if ($intHostsGroup !== 0) { $intCounter = 0; foreach ($arrHostgroups as $elem) { - if (($intCounter != 0) && (\count($arrServices) == 0)) { + if (($intCounter !== 0) && (count($arrServices) === 0)) { continue; } $arrTempServ = array(); @@ -1348,13 +831,13 @@ class NagVisualClass $elem = str_replace('e', '', $elem); $strSQLTmp = $this->getRawDataSQLService5($strDomainWhere1, $elem, $strAccess); $booReturn = $this->myDBClass->hasDataArray($strSQLTmp, $arrDataTmp, $intDataTmp); - if ($booReturn && ($intDataTmp != 0)) { + if ($booReturn && ($intDataTmp !== 0)) { foreach ($arrDataTmp as $elem2) { - if ($intCounter == 0) { + if ($intCounter === 0) { $arrTempServ[] = $elem2['service_description']; $arrTempServId[] = $elem2['id']; - } elseif (\in_array($elem2['service_description'], $arrServices, true) && - !\in_array($elem2['service_description'], $arrTempServ, true)) { + } elseif (in_array($elem2['service_description'], $arrServices, true) && + !in_array($elem2['service_description'], $arrTempServ, true)) { $arrTempServ[] = $elem2['service_description']; $arrTempServId[] = $elem2['id']; } @@ -1365,8 +848,8 @@ class NagVisualClass $intCounter++; } } - if (\count($arrServices) != 0) { - $strServices = "'" . implode("','", $arrServices) . "'"; + if (count($arrServices) !== 0) { + $strServices = "'" . implode("','", $arrServices) . "'"; $strServicesId = implode(',', $arrServicesId); $strSQL = $this->getRawDataSQLService6( $strTabField, @@ -1382,71 +865,571 @@ class NagVisualClass return $strSQL; } + /** + * Define SQL commands for service table + * @param string $strDomainWhere1 WHERE SQL domain part + * @param string $elem Host array + * @param string $strAccess Access groups + * @return string SQL Statement + */ + private function getRawDataSQLService4(string $strDomainWhere1, string $elem, string $strAccess): string + { + return 'SELECT `id`, `service_description` FROM `tbl_service` ' . + 'LEFT JOIN `tbl_lnkServiceToHost` ON `tbl_service`.`id` = `tbl_lnkServiceToHost`.`idMaster` ' . + "WHERE $strDomainWhere1 AND `tbl_lnkServiceToHost`.`idSlave` = $elem AND `service_description`<>'' " . + "AND `access_group` IN ($strAccess) " . + 'UNION ' . + 'SELECT `id`, `service_description` FROM `tbl_service` ' . + 'LEFT JOIN `tbl_lnkServiceToHostgroup` ON `tbl_service`.`id`=`tbl_lnkServiceToHostgroup`.`idMaster` ' . + 'LEFT JOIN `tbl_lnkHostToHostgroup` ON `tbl_lnkServiceToHostgroup`.`idSlave` = ' . + '`tbl_lnkHostToHostgroup`.`idSlave` ' . + "WHERE $strDomainWhere1 AND `tbl_lnkHostToHostgroup`.`idMaster`=$elem AND `service_description`<>'' " . + "AND `access_group` IN ($strAccess) " . + 'UNION ' . + 'SELECT `id`, `service_description` FROM `tbl_service` ' . + 'LEFT JOIN `tbl_lnkServiceToHostgroup` ON `tbl_service`.`id`=`tbl_lnkServiceToHostgroup`.`idMaster` ' . + 'LEFT JOIN `tbl_lnkHostgroupToHost` ON `tbl_lnkServiceToHostgroup`.`idSlave` = ' . + '`tbl_lnkHostgroupToHost`.`idMaster` ' . + "WHERE $strDomainWhere1 AND `tbl_lnkHostgroupToHost`.`idSlave`=$elem AND `service_description`<>'' " . + "AND `access_group` IN ($strAccess)"; + } + + /** + * Define SQL commands for service table + * @param string $strDomainWhere1 WHERE SQL domain part + * @param string $elem Hostgroup array + * @param string $strAccess Access groups + * @return string SQL Statement + */ + private function getRawDataSQLService5(string $strDomainWhere1, string $elem, string $strAccess): string + { + return 'SELECT `id`, `service_description` FROM `tbl_service` ' . + 'LEFT JOIN `tbl_lnkServiceToHostgroup` ON `tbl_service`.`id`=`tbl_lnkServiceToHostgroup`.`idMaster` ' . + "WHERE $strDomainWhere1 AND `tbl_lnkServiceToHostgroup`.`idSlave` = $elem " . + "AND `service_description` <> '' AND `access_group` " . + "IN ($strAccess)"; + } + + /** + * Define SQL commands for service table + * @param string $strTabField Table field + * @param string $strWhere WHERE SQL domain part + * @param string $strServices Comma separated list of services + * @param string $strServicesId Comma separated list of services IDs + * @param string $strAccess Access groups + * @return string SQL Statement + */ + private function getRawDataSQLService6(string $strTabField, string $strWhere, string $strServices, string $strServicesId, string $strAccess): string + { + return 'SELECT `id` AS `key`, `' . $strTabField . '` AS `value`, `active` FROM `tbl_service` ' . + 'LEFT JOIN `tbl_lnkServiceToHost` ON `tbl_service`.`id` = `tbl_lnkServiceToHost`.`idMaster` ' . + "WHERE $strWhere AND `tbl_service`.`service_description` IN ($strServices) " . + "AND `tbl_service`.`id` IN ($strServicesId) AND `" . $strTabField . "` <> '' AND `" . + $strTabField . "` IS NOT NULL AND `access_group` IN ($strAccess) GROUP BY `value` " . + 'UNION ' . + 'SELECT `id` AS `key`, `' . $strTabField . '` AS `value`, `active` FROM `tbl_service` ' . + 'LEFT JOIN `tbl_lnkServiceToHostgroup` ON `tbl_service`.`id`=`tbl_lnkServiceToHostgroup`.`idMaster` ' . + "WHERE $strWhere AND `tbl_service`.`service_description` IN ($strServices) " . + "AND `tbl_service`.`id` IN ($strServicesId) AND `" . $strTabField . "` <> '' AND `" . + $strTabField . "` IS NOT NULL AND `access_group` IN ($strAccess) GROUP BY `value` " . + 'UNION ' . + 'SELECT `id` AS `key`, `' . $strTabField . '` AS `value`, `active` FROM `tbl_service` ' . + "WHERE $strWhere AND `host_name`=2 OR `hostgroup_name`=2 AND `" . $strTabField . "` <> '' " . + 'AND `' . $strTabField . "` IS NOT NULL AND `access_group` IN ($strAccess) " . + 'GROUP BY `value` ORDER BY `value`'; + } + + /** + * Define SQL commands for service table + * @param string $strTabField Table field + * @param string $strDomainWhere1 WHERE SQL domain part + * @param int $intHostId Host ID + * @param string $strAccess Access groups + * @return string SQL Statement + */ + private function getRawDataSQLService7(string $strTabField, string $strDomainWhere1, int $intHostId, string $strAccess): string + { + return 'SELECT `tbl_service`.`id` AS `key`, `tbl_service`.`' . $strTabField . '` AS `value`, ' . + '`tbl_service`.`active` FROM `tbl_service` ' . + 'LEFT JOIN `tbl_lnkServiceToHost` ON `tbl_service`.`id` = `tbl_lnkServiceToHost`.`idMaster` ' . + "WHERE $strDomainWhere1 AND `tbl_lnkServiceToHost`.`idSlave` = $intHostId AND `" . $strTabField . + "` <> '' AND `" . $strTabField . "` IS NOT NULL AND `access_group` IN ($strAccess) " . + 'ORDER BY `' . $strTabField . '`'; + } + + /** + * Define SQL commands for service table + * @param string $strDomainWhere1 WHERE SQL domain part + * @param string $strAccess Access groups + * @return string SQL Statement + */ + private function getRawDataSQLService89(string $strDomainWhere1, string $strAccess): string + { + return "SELECT `tbl_service`.`id` AS `key`, CONCAT(`tbl_service`.`config_name`, ' - ', " . + '`tbl_service`.`service_description`) AS `value`, `active` ' . + "FROM `tbl_service` WHERE $strDomainWhere1 AND `tbl_service`.`config_name` <> '' " . + "AND `tbl_service`.`config_name` IS NOT NULL AND `tbl_service`.`service_description` <> '' " . + "AND `tbl_service`.`service_description` IS NOT NULL AND `access_group` IN ($strAccess) " . + 'ORDER BY `value`'; + } + + /** + * Define SQL commands for service table + * @param string $strDomainWhere2 WHERE SQL domain part for services + * @param string $strAccess Access groups + * @return string SQL Statement + */ + private function getRawDataSQLService10(string $strDomainWhere2, string $strAccess): string + { + return 'SELECT CONCAT(tbl_service.id, "-", tbl_host.id) AS `key`, CONCAT(tbl_host.host_name, " - ", ' + . 'tbl_service.service_description) AS `value`, tbl_service.active ' + . 'FROM tbl_service ' + . 'LEFT JOIN tbl_lnkServiceToHost ON tbl_service.id=tbl_lnkServiceToHost.idMaster ' + . 'LEFT JOIN tbl_host ON tbl_lnkServiceToHost.idSlave=tbl_host.id ' + . 'WHERE ' . $strDomainWhere2 . ' AND tbl_service.service_description <> "" ' + . 'AND tbl_service.service_description IS NOT NULL AND tbl_host.host_name IS NOT NULL ' + . 'AND tbl_service.access_group IN (' . $strAccess . ') ' + . 'UNION ' + . 'SELECT CONCAT(tbl_service.id, "-", tbl_host.id) AS `key`, CONCAT(tbl_host.host_name, " - ", ' + . 'tbl_service.service_description) AS `value`, tbl_service.active ' + . 'FROM tbl_service ' + . 'LEFT JOIN tbl_lnkServiceToHostgroup ON tbl_service.id=tbl_lnkServiceToHostgroup.idMaster ' + . 'LEFT JOIN tbl_lnkHostgroupToHost ON tbl_lnkServiceToHostgroup.idSlave = ' + . 'tbl_lnkHostgroupToHost.idMaster ' + . 'LEFT JOIN tbl_host ON tbl_lnkHostgroupToHost.idSlave=tbl_host.id ' + . 'WHERE ' . $strDomainWhere2 . ' AND tbl_service.service_description <> "" ' + . 'AND tbl_service.service_description IS NOT NULL AND tbl_host.host_name IS NOT NULL ' + . 'AND tbl_service.access_group IN (' . $strAccess . ') ' + . 'ORDER BY `value`'; + } + + /** + * Define SQL commands for common tables + * @param string $strTable Table name + * @param string $strTabField Table field + * @param string $strDomainWhere1 WHERE SQL domain part + * @param string $strAccess Access groups + * @return string SQL Statement + */ + private function getRawDataSQLCommon(string $strTable, string $strTabField, string $strDomainWhere1, string $strAccess): string + { + return 'SELECT `id` AS `key`, `' . $strTabField . '` AS `value`, `config_id`, `active` ' . + 'FROM `' . $strTable . "` WHERE $strDomainWhere1 AND `" . $strTabField . "` <> '' " . + 'AND `' . $strTabField . "` IS NOT NULL AND `access_group` IN ($strAccess) " . + 'ORDER BY `' . $strTabField . '`'; + } + + /** + * Builds a multi selection field inside a template + * @param string $strTable Table name (source data) + * @param string $strTabField Field name (source data) + * @param string $strTemplKey Template key + * @param string $strLinkTable Name of link table + * @param int $intModeId 0 = only data + * 1 = with empty line at the beginning + * 2 = with * line at the beginning + * @param int $intTypeId Type ID (from master table) + * @param int $intExclId Exclude ID + * @param string $strRefresh Session token for refresh mode + * @return int 0 = successful / 1 = error + */ + public function parseSelectMulti( + string $strTable, + string $strTabField, + string $strTemplKey, + string $strLinkTable, + int $intModeId = 0, + int $intTypeId = -9, + int $intExclId = -9, + string $strRefresh = '' + ): int + { + /* Compute option value */ + $intOption = 2; + $intRefresh = 0; + $intReturn = 1; + $arrSelectedAdd = array(); + $arrData = array(); + $intSelAdd = 1; + if ($strLinkTable === 'tbl_lnkServicegroupToService') { + $intOption = 3; + } + if ($strLinkTable === 'tbl_lnkServicedependencyToService_DS') { + $intOption = 4; + } + if ($strLinkTable === 'tbl_lnkServicedependencyToService_S') { + $intOption = 5; + } + if ($strLinkTable === 'tbl_lnkServiceescalationToService') { + $intOption = 6; + } + if ($strTemplKey === 'host_services') { + $intOption = 8; + } + if ($strTemplKey === 'service_parents') { + $intOption = 9; + } + if (($strLinkTable === 'tbl_lnkServiceToService') || ($strLinkTable === 'tbl_lnkServicetemplateToService')) { + $intOption = 10; + } + /* Get version */ + $this->myConfigClass->getDomainData('version', $strVersion); + $intVersion = (int)$strVersion; + /* Get raw data */ + $intRaw = $this->getSelectRawdata($strTable, $strTabField, $arrData, $intOption); + /* Get selected data */ + $arrSelected = array(); + $intSel = $this->getSelectedItems($strLinkTable, $arrSelected, $intOption); + /* Get additional selected data */ + if ($strLinkTable === 'tbl_lnkHostToHostgroup') { + $intSelAdd = $this->getSelectedItems('tbl_lnkHostgroupToHost', $arrSelectedAdd, 8); + } + if ($strLinkTable === 'tbl_lnkHostgroupToHost') { + $intSelAdd = $this->getSelectedItems('tbl_lnkHostToHostgroup', $arrSelectedAdd, 8); + } + /* Get browser */ + $strBrowser = $this->browserCheck(); + /* Refresh processing (replaces selection array) */ + if (isset($this->arrSession['refresh'][$strRefresh]) && + $strRefresh !== '' && is_array($this->arrSession['refresh'][$strRefresh])) { + $arrSelected = $this->arrSession['refresh'][$strRefresh]; + $intRefresh = 1; + $intSel = 0; + } + if ($intRaw === 0) { + $intCount = 0; + /* Insert an empty line in mode 1 */ + if ($intModeId === 1) { + $this->myContentTpl->setVariable('SPECIAL_STYLE'); + $this->myContentTpl->setVariable('OPTION_DISABLED'); + if (($strBrowser === 'msie') && ((int)$this->arrSettings['common']['seldisable'] !== 0)) { + $this->myContentTpl->setVariable('OPTION_DISABLED', 'disabled="disabled"'); + } + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey), ' '); + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey) . '_ID', 0); + if ($intVersion < 3) { + $this->myContentTpl->setVariable('VERSION_20_MUST', 'inpmust'); + } + $this->myContentTpl->parse($strTemplKey); + $intCount++; + } + /* Insert an * line in mode 2 */ + if ($intModeId === 2) { + $this->myContentTpl->setVariable('SPECIAL_STYLE'); + $this->myContentTpl->setVariable('OPTION_DISABLED'); + if (($strBrowser === 'msie') && ((int)$this->arrSettings['common']['seldisable'] !== 0)) { + $this->myContentTpl->setVariable('OPTION_DISABLED', 'disabled="disabled"'); + } + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey), '*'); + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey) . '_ID', '*'); + if ($intVersion < 3) { + $this->myContentTpl->setVariable('VERSION_20_MUST', 'inpmust'); + } + if ($intTypeId === 2) { + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey) . '_SEL', 'selected'); + $this->myContentTpl->setVariable('IE_' . strtoupper($strTemplKey) . '_SEL', 'ieselected'); + } + if (($intRefresh === 1) && in_array('*', $arrSelected, true)) { + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey) . '_SEL', 'selected'); + $this->myContentTpl->setVariable('IE_' . strtoupper($strTemplKey) . '_SEL', 'ieselected'); + } + $intCount++; + $this->myContentTpl->parse($strTemplKey); + } + /* Insert data sets */ + foreach ($arrData as $elem) { + if ((int)$elem['key'] === $intExclId) { + continue; + } + if (($intOption === 10) && ((int)strstr($elem['key'], '-', true) === $intExclId)) { + continue; + } + if ((string)$elem['value'] === '') { + continue; + } + $intIsSelected = 0; + $intIsExcluded = 0; + $intIsForeign = 0; + $this->myContentTpl->setVariable('SPECIAL_STYLE'); + $this->myContentTpl->setVariable('OPTION_DISABLED'); + if (($strBrowser === 'msie') && ((int)$this->arrSettings['common']['seldisable'] !== 0)) { + $this->myContentTpl->setVariable('OPTION_DISABLED', 'disabled="disabled"'); + } + if (isset($elem['active']) && (int)$elem['active'] === 0) { + $strActive = ' [inactive]'; + $this->myContentTpl->setVariable('SPECIAL_STYLE', 'inactive_option'); + } else { + $strActive = ''; + } + if (isset($elem['config_id']) && (int)$elem['config_id'] === 0) { + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey), htmlspecialchars( + $elem['value'], + ENT_QUOTES + ) . ' [common]' . $strActive); + } else { + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey), htmlspecialchars( + $elem['value'], + ENT_QUOTES + ) . $strActive); + } + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey) . '_ID', $elem['key']); + $this->myContentTpl->setVariable('CLASS_SEL'); + if ($intVersion < 3) { + $this->myContentTpl->setVariable('VERSION_20_MUST', 'inpmust'); + } + if (($intSel === 0) && in_array($elem['key'], $arrSelected, true)) { + $intIsSelected = 1; + } + if (($intSel === 0) && in_array($elem['value'], $arrSelected, true)) { + $intIsSelected = 1; + } + if (($intSelAdd === 0) && in_array($elem['key'], $arrSelectedAdd, true)) { + $intIsForeign = 1; + } + if (($intSelAdd === 0) && in_array($elem['value'], $arrSelectedAdd, true)) { + $intIsForeign = 1; + } + if (($intIsForeign === 1) && ($strActive === '')) { + $this->myContentTpl->setVariable('SPECIAL_STYLE', 'foreign_option'); + } + /* Exclude rule */ + if (($intSel === 0) && in_array('e' . $elem['key'], $arrSelected, true)) { + $intIsExcluded = 1; + } + if (($intSel === 0) && in_array('e' . '::' . $elem['value'], $arrSelected, true)) { + $intIsExcluded = 1; + } + if ($intIsExcluded === 1) { + if (isset($elem['config_id']) && (int)$elem['config_id'] === 0) { + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey), '!' . + htmlspecialchars($elem['value'], ENT_QUOTES) . ' [common]' . $strActive); + } else { + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey), '!' . + htmlspecialchars($elem['value'], ENT_QUOTES) . $strActive); + } + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey) . '_ID', 'e' . $elem['key']); + } + if (($intIsSelected === 1) || ($intIsExcluded === 1)) { + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey) . '_SEL', 'selected'); + $this->myContentTpl->setVariable('IE_' . strtoupper($strTemplKey) . '_SEL', 'ieselected'); + } + $intCount++; + $this->myContentTpl->parse($strTemplKey); + } + if ($intCount === 0) { + /* Insert an empty line to create valid HTML select fields */ + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey), ' '); + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey) . '_ID', 0); + $this->myContentTpl->parse($strTemplKey); + } + $intReturn = 0; + } else { + /* Insert an empty line to create valid HTML select fields */ + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey), ' '); + $this->myContentTpl->setVariable('DAT_' . strtoupper($strTemplKey) . '_ID', 0); + $this->myContentTpl->parse($strTemplKey); + } + return $intReturn; + } + /** * Get selected data - * @param string $strLinkTable Link table name - * @param array $arrSelect Result data array - * @param int $intOption Option parameter + * @param string $strLinkTable Link table name + * @param array $arrSelect Result data array + * @param int $intOption Option parameter * @return int 0 = successful / 1 = error */ - private function getSelectedItems($strLinkTable, &$arrSelect, $intOption = 0) + private function getSelectedItems(string $strLinkTable, array &$arrSelect, int $intOption = 0): int { - // Define variables + /* Define variables */ $arrSelectedRaw = array(); - $intDataCount = 0; - $intReturn = 1; - // Define SQL commands - if ($intOption == 8) { - $strSQL = 'SELECT * FROM `' .$strLinkTable. '` WHERE `idSlave`=' .$this->intDataId; + $intDataCount = 0; + $intReturn = 1; + /* Define SQL commands */ + if ($intOption === 8) { + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $strLinkTable . '` WHERE `idSlave`=' . $this->intDataId; } else { - $strSQL = 'SELECT * FROM `' .$strLinkTable. '` WHERE `idMaster`=' .$this->intDataId; + /** @noinspection SqlResolve */ + $strSQL = 'SELECT * FROM `' . $strLinkTable . '` WHERE `idMaster`=' . $this->intDataId; } - // Process data - $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrSelectedRaw, $intDataCount); - if ($booReturn == false) { + /* Process data */ + $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrSelectedRaw, $intDataCount); + if ($booReturn === false) { $this->strErrorMessage .= $this->myDBClass->strErrorMessage; } - if ($booReturn && ($intDataCount != 0)) { + if ($booReturn && ($intDataCount !== 0)) { foreach ($arrSelectedRaw as $elem) { - // Multi tables - if ($strLinkTable == 'tbl_lnkServicegroupToService') { - if (isset($elem['exclude']) && ($elem['exclude'] == 1)) { - $arrSelect[] = 'e' .$elem['idSlaveH']. '::' .$elem['idSlaveHG']. '::' .$elem['idSlaveS']; + /* Multi tables */ + if ($strLinkTable === 'tbl_lnkServicegroupToService') { + if (isset($elem['exclude']) && ((int)$elem['exclude'] === 1)) { + $arrSelect[] = 'e' . $elem['idSlaveH'] . '::' . $elem['idSlaveHG'] . '::' . $elem['idSlaveS']; } else { - $arrSelect[] = $elem['idSlaveH']. '::' .$elem['idSlaveHG']. '::' .$elem['idSlaveS']; + $arrSelect[] = $elem['idSlaveH'] . '::' . $elem['idSlaveHG'] . '::' . $elem['idSlaveS']; } - // Servicedependencies and -escalations - } elseif (($strLinkTable == 'tbl_lnkServicedependencyToService_DS') || - ($strLinkTable == 'tbl_lnkServicedependencyToService_S') || - ($strLinkTable == 'tbl_lnkServiceescalationToService')) { - if (isset($elem['exclude']) && ($elem['exclude'] == 1)) { - $arrSelect[] = 'e::' .$elem['strSlave']; + /* Servicedependencies and -escalations + } elseif (($strLinkTable === 'tbl_lnkServicedependencyToService_DS') || + ($strLinkTable === 'tbl_lnkServicedependencyToService_S') || + ($strLinkTable === 'tbl_lnkServiceescalationToService')) { + if (isset($elem['exclude']) && ((int)$elem['exclude'] === 1)) { + $arrSelect[] = 'e::' . $elem['strSlave']; } else { $arrSelect[] = $elem['strSlave']; } - // Service parents - } elseif (($strLinkTable == 'tbl_lnkServiceToService') || - ($strLinkTable == 'tbl_lnkServicetemplateToService')) { - $arrSelect[] = $elem['idSlave'].'-'.$elem['idHost']; - // Standard tables - } else { - if ($intOption == 8) { - if (isset($elem['exclude']) && ($elem['exclude'] == 1)) { - $arrSelect[] = 'e' .$elem['idMaster']; - } else { - $arrSelect[] = $elem['idMaster']; - } + /* Service parents */ + } elseif (($strLinkTable === 'tbl_lnkServiceToService') || + ($strLinkTable === 'tbl_lnkServicetemplateToService')) { + $arrSelect[] = $elem['idSlave'] . '-' . $elem['idHost']; + /* Standard tables */ + } else if ($intOption === 8) { + if (isset($elem['exclude']) && ((int)$elem['exclude'] === 1)) { + $arrSelect[] = 'e' . $elem['idMaster']; } else { - if (isset($elem['exclude']) && ($elem['exclude'] == 1)) { - $arrSelect[] = 'e' .$elem['idSlave']; - } else { - $arrSelect[] = $elem['idSlave']; - } + $arrSelect[] = $elem['idMaster']; } + } else if (isset($elem['exclude']) && ((int)$elem['exclude'] === 1)) { + $arrSelect[] = 'e' . $elem['idSlave']; + } else { + $arrSelect[] = $elem['idSlave']; } } $intReturn = 0; } return $intReturn; } -} + + /** + * Search for browser type + * @return string Browser String + */ + public function browserCheck(): string + { + $strUserAgent = filter_input(INPUT_SERVER, 'HTTP_USER_AGENT', FILTER_UNSAFE_RAW); + /* Define variables */ + $strBrowserString = 'unknown'; + if (false !== stripos($strUserAgent, 'msie')) { + $strBrowserString = 'msie'; + } elseif (false !== stripos($strUserAgent, 'firefox')) { + $strBrowserString = 'firefox'; + } elseif (false !== stripos($strUserAgent, 'opera')) { + $strBrowserString = 'opera'; + } elseif (false !== stripos($strUserAgent, 'chrome')) { + $strBrowserString = 'chrome'; + } + return $strBrowserString; + } + + /** + * Merge message strings and check for duplicate messages + * @param string $strNewMessage Message to add + * @param string|null $strOldMessage Modified message string (by reference) + * @param string $strSeparate Separate string (
or \n) + */ + public function processMessage(string $strNewMessage, string &$strOldMessage = null, string $strSeparate = '
'): int + { + $strNewMessage = str_replace(array('::::', '::'), array('::', $strSeparate), $strNewMessage); + if (($strOldMessage !== '') && ($strNewMessage !== '')) { + if (substr_count($strOldMessage, $strNewMessage) === 0) { + if (substr_count(substr($strOldMessage, -5), $strSeparate) === 0) { + $strOldMessage .= $strSeparate . $strNewMessage; + } else { + $strOldMessage .= $strNewMessage; + } + } + } else { + $strOldMessage .= $strNewMessage; + } + return 0; + } + + /** + * Inserts the domain list to the list view template (host and services only) + * @param HTML_Template_IT $resTemplate Template object + * @noinspection PhpMissingParamTypeInspection + */ + public function insertDomainList($resTemplate): int + { + $arrDataDomain = array(); + $strSQL = "SELECT * FROM `tbl_datadomain` WHERE `active` <> '0' ORDER BY `domain`"; + $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrDataDomain, $intDataCount); + if ($booReturn && ($intDataCount !== 0)) { + foreach ($arrDataDomain as $elem) { + /* Check access rights */ + if ($this->checkAccountGroup($elem['access_group'], 'read') === 0) { + $resTemplate->setVariable('DOMAIN_ID', $elem['id']); + $resTemplate->setVariable('DOMAIN_NAME', $elem['domain']); + if ($this->intDomainId === (int)$elem['id']) { + $resTemplate->setVariable('DOMAIN_SEL', 'selected'); + } + $resTemplate->parse('domainlist'); + } + } + } elseif (!$booReturn) { + $this->strErrorMessage .= translate('Error while selecting data from database:') . + '::' . $this->myDBClass->strErrorMessage; + } + return 0; + } + + /** + * Checks if user has access to an account group + * @param int $intGroupId Group ID + * @param string $strType Access type (read,write,link) + * @return int 0 = access granted / 1 = no access + */ + public function checkAccountGroup(int $intGroupId, string $strType): int + { + /* Define variables */ + $intReturn = 0; + /* Admin user or member og group 0 do not need permissions */ + if (((int)$this->arrSession['userid'] !== 1) && ($intGroupId !== 0)) { + /* Define variables */ + $arrDataMain = array(); + /* Read database values */ + $strTypeValue = $this->getGroupValue($strType); + if ($strTypeValue !== '') { + $strSQL = "SELECT * FROM `tbl_lnkGroupToUser` WHERE `idMaster`=$intGroupId AND " . + '`idSlave`=' . $this->arrSession['userid'] . " AND $strTypeValue"; + $booReturn = $this->myDBClass->hasDataArray($strSQL, $arrDataMain, $intDataCount); + if ($booReturn === false) { + $this->strErrorMessage .= $this->myDBClass->strErrorMessage; + } + if (($booReturn === false) || ($intDataCount === 0)) { + $intReturn = 1; + } + } + } + return $intReturn; + } + + /** + * Adds a "/" after a parh string and replaces double "//" with "/" + * @param string $strPath Path string + * @return string Modified path string + */ + public function addSlash(string $strPath): string + { + if ($strPath === '') { + return ''; + } + $strPath .= '/'; + while (substr_count($strPath, '//') !== 0) { + $strPath = str_replace('//', '/', $strPath); + } + return $strPath; + } + + /** + * Replaces "NULL" with -1 + * @param string $strKey Process string + * @return string Modified process string + */ + public function checkNull(string $strKey): string + { + $strReturn = $strKey; + if (strtoupper($strKey) === 'NULL') { + $strReturn = '-1'; + } + return $strReturn; + } +} \ No newline at end of file diff --git a/functions/common.js b/functions/common.js index c58de2a..27b4afc 100644 --- a/functions/common.js +++ b/functions/common.js @@ -1,14 +1,15 @@ -/* -(c) 2005-2018 by Martin Willisegger -Project : NagiosQL -Component : common JavaScript functions -Website : https://sourceforge.net/projects/nagiosql/ -Version : 3.4.0 -GIT Repo : https://gitlab.com/wizonet/NagiosQL +/** + * (c) 2005-2022 by Martin Willisegger + * Project : NagiosQL + * Component : common JavaScript functions + * Website : https://sourceforge.net/projects/nagiosql/ + * Version : 3.5.0 + * GIT Repo : https://gitlab.com/wizonet/NagiosQL */ let popup = false; -function info(key1,key2,ver) { - if(popup && popup.closed === false) popup.close(); + +function info(key1, key2, ver) { + if (popup && popup.closed === false) popup.close(); const top = (screen.availHeight - 240) / 2; const left = (screen.availWidth - 320) / 2; popup = window.open("info.php?key1=" + key1 + "&key2=" + key2 + "&version=" + ver, @@ -19,9 +20,9 @@ function info(key1,key2,ver) { const myFocusObject = {}; -function checkfields(fields,frm,object) { +function checkfields(fields, frm, object) { const ar_field = fields.split(","); - for (let i=0;i -function msginit(msg,header,type) { +function msginit(msg, header, type) { let iconobj; YAHOO.namespace("msg.container"); const handleOK = function () { @@ -67,7 +70,8 @@ function msginit(msg,header,type) { iconobj = YAHOO.widget.SimpleDialog.ICON_HELP; } YAHOO.msg.container.domainmsg = new YAHOO.widget.SimpleDialog("domainmsg", - { width: "300px", + { + width: "300px", fixedcenter: true, visible: false, draggable: false, @@ -76,15 +80,15 @@ function msginit(msg,header,type) { modal: true, icon: iconobj, constraintoviewport: true, - buttons: [ { text:"Ok", handler:handleOK, isDefault:true } ] - } ); + buttons: [{text: "Ok", handler: handleOK, isDefault: true}] + }); YAHOO.msg.container.domainmsg.setHeader(header); YAHOO.msg.container.domainmsg.render("msgcontainer"); YAHOO.msg.container.domainmsg.show(); } -function confirminit(msg,header,type,yes,no,key) { +function confirminit(msg, header, type, yes, no, key) { let iconobj; YAHOO.namespace("question.container"); const handleYes = function () { @@ -99,7 +103,8 @@ function confirminit(msg,header,type,yes,no,key) { iconobj = YAHOO.widget.SimpleDialog.ICON_WARN; } YAHOO.question.container.domainmsg = new YAHOO.widget.SimpleDialog("confirm1", - { width: "400px", + { + width: "400px", fixedcenter: true, visible: false, draggable: false, @@ -108,9 +113,9 @@ function confirminit(msg,header,type,yes,no,key) { modal: true, icon: iconobj, constraintoviewport: true, - buttons: [ { text:yes, handler:handleYes, isDefault:true }, - { text:no, handler:handleNo }] - } ); + buttons: [{text: yes, handler: handleYes, isDefault: true}, + {text: no, handler: handleNo}] + }); YAHOO.question.container.domainmsg.setHeader(header); YAHOO.question.container.domainmsg.render("confirmcontainer"); YAHOO.question.container.domainmsg.show(); @@ -118,7 +123,7 @@ function confirminit(msg,header,type,yes,no,key) { -function dialoginit(key1,key2,ver,header) { +function dialoginit(key1, key2, ver, header) { YAHOO.namespace("dialog.container"); const handleCancel = function () { @@ -149,12 +154,13 @@ function dialoginit(key1,key2,ver,header) { if (typeof YAHOO.dialog.container.infodialog === "undefined") { YAHOO.dialog.container.infodialog = new YAHOO.widget.Dialog("infodialog", - { width : "50em", - visible : false, + { + width: "50em", + visible: false, draggable: true, fixedcenter: true, - constraintoviewport : true, - buttons : [ { text:"Ok", handler:handleCancel, isDefault:true } ] + constraintoviewport: true, + buttons: [{text: "Ok", handler: handleCancel, isDefault: true}] }); } @@ -165,18 +171,18 @@ function dialoginit(key1,key2,ver,header) { } -function calendarinit(lang,start,field,key,cont,obj) { - YAHOO.util.Event.onDOMReady(function(){ +function calendarinit(lang, start, field, key, cont, obj) { + YAHOO.util.Event.onDOMReady(function () { let dialog, calendar; calendar = new YAHOO.widget.Calendar(obj, { - iframe:false, - hide_blank_weeks:true, - START_WEEKDAY:start + iframe: false, + hide_blank_weeks: true, + START_WEEKDAY: start }); if (lang === "de_DE") { - calendar.cfg.setProperty("MONTHS_LONG", ["Januar", "Februar", "M\u00E4rz", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]); + calendar.cfg.setProperty("MONTHS_LONG", ["Januar", "Februar", "M\u00E4rz", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]); calendar.cfg.setProperty("WEEKDAYS_SHORT", ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"]); } @@ -185,31 +191,35 @@ function calendarinit(lang,start,field,key,cont,obj) { //} //function handleSelect(type,args,obj) { - function handleSelect(type,args) { + function handleSelect(type, args) { const dates = args[0]; const date = dates[0]; const year = date[0]; let month = date[1], day = date[2]; const txtDate1 = document.getElementById(field); - if (month < 10) { month = "0" + month;} - if (day < 10) { day = "0" + day;} + if (month < 10) { + month = "0" + month; + } + if (day < 10) { + day = "0" + day; + } // noinspection JSUndefinedPropertyAssignment txtDate1.value = year + "-" + month + "-" + day; dialog.hide(); } dialog = new YAHOO.widget.Dialog(cont, { - context:[field, "tl", "bl"], - width:"16em", - draggable:true, - close:true + context: [field, "tl", "bl"], + width: "16em", + draggable: true, + close: true }); calendar.render(); dialog.render(); dialog.hide(); - calendar.renderEvent.subscribe(function() { + calendar.renderEvent.subscribe(function () { dialog.fireEvent("changeContent"); }); // noinspection JSUnresolvedVariable @@ -220,9 +230,9 @@ function calendarinit(lang,start,field,key,cont,obj) { } // Open edit dialog for list boxes -function openMutDlgInit(field,divbox,header,key,langkey1,langkey2,exclude) { +function openMutDlgInit(field, divbox, header, key, langkey1, langkey2, exclude) { - YAHOO.util.Event.onDOMReady(function(){ + YAHOO.util.Event.onDOMReady(function () { let mutdialog; @@ -269,7 +279,7 @@ function openMutDlgInit(field,divbox,header,key,langkey1,langkey2,exclude) { } this.cancel(); // noinspection JSUnresolvedVariable - if ((typeof(update) === 'number') && (update === 1)) { + if ((typeof (update) === 'number') && (update === 1)) { // noinspection JSUnresolvedFunction updateForm(field); } @@ -278,20 +288,21 @@ function openMutDlgInit(field,divbox,header,key,langkey1,langkey2,exclude) { this.cancel(); }; mutdialog = new YAHOO.widget.Dialog(divbox, - { width : "60em", - fixedcenter : true, - visible : false, + { + width: "60em", + fixedcenter: true, + visible: false, draggable: true, modal: true, - constraintoviewport : true, - buttons : [ { text:langkey1, handler:handleSave, isDefault:true }, - { text:langkey2, handler:handleCancel } ] + constraintoviewport: true, + buttons: [{text: langkey1, handler: handleSave, isDefault: true}, + {text: langkey2, handler: handleCancel}] }); mutdialog.setHeader(header); mutdialog.render(); mutdialog.hide(); - mutdialog.beforeShowEvent.subscribe(function() { + mutdialog.beforeShowEvent.subscribe(function () { getData(field); }); @@ -304,12 +315,12 @@ function getData(field) { const source = document.getElementById(field); const targetSelect = document.getElementById(field + 'Selected'); const targetAvail = document.getElementById(field + 'Avail'); - for (let i=0; i < targetSelect.length; i++) { + for (let i = 0; i < targetSelect.length; i++) { targetSelect.options[i] = null; } // noinspection JSUndefinedPropertyAssignment targetSelect.length = 0; - for (let i=0; i < targetAvail.length; i++) { + for (let i = 0; i < targetAvail.length; i++) { targetAvail.options[i] = null; } // noinspection JSUndefinedPropertyAssignment @@ -333,6 +344,7 @@ function getData(field) { } } } + // Insert selection function selValue(field) { const targetSelect = document.getElementById(field + 'Selected'); @@ -350,11 +362,12 @@ function selValue(field) { } sort(targetSelect); DelOptions.reverse(); - for (let i=0; i=PHP5.1) -// ============================ -if (function_exists('date_default_timezone_set') and function_exists('date_default_timezone_get')) { +/** + * Class and variable includes + * @var HTML_Template_IT $conttp Content template + */ +/* +Timezone settings +*/ +if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) { date_default_timezone_set(date_default_timezone_get()); } -// -// Process post/get parameters -// =========================== -$chkInsName = filter_input(INPUT_POST, 'tfUsername', FILTER_SANITIZE_STRING); -$chkInsPasswd = filter_input(INPUT_POST, 'tfPassword', FILTER_SANITIZE_STRING); -$chkLogout = filter_input(INPUT_GET, 'logout', FILTER_SANITIZE_STRING, array('options' => array('default' => 'rr'))); -// -// Define common variables -// ======================= -if ((filter_input(INPUT_GET, 'SETS') != null) || (filter_input(INPUT_POST, 'SETS') != null)) { - $SETS = ''; // For security reason +/* +Process post/get parameters +*/ +$chkInsName = filter_input(INPUT_POST, 'tfUsername'); +$chkInsPasswd = filter_input(INPUT_POST, 'tfPassword'); +$chkLogout = filter_input(INPUT_GET, 'logout', FILTER_DEFAULT, array('options' => array('default' => 'rr'))); +/* +Define common variables +*/ +if ((filter_input(INPUT_GET, 'SETS') !== null) || (filter_input(INPUT_POST, 'SETS') !== null)) { + $SETS = ''; /* For security reason */ } -$strErrorMessage = ''; // All error messages (red) -$strInfoMessage = ''; // All information messages (green) -$strConsistMessage = ''; // Consistency message -$tplHeaderVar = ''; -$chkDomainId = 0; -$chkGroupAdm = 0; -$intError = 0; -$setDBVersion = 'unknown'; -$setFileVersion = '3.4.0'; -// -// Start PHP session -// ================= +$strErrorMessage = ''; /* All error messages (red) */ +$strInfoMessage = ''; /* All information messages (green) */ +$strConsistMessage = ''; /* Consistency message */ +$tplHeaderVar = ''; +$chkDomainId = 0; +$chkGroupAdm = 0; +$intError = 0; +$setEnableCommon = 0; +$setDBVersion = 'unknown'; +$setFileVersion = '3.5.0'; +$setGITVersion = '2023-06-18'; +$arrLocale = array(); +/* +Start PHP session +*/ session_start(); -// -// Check path settings -// =================== -if (substr_count(filter_input(INPUT_SERVER, 'SCRIPT_NAME', FILTER_SANITIZE_STRING), 'index.php') != 0) { +/* +Check path settings +*/ +if (substr_count(filter_input(INPUT_SERVER, 'SCRIPT_NAME'), 'index.php') !== 0) { $preBasePath = str_replace('//', '/', dirname(filter_input( - INPUT_SERVER, - 'SCRIPT_FILENAME', - FILTER_SANITIZE_STRING - )). '/'); - $preBaseURL = str_replace('//', '/', dirname(filter_input( - INPUT_SERVER, - 'SCRIPT_NAME', - FILTER_SANITIZE_STRING - )). '/'); - $_SESSION['SETS']['path']['base_url'] = $preBaseURL; + INPUT_SERVER, + 'SCRIPT_FILENAME' + )) . '/'); + $preBaseURL = str_replace('//', '/', dirname(filter_input( + INPUT_SERVER, + 'SCRIPT_NAME' + )) . '/'); + $_SESSION['SETS']['path']['base_url'] = $preBaseURL; $_SESSION['SETS']['path']['base_path'] = $preBasePath; -} elseif (!isset($_SESSION['SETS']['path']['base_url']) || !isset($_SESSION['SETS']['path']['base_path'])) { +} elseif (!isset($_SESSION['SETS']['path']['base_url'], $_SESSION['SETS']['path']['base_path'])) { header('Location: ../index.php'); exit; } else { - $preBaseURL = $_SESSION['SETS']['path']['base_url']; + $preBaseURL = $_SESSION['SETS']['path']['base_url']; $preBasePath = $_SESSION['SETS']['path']['base_path']; } -// -// Start installer -// =============== -$preIniFile = $preBasePath.'config/settings.php'; +/* +Start installer +*/ +$preIniFile = $preBasePath . 'config/settings.php'; if (!file_exists($preIniFile) || !is_readable($preIniFile)) { - header('Location: '.$preBaseURL.'install/index.php'); + header('Location: ' . $preBaseURL . 'install/index.php'); exit; } -// -// Read file settings -// ================== -$SETS = parse_ini_file($preBasePath.'config/settings.php', true); +/* +Read file settings +*/ +$SETS = parse_ini_file($preBasePath . 'config/settings.php', true); if (!isset($_SESSION['SETS']['db'])) { $_SESSION['SETS']['db'] = $SETS['db']; } -// -// Include external function/class files -// ===================================== -require $preBasePath.'functions/Autoloader.php'; -require $preBasePath.'functions/translator.php'; +/* +Include external function/class files +*/ +require $preBasePath . 'functions/Autoloader.php'; +require $preBasePath . 'functions/translator.php'; functions\Autoloader::register($preBasePath); -// -// Initialize classes - part 1 -// =========================== +/* +Initialize classes - part 1 +*/ $myDBClass = new functions\MysqliDbClass; $myDBClass->arrParams = $_SESSION['SETS']['db']; $myDBClass->hasDBConnection(); -if ($myDBClass->error == true) { +if ($myDBClass->error === true) { $strDBMessage = $myDBClass->strErrorMessage; - $booError = $myDBClass->error; - $intError = 1; + $booError = $myDBClass->error; + $intError = 1; } -// -// Get additional configuration from the table tbl_settings -// ======================================================== -if ($intError == 0) { - $strSQL = 'SELECT `category`,`name`,`value` FROM `tbl_settings`'; +/* +Get additional configuration from the table tbl_settings +*/ +if ($intError === 0) { + $strSQL = 'SELECT `category`,`name`,`value` FROM `tbl_settings`'; $booReturn = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - if ($booReturn == false) { - $strErrorMessage .= translate('Error while selecting data from database:'). '::' .$myDBClass->strErrorMessage; - $intError = 1; - } elseif ($intDataCount != 0) { - if (isset($_SESSION['SETS']['data']['locale']) && ($_SESSION['SETS']['data']['locale'] != '')) { + if ($booReturn === false) { + $strErrorMessage .= translate('Error while selecting data from database:') . '::' . $myDBClass->strErrorMessage; + $intError = 1; + } elseif ($intDataCount !== 0) { + if (isset($_SESSION['SETS']['data']['locale']) && ($_SESSION['SETS']['data']['locale'] !== '')) { $strStoreLanguage = $_SESSION['SETS']['data']['locale']; } - // Save additional configuration information + /* Save additional configuration information */ for ($i = 0; $i < $intDataCount; $i++) { - // We use the path settings from file - if ($arrDataLines[$i]['name'] == 'base_url') { + /* We use the path settings from file */ + if ($arrDataLines[$i]['name'] === 'base_url') { continue; } - if ($arrDataLines[$i]['name'] == 'base_path') { + if ($arrDataLines[$i]['name'] === 'base_path') { continue; } $SETS[$arrDataLines[$i]['category']][$arrDataLines[$i]['name']] = $arrDataLines[$i]['value']; } - if (isset($strStoreLanguage) && ($strStoreLanguage != '')) { + if (isset($strStoreLanguage) && ($strStoreLanguage !== '')) { $SETS['data']['locale'] = $strStoreLanguage; } } } -// -// Enable PHP gettext functionality -// ================================ -if ($intError == 0) { +/* +Enable PHP gettext functionality +*/ +if ($intError === 0) { $arrLocale = explode('.', $SETS['data']['locale']); $strDomain = $arrLocale[0]; $strLocale = setlocale( LC_ALL, $SETS['data']['locale'], - $SETS['data']['locale']. '.utf-8', - $SETS['data']['locale']. '.utf-8', - $SETS['data']['locale']. '.utf8', + $SETS['data']['locale'] . '.utf-8', + $SETS['data']['locale'] . '.utf-8', + $SETS['data']['locale'] . '.utf8', 'en_GB', 'en_GB.utf-8', 'en_GB.utf8' ); if (!isset($strLocale)) { $strErrorMessage .= translate('Error setting the correct locale. Please report this error with the associated ' - . "output of 'locale -a'"). '::'; + . "output of 'locale -a'") . '::'; $intError = 1; } - putenv('LC_ALL=' .$SETS['data']['locale']. '.utf-8'); - putenv('LANG=' .$SETS['data']['locale']. '.utf-8'); - bindtextdomain($strDomain, $preBasePath. 'config/locale'); + putenv('LC_ALL=' . $SETS['data']['locale'] . '.utf-8'); + putenv('LANG=' . $SETS['data']['locale'] . '.utf-8'); + bindtextdomain($strDomain, $preBasePath . 'config/locale'); bind_textdomain_codeset($strDomain, $SETS['data']['encoding']); textdomain($strDomain); } -// -// Include external function/class files -// ===================================== -require_once $preBasePath.'libraries/pear/HTML/Template/IT.php'; -if (isset($preFieldvars) && ($preFieldvars == 1)) { - require $preBasePath.'config/fieldvars.php'; +/* +Include external function/class files +*/ +require_once $preBasePath . 'libraries/pear/HTML/Template/IT.php'; +if (isset($preFieldvars) && ($preFieldvars === 1)) { + require $preBasePath . 'config/fieldvars.php'; } -// -// Check path settings -// =================== -if (!isset($SETS['path']['base_path']) || ($preBasePath != $SETS['path']['base_path'])) { +/* +Check path settings +*/ +if (!isset($SETS['path']['base_path']) || ($preBasePath !== $SETS['path']['base_path'])) { $SETS['path']['base_path'] = $preBasePath; } -if (!isset($SETS['path']['base_url']) || ($preBaseURL != $SETS['path']['base_url'])) { +if (!isset($SETS['path']['base_url']) || ($preBaseURL !== $SETS['path']['base_url'])) { $SETS['path']['base_url'] = $preBaseURL; } -// -// Add data to the session -// ======================= -$_SESSION['SETS'] = $SETS; +/* +Add data to the session +*/ +$_SESSION['SETS'] = $SETS; $_SESSION['strLoginMessage'] = ''; -$_SESSION['startsite'] = $_SESSION['SETS']['path']['base_url']. 'admin.php'; +$_SESSION['startsite'] = $_SESSION['SETS']['path']['base_url'] . 'admin.php'; if (!isset($_SESSION['logged_in'])) { $_SESSION['logged_in'] = 0; } -// Reload locale after logout -if (isset($chkLogout) && ($chkLogout == 'yes')) { +/* Reload locale after logout */ +if (isset($chkLogout) && ($chkLogout === 'yes')) { $_SESSION = array(); - $_SESSION['SETS'] = $SETS; - $_SESSION['logged_in'] = 0; - $_SESSION['userid'] = 0; - $_SESSION['groupadm'] = 0; + $_SESSION['SETS'] = $SETS; + $_SESSION['logged_in'] = 0; + $_SESSION['userid'] = 0; + $_SESSION['groupadm'] = 0; $_SESSION['strLoginMessage'] = ''; - $_SESSION['startsite'] = $_SESSION['SETS']['path']['base_url']. 'admin.php'; + $_SESSION['startsite'] = $_SESSION['SETS']['path']['base_url'] . 'admin.php'; // Get default language - $strSQL = "SELECT `value` FROM `tbl_settings` WHERE `category`='data' AND `name`='locale'"; + $strSQL = "SELECT `value` FROM `tbl_settings` WHERE `category`='data' AND `name`='locale'"; $strLocaleDB = $myDBClass->getFieldData($strSQL); - if ($strLocaleDB != '') { + if ($strLocaleDB !== '') { $_SESSION['SETS']['data']['locale'] = $strLocaleDB; - $SETS['data']['locale'] = $strLocaleDB; + $SETS['data']['locale'] = $strLocaleDB; } - $arrLocale = explode('.', $SETS['data']['locale']); $strDomain = $arrLocale[0]; $strLocale = setlocale( LC_ALL, $SETS['data']['locale'], - $SETS['data']['locale']. '.utf-8', - $SETS['data']['locale']. '.utf-8', - $SETS['data']['locale']. '.utf8', + $SETS['data']['locale'] . '.utf-8', + $SETS['data']['locale'] . '.utf-8', + $SETS['data']['locale'] . '.utf8', 'en_GB', 'en_GB.utf-8', 'en_GB.utf8' ); if (!isset($strLocale)) { $strErrorMessage .= translate('Error in setting the correct locale, please report this error with the ' - . "associated output of 'locale -a' to bugs@nagiosql.org"). '::'; + . "associated output of 'locale -a' to bugs@nagiosql.org") . '::'; $intError = 1; } - putenv('LC_ALL=' .$SETS['data']['locale']. '.utf-8'); - putenv('LANG=' .$SETS['data']['locale']. '.utf-8'); + putenv('LC_ALL=' . $SETS['data']['locale'] . '.utf-8'); + putenv('LANG=' . $SETS['data']['locale'] . '.utf-8'); bindtextdomain($strDomain, $preBasePath . 'config/locale'); bind_textdomain_codeset($strDomain, $SETS['data']['encoding']); textdomain($strDomain); } -// Hide menu -if (filter_input(INPUT_GET, 'menu') != null) { - if (filter_input(INPUT_GET, 'menu', FILTER_SANITIZE_STRING) == 'visible') { +/* Hide menu */ +if (filter_input(INPUT_GET, 'menu') !== null) { + if (filter_input(INPUT_GET, 'menu') === 'visible') { $_SESSION['menu'] = 'visible'; - } elseif (filter_input(INPUT_GET, 'menu', FILTER_SANITIZE_STRING) == 'invisible') { + } elseif (filter_input(INPUT_GET, 'menu') === 'invisible') { $_SESSION['menu'] = 'invisible'; } } -// -// Initialize classes -// ================== -$myVisClass = new functions\NagVisualClass($_SESSION); -$myDataClass = new functions\NagDataClass($_SESSION); -$myConfigClass = new functions\NagConfigClass($_SESSION); +/* +Initialize classes +*/ +$myVisClass = new functions\NagVisualClass($_SESSION); +$myDataClass = new functions\NagDataClass($_SESSION); +$myConfigClass = new functions\NagConfigClass($_SESSION); +/** @noinspection PhpObjectFieldsAreOnlyWrittenInspection */ $myContentClass = new functions\NagContentClass($_SESSION); -// -// Propagating the classes themselves -// ================================== -$myVisClass->myDBClass =& $myDBClass; -$myVisClass->myConfigClass =& $myConfigClass; -// -$myDataClass->myDBClass =& $myDBClass; -$myDataClass->myVisClass =& $myVisClass; -$myDataClass->myConfigClass =& $myConfigClass; -// -$myConfigClass->myDBClass =& $myDBClass; -$myConfigClass->myDataClass =& $myDataClass; -// -$myContentClass->myDBClass =& $myDBClass; -$myContentClass->myVisClass =& $myVisClass; +/* +Propagating the classes themselves +*/ +$myVisClass->myDBClass =& $myDBClass; +$myVisClass->myConfigClass =& $myConfigClass; +$myDataClass->myDBClass =& $myDBClass; +$myDataClass->myVisClass =& $myVisClass; +$myDataClass->myConfigClass =& $myConfigClass; +$myConfigClass->myDBClass =& $myDBClass; +$myConfigClass->myDataClass =& $myDataClass; +$myContentClass->myDBClass =& $myDBClass; +$myContentClass->myVisClass =& $myVisClass; $myContentClass->myConfigClass =& $myConfigClass; if (isset($arrDescription)) { $myContentClass->arrDescription = $arrDescription; } -// -// Version management -// ================== -if ($intError == 0) { +/* +Version management +*/ +if ($intError === 0) { $setDBVersion = $SETS['db']['version']; } -// -// Version check -// ============= -if (version_compare($setFileVersion, $setDBVersion, '>') && (file_exists($preBasePath. 'install') && - is_readable($preBasePath. 'install'))) { - header('Location: '. $_SESSION['SETS']['path']['base_url'].'install/index.php'); +/* +Version check +*/ +if (version_compare($setFileVersion, $setDBVersion, '>') && (file_exists($preBasePath . 'install') && + is_readable($preBasePath . 'install'))) { + header('Location: ' . $_SESSION['SETS']['path']['base_url'] . 'install/index.php'); exit; } -// -// Browser Check -// ============= +/* +Browser Check +*/ $preBrowser = $myVisClass->browserCheck(); -// -// Login process -// ============== -$strRemoteUser = filter_input(INPUT_SERVER, 'REMOTE_USER', FILTER_SANITIZE_STRING); -if (isset($strRemoteUser) && ($strRemoteUser != '') && ($_SESSION['logged_in'] == 0) && - ($chkLogout != 'yes') && ($chkInsName == '')) { - $strSQL = "SELECT * FROM `tbl_user` WHERE `username`='".$strRemoteUser."' AND `wsauth`='1' AND `active`='1'"; +/* +Login process +*/ +$strRemoteUser = filter_input(INPUT_SERVER, 'REMOTE_USER'); +if (isset($strRemoteUser) && ($strRemoteUser !== '') && ((int)$_SESSION['logged_in'] === 0) && + ($chkLogout !== 'yes') && (($chkInsName === '') || ($chkInsName === null))) { + $strSQL = "SELECT * FROM `tbl_user` WHERE `username`='" . $strRemoteUser . "' AND `wsauth`='1' AND `active`='1'"; $booReturn = $myDBClass->hasDataArray($strSQL, $arrDataUser, $intDataCount); - if ($booReturn && ($intDataCount == 1)) { - // Set session variables - $_SESSION['username'] = $arrDataUser[0]['username']; - $_SESSION['userid'] = $arrDataUser[0]['id']; - $_SESSION['groupadm'] = $arrDataUser[0]['admin_enable']; - $_SESSION['startsite'] = $_SESSION['SETS']['path']['base_url']. 'admin.php'; + if ($booReturn && ($intDataCount === 1)) { + /* Set session variables */ + /** @noinspection DuplicatedCode */ + $_SESSION['username'] = $arrDataUser[0]['username']; + $_SESSION['userid'] = $arrDataUser[0]['id']; + $_SESSION['groupadm'] = $arrDataUser[0]['admin_enable']; + $_SESSION['startsite'] = $_SESSION['SETS']['path']['base_url'] . 'admin.php'; $_SESSION['timestamp'] = time(); $_SESSION['logged_in'] = 1; - $_SESSION['domain'] = $arrDataUser[0]['domain']; - // Update language settings - $strSQL = 'SELECT `locale` FROM `tbl_language` ' - . "WHERE `id`='".$arrDataUser[0]['language']."' AND `active`='1'"; + $_SESSION['domain'] = $arrDataUser[0]['domain']; + /* Update language settings */ + $strSQL = 'SELECT `locale` FROM `tbl_language` ' + . "WHERE `id`='" . $arrDataUser[0]['language'] . "' AND `active`='1'"; $strUserLocale = $myDBClass->getFieldData($strSQL); - if ($strUserLocale != '') { + if ($strUserLocale !== '') { $_SESSION['SETS']['data']['locale'] = $strUserLocale; - $SETS['data']['locale'] = $strUserLocale; + $SETS['data']['locale'] = $strUserLocale; } - // Update last login time + /* Update last login time */ $strSQLUpdate = 'UPDATE `tbl_user` SET `last_login`=NOW() ' - . "WHERE `username`='".$myDBClass->realEscape($chkInsName)."'"; - $booReturn = $myDBClass->insertData($strSQLUpdate); + . "WHERE `username`='" . $myDBClass->realEscape($strRemoteUser) . "'"; + $booReturn = $myDBClass->insertData($strSQLUpdate); $myDataClass->strUserName = $arrDataUser[0]['username']; $myDataClass->writeLog(translate('Webserver login successfull')); $_SESSION['strLoginMessage'] = ''; - // Redirect to start page - header('Location: ' .$_SESSION['SETS']['path']['protocol']. '://' . - filter_input(INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_STRING).$_SESSION['startsite']); + /* Redirect to start page */ + header('Location: ' . $_SESSION['SETS']['path']['protocol'] . '://' . + filter_input(INPUT_SERVER, 'HTTP_HOST') . $_SESSION['startsite']); exit; } } -if (($_SESSION['logged_in'] == 0) && isset($chkInsName) && ($chkInsName != '') && ($intError == 0)) { - $chkInsName = $myDBClass->realEscape($chkInsName); +if (((int)$_SESSION['logged_in'] === 0) && isset($chkInsName) && ($chkInsName !== '') && ($intError === 0)) { + $chkInsName = $myDBClass->realEscape($chkInsName); $chkInsPasswd = $myDBClass->realEscape($chkInsPasswd); - $strSQL = 'SELECT * FROM `tbl_user` ' - . "WHERE `username`='".$chkInsName."' AND `password`=MD5('".$chkInsPasswd."') AND `active`='1'"; + $strSQL = 'SELECT * FROM `tbl_user` ' + . "WHERE `username`='" . $chkInsName . "' AND `password`=MD5('" . $chkInsPasswd . "') AND `active`='1'"; $booReturn = $myDBClass->hasDataArray($strSQL, $arrDataUser, $intDataCount); - if ($booReturn == false) { + if ($booReturn === false) { $strErrorMessage = str_replace('::', '
', $strErrorMessage); $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); $_SESSION['strLoginMessage'] = $strErrorMessage; - } elseif ($intDataCount == 1) { - // Set session variables - $_SESSION['username'] = $arrDataUser[0]['username']; - $_SESSION['userid'] = $arrDataUser[0]['id']; - $_SESSION['groupadm'] = $arrDataUser[0]['admin_enable']; + } elseif ($intDataCount === 1) { + /* Set session variables */ + /** @noinspection DuplicatedCode */ + $_SESSION['username'] = $arrDataUser[0]['username']; + $_SESSION['userid'] = $arrDataUser[0]['id']; + $_SESSION['groupadm'] = $arrDataUser[0]['admin_enable']; $_SESSION['startsite'] = $_SESSION['SETS']['path']['base_url'] . 'admin.php'; $_SESSION['timestamp'] = time(); $_SESSION['logged_in'] = 1; - $_SESSION['domain'] = $arrDataUser[0]['domain']; + $_SESSION['domain'] = $arrDataUser[0]['domain']; // Update language settings $strSQL = 'SELECT `locale` FROM `tbl_language` ' - . "WHERE `id`='".$arrDataUser[0]['language']."' AND `active`='1'"; + . "WHERE `id`='" . $arrDataUser[0]['language'] . "' AND `active`='1'"; $strUserLocale = $myDBClass->getFieldData($strSQL); - if ($strUserLocale != '') { + if ($strUserLocale !== '') { $_SESSION['SETS']['data']['locale'] = $strUserLocale; - $SETS['data']['locale'] = $strUserLocale; + $SETS['data']['locale'] = $strUserLocale; } - // Update last login time + /* Update last login time */ $strSQLUpdate = 'UPDATE `tbl_user` SET `last_login`=NOW() ' - . "WHERE `username`='".$myDBClass->realEscape($chkInsName)."'"; - $booReturn = $myDBClass->insertData($strSQLUpdate); + . "WHERE `username`='" . $myDBClass->realEscape($chkInsName) . "'"; + $booReturn = $myDBClass->insertData($strSQLUpdate); $myDataClass->strUserName = $arrDataUser[0]['username']; $myDataClass->writeLog(translate('Login successfull')); $_SESSION['strLoginMessage'] = ''; - // Redirect to start page - header('Location: ' .$_SESSION['SETS']['path']['protocol']. '://' . - filter_input(INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_STRING).$_SESSION['startsite']); + /* Redirect to start page */ + header('Location: ' . $_SESSION['SETS']['path']['protocol'] . '://' . + filter_input(INPUT_SERVER, 'HTTP_HOST') . $_SESSION['startsite']); exit; } else { $_SESSION['strLoginMessage'] = translate('Login failed!'); - $myDataClass->writeLog(translate('Login failed!'). ' - Username: ' .$chkInsName); + $myDataClass->writeLog(translate('Login failed!') . ' - Username: ' . $chkInsName); $preNoMain = 0; } } -if (($_SESSION['logged_in'] == 0) && (!isset($intPageID) || ($intPageID != 0)) && - (!isset($chkInsName) || ($chkInsName == ''))) { - header('Location: ' .$_SESSION['SETS']['path']['protocol']. '://' . - filter_input(INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_STRING). - $_SESSION['SETS']['path']['base_url']. 'index.php'); +if (((int)$_SESSION['logged_in'] === 0) && (!isset($intPageID) || ($intPageID !== 0)) && + (!isset($chkInsName) || ($chkInsName === ''))) { + header('Location: ' . $_SESSION['SETS']['path']['protocol'] . '://' . + filter_input(INPUT_SERVER, 'HTTP_HOST') . + $_SESSION['SETS']['path']['base_url'] . 'index.php'); exit; } -if (!isset($_SESSION['userid']) && ($_SESSION['logged_in'] == 1)) { +if (!isset($_SESSION['userid']) && ((int)$_SESSION['logged_in'] === 1)) { $_SESSION['logged_in'] = 0; - header('Location: ' .$_SESSION['SETS']['path']['protocol']. '://' . - filter_input(INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_STRING). - $_SESSION['SETS']['path']['base_url']. 'index.php'); + header('Location: ' . $_SESSION['SETS']['path']['protocol'] . '://' . + filter_input(INPUT_SERVER, 'HTTP_HOST') . + $_SESSION['SETS']['path']['base_url'] . 'index.php'); exit; } -// -// Review and update login -// ======================= -if (($_SESSION['logged_in'] == 1) && ($intError == 0)) { - $strSQL = "SELECT * FROM `tbl_user` WHERE `username`='".$myDBClass->realEscape($_SESSION['username'])."'"; +/* +Review and update login +*/ +if (((int)$_SESSION['logged_in'] === 1) && ($intError === 0)) { + $strSQL = "SELECT * FROM `tbl_user` WHERE `username`='" . $myDBClass->realEscape($_SESSION['username']) . "'"; $booReturn = $myDBClass->hasDataArray($strSQL, $arrDataUser, $intDataCount); - if ($booReturn == false) { + if ($booReturn === false) { $strErrorMessage = str_replace('::', '
', $strErrorMessage); $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); - } elseif ($intDataCount == 1) { - // Time expired? + } elseif ($intDataCount === 1) { + /* Time expired? */ if (time() - $_SESSION['timestamp'] > $_SESSION['SETS']['security']['logofftime']) { - // Force new login - $myDataClass->writeLog(translate('Session timeout reached - Seconds:'). ' ' . - (time() - $_SESSION['timestamp']. ' - User: ' .$_SESSION['username'])); + /* Force new login */ + $myDataClass->writeLog(translate('Session timeout reached - Seconds:') . ' ' . + (time() - $_SESSION['timestamp'] . ' - User: ' . $_SESSION['username'])); $_SESSION['logged_in'] = 0; - - header('Location: ' .$_SESSION['SETS']['path']['protocol']. '://' . - filter_input(INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_STRING). - $_SESSION['SETS']['path']['base_url']. 'index.php'); + header('Location: ' . $_SESSION['SETS']['path']['protocol'] . '://' . + filter_input(INPUT_SERVER, 'HTTP_HOST') . + $_SESSION['SETS']['path']['base_url'] . 'index.php'); exit; } - // Check rights - if (isset($preAccess) && ($preAccess == 1) && (isset($prePageId) && ($prePageId != 0))) { - $strKey = $myDBClass->getFieldData("SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=$prePageId"); + /* Check rights */ + if (isset($preAccess, $prePageId) && ($preAccess === 1) && ($prePageId !== 0)) { + $strKey = $myDBClass->getFieldData("SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=$prePageId"); $intResult = $myVisClass->checkAccountGroup($strKey, 'read'); - // If no rights - redirect to index page - if ($intResult != 0) { - $myDataClass->writeLog(translate('Restricted site accessed:'). ' ' . - filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); - header('Location: ' .$_SESSION['SETS']['path']['protocol']. '://' . - filter_input(INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_STRING). - $_SESSION['SETS']['path']['base_url']. 'index.php'); + /* If no rights - redirect to index page */ + if ($intResult !== 0) { + $myDataClass->writeLog(translate('Restricted site accessed:') . ' ' . + filter_input(INPUT_SERVER, 'PHP_SELF')); + header('Location: ' . $_SESSION['SETS']['path']['protocol'] . '://' . + filter_input(INPUT_SERVER, 'HTTP_HOST') . + $_SESSION['SETS']['path']['base_url'] . 'index.php'); exit; } } - // Update login time + /* Update login time */ $_SESSION['timestamp'] = time(); - if (isset($preContent) && ($preContent == 'index.htm.tpl')) { - header('Location: ' .$_SESSION['SETS']['path']['protocol']. '://' . - filter_input(INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_STRING).$_SESSION['startsite']); + if (isset($preContent) && ($preContent === 'index.htm.tpl')) { + header('Location: ' . $_SESSION['SETS']['path']['protocol'] . '://' . + filter_input(INPUT_SERVER, 'HTTP_HOST') . $_SESSION['startsite']); exit; } } else { - // Force new login + /* Force new login */ $myDataClass->writeLog(translate('User not found in database')); $_SESSION['logged_in'] = 0; - header('Location: ' .$_SESSION['SETS']['path']['protocol']. '://' . - filter_input(INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_STRING). - $_SESSION['SETS']['path']['base_url']. 'index.php'); + header('Location: ' . $_SESSION['SETS']['path']['protocol'] . '://' . + filter_input(INPUT_SERVER, 'HTTP_HOST') . + $_SESSION['SETS']['path']['base_url'] . 'index.php'); exit; } } -// -// Check access to current site -// ============================ -if (isset($prePageId) && ($prePageId != 1)) { +/* +Check access to current site +*/ +if (isset($prePageId) && ((int)$prePageId !== 1)) { if (!isset($_SESSION['userid'])) { - header('Location: ' .$_SESSION['SETS']['path']['protocol']. '://' . - filter_input(INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_STRING). - $_SESSION['SETS']['path']['base_url']. 'index.php'); + header('Location: ' . $_SESSION['SETS']['path']['protocol'] . '://' . + filter_input(INPUT_SERVER, 'HTTP_HOST') . + $_SESSION['SETS']['path']['base_url'] . 'index.php'); exit; } - $strSQL = "SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=$prePageId"; + $strSQL = "SELECT `mnuGrpId` FROM `tbl_menu` WHERE `mnuId`=$prePageId"; $prePageKey = (int)$myDBClass->getFieldData($strSQL); - if ($myVisClass->checkAccountGroup($prePageKey, 'read') != 0) { - header('Location: ' .$_SESSION['SETS']['path']['protocol']. '://' . - filter_input(INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_STRING). - $_SESSION['startsite']); + if ($myVisClass->checkAccountGroup($prePageKey, 'read') !== 0) { + header('Location: ' . $_SESSION['SETS']['path']['protocol'] . '://' . + filter_input(INPUT_SERVER, 'HTTP_HOST') . + $_SESSION['startsite']); exit; } } -// -// Insert main template -// ==================== -if (isset($preContent) && ($preContent != '') && (!isset($preNoMain) || ($preNoMain != 1))) { +/* +Insert main template +*/ +if (isset($preContent) && ($preContent !== '') && (!isset($preNoMain) || ($preNoMain !== 1))) { $arrTplOptions = array('use_preg' => false); $maintp = new HTML_Template_IT($preBasePath . 'templates/'); - $maintp->loadTemplatefile('main.htm.tpl', true, true); + $maintp->loadTemplatefile('main.htm.tpl'); $maintp->setOptions($arrTplOptions); $maintp->setVariable('META_DESCRIPTION', 'NagiosQL System Monitoring Administration Tool'); $maintp->setVariable('AUTHOR', 'NagiosQL Team'); $maintp->setVariable('LANGUAGE', 'de'); $maintp->setVariable('PUBLISHER', 'NagiosQL @ Sourceforge'); - if ($_SESSION['logged_in'] == 1) { + if ((int)$_SESSION['logged_in'] === 1) { $maintp->setVariable('ADMIN', '' .translate('Administration'). ''); - //$maintp->setVariable("PLUGINS","".translate('Plugins').""); + . 'class="top-link">' . translate('Administration') . ''); } $maintp->setVariable('BASE_PATH', $_SESSION['SETS']['path']['base_url']); $maintp->setVariable('ROBOTS', 'noindex,nofollow'); - $maintp->setVariable('PAGETITLE', 'NagiosQL - Version ' .$setDBVersion); + $maintp->setVariable('PAGETITLE', 'NagiosQL - Version ' . $setDBVersion); $maintp->setVariable('IMAGEDIR', $_SESSION['SETS']['path']['base_url'] . 'images/'); - if (isset($prePageId) && ($intError == 0)) { + if (isset($prePageId) && ($intError === 0)) { $maintp->setVariable('POSITION', $myVisClass->getPosition($prePageId, translate('Administration'))); } $maintp->parse('header'); $tplHeaderVar = $maintp->get('header'); - // - // Read domain list - // ================ - if (($_SESSION['logged_in'] == 1) && ($intError == 0)) { + /* + Read domain list + */ + if (((int)$_SESSION['logged_in'] === 1) && ($intError === 0)) { $intDomain = filter_input( INPUT_POST, 'selDomain', FILTER_VALIDATE_INT, array('options' => array('default' => -1)) ); - if ($intDomain != -1) { - $_SESSION['domain'] = $intDomain; - $myVisClass->intDomainId = $intDomain; - $myDataClass->intDomainId = $intDomain; - $myConfigClass->intDomainId = $intDomain; + if ($intDomain !== -1) { + $_SESSION['domain'] = $intDomain; + $myVisClass->intDomainId = $intDomain; + $myDataClass->intDomainId = $intDomain; + $myConfigClass->intDomainId = $intDomain; $myContentClass->intDomainId = $intDomain; } $arrDataDomain = array(); - $strSQL = "SELECT * FROM `tbl_datadomain` WHERE `active` <> '0' ORDER BY `domain`"; - $booReturn = $myDBClass->hasDataArray($strSQL, $arrDataDomain, $intDataCount); - if ($booReturn == false) { + $strSQL = "SELECT * FROM `tbl_datadomain` WHERE `active` <> '0' ORDER BY `domain`"; + $booReturn = $myDBClass->hasDataArray($strSQL, $arrDataDomain, $intDataCount); + if ($booReturn === false) { $strErrorMessage = str_replace('::', '
', $strErrorMessage); $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); @@ -499,127 +496,120 @@ if (isset($preContent) && ($preContent != '') && (!isset($preNoMain) || ($preNoM if ($intDataCount > 0) { foreach ($arrDataDomain as $elem) { $intIsDomain = 0; - // Check access rights - if ($myVisClass->checkAccountGroup($elem['access_group'], 'read') == 0) { + /* Check access rights */ + if ($myVisClass->checkAccountGroup($elem['access_group'], 'read') === 0) { $maintp->setVariable('DOMAIN_VALUE', $elem['id']); $maintp->setVariable('DOMAIN_TEXT', $elem['domain']); - if (isset($_SESSION['domain']) && ($_SESSION['domain'] == $elem['id'])) { + if (isset($_SESSION['domain']) && ((int)$_SESSION['domain'] === (int)$elem['id'])) { $maintp->setVariable('DOMAIN_SELECTED', 'selected'); - $intDomain = $elem['id']; + $intDomain = $elem['id']; $intIsDomain = 1; } - if ($intDomain == -1) { - $intDomain = $elem['id']; + if ($intDomain === -1) { + $intDomain = $elem['id']; $intIsDomain = 1; } $maintp->parse('domainsel'); } - if ($intIsDomain == 0) { - // Select available an domain + if ($intIsDomain === 0) { + /* Select available an domain */ $strDomAcc = $myVisClass->getAccessGroups('read'); - $strSQL = 'SELECT id FROM `tbl_datadomain` ' - . "WHERE `active` <> '0' AND `access_group` IN (".$strDomAcc. ') ' - . 'ORDER BY domain LIMIT 1'; + $strSQL = 'SELECT id FROM `tbl_datadomain` ' + . "WHERE `active` <> '0' AND `access_group` IN (" . $strDomAcc . ') ' + . 'ORDER BY domain LIMIT 1'; $booReturn = $myDBClass->hasDataArray($strSQL, $arrDataDomain, $intDataCount); - if ($booReturn == false) { + if ($booReturn === false) { $strErrorMessage = str_replace('::', '
', $strErrorMessage); $myVisClass->processMessage( translate('Error while selecting data from database:'), $strErrorMessage ); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); - } else { - if ($intDataCount != 0) { - $intDomain = $arrDataDomain[0]['id']; - } + } else if ($intDataCount !== 0) { + $intDomain = $arrDataDomain[0]['id']; } } } - $maintp->setVariable('DOMAIN_INFO', translate('Domain'). ':'); + $maintp->setVariable('DOMAIN_INFO', translate('Domain') . ':'); $maintp->parse('dselect'); $tplHeaderVar .= $maintp->get('dselect'); } } } - // - // Show login information - // ====================== - if ($_SESSION['logged_in'] == 1) { - $maintp->setVariable('LOGIN_INFO', translate('Logged in:'). ' ' .$_SESSION['username']); - $maintp->setVariable('LOGOUT_INFO', '' .translate('Logout'). ''); + /* + Show login information + */ + if ((int)$_SESSION['logged_in'] === 1) { + $maintp->setVariable('LOGIN_INFO', translate('Logged in:') . ' ' . $_SESSION['username']); + $maintp->setVariable('LOGOUT_INFO', '' . translate('Logout') . ''); } else { $maintp->setVariable('LOGOUT_INFO', ' '); } - // - // Build content menu - // ================== - if (isset($prePageId) && ($prePageId != 0)) { + /* + Build content menu + */ + if (isset($prePageId) && ((int)$prePageId !== 0)) { $maintp->setVariable('MAINMENU', $myVisClass->getMenu($prePageId)); } $maintp->parse('header2'); $tplHeaderVar .= $maintp->get('header2'); - if (!isset($preShowHeader) || $preShowHeader == 1) { + if (!isset($preShowHeader) || $preShowHeader === 1) { echo $tplHeaderVar; } } -// -// Insert content and master template -// ====================================== -if (isset($preContent) && ($preContent != '')) { +/* +Insert content and master template +*/ +if (isset($preContent) && ($preContent !== '')) { $arrTplOptions = array('use_preg' => false); - if (!file_exists($preBasePath . 'templates/' .$preContent) || - !is_readable($preBasePath . 'templates/' .$preContent)) { - echo '' .translate('Warning - template file not found or not readable, please ' - . 'check your file permissions! - File: '); - echo str_replace('//', '/', $preBasePath . 'templates/' .$preContent). '
'; + if (!file_exists($preBasePath . 'templates/' . $preContent) || + !is_readable($preBasePath . 'templates/' . $preContent)) { + echo '' . translate('Warning - template file not found or not readable, please ' + . 'check your file permissions! - File: '); + echo str_replace('//', '/', $preBasePath . 'templates/' . $preContent) . '
'; exit; } $conttp = new HTML_Template_IT($preBasePath . 'templates/'); - $conttp->loadTemplatefile($preContent, true, true); + $conttp->loadTemplatefile($preContent); $conttp->setOptions($arrTplOptions); $strRootPath = $_SESSION['SETS']['path']['base_url']; - if (substr($strRootPath, -1) != '/') { - $conttp->setVariable('BASE_PATH', $strRootPath); - $conttp->setVariable('IMAGE_PATH', $strRootPath. 'images/'); - } else { - $conttp->setVariable('BASE_PATH', $strRootPath); - $conttp->setVariable('IMAGE_PATH', $strRootPath. 'images/'); - } + $conttp->setVariable('BASE_PATH', $strRootPath); + $conttp->setVariable('IMAGE_PATH', $strRootPath . 'images/'); $mastertp = new HTML_Template_IT($preBasePath . 'templates/'); - if (isset($preListTpl) && ($preListTpl != '')) { - $mastertp->loadTemplatefile($preListTpl, true, true); + if (isset($preListTpl) && ($preListTpl !== '')) { + $mastertp->loadTemplatefile($preListTpl); } $mastertp->setOptions($arrTplOptions); } -// -// Process standard get/post parameters -// ==================================== -$arrSortDir = array('ASC', 'DESC'); -$arrSortBy = array(1, 2); -$chkModus = 'display'; -$chkModusGet = filter_input(INPUT_GET, 'modus', 513, array('options' => array('default' => 'display'))); -$chkOrderBy = filter_input(INPUT_GET, 'orderby', FILTER_SANITIZE_STRING); -$chkOrderDir = filter_input(INPUT_GET, 'orderdir', FILTER_SANITIZE_STRING); -$chkLimitGet = filter_input(INPUT_GET, 'limit', FILTER_VALIDATE_INT); +/* +Process standard get/post parameters +*/ +$arrSortDir = array('ASC', 'DESC'); +$arrSortBy = array(1, 2); +$chkModus = 'display'; +$chkModusGet = filter_input(INPUT_GET, 'modus', 513, array('options' => array('default' => 'display'))); +$chkOrderBy = filter_input(INPUT_GET, 'orderby', FILTER_VALIDATE_INT); +$chkOrderDir = filter_input(INPUT_GET, 'orderdir'); +$chkLimitGet = filter_input(INPUT_GET, 'limit', FILTER_VALIDATE_INT); $chkModusPost = filter_input(INPUT_POST, 'modus', 513, array('options' => array('default' => 'display'))); -$chkHidModify = filter_input(INPUT_POST, 'hidModify', FILTER_SANITIZE_STRING); -$chkSelModify = filter_input(INPUT_POST, 'selModify', FILTER_SANITIZE_STRING); -$hidSortDir = filter_input(INPUT_POST, 'hidSortDir', FILTER_SANITIZE_STRING); -$hidSortBy = filter_input(INPUT_POST, 'hidSortBy', FILTER_VALIDATE_INT); -$chkLimit = filter_input(INPUT_POST, 'hidLimit', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); +$chkHidModify = filter_input(INPUT_POST, 'hidModify'); +$chkSelModify = filter_input(INPUT_POST, 'selModify'); +$hidSortDir = filter_input(INPUT_POST, 'hidSortDir'); +$hidSortBy = filter_input(INPUT_POST, 'hidSortBy', FILTER_VALIDATE_INT); +$chkLimit = filter_input(INPUT_POST, 'hidLimit', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); $chkSelTarDom = filter_input(INPUT_POST, 'selTarDom', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); -$chkListId = filter_input(INPUT_POST, 'hidListId', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); -$chkDataId = filter_input(INPUT_POST, 'hidId', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); -$chkActive = filter_input(INPUT_POST, 'chbActive', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); -$chkRegister = filter_input(INPUT_POST, 'chbRegister', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); -$hidActive = filter_input(INPUT_POST, 'hidActive', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); -$hidSort = filter_input(INPUT_POST, 'hidSort', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); -$chkStatus = filter_input(INPUT_POST, 'hidStatus', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); -if ($chkModusGet != 'display') { +$chkListId = filter_input(INPUT_POST, 'hidListId', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); +$chkDataId = filter_input(INPUT_POST, 'hidId', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); +$chkActive = filter_input(INPUT_POST, 'chbActive', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); +$chkRegister = filter_input(INPUT_POST, 'chbRegister', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); +$hidActive = filter_input(INPUT_POST, 'hidActive', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); +$hidSort = filter_input(INPUT_POST, 'hidSort', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); +$chkStatus = filter_input(INPUT_POST, 'hidStatus', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); +if ($chkModusGet !== 'display') { $chkModus = $chkModusGet; } -if ($chkModusPost != 'display') { +if ($chkModusPost !== 'display') { $chkModus = $chkModusPost; } if (!in_array($hidSortDir, $arrSortDir, true)) { @@ -634,62 +624,66 @@ if (in_array($chkOrderDir, $arrSortDir, true)) { if (in_array($chkOrderBy, $arrSortBy, true)) { $hidSortBy = $chkOrderBy; } -// -// Setting some variables -// ====================== -if ($chkModus == 'add') { +/* +Setting some variables +*/ +if ($chkModus === 'add') { $chkSelModify = ''; } -if ($chkHidModify != '') { +if ($chkHidModify !== '') { $chkSelModify = $chkHidModify; } if (isset($chkLimitGet)) { - $chkLimit = $chkLimitGet; + $chkLimit = $chkLimitGet; } if (isset($_SESSION['domain'])) { - $chkDomainId = $_SESSION['domain']; + $chkDomainId = (int)$_SESSION['domain']; } if (isset($_SESSION['groupadm'])) { - $chkGroupAdm = $_SESSION['groupadm']; + $chkGroupAdm = $_SESSION['groupadm']; } if (isset($_SESSION['strLoginMessage'])) { $_SESSION['strLoginMessage'] .= str_replace('::', '
', $strErrorMessage); } -$myConfigClass->getDomainData('version', $intVersion); -$myConfigClass->getDomainData('enable_common', $setEnableCommon); +if ($myConfigClass->getDomainData('version', $strVersion) === 0) { + $intVersion = (int)$strVersion; +} +if ($myConfigClass->getDomainData('enable_common', $strEnableCommon) === 0) { + $setEnableCommon = (int)$strEnableCommon; +} if (isset($preTableName)) { - if ($setEnableCommon != 0) { - $strDomainWhere = " (`$preTableName`.`config_id`=$chkDomainId OR `$preTableName`.`config_id`=0) "; + if ($setEnableCommon !== 0) { + $strDomainWhere = " (`$preTableName`.`config_id`=$chkDomainId OR `$preTableName`.`config_id`=0) "; $strDomainWhere2 = " (`config_id`=$chkDomainId OR `config_id`=0) "; } else { - $strDomainWhere = " (`$preTableName`.`config_id`=$chkDomainId) "; + $strDomainWhere = " (`$preTableName`.`config_id`=$chkDomainId) "; $strDomainWhere2 = " (`config_id`=$chkDomainId) "; } } -// Row sort variables -if ($hidSortDir == 'ASC') { +/* Row sort variables */ +if ($hidSortDir === 'ASC') { $setSortDir = 'DESC'; } else { $setSortDir = 'ASC'; } -if (isset($preContent) && ($preContent != '')) { - if ($hidSortBy == 2) { - $mastertp->setVariable('SORT_IMAGE_1', ''); +if (isset($preContent) && ($preContent !== '')) { + if ($hidSortBy === 2) { + $mastertp->setVariable('SORT_IMAGE_1'); } else { $hidSortBy = 1; - $mastertp->setVariable('SORT_IMAGE_2', ''); + $mastertp->setVariable('SORT_IMAGE_2'); } - $setSortPicture = $_SESSION['SETS']['path']['base_url']. 'images/sort_' .strtolower($hidSortDir). '.png'; - $mastertp->setVariable('SORT_DIR_' .$hidSortBy, $setSortDir); - $mastertp->setVariable('SORT_IMAGE_' .$hidSortBy, "\"$hidSortDir\""); + $setSortPicture = $_SESSION['SETS']['path']['base_url'] . 'images/sort_' . strtolower($hidSortDir) . '.png'; + $mastertp->setVariable('SORT_DIR_' . $hidSortBy, $setSortDir); + $mastertp->setVariable('SORT_IMAGE_' . $hidSortBy, "\"$hidSortDir\""); $mastertp->setVariable('SORT_DIR', $hidSortDir); $mastertp->setVariable('SORT_BY', $hidSortBy); } -// -// Set class variables -// =================== -if (isset($preContent) && ($preContent != '')) { +/* +Set class variables +*/ +if (isset($preContent) && ($preContent !== '')) { $myVisClass->myContentTpl = $conttp; - $myVisClass->intDataId = $chkListId; -} + $myVisClass->intDataId = $chkListId; +} \ No newline at end of file diff --git a/functions/prepend_content.php b/functions/prepend_content.php index d82b0f5..ff8f6f2 100644 --- a/functions/prepend_content.php +++ b/functions/prepend_content.php @@ -1,201 +1,241 @@ 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 = filter_input(INPUT_GET, 'from_line', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); -// -// Process post parameters -// ======================= -$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); -// -// 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); - } -} +/* ---------------------------------------------------------------------------- + NagiosQL +------------------------------------------------------------------------------- + (c) 2005-2022 by Martin Willisegger -// Common multi select field value + Project : NagiosQL + Component : Preprocessing script for content pages + Website : https://sourceforge.net/projects/nagiosql/ + Version : 3.5.0 + GIT Repo : https://gitlab.com/wizonet/NagiosQL +-----------------------------------------------------------------------------*/ + +use functions\MysqliDbClass; +use functions\NagConfigClass; +use functions\NagContentClass; +use functions\NagDataClass; +use functions\NagVisualClass; + +/** + * Class and variable includes + * @var NagContentClass $myContentClass NagiosQL content class + * @var NagVisualClass $myVisClass Visual content class + * @var MysqliDbClass $myDBClass MySQL database class + * @var NagConfigClass $myConfigClass NagiosQL configuration class + * @var NagDataClass $myDataClass NagiosQL data class + * @var HTML_Template_IT $mastertp Master template (list view) + * @var string $chkLimit from prepend_adm.php / settings -> Data set count per page + * @var string $preBrowser from prepend_adm.php -> Browser version + * @var string $chkGroupAdm from prepend_adm.php -> Session value group admin + * @var string $hidSortBy from prepend_adm.php -> Sort data by + * @var string $hidSortDir from prepend_adm.php -> Sort data direction (ASC, DESC) + * @var string $chkModus from prepend_adm.php -> Form work mode + * @var string $chkRegister from prepend_adm.php -> Register checkbox + * @var string $preKeyField from content file -> Table key field + * @var string $strDomainWhere from prepend_adm.php -> Domain selection SQL part with table name + * @var string $chkSelModify from prepend_adm.php -> Modification selection value + * @var string $strInfoMessage from prepend_adm.php -> Information messages + * @var string $chkSelTarDom from prepend_adm.php -> Target domain + * @var int $intVersion from prepend_adm.php -> Nagios version + * @var int $hidActive from prepend_adm.php -> (hidden) active checkbox + * @var int $chkActive from prepend_adm.php -> Active checkbox + * @var int $chkDomainId from prepend_adm.php -> Configuration domain id + * @var int $chkDataId from prepend_adm.php -> Actual dataset id + * @var int $chkListId from prepend_adm.php -> Actual dataset id (list view) + * @var int $intGlobalWriteAccess from prepend_content.php -> Global admin write access + */ +/* +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 */ +$chkTfValue3 = ''; +$chkTfValue5 = ''; +/* +Define missing variables used in this prepend file +*/ +if (!isset($preTableName)) { + /* Predefined variable table name */ + $preTableName = ''; +} +if (!isset($preSearchSession)) { + /* Predefined variable search session */ + $preSearchSession = ''; +} +/* +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; +/* +Process get parameters +*/ +$chkFromLine = filter_input(INPUT_GET, 'from_line', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); +/* +Process post parameters +*/ +$chkTfSearchRaw = filter_input(INPUT_POST, 'txtSearch'); +$chkSelAccGr = filter_input(INPUT_POST, 'selAccGr', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); +$chkSelCnfName = filter_input(INPUT_POST, 'selCnfName'); +$chkSelRegFilter = filter_input(INPUT_POST, 'selRegFilter', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); +$chkSelActiveFilter = filter_input(INPUT_POST, 'selActiveFilter', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); +/* Common text field value */ +for ($i = 1; $i <= 23; $i++) { + $tmpVar = 'chkTfValue' . $i; + $$tmpVar = filter_input(INPUT_POST, 'tfValue' . $i, FILTER_DEFAULT, FILTER_FLAG_NO_ENCODE_QUOTES); + $$tmpVar = $myVisClass->tfSecure(addslashes($$tmpVar)); +} +/* Common argument text 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; + $tmpVar = 'chkTfArg' . $i; + $$tmpVar = filter_input(INPUT_POST, 'tfArg' . $i, FILTER_UNSAFE_RAW); + $$tmpVar = $myVisClass->tfSecure(addslashes($$tmpVar)); +} +/* Common argument info field value */ +for ($i = 1; $i <= 8; $i++) { + $tmpVar = 'chkTaArg' . $i . 'Info'; + $$tmpVar = filter_input(INPUT_POST, 'taArg' . $i . 'Info', FILTER_UNSAFE_RAW); + $$tmpVar = $myVisClass->tfSecure(addslashes($$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_DEFAULT, FILTER_FORCE_ARRAY); + /* Multiselect-data processing */ + if (isset(${$tmpVar}[0])) { + if ((${$tmpVar}[0] === '') || (${$tmpVar}[0] === '0')) { + $$tmpVar2 = 0; + } elseif (${$tmpVar}[0] === '*') { + $$tmpVar2 = 2; + } else { + $$tmpVar2 = 1; + } } } -// Common select field value +/* 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))); + $tmpVar = 'chkSelValue' . $i; + $$tmpVar = filter_input(INPUT_POST, 'selValue' . $i, FILTER_VALIDATE_INT, array('options' => array('default' => 0))); } -//Common radio field value +/* 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))); + $tmpVar = 'chkRadValue' . $i; + $$tmpVar = filter_input(INPUT_POST, 'radValue' . $i, FILTER_VALIDATE_INT, array('options' => array('default' => 2))); } -// Common checkbox group +/* 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 = 'chkChbGr' . $i . $elem; + $$tmpVar = filter_input(INPUT_POST, 'chbGr' . $i . $elem); + if (isset($$tmpVar) && ($$tmpVar !== '')) { $$tmpVar .= ','; } } } -// Common button value +/* Common button value */ for ($i = 1; $i <= 5; $i++) { - $tmpVar = 'chkButValue'.$i; - $$tmpVar = filter_input(INPUT_POST, 'butValue'.$i, FILTER_SANITIZE_STRING); + $tmpVar = 'chkButValue' . $i; + $$tmpVar = filter_input(INPUT_POST, 'butValue' . $i); } -// Common text NULL field value +/* 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); + $tmpVar = 'chkTfNullVal' . $i; + $$tmpVar = filter_input(INPUT_POST, 'tfNullVal' . $i); + if (isset($$tmpVar) && ($$tmpVar !== '')) { + $$tmpVar = $myVisClass->checkNull($$tmpVar); } else { $$tmpVar = 'NULL'; } } -// Common checkbox field value +/* 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 +/* Common file selection field */ +$chkDatValue1 = filter_input(INPUT_POST, 'datValue1'); +/* 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) { - $chkTfSearchRaw = addslashes($chkTfSearchRaw); - $chkTaValue1Raw = addslashes($chkTaValue1Raw); - $chkTaFileTextRaw = addslashes($chkTaFileTextRaw); +/* Common text area value for file import (not SQL) */ +$chkTaFileTextRaw = filter_input(INPUT_POST, 'taFileText'); +/* Common text field with special chars */ +$chkTfSpValue1 = filter_input(INPUT_POST, 'tfSpValue1'); +/* +Quote special characters +*/ +$chkTfSearchRaw = addslashes($chkTfSearchRaw); +$chkTaValue1Raw = addslashes($chkTaValue1Raw); +$chkTaFileTextRaw = addslashes($chkTaFileTextRaw); +$chkTfSpValue1 = addslashes($chkTfSpValue1); +/* +Security function for text fields +*/ +$chkTfSearch = $myVisClass->tfSecure($chkTfSearchRaw); +$chkTaValue1 = $myVisClass->tfSecure($chkTaValue1Raw); +$chkTfSpValue1 = $myVisClass->tfSecure($chkTfSpValue1); +$chkTaFileText = stripslashes($chkTaFileTextRaw); +/* +Search/sort/filter - session data +*/ +if (!isset($_SESSION['search'][$preSearchSession])) { + $_SESSION['search'][$preSearchSession] = ''; } -// -// Security function for text fields -// ================================= -$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['filter'][$preSearchSession]['registered'])) { + $_SESSION['filter'][$preSearchSession]['registered'] = ''; } -if (!isset($_SESSION['search']) || !isset($_SESSION['search']['config_selection'])) { +if (!isset($_SESSION['filter'][$preSearchSession]['active'])) { + $_SESSION['filter'][$preSearchSession]['active'] = ''; +} +if (!isset($_SESSION['search']['config_selection'])) { $_SESSION['search']['config_selection'] = ''; } -if (($chkModus == 'checkform') || ($chkModus == 'filter')) { - $_SESSION['search'][$preSearchSession] = $chkTfSearch; +if (($chkModus === 'checkform') || ($chkModus === 'filter')) { + $_SESSION['search'][$preSearchSession] = $chkTfSearch; $_SESSION['search']['config_selection'] = $chkSelCnfName; + $_SESSION['filter'][$preSearchSession]['registered'] = $chkSelRegFilter; + $_SESSION['filter'][$preSearchSession]['active'] = $chkSelActiveFilter; $myContentClass->arrSession = $_SESSION; } -// -// Process additional templates/variables -// ====================================== +/* +Process additional templates/variables +*/ if (isset($_SESSION['templatedefinition']) && is_array($_SESSION['templatedefinition']) && - (count($_SESSION['templatedefinition']) != 0)) { + (count($_SESSION['templatedefinition']) !== 0)) { $intTemplates = 1; } else { $intTemplates = 0; } if (isset($_SESSION['variabledefinition']) && is_array($_SESSION['variabledefinition']) && - (count($_SESSION['variabledefinition']) != 0)) { + (count($_SESSION['variabledefinition']) !== 0)) { $intVariables = 1; } else { $intVariables = 0; } -// -// Common SQL parts -// ================ -if ($hidActive == 1) { +/* +Common SQL parts +*/ +if ($hidActive === 1) { $chkActive = 1; } -if ($chkGroupAdm == 1) { +if ((int)$chkGroupAdm === 1) { $strGroupSQL = "`access_group`=$chkSelAccGr, "; } else { $strGroupSQL = ''; } $preSQLCommon1 = "$strGroupSQL `active`='$chkActive', `register`='$chkRegister', `config_id`=$chkDomainId, " - . '`last_modified`=NOW()'; + . '`last_modified`=NOW()'; $preSQLCommon2 = "$strGroupSQL `active`='$chkActive', `register`='0', `config_id`=$chkDomainId, `last_modified`=NOW()"; $intRet1 = 0; $intRet2 = 0; @@ -205,50 +245,52 @@ $intRet5 = 0; $intRet6 = 0; $intRet7 = 0; $intRet8 = 0; -// -// Check read and write access -// =========================== +/* +Check read and write access +*/ if (isset($prePageKey)) { - // Global read access (0 = access granted) - $intGlobalReadAccess = $myVisClass->checkAccountGroup($prePageKey, 'read'); - // Global write access (0 = access granted) + /* 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; +if (!isset($preNoAccessGrp) || ($preNoAccessGrp === 0)) { + if ($chkDataId !== 0) { + /** @noinspection SqlResolve */ + $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'); + if ($chkListId !== 0) { + /** @noinspection SqlResolve */ + $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; +/* +Data processing +*/ +if (($chkModus === 'make') && ($intGlobalWriteAccess === 0)) { + $intError = 0; $intSuccess = 0; - // Get write access groups + /* 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'"; + /* Write configuration file */ + if ($preTableName === 'tbl_host') { + /** @noinspection SqlResolve */ + $strSQL = "SELECT `id` FROM `$preTableName` " + . "WHERE $strDomainWhere AND `access_group` IN ($strAccess) AND `active`='1'"; $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); - if ($booReturn == false) { + if ($booReturn === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($booReturn && ($intDataCount != 0)) { + if ($booReturn && ($intDataCount !== 0)) { foreach ($arrData as $data) { $intReturn = $myConfigClass->createConfigSingle($preTableName, $data['id']); - if ($intReturn == 1) { + if ($intReturn === 1) { $intError++; $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } else { @@ -257,28 +299,28 @@ if (($chkModus == 'make') && ($intGlobalWriteAccess == 0)) { } } else { $myVisClass->processMessage(translate('Some configuration files were not written. Dataset not activated, ' - . 'not found or you do not have write permission!'), $strErrorMessage); + . 'not found or you do not have write permission!'), $strErrorMessage); } - if ($intSuccess != 0) { + if ($intSuccess !== 0) { $myVisClass->processMessage(translate('Configuration files successfully written!'), $strInfoMessage); } - if ($intError != 0) { + 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); + . '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) { + } elseif ($preTableName === 'tbl_service') { + /** @noinspection SqlResolve */ + $strSQL = "SELECT `id`, `$preKeyField` FROM `$preTableName` " + . "WHERE $strDomainWhere AND `access_group` IN ($strAccess) AND `active`='1' " + . "GROUP BY `$preKeyField`, `id`"; + $booReturn = $myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); + if ($booReturn === false) { $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); } - if ($booReturn && ($intDataCount != 0)) { + if ($booReturn && ($intDataCount !== 0)) { foreach ($arrData as $data) { $intReturn = $myConfigClass->createConfigSingle($preTableName, $data['id']); - if ($intReturn == 1) { + if ($intReturn === 1) { $intError++; $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } else { @@ -287,212 +329,215 @@ if (($chkModus == 'make') && ($intGlobalWriteAccess == 0)) { } } else { $myVisClass->processMessage(translate('Some configuration files were not written. Dataset not activated, ' - . 'not found or you do not have write permission!'), $strErrorMessage); + . 'not found or you do not have write permission!'), $strErrorMessage); } - if ($intSuccess != 0) { + if ($intSuccess !== 0) { $myVisClass->processMessage(translate('Configuration files successfully written!'), $strInfoMessage); } - if ($intError != 0) { + 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); + . 'not found or you do not have write permission!'), $strErrorMessage); } } else { - $intReturn = $myConfigClass->createConfig($preTableName, 0); - if ($intReturn == 1) { + $intReturn = $myConfigClass->createConfig($preTableName); + if ($intReturn === 1) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } - if ($intReturn == 0) { + if ($intReturn === 0) { $myVisClass->processMessage($myConfigClass->strInfoMessage, $strInfoMessage); } } - $chkModus = 'display'; -} elseif (($chkModus == 'checkform') && ($chkSelModify == 'info')) { - // Display additional relation information - if ($preTableName == 'tbl_service') { + $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)) { + $chkModus = 'display'; +} elseif (($chkModus === 'checkform') && ($chkSelModify === 'delete') && ($intGlobalWriteAccess === 0)) { $intReturn = 1; - // Delete selected datasets - if (($preTableName == 'tbl_user') && ($chkTfValue5 == 'Admin')) { + /* 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')) { + } 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')) { + } elseif (($preTableName === 'tbl_user') || ($preTableName === 'tbl_datadomain') || + ($preTableName === 'tbl_configtarget')) { $intReturn = $myDataClass->dataDeleteEasy($preTableName, $chkListId); } else { $strInfoMessageTmp = $strInfoMessage; - if ($preTableName == 'tbl_service') { + if ($preTableName === 'tbl_service') { $intRetVal = $myDataClass->infoRelation($preTableName, $chkListId, "$preKeyField,service_description"); } else { $intRetVal = $myDataClass->infoRelation($preTableName, $chkListId, $preKeyField); } - if ($intRetVal == 0) { + 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 + $chkModus = 'display'; +} elseif (($chkModus === 'checkform') && ($chkSelModify === 'copy') && ($intGlobalWriteAccess === 0)) { + /* Copy selected datasets */ $intReturn = $myDataClass->dataCopyEasy($preTableName, $preKeyField, $chkListId, $chkSelTarDom); - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intReturn == 0) { + if ($intReturn === 0) { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); } $chkModus = 'display'; -} elseif (($chkModus == 'checkform') && ($chkSelModify == 'activate') && ($intGlobalWriteAccess == 0)) { - // Activate selected datasets +} elseif (($chkModus === 'checkform') && ($chkSelModify === 'activate') && ($intGlobalWriteAccess === 0)) { + /* Activate selected datasets */ $intReturn = $myDataClass->dataActivate($preTableName, $chkListId); - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intReturn == 0) { + if ($intReturn === 0) { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); } - $chkModus = 'display'; -} elseif (($chkModus == 'checkform') && ($chkSelModify == 'deactivate') && ($intGlobalWriteAccess == 0)) { - // Deactivate selected datasets + $chkModus = 'display'; +} elseif (($chkModus === 'checkform') && ($chkSelModify === 'deactivate') && ($intGlobalWriteAccess === 0)) { + /* Deactivate selected datasets */ $intReturn = $myDataClass->dataDeactivate($preTableName, $chkListId); - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } - if ($intReturn == 0) { + if ($intReturn === 0) { $myVisClass->processMessage($myDataClass->strInfoMessage, $strInfoMessage); } - // Remove deactivated files - if ($preTableName == 'tbl_host') { - if ($chkListId != 0) { - $strChbName = 'chbId_' .$chkListId; + /* Remove deactivated files */ + if ($preTableName === 'tbl_host') { + if ($chkListId !== 0) { + $strChbName = 'chbId_' . $chkListId; $_POST[$strChbName] = 'on'; } - // Get write access groups + /* 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; + /* Getting data sets */ + /** @noinspection SqlResolve */ + $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)) { + $intCount = 0; + if (is_array($arrConfigID) && ((int)$arrConfigID[0] !== 0)) { 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; + $strChbName = 'chbId_' . $elem['id']; + /* was the current record is marked for deactivate? */ + if ((filter_input(INPUT_POST, $strChbName) === 'on')) { $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'] + $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) { + if ($intReturn === 0) { $intSuccess++; } - if ($intReturn != 0) { + if ($intReturn !== 0) { $intError++; } } } - if (($intSuccess != 0) && ($intCount != 0)) { + if (($intSuccess !== 0) && ($intCount !== 0)) { $myVisClass->processMessage(translate('The assigned, no longer used configuration files were ' - . 'deleted successfully!').$intCount, $strInfoMessage); + . 'deleted successfully!') . $intCount, $strInfoMessage); } - if ($intError != 0) { + if ($intError !== 0) { $myVisClass->processMessage(translate('Errors while deleting the old configuration file - please ' - . 'check!:'), $strErrorMessage); + . 'check!:'), $strErrorMessage); } } - } elseif ($chkDomainId == 0) { + } elseif ($chkDomainId === 0) { $myVisClass->processMessage(translate('Common files cannot be removed from target systems - please check ' - . 'manually'), $strErrorMessage); + . 'manually'), $strErrorMessage); } - } elseif ($preTableName == 'tbl_service') { - if ($chkListId != 0) { - $strChbName = 'chbId_' .$chkListId; + } elseif ($preTableName === 'tbl_service') { + if ($chkListId !== 0) { + $strChbName = 'chbId_' . $chkListId; $_POST[$strChbName] = 'on'; } - // Get write access groups + /* 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; + /* Getting data sets */ + /** @noinspection SqlResolve */ + $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; + if ($booReturn && ($intDataCount !== 0) && ($chkDomainId !== 0)) { + $intReturn = $myConfigClass->getConfigTargets($arrConfigID); + $intError = 0; $intSuccess = 0; - if (($arrConfigID != 1) && is_array($arrConfigID)) { - $intCount = 0; + if (is_array($arrConfigID) && ((int)$arrConfigID[0] !== 0)) { + $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')) { + $strChbName = 'chbId_' . $elem['id']; + /* was the current record is marked for deactivate? */ + if (filter_input(INPUT_POST, $strChbName) === 'on') { + /** @noinspection SqlResolve */ $intServiceCount = $myDBClass->countRows("SELECT * FROM `$preTableName` " - . "WHERE `$preKeyField`='".$elem['config_name']."' " - . "AND `config_id`=$chkDomainId AND `active`='1'"); - if ($intServiceCount == 0) { + . "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', + $elem['config_name'] . '.cfg', $intConfigID ); - if ($intReturn == 0) { - $myDataClass->writeLog(translate('Service file deleted:'). ' ' . - $elem['config_name']. '.cfg'); + if ($intReturn === 0) { + $myDataClass->writeLog(translate('Service file deleted:') . ' ' . + $elem['config_name'] . '.cfg'); } $intCount++; } - if ($intReturn == 0) { + if ($intReturn === 0) { $intSuccess++; } - if ($intReturn != 0) { + if ($intReturn !== 0) { $intError++; } } } } - if (($intSuccess != 0) && ($intCount != 0)) { + if (($intSuccess !== 0) && ($intCount !== 0)) { $myVisClass->processMessage(translate('The assigned, no longer used configuration files were ' - . 'deleted successfully!'), $strInfoMessage); + . 'deleted successfully!'), $strInfoMessage); } - if ($intError != 0) { + if ($intError !== 0) { $myVisClass->processMessage(translate('Errors while deleting the old configuration file - please ' - . 'check!:'), $strErrorMessage); + . 'check!:'), $strErrorMessage); } } - } elseif ($chkDomainId == 0) { + } elseif ($chkDomainId === 0) { $myVisClass->processMessage(translate('Common files cannot be removed from target systems - please check ' - . 'manually'), $strErrorMessage); + . 'manually'), $strErrorMessage); } } - $chkModus = 'display'; -} elseif (($chkModus == 'checkform') && ($chkSelModify == 'modify')) { - // Open the dataset to modify - if ($intReadAccessId == 0) { + $chkModus = 'display'; +} elseif (($chkModus === 'checkform') && ($chkSelModify === 'modify')) { + /* Open the dataset to modify */ + if ($intReadAccessId === 0) { + /** @noinspection SqlResolve */ $booReturn = $myDBClass->hasSingleDataset("SELECT * FROM `$preTableName` " - . 'WHERE `id`=' .$chkListId, $arrModifyData); - if ($booReturn == false) { + . 'WHERE `id`=' . $chkListId, $arrModifyData); + if ($booReturn === false) { $myVisClass->processMessage(translate('Error while selecting data from database:'), $strErrorMessage); $myVisClass->processMessage($myDBClass->strErrorMessage, $strErrorMessage); $chkModus = 'display'; @@ -503,15 +548,15 @@ if (($chkModus == 'make') && ($intGlobalWriteAccess == 0)) { $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)) { +} 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') { + if ($elem === 'on') { $intValCount++; } } @@ -519,22 +564,21 @@ if (($chkModus == 'make') && ($intGlobalWriteAccess == 0)) { $intDSId = 0; } $intReturn = $myConfigClass->createConfigSingle($preTableName, $intDSId); - if ($intReturn == 1) { + if ($intReturn === 1) { $myVisClass->processMessage($myConfigClass->strErrorMessage, $strErrorMessage); } - if ($intReturn == 0) { + if ($intReturn === 0) { $myVisClass->processMessage($myConfigClass->strInfoMessage, $strInfoMessage); } - $chkModus = 'display'; + $chkModus = 'display'; } -// -// Some common list view functions -// =============================== -if ($chkModus != 'add') { - // Get Group id's with READ +/* +Some common list view functions +*/ +if ($chkModus !== 'add') { + /* Get Group id's with READ */ $strAccess = $myVisClass->getAccessGroups('read'); - // Include domain list - /** @var HTML_Template_IT $mastertp */ + /* Include domain list */ $myVisClass->insertDomainList($mastertp); - // Process filter string -} + /* Process filter string */ +} \ No newline at end of file diff --git a/functions/prepend_scripting.php b/functions/prepend_scripting.php index f7d3138..a0a53a5 100644 --- a/functions/prepend_scripting.php +++ b/functions/prepend_scripting.php @@ -1,77 +1,76 @@ =PHP5.1) -// ============================ + +/* +Timezone settings +*/ if (function_exists('date_default_timezone_set') and function_exists('date_default_timezone_get')) { @date_default_timezone_set(@date_default_timezone_get()); } -// -// Define common variables -// ======================= -$chkDomainId = 0; -$intError = 0; -// -// Define path constants -// -//define('BASE_PATH', str_replace("functions", "", dirname(__FILE__))); -// -// Read settings file -// ================== + +/* +Define common variables +*/ +$chkDomainId = 0; +$intError = 0; + +/* +Read settings file +*/ $preBasePath = str_replace('functions', '', __DIR__); -$preIniFile = $preBasePath.'config/settings.php'; -// -// Read file settings -// ================== +$preIniFile = $preBasePath . 'config/settings.php'; + +/* +Read file settings +*/ $SETS = parse_ini_file($preIniFile, true); -// -// Include external function/class files - part 1 -// ============================================== -require $preBasePath.'functions/Autoloader.php'; + +/* +Include external function/class files - part 1 +*/ +require_once $preBasePath . 'libraries/pear/HTML/Template/IT.php'; +require $preBasePath . 'functions/Autoloader.php'; functions\Autoloader::register($preBasePath); -// -// Initialize classes - part 1 -// =========================== -$myDBClass = new functions\MysqliDbClass(); + +/* +Initialize classes - part 1 +*/ +$myDBClass = new functions\MysqliDbClass(); $myDBClass->arrParams = $SETS['db']; $myDBClass->hasDBConnection(); -if ($myDBClass->error == true) { +if ($myDBClass->error === true) { $strDBMessage = $myDBClass->strErrorMessage; - $booError = $myDBClass->error; + $booError = $myDBClass->error; } -// -// Get additional configuration from the table tbl_settings -// ======================================================== -if ($intError == 0) { - $strSQL = 'SELECT `category`,`name`,`value` FROM `tbl_settings`'; + +/* +Get additional configuration from the table tbl_settings +*/ +if ($intError === 0) { + $strSQL = 'SELECT `category`,`name`,`value` FROM `tbl_settings`'; $booReturn = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - if ($booReturn == false) { - echo str_replace('::', "\n", 'Error while selecting data from database: ' .$myDBClass->strErrorMessage); - $intError = 1; - } elseif ($intDataCount != 0) { - for ($i=0; $i<$intDataCount; $i++) { + if ($booReturn === false) { + echo str_replace('::', "\n", 'Error while selecting data from database: ' . $myDBClass->strErrorMessage); + $intError = 1; + } elseif ($intDataCount !== 0) { + for ($i = 0; $i < $intDataCount; $i++) { $SETS[$arrDataLines[$i]['category']][$arrDataLines[$i]['name']] = $arrDataLines[$i]['value']; } } @@ -79,25 +78,29 @@ if ($intError == 0) { echo "Could not load configuration settings from database - abort\n"; exit; } -// -// Include external function/class files -// ===================================== + +/* +Include translator strings +*/ include 'translator.php'; -// -// Initialize classes -// ================== -$arrSession = array(); + +/* +Initialize classes +*/ +$arrSession = array(); $arrSession['SETS'] = $SETS; -$myDataClass = new functions\NagDataClass($arrSession); -$myConfigClass = new functions\NagConfigClass($arrSession); -$myImportClass = new functions\NagImportClass($arrSession); -// -// Propagating the classes themselves -// ================================== -$myDataClass->myDBClass =& $myDBClass; -$myDataClass->myConfigClass =& $myConfigClass; -$myConfigClass->myDBClass =& $myDBClass; -$myConfigClass->myDataClass =& $myDataClass; -$myImportClass->myDataClass =& $myDataClass; -$myImportClass->myDBClass =& $myDBClass; -$myImportClass->myConfigClass =& $myConfigClass; +$myDataClass = new functions\NagDataClass($arrSession); +$myConfigClass = new functions\NagConfigClass($arrSession); +/** @noinspection PhpObjectFieldsAreOnlyWrittenInspection */ +$myImportClass = new functions\NagImportClass($arrSession); + +/* +Propagating the classes themselves +*/ +$myDataClass->myDBClass =& $myDBClass; +$myDataClass->myConfigClass =& $myConfigClass; +$myConfigClass->myDBClass =& $myDBClass; +$myConfigClass->myDataClass =& $myDataClass; +$myImportClass->myDataClass =& $myDataClass; +$myImportClass->myDBClass =& $myDBClass; +$myImportClass->myConfigClass =& $myConfigClass; \ No newline at end of file diff --git a/functions/translator.php b/functions/translator.php index 9f5b372..d9fc947 100644 --- a/functions/translator.php +++ b/functions/translator.php @@ -1,42 +1,35 @@ $languagename) { - if ($languagetosearch == $languagename['description']) { - $strReturn = $key2; + $arrLangDetail = getLanguageData(); + foreach ($arrLangDetail as $key => $elem) { + if ($strLangSearch === $elem['description']) { + $strReturn = $key; } } - // else return default en code return $strReturn; } @@ -46,7 +39,7 @@ function getLanguageNameFromCode($codetosearch, $withnative = true) $detaillanguages = getLanguageData(); if (isset($detaillanguages[$codetosearch]['description'])) { if ($withnative) { - $strReturn = $detaillanguages[$codetosearch]['description'].' - '. + $strReturn = $detaillanguages[$codetosearch]['description'] . ' - ' . $detaillanguages[$codetosearch]['nativedescription']; } else { $strReturn = $detaillanguages[$codetosearch]['description']; @@ -58,206 +51,56 @@ function getLanguageNameFromCode($codetosearch, $withnative = true) function getLanguageData() { - unset($supportedLanguages); - // English - $supportedLanguages['en_GB']['description'] = translate('English'); - $supportedLanguages['en_GB']['nativedescription'] = 'English'; + unset($arrLangSupported); + /* English */ + $arrLangSupported['en_GB']['description'] = translate('English'); + $arrLangSupported['en_GB']['nativedescription'] = 'English'; - // German - $supportedLanguages['de_DE']['description'] = translate('German'); - $supportedLanguages['de_DE']['nativedescription'] = 'Deutsch'; + /* German */ + $arrLangSupported['de_DE']['description'] = translate('German'); + $arrLangSupported['de_DE']['nativedescription'] = 'Deutsch'; - // Chinese (Simplified) - $supportedLanguages['zh_CN']['description'] = translate('Chinese (Simplified)'); - $supportedLanguages['zh_CN']['nativedescription'] = '简体中文'; + /* Chinese (Simplified) */ + $arrLangSupported['zh_CN']['description'] = translate('Chinese (Simplified)'); + $arrLangSupported['zh_CN']['nativedescription'] = '简体中文'; - // Italian - $supportedLanguages['it_IT']['description'] = translate('Italian'); - $supportedLanguages['it_IT']['nativedescription'] = 'Italiano'; + /* Italian */ + $arrLangSupported['it_IT']['description'] = translate('Italian'); + $arrLangSupported['it_IT']['nativedescription'] = 'Italiano'; - // French - $supportedLanguages['fr_FR']['description'] = translate('French'); - $supportedLanguages['fr_FR']['nativedescription'] = 'Français'; + /* French */ + $arrLangSupported['fr_FR']['description'] = translate('French'); + $arrLangSupported['fr_FR']['nativedescription'] = 'Français'; - // Russian - $supportedLanguages['ru_RU']['description'] = translate('Russian'); - $supportedLanguages['ru_RU']['nativedescription'] = 'Русский'; + /* Russian */ + $arrLangSupported['ru_RU']['description'] = translate('Russian'); + $arrLangSupported['ru_RU']['nativedescription'] = 'Русский'; - // Spanish - $supportedLanguages['es_ES']['description'] = translate('Spanish'); - $supportedLanguages['es_ES']['nativedescription'] = 'Español'; + /* Spanish */ + $arrLangSupported['es_ES']['description'] = translate('Spanish'); + $arrLangSupported['es_ES']['nativedescription'] = 'Español'; - // Brazilian Portuguese - $supportedLanguages['pt_BR']['description'] = translate('Portuguese (Brazilian)'); - $supportedLanguages['pt_BR']['nativedescription'] = 'Português do Brasil'; + /* Brazilian Portuguese */ + $arrLangSupported['pt_BR']['description'] = translate('Portuguese (Brazilian)'); + $arrLangSupported['pt_BR']['nativedescription'] = 'Português do Brasil'; - // Dutch - $supportedLanguages['nl_NL']['description'] = translate('Dutch'); - $supportedLanguages['nl_NL']['nativedescription'] = 'Nederlands'; + /* Dutch */ + $arrLangSupported['nl_NL']['description'] = translate('Dutch'); + $arrLangSupported['nl_NL']['nativedescription'] = 'Nederlands'; - // Danish - $supportedLanguages['da_DK']['description'] = translate('Danish'); - $supportedLanguages['da_DK']['nativedescription'] = 'Dansk'; - - // No longer supported language because of missing translators - // - // // Japanese - // $supportedLanguages['ja_JP']['description'] = translate('Japanese'); - // $supportedLanguages['ja_JP']['nativedescription'] = '日本語'; - // - // // Polish - // $supportedLanguages['pl_PL']['description'] = translate('Polish'); - // $supportedLanguages['pl_PL']['nativedescription'] = 'Polski'; - // - // // Spanish (Argentina) - // $supportedLanguages['es_AR']['description'] = translate('Spanish (Argentina)'); - // $supportedLanguages['es_AR']['nativedescription'] = 'Español Argentina'; - /// - /// Currently not supported languages - // - // // Albanian - // $supportedLanguages['sq']['description'] = $clang->translate('Albanian'); - // $supportedLanguages['sq']['nativedescription'] = 'Shqipe'; - // - // // Basque - // $supportedLanguages['eu']['description'] = translate('Basque'); - // $supportedLanguages['eu']['nativedescription'] = 'Euskara'; - // - // // Bosnian - // $supportedLanguages['bs']['description'] = translate('Bosnian'); - // $supportedLanguages['bs']['nativedescription'] = - // 'Български'; - // - // // Bulgarian - // $supportedLanguages['bg']['description'] = translate('Bulgarian'); - // $supportedLanguages['bg']['nativedescription'] = - // 'Български'; - // - // // Catalan - // $supportedLanguages['ca']['description'] = translate('Catalan'); - // $supportedLanguages['ca']['nativedescription'] = 'Catalά'; - // - // // Welsh - // $supportedLanguages['cy']['description'] = translate('Welsh'); - // $supportedLanguages['cy']['nativedescription'] = 'Cymraeg'; - // - // // Chinese (Traditional - Hong Kong) - // $supportedLanguages['zh-Hant-HK']['description'] = translate('Chinese (Traditional - Hong Kong)'); - // $supportedLanguages['zh-Hant-HK']['nativedescription'] = '繁體中文語系'; - // - // // Chinese (Traditional - Taiwan) - // $supportedLanguages['zh-Hant-TW']['description'] = translate('Chinese (Traditional - Taiwan)'); - // $supportedLanguages['zh-Hant-TW']['nativedescription'] = 'Chinese (Traditional - Taiwan)'; - // - // // Croatian - // $supportedLanguages['hr']['description'] = translate('Croatian'); - // $supportedLanguages['hr']['nativedescription'] = 'Hrvatski'; - // - // // Czech - // $supportedLanguages['cs']['description'] = translate('Czech'); - // $supportedLanguages['cs']['nativedescription'] = 'Česky'; - // - // - // // Estonian - // $supportedLanguages['et']['description'] = translate('Estonian'); - // $supportedLanguages['et']['nativedescription'] = 'Eesti'; - // - // // Finnish - // $supportedLanguages['fi']['description'] = translate('Finnish'); - // $supportedLanguages['fi']['nativedescription'] = 'Suomi'; - // - // // Galician - // $supportedLanguages['gl']['description'] = translate('Galician'); - // $supportedLanguages['gl']['nativedescription'] = 'Galego'; - // - // // German informal - // $supportedLanguages['de-informal']['description'] = translate('German informal'); - // $supportedLanguages['de-informal']['nativedescription'] = 'Deutsch (Du)'; - // - // // Greek - // $supportedLanguages['el']['description'] = translate('Greek'); - // $supportedLanguages['el']['nativedescription'] = 'ελληνικά'; - // - // // Hebrew - // $supportedLanguages['he']['description'] = translate('Hebrew'); - // $supportedLanguages['he']['nativedescription'] = ' עברית'; - // - // // Hungarian - // $supportedLanguages['hu']['description'] = translate('Hungarian'); - // $supportedLanguages['hu']['nativedescription'] = 'Magyar'; - // - // // Indonesian - // $supportedLanguages['id']['description'] = translate('Indonesian'); - // $supportedLanguages['id']['nativedescription'] = 'Bahasa Indonesia'; - // - // - // // Lithuanian - // $supportedLanguages['lt']['description'] = translate('Lithuanian'); - // $supportedLanguages['lt']['nativedescription'] = 'Lietuvių'; - // - // // Macedonian - // $supportedLanguages['mk']['description'] = translate('Macedonian'); - // $supportedLanguages['mk']['nativedescription'] = - // 'Македонски'; - // - // // Norwegian Bokml - // $supportedLanguages['nb']['description'] = translate('Norwegian (Bokmal)'); - // $supportedLanguages['nb']['nativedescription'] = 'Norsk Bokmål'; - // - // // Norwegian Nynorsk - // $supportedLanguages['nn']['description'] = translate('Norwegian (Nynorsk)'); - // $supportedLanguages['nn']['nativedescription'] = 'Norsk Nynorsk'; - // - // // Portuguese - // $supportedLanguages['pt']['description'] = translate('Portuguese'); - // $supportedLanguages['pt']['nativedescription'] = 'Português'; - // - // // Romanian - // $supportedLanguages['ro']['description'] = translate('Romanian'); - // $supportedLanguages['ro']['nativedescription'] = 'Românesc'; - // - // // Slovak - // $supportedLanguages['sk']['description'] = translate('Slovak'); - // $supportedLanguages['sk']['nativedescription'] = 'Slovák'; - // - // // Slovenian - // $supportedLanguages['sl']['description'] = translate('Slovenian'); - // $supportedLanguages['sl']['nativedescription'] = 'Slovenščina'; - // - // // Serbian - // $supportedLanguages['sr']['description'] = translate('Serbian'); - // $supportedLanguages['sr']['nativedescription'] = 'Srpski'; - // - // // Spanish (Mexico) - // $supportedLanguages['es-MX']['description'] = translate('Spanish (Mexico)'); - // $supportedLanguages['es-MX']['nativedescription'] = 'Español Mejicano'; - // - // // Swedish - // $supportedLanguages['sv']['description'] = translate('Swedish'); - // $supportedLanguages['sv']['nativedescription'] = 'Svenska'; - // - // // Turkish - // $supportedLanguages['tr']['description'] = translate('Turkish'); - // $supportedLanguages['tr']['nativedescription'] = 'Türkçe'; - // - // // Thai - // $supportedLanguages['th']['description'] = translate('Thai'); - // $supportedLanguages['th']['nativedescription'] = 'ภาษาไทย'; - // - // // Vietnamese - // $supportedLanguages['vi']['description'] = translate('Vietnamese'); - // $supportedLanguages['vi']['nativedescription'] = 'Tiếng Việt'; + /* Danish */ + $arrLangSupported['da_DK']['description'] = translate('Danish'); + $arrLangSupported['da_DK']['nativedescription'] = 'Dansk'; - uasort($supportedLanguages, 'user_sort'); - return $supportedLanguages; + uasort($arrLangSupported, 'user_sort'); + return $arrLangSupported; } -function user_sort($intValue1, $intValue2) +function user_sort($intValue1, $intValue2): int { $intReturn = -1; - // smarts is all-important, so sort it first if ($intValue1['description'] > $intValue2['description']) { $intReturn = 1; } return $intReturn; -} +} \ No newline at end of file diff --git a/index.php b/index.php index 5f71c72..e0251df 100644 --- a/index.php +++ b/index.php @@ -1,49 +1,51 @@ Application version string + */ +/* +Path settings +*/ +$preRelPath = strstr(filter_input(INPUT_SERVER, 'PHP_SELF'), 'index.php', true); +$preBasePath = strstr(filter_input(INPUT_SERVER, 'SCRIPT_FILENAME'), 'index.php', true); +/* +Destroy old session data +*/ session_start(); session_destroy(); -// -// Define common variables -// ======================= -$intPageID = 0; +/* +Define common variables +*/ +$intPageID = 0; $preContent = 'index.htm.tpl'; -// -// Redirect to installation wizard -// =============================== -if (PHP_VERSION_ID < 50300) { +/* +Redirect to installation wizard +*/ +if (PHP_VERSION_ID < 70200) { header('Location: install/index.php'); } -// -// Include preprocessing file -// ========================== -$preAccess = 0; +/* +Include preprocessing file +*/ +$preAccess = 0; $preFieldvars = 0; -require $preBasePath.'functions/prepend_adm.php'; -// -// Include Content -// =============== +require 'functions/prepend_adm.php'; +/* +Include Content +*/ $conttp->setVariable('TITLE', translate('Welcome to')); $conttp->setVariable('TITLE_LOGIN', translate('Welcome')); $conttp->setVariable('LOGIN_TEXT', translate('Please enter your username and password to access NagiosQL.
If ' @@ -51,19 +53,19 @@ $conttp->setVariable('LOGIN_TEXT', translate('Please enter your username and pas $conttp->setVariable('USERNAME', translate('Username')); $conttp->setVariable('PASSWORD', translate('Password')); $conttp->setVariable('LOGIN', translate('Login')); -if (isset($_SESSION['strLoginMessage']) && ($_SESSION['strLoginMessage'] != '')) { +if (isset($_SESSION['strLoginMessage']) && ($_SESSION['strLoginMessage'] !== '')) { $conttp->setVariable('MESSAGE', $_SESSION['strLoginMessage']); } else { $conttp->setVariable('MESSAGE', ' '); } -$conttp->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING)); +$conttp->setVariable('ACTION_INSERT', filter_input(INPUT_SERVER, 'PHP_SELF')); $conttp->setVariable('IMAGE_PATH', 'images/'); $conttp->parse('main'); $conttp->show('main'); -// -// Include footer -// ============== +/* +Include footer +*/ $maintp->setVariable('VERSION_INFO', "NagiosQL $setFileVersion"); $maintp->parse('footer'); -$maintp->show('footer'); +$maintp->show('footer'); \ No newline at end of file diff --git a/install/css/install.css b/install/css/install.css index accd66a..f6e027d 100644 --- a/install/css/install.css +++ b/install/css/install.css @@ -1,7 +1,6 @@ @charset "utf-8"; /********************************************** -/* CSS for Installation Wizard ************** - +/* CSS for Installation Wizard /********************************************** /* /* NagiosQL @@ -11,7 +10,7 @@ /* Project : NagiosQL /* Component : Installer CSS /* Website : https://sourceforge.net/projects/nagiosql/ -/* Version : 3.4.0 +/* Version : 3.5.0 /* GIT Repo : https://gitlab.com/wizonet/NagiosQL /* /**********************************************/ @@ -20,79 +19,80 @@ /* Body CSS /**********************************************/ body { - background: #7fadd4 url(../images/body_background.png) repeat-x fixed left top; - font-family: Arial, Helvetica, sans-serif; - font-size: 12px; - padding: 10px; - } + background: #7fadd4 url(../images/body_background.png) repeat-x fixed left top; + font-family: Arial, Helvetica, sans-serif; + font-size: 12px; + padding: 10px; +} /**********************************************/ /* Page Common CSS /**********************************************/ #page { - border: 5px solid #053056; - background: #FFFFFF; - } + border: 5px solid #053056; + background: #FFFFFF; +} #page_margins { - min-width: 740px; - max-width: 80em; - margin: 0 auto; - border: 0 #889 solid; - text-align:left; - } + min-width: 740px; + max-width: 80em; + margin: 0 auto; + border: 0 #889 solid; + text-align: left; +} #header, #main, #footer { - clear:both; - } + clear: both; +} #header { - background: #FFFFFF url(../images/background.png) repeat-x left top; - position: relative; - padding: 5px; - text-align: center; - height: 120px; - } + background: #FFFFFF url(../images/background.png) repeat-x left top; + position: relative; + padding: 5px; + text-align: center; + height: 120px; +} #main { - background: #fff; - padding:10px 0; - } + background: #fff; + padding: 10px 0; +} #footer { - color:#666; - background: #f9f9f9; - padding: 15px; - text-align: center; - border-top: 5px #efefef solid; - } + color: #666; + background: #f9f9f9; + padding: 15px; + text-align: center; + border-top: 5px #efefef solid; +} /**********************************************/ /* Page Custom CSS /**********************************************/ #header-logo { - background: transparent; - position: absolute; - text-align: center; - top: 30px; - left: 70px; - } + background: transparent; + position: absolute; + text-align: center; + top: 30px; + left: 70px; +} #documentation { - position:absolute; - left: 320px; - text-align:right; - top: 56px; - } - + position: absolute; + left: 320px; + text-align: right; + top: 56px; +} + #langselector { - position:absolute; - left: 650px; - text-align:right; - top: 50px; - } + position: absolute; + left: 650px; + text-align: right; + top: 50px; +} + /**********************************************/ /* Step Rows /**********************************************/ @@ -100,267 +100,273 @@ body { /* Installer Menu */ #installmenu { - width: 20%; - z-index: 3; - float: left; - } + width: 20%; + z-index: 3; + float: left; +} - #installmenu_content { +#installmenu_content { padding: 10px 10px 10px 20px; z-index: 4; - } +} .step1_active { - background: url(../images/step1_active.png) no-repeat; - height: 75px; - width: 150px; - color: #FFFFFF; - text-align: center; - font-weight: bold; - padding: 0 0 0 0; - } - - .step1_active a, - .step1_active a:hover, - .step3_active a, - .step3_active a:hover, - .step2_active a, - .step2_active a:hover { - color: #FFFFFF; - } + background: url(../images/step1_active.png) no-repeat; + height: 75px; + width: 150px; + color: #FFFFFF; + text-align: center; + font-weight: bold; + padding: 0 0 0 0; +} + +.step1_active a, +.step1_active a:hover, +.step3_active a, +.step3_active a:hover, +.step2_active a, +.step2_active a:hover { + color: #FFFFFF; +} .step2_active { - background: url(../images/step2_active.png) no-repeat; - height: 75px; - width: 150px; - color: #FFFFFF; - text-align: center; - font-weight: bold; - padding: 0 0 0 0; - } + background: url(../images/step2_active.png) no-repeat; + height: 75px; + width: 150px; + color: #FFFFFF; + text-align: center; + font-weight: bold; + padding: 0 0 0 0; +} + +.step3_active { + background: url(../images/step3_active.png) no-repeat; + height: 75px; + width: 150px; + color: #FFFFFF; + text-align: center; + font-weight: bold; + padding: 0 0 0 0; +} - .step3_active { - background: url(../images/step3_active.png) no-repeat; - height: 75px; - width: 150px; - color: #FFFFFF; - text-align: center; - font-weight: bold; - padding: 0 0 0 0; - } - .textmiddle { - vertical-align:middle; -} + vertical-align: middle; +} #installmain { - margin-left: 20%; - margin-right: 0; - z-index: 1; - } + margin-left: 20%; + margin-right: 0; + z-index: 1; +} - #installmain_content { +#installmain_content { padding: 10px 20px 10px 10px; z-index: 2; - } - +} + #install-next { - float: right; - text-align: center; - } - + float: right; + text-align: center; +} + #install-back { - float: left; - text-align: center; - } + float: left; + text-align: center; +} /*noinspection CssUnusedSymbol*/ #install-center { - padding-left: 240px; - } + padding-left: 240px; +} - .button-update { - float: right; - width:100px; - padding: 5px; - } +.button-update { + float: right; + width: 100px; + padding: 5px; +} /* Index */ #indexmain { - z-index: 1; - } + z-index: 1; +} - #indexmain_content { +#indexmain_content { padding: 0 20px 10px 10px; z-index: 2; - } +} #installmain_content, #installmenu_content, #indexmain_content { - position: relative; - } + position: relative; +} /* Hyperlinks */ A { - text-decoration: none; - font-weight: bold; - color: #0c4271; - } + text-decoration: none; + font-weight: bold; + color: #0c4271; +} A:hover { - text-decoration: underline; - font-weight: bold; - color: #0c4271; - } + text-decoration: underline; + font-weight: bold; + color: #0c4271; +} /* Headlines */ -h1,h2,h3 { - color: #0c4271; - } +h1, h2, h3 { + color: #0c4271; +} h1 { - text-align: center; - font-size: 22px; - } + text-align: center; + font-size: 22px; +} h2 { - font-size: 14px; - color: #1962a2; - } + font-size: 14px; + color: #1962a2; +} h3 { - font-size: 14px; - font-style:italic; - } + font-size: 14px; + font-style: italic; +} /* Index Headlines */ .index-install { - padding: 10px 0 0 28px; - height: 25px; - background: url(../images/index-install.png) no-repeat left top; - margin: 10px 0 0 0; + padding: 10px 0 0 28px; + height: 25px; + background: url(../images/index-install.png) no-repeat left top; + margin: 10px 0 0 0; } .index-update { - padding: 10px 0 0 28px; - height: 25px; - background: url(../images/index-update.png) no-repeat left top; + padding: 10px 0 0 28px; + height: 25px; + background: url(../images/index-update.png) no-repeat left top; } /* Specials */ .attention { - color: #CC0000; - font-weight: bold; - } + color: #CC0000; + font-weight: bold; +} .red { - font-weight:bold; - color:#FF0000 - } + font-weight: bold; + color: #FF0000 +} + .green { - font-weight:bold; - color:#006600; - } + font-weight: bold; + color: #006600; +} .yellow { - font-weight:bold; - color:#f2d409; - } + font-weight: bold; + color: #f2d409; +} .clear { - overflow: hidden; - width: 100%; - } + overflow: hidden; + width: 100%; +} #ie_clearing { - display:none; - } + display: none; +} /*noinspection CssUnusedSymbol*/ .showfield { - + } /*noinspection CssUnusedSymbol*/ .hidefield { - display:none; + display: none; } /* Required fields validation */ -input[type=text].required,input[type=password].required { - width:200px; - border: 1px solid #053056; - background: #941616 url(../images/inputmust.png); - font-family:Verdana, Helvetica, sans-serif; - color: #FFFFFF; - font-weight: bold; - font-size:12px; - height:18px; +input[type=text].required, input[type=password].required { + width: 200px; + border: 1px solid #053056; + background: #941616 url(../images/inputmust.png); + font-family: Verdana, Helvetica, sans-serif; + color: #FFFFFF; + font-weight: bold; + font-size: 12px; + height: 18px; } + input[type=text] { - width:200px; - border: 1px solid #053056; - background: #941616 url(../images/input.png); - font-family:Verdana, Helvetica, sans-serif; - color: #000000; - font-size:12px; - height:18px; + width: 200px; + border: 1px solid #053056; + background: #941616 url(../images/input.png); + font-family: Verdana, Helvetica, sans-serif; + color: #000000; + font-size: 12px; + height: 18px; } + input[type=text].locked { - width:200px; - border: 1px solid #053056; - background: #666666 url(../images/inputlock.png); - font-family:Verdana, Helvetica, sans-serif; - color: #FFFFFF; - font-weight: bold; - font-size:12px; - height:18px; + width: 200px; + border: 1px solid #053056; + background: #666666 url(../images/inputlock.png); + font-family: Verdana, Helvetica, sans-serif; + color: #FFFFFF; + font-weight: bold; + font-size: 12px; + height: 18px; } + input[type=submit] { - border:1px solid #6CF; - background: #d1e2fd url(../images/input.png); - font-family:Verdana, Helvetica, sans-serif; - font-size:12px; - color:#0c4271; - height:25px; - padding-left:10px; - padding-right:10px; - margin:0; - padding-bottom:2px; + border: 1px solid #6CF; + background: #d1e2fd url(../images/input.png); + font-family: Verdana, Helvetica, sans-serif; + font-size: 12px; + color: #0c4271; + height: 25px; + padding-left: 10px; + padding-right: 10px; + margin: 0; + padding-bottom: 2px; } + input[type=submit][disabled] { - border:1px solid #6CF; - background: #d1e2fd url(../images/input.png); - font-family:Verdana, Helvetica, sans-serif; - font-size:12px; - color:#999; - height:25px; - padding-left:10px; - padding-right:10px; - margin:0; - padding-bottom:2px; + border: 1px solid #6CF; + background: #d1e2fd url(../images/input.png); + font-family: Verdana, Helvetica, sans-serif; + font-size: 12px; + color: #999; + height: 25px; + padding-left: 10px; + padding-right: 10px; + margin: 0; + padding-bottom: 2px; } + select.required { - width:202px; - border: 1px solid #053056; - background: #941616 url(../images/inputmust.png); - font-family:Verdana, Helvetica, sans-serif; - color: #FFFFFF; - font-weight: bold; - font-size:12px; - height:22px; + width: 202px; + border: 1px solid #053056; + background: #941616 url(../images/inputmust.png); + font-family: Verdana, Helvetica, sans-serif; + color: #FFFFFF; + font-weight: bold; + font-size: 12px; + height: 22px; } /* Text Styles */ .hint { - color: #666; - font-size: 0.95em; + color: #666; + font-size: 0.95em; } diff --git a/install/functions/NagInstallClass.php b/install/functions/NagInstallClass.php index 33173d5..85308bf 100644 --- a/install/functions/NagInstallClass.php +++ b/install/functions/NagInstallClass.php @@ -1,64 +1,56 @@ arrSession = $arrSession; } /** * Parse template - * @param array $arrTemplate Array including template replacements - * @param string $strTplFile Template file - * @return mixed|string + * @param array $arrTemplate Array including template replacements + * @param string $strTplFile Template file + * @return string */ - public function parseTemplate($arrTemplate, $strTplFile) + public function parseTemplate(array $arrTemplate, string $strTplFile): string { - // Open template file + /* Open template file */ if (file_exists($strTplFile) && is_readable($strTplFile)) { $strTemplate = ''; $datTplFile = fopen($strTplFile, 'rb'); @@ -66,244 +58,40 @@ class NagInstallClass $strTemplate .= fgets($datTplFile); } foreach ($arrTemplate as $key => $elem) { - if (substr_count($strTemplate, '{' .$key. '}') != 0) { - $strTemplate = str_replace('{' .$key. '}', $elem, $strTemplate); + if (substr_count($strTemplate, '{' . $key . '}') !== 0) { + $strTemplate = str_replace('{' . $key . '}', $elem, $strTemplate); } } return $strTemplate; } - echo $this->translate('Template file not found'). ': ' .$strTplFile; + echo $this->translate('Template file not found') . ': ' . $strTplFile; return 0; } /** * Translate text - * @param string $strLangString String to translate - * @return string Translated string + * @param string $strLangString String to translate + * @return string Translated string */ - public function translate($strLangString) + public function translate(string $strLangString): string { $strTemp1 = gettext($strLangString); return str_replace(array('"', "'"), array('"', '''), $strTemp1); } - /** - * Return supported languages - * @return array Array including supported languages - */ - public function getLangData() - { - $arrLangSupported = array(); - unset($arrLangSupported); - // English - $arrLangSupported['en_GB']['description'] = $this->translate('English'); - $arrLangSupported['en_GB']['nativedescription'] = 'English'; - - // German - $arrLangSupported['de_DE']['description'] = $this->translate('German'); - $arrLangSupported['de_DE']['nativedescription'] = 'Deutsch'; - - // Chinese (Simplified) - $arrLangSupported['zh_CN']['description'] = $this->translate('Chinese (Simplified)'); - $arrLangSupported['zh_CN']['nativedescription'] = '简体中文'; - - // Italian - $arrLangSupported['it_IT']['description'] = $this->translate('Italian'); - $arrLangSupported['it_IT']['nativedescription'] = 'Italiano'; - - // French - $arrLangSupported['fr_FR']['description'] = $this->translate('French'); - $arrLangSupported['fr_FR']['nativedescription'] = 'Français'; - - // Russian - $arrLangSupported['ru_RU']['description'] = $this->translate('Russian'); - $arrLangSupported['ru_RU']['nativedescription'] = 'Русский'; - - // Spanish - $arrLangSupported['es_ES']['description'] = $this->translate('Spanish'); - $arrLangSupported['es_ES']['nativedescription'] = 'Español'; - - // Brazilian Portuguese - $arrLangSupported['pt_BR']['description'] = $this->translate('Portuguese (Brazilian)'); - $arrLangSupported['pt_BR']['nativedescription'] = 'Português do Brasil'; - - // Dutch - $arrLangSupported['nl_NL']['description'] = $this->translate('Dutch'); - $arrLangSupported['nl_NL']['nativedescription'] = 'Nederlands'; - - // Danish - $arrLangSupported['da_DK']['description'] = $this->translate('Danish'); - $arrLangSupported['da_DK']['nativedescription'] = 'Dansk'; - - // No longer supported language due to missing translators - // - // // Japanese - // $arrLangSupported['ja_JP']['description'] = $this->translate('Japanese'); - // $arrLangSupported['ja_JP']['nativedescription'] = '日本語'; - // - // // Polish - // $arrLangSupported['pl_PL']['description'] = $this->translate('Polish'); - // $arrLangSupported['pl_PL']['nativedescription'] = 'Polski'; - // - // // Spanish (Argentina) - // $arrLangSupported['es_AR']['description'] = $this->translate('Spanish (Argentina)'); - // $arrLangSupported['es_AR']['nativedescription'] = 'Español Argentina'; - /// - /// Currently not supported languages - // - // // Albanian - // $arrLangSupported['sq']['description'] = $clang->$this->translate('Albanian'); - // $arrLangSupported['sq']['nativedescription'] = 'Shqipe'; - // - // // Basque - // $arrLangSupported['eu']['description'] = $this->translate('Basque'); - // $arrLangSupported['eu']['nativedescription'] = 'Euskara'; - // - // // Bosnian - // $arrLangSupported['bs']['description'] = $this->translate('Bosnian'); - // $arrLangSupported['bs']['nativedescription'] = - // 'Български'; - // - // // Bulgarian - // $arrLangSupported['bg']['description'] = $this->translate('Bulgarian'); - // $arrLangSupported['bg']['nativedescription'] = - // 'Български'; - // - // // Catalan - // $arrLangSupported['ca']['description'] = $this->translate('Catalan'); - // $arrLangSupported['ca']['nativedescription'] = 'Catalά'; - // - // // Welsh - // $arrLangSupported['cy']['description'] = $this->translate('Welsh'); - // $arrLangSupported['cy']['nativedescription'] = 'Cymraeg'; - // - // // Chinese (Traditional - Hong Kong) - // $arrLangSupported['zh-Hant-HK']['description'] = $this->translate('Chinese (Traditional - Hong Kong)'); - // $arrLangSupported['zh-Hant-HK']['nativedescription'] = '繁體中文語系'; - // - // // Chinese (Traditional - Taiwan) - // $arrLangSupported['zh-Hant-TW']['description'] = $this->translate('Chinese (Traditional - Taiwan)'); - // $arrLangSupported['zh-Hant-TW']['nativedescription'] = 'Chinese (Traditional - Taiwan)'; - // - // // Croatian - // $arrLangSupported['hr']['description'] = $this->translate('Croatian'); - // $arrLangSupported['hr']['nativedescription'] = 'Hrvatski'; - // - // // Czech - // $arrLangSupported['cs']['description'] = $this->translate('Czech'); - // $arrLangSupported['cs']['nativedescription'] = 'Česky'; - // - // // Estonian - // $arrLangSupported['et']['description'] = $this->translate('Estonian'); - // $arrLangSupported['et']['nativedescription'] = 'Eesti'; - // - // // Finnish - // $arrLangSupported['fi']['description'] = $this->translate('Finnish'); - // $arrLangSupported['fi']['nativedescription'] = 'Suomi'; - // - // // Galician - // $arrLangSupported['gl']['description'] = $this->translate('Galician'); - // $arrLangSupported['gl']['nativedescription'] = 'Galego'; - // - // // German informal - // $arrLangSupported['de-informal']['description'] = $this->translate('German informal'); - // $arrLangSupported['de-informal']['nativedescription'] = 'Deutsch (Du)'; - // - // // Greek - // $arrLangSupported['el']['description'] = $this->translate('Greek'); - // $arrLangSupported['el']['nativedescription'] = 'ελληνικά'; - // - // // Hebrew - // $arrLangSupported['he']['description'] = $this->translate('Hebrew'); - // $arrLangSupported['he']['nativedescription'] = ' עברית'; - // - // // Hungarian - // $arrLangSupported['hu']['description'] = $this->translate('Hungarian'); - // $arrLangSupported['hu']['nativedescription'] = 'Magyar'; - // - // // Indonesian - // $arrLangSupported['id']['description'] = $this->translate('Indonesian'); - // $arrLangSupported['id']['nativedescription'] = 'Bahasa Indonesia'; - // - // // Lithuanian - // $arrLangSupported['lt']['description'] = $this->translate('Lithuanian'); - // $arrLangSupported['lt']['nativedescription'] = 'Lietuvių'; - // - // // Macedonian - // $arrLangSupported['mk']['description'] = $this->translate('Macedonian'); - // $arrLangSupported['mk']['nativedescription'] = - // 'Македонски'; - // - // // Norwegian Bokml - // $arrLangSupported['nb']['description'] = $this->translate('Norwegian (Bokmal)'); - // $arrLangSupported['nb']['nativedescription'] = 'Norsk Bokmål'; - // - // // Norwegian Nynorsk - // $arrLangSupported['nn']['description'] = $this->translate('Norwegian (Nynorsk)'); - // $arrLangSupported['nn']['nativedescription'] = 'Norsk Nynorsk'; - // - // // Portuguese - // $arrLangSupported['pt']['description'] = $this->translate('Portuguese'); - // $arrLangSupported['pt']['nativedescription'] = 'Português'; - // - // // Romanian - // $arrLangSupported['ro']['description'] = $this->translate('Romanian'); - // $arrLangSupported['ro']['nativedescription'] = 'Românesc'; - // - // // Slovak - // $arrLangSupported['sk']['description'] = $this->translate('Slovak'); - // $arrLangSupported['sk']['nativedescription'] = 'Slovák'; - // - // // Slovenian - // $arrLangSupported['sl']['description'] = $this->translate('Slovenian'); - // $arrLangSupported['sl']['nativedescription'] = 'Slovenščina'; - // - // // Serbian - // $arrLangSupported['sr']['description'] = $this->translate('Serbian'); - // $arrLangSupported['sr']['nativedescription'] = 'Srpski'; - // - // // Spanish (Mexico) - // $arrLangSupported['es-MX']['description'] = $this->translate('Spanish (Mexico)'); - // $arrLangSupported['es-MX']['nativedescription'] = 'Español Mejicano'; - // - // // Swedish - // $arrLangSupported['sv']['description'] = $this->translate('Swedish'); - // $arrLangSupported['sv']['nativedescription'] = 'Svenska'; - // - // // Turkish - // $arrLangSupported['tr']['description'] = $this->translate('Turkish'); - // $arrLangSupported['tr']['nativedescription'] = 'Türkçe'; - // - // // Thai - // $arrLangSupported['th']['description'] = $this->translate('Thai'); - // $arrLangSupported['th']['nativedescription'] = 'ภาษาไทย'; - // - // // Vietnamese - // $arrLangSupported['vi']['description'] = $this->translate('Vietnamese'); - // $arrLangSupported['vi']['nativedescription'] = 'Tiếng Việt'; - $nativedescription = array(); - $description = array(); - foreach ($arrLangSupported as $key => $row) { - $description[$key] = $row['description']; - $nativedescription[$key] = $row['nativedescription']; - } - array_multisort($description, SORT_ASC, $nativedescription, SORT_ASC, $arrLangSupported); - return $arrLangSupported; - } - /** * Translate text - * @param string $strCode Language code - * @param bool $booNative Native code true/false - * @return bool|string Language name if found / false if not exist + * @param string $strCode Language code + * @param bool $booNative Native code true/false + * @return string Language name if found / false if not exist */ - public function getLangNameFromCode($strCode, $booNative = true) + public function getLangNameFromCode(string $strCode, bool $booNative = true): string { - $strReturn = false; + $strReturn = false; $arrLanguages = $this->getLangData(); if (isset($arrLanguages[$strCode]['description'])) { if ($booNative) { - $strReturn = $arrLanguages[$strCode]['description'].' - '.$arrLanguages[$strCode]['nativedescription']; + $strReturn = $arrLanguages[$strCode]['description'] . ' - ' . $arrLanguages[$strCode]['nativedescription']; } else { $strReturn = $arrLanguages[$strCode]['description']; } @@ -312,62 +100,120 @@ class NagInstallClass } /** - * Connect to database server as administrator - * @param string $strStatusMessage Array variable for status message - * @param string $strErrorMessage Error string - * @param int $intMode Mode (0=admin user/1=NagiosQL user - * @return int Status variable (0=ok,1=failed) + * Return supported languages + * @return array Array including supported languages */ - public function openAdmDBSrv(&$strStatusMessage, &$strErrorMessage, $intMode = 0) + public function getLangData(): array { - $intStatus = 0; - $intReturn = 0; + $arrLangSupported = array(); + unset($arrLangSupported); + /* English */ + $arrLangSupported['en_GB']['description'] = $this->translate('English'); + $arrLangSupported['en_GB']['nativedescription'] = 'English'; + + /* German */ + $arrLangSupported['de_DE']['description'] = $this->translate('German'); + $arrLangSupported['de_DE']['nativedescription'] = 'Deutsch'; + + /* Chinese (Simplified) */ + $arrLangSupported['zh_CN']['description'] = $this->translate('Chinese (Simplified)'); + $arrLangSupported['zh_CN']['nativedescription'] = '简体中文'; + + /* Italian */ + $arrLangSupported['it_IT']['description'] = $this->translate('Italian'); + $arrLangSupported['it_IT']['nativedescription'] = 'Italiano'; + + /* French */ + $arrLangSupported['fr_FR']['description'] = $this->translate('French'); + $arrLangSupported['fr_FR']['nativedescription'] = 'Français'; + + /* Russian */ + $arrLangSupported['ru_RU']['description'] = $this->translate('Russian'); + $arrLangSupported['ru_RU']['nativedescription'] = 'Русский'; + + /* Spanish */ + $arrLangSupported['es_ES']['description'] = $this->translate('Spanish'); + $arrLangSupported['es_ES']['nativedescription'] = 'Español'; + + /* Brazilian Portuguese */ + $arrLangSupported['pt_BR']['description'] = $this->translate('Portuguese (Brazilian)'); + $arrLangSupported['pt_BR']['nativedescription'] = 'Português do Brasil'; + + /* Dutch */ + $arrLangSupported['nl_NL']['description'] = $this->translate('Dutch'); + $arrLangSupported['nl_NL']['nativedescription'] = 'Nederlands'; + + /* Danish */ + $arrLangSupported['da_DK']['description'] = $this->translate('Danish'); + $arrLangSupported['da_DK']['nativedescription'] = 'Dansk'; + + $nativedescription = array(); + $description = array(); + foreach ($arrLangSupported as $key => $row) { + $description[$key] = $row['description']; + $nativedescription[$key] = $row['nativedescription']; + } + array_multisort($description, SORT_ASC, $nativedescription, SORT_ASC, $arrLangSupported); + return $arrLangSupported; + } + + /** + * Connect to database server as administrator + * @param string|null $strStatusMessage Array variable for status message + * @param string|null $strErrorMessage Error string + * @param int $intMode Mode (0=admin user/1=NagiosQL user + * @return int Status variable (0=ok,1=failed) + */ + public function openAdmDBSrv(string &$strStatusMessage = null, string &$strErrorMessage = null, int $intMode = 0): int + { + $intStatus = 0; + $intReturn = 0; $this->myDBClass->hasDBConnection(1); - if ($this->myDBClass->error == true) { + if ($this->myDBClass->error === true) { $strErrorMessage .= str_replace('::', '
', $this->myDBClass->strErrorMessage); $intStatus = 1; } /** @noinspection PhpStatementHasEmptyBodyInspection */ /** @noinspection MissingOrEmptyGroupStatementInspection */ - if ($intMode == 1) { - // TO BE DEFINED + if ($intMode === 1) { + /* TODO: TO BE DEFINED */ } - if ($intStatus == 0) { - $strStatusMessage = '' .$this->translate('passed'). ''; + if ($intStatus === 0) { + $strStatusMessage = '' . $this->translate('passed') . ''; } else { - $strStatusMessage = '' .$this->translate('failed'). ''; - $intReturn = 1; + $strStatusMessage = '' . $this->translate('failed') . ''; + $intReturn = 1; } return $intReturn; } /** * Connect to database as administrator - * @param string $strStatusMessage Error string - * @param string $strErrorMessage Error string - * @param int $intMode Mode (0=admin user/1=NagiosQL user - * @return int Status variable (0=ok,1=failed) + * @param string|null $strStatusMessage Error string + * @param string|null $strErrorMessage Error string + * @param int $intMode Mode (0=admin user/1=NagiosQL user + * @return int Status variable (0=ok,1=failed) */ - public function openDatabase(&$strStatusMessage, &$strErrorMessage, $intMode = 0) + public function openDatabase(string &$strStatusMessage = null, string &$strErrorMessage = null, int $intMode = 0): int { $intStatus = 0; $intReturn = 0; - // Connect to database - $booDB = $this->myDBClass->hasDBConnection(); + /* Connect to database */ + $booDB = $this->myDBClass->hasDBConnection(); if (!$booDB) { - $strErrorMessage .= $this->translate('Error while connecting to database:'). '
'; - $strErrorMessage .= str_replace('::', '
', $this->myDBClass->strErrorMessage)."\n"; + $strErrorMessage .= $this->translate('Error while connecting to database:') . '
'; + $strErrorMessage .= str_replace('::', '
', $this->myDBClass->strErrorMessage) . "\n"; $intStatus = 1; } /** @noinspection PhpStatementHasEmptyBodyInspection */ /** @noinspection MissingOrEmptyGroupStatementInspection */ - if ($intMode == 1) { - // TO BE DEFINED + if ($intMode === 1) { + /* TODO: TO BE DEFINED */ } - if ($intStatus == 0) { - $strStatusMessage = '' .$this->translate('passed'). ''; + if ($intStatus === 0) { + $strStatusMessage = '' . $this->translate('passed') . ''; } else { - $strStatusMessage = '' .$this->translate('failed'). ''; + $strStatusMessage = '' . $this->translate('failed') . ''; $intReturn = 1; } return $intReturn; @@ -375,36 +221,36 @@ class NagInstallClass /** * Check database version - * @param string $strStatusMessage Variable for status message - * @param string $strErrorMessage Error string - * @param string $setVersion Database version - * @return int Status variable (0=ok,1=failed) + * @param string|null $strStatusMessage Variable for status message + * @param string|null $strErrorMessage Error string + * @param string|null $setVersion Database version + * @return int Status variable (0=ok,1=failed) */ - public function checkDBVersion(&$strStatusMessage, &$strErrorMessage, &$setVersion) + public function checkDBVersion(string &$strStatusMessage = null, string &$strErrorMessage = null, string &$setVersion = null): int { $arrDataset = array(); - $intReturn = 0; + $intReturn = 0; $strDBError = ''; $intVersion = 0; - // Read version string from DB - if ($this->arrSession['install']['dbtype'] == 'mysqli') { + /* Read version string from DB */ + if ($this->arrSession['install']['dbtype'] === 'mysqli') { $this->myDBClass->hasSingleDataset("SHOW VARIABLES LIKE 'version'", $arrDataset); $setVersion = $arrDataset['Value']; $strDBError = str_replace('::', '
', $this->myDBClass->strErrorMessage); $intVersion = version_compare($setVersion, '4.1.0'); } - if ($strDBError == '') { - // Is the currrent version supported? - if ($intVersion >=0) { - $strStatusMessage = '' .$this->translate('supported'). ''; + if ($strDBError === '') { + /* Is the currrent version supported? */ + if ($intVersion >= 0) { + $strStatusMessage = '' . $this->translate('supported') . ''; } else { - $strStatusMessage = '' .$this->translate('not supported'). ''; + $strStatusMessage = '' . $this->translate('not supported') . ''; $intReturn = 1; } } else { - $strErrorMessage .= $strDBError."
\n"; - $strStatusMessage = '' .$this->translate('failed'). ''; - $setVersion = 'unknown'; + $strErrorMessage .= $strDBError . "
\n"; + $strStatusMessage = '' . $this->translate('failed') . ''; + $setVersion = 'unknown'; $intReturn = 1; } return $intReturn; @@ -412,42 +258,36 @@ class NagInstallClass /** * Check NagiosQL version - * @param string $strStatusMessage Variable for status message - * @param string $strErrorMessage Error string - * @param array $arrUpdate Array including all update files - * @param string $setVersion Current NagiosQL version string - * @return int Status variable (0=ok,1=failed) + * @param string|null $strStatusMessage Variable for status message + * @param string|null $strErrorMessage Error string + * @param array $arrUpdate Array including all update files + * @param string|null $setVersion Current NagiosQL version string + * @return int Status variable (0=ok,1=failed) + * @noinspection PhpOptionalBeforeRequiredParametersInspection */ - public function checkQLVersion(&$strStatusMessage, &$strErrorMessage, &$arrUpdate, &$setVersion) + public function checkQLVersion(string &$strStatusMessage = null, string &$strErrorMessage = null, array &$arrUpdate, string &$setVersion = null): int { - $intReturn = 0; - $strSQL = "SELECT `value` FROM `tbl_settings` WHERE `category`='db' AND `name`='version'"; + $intReturn = 0; + $strSQL = "SELECT `value` FROM `tbl_settings` WHERE `category`='db' AND `name`='version'"; $setVersion = $this->myDBClass->getFieldData($strSQL); $strDBError = str_replace('::', '
', $this->myDBClass->strErrorMessage); - // Process result - if (($strDBError == '') && ($setVersion != '')) { - // NagiosQL version supported? + /* Process result */ + if (($strDBError === '') && ($setVersion !== '')) { + /* NagiosQL version supported? */ $intVersionError = 0; switch ($setVersion) { case '3.0.0': $arrUpdate[] = 'sql/update_300_310.sql'; $arrUpdate[] = 'sql/update_310_320.sql'; break; + case '3.0.2': case '3.0.1': $arrUpdate[] = 'sql/update_302_303.sql'; $arrUpdate[] = 'sql/update_304_310.sql'; $arrUpdate[] = 'sql/update_310_320.sql'; break; - case '3.0.2': - $arrUpdate[] = 'sql/update_302_303.sql'; - $arrUpdate[] = 'sql/update_304_310.sql'; - $arrUpdate[] = 'sql/update_310_320.sql'; - break; - case '3.0.3': - $arrUpdate[] = 'sql/update_304_310.sql'; - $arrUpdate[] = 'sql/update_310_320.sql'; - break; case '3.0.4': + case '3.0.3': $arrUpdate[] = 'sql/update_304_310.sql'; $arrUpdate[] = 'sql/update_310_320.sql'; break; @@ -457,63 +297,67 @@ class NagInstallClass case '3.1.1': $arrUpdate[] = 'sql/update_311_320.sql'; break; + case '3.3.0': case '3.2.0': $arrUpdate[] = 'sql/update_320_340.sql'; break; - case '3.3.0': - $arrUpdate[] = 'sql/update_320_340.sql'; - break; case '3.4.0': + $arrUpdate[] = 'sql/update_340_341.sql'; + break; + case '3.4.1': + $arrUpdate[] = 'sql/update_341_350.sql'; + break; + case '3.5.0': $intVersionError = 2; break; default: $intVersionError = 1; break; } - if ($intVersionError == 0) { - $strStatusMessage = '' .$this->translate('supported'). ' (' - .$setVersion. ')'; - } elseif ($intVersionError == 2) { + if ($intVersionError === 0) { + $strStatusMessage = '' . $this->translate('supported') . ' (' + . $setVersion . ')'; + } elseif ($intVersionError === 2) { $strErrorMessage .= $this->translate('Your NagiosQL installation is up to date - no further ' - . 'actions are needed!')."
\n"; - $strStatusMessage = '' .$this->translate('up-to-date'). ' (' - .$setVersion. ')'; - $intReturn = 1; + . 'actions are needed!') . "
\n"; + $strStatusMessage = '' . $this->translate('up-to-date') . ' (' + . $setVersion . ')'; + $intReturn = 1; } else { $strErrorMessage .= $this->translate('Updates to NagiosQL 3.2 and above are only supported from ' - . 'NagiosQL 3.0.0 and above!')."
\n"; - $strStatusMessage = '' .$this->translate('failed'). ' (' .$setVersion. ')'; - $intReturn = 1; + . 'NagiosQL 3.0.0 and above!') . "
\n"; + $strStatusMessage = '' . $this->translate('failed') . ' (' . $setVersion . ')'; + $intReturn = 1; } } else { - $strErrorMessage .= $this->translate('Error while selecting settings table.')."
\n"; - $strErrorMessage .= $strDBError."
\n"; + $strErrorMessage .= $this->translate('Error while selecting settings table.') . "
\n"; + $strErrorMessage .= $strDBError . "
\n"; $strErrorMessage .= $this->translate('Updates to NagiosQL 3.2 and above are only supported ' - . 'from NagiosQL 3.0.0 and above!')."
\n"; - $strStatusMessage = '' .$this->translate('failed'). ''; - $intReturn = 1; + . 'from NagiosQL 3.0.0 and above!') . "
\n"; + $strStatusMessage = '' . $this->translate('failed') . ''; + $intReturn = 1; } return $intReturn; } /** * Delete old NagiosQL database - * @param string $strStatusMessage Variable for status message - * @param string $strErrorMessage Error string - * @return int Status variable (0=ok,1=failed) + * @param string|null $strStatusMessage Variable for status message + * @param string|null $strErrorMessage Error string + * @return int Status variable (0=ok,1=failed) */ - public function dropDB(&$strStatusMessage, &$strErrorMessage) + public function dropDB(string &$strStatusMessage = null, string &$strErrorMessage = null): int { - $intReturn = 0; - $booReturn = $this->myDBClass->insertData('DROP DATABASE ' .$this->arrSession['install']['dbname']); + $intReturn = 0; + $booReturn = $this->myDBClass->insertData('DROP DATABASE ' . $this->arrSession['install']['dbname']); $strDBError = str_replace('::', '
', $this->myDBClass->strErrorMessage); if ($booReturn) { - $strStatusMessage = '' .$this->translate('done'). ' (' . - $this->arrSession['install']['dbname']. ')'; + $strStatusMessage = '' . $this->translate('done') . ' (' . + $this->arrSession['install']['dbname'] . ')'; } else { - $strErrorMessage .= $strDBError."
\n"; - $strStatusMessage = '' .$this->translate('failed'). ' (' . - $this->arrSession['install']['dbname']. ')'; + $strErrorMessage .= $strDBError . "
\n"; + $strStatusMessage = '' . $this->translate('failed') . ' (' . + $this->arrSession['install']['dbname'] . ')'; $intReturn = 1; } return $intReturn; @@ -521,35 +365,35 @@ class NagInstallClass /** * Create NagiosQL database - * @param string $strStatusMessage Variable for status message - * @param string $strErrorMessage Error string - * @return int Status variable (0=ok,1=failed) + * @param string|null $strStatusMessage Variable for status message + * @param string|null $strErrorMessage Error string + * @return int Status variable (0=ok,1=failed) */ - public function createDB(&$strStatusMessage, &$strErrorMessage) + public function createDB(string &$strStatusMessage = null, string &$strErrorMessage = null): int { $intReturn = 0; - $strSQL = ''; - // Create database - if (($this->arrSession['install']['dbtype'] == 'mysql') || - ($this->arrSession['install']['dbtype'] == 'mysqli')) { - $strSQL = 'CREATE DATABASE ' .$this->arrSession['install']['dbname']. ' DEFAULT CHARACTER SET utf8 DEFAULT ' + $strSQL = ''; + /* Create database */ + if (($this->arrSession['install']['dbtype'] === 'mysql') || + ($this->arrSession['install']['dbtype'] === 'mysqli')) { + $strSQL = 'CREATE DATABASE ' . $this->arrSession['install']['dbname'] . ' DEFAULT CHARACTER SET utf8 DEFAULT ' . 'COLLATE utf8_unicode_ci'; } else { - $strErrorMessage .= $this->translate('Unsupported database type.')."
\n"; - $strStatusMessage = '' .$this->translate('failed'). ' (' . - $this->arrSession['install']['dbname']. ')'; + $strErrorMessage .= $this->translate('Unsupported database type.') . "
\n"; + $strStatusMessage = '' . $this->translate('failed') . ' (' . + $this->arrSession['install']['dbname'] . ')'; $intReturn = 1; } - if ($intReturn == 0) { - $booReturn = $this->myDBClass->insertData($strSQL); + if ($intReturn === 0) { + $booReturn = $this->myDBClass->insertData($strSQL); $strDBError = str_replace('::', '
', $this->myDBClass->strErrorMessage); if ($booReturn) { - $strStatusMessage = '' .$this->translate('done'). ' (' . - $this->arrSession['install']['dbname']. ')'; + $strStatusMessage = '' . $this->translate('done') . ' (' . + $this->arrSession['install']['dbname'] . ')'; } else { - $strErrorMessage .= $strDBError."
\n"; - $strStatusMessage = '' .$this->translate('failed'). ' (' . - $this->arrSession['install']['dbname']. ')'; + $strErrorMessage .= $strDBError . "
\n"; + $strStatusMessage = '' . $this->translate('failed') . ' (' . + $this->arrSession['install']['dbname'] . ')'; $intReturn = 1; } } @@ -558,64 +402,64 @@ class NagInstallClass /** * Grant user to database - * @param string $strStatusMessage Variable for status message - * @param string $strErrorMessage Error string - * @return int Status variable (0=ok,1=failed) + * @param string|null $strStatusMessage Variable for status message + * @param string|null $strErrorMessage Error string + * @return int Status variable (0=ok,1=failed) */ - public function grantDBUser(&$strStatusMessage, &$strErrorMessage) + public function grantDBUser(string &$strStatusMessage = null, string &$strErrorMessage = null): int { - $intReturn = 0; + $intReturn = 0; $intUserError = 0; - $strDBError = ''; - // Grant user - if (($this->arrSession['install']['dbtype'] == 'mysql') || - ($this->arrSession['install']['dbtype'] == 'mysqli')) { - // does the user exist? + $strDBError = ''; + /* Grant NagiosQL database user */ + if (($this->arrSession['install']['dbtype'] === 'mysql') || + ($this->arrSession['install']['dbtype'] === 'mysqli')) { + /* Does the NagiosQL database user exist? */ $intUserError = 0; $this->myDBClass->insertData('FLUSH PRIVILEGES'); - $strSQL = "SELECT * FROM `mysql`.`user` WHERE `Host`='".$this->arrSession['install']['localsrv']."' " - . "AND `User`='".$this->arrSession['install']['dbuser']."'"; - $intCount = $this->myDBClass->countRows($strSQL); - if ($intCount == 0) { - $strSQL = "CREATE USER '".$this->arrSession['install']['dbuser']."'@'" - . $this->arrSession['install']['localsrv']."' " - . "IDENTIFIED BY '".$this->arrSession['install']['dbpass']."'"; + $strSQL = "SELECT * FROM `mysql`.`user` WHERE `Host`='" . $this->arrSession['install']['localsrv'] . "' " + . "AND `User`='" . $this->arrSession['install']['dbuser'] . "'"; + $intCount = $this->myDBClass->countRows($strSQL); + if ($intCount === 0) { + $strSQL = "CREATE USER '" . $this->arrSession['install']['dbuser'] . "'@'" + . $this->arrSession['install']['localsrv'] . "' " + . "IDENTIFIED BY '" . $this->arrSession['install']['dbpass'] . "'"; $booReturn = $this->myDBClass->insertData($strSQL); - if ($booReturn == false) { + if ($booReturn === false) { $intUserError = 1; - $strDBError = str_replace('::', '
', $this->myDBClass->strErrorMessage); + $strDBError = str_replace('::', '
', $this->myDBClass->strErrorMessage); } - } elseif ($this->myDBClass->strErrorMessage == '') { + } elseif ($this->myDBClass->strErrorMessage === '') { $intUserError = 2; } else { $intUserError = 1; - $strDBError = str_replace('::', '
', $this->myDBClass->strErrorMessage); + $strDBError = str_replace('::', '
', $this->myDBClass->strErrorMessage); } - if ($intUserError != 1) { + if ($intUserError !== 1) { $this->myDBClass->insertData('FLUSH PRIVILEGES'); - $strSQL = 'GRANT SELECT, INSERT, UPDATE, DELETE, LOCK TABLES ON ' - . '`' .$this->arrSession['install']['dbname']. '`.* TO ' - . "'".$this->arrSession['install']['dbuser']."'@'" - . $this->arrSession['install']['localsrv']."'"; + $strSQL = 'GRANT SELECT, INSERT, UPDATE, DELETE, LOCK TABLES ON ' + . '`' . $this->arrSession['install']['dbname'] . '`.* TO ' + . "'" . $this->arrSession['install']['dbuser'] . "'@'" + . $this->arrSession['install']['localsrv'] . "'"; $booReturn = $this->myDBClass->insertData($strSQL); - if ($booReturn == false) { - $intUserError = 1; - $strDBError = str_replace('::', '
', $this->myDBClass->strErrorMessage); + if ($booReturn === false) { + $intUserError = 1; + $strDBError = str_replace('::', '
', $this->myDBClass->strErrorMessage); } $this->myDBClass->insertData('FLUSH PRIVILEGES'); } } - if ($intUserError != 1) { - if ($intUserError == 2) { - $strStatusMessage = '' .$this->translate('done'). ' (' . - $this->translate('Only added rights to existing user'). ': ' . - $this->arrSession['install']['dbuser']. ')'; + if ($intUserError !== 1) { + if ($intUserError === 2) { + $strStatusMessage = '' . $this->translate('done') . ' (' . + $this->translate('Only added rights to existing user') . ': ' . + $this->arrSession['install']['dbuser'] . ')'; } else { - $strStatusMessage = '' .$this->translate('done'). ''; + $strStatusMessage = '' . $this->translate('done') . ''; } } else { - $strErrorMessage .= $strDBError."
\n"; - $strStatusMessage = '' .$this->translate('failed'). ''; + $strErrorMessage .= $strDBError . "
\n"; + $strStatusMessage = '' . $this->translate('failed') . ''; $intReturn = 1; } return $intReturn; @@ -623,36 +467,37 @@ class NagInstallClass /** * Update NagiosQL database - * @param string $strStatusMessage Variable for status message - * @param string $strErrorMessage Error string - * @param array $arrUpdate Array including all update files - * @return int Status variable (0=ok,1=failed) + * @param string|null $strStatusMessage Variable for status message + * @param string|null $strErrorMessage Error string + * @param array $arrUpdate Array including all update files + * @return int Status variable (0=ok,1=failed) + * @noinspection PhpOptionalBeforeRequiredParametersInspection */ - public function updateQLDB(&$strStatusMessage, &$strErrorMessage, $arrUpdate) + public function updateQLDB(string &$strStatusMessage = null, string &$strErrorMessage = null, array $arrUpdate): int { - $intReturn = 0; - $intUpdateOk = 0; + $intReturn = 0; + $intUpdateOk = 0; $intUpdateError = 0; - if (\is_array($arrUpdate) && (\count($arrUpdate) != 0)) { - $intUpdateOk = 0; + if (count($arrUpdate) !== 0) { + $intUpdateOk = 0; $intUpdateError = 0; } else { - $strStatusMessage = '' .$this->translate('failed'). ''; - $strErrorMessage .= $this->translate('No SQL update files available')."
\n"; - $intReturn = 1; + $strStatusMessage = '' . $this->translate('failed') . ''; + $strErrorMessage .= $this->translate('No SQL update files available') . "
\n"; + $intReturn = 1; } - if ($intReturn == 0) { + if ($intReturn === 0) { foreach ($arrUpdate as $elem) { - if (($intUpdateError == 0) && is_readable($elem)) { + if (($intUpdateError === 0) && is_readable($elem)) { $this->processSqlFile($elem, $intUpdateOk, $intUpdateError, $strStatusMessage, $strErrorMessage); } else { - $strStatusMessage = '' .$this->translate('failed'). ''; - $strErrorMessage .= $this->translate('SQL file is not readable or empty'). ' (' .$elem.")
\n"; + $strStatusMessage = '' . $this->translate('failed') . ''; + $strErrorMessage .= $this->translate('SQL file is not readable or empty') . ' (' . $elem . ")
\n"; $intUpdateError++; } } - if ($intUpdateError == 0) { - $strStatusMessage = '' .$this->translate('done'). ''; + if ($intUpdateError === 0) { + $strStatusMessage = '' . $this->translate('done') . ''; } else { $intReturn = 1; } @@ -662,81 +507,80 @@ class NagInstallClass /** * Process SQL files - * @param string $strFileName SQL Filename - * @param int $intSuccess Success counter - * @param int $intError Error Counter - * @param string $strStatus Status message string - * @param string $strError Error message string + * @param string $strFileName SQL Filename + * @param int $intSuccess Success counter + * @param int $intError Error Counter + * @param string|null $strStatus Status message string + * @param string|null $strError Error message string */ - private function processSqlFile($strFileName, &$intSuccess, &$intError, &$strStatus, &$strError) + private function processSqlFile(string $strFileName, int &$intSuccess, int &$intError, string &$strStatus = null, string &$strError = null): void { $filSqlNew = fopen($strFileName, 'rb'); if ($filSqlNew) { $strSqlCommand = ''; - $intSQLError = 0; - $intLineCount = 0; + $intSQLError = 0; + $intLineCount = 0; while (!feof($filSqlNew)) { $strLine = trim(fgets($filSqlNew)); - if ($intSQLError == 1) { + if ($intSQLError === 1) { continue; - } // skip if an error was found + } /* skip if an error was found */ $intLineCount++; - if (($strLine == '') || (0 === strpos($strLine, '--'))) { + if (($strLine === '') || (0 === strpos($strLine, '--'))) { continue; - } // skip empty and comment lines + } /* skip empty and comment lines */ $strSqlCommand .= $strLine; - if (substr($strSqlCommand, -1) == ';') { + if (substr($strSqlCommand, -1) === ';') { $booReturn = $this->myDBClass->insertData($strSqlCommand); - if ($booReturn == false) { + if ($booReturn === false) { $intSQLError = 1; - $strError .= str_replace('::', '
', $this->myDBClass->strErrorMessage); - $intError = 1; + $strError .= str_replace('::', '
', $this->myDBClass->strErrorMessage); + $intError = 1; } $strSqlCommand = ''; } } - if ($intSQLError == 0) { + if ($intSQLError === 0) { $intSuccess++; } else { - $strStatus = '' .$this->translate('failed'). ' (Line: ' . - $intLineCount. ' in file: ' .$strFileName. ')'; + $strStatus = '' . $this->translate('failed') . ' (Line: ' . + $intLineCount . ' in file: ' . $strFileName . ')'; $intError++; } } else { - $strStatus = '' .$this->translate('failed'). ''; - $strError .= $this->translate('SQL file is not readable or empty'). ' (' .$strFileName.")
\n"; + $strStatus = '' . $this->translate('failed') . ''; + $strError .= $this->translate('SQL file is not readable or empty') . ' (' . $strFileName . ")
\n"; $intError++; } } /** * Create NagiosQL administrator - * @param string $strStatusMessage Variable for status message - * @param string $strErrorMessage Error string - * @return int Status variable (0=ok,1=failed) + * @param string|null $strStatusMessage Variable for status message + * @param string|null $strErrorMessage Error string + * @return int Status variable (0=ok,1=failed) */ - public function createNQLAdmin(&$strStatusMessage, &$strErrorMessage) + public function createNQLAdmin(string &$strStatusMessage = null, string &$strErrorMessage = null): int { $intReturn = 0; - // Create admin user - $strSQL = "SELECT `id` FROM `tbl_language` WHERE `locale`='".$this->arrSession['install']['locale']."'"; + /* Create admin user */ + $strSQL = "SELECT `id` FROM `tbl_language` WHERE `locale`='" . $this->arrSession['install']['locale'] . "'"; $intLang = (int)$this->myDBClass->getFieldData($strSQL); - if ($intLang == 0) { + if ($intLang === 0) { $intLang = 1; } - /** @noinspection SqlSignature */ - $strSQL = 'INSERT INTO `tbl_user` (`id`, `username`, `alias`, `password`, `admin_enable`, `wsauth`, ' + $strSQL = 'INSERT INTO `tbl_user` (`id`, `username`, `alias`, `password`, `admin_enable`, `wsauth`, ' . '`active`, `nodelete`, `language`, `domain`, `last_login`, `last_modified`) ' - . "VALUES (1, '".$this->arrSession['install']['qluser']."', 'Administrator', " - . "MD5('".$this->arrSession['install']['qlpass']."'), '1', '0', '1', '1', '".$intLang + . "VALUES (1, '" . $this->arrSession['install']['qluser'] . "', 'Administrator', " + . "MD5('" . $this->arrSession['install']['qlpass'] . "'), '1', '0', '1', '1', '" . $intLang . "', '1', '', NOW());"; - $booReturn = $this->myDBClass->insertData($strSQL); + $booReturn = $this->myDBClass->insertData($strSQL); $strDBError = str_replace('::', '
', $this->myDBClass->strErrorMessage); if ($booReturn) { - $strStatusMessage = '' .$this->translate('done'). ''; + $strStatusMessage = '' . $this->translate('done') . ''; } else { - $strErrorMessage .= $strDBError."
\n"; - $strStatusMessage = '' .$this->translate('failed'). ''; + $strErrorMessage .= $strDBError . "
\n"; + $strStatusMessage = '' . $this->translate('failed') . ''; $intReturn = 1; } return $intReturn; @@ -744,79 +588,76 @@ class NagInstallClass /** * Update settings database - * @param string $strStatusMessage Variable for status message - * @param string $strErrorMessage Error string - * @return int Status variable (0=ok,1=failed) + * @param string|null $strStatusMessage Variable for status message + * @param string|null $strErrorMessage Error string + * @return int Status variable (0=ok,1=failed) */ - public function updateSettingsDB(&$strStatusMessage, &$strErrorMessage) + public function updateSettingsDB(string &$strStatusMessage = null, string &$strErrorMessage = null): int { $intReturn = 0; - // Checking initial settings - $arrInitial[] = array('category'=>'db','name'=>'version','value'=>$this->arrSession['install']['version']); - $arrInitial[] = array('category'=>'db','name'=>'type','value'=>$this->arrSession['install']['dbtype']); - /** @noinspection ForeachSourceInspection */ + /* Checking initial settings */ + $arrInitial[] = array('category' => 'db', 'name' => 'version', 'value' => $this->arrSession['install']['version']); + $arrInitial[] = array('category' => 'db', 'name' => 'type', 'value' => $this->arrSession['install']['dbtype']); foreach ($this->arrSession['init_settings'] as $key => $value) { - if ($key == 'db') { + if ($key === 'db') { continue; - } // do not store db values to database - /** @var array $value */ + } /* Do not store db values to database */ foreach ($value as $key2 => $value2) { - $arrInitial[] = array('category'=>$key,'name'=>$key2,'value'=>$value2); + $arrInitial[] = array('category' => $key, 'name' => $key2, 'value' => $value2); } } - /** @noinspection ForeachSourceInspection */ foreach ($arrInitial as $elem) { $strSQL1 = 'SELECT `value` FROM `tbl_settings` ' - . "WHERE `category`='".$elem['category']."' AND `name`='".$elem['name']."'"; + . "WHERE `category`='" . $elem['category'] . "' AND `name`='" . $elem['name'] . "'"; $strSQL2 = 'INSERT INTO `tbl_settings` (`category`, `name`, `value`) ' - . "VALUES ('".$elem['category']."', '".$elem['name']."', '".$elem['value']."')"; - $intCount = $this->myDBClass->countRows($strSQL1); - if ($intCount == 0) { - $booReturn = $this->myDBClass->insertData($strSQL2); - if ($booReturn == false) { - $strStatusMessage = '' .$this->translate('failed'). ''; + . "VALUES ('" . $elem['category'] . "', '" . $elem['name'] . "', '" . $elem['value'] . "')"; + $intCount = $this->myDBClass->countRows($strSQL1); + if ($intCount === 0) { + $booReturn = $this->myDBClass->insertData($strSQL2); + if ($booReturn === false) { + $strStatusMessage = '' . $this->translate('failed') . ''; $strErrorMessage .= $this->translate('Inserting initial data to settings database has ' - . 'failed:'). '1
'; + . 'failed:') . '1
'; $strErrorMessage .= str_replace('::', '
', $this->myDBClass->strErrorMessage); $intReturn = 1; } - } elseif ($this->myDBClass->strErrorMessage != '') { - $strStatusMessage = '' .$this->translate('failed'). ''; + } elseif ($this->myDBClass->strErrorMessage !== '') { + $strStatusMessage = '' . $this->translate('failed') . ''; $strErrorMessage .= $this->translate('Inserting initial data to settings database has failed:') . '2
'; $strErrorMessage .= str_replace('::', '
', $this->myDBClass->strErrorMessage); $intReturn = 1; } } - if ($intReturn == 0) { - $strBaseURL = str_replace('install/install.php', '', filter_input(INPUT_SERVER, 'PHP_SELF', 513)); + if ($intReturn === 0) { + $strBaseURL = str_replace('install/install.php', '', filter_input(INPUT_SERVER, 'PHP_SELF', 513)); $strBasePath = substr(realpath('.'), 0, -7); // Update some values - $arrSettings[] = array('category'=>'db','name'=>'version', - 'value'=>$this->arrSession['install']['version']); - if (substr_count(filter_input(INPUT_SERVER, 'SERVER_PROTOCOL', FILTER_SANITIZE_STRING), 'HTTPS') != 0) { - $arrSettings[] = array('category'=>'path','name'=>'protocol','value'=>'https'); + $arrSettings[] = array('category' => 'db', 'name' => 'version', + 'value' => $this->arrSession['install']['version']); + if (filter_input(INPUT_SERVER, 'REQUEST_SCHEME') === 'https') { + $arrSettings[] = array('category' => 'path', 'name' => 'protocol', 'value' => 'https'); } else { - $arrSettings[] = array('category'=>'path','name'=>'protocol','value'=>'http'); + $arrSettings[] = array('category' => 'path', 'name' => 'protocol', 'value' => 'http'); } - $arrSettings[] = array('category'=>'data','name'=>'locale', - 'value'=>$this->arrSession['install']['locale']); - $arrSettings[] = array('category'=>'path','name'=>'base_url','value'=>$strBaseURL); - $arrSettings[] = array('category'=>'path','name'=>'base_path','value'=>$strBasePath); - /** @var array $arrSettings */ + $arrSettings[] = array('category' => 'data', 'name' => 'locale', + 'value' => $this->arrSession['install']['locale']); + $arrSettings[] = array('category' => 'path', 'name' => 'base_url', 'value' => $strBaseURL); + $arrSettings[] = array('category' => 'path', 'name' => 'base_path', 'value' => $strBasePath); foreach ($arrSettings as $elem) { - $strSQL = "UPDATE `tbl_settings` SET `value`='".$elem['value']."' " - . "WHERE `category`='".$elem['category']."' AND `name`='".$elem['name']."'"; + $strSQL = "UPDATE `tbl_settings` SET `value`='" . $elem['value'] . "' " + . "WHERE `category`='" . $elem['category'] . "' AND `name`='" . $elem['name'] . "'"; $booReturn = $this->myDBClass->insertData($strSQL); - if ($booReturn == false) { - $strStatusMessage = '' .$this->translate('failed'). ''; - $strErrorMessage .= $this->translate('Inserting initial data to settings database has failed:'); - $strErrorMessage .= str_replace('::', '
', $this->myDBClass->strErrorMessage); - $intReturn = 1; + if ($booReturn === false) { + $strStatusMessage = '' . $this->translate('failed') . ''; + $strErrorMessage .= $this->translate('Inserting initial data to settings database has failed:'); + $strErrorMessage .= str_replace('::', '
', $this->myDBClass->strErrorMessage); + $intReturn = 1; } } - if ($intReturn == 0) { - $strStatusMessage = '' .$this->translate('done'). ''; + /** @noinspection NotOptimalIfConditionsInspection */ + if ($intReturn === 0) { + $strStatusMessage = '' . $this->translate('done') . ''; } } return $intReturn; @@ -824,22 +665,23 @@ class NagInstallClass /** * Update settings file - * @param string $strStatusMessage Variable for status message - * @param string $strErrorMessage Error string - * @return int Status variable (0=ok,1=failed) + * @param string|null $strStatusMessage Variable for status message + * @param string|null $strErrorMessage Error string + * @return int Status variable (0=ok,1=failed) */ - public function updateSettingsFile(&$strStatusMessage, &$strErrorMessage) + public function updateSettingsFile(string &$strStatusMessage = null, string &$strErrorMessage = null): int { $intReturn = 0; - // open settings file - $strBaseURL = str_replace('install/install.php', '', filter_input(INPUT_SERVER, 'PHP_SELF', 513)); + /* Open settings file */ + $strBaseURL = str_replace('install/install.php', '', filter_input(INPUT_SERVER, 'PHP_SELF', 513)); $strBasePath = substr(realpath('.'), 0, -7); - $strErrorId = error_reporting(); + $strErrorId = error_reporting(); error_reporting(0); - $filSettings = fopen($strBasePath. 'config/settings.php', 'wb'); + $filSettings = fopen($strBasePath . 'config/settings.php', 'wb'); error_reporting($strErrorId); if ($filSettings) { - // Write Database Configuration into settings.php + /* Write Database Configuration into settings.php */ + /** @noinspection DuplicatedCode */ fwrite($filSettings, "\n"); @@ -852,25 +694,25 @@ class NagInstallClass fwrite($filSettings, "; Project : NagiosQL\n"); fwrite($filSettings, "; Component: Database Configuration\n"); fwrite($filSettings, "; Website : https://sourceforge.net/projects/nagiosql/\n"); - fwrite($filSettings, '; Date : ' .date('F j, Y, g:i a')."\n"); - fwrite($filSettings, '; Version : ' .$this->arrSession['install']['version']."\n"); + fwrite($filSettings, '; Date : ' . date('F j, Y, g:i a') . "\n"); + fwrite($filSettings, '; Version : ' . $this->arrSession['install']['version'] . "\n"); fwrite($filSettings, ";\n"); fwrite($filSettings, ";///////////////////////////////////////////////////////////////////////////////\n"); fwrite($filSettings, "[db]\n"); - fwrite($filSettings, 'type = ' .$this->arrSession['install']['dbtype']."\n"); - fwrite($filSettings, 'server = ' .$this->arrSession['install']['dbserver']."\n"); - fwrite($filSettings, 'port = ' .$this->arrSession['install']['dbport']."\n"); - fwrite($filSettings, 'database = ' .$this->arrSession['install']['dbname']."\n"); - fwrite($filSettings, 'username = ' .$this->arrSession['install']['dbuser']."\n"); - fwrite($filSettings, 'password = ' .$this->arrSession['install']['dbpass']."\n"); + fwrite($filSettings, 'type = \'' . $this->arrSession['install']['dbtype'] . "'\n"); + fwrite($filSettings, 'server = \'' . $this->arrSession['install']['dbserver'] . "'\n"); + fwrite($filSettings, 'port = \'' . $this->arrSession['install']['dbport'] . "'\n"); + fwrite($filSettings, 'database = \'' . $this->arrSession['install']['dbname'] . "'\n"); + fwrite($filSettings, 'username = \'' . $this->arrSession['install']['dbuser'] . "'\n"); + fwrite($filSettings, 'password = \'' . $this->arrSession['install']['dbpass'] . "'\n"); fwrite($filSettings, "[path]\n"); - fwrite($filSettings, 'base_url = ' .$strBaseURL."\n"); - fwrite($filSettings, 'base_path = ' .$strBasePath."\n"); + fwrite($filSettings, 'base_url = \'' . $strBaseURL . "'\n"); + fwrite($filSettings, 'base_path = \'' . $strBasePath . "'\n"); fclose($filSettings); - $strStatusMessage = '' .$this->translate('done'). ''; + $strStatusMessage = '' . $this->translate('done') . ''; } else { - $strStatusMessage = '' .$this->translate('failed'). ''; - $strErrorMessage .= $this->translate('Connot open/write to config/settings.php')."
\n"; + $strStatusMessage = '' . $this->translate('failed') . ''; + $strErrorMessage .= $this->translate('Cannot open/write to config/settings.php') . "
\n"; $intReturn = 1; } return $intReturn; @@ -878,146 +720,147 @@ class NagInstallClass /** * Update settings database - * @param string $strStatusMessage Variable for status message - * @param string $strErrorMessage Error string - * @return int Status variable (0=ok,1=failed) + * @param string|null $strStatusMessage Variable for status message + * @param string|null $strErrorMessage Error string + * @return int Status variable (0=ok,1=failed) */ - public function updateQLpath(&$strStatusMessage, &$strErrorMessage) + public function updateQLpath(string &$strStatusMessage = null, string &$strErrorMessage = null): int { $intReturn = 0; - // Update configuration target database - $strNagiosQLpath = str_replace('//', '/', $this->arrSession['install']['qlpath']. '/'); - $strNagiosPath = str_replace('//', '/', $this->arrSession['install']['nagpath']. '/'); - $strSQL = 'UPDATE `tbl_configtarget` SET ' - . "`basedir`='".$strNagiosQLpath."', " - . "`hostconfig`='".$strNagiosQLpath."hosts/', " - . "`serviceconfig`='".$strNagiosQLpath."services/', " - . "`backupdir`='".$strNagiosQLpath."backup/', " - . "`hostbackup`='".$strNagiosQLpath."backup/hosts/', " - . "`servicebackup`='".$strNagiosQLpath."backup/services/', " - . "`nagiosbasedir`='".$strNagiosPath."', " - . "`importdir`='".$strNagiosPath."objects/', " - . "`conffile`='".$strNagiosPath."nagios.cfg', " + /* Update configuration target database */ + $strNagiosQLpath = str_replace('//', '/', $this->arrSession['install']['qlpath'] . '/'); + $strNagiosPath = str_replace('//', '/', $this->arrSession['install']['nagpath'] . '/'); + $strSQL = 'UPDATE `tbl_configtarget` SET ' + . "`basedir`='" . $strNagiosQLpath . "', " + . "`hostconfig`='" . $strNagiosQLpath . "hosts/', " + . "`serviceconfig`='" . $strNagiosQLpath . "services/', " + . "`backupdir`='" . $strNagiosQLpath . "backup/', " + . "`hostbackup`='" . $strNagiosQLpath . "backup/hosts/', " + . "`servicebackup`='" . $strNagiosQLpath . "backup/services/', " + . "`nagiosbasedir`='" . $strNagiosPath . "', " + . "`importdir`='" . $strNagiosPath . "objects/', " + . "`conffile`='" . $strNagiosPath . "nagios.cfg', " . "`last_modified`=NOW() WHERE `target`='localhost'"; - $booReturn = $this->myDBClass->insertData($strSQL); - if ($booReturn == false) { - $strStatusMessage = '' .$this->translate('failed'). ''; - $strErrorMessage .= $this->translate('Inserting path data to database has failed:'). ' ' . - str_replace('::', '
', $this->myDBClass->strErrorMessage)."\n"; + $booReturn = $this->myDBClass->insertData($strSQL); + if ($booReturn === false) { + $strStatusMessage = '' . $this->translate('failed') . ''; + $strErrorMessage .= $this->translate('Inserting path data to database has failed:') . ' ' . + str_replace('::', '
', $this->myDBClass->strErrorMessage) . "\n"; $intReturn = 1; } - if ($intReturn == 0 && $this->arrSession['install']['createpath'] == 1) { + if ($intReturn === 0 && $this->arrSession['install']['createpath'] === 1) { if (is_writable($strNagiosQLpath) && is_dir($strNagiosQLpath) && is_executable($strNagiosQLpath)) { if (!file_exists($strNagiosQLpath . 'hosts') && !mkdir($strNagiosQLpath . 'hosts', 0755) && !is_dir($strNagiosQLpath . 'hosts')) { - throw new \RuntimeException(sprintf('Directory "%s" was not created', $strNagiosQLpath . 'hosts')); + throw new RuntimeException(sprintf('Directory "%s" was not created', $strNagiosQLpath . 'hosts')); } if (!file_exists($strNagiosQLpath . 'services') && !mkdir($strNagiosQLpath . 'services', 0755) && !is_dir($strNagiosQLpath . 'services')) { - throw new \RuntimeException(sprintf('Directory "%s" was not created', $strNagiosQLpath + throw new RuntimeException(sprintf('Directory "%s" was not created', $strNagiosQLpath . 'services')); } if (!file_exists($strNagiosQLpath . 'backup') && !mkdir($strNagiosQLpath . 'backup', 0755) && !is_dir($strNagiosQLpath . 'backup')) { - throw new \RuntimeException(sprintf('Directory "%s" was not created', $strNagiosQLpath . 'backup')); + throw new RuntimeException(sprintf('Directory "%s" was not created', $strNagiosQLpath . 'backup')); } if (!file_exists($strNagiosQLpath . 'backup/hosts') && !mkdir($strNagiosQLpath . 'backup/hosts', 0755) && !is_dir($strNagiosQLpath . 'backup/hosts')) { - throw new \RuntimeException(sprintf('Directory "%s" was not created', $strNagiosQLpath + throw new RuntimeException(sprintf('Directory "%s" was not created', $strNagiosQLpath . 'backup/hosts')); } if (!file_exists($strNagiosQLpath . 'backup/services') && !mkdir($strNagiosQLpath . 'backup/services', 0755) && !is_dir($strNagiosQLpath . 'backup/services')) { - throw new \RuntimeException(sprintf('Directory "%s" was not created', $strNagiosQLpath + throw new RuntimeException(sprintf('Directory "%s" was not created', $strNagiosQLpath . 'backup/services')); } - $strStatusMessage = '' .$this->translate('done'). ' (' . - $this->translate('Check the permissions of the created paths!'). ')'; + $strStatusMessage = '' . $this->translate('done') . ' (' . + $this->translate('Check the permissions of the created paths!') . ')'; } else { - $strStatusMessage = '' .$this->translate('failed'). ''; + $strStatusMessage = '' . $this->translate('failed') . ''; $strErrorMessage .= $this->translate('NagiosQL config path is not writeable - only database ' - . 'values updated')."
\n"; - $intReturn = 1; + . 'values updated') . "
\n"; + $intReturn = 1; } } - if ($intReturn == 0) { - $strStatusMessage = '' .$this->translate('done'). ''; + if ($intReturn === 0) { + $strStatusMessage = '' . $this->translate('done') . ''; } return $intReturn; } /** * Converting NagiosQL database to utf-8 - * @param string $strStatusMessage Variable for status message - * @param string $strErrorMessage Error string - * @return int Status variable (0=ok,1=failed) + * @param string|null $strStatusMessage Variable for status message + * @param string|null $strErrorMessage Error string + * @return int Status variable (0=ok,1=failed) */ - public function convQLDB(&$strStatusMessage, &$strErrorMessage) + public function convQLDB(string &$strStatusMessage = null, string &$strErrorMessage = null): int { $strDBError = ''; - $intReturn = 0; - if ($this->arrSession['install']['dbtype'] == 'mysqli') { - $strSQL = 'ALTER DATABASE `' .$this->arrSession['install']['dbname']. '` ' + $intReturn = 0; + if ($this->arrSession['install']['dbtype'] === 'mysqli') { + $strSQL = 'ALTER DATABASE `' . $this->arrSession['install']['dbname'] . '` ' . 'DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci'; $this->myDBClass->insertData($strSQL); $strDBError = str_replace('::', '
', $this->myDBClass->strErrorMessage); } - if ($strDBError == '') { - $strStatusMessage = '' .$this->translate('done'). ''; + if ($strDBError === '') { + $strStatusMessage = '' . $this->translate('done') . ''; } else { - $strErrorMessage .= $this->translate('Database errors while converting to utf-8:'). '
' . - $strDBError."
\n"; - $strStatusMessage = '' .$this->translate('failed'). ''; - $intReturn = 1; + $strErrorMessage .= $this->translate('Database errors while converting to utf-8:') . '
' . + $strDBError . "
\n"; + $strStatusMessage = '' . $this->translate('failed') . ''; + $intReturn = 1; } return $intReturn; } /** * Converting NagiosQL database tables to utf-8 - * @param string $strStatusMessage Variable for status message - * @param string $strErrorMessage Error string - * @return int Status variable (0=ok,1=failed) + * @param string|null $strStatusMessage Variable for status message + * @param string|null $strErrorMessage Error string + * @return int Status variable (0=ok,1=failed) */ - public function convQLDBTables(&$strStatusMessage, &$strErrorMessage) + public function convQLDBTables(string &$strStatusMessage = null, string &$strErrorMessage = null): int { - $arrDataset = array(); + $arrDataset = array(); $intDataCount = 0; - $intReturn = 0; - $intError = 0; - $strDBError = ''; + $intReturn = 0; + $intError = 0; + $strDBError = ''; // Read version string from DB - if ($this->arrSession['install']['dbtype'] == 'mysqli') { - $strSQL = 'SHOW TABLES FROM `' .$this->arrSession['install']['dbname']. '`'; + if ($this->arrSession['install']['dbtype'] === 'mysqli') { + $strSQL = 'SHOW TABLES FROM `' . $this->arrSession['install']['dbname'] . '`'; $this->myDBClass->hasDataArray($strSQL, $arrDataset, $intDataCount); - if ($intDataCount != 0) { + if ($intDataCount !== 0) { foreach ($arrDataset as $elem) { - if ($intError == 1) { + if ($intError === 1) { continue; } - $strSQL = 'ALTER TABLE `' .$elem[0]. '` DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci'; + /** @noinspection SqlResolve */ + $strSQL = 'ALTER TABLE `' . $elem[0] . '` DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci'; $booReturn = $this->myDBClass->insertData($strSQL); - if ($booReturn == false) { - $intError = 1; + if ($booReturn === false) { + $intError = 1; $strDBError = str_replace('::', '
', $this->myDBClass->strErrorMessage); } } } } else { - $strErrorMessage .= translate('Database type not defined!'). ' (' .$this->arrSession['install']['dbtype'] - .")
\n"; - $strStatusMessage = '' .translate('failed'). ''; + $strErrorMessage .= translate('Database type not defined!') . ' (' . $this->arrSession['install']['dbtype'] + . ")
\n"; + $strStatusMessage = '' . translate('failed') . ''; $intReturn = 1; } - if ($intReturn == 0) { - if ($strDBError == '') { - $strStatusMessage = '' .translate('done'). ''; + if ($intReturn === 0) { + if ($strDBError === '') { + $strStatusMessage = '' . translate('done') . ''; } else { - $strErrorMessage .= translate('Database errors while converting to utf-8:'). '
' .$strDBError - ."
\n"; - $strStatusMessage = '' .translate('failed'). ''; - $intReturn = 1; + $strErrorMessage .= translate('Database errors while converting to utf-8:') . '
' . $strDBError + . "
\n"; + $strStatusMessage = '' . translate('failed') . ''; + $intReturn = 1; } } return $intReturn; @@ -1025,31 +868,31 @@ class NagInstallClass /** * Converting NagiosQL database tables to utf-8 - * @param string $strStatusMessage Variable for status message - * @param string $strErrorMessage Error string - * @return int Status variable (0=ok,1=failed) + * @param string|null $strStatusMessage Variable for status message + * @param string|null $strErrorMessage Error string + * @return int Status variable (0=ok,1=failed) */ - public function convQLDBFields(&$strStatusMessage, &$strErrorMessage) + public function convQLDBFields(string &$strStatusMessage = null, string &$strErrorMessage = null): int { - $arrDataset1 = array(); - $arrDataset2 = array(); + $arrDataset1 = array(); + $arrDataset2 = array(); $intDataCount1 = 0; $intDataCount2 = 0; - $intReturn = 0; - $intError = 0; - $strDBError = ''; - // Read version string from DB - $strSQL1 = 'SHOW TABLES FROM `' .$this->arrSession['install']['dbname']. '`'; + $intReturn = 0; + $intError = 0; + $strDBError = ''; + /* Read version string from DB */ + $strSQL1 = 'SHOW TABLES FROM `' . $this->arrSession['install']['dbname'] . '`'; $booReturn = $this->myDBClass->hasDataArray($strSQL1, $arrDataset1, $intDataCount1); - if ($booReturn && ($intDataCount1 != 0)) { + if ($booReturn && ($intDataCount1 !== 0)) { foreach ($arrDataset1 as $elem1) { - $strSQL2 = 'SHOW FULL FIELDS FROM `' .$elem1[0]. '` ' + $strSQL2 = 'SHOW FULL FIELDS FROM `' . $elem1[0] . '` ' . "WHERE (`Type` LIKE '%varchar%' OR `Type` LIKE '%enum%' OR `Type` LIKE '%text%') " . "AND Collation <> 'utf8_unicode_ci'"; $this->myDBClass->hasDataArray($strSQL2, $arrDataset2, $intDataCount2); - if ($intDataCount2 != 0) { + if ($intDataCount2 !== 0) { foreach ($arrDataset2 as $elem2) { - if ($intError == 1) { + if ($intError === 1) { continue; } $this->convTabFields($elem1[0], $elem2, $intError, $strDBError); @@ -1057,18 +900,18 @@ class NagInstallClass } } } else { - $strErrorMessage .= translate('Database type not defined!'). ' (' - .$this->arrSession['install']['dbtype'].")
\n"; - $strStatusMessage = '' .translate('failed'). ''; + $strErrorMessage .= translate('Database type not defined!') . ' (' + . $this->arrSession['install']['dbtype'] . ")
\n"; + $strStatusMessage = '' . translate('failed') . ''; $intReturn = 1; } - if ($intReturn == 0) { - if ($strDBError == '') { - $strStatusMessage = '' .translate('done'). ''; + if ($intReturn === 0) { + if ($strDBError === '') { + $strStatusMessage = '' . translate('done') . ''; } else { - $strErrorMessage .= translate('Database errors while converting to utf-8:'). '
' .$strDBError - ."
\n"; - $strStatusMessage = '' .translate('failed'). ''; + $strErrorMessage .= translate('Database errors while converting to utf-8:') . '
' . $strDBError + . "
\n"; + $strStatusMessage = '' . translate('failed') . ''; $intReturn = 1; } } @@ -1077,30 +920,31 @@ class NagInstallClass /** * Convert table fields - * @param string $strTable Table Name - * @param array $arrFields Table fields (array) - * @param int $intError Error Counter - * @param string $strDBError DB error message string + * @param string $strTable Table Name + * @param array $arrFields Table fields (array) + * @param int $intError Error Counter + * @param string $strDBError DB error message string */ - private function convTabFields($strTable, $arrFields, &$intError, &$strDBError) + private function convTabFields(string $strTable, array $arrFields, int &$intError, string &$strDBError): void { $strDefault = ''; - $strNull = 'NOT NULL'; + $strNull = 'NOT NULL'; if (($arrFields[5] === null) && ($arrFields[3] === 'YES')) { $strDefault = 'DEFAULT NULL'; - } elseif ($arrFields[5] != '') { - $strDefault = "DEFAULT '".$arrFields[5]."'"; + } elseif ($arrFields[5] !== '') { + $strDefault = "DEFAULT '" . $arrFields[5] . "'"; } - if ($arrFields[3] == 'YES') { + if ($arrFields[3] === 'YES') { $strNull = 'NULL'; } - $strSQL = /** @lang text */ 'ALTER TABLE `' .$strTable. '` CHANGE `' .$arrFields[0]. '` `' .$arrFields[0] - . '` ' . $arrFields[1]." CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' $strNull $strDefault"; + $strSQL = /** @lang text */ + 'ALTER TABLE `' . $strTable . '` CHANGE `' . $arrFields[0] . '` `' . $arrFields[0] + . '` ' . $arrFields[1] . " CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' $strNull $strDefault"; $booReturn = $this->myDBClass->insertData($strSQL); - if ($booReturn == false) { - $intError = 1; - $strDBError = 'Table:' .$strTable. ' - Field: ' .$arrFields[0]. ' ' . + if ($booReturn === false) { + $intError = 1; + $strDBError = 'Table:' . $strTable . ' - Field: ' . $arrFields[0] . ' ' . $this->myDBClass->strErrorMessage; } } -} +} \ No newline at end of file diff --git a/install/functions/initial_settings.php b/install/functions/initial_settings.php index 31f78ef..6a84799 100644 --- a/install/functions/initial_settings.php +++ b/install/functions/initial_settings.php @@ -10,7 +10,7 @@ exit; ; Project : NagiosQL ; Component : Initial configuration settings ; Website : https://sourceforge.net/projects/nagiosql/ -; Version : 3.4.0 +; Version : 3.5.0 ; GIT Repo : https://gitlab.com/wizonet/NagiosQL ; ; DO NOT USE THIS FILE AS NAGIOSQL SETTINGS FILE! @@ -20,7 +20,7 @@ exit; type = mysqli server = localhost port = 3306 -database = db_nagiosql_v34 +database = db_nagiosql_v35 username = nagiosql_user password = nagiosql_pass [path] @@ -44,4 +44,6 @@ proxy = 0 proxyserver = '' proxyuser = '' proxypasswd = '' -onlineupdate = 0 \ No newline at end of file +onlineupdate = 0 +[performance] +parents = 1 \ No newline at end of file diff --git a/install/functions/prepend_install.php b/install/functions/prepend_install.php index 27df38a..9956bc2 100644 --- a/install/functions/prepend_install.php +++ b/install/functions/prepend_install.php @@ -1,34 +1,35 @@ 'nagiosql_install']); -// -// Include external function/class files -// ===================================== -require $preBasePath.'functions/Autoloader.php'; +*/ +session_start(['name' => 'nagiosql_install']); +/* +Include external function/class files +*/ +require $preBasePath . 'functions/Autoloader.php'; functions\Autoloader::register($preBasePath); -// -// Initialize class -// ================ -$myInstClass = new install\functions\NagInstallClass($_SESSION); +/* +Initialize class +*/ +$myInstClass = new install\functions\NagInstallClass($_SESSION); \ No newline at end of file diff --git a/install/index.php b/install/index.php index 3975ef1..b83010f 100644 --- a/install/index.php +++ b/install/index.php @@ -1,77 +1,83 @@ 'nagiosql_install']); -// -// POST parameters -// =============== +session_start(['name' => 'nagiosql_install']); +/* +POST parameters +*/ $arrLocale = array('zh_CN', 'de_DE', 'da_DK', 'en_GB', 'fr_FR', 'it_IT', 'ja_JP', 'nl_NL', 'pl_PL', 'pt_BR', 'ru_RU', 'es_ES'); -$chkLocale = filter_input(INPUT_POST, 'selLanguage', FILTER_SANITIZE_STRING); +$chkLocale = filter_input(INPUT_POST, 'selLanguage'); if (!in_array($chkLocale, $arrLocale, true)) { $chkLocale = 'no'; } -// -// Language settings -// ================= +/* +Language settings +*/ if (extension_loaded('gettext')) { - if ($chkLocale == 'no') { - if (0 === strpos(filter_input(INPUT_SERVER, 'HTTP_ACCEPT_LANGUAGE', FILTER_SANITIZE_STRING), 'de')) { + if ($chkLocale === 'no') { + if (0 === strpos(filter_input(INPUT_SERVER, 'HTTP_ACCEPT_LANGUAGE'), 'de')) { $chkLocale = 'de_DE'; } else { $chkLocale = 'en_GB'; } } - putenv('LC_ALL=' .$chkLocale. '.' .$preEncode); - putenv('LANG=' .$chkLocale. '.' .$preEncode); - setlocale(LC_ALL, $chkLocale. '.' .$preEncode); + putenv('LC_ALL=' . $chkLocale . '.' . $preEncode); + putenv('LANG=' . $chkLocale . '.' . $preEncode); + setlocale(LC_ALL, $chkLocale . '.' . $preEncode); bindtextdomain($chkLocale, $preLocale); bind_textdomain_codeset($chkLocale, $preEncode); textdomain($chkLocale); $arrTemplate['NAGIOS_FAQ'] = $myInstClass->translate('Online Documentation'); - // Language selection field - $arrTemplate['LANGUAGE'] = $myInstClass->translate('Language'); + /* Language selection field */ + $arrTemplate['LANGUAGE'] = $myInstClass->translate('Language'); foreach ($myInstClass->getLangData() as $key => $elem) { - $strLangOpt .= "\n"; - if ($key != $chkLocale) { + /** @noinspection HtmlUnknownAttribute */ + $strLangOpt .= "\n"; + if ($key !== $chkLocale) { $strLangOpt = str_replace(' {sel}', '', $strLangOpt); } else { $strLangOpt = str_replace(' {sel}', ' selected', $strLangOpt); @@ -79,50 +85,48 @@ if (extension_loaded('gettext')) { } $arrTemplate['LANG_OPTION'] = $strLangOpt; } else { - $intError = 1; + $intError = 1; $strErrorMessage .= 'Installation cannot continue, please make sure you have the php-gettext extension loaded!'; } -// -// Checking current installation -// ============================= -// Does the settings file exist? +/* +Checking current installation +/* +/* Does the settings file exist? */ if (file_exists($filConfig) && is_readable($filConfig)) { $preSettings = parse_ini_file($filConfig, true); - // Are there any database connection data? - if (isset($preSettings['db']) && isset($preSettings['db']['server']) && isset($preSettings['db']['port']) && - isset($preSettings['db']['database']) && isset($preSettings['db']['username']) && - isset($preSettings['db']['password'])) { - // Old mysql db module is no longer supported - if (!isset($preSettings['db']['type']) || ($preSettings['db']['type'] == 'mysql') || - ($preSettings['db']['type'] == '')) { + /* Are there any database connection data? */ + if (isset($preSettings['db']['server'], $preSettings['db']['port'], $preSettings['db']['database'], $preSettings['db']['username'], $preSettings['db']['password'])) { + /* Old mysql db module is no longer supported */ + if (!isset($preSettings['db']['type']) || ($preSettings['db']['type'] === 'mysql') || + ($preSettings['db']['type'] === '')) { $preSettings['db']['type'] = 'mysqli'; } - // Copy settings to session + /* Copy settings to session */ $_SESSION['SETS'] = $preSettings; - // Select database + /* Select database */ $intDBFallback = 0; - if (($preSettings['db']['type'] == 'mysqli') && extension_loaded('mysqli')) { - // Initialize mysqli class + if (($preSettings['db']['type'] === 'mysqli') && extension_loaded('mysqli')) { + /* Initialize mysqli class */ $myDBClass = new functions\MysqliDbClass; - // Set DB parameters - $myDBClass->arrParams['server'] = $preSettings['db']['server']; - $myDBClass->arrParams['port'] = $preSettings['db']['port']; + /* Set DB parameters */ + $myDBClass->arrParams['server'] = $preSettings['db']['server']; + $myDBClass->arrParams['port'] = $preSettings['db']['port']; $myDBClass->arrParams['username'] = $preSettings['db']['username']; $myDBClass->arrParams['password'] = $preSettings['db']['password']; $myDBClass->arrParams['database'] = $preSettings['db']['database']; $myDBClass->hasDBConnection(); - if ($myDBClass->error == true) { + if ($myDBClass->error === true) { $strErrorMessage .= $myInstClass->translate('Database connection failed. Upgrade not available!') . '
'; $strErrorMessage .= str_replace('::', '
', $myDBClass->strErrorMessage) . '
'; } else { - $strSQL = 'SELECT `category`, `name`, `value` FROM `tbl_settings`'; + $strSQL = 'SELECT `category`, `name`, `value` FROM `tbl_settings`'; $booReturn = $myDBClass->hasDataArray($strSQL, $arrDataLines, $intDataCount); - if ($booReturn == false) { - $strErrorMessage .= $myInstClass->translate('Settings table not available or wrong. ' - . 'Upgrade not available!'). '
'; + if ($booReturn === false) { + $strErrorMessage .= $myInstClass->translate('Settings table not available or wrong. Upgrade not available!') . + '
'; $strErrorMessage .= str_replace('::', '
', $myDBClass->strErrorMessage) . '
'; - } elseif ($intDataCount != 0) { + } elseif ($intDataCount !== 0) { foreach ($arrDataLines as $elem) { $preSettings[$elem['category']][$elem['name']] = $elem['value']; } @@ -130,76 +134,74 @@ if (file_exists($filConfig) && is_readable($filConfig)) { } } } else { - $strErrorMessage .= $myInstClass->translate('Invalid database type in settings file ' - . '(config/settings.php). Upgrade not available!'); + $strErrorMessage .= $myInstClass->translate('Invalid database type in settings file (config/settings.php). Upgrade not available!') . + '
'; } } else { - $strErrorMessage .= $myInstClass->translate('Database values in settings file are missing ' - . '(config/settings.php). Upgrade not available!'); + $strErrorMessage .= $myInstClass->translate('Database values in settings file are missing (config/settings.php). Upgrade not available!') . + '
'; } } else { - $strErrorMessage .= $myInstClass->translate('Settings file not found or not readable (config/settings.php). ' - . 'Upgrade not available!'); + $strErrorMessage .= $myInstClass->translate('Settings file not found or not readable (config/settings.php). Upgrade not available!') . + '
'; } -// -// Initial settings (new installation) -// =================================== +/* +Initial settings (new installation) +*/ $filInit = 'functions/initial_settings.php'; if (file_exists($filInit) && is_readable($filInit)) { $preInit = parse_ini_file($filInit, true); $_SESSION['init_settings'] = $preInit; } else { - $strErrorMessage .= $myInstClass->translate('Default values file is not available or not readable ' - . '(install/functions/initial_settings.php). Installation possible, ' - . 'but without predefined data!'); + $strErrorMessage .= $myInstClass->translate('Default values file is not available or not readable (install/functions/initial_settings.php). Installation possible, but without predefined data!') . + '
'; } -// -// Build content -// ============= -$arrTemplate['PAGETITLE'] = '[NagiosQL] ' .$myInstClass->translate('Installation wizard'); -$arrTemplate['MAIN_TITLE'] = $myInstClass->translate('Welcome to the NagiosQL installation wizard'); -$arrTemplate['TEXT_PART_1'] = $myInstClass->translate('This wizard will help you to install and configure ' - . 'NagiosQL.'); -$arrTemplate['TEXT_PART_2'] = $myInstClass->translate('For questions please visit'). ': '; -$arrTemplate['TEXT_PART_3'] = $myInstClass->translate("First let's check your local environment and find out if " - . 'everything NagiosQL needs is available.'); -$arrTemplate['TEXT_PART_4'] = $myInstClass->translate('The basic requirements are:'); -$arrTemplate['TEXT_PART_5'] = $myInstClass->translate('PHP 5.5.0 or greater including:'); -$arrTemplate['TEXT_PHP_REQ_1'] = $myInstClass->translate('PHP database module:'). ' ' . - $myInstClass->translate('supported types are'). ' mysqli'; -$arrTemplate['TEXT_PHP_REQ_2'] = $myInstClass->translate('PHP module:'). ' session'; -$arrTemplate['TEXT_PHP_REQ_3'] = $myInstClass->translate('PHP module:'). ' gettext'; -$arrTemplate['TEXT_PHP_REQ_6'] = $myInstClass->translate('PHP module:'). ' filter'; -$arrTemplate['TEXT_PHP_REQ_8'] = $myInstClass->translate('PHP module:'). ' FTP ' . +/* +Build content +*/ +$arrTemplate['PAGETITLE'] = '[NagiosQL] ' . $myInstClass->translate('Installation wizard'); +$arrTemplate['MAIN_TITLE'] = $myInstClass->translate('Welcome to the NagiosQL installation wizard'); +$arrTemplate['TEXT_PART_1'] = $myInstClass->translate('This wizard will help you to install and configure NagiosQL.'); +$arrTemplate['TEXT_PART_2'] = $myInstClass->translate('For questions please visit') . ': '; +$arrTemplate['TEXT_PART_3'] = $myInstClass->translate("First let's check your local environment and find out if everything NagiosQL needs is available."); +$arrTemplate['TEXT_PART_4'] = $myInstClass->translate('The basic requirements are:'); +$arrTemplate['TEXT_PART_5'] = $myInstClass->translate('PHP 7.2.0 or above (PHP 8 is recommended) including:'); +$arrTemplate['TEXT_PHP_REQ_1'] = $myInstClass->translate('PHP database module:') . ' ' . + $myInstClass->translate('supported types are') . ' mysqli'; +$arrTemplate['TEXT_PHP_REQ_2'] = $myInstClass->translate('PHP module:') . ' session'; +$arrTemplate['TEXT_PHP_REQ_3'] = $myInstClass->translate('PHP module:') . ' gettext'; +$arrTemplate['TEXT_PHP_REQ_6'] = $myInstClass->translate('PHP module:') . ' filter'; +$arrTemplate['TEXT_PHP_REQ_8'] = $myInstClass->translate('PHP module:') . ' FTP ' . $myInstClass->translate('(optional)'); -$arrTemplate['TEXT_PHP_REQ_10'] = $myInstClass->translate('PECL extension:'). ' SSH ' . +$arrTemplate['TEXT_PHP_REQ_10'] = $myInstClass->translate('PECL extension:') . ' SSH ' . $myInstClass->translate('(optional)'); -$arrTemplate['TEXT_PART_6'] = $myInstClass->translate('php.ini options'). ':'; -$arrTemplate['TEXT_INI_REQ_1'] = $myInstClass->translate('file_uploads on (for upload features)'); -$arrTemplate['TEXT_INI_REQ_2'] = $myInstClass->translate('session.auto_start needs to be off'); -$arrTemplate['TEXT_PART_7'] = $myInstClass->translate('A database server'); -$arrTemplate['TEXT_PART_8'] = $myInstClass->translate('Nagios 2.x/3.x/4.x'); -$arrTemplate['TEXT_PART_9'] = $myInstClass->translate('NagiosQL version'). ' ' .$strVersion; -$arrTemplate['LOCALE'] = $chkLocale; -$arrTemplate['ONLINE_DOC'] = $myInstClass->translate('Online documentation'); -// -// New installation or upgrade -// =========================== +$arrTemplate['TEXT_PART_6'] = $myInstClass->translate('php.ini options') . ':'; +$arrTemplate['TEXT_INI_REQ_1'] = $myInstClass->translate('file_uploads on (for upload features)'); +$arrTemplate['TEXT_INI_REQ_2'] = $myInstClass->translate('session.auto_start needs to be off'); +$arrTemplate['TEXT_INI_REQ_3'] = $myInstClass->translate('date.timezone should be set to your local timezone'); +$arrTemplate['TEXT_PART_7'] = $myInstClass->translate('A database server'); +$arrTemplate['TEXT_PART_8'] = $myInstClass->translate('Nagios 2.x/3.x/4.x'); +$arrTemplate['TEXT_PART_9'] = $myInstClass->translate('NagiosQL version') . ' ' . $strVersion; +$arrTemplate['LOCALE'] = $chkLocale; +$arrTemplate['ONLINE_DOC'] = $myInstClass->translate('Online documentation'); +/* +New installation or upgrade +*/ $arrTemplate['NEW_INSTALLATION'] = $myInstClass->translate('START INSTALLATION'); -$arrTemplate['UPDATE'] = $myInstClass->translate('START UPDATE'); -$arrTemplate['DISABLE_NEW'] = ''; -$arrTemplate['UPDATE_ERROR'] = '
' .$strErrorMessage. '
'; -if ($intUpdate == 1) { +$arrTemplate['UPDATE'] = $myInstClass->translate('START UPDATE'); +$arrTemplate['DISABLE_NEW'] = ''; +$arrTemplate['UPDATE_ERROR'] = '
' . $strErrorMessage . '
'; +if ($intUpdate === 1) { $arrTemplate['DISABLE_UPDATE'] = ''; } else { $arrTemplate['DISABLE_UPDATE'] = "disabled=\disabled\""; } -if ($intError == 1) { - $arrTemplate['DISABLE_NEW'] = "disabled=\disabled\""; +if ($intError === 1) { + $arrTemplate['DISABLE_NEW'] = "disabled=\disabled\""; $arrTemplate['DISABLE_UPDATE'] = "disabled=\disabled\""; } -// -// Write content -// ============= +/* +Write content +*/ $strContent = $myInstClass->parseTemplate($arrTemplate, $preContent); -echo $strContent; +echo $strContent; \ No newline at end of file diff --git a/install/install.php b/install/install.php index e071f8a..7fd57e5 100644 --- a/install/install.php +++ b/install/install.php @@ -1,165 +1,149 @@ array('default' => 0)) ); -$strSqlFile = str_replace('DBTYPE', $_SESSION['install']['dbtype'], $preSqlNewInstall); -if (filter_input(INPUT_POST, 'butNewInstall') != null) { +$strSqlFile = str_replace('DBTYPE', $_SESSION['install']['dbtype'], $preSqlNewInstall); +if (filter_input(INPUT_POST, 'butNewInstall') !== null) { $chkModus = 'Installation'; } -if (filter_input(INPUT_POST, 'butUpgrade') != null) { +if (filter_input(INPUT_POST, 'butUpgrade') !== null) { $chkModus = 'Update'; } if (!isset($_SESSION['install']['mode'])) { $_SESSION['install']['mode'] = $chkModus; } -// -// Language settings -// ================= +/* +Language settings +*/ if (extension_loaded('gettext')) { - putenv('LC_ALL=' .$_SESSION['install']['locale'].$preEncode); - putenv('LANG=' .$_SESSION['install']['locale'].$preEncode); - // GETTEXT domain - setlocale(LC_ALL, $_SESSION['install']['locale']. '.' .$preEncode); + putenv('LC_ALL=' . $_SESSION['install']['locale'] . $preEncode); + putenv('LANG=' . $_SESSION['install']['locale'] . $preEncode); + setlocale(LC_ALL, $_SESSION['install']['locale'] . '.' . $preEncode); bindtextdomain($_SESSION['install']['locale'], $preLocale); bind_textdomain_codeset($_SESSION['install']['locale'], $preEncode); textdomain($_SESSION['install']['locale']); } $myInstClass->arrSession = $_SESSION; -// -// Content in buffer laden -// ======================= +/* +Content in buffer laden +*/ ob_start(); -include 'step' .$chkStep. '.php'; -$strContentRaw = ob_get_contents(); -ob_end_clean(); -// -// Build content -// ============= -$arrTemplate['PAGETITLE'] = '[NagiosQL] Installation Wizard'; +include 'step' . $chkStep . '.php'; +$strContentRaw = ob_get_clean(); +/* +Build content +*/ +$arrTemplate['PAGETITLE'] = '[NagiosQL] Installation Wizard'; $arrTemplate['MAIN_TITLE'] = $myInstClass->translate('Welcome to the NagiosQL Installation Wizard'); -$arrTemplate['CONTENT'] = $strContentRaw; -// -// Write content -// ============= +$arrTemplate['CONTENT'] = $strContentRaw; +/* +Write content +*/ $myInstClass->filTemplate = $preContent; $strContent = $myInstClass->parseTemplate($arrTemplate, $preContent); -echo $strContent; +echo $strContent; \ No newline at end of file diff --git a/install/sql/import_nagios_sample.sql b/install/sql/import_nagios_sample.sql index 493dd9e..24ae129 100644 --- a/install/sql/import_nagios_sample.sql +++ b/install/sql/import_nagios_sample.sql @@ -5,12 +5,12 @@ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --- (c) 2005-2018 by Martin Willisegger +-- (c) 2005-2022 by Martin Willisegger -- -- Project : NagiosQL -- Component : Import samples build from Nagios 3.0.5 configuration samples -- Website : https://sourceforge.net/projects/nagiosql/ --- Version : 3.4.0 +-- Version : 3.5.0 -- GIT Repo : https://gitlab.com/wizonet/NagiosQL -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff --git a/install/sql/nagiosQL_v32_db_mysql.sql b/install/sql/nagiosQL_v32_db_mysql.sql index 7f4fba2..75d7f37 100644 --- a/install/sql/nagiosQL_v32_db_mysql.sql +++ b/install/sql/nagiosQL_v32_db_mysql.sql @@ -5,12 +5,12 @@ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --- (c) 2005-2018 by Martin Willisegger +-- (c) 2005-2023 by Martin Willisegger -- -- Project : NagiosQL -- Component : Complete NagiosQL Database -- Website : https://sourceforge.net/projects/nagiosql/ --- Version : 3.4.0 +-- Version : 3.5.0 -- GIT Repo : https://gitlab.com/wizonet/NagiosQL -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff --git a/install/sql/nagiosQL_v341_db_mysql.sql b/install/sql/nagiosQL_v341_db_mysql.sql new file mode 100644 index 0000000..4b3264c --- /dev/null +++ b/install/sql/nagiosQL_v341_db_mysql.sql @@ -0,0 +1,2862 @@ +-- +-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +-- +-- NagiosQL +-- +-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +-- +-- (c) 2005-2023 by Martin Willisegger +-- +-- Project : NagiosQL +-- Component : Complete NagiosQL Database +-- Website : https://sourceforge.net/projects/nagiosql/ +-- Version : 3.5.0 +-- GIT Repo : https://gitlab.com/wizonet/NagiosQL +-- +-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; +SET NAMES 'utf8'; + +-- +-- Structure for table `tbl_command` +-- + +CREATE TABLE IF NOT EXISTS `tbl_command` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `command_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `command_line` text COLLATE utf8_unicode_ci NOT NULL, + `command_type` tinyint(3) unsigned NOT NULL DEFAULT '0', + `arg1_info` text COLLATE utf8_unicode_ci DEFAULT NULL, + `arg2_info` text COLLATE utf8_unicode_ci DEFAULT NULL, + `arg3_info` text COLLATE utf8_unicode_ci DEFAULT NULL, + `arg4_info` text COLLATE utf8_unicode_ci DEFAULT NULL, + `arg5_info` text COLLATE utf8_unicode_ci DEFAULT NULL, + `arg6_info` text COLLATE utf8_unicode_ci DEFAULT NULL, + `arg7_info` text COLLATE utf8_unicode_ci DEFAULT NULL, + `arg8_info` text COLLATE utf8_unicode_ci DEFAULT NULL, + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(10) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`command_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_command` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_configtarget` +-- + +CREATE TABLE `tbl_configtarget` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `target` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `server` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `port` int(10) UNSIGNED NOT NULL DEFAULT '22', + `method` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `user` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `ssh_key_path` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `ftp_secure` tinyint(3) UNSIGNED NOT NULL DEFAULT '0', + `basedir` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `hostconfig` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `serviceconfig` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `backupdir` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `hostbackup` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `servicebackup` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `nagiosbasedir` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `importdir` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `picturedir` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `commandfile` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `binaryfile` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `pidfile` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `conffile` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `cgifile` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `resourcefile` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `version` tinyint(3) UNSIGNED NOT NULL DEFAULT '3', + `access_group` int(10) UNSIGNED NOT NULL DEFAULT '0', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `nodelete` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', + `last_modified` datetime NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `target` (`target`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; +-- +-- Datasets for table `tbl_configtarget` +-- +INSERT INTO `tbl_configtarget` (`id`, `target`, `alias`, `server`, `method`, `user`, `password`, `ssh_key_path`, `ftp_secure`, `basedir`, `hostconfig`, `serviceconfig`, `backupdir`, `hostbackup`, `servicebackup`, `nagiosbasedir`, `importdir`, `picturedir`, `commandfile`, `binaryfile`, `pidfile`, `conffile`, `cgifile`, `resourcefile`, `version`, `access_group`, `active`, `nodelete`, `last_modified`) VALUES (1, 'localhost', 'Local installation', 'localhost', '1', '', '', '', 0, '/etc/nagiosql/', '/etc/nagiosql/hosts/', '/etc/nagiosql/services/', '/etc/nagiosql/backup/', '/etc/nagiosql/backup/hosts/', '/etc/nagiosql/backup/services/', '/etc/nagios/', '/opt/nagios/etc/objects/', '', '/var/nagios/rw/nagios.cmd', '/opt/nagios/bin/nagios', '/var/nagios/nagios.lock', '/etc/nagios/nagios.cfg', '/etc/nagios/cgi.cfg', '/etc/nagios/resource.cfg', 3, 0, '1', '1', NOW()); + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_contact` +-- +CREATE TABLE IF NOT EXISTS `tbl_contact` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `contact_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `contactgroups` int(10) unsigned NOT NULL DEFAULT '0', + `contactgroups_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `minimum_importance` int(11) DEFAULT NULL, + `host_notifications_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `service_notifications_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `host_notification_period` int(10) unsigned NOT NULL DEFAULT '0', + `service_notification_period` int(10) unsigned NOT NULL DEFAULT '0', + `host_notification_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `service_notification_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `host_notification_commands` int(10) unsigned NOT NULL DEFAULT '0', + `host_notification_commands_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `service_notification_commands` int(10) unsigned NOT NULL DEFAULT '0', + `service_notification_commands_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `can_submit_commands` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_status_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_nonstatus_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `pager` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address1` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address2` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address3` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address4` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address5` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address6` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `use_variables` tinyint(3) unsigned NOT NULL DEFAULT '0', + `use_template` tinyint(3) unsigned NOT NULL DEFAULT '0', + `use_template_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(10) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`contact_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_contact` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_contactgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_contactgroup` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `contactgroup_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `members` int(10) unsigned NOT NULL DEFAULT '0', + `contactgroup_members` int(10) unsigned NOT NULL DEFAULT '0', + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(10) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`contactgroup_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_contactgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_contacttemplate` +-- + +CREATE TABLE IF NOT EXISTS `tbl_contacttemplate` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `template_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `contactgroups` int(10) unsigned NOT NULL DEFAULT '0', + `contactgroups_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `minimum_importance` int(11) DEFAULT NULL, + `host_notifications_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `service_notifications_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `host_notification_period` int(11) NOT NULL DEFAULT '0', + `service_notification_period` int(11) NOT NULL DEFAULT '0', + `host_notification_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `service_notification_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `host_notification_commands` int(10) unsigned NOT NULL DEFAULT '0', + `host_notification_commands_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `service_notification_commands` int(10) unsigned NOT NULL DEFAULT '0', + `service_notification_commands_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `can_submit_commands` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_status_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_nonstatus_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `pager` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address1` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address2` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address3` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address4` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address5` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address6` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `use_variables` tinyint(3) unsigned NOT NULL DEFAULT '0', + `use_template` tinyint(3) unsigned NOT NULL DEFAULT '0', + `use_template_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(10) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`template_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_contacttemplate` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_datadomain` +-- + + +CREATE TABLE IF NOT EXISTS `tbl_datadomain` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `domain` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `targets` int(10) unsigned NOT NULL, + `version` tinyint(3) unsigned NOT NULL DEFAULT '3', + `enable_common` tinyint(3) unsigned NOT NULL DEFAULT '0', + `utf8_decode` tinyint(3) unsigned NOT NULL DEFAULT '0', + `access_group` int(10) unsigned NOT NULL DEFAULT '0', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `nodelete` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', + `last_modified` datetime NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `domain` (`domain`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_datadomain` +-- + +INSERT INTO `tbl_datadomain` (`id`, `domain`, `alias`, `targets`, `version`, `enable_common`, `utf8_decode`, `access_group`, `active`, `nodelete`, `last_modified`) VALUES(0, 'common', 'Global common domain', 0, 3, 0, 0, 0, '1', '1', NOW()); +UPDATE `tbl_datadomain` SET `id` = '0' WHERE `domain` = 'common'; +ALTER TABLE `tbl_datadomain` AUTO_INCREMENT = 1; +INSERT INTO `tbl_datadomain` (`id`, `domain`, `alias`, `targets`, `version`, `enable_common`, `utf8_decode`, `access_group`, `active`, `nodelete`, `last_modified`) VALUES(1, 'localhost', 'Local installation', 1, 3, 1, 0, 0, '1', '1', NOW()); + + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_group` +-- + +CREATE TABLE IF NOT EXISTS `tbl_group` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `groupname` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `users` tinyint(3) unsigned NOT NULL DEFAULT '0', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_group` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_host` +-- + +CREATE TABLE IF NOT EXISTS `tbl_host` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `host_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `display_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `parents` tinyint(3) unsigned NOT NULL DEFAULT '0', + `parents_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `importance` int(11) DEFAULT NULL, + `hostgroups` tinyint(3) unsigned NOT NULL DEFAULT '0', + `hostgroups_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_command` text COLLATE utf8_unicode_ci NOT NULL, + `use_template` tinyint(3) unsigned NOT NULL DEFAULT '0', + `use_template_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `initial_state` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `max_check_attempts` int(11) DEFAULT NULL, + `check_interval` int(11) DEFAULT NULL, + `retry_interval` int(11) DEFAULT NULL, + `active_checks_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `passive_checks_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_period` int(11) NOT NULL DEFAULT '0', + `obsess_over_host` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_freshness` tinyint(3) unsigned NOT NULL DEFAULT '2', + `freshness_threshold` int(11) DEFAULT NULL, + `event_handler` int(11) NOT NULL DEFAULT '0', + `event_handler_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `low_flap_threshold` int(11) DEFAULT NULL, + `high_flap_threshold` int(11) DEFAULT NULL, + `flap_detection_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `flap_detection_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `process_perf_data` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_status_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_nonstatus_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `contacts` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contacts_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `contact_groups` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contact_groups_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `notification_interval` int(11) DEFAULT NULL, + `notification_period` int(11) NOT NULL DEFAULT '0', + `first_notification_delay` int(11) DEFAULT NULL, + `notification_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `notifications_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `stalking_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `notes` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `notes_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `action_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `icon_image` varchar(500) COLLATE utf8_unicode_ci NOT NULL, + `icon_image_alt` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `vrml_image` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `statusmap_image` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `2d_coords` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `3d_coords` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `use_variables` tinyint(3) unsigned NOT NULL DEFAULT '0', + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(10) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`host_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_host` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_hostdependency` +-- + +CREATE TABLE IF NOT EXISTS `tbl_hostdependency` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `config_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `dependent_host_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `dependent_hostgroup_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `host_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `hostgroup_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `inherits_parent` tinyint(3) unsigned NOT NULL DEFAULT '0', + `execution_failure_criteria` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `notification_failure_criteria` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `dependency_period` int(11) NOT NULL DEFAULT '0', + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + `import_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`config_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_hostdependency` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_hostescalation` +-- + +CREATE TABLE IF NOT EXISTS `tbl_hostescalation` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `config_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `host_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `hostgroup_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contacts` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contact_groups` tinyint(3) unsigned NOT NULL DEFAULT '0', + `first_notification` int(11) DEFAULT NULL, + `last_notification` int(11) DEFAULT NULL, + `notification_interval` int(11) DEFAULT NULL, + `escalation_period` int(11) NOT NULL DEFAULT '0', + `escalation_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + `import_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`config_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_hostescalation` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_hostextinfo` +-- + +CREATE TABLE IF NOT EXISTS `tbl_hostextinfo` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `host_name` int(11) NOT NULL, + `notes` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `notes_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `action_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `statistik_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `icon_image` varchar(500) COLLATE utf8_unicode_ci NOT NULL, + `icon_image_alt` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `vrml_image` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `statusmap_image` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `2d_coords` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `3d_coords` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`host_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_hostextinfo` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_hostgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_hostgroup` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `hostgroup_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `members` tinyint(3) unsigned NOT NULL DEFAULT '0', + `hostgroup_members` tinyint(3) unsigned NOT NULL DEFAULT '0', + `notes` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `notes_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `action_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`hostgroup_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_hostgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_hosttemplate` +-- + +CREATE TABLE IF NOT EXISTS `tbl_hosttemplate` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `template_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `parents` tinyint(3) unsigned NOT NULL DEFAULT '0', + `parents_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `importance` int(11) DEFAULT NULL, + `hostgroups` tinyint(3) unsigned NOT NULL DEFAULT '0', + `hostgroups_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_command` text COLLATE utf8_unicode_ci NOT NULL, + `use_template` tinyint(3) unsigned NOT NULL DEFAULT '0', + `use_template_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `initial_state` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `max_check_attempts` int(11) DEFAULT NULL, + `check_interval` int(11) DEFAULT NULL, + `retry_interval` int(11) DEFAULT NULL, + `active_checks_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `passive_checks_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_period` int(11) NOT NULL DEFAULT '0', + `obsess_over_host` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_freshness` tinyint(3) unsigned NOT NULL DEFAULT '2', + `freshness_threshold` int(11) DEFAULT NULL, + `event_handler` int(11) NOT NULL DEFAULT '0', + `event_handler_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `low_flap_threshold` int(11) DEFAULT NULL, + `high_flap_threshold` int(11) DEFAULT NULL, + `flap_detection_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `flap_detection_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `process_perf_data` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_status_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_nonstatus_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `contacts` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contacts_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `contact_groups` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contact_groups_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `notification_interval` int(11) DEFAULT NULL, + `notification_period` int(11) NOT NULL DEFAULT '0', + `first_notification_delay` int(11) DEFAULT NULL, + `notification_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `notifications_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `stalking_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `notes` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `notes_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `action_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `icon_image` varchar(500) COLLATE utf8_unicode_ci NOT NULL, + `icon_image_alt` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `vrml_image` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `statusmap_image` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `2d_coords` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `3d_coords` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `use_variables` tinyint(3) unsigned NOT NULL DEFAULT '0', + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`template_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_hosttemplate` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_info` +-- + +CREATE TABLE IF NOT EXISTS `tbl_info` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `key1` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `key2` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `version` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `language` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `infotext` text COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + KEY `keypair` (`key1`,`key2`,`version`,`language`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_info` +-- + +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(1, 'domain', 'domain', 'all', 'default', 'Common name of this domain. This field is for internal use only.'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(2, 'domain', 'basedir', 'all', 'default', '

Absolute path to your NagiosQL configuration directory.

Examples:
/etc/nagiosql/
/usr/local/nagiosql/etc/

Be sure, that your configuration path settings are matching with your nagios.cfg! (cfg_file=/etc/nagiosql/timeperiods.cfg)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(3, 'domain', 'hostdir', 'all', 'default', 'NagiosQL writes one configuration file for every host. It is useful to store this files inside an own subdirectory below your Nagios configuration path.

Examples:
/etc/nagios/hosts
/usr/local/nagios/etc/hosts

Be sure, that your configuration settings are matching with your nagios.cfg!
(cfg_dir=/etc/nagios/hosts)'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(4, 'domain', 'servicedir', 'all', 'default', 'NagiosQL writes services grouped into files identified by the service configuration names. It is useful to store this files inside an own subdirectory below your Nagios configuration path.

Examples:
/etc/nagios/services
/usr/local/nagios/etc/services

Be sure, that your configuration settings are matching with your nagios.cfg!
(cfg_dir=/etc/nagios/services)'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(5, 'domain', 'backupdir', 'all', 'default', 'Absolute path to your NagiosQL configuration backup directory.

Examples:
/etc/nagios/backup
/usr/local/nagios/etc/backup

This directory is for internal configuration backups of NagiosQL and is not used by Nagios itself. '); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(6, 'domain', 'backuphostdir', 'all', 'default', 'Absolute path to your NagiosQL host configuration backup directory.

Examples:
/etc/nagios/backup/hosts
/usr/local/nagios/etc/backup/hosts

This directory is for internal configuration backups of NagiosQL only and is not used by Nagios itself.'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(7, 'domain', 'backupservicedir', 'all', 'default', 'Absolute path to your NagiosQL service configuration backup directory.

Examples:
/etc/nagios/backup/services
/usr/local/nagios/etc/backup/services

This directory is for internal configuration backups of NagiosQL only and is not used by Nagios itself.'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(8, 'domain', 'commandfile', 'all', 'default', 'Absolute path to your Nagios command file.

Examples:
/var/spool/nagios/nagios.cmd
/usr/local/nagios/var/rw/nagios.cmd

Be sure, that your command file path settings are matching with your nagios.cfg! (command_file=/var/spool/nagios/nagios.cmd)
(check_external_commands=1)

\r\nThis is used to reload Nagios directly from NagiosQL after changing a configuration.'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(9, 'common', 'accesskeys', 'all', 'default', '

Access key/keyholes

\r\n

NagiosQL uses a very simplified access control mechanism by using up to 8 keys.

\r\n

To access a secure object (menu, domain), a user must have a key for every defined keyhole.

\r\n

Example:

\r\n

User A has key 1,2,5,7 (can be defined in user management)
User B has key 3,5,7,8 (can be defined in user management)

\r\n

Menu 1 has keyhole 3,5
Menu 2 has keyhole 2,5,7
Menu 3 has no keyhole
Menu 4 has keyhole 4

User A has access to menu 2 and menu 3 (key 3 for menu 1 and key 4 for menu 4 are missing)
User B has access to menu 1 and menu 3 (key 2 for menu 2 and key 4 for menu 4 are missing)

\r\n

 

\r\n

 

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(10, 'user', 'webserverauth', 'all', 'default', '

User - webserver authentification

\r\n

If your webserver uses authentification and the NagiosQL user name is the same which is actually logged in - the NagiosQL login process will passed. This means, that NagiosQL no longer shows a login page if this user is already logged in by webserver authentification.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(11, 'domain', 'nagiosbasedir', 'all', 'default', '

Absolute path to your Nagios configuration directory.

Examples:
/etc/nagios/
/usr/local/nagios/etc/

\r\n

Be sure, that your nagios.cfg and cfg.cfg ist located inside this directory. NagiosQL uses this to handle this two files.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(12, 'domain', 'importdir', 'all', 'default', '

Absolute path to your configuration import directory.

Examples:
/etc/nagiosql/import/
/usr/local/nagios/etc/import/

\r\n

You can use this directory to store old or example configuration files in it which should be accessable by the importer of NagiosQL.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(13, 'domain', 'binary', 'all', 'default', '

Absolute path to your Nagios binary file.

Examples:
/usr/bin/nagios
/usr/local/nagios/bin/nagios

This is used to verify your configuration.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(14, 'domain', 'pidfile', 'all', 'default', '

Absolute path to your Nagios process file.

Examples:
/var/run/nagios/nagios.pid
/var/run/nagios/nagios.lock

This is used to check if nagios is running before sending a reload command to the nagios command file.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(15, 'domain', 'version', 'all', 'default', '

The nagios version which is running in this domain.

\r\n

Be sure you select the correct version here - otherwise not all configuration options are available or not supported options are shown.

\r\n

You can change this with a running configuration - NagiosQL will then upgrade or downgrade your configuration. Don\'t forget to write your complete configuration after a version change!

\r\n

Difference between version in data domain and configuration domain:

\r\n
    \r\n
  • The version information of the data domain is used to define the options offered in the web forms in NagiosQL.
  • \r\n
  • The version information of the configuration domain is used to define the options offered in the written configuration files.
  • \r\n
\r\n

This way you can create your data in a newer Nagios version and still write in an older version to keep the configuration compatible to the running Nagios version.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(16, 'host', 'hostname', 'all', 'default', '

Host - host name

This directive is used to define a short name used to identify the host. It is used in host group and service definitions to reference this particular host. Hosts can have multiple services (which are monitored) associated with them. When used properly, the $HOSTNAME$ macro will contain this short name.

\r\n

Parameter name: host_name
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(17, 'host', 'alias', 'all', 'default', '

Host - alias

This directive is used to define a longer name or description used to identify the host. It is provided in order to allow you to more easily identify a particular host. When used properly, the $HOSTALIAS$ macro will contain this alias/description.

\r\n

Parameter name: alias
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(18, 'host', 'address', 'all', 'default', '

Host - address

\r\n

This directive is used to define the address of the host. Normally, this is an IP address, although it could really be anything you want (so long as it can be used to check the status of the host). You can use a FQDN to identify the host instead of an IP address, but if DNS services are not availble this could cause problems. When used properly, the $HOSTADDRESS$ macro will contain this address.

\r\n

Note: If you do not specify an address directive in a host definition, the name of the host will be used as its address. A word of caution about doing this, however - if DNS fails, most of your service checks will fail because the plugins will be unable to resolve the host name.

\r\n

Parameter name: address
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(19, 'host', 'display_name', 'all', 'default', '

Host - display name

\r\n

This directive is used to define an alternate name that should be displayed in the web interface for this host. If not specified, this defaults to the value you specify for the host_name directive.

\r\n

Note: The current CGIs do not use this option, although future versions of the web interface will.

\r\n

Parameter name: display_name
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(20, 'host', 'parents', 'all', 'default', '

Host - parents

\r\n

This directive is used to define a comma-delimited list of short names of the "parent" hosts for this particular host. Parent hosts are typically routers, switches, firewalls, etc. that lie between the monitoring host and a remote hosts. A router, switch, etc. which is closest to the remote host is considered to be that host''s "parent". Read the "Determining Status and Reachability of Network Hosts" document for more information.

\r\n

If this host is on the same network segment as the host doing the monitoring (without any intermediate routers, etc.) the host is considered to be on the local network and will not have a parent host. Leave this value blank if the host does not have a parent host (i.e. it is on the same segment as the Nagios host). The order in which you specify parent hosts has no effect on how things are monitored.

\r\n

Parameter name: parents
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(21, 'host', 'hostgroups', 'all', 'default', '

Host - hostgroup names

\r\n

This directive is used to identify the short name(s) of the hostgroup(s) that the host belongs to. Multiple hostgroups should be separated by commas. This directive may be used as an alternative to (or in addition to) using the members directive in hostgroup definitions.

\r\n

NagiosQL: If a hostgroup is defined here - this host will not be selected inside the member field of the same hostgroup definition!

\r\n

Parameter name: hostgroups
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(22, 'common', 'tploptions', '3', 'default', '

Cancelling Inheritance of String Values

\r\n

In some cases you may not want your host, service, or contact definitions to inherit values of string variables from the templates they reference. If this is the case, you can specify "null" as the value of the variable that you do not want to inherit.

\r\n


Additive Inheritance of String Values

\r\n

Nagios gives preference to local variables instead of values inherited from templates. In most cases local variable values override those that are defined in templates. In some cases it makes sense to allow Nagios to use the values of inherited and local variables together.

\r\n

This "additive inheritance" can be accomplished by prepending the local variable value with a plus sign (+). This features is only available for standard (non-custom) variables that contain string values.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(23, 'host', 'check_command', 'all', 'default', '

Host - check command

This directive is used to specify the short name of the command that should be used to check if the host is up or down. Typically, this command would try and ping the host to see if it is "alive". The command must return a status of OK (0) or Nagios will assume the host is down.

\r\n

If you leave this argument blank, the host will not be actively checked. Thus, Nagios will likely always assume the host is up (it may show up as being in a "PENDING" state in the web interface). This is useful if you are monitoring printers or other devices that are frequently turned off. The maximum amount of time that the notification command can run is controlled by the host_check_timeout option.

\r\n

Parameter name: check_command
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(24, 'host', 'arguments', 'all', 'default', '

Host - arguments

\r\n

The values defined here will replace the according argument variable behind the selected command. Up to 8 argument variables are supported. Be sure, that you defines a valid value for each required argument variable.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(25, 'host', 'templateadd', 'all', 'default', '

Host - Templates

\r\n

You can add one or more host templates to a host configuration. Nagios will add the definitions from each template to a host configuration.

\r\n

If you add more than one template - the sort order will be used to overwrite configuration items which are defined inside templates before.

\r\n

The host configuration itselves will overwrite all values which are defined in templates before and pass all values which are not defined.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(26, 'host', 'initial_state', '3', 'default', '

Host - initial state

\r\n

By default Nagios will assume that all hosts are in UP states when in starts. You can override the initial state for a host by using this directive. Valid options are:
o
= UP,
d = DOWN, and
u = UNREACHABLE.

\r\n

Parameter name: initial_state
Required:
no

\r\n

 

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(27, 'host', 'retry_interval', '3', 'default', '

Host - retry interval

\r\n

This directive is used to define the number of "time units" to wait before scheduling a re-check of the hosts. Hosts are rescheduled at the retry interval when they have changed to a non-UP state. Once the host has been retried max_check_attempts times without a change in its status, it will revert to being scheduled at its "normal" rate as defined by the check_interval value. Unless you''ve changed the interval_length directive from the default value of 60, this number will mean minutes. More information on this value can be found in the check scheduling documentation.

\r\n

Parameter name: retry_interval
Required:
no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(28, 'host', 'max_check_attempts', 'all', 'default', '

Host - max check attempts

\r\n

This directive is used to define the number of times that Nagios will retry the host check command if it returns any state other than an OK state. Setting this value to 1 will cause Nagios to generate an alert without retrying the host check again. Note: If you do not want to check the status of the host, you must still set this to a minimum value of 1. To bypass the host check, just leave the check_command option blank.

\r\n

Parameter name: max_check_attempts
Required:
yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(29, 'host', 'check_interval', 'all', 'default', '

Host - check interval

\r\n

This directive is used to define the number of "time units" between regularly scheduled checks of the host. Unless you''ve changed the interval_length directive from the default value of 60, this number will mean minutes. More information on this value can be found in the check scheduling documentation.

\r\n

Parameter name: check_interval
Required:
no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(30, 'host', 'active_checks_enabled', 'all', 'default', '

Host - active checks enabled

\r\n

This directive is used to determine whether or not active checks (either regularly scheduled or on-demand) of this host are enabled. Values: 0 = disable active host checks, 1 = enable active host checks.

\r\n

Parameter name: active_checks_enabled
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(31, 'host', 'passive_checks_enabled', 'all', 'default', '

Host - passive checks enabled

\r\n

This directive is used to determine whether or not passive checks are enabled for this host. Values: 0 = disable passive host checks, 1 = enable passive host checks.

\r\n

Parameter name: passive_checks_enabled
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(32, 'host', 'check_period', 'all', 'default', '

Host - check period

\r\n

This directive is used to specify the short name of the time period during which active checks of this host can be made.

\r\n

Parameter name: check_period
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(33, 'host', 'freshness_threshold', 'all', 'default', '

Host - freshness threshold

\r\n

This directive is used to specify the freshness threshold (in seconds) for this host. If you set this directive to a value of 0, Nagios will determine a freshness threshold to use automatically.

\r\n

Parameter name: freshness_threshold
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(34, 'host', 'check_freshness', 'all', 'default', '

Host - check freshness

\r\n

This directive is used to determine whether or not freshness checks are enabled for this host. Values: 0 = disable freshness checks, 1 = enable freshness checks.

\r\n

Parameter name: check_freshness
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(35, 'host', 'obsess_over_host', 'all', 'default', '

Host - obsess over host

\r\n

This directive determines whether or not checks for the host will be "obsessed" over using the ochp_command.

\r\n

Parameter name: obsess_over_host
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(36, 'host', 'event_handler', 'all', 'default', '

Host - event handler

\r\n

This directive is used to specify the short name of the command that should be run whenever a change in the state of the host is detected (i.e. whenever it goes down or recovers). Read the documentation on event handlers for a more detailed explanation of how to write scripts for handling events. The maximum amount of time that the event handler command can run is controlled by the event_handler_timeout option.

\r\n

Parameter name: event_handler
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(37, 'host', 'event_handler_enabled', 'all', 'default', '

Host - event handler enabled

\r\n

This directive is used to determine whether or not the event handler for this host is enabled. Values: 0 = disable host event handler, 1 = enable host event handler.

\r\n

Parameter name: event_handler_enabled
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(38, 'host', 'low_flap_threshold', 'all', 'default', '

Host - low flap threshold

\r\n

This directive is used to specify the low state change threshold used in flap detection for this host. If you set this directive to a value of 0, the program-wide value specified by the low_host_flap_threshold directive will be used.

\r\n

Parameter name: low_flap_threshold
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(39, 'host', 'high_flap_threshold', 'all', 'default', '

Host - high flap threshold

\r\n

This directive is used to specify the high state change threshold used in flap detection for this host. If you set this directive to a value of 0, the program-wide value specified by the high_host_flap_threshold directive will be used.

\r\n

Parameter name: high_flap_threshold
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(40, 'host', 'flap_detection_enabled', 'all', 'default', '

Host - flap detection enabled

\r\n

This directive is used to determine whether or not flap detection is enabled for this host. Values: 0 = disable host flap detection, 1 = enable host flap detection.

\r\n

Parameter name: flap_detection_enabled
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(41, 'host', 'flap_detection_options', '3', 'default', '

Host - flap detection options

\r\n

This directive is used to determine what host states the flap detection logic will use for this host. Valid options are a combination of one or more of the following:
o
= UP states,
d = DOWN states,
u = UNREACHABLE states.

\r\n

Parameter name: flap_detection_options
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(42, 'host', 'retain_status_information', 'all', 'default', '

Host - retain status information

\r\n

This directive is used to determine whether or not status-related information about the host is retained across program restarts. This is only useful if you have enabled state retention using the retain_state_information directive. Value: 0 = disable status information retention, 1 = enable status information retention.

\r\n

Parameter name: retain_status_information
Required:
no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(43, 'host', 'retain_nonstatus_information', 'all', 'default', '

Host - retain nonstatus information

\r\n

This directive is used to determine whether or not non-status information about the host is retained across program restarts. This is only useful if you have enabled state retention using the retain_state_information directive. Value: 0 = disable non-status information retention, 1 = enable non-status information retention.

\r\n

Parameter name: retain_nonstatus_information
Required:
no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(45, 'host', 'contacts', '3', 'default', '

Host - contacts

\r\n

This is a list of the short names of the contacts that should be notified whenever there are problems (or recoveries) with this host. Multiple contacts should be separated by commas. Useful if you want notifications to go to just a few people and don''t want to configure contact groups. You must specify at least one contact or contact group in each host definition.

\r\n

Parameter name: contacs
Required:
yes (at least one contact or contact group)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(46, 'host', 'contactgroups', 'all', 'default', '

Host - contact groups

\r\n

This is a list of the short names of the contact groups that should be notified whenever there are problems (or recoveries) with this host. Multiple contact groups should be separated by commas. You must specify at least one contact or contact group in each host definition.

\r\n

Parameter name: contact_groups
Required: yes (at least one contact or contact group)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(47, 'host', 'notification_period', 'all', 'default', '

Host - notification period

\r\n

This directive is used to specify the short name of the time period during which notifications of events for this host can be sent out to contacts. If a host goes down, becomes unreachable, or recoveries during a time which is not covered by the time period, no notifications will be sent out.

\r\n

Parameter name: notification_period
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(48, 'host', 'notification_options', 'all', 'default', '

Host - notification options

\r\n

This directive is used to determine when notifications for the host should be sent out. Valid options are a combination of one or more of the following:
d = send notifications on a DOWN state,
u = send notifications on an UNREACHABLE state,
r
= send notifications on recoveries (OK state),
f = send notifications when the host starts and stops flapping, and
s = send notifications when scheduled downtime starts and ends.
If you do not specify any notification options, Nagios will assume that you want notifications to be sent out for all possible states.

\r\n

Example: If you specify d,r in this field, notifications will only be sent out when the host goes DOWN and when it recovers from a DOWN state.

\r\n

Parameter name: notification_options
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(51, 'host', 'notification_enabled', 'all', 'default', '

Host - notification enabled

\r\n

This directive is used to determine whether or not notifications for this host are enabled. Values: 0 = disable host notifications, 1 = enable host notifications.

\r\n

Parameter name: notification_enabled
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(52, 'host', 'stalking_options', 'all', 'default', '

Host - stalking options

\r\n

This directive determines which host states "stalking" is enabled for. Valid options are a combination of one or more of the following:
o
= stalk on UP states,
d = stalk on DOWN states, and
u = stalk on UNREACHABLE states.

\r\n

Parameter name: stalking_options
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(53, 'host', 'process_perf_data', 'all', 'default', '

Host - process performance data

\r\n

This directive is used to determine whether or not the processing of performance data is enabled for this host. Values: 0 = disable performance data processing, 1 = enable performance data processing.

\r\n

Parameter name: process_perf_data
Required:
no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(54, 'host', 'notification_intervall', 'all', 'default', '

Host - notification interval

\r\n

This directive is used to define the number of "time units" to wait before re-notifying a contact that this service is still down or unreachable. Unless you''ve changed the interval_length directive from the default value of 60, this number will mean minutes. If you set this value to 0, Nagios will not re-notify contacts about problems for this host - only one problem notification will be sent out.

\r\n

Parameter name: notification_interval
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(55, 'host', 'first_notification_delay', 'all', 'default', '

Host - first notification delay

\r\n

This directive is used to define the number of "time units" to wait before sending out the first problem notification when this host enters a non-UP state. Unless you''ve changed the interval_length directive from the default value of 60, this number will mean minutes. If you set this value to 0, Nagios will start sending out notifications immediately.

\r\n

Parameter name: first_notification_delay
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(56, 'host', 'notes', '3', 'default', '

Host - notes

\r\n

This directive is used to define an optional string of notes pertaining to the host. If you specify a note here, you will see the it in the extended information CGI (when you are viewing information about the specified host).

\r\n

Parameter name: notes
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(57, 'host', 'vrml_image', '3', 'default', '

Host - vrml image

\r\n

This variable is used to define the name of a GIF, PNG, or JPG image that should be associated with this host. This image will be used as the texture map for the specified host in the statuswrl CGI. Unlike the image you use for the icon_image variable, this one should probably not have any transparency.

\r\n

If it does, the host object will look a bit wierd. Images for hosts are assumed to be in the logos/ subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).

\r\n

Parameter name: vrml_image
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(58, 'host', 'notes_url', '3', 'default', '

Host - notes url

\r\n

This variable is used to define an optional URL that can be used to provide more information about the host. If you specify an URL, you will see a red folder icon in the CGIs (when you are viewing host information) that links to the URL you specify here. Any valid URL can be used.

\r\n

If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/). This can be very useful if you want to make detailed information on the host, emergency contact methods, etc. available to other support staff.

\r\n

Parameter name: notes_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(59, 'host', 'status_image', '3', 'default', '

Host - statusmap image

\r\n

This variable is used to define the name of an image that should be associated with this host in the statusmap CGI. You can specify a JPEG, PNG, and GIF image if you want, although I would strongly suggest using a GD2 format image, as other image formats will result in a lot of wasted CPU time when the statusmap image is generated.

\r\n

GD2 images can be created from PNG images by using the pngtogd2 utility supplied with Thomas Boutell''s gd library . The GD2 images should be created in uncompressed format in order to minimize CPU load when the statusmap CGI is generating the network map image.

\r\n

The image will look best if it is 40x40 pixels in size. You can leave these option blank if you are not using the statusmap CGI. Images for hosts are assumed to be in the logos/ subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).

\r\n

Parameter name: statusmap_image
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(60, 'host', 'action_url', '3', 'default', '

Host - action url

\r\n

This directive is used to define an optional URL that can be used to provide more actions to be performed on the host. If you specify an URL, you will see a red "splat" icon in the CGIs (when you are viewing host information) that links to the URL you specify here. Any valid URL can be used.

\r\n

If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/).

\r\n

Parameter name: action_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(61, 'host', 'icon_image', '3', 'default', '

Host - icon image

\r\n

This variable is used to define the name of a GIF, PNG, or JPG image that should be associated with this host. This image will be displayed in the various places in the CGIs. The image will look best if it is 40x40 pixels in size. Images for hosts are assumed to be in the logos/ subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).

\r\n

Parameter name: icon_image
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(62, 'host', '2d_coords', '3', 'default', '

Host - 2D coords

\r\n

This variable is used to define coordinates to use when drawing the host in the statusmap CGI. Coordinates should be given in positive integers, as they correspond to physical pixels in the generated image. The origin for drawing (0,0) is in the upper left hand corner of the image and extends in the positive x direction (to the right) along the top of the image and in the positive y direction (down) along the left hand side of the image.

\r\n

For reference, the size of the icons drawn is usually about 40x40 pixels (text takes a little extra space). The coordinates you specify here are for the upper left hand corner of the host icon that is drawn. Note: Don''t worry about what the maximum x and y coordinates that you can use are. The CGI will automatically calculate the maximum dimensions of the image it creates based on the largest x and y coordinates you specify.

\r\n

Parameter name: 2d_coords
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(63, 'host', 'icon_image_alt_text', '3', 'default', '

Host - icon image alt

\r\n

This variable is used to define an optional string that is used in the ALT tag of the image specified by the icon image argument.

\r\n

Parameter name: icon_image_alt
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(64, 'host', '3d_coords', '3', 'default', '

Host - 3D coords

\r\n

This variable is used to define coordinates to use when drawing the host in the statuswrl CGI. Coordinates can be positive or negative real numbers. The origin for drawing is (0.0,0.0,0.0). For reference, the size of the host cubes drawn is 0.5 units on each side (text takes a little more space). The coordinates you specify here are used as the center of the host cube.

\r\n

Parameter name: 3d_coords
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(65, 'common', 'free_variables_name', 'all', 'default', '

Free variables (custom object variables)

\r\n

NagiosQL supports custom object variables.

\r\n

There are a few important things that you should note about custom variables:

\r\n
    \r\n
  • Custom variable names must begin with an underscore (_) to prevent name collision with standard variables
  • \r\n
  • Custom variable names are case-insensitive
  • \r\n
  • Custom variables are inherited from object templates like normal variables
  • \r\n
  • Scripts can reference custom variable values with macros and environment variables
  • \r\n
\r\n

Examples

\r\n

define host{
       host_name linuxserver
       _mac_address 00:06:5B:A6:AD:AA ; <-- Custom MAC_ADDRESS variable
       _rack_number R32 ; <-- Custom RACK_NUMBER variable
       ...
}

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(66, 'common', 'free_variables_value', 'all', 'default', '

Free variables (custom object variables)

\r\n

NagiosQL supports custom object variables.

\r\n

There are a few important things that you should note about custom variables:

\r\n
    \r\n
  • Custom variable names must begin with an underscore (_) to prevent name collision with standard variables
  • \r\n
  • Custom variable names are case-insensitive
  • \r\n
  • Custom variables are inherited from object templates like normal variables
  • \r\n
  • Scripts can reference custom variable values with macros and environment variables
  • \r\n
\r\n

Examples

\r\n

define host{
       host_name linuxserver
       _mac_address 00:06:5B:A6:AD:AA ; <-- Custom MAC_ADDRESS variable
       _rack_number R32 ; <-- Custom RACK_NUMBER variable
       ...
}

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(67, 'host', 'genericname', 'all', 'default', '

Host or Service - generic name

\r\n

It is possible to use a host definition as a template for other host configurations. If this definition should be used as template, a generic template name must be defined.

\r\n

We do not recommend to do this - it is more open to define a separate host template than to use this option.

\r\n

Parameter name: name
Required:
no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(68, 'service', 'config_name', 'all', 'default', '

Service - config name

\r\n

This directive is used to specify a common config name for a group of service definitions. This is a NagiosQL parameter and it will not be written to the configuration file. Every service definitions with the same configuration name will stored in one file. The configuration name is also the file name of this configuration set.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(69, 'service', 'hosts', 'all', 'default', '

Service - host name

\r\n

This directive is used to specify the short name(s) of the host(s) that the service "runs" on or is associated with.

\r\n

Parameter name: host_name
Required: yes (no, if a hostgroup is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(70, 'service', 'hostgroups', 'all', 'default', '

Service - hostgroup name

\r\n

This directive is used to specify the short name(s) of the hostgroup(s) that the service "runs" on or is associated with. The hostgroup_name may be used instead of, or in addition to, the host_name directive.

\r\n

Parameter name: hostgroup_name
Required: no (yes, if no host is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(71, 'service', 'service_description', 'all', 'default', '

Service - service description

\r\n

This directive is used to define the description of the service, which may contain spaces, dashes, and colons (semicolons, apostrophes, and quotation marks should be avoided). No two services associated with the same host can have the same description. Services are uniquely identified with their host_name and service_description directives.

\r\n

Parameter name: service_description
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(72, 'service', 'service_groups', 'all', 'default', '

Service - servicegroups

\r\n

This directive is used to identify the short name(s) of the servicegroup(s) that the service belongs to. Multiple servicegroups should be separated by commas. This directive may be used as an alternative to using the members directive in servicegroup definitions.

\r\n

NagiosQL: If a servicegroup is defined here - this service will not be selected inside the member field of the same servicegroup definition!

\r\n

Parameter name: servicegroups
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(73, 'service', 'display_name', 'all', 'default', '

Service - display name

\r\n

This directive is used to define an alternate name that should be displayed in the web interface for this service. If not specified, this defaults to the value you specify for the service_description directive. Note: The current CGIs do not use this option, although future versions of the web interface will.

\r\n

Parameter name: display_name
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(74, 'service', 'check_command', 'all', 'default', '

Service - check command

\r\n

This directive is used to specify the short name of the command that Nagios will run in order to check the status of the service. The maximum amount of time that the service check command can run is controlled by the service_check_timeout option.

\r\n

Parameter name: check_command
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(75, 'service', 'argument', 'all', 'default', '

Service - arguments

\r\n

The values defined here will replace the according argument variable behind the selected command. Up to 8 argument variables are supported. Be sure, that you defines a valid value for each required argument variable.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(76, 'service', 'templateadd', 'all', 'default', '

Service - Templates

\r\n

You can add one or more service templates to a service configuration. Nagios will add the definitions from each template to a service configuration.

\r\n

If you add more than one template - the sort order will be used to overwrite configuration items which are defined inside templates before.

\r\n

The host configuration itselves will overwrite all values which are defined in templates before and pass all values which are not defined.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(77, 'service', 'initial_state', '3', 'default', '

Service - initial state

\r\n

By default Nagios will assume that all services are in OK states when in starts. You can override the initial state for a service by using this directive. Valid options are:
o
= OK,
w = WARNING,
u
= UNKNOWN, and
c
= CRITICAL.

\r\n

Parameter name: initial_state
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(78, 'service', 'retry_interval', '3', 'default', '

Service - retry interval

\r\n

This directive is used to define the number of "time units" to wait before scheduling a re-check of the service. Services are rescheduled at the retry interval when they have changed to a non-OK state. Once the service has been retried max_check_attempts times without a change in its status, it will revert to being scheduled at its "normal" rate as defined by the check_interval value. Unless you''ve changed the interval_length directive from the default value of 60, this number will mean minutes. More information on this value can be found in the check scheduling documentation.

\r\n

Parameter name: retry_interval
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(79, 'service', 'max_check_attempts', 'all', 'default', '

Service - max check attempts

\r\n

This directive is used to define the number of times that Nagios will retry the service check command if it returns any state other than an OK state. Setting this value to 1 will cause Nagios to generate an alert without retrying the service check again.

\r\n

Parameter name: max_check_attempts
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(80, 'service', 'check_interval', 'all', 'default', '

Service - check interval

\r\n

This directive is used to define the number of "time units" to wait before scheduling the next "regular" check of the service. "Regular" checks are those that occur when the service is in an OK state or when the service is in a non-OK state, but has already been rechecked max_check_attempts number of times. Unless you''ve changed the interval_length directive from the default value of 60, this number will mean minutes. More information on this value can be found in the check scheduling documentation.

\r\n

Parameter name: check_interval
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(81, 'service', 'active_checks_enabled', 'all', 'default', '

Service - active checks enabled

\r\n

This directive is used to determine whether or not active checks of this service are enabled. Values: 0 = disable active service checks, 1 = enable active service checks.

\r\n

Parameter name: active_checks_enabled
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(82, 'service', 'passive_checks_enabled', 'all', 'default', '

Service - passive checks enabled

\r\n

This directive is used to determine whether or not passive checks of this service are enabled. Values: 0 = disable passive service checks, 1 = enable passive service checks.

\r\n

Parameter name: passive_checks_enabled
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(83, 'service', 'parallelize_checks', '2', 'default', '

Service - parallelize check

\r\n

This directive is used to determine whether or not the service check can be parallelized. By default, all service checks are parallelized. Disabling parallel checks of services can result in serious performance problems. More information on service check parallelization can be found in the nagios documentation.

\r\n

Values: 0 = service check cannot be parallelized (use with caution!), 1 = service check can be parallelized.

\r\n

Parameter name: parallelize_check
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(84, 'service', 'check_period', 'all', 'default', '

Service - check period

\r\n

This directive is used to specify the short name of the time period during which active checks of this service can be made.

\r\n

Parameter name: check_period
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(85, 'service', 'freshness_threshold', 'all', 'default', '

Service - freshness threshold

\r\n

This directive is used to specify the freshness threshold (in seconds) for this service. If you set this directive to a value of 0, Nagios will determine a freshness threshold to use automatically.

\r\n

Parameter name: freshness_threshold
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(86, 'service', 'check_freshness', 'all', 'default', '

Service - check freshness

\r\n

This directive is used to determine whether or not freshness checks are enabled for this service. Values: 0 = disable freshness checks, 1 = enable freshness checks.

\r\n

Parameter name: check_freshness
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(87, 'service', 'obsess_over_service', 'all', 'default', '

Service - obsess over service

\r\n

This directive determines whether or not checks for the service will be "obsessed" over using the ocsp_command.

\r\n

Parameter name: obsess_over_service
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(88, 'service', 'event_handler', 'all', 'default', '

Service - event handler

\r\n

This directive is used to specify the short name of the command that should be run whenever a change in the state of the service is detected (i.e. whenever it goes down or recovers). Read the documentation on event handlers for a more detailed explanation of how to write scripts for handling events. The maximum amount of time that the event handler command can run is controlled by the event_handler_timeout option.

\r\n

Parameter name: event_handler
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(89, 'service', 'event_handler_enabled', 'all', 'default', '

Service - event handler enabled

\r\n

This directive is used to determine whether or not the event handler for this service is enabled. Values: 0 = disable service event handler, 1 = enable service event handler.

\r\n

Parameter name: event_handler_enabled
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(90, 'service', 'low_flap_threshold', 'all', 'default', '

Service - low flap threshold

\r\n

This directive is used to specify the low state change threshold used in flap detection for this service. More information on flap detection can be found in the nagios documentation. If you set this directive to a value of 0, the program-wide value specified by the low_service_flap_threshold directive will be used.

\r\n

Parameter name: low_flap_threshold
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(91, 'service', 'high_flap_threshold', 'all', 'default', '

Service - high flap threshold

\r\n

This directive is used to specify the high state change threshold used in flap detection for this service. More information on flap detection can be found in the nagios documentation. If you set this directive to a value of 0, the program-wide value specified by the high_service_flap_threshold directive will be used.

\r\n

Parameter name: high_flap_threshold
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(92, 'service', 'flap_detection_enabled', 'all', 'default', '

Service - flap detection enabled

\r\n

This directive is used to determine whether or not flap detection is enabled for this service. More information on flap detection can be found in the nagios documentation. Values: 0 = disable service flap detection, 1 = enable service flap detection.

\r\n

Parameter name: flap_detection_enabled
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(93, 'service', 'flap_detection_options', '3', 'default', '

Service - flap detection options

\r\n

This directive is used to determine what service states the flap detection logic will use for this service. Valid options are a combination of one or more of the following:
o
= OK states,
w = WARNING states,
c = CRITICAL states,
u = UNKNOWN states.

\r\n

Parameter name: flap_detection_options
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(94, 'service', 'retain_status_information', 'all', 'default', '

Service - retain status information

\r\n

This directive is used to determine whether or not status-related information about the service is retained across program restarts. This is only useful if you have enabled state retention using the retain_state_information directive. Value: 0 = disable status information retention, 1 = enable status information retention.

\r\n

Parameter name: retain_status_information
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(95, 'service', 'retain_nonstatus_information', 'all', 'default', '

Service - retain nonstatus information

\r\n

This directive is used to determine whether or not non-status information about the service is retained across program restarts. This is only useful if you have enabled state retention using the retain_state_information directive. Value: 0 = disable non-status information retention, 1 = enable non-status information retention.

\r\n

Parameter name: retain_nonstatus_information
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(96, 'service', 'process_perf_data', 'all', 'default', '

Service - process perf data

\r\n

This directive is used to determine whether or not the processing of performance data is enabled for this service. Values: 0 = disable performance data processing, 1 = enable performance data processing.

\r\n

Parameter name: process_perf_data
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(97, 'service', 'is_volatile', 'all', 'default', '

Service - is volatile

\r\n

This directive is used to denote whether the service is "volatile". Services are normally not volatile. More information on volatile service and how they differ from normal services can be found in the nagios documentation. Value: 0 = service is not volatile, 1 = service is volatile.

\r\n

Parameter name: is_volatile
Required:no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(98, 'service', 'contacts', '3', 'default', '

Service - contacts

\r\n

This is a list of the short names of the contacts that should be notified whenever there are problems (or recoveries) with this service. Multiple contacts should be separated by commas. Useful if you want notifications to go to just a few people and don''t want to configure contact groups. You must specify at least one contact or contact group in each service definition.

\r\n

Parameter name: contacts
Required: yes (no, if a contact group is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(99, 'service', 'contactgroups', 'all', 'default', '

Service - contact groups

\r\n

This is a list of the short names of the contact groups that should be notified whenever there are problems (or recoveries) with this service. Multiple contact groups should be separated by commas. You must specify at least one contact or contact group in each service definition.

\r\n

Parameter name: contact_groups
Required: yes (no, if a contact is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(100, 'service', 'notification_period', 'all', 'default', '

Service - notification period

\r\n

This directive is used to specify the short name of the time period during which notifications of events for this service can be sent out to contacts. No service notifications will be sent out during times which is not covered by the time period.

\r\n

Parameter name: notification_period
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(101, 'service', 'notification_options', 'all', 'default', '

Service - notification options

\r\n

This directive is used to determine when notifications for the service should be sent out. Valid options are a combination of one or more of the following:

w
= send notifications on a WARNING state,
u = send notifications on an UNKNOWN state,
c
= send notifications on a CRITICAL state,
r = send notifications on recoveries (OK state),
f
= send notifications when the service starts and stops flapping, and
s = send notifications when scheduled downtime starts and ends.

\r\n

If you do not specify any notification options, Nagios will assume that you want notifications to be sent out for all possible states.

\r\n

Example: If you specify w,r in this field, notifications will only be sent out when the service goes into a WARNING state and when it recovers from a WARNING state.

\r\n

Parameter name: notification_options
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(102, 'service', 'notification_intervall', 'all', 'default', '

Service - notification interval

\r\n

This directive is used to define the number of "time units" to wait before re-notifying a contact that this service is still in a non-OK state. Unless you''ve changed the interval_length directive from the default value of 60, this number will mean minutes. If you set this value to 0, Nagios will not re-notify contacts about problems for this service - only one problem notification will be sent out.

\r\n

Parameter name: notification_interval
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(103, 'service', 'first_notification_delay', 'all', 'default', '

Service - first notification delay

\r\n

This directive is used to define the number of "time units" to wait before sending out the first problem notification when this service enters a non-OK state. Unless you''ve changed the interval_length directive from the default value of 60, this number will mean minutes. If you set this value to 0, Nagios will start sending out notifications immediately.

\r\n

Parameter name: first_notification_delay
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(104, 'service', 'notification_enabled', 'all', 'default', '

Service - notifications enabled

\r\n

This directive is used to determine whether or not notifications for this service are enabled. Values: 0 = disable service notifications, 1 = enable service notifications.

\r\n

Parameter name: notifications_enabled
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(105, 'service', 'stalking_options', 'all', 'default', '

Service - stalking options

\r\n

This directive determines which service states "stalking" is enabled for. Valid options are a combination of one or more of the following:
o
= stalk on OK states,
w = stalk on WARNING states,
u
= stalk on UNKNOWN states, and
c
= stalk on CRITICAL states.

\r\n

More information on state stalking can be found in the nagios documentation.

\r\n

Parameter name: stalking_options
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(106, 'service', 'notes', '3', 'default', '

Service - notes

\r\n

This directive is used to define an optional string of notes pertaining to the service. If you specify a note here, you will see the it in the extended information CGI (when you are viewing information about the specified service).

\r\n

Parameter name: notes
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(107, 'service', 'icon_image', '3', 'default', '

Service - icon image

\r\n

This variable is used to define the name of a GIF, PNG, or JPG image that should be associated with this service. This image will be displayed in the status and extended information CGIs. The image will look best if it is 40x40 pixels in size. Images for services are assumed to be in the logos/ subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).

\r\n

Parameter name: icon_image
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(108, 'service', 'notes_url', '3', 'default', '

Service - notes url

\r\n

This directive is used to define an optional URL that can be used to provide more information about the service. If you specify an URL, you will see a red folder icon in the CGIs (when you are viewing service information) that links to the URL you specify here. Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/). This can be very useful if you want to make detailed information on the service, emergency contact methods, etc. available to other support staff.

\r\n

Parameter name: notes_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(109, 'service', 'icon_image_alt_text', '3', 'default', '

Service - icon image alt

\r\n

This variable is used to define an optional string that is used in the ALT tag of the image specified by the <icon_image> argument. The ALT tag is used in the status, extended information and statusmap CGIs.

\r\n

Parameter name: icon_image_alt
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(110, 'service', 'action_url', '3', 'default', '

Service - action url

\r\n

This directive is used to define an optional URL that can be used to provide more actions to be performed on the service. If you specify an URL, you will see a red "splat" icon in the CGIs (when you are viewing service information) that links to the URL you specify here. Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/).

\r\n

Parameter name: action_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(111, 'hostgroup', 'hostgroup_name', 'all', 'default', '

Hostgroup - hostgroup name

\r\n

This directive is used to define a short name used to identify the host group.

\r\n

Parameter name: hostgroup_name
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(112, 'hostgroup', 'members', 'all', 'default', '

Hostgroup - members

\r\n

This is a list of the short names of hosts that should be included in this group. Multiple host names should be separated by commas. This directive may be used as an alternative to (or in addition to) the hostgroups directive in host definitions.

\r\n

NagiosQL: If you select a hostgroup inside a host definition using the hostgroups directive in host definition, this host will not be selected here because these are two different ways to specify a hostgroup!

\r\n

Parameter name: members
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(113, 'hostgroup', 'description', 'all', 'default', '

Hostgroup - alias

\r\n

This directive is used to define is a longer name or description used to identify the host group. It is provided in order to allow you to more easily identify a particular host group.

\r\n

Parameter name: alias
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(114, 'hostgroup', 'notes', '3', 'default', '

Hostgroup - notes

\r\n

This directive is used to define an optional string of notes pertaining to the host. If you specify a note here, you will see the it in the extended information CGI (when you are viewing information about the specified host).

\r\n

Parameter name: notes
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(115, 'hostgroup', 'notes_url', '3', 'default', '

Hostgroup - notes url

\r\n

This variable is used to define an optional URL that can be used to provide more information about the host group. If you specify an URL, you will see a red folder icon in the CGIs (when you are viewing hostgroup information) that links to the URL you specify here. Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/). This can be very useful if you want to make detailed information on the host group, emergency contact methods, etc. available to other support staff.

\r\n

Parameter name: notes_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(116, 'hostgroup', 'action_url', '3', 'default', '

Hostgroup - action url

\r\n

This directive is used to define an optional URL that can be used to provide more actions to be performed on the host group. If you specify an URL, you will see a red "splat" icon in the CGIs (when you are viewing hostgroup information) that links to the URL you specify here. Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/).

\r\n

Parameter name: action_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(117, 'hostgroup', 'hostgroup_members', 'all', 'default', '

Hostgroup - hostgroup members

\r\n

This optional directive can be used to include hosts from other "sub" host groups in this host group. Specify a comma-delimited list of short names of other host groups whose members should be included in this group.

\r\n

Parameter name: hostgroup_members
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(118, 'servicegroup', 'servicegroup_name', 'all', 'default', '

Servicegroup - servicegroup name

\r\n

This directive is used to define a short name used to identify the service group.

\r\n

Parameter name: servicegroup_name
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(119, 'servicegroup', 'members', 'all', 'default', '

Servicegroup - members

\r\n

This is a list of the descriptions of services (and the names of their corresponding hosts) that should be included in this group. Host and service names should be separated by commas. This directive may be used as an alternative to the servicegroups directive in service definitions.

\r\n

NagiosQL: If you select a servicegroup inside a service definition using the servicegroups directive in service definition, this service will not be selected here because these are two different ways to specify a servicegroup!

\r\n

Parameter name: members
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(120, 'servicegroup', 'description', 'all', 'default', '

Servicegroup - alias

\r\n

This directive is used to define is a longer name or description used to identify the service group. It is provided in order to allow you to more easily identify a particular service group.

\r\n

Parameter name: alias
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(121, 'servicegroup', 'notes', '3', 'default', '

Servicegroup - notes

\r\n

This directive is used to define an optional string of notes pertaining to the service group. If you specify a note here, you will see the it in the extended information CGI (when you are viewing information about the specified service group).

\r\n

Parameter name: notes
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(122, 'servicegroup', 'notes_url', '3', 'default', '

Servicegroup - notes url

\r\n

This directive is used to define an optional URL that can be used to provide more information about the service group. If you specify an URL, you will see a red folder icon in the CGIs (when you are viewing service group information) that links to the URL you specify here. Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/). This can be very useful if you want to make detailed information on the service group, emergency contact methods, etc. available to other support staff.

\r\n

Parameter name: notes_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(123, 'servicegroup', 'action_url', '3', 'default', '

Servicegroup - action url

\r\n

This directive is used to define an optional URL that can be used to provide more actions to be performed on the service group. If you specify an URL, you will see a red "splat" icon in the CGIs (when you are viewing service group information) that links to the URL you specify here. Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/).

\r\n

Parameter name: action_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(124, 'servicegroup', 'servicegroup_members', 'all', 'default', '

Servicegroup - servicegroup members

\r\n

This optional directive can be used to include services from other "sub" service groups in this service group. Specify a comma-delimited list of short names of other service groups whose members should be included in this group.

\r\n

Parameter name: servicegroup_members
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(125, 'hosttemplate', 'template_name', 'all', 'default', '

Hosttemplate - template name

\r\n

This directive is used to define a short name used to identify the host template.

\r\n

Parameter name: name
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(126, 'servicetemplate', 'template_name', 'all', 'default', '

Servicetemplate - template name

\r\n

This directive is used to define a short name used to identify the service template.

\r\n

Parameter name: name
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(127, 'contact', 'contact_name', 'all', 'default', '

Contact - contact name

\r\n

This directive is used to define a short name used to identify the contact. It is referenced in contact group definitions. Under the right circumstances, the $CONTACTNAME$ macro will contain this value.

\r\n

Parameter name: contact_name
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(128, 'contact', 'contactgroups', 'all', 'default', '

Contact - contactgroups

\r\n

This directive is used to identify the short name(s) of the contactgroup(s) that the contact belongs to. Multiple contactgroups should be separated by commas. This directive may be used as an alternative to (or in addition to) using the members directive in contactgroup definitions.

\r\n

NagiosQL: If a contactgroup is defined here - this contact will not be selected inside the member field of the same contactgroup definition!

\r\n

Parameter name: contactgroups
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(129, 'contact', 'alias', 'all', 'default', '

Contact - alias

\r\n

This directive is used to define a longer name or description for the contact. Under the rights circumstances, the $CONTACTALIAS$ macro will contain this value. If not specified, the contact_name will be used as the alias.

\r\n

Parameter name: alias
Required: no (yes in Nagios 2.x)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(130, 'contact', 'email', 'all', 'default', '

Contact - email

\r\n

This directive is used to define an email address for the contact. Depending on how you configure your notification commands, it can be used to send out an alert email to the contact. Under the right circumstances, the $CONTACTEMAIL$ macro will contain this value.

\r\n

Parameter name: email
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(131, 'contact', 'pager', 'all', 'default', '

Contact - pager

\r\n

This directive is used to define a pager number for the contact. It can also be an email address to a pager gateway (i.e. pagejoe@pagenet.com). Depending on how you configure your notification commands, it can be used to send out an alert page to the contact. Under the right circumstances, the $CONTACTPAGER$ macro will contain this value.

\r\n

Parameter name: pager
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(132, 'contact', 'address', 'all', 'default', '

Contact - addressx

\r\n

Address directives are used to define additional "addresses" for the contact. These addresses can be anything - cell phone numbers, instant messaging addresses, etc. Depending on how you configure your notification commands, they can be used to send out an alert o the contact. Up to six addresses can be defined using these directives (address1 through address6). The $CONTACTADDRESSx$ macro will contain this value.

\r\n

Parameter name: addressx (x as number from 1 to 6)
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(133, 'contact', 'host_notifications_enabled', '3', 'default', '

Contact - host notifications enabled

\r\n

This directive is used to determine whether or not the contact will receive notifications about host problems and recoveries. Values: 0 = don''t send notifications, 1 = send notifications.

\r\n

Parameter name: host_notifications_enabled
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(134, 'contact', 'service_notifications_enabled', '3', 'default', '

Contact - service notifications enabled

\r\n

This directive is used to determine whether or not the contact will receive notifications about service problems and recoveries. Values: 0 = don''t send notifications, 1 = send notifications.

\r\n

Parameter name: service_notifications_enabled
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(135, 'contact', 'host_notification_period', 'all', 'default', '

Contact - host notification period

\r\n

This directive is used to specify the short name of the time period during which the contact can be notified about host problems or recoveries. You can think of this as an "on call" time for host notifications for the contact. Read the documentation on time periods for more information on how this works and potential problems that may result from improper use.

\r\n

Parameter name: host_notification_period
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(136, 'contact', 'service_notification_period', 'all', 'default', '

Contact - service notification period

\r\n

This directive is used to specify the short name of the time period during which the contact can be notified about service problems or recoveries. You can think of this as an "on call" time for service notifications for the contact. Read the documentation on time periods for more information on how this works and potential problems that may result from improper use.

\r\n

Parameter name: service_notification_period
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(137, 'contact', 'host_notification_options', '2', 'default', '

Contact - host notification options

\r\n

This directive is used to define the host states for which notifications can be sent out to this contact. Valid options are a combination of one or more of the following:
d
= notify on DOWN host states,
u = notify on UNREACHABLE host states,
r
= notify on host recoveries (UP states), and
f
= notify when the host starts and stops flapping.
If you specify n (none) as an option, the contact will not receive any type of host notifications.

\r\n

Parameter name: host_notification_options
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(138, 'contact', 'host_notification_options', '3', 'default', '

Contact - host notification options

\r\n

This directive is used to define the host states for which notifications can be sent out to this contact. Valid options are a combination of one or more of the following:
d = notify on DOWN host states,
u
= notify on UNREACHABLE host states,
r
= notify on host recoveries (UP states),
f
= notify when the host starts and stops flapping, and
s = send notifications when host or service scheduled downtime starts and ends.
If you specify n (none) as an option, the contact will not receive any type of host notifications.

\r\n

Parameter name: host_notification_options
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(139, 'contact', 'service_notification_options', '2', 'default', '

Contact - service notification options

\r\n

This directive is used to define the service states for which notifications can be sent out to this contact. Valid options are a combination of one or more of the following:
w
= notify on WARNING service states,
u
= notify on UNKNOWN service states,
c
= notify on CRITICAL service states,
r = notify on service recoveries (OK states), and
f = notify when the servuce starts and stops flapping.
If you specify n (none) as an option, the contact will not receive any type of host notifications.

\r\n

Parameter name: service_notification_options
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(140, 'contact', 'service_notification_options', '3', 'default', '

Contact - service notification options

\r\n

This directive is used to define the service states for which notifications can be sent out to this contact. Valid options are a combination of one or more of the following:
w
= notify on WARNING service states,
u = notify on UNKNOWN service states,
c = notify on CRITICAL service states,
r
= notify on service recoveries (OK states), and
f = notify when the host starts and stops flapping, and
s
= send notifications when host or service scheduled downtime starts and ends.
If you specify n (none) as an option, the contact will not receive any type of host notifications.

\r\n

Parameter name: service_notification_options
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(141, 'contact', 'host_notification_commands', 'all', 'default', '

Contact - host notification commands

\r\n

This directive is used to define a list of the short names of the commands used to notify the contact of a host problem or recovery. Multiple notification commands should be separated by commas. All notification commands are executed when the contact needs to be notified. The maximum amount of time that a notification command can run is controlled by the notification_timeout option.

\r\n

Parameter name: host_notification_commands
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(142, 'contact', 'service_notification_commands', 'all', 'default', '

Contact - service notification commands

\r\n

This directive is used to define a list of the short names of the commands used to notify the contact of a service problem or recovery. Multiple notification commands should be separated by commas. All notification commands are executed when the contact needs to be notified. The maximum amount of time that a notification command can run is controlled by the notification_timeout option.

\r\n

Parameter name: service_notification_commands
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(143, 'contact', 'retain_status_information', '3', 'default', '

Contact - retain status information

\r\n

This directive is used to determine whether or not status-related information about the contact is retained across program restarts. This is only useful if you have enabled state retention using the retain_state_information directive. Value: 0 = disable status information retention, 1 = enable status information retention.

\r\n

Parameter name: retain_status_information
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(144, 'contact', 'can_submit_commands', '3', 'default', '

Contact - can submit commands

\r\n

This directive is used to determine whether or not the contact can submit external commands to Nagios from the CGIs. Values: 0 = don''t allow contact to submit commands, 1 = allow contact to submit commands.

\r\n

Parameter name: can_submit_commands
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(145, 'contact', 'retain_nostatus_information', '3', 'default', '

Contact - retain nonstatus information

\r\n

This directive is used to determine whether or not non-status information about the contact is retained across program restarts. This is only useful if you have enabled state retention using the retain_state_information directive. Value: 0 = disable non-status information retention, 1 = enable non-status information retention.

\r\n

Parameter name: retain_nonstatus_information
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(146, 'contact', 'templateadd', 'all', 'default', '

Contact - Templates

\r\n

You can add one or more contact templates to a contact configuration. Nagios will add the definitions from each template to a contact configuration.

\r\n

If you add more than one template - the sort order will be used to overwrite configuration items which are defined inside templates before.

\r\n

The host configuration itselves will overwrite all values which are defined in templates before and pass all values which are not defined.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(147, 'contact', 'genericname', 'all', 'default', '

Contact - generic name

\r\n

It is possible to use a contact definition as a template for other contact configurations. If this definition should be used as template, a generic template name must be defined.

\r\n

We do not recommend to do this - it is more open to define a separate contact template than use this option.

\r\n

Parameter name: name
Required:
no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(148, 'contactgroup', 'contactgroup_name', 'all', 'default', '

Contactgroup - contactgroup name

\r\n

This directive is a short name used to identify the contact group.

\r\n

Parameter name: contactgroup_name
Required:
yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(149, 'contactgroup', 'members', 'all', 'default', '

Contactgroup - members

\r\n

This directive is used to define a list of the short names of contacts that should be included in this group. Multiple contact names should be separated by commas. This directive may be used as an alternative to (or in addition to) using the contactgroups directive in contact definitions.

\r\n

NagiosQL: If you select a contactgroup inside a contact definition using the contactgroups directive in contact definition, this contact will not be selected here because these are two different ways to specify a contactgroup!

\r\n

Parameter name: members
Required:
yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(150, 'contactgroup', 'alias', 'all', 'default', '

Contactgroup - alias

\r\n

This directive is used to define a longer name or description used to identify the contact group.

\r\n

Parameter name: alias
Required:
yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(151, 'contactgroup', 'contactgroup_members', 'all', 'default', '

Contactgroup - contactgroup members

\r\n

This optional directive can be used to include contacts from other "sub" contact groups in this contact group. Specify a comma-delimited list of short names of other contact groups whose members should be included in this group.

\r\n

Parameter name: contactgroup_members
Required:
no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(152, 'timeperiod', 'timeperiod_name', 'all', 'default', '

Timeperiod - timeperiod name

\r\n

This directives is the short name used to identify the time period.

\r\n

Parameter name: timeperiod_name
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(153, 'timeperiod', 'exclude', '3', 'default', '

Timeperiod - exclude

\r\n

This directive is used to specify the short names of other timeperiod definitions whose time ranges should be excluded from this timeperiod. Multiple timeperiod names should be separated with a comma.

\r\n

Parameter name: exclude
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(154, 'timeperiod', 'alias', 'all', 'default', '

Timeperiod - alias

\r\n

This directive is a longer name or description used to identify the time period.

\r\n

Parameter name: alias
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(155, 'timeperiod', 'templatename', '3', 'default', '

Timeperiod - template name

\r\n

Not yet implemented.

\r\n

Parameter name: name
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(156, 'timeperiod', 'weekday', '2', 'default', '

Timeperiod - time definition

\r\n

The sunday through saturday directives are comma-delimited lists of time ranges that are "valid" times for a particular day of the week. Notice that there are seven different days for which you can define time ranges (Sunday through Saturday).

\r\n

Parameter name: [weekday] [exception]
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(157, 'timeperiod', 'timerange', '2', 'default', '

Timeperiod - time range

\r\n

Each time range is in the form of HH:MM-HH:MM, where hours are specified on a 24 hour clock. For example, 00:15-24:00 means 12:15am in the morning for this day until 12:20am midnight (a 23 hour, 45 minute total time range). If you wish to exclude an entire day from the timeperiod, simply do not include it in the timeperiod definition.

\r\n

Parameter name: [weekday] [exception]
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(158, 'timeperiod', 'weekday', '3', 'default', '

Timeperiod - time definition

\r\n

The weekday directives ("sunday" through "saturday")are comma-delimited lists of time ranges that are "valid" times for a particular day of the week. Notice that there are seven different days for which you can define time ranges (Sunday through Saturday). 

\r\n

You can also specify several different types of exceptions to the standard rotating weekday schedule. Exceptions can take a number of different forms including single days of a specific or generic month, single weekdays in a month, or single calendar dates. You can also specify a range of days/dates and even specify skip intervals to obtain functionality described by "every 3 days between these dates". Rather than list all the possible formats for exception strings, Weekdays and different types of exceptions all have different levels of precedence, so its important to understand how they can affect each other. More information on this can be found in the documentation on timeperiods.

\r\n

Parameter name: [weekday] [exception]
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(159, 'timeperiod', 'timerange', '3', 'default', '

Timeperiod - time range

\r\n

Each time range is in the form of HH:MM-HH:MM, where hours are specified on a 24 hour clock. For example, 00:15-24:00 means 12:15am in the morning for this day until 12:00am midnight (a 23 hour, 45 minute total time range). If you wish to exclude an entire day from the timeperiod, simply do not include it in the timeperiod definition.

\r\n

Parameter name: [weekday] [exception]
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(160, 'contacttemplate', 'template_name', 'all', 'default', '

Contacttemplate - template name

\r\n

This directive is used to define a short name used to identify the contact template.

\r\n

Parameter name: name
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(161, 'command', 'command_name', 'all', 'default', '

Command - command name

\r\n

This directive is the short name used to identify the command. It is referenced in contact, host, and service definitions (in notification, check, and event handler directives), among other places.

\r\n

Parameter name: command_name
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(162, 'command', 'command_line', 'all', 'default', '

Command - command line

\r\n

This directive is used to define what is actually executed by Nagios when the command is used for service or host checks, notifications, or event handlers. Before the command line is executed, all valid macros are replaced with their respective values. See the documentation on macros for determining when you can use different macros. Note that the command line is not surrounded in quotes. Also, if you want to pass a dollar sign ($) on the command line, you have to escape it with another dollar sign.

\r\n

NOTE: You may not include a semicolon (;) in the command_line directive, because everything after it will be ignored as a config file comment. You can work around this limitation by setting one of the $USER$ macros in your resource file to a semicolon and then referencing the appropriate $USER$ macro in the command_line directive in place of the semicolon.

\r\n

If you want to pass arguments to commands during runtime, you can use $ARGn$ macros in the command_line directive of the command definition and then separate individual arguments from the command name (and from each other) using bang (!) characters in the object definition directive (host check command, service event handler command, etc) that references the command. More information on how arguments in command definitions are processed during runtime can be found in the documentation on macros.

\r\n

Parameter name: command_line
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(163, 'command', 'command_type', 'all', 'default', '

Command - command type

\r\n

This directive is used to differ checks and misc commands. Its a NagiosQL definition only.

\r\n

Commands tagged as "check command" will be displayed in services and hosts as check command.

\r\n

Commands tagged as "misc command" will be displayed in contacts, services and hosts as event command.

\r\n

Not classified commands will be displayed everywhere.

\r\n

This definition is only used to reduce the amount of commands shown in the selection fields and to have a more clear view.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(164, 'hostdependency', 'dependent_host', 'all', 'default', '

Hostdependency - dependent host name

\r\n

This directive is used to identify the short name(s) of the dependent host(s). Multiple hosts should be separated by commas

\r\n

Parameter name: dependent_host_name
Required: yes (no, if a dependent hostgroup is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(165, 'hostdependency', 'dependent_hostgroups', 'all', 'default', '

Hostdependency - dependent hostgroup name

\r\n

This directive is used to identify the short name(s) of the dependenthostgroup(s). Multiple hostgroups should be separated by commas. The dependent_hostgroup_name may be used instead of, or in addition to, the dependent_host_name directive.

\r\n

Parameter name: dependent_hostgroup_name
Required: no (yes, if no dependent host is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(166, 'hostdependency', 'host', 'all', 'default', '

Hostdependency - host name

\r\n

This directive is used to identify the short name(s) of the host(s) that is being depended upon (also referred to as the master host). Multiple hosts should be separated by commas.

\r\n

Parameter name: host_name
Required: yes (no, if  a hostgroup is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(167, 'hostdependency', 'hostgroup', 'all', 'default', '

Hostdependency - hostgroup name

\r\n

This directive is used to identify the short name(s) of the host(s) that is being depended upon (also referred to as the master host). Multiple hosts should be separated by commas.

\r\n

Parameter name: hostgroup_name
Required: no (yes, if a no host is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(168, 'hostdependency', 'config_name', 'all', 'default', '

Hostdependency - config name

\r\n

This directive is used to specify a common config name for a hostdependency configration. This is a NagiosQL parameter and it will not be written to the configuration file.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(169, 'hostdependency', 'inherit_parents', 'all', 'default', '

Hostdependency - inherits parent

\r\n

This directive indicates whether or not the dependency inherits dependencies of the host that is being depended upon (also referred to as the master host). In other words, if the master host is dependent upon other hosts and any one of those dependencies fail, this dependency will also fail.

\r\n

Parameter name: inherits_parent
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(170, 'hostdependency', 'dependency_period', '3', 'default', '

Hostdependency - dependency_period

\r\n

This directive is used to specify the short name of the time period during which this dependency is valid. If this directive is not specified, the dependency is considered to be valid during all times.

\r\n

Parameter name: dependency_period
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(171, 'hostdependency', 'execution_failure_criteria', 'all', 'default', '

Hostdependency - execution failure criteria

\r\n

This directive is used to specify the criteria that determine when the dependent host should not be actively checked. If the master host is in one of the failure states we specify, the dependent host will not be actively checked. Valid options are a combination of one or more of the following (multiple options are separated with commas):
o = fail on an UP state,
d = fail on a DOWN state,
u = fail on an UNREACHABLE state, and
p
= fail on a pending state (e.g. the host has not yet been checked).

\r\n

If you specify n (none) as an option, the execution dependency will never fail and the dependent host will always be actively checked (if other conditions allow for it to be).

\r\n

Example: If you specify u,d in this field, the dependent host will not be actively checked if the master host is in either an UNREACHABLE or DOWN state.

\r\n

Parameter name: execution_failure_criteria
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(172, 'hostdependency', 'notification_failure_criteria', 'all', 'default', '

Hostdependency - notification failure criteria

\r\n

This directive is used to define the criteria that determine when notifications for the dependent host should not be sent out. If the master host is in one of the failure states we specify, notifications for the dependent host will not be sent to contacts. Valid options are a combination of one or more of the following:
o = fail on an UP state,
d = fail on a DOWN state,
u = fail on an UNREACHABLE state, and
p = fail on a pending state (e.g. the host has not yet been checked).

\r\n

If you specify n (none) as an option, the notification dependency will never fail and notifications for the dependent host will always be sent out.

\r\n

Example: If you specify d in this field, the notifications for the dependent host will not be sent out if the master host is in a DOWN state.

\r\n

Parameter name: notification_failure_criteria
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(173, 'hostescalation', 'host', 'all', 'default', '

Hostescalation - host name

\r\n

This directive is used to identify the short name of the host that the escalation should apply to.

\r\n

Parameter name: host_name
Required: yes (no, if a hostgroup name is defined

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(174, 'hostescalation', 'hostgroup', 'all', 'default', '

Hostescalation - hostgroup name

\r\n

This directive is used to identify the short name(s) of the hostgroup(s) that the escalation should apply to. Multiple hostgroups should be separated by commas. If this is used, the escalation will apply to all hosts that are members of the specified hostgroup(s).

\r\n

Parameter name: hostgroup_name
Required: no (yes, if no host ist defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(175, 'hostescalation', 'contact', 'all', 'default', '

Hostescalation - contacts

\r\n

This is a list of the short names of the contacts that should be notified whenever there are problems (or recoveries) with this host. Multiple contacts should be separated by commas. Useful if you want notifications to go to just a few people and don''t want to configure contact groups. You must specify at least one contact or contact group in each host escalation definition.

\r\n

Parameter name: contacts
Required: yes (no, if a contactgroup is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(176, 'hostescalation', 'contactgroup', 'all', 'default', '

Hostescalation - contact groups

\r\n

This directive is used to identify the short name of the contact group that should be notified when the host notification is escalated. Multiple contact groups should be separated by commas. You must specify at least one contact or contact group in each host escalation definition.

\r\n

Parameter name: contact_groups
Required: yes (no, if a contact is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(177, 'hostescalation', 'config_name', 'all', 'default', '

Hostescalation - config name

\r\n

This directive is used to specify a common config name for a hostescalation configration. This is a NagiosQL parameter and it will not be written to the configuration file.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(178, 'hostescalation', 'escalation_period', 'all', 'default', '

Hostescalation - escalation period

\r\n

This directive is used to specify the short name of the time period during which this escalation is valid. If this directive is not specified, the escalation is considered to be valid during all times.

\r\n

Parameter name: escalation_period
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(179, 'hostescalation', 'escalation_options', 'all', 'default', '

Hostescalation - escalation options

\r\n

This directive is used to define the criteria that determine when this host escalation is used. The escalation is used only if the host is in one of the states specified in this directive. If this directive is not specified in a host escalation, the escalation is considered to be valid during all host states. Valid options are a combination of one or more of the following:
r = escalate on an UP (recovery) state,
d = escalate on a DOWN state, and
u
= escalate on an UNREACHABLE state.

\r\n

Example: If you specify d in this field, the escalation will only be used if the host is in a DOWN state.

\r\n

Parameter name: escalation_options
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(180, 'hostescalation', 'first_notification', 'all', 'default', '

Hostescalation - first notification

\r\n

This directive is a number that identifies the first notification for which this escalation is effective. For instance, if you set this value to 3, this escalation will only be used if the host is down or unreachable long enough for a third notification to go out.

\r\n

Parameter name: first_notification
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(181, 'hostescalation', 'last_notification', 'all', 'default', '

Hostescalation - last notification

\r\n

This directive is a number that identifies the last notification for which this escalation is effective. For instance, if you set this value to 5, this escalation will not be used if more than five notifications are sent out for the host. Setting this value to 0 means to keep using this escalation entry forever (no matter how many notifications go out).

\r\n

Parameter name: last_notification
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(182, 'hostescalation', 'notification_intervall', 'all', 'default', '

Hostescalation - notification interval

\r\n

This directive is used to determine the interval at which notifications should be made while this escalation is valid. If you specify a value of 0 for the interval, Nagios will send the first notification when this escalation definition is valid, but will then prevent any more problem notifications from being sent out for the host. Notifications are sent out again until the host recovers.

\r\n

This is useful if you want to stop having notifications sent out after a certain amount of time. Note: If multiple escalation entries for a host overlap for one or more notification ranges, the smallest notification interval from all escalation entries is used.

\r\n

Parameter name: notification_interval
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(183, 'hostextinfo', 'host_name', 'all', 'default', '

Hostextinfo - host name

\r\n

This variable is used to identify the short name of the host which the data is associated with.

\r\n

Parameter name: host_name
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(184, 'hostextinfo', 'icon_image', 'all', 'default', '

Hostextinfo - icon image

\r\n

This variable is used to define the name of a GIF, PNG, or JPG image that should be associated with this host. This image will be displayed in the status and extended information CGIs. The image will look best if it is 40x40 pixels in size.

\r\n

Images for hosts are assumed to be in the logos/ subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).

\r\n

Parameter name: icon_image
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(185, 'hostextinfo', 'notes', 'all', 'default', '

Hostextinfo - notes

\r\n

This directive is used to define an optional string of notes pertaining to the host. If you specify a note here, you will see the it in the extended information CGI (when you are viewing information about the specified host).

\r\n

Parameter name: notes
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(186, 'hostextinfo', 'icon_image_alt_text', 'all', 'default', '

Hostextinfo - icon image alt

\r\n

This variable is used to define an optional string that is used in the ALT tag of the image specified by the <icon_image> argument. The ALT tag is used in the status, extended information and statusmap CGIs.

\r\n

Parameter name: icon_image_alt
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(187, 'hostextinfo', 'notes_url', 'all', 'default', '

Hostextinfo - notes url

\r\n

This variable is used to define an optional URL that can be used to provide more information about the host. If you specify an URL, you will see a link that says "Extra Host Notes" in the extended information CGI (when you are viewing information about the specified host). Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/). This can be very useful if you want to make detailed information on the host, emergency contact methods, etc. available to other support staff.

\r\n

Parameter name: notes_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(188, 'hostextinfo', 'vrml_image', 'all', 'default', '

Hostextinfo - vrml image

\r\n

This variable is used to define the name of a GIF, PNG, or JPG image that should be associated with this host. This image will be used as the texture map for the specified host in the statuswrl CGI. Unlike the image you use for the icon_image variable, this one should probably not have any transparency. If it does, the host object will look a bit wierd.

\r\n

Images for hosts are assumed to be in the logos/ subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).

\r\n

Parameter name: vrml_image
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(189, 'hostextinfo', 'action_url', 'all', 'default', '

Hostextinfo - action url

\r\n

This directive is used to define an optional URL that can be used to provide more actions to be performed on the host. If you specify an URL, you will see a link that says "Extra Host Actions" in the extended information CGI (when you are viewing information about the specified host). Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/).

\r\n

Parameter name: action_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(190, 'hostextinfo', 'status_image', 'all', 'default', '

Hostextinfo - statusmap image

\r\n

This variable is used to define the name of an image that should be associated with this host in the statusmap CGI. You can specify a JPEG, PNG, and GIF image if you want, although I would strongly suggest using a GD2 format image, as other image formats will result in a lot of wasted CPU time when the statusmap image is generated.

\r\n

GD2 images can be created from PNG images by using the pngtogd2 utility supplied with Thomas Boutell''s gd library. The GD2 images should be created in uncompressed format in order to minimize CPU load when the statusmap CGI is generating the network map image.

\r\n

The image will look best if it is 40x40 pixels in size. You can leave these option blank if you are not using the statusmap CGI. Images for hosts are assumed to be in the logos/ subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).

\r\n

Parameter name: statusmap_image
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(191, 'hostextinfo', '2d_coords', 'all', 'default', '

Hostextinfo - 2d coords

\r\n

This variable is used to define coordinates to use when drawing the host in the statusmap CGI. Coordinates should be given in positive integers, as they correspond to physical pixels in the generated image. The origin for drawing (0,0) is in the upper left hand corner of the image and extends in the positive x direction (to the right) along the top of the image and in the positive y direction (down) along the left hand side of the image. For reference, the size of the icons drawn is usually about 40x40 pixels (text takes a little extra space). The coordinates you specify here are for the upper left hand corner of the host icon that is drawn.

\r\n

Note: Don''t worry about what the maximum x and y coordinates that you can use are. The CGI will automatically calculate the maximum dimensions of the image it creates based on the largest x and y coordinates you specify.

\r\n

Parameter name: 2d_coords
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(192, 'hostextinfo', '3d_coords', 'all', 'default', '

Hostextinfo - 3d coords

\r\n

This variable is used to define coordinates to use when drawing the host in the statuswrl CGI. Coordinates can be positive or negative real numbers. The origin for drawing is (0.0,0.0,0.0). For reference, the size of the host cubes drawn is 0.5 units on each side (text takes a little more space). The coordinates you specify here are used as the center of the host cube.

\r\n

Parameter name: 3d_coords
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(193, 'serviceescalation', 'host', 'all', 'default', '

Serviceescalation - host name

\r\n

This directive is used to identify the short name(s) of the host(s) that the service escalation should apply to or is associated with.

\r\n

Parameter name: host_name
Required: yes (no, if a hostgroup name is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(194, 'serviceescalation', 'hostgroup', 'all', 'default', '

Serviceescalation - hostgroup name

\r\n

This directive is used to specify the short name(s) of the hostgroup(s) that the service escalation should apply to or is associated with. Multiple hostgroups should be separated by commas. The hostgroup_name may be used instead of, or in addition to, the host_name directive.

\r\n

Parameter name: hostgroup_name
Required: yes (no, if a host name is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(195, 'serviceescalation', 'contact', 'all', 'default', '

Serviceescalation - contacts

\r\n

This is a list of the short names of the contacts that should be notified whenever there are problems (or recoveries) with this service. Multiple contacts should be separated by commas. Useful if you want notifications to go to just a few people and don''t want to configure contact groups. You must specify at least one contact or contact group in each service escalation definition.

\r\n

Parameter name: contacts
Required: yes (no, if a contact group is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(196, 'serviceescalation', 'contactgroup', 'all', 'default', '

Serviceescalation - contact groups

\r\n

This directive is used to identify the short name of the contact group that should be notified when the service notification is escalated. Multiple contact groups should be separated by commas. You must specify at least one contact or contact group in each service escalation definition.

\r\n

Parameter name: contact_groups
Required: yes (no, if a contact is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(197, 'serviceescalation', 'config_name', 'all', 'default', '

Serviceescalation - config name

\r\n

This directive is used to specify a common config name for a serviceescalation configration. This is a NagiosQL parameter and it will not be written to the configuration file.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(198, 'serviceescalation', 'service', 'all', 'default', '

Serviceescalation - service description

\r\n

This directive is used to identify the description of the service the escalation should apply to.

\r\n

Parameter name: service_description
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(199, 'serviceescalation', 'first_notification', 'all', 'default', '

Serviceescalation - first notification

\r\n

This directive is a number that identifies the first notification for which this escalation is effective. For instance, if you set this value to 3, this escalation will only be used if the service is in a non-OK state long enough for a third notification to go out.

\r\n

Parameter name: first_notification
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(200, 'serviceescalation', 'last_notification', 'all', 'default', '

Serviceescalation - last notification

\r\n

This directive is a number that identifies the last notification for which this escalation is effective. For instance, if you set this value to 5, this escalation will not be used if more than five notifications are sent out for the service. Setting this value to 0 means to keep using this escalation entry forever (no matter how many notifications go out).

\r\n

Parameter name: last_notification
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(201, 'serviceescalation', 'notification_intervall', 'all', 'default', '

Serviceescalation - notification interval

\r\n

This directive is used to determine the interval at which notifications should be made while this escalation is valid. If you specify a value of 0 for the interval, Nagios will send the first notification when this escalation definition is valid, but will then prevent any more problem notifications from being sent out for the host. Notifications are sent out again until the host recovers.

\r\n

This is useful if you want to stop having notifications sent out after a certain amount of time. Note: If multiple escalation entries for a host overlap for one or more notification ranges, the smallest notification interval from all escalation entries is used.

\r\n

Parameter name: notification_interval
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(202, 'serviceescalation', 'escalation_period', 'all', 'default', '

Serviceescalation - escalation period

\r\n

This directive is used to specify the short name of the time period during which this escalation is valid. If this directive is not specified, the escalation is considered to be valid during all times.

\r\n

Parameter name: escalation_period
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(203, 'serviceescalation', 'escalation_options', 'all', 'default', '

Serviceescalation - escalation options

\r\n

This directive is used to define the criteria that determine when this service escalation is used. The escalation is used only if the service is in one of the states specified in this directive. If this directive is not specified in a service escalation, the escalation is considered to be valid during all service states. Valid options are a combination of one or more of the following:
r
= escalate on an OK (recovery) state,
w = escalate on a WARNING state,
u
= escalate on an UNKNOWN state, and
c = escalate on a CRITICAL state.

\r\n

Example: If you specify w in this field, the escalation will only be used if the service is in a WARNING state.

\r\n

Parameter name: escalation_options
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(204, 'servicedependency', 'dependent_host', 'all', 'default', '

Servicedependency - dependent host

\r\n

This directive is used to identify the short name(s) of the host(s) that the dependent service "runs" on or is associated with. Multiple hosts should be separated by commas. Leaving this directive blank can be used to create "same host" dependencies.

\r\n

Parameter name: dependent_host
Required: yes (no, if a dependent hostgroup is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(205, 'servicedependency', 'host', 'all', 'default', '

Servicedependency - host name

\r\n

This directive is used to identify the short name(s) of the host(s) that the service that is being depended upon (also referred to as the master service) "runs" on or is associated with. Multiple hosts should be separated by commas.

\r\n

Parameter name: host_name
Required: yes (no, if a hostgroup is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(206, 'servicedependency', 'dependent_hostgroup', 'all', 'default', '

Servicedependency - dependent hostgroup

\r\n

This directive is used to specify the short name(s) of the hostgroup(s) that the dependent service "runs" on or is associated with. Multiple hostgroups should be separated by commas. The dependent_hostgroup may be used instead of, or in addition to, the dependent_host directive.

\r\n

Parameter name: dependent_hostgroup
Required: yes (no, if a dependent host is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(207, 'servicedependency', 'hostgroup', 'all', 'default', '

Servicedependency - hostgroup name

\r\n

This directive is used to identify the short name(s) of the hostgroup(s) that the service that is being depended upon (also referred to as the master service) "runs" on or is associated with. Multiple hostgroups should be separated by commas. The hostgroup_name may be used instead of, or in addition to, the host_name directive.

\r\n

Parameter name: hostgroup_name
Required: yes (no, if a host is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(208, 'servicedependency', 'dependent_services', 'all', 'default', '

Servicedependency - dependent service description

\r\n

This directive is used to identify the description of the dependent service.

\r\n

Parameter name: dependent_service_description
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(209, 'servicedependency', 'services', 'all', 'default', '

Servicedependency - service description

\r\n

This directive is used to identify the description of the service that is being depended upon (also referred to as the master service).

\r\n

Parameter name: service_description
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(210, 'servicedependency', 'config_name', 'all', 'default', '

Servicedependency - config name

\r\n

This directive is used to specify a common config name for a servicedependency configration. This is a NagiosQL parameter and it will not be written to the configuration file.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(211, 'servicedependency', 'inherit_parents', 'all', 'default', '

Servicedependency - inherits parent

\r\n

This directive indicates whether or not the dependency inherits dependencies of the service that is being depended upon (also referred to as the master service). In other words, if the master service is dependent upon other services and any one of those dependencies fail, this dependency will also fail.

\r\n

Parameter name: inherits_parent
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(212, 'servicedependency', 'dependency_period', 'all', 'default', '

Servicedependency - dependency period

\r\n

This directive is used to specify the short name of the time period during which this dependency is valid. If this directive is not specified, the dependency is considered to be valid during all times.

\r\n

Parameter name: dependency_period
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(213, 'servicedependency', 'execution_failure_criteria', 'all', 'default', '

Servicedependency - execution failure criteria

\r\n

This directive is used to specify the criteria that determine when the dependent service should not be actively checked. If the master service is in one of the failure states we specify, the dependent service will not be actively checked. Valid options are a combination of one or more of the following (multiple options are separated with commas):
o = fail on an OK state,
w = fail on a WARNING state,
u
= fail on an UNKNOWN state,
c = fail on a CRITICAL state, and
p = fail on a pending state (e.g. the service has not yet been checked).
If you specify n (none) as an option, the execution dependency will never fail and checks of the dependent service will always be actively checked (if other conditions allow for it to be).

\r\n

Example: If you specify o,c,u in this field, the dependent service will not be actively checked if the master service is in either an OK, a CRITICAL, or an UNKNOWN state.

\r\n

Parameter name: execution_failure_criteria
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(214, 'servicedependency', 'notification_failure_criteria', 'all', 'default', '

Servicedependency - notification failure criteria

\r\n

This directive is used to define the criteria that determine when notifications for the dependent service should not be sent out. If the master service is in one of the failure states we specify, notifications for the dependent service will not be sent to contacts. Valid options are a combination of one or more of the following:
o
= fail on an OK state,
w = fail on a WARNING state,
u
= fail on an UNKNOWN state,
c = fail on a CRITICAL state, and
p = fail on a pending state (e.g. the service has not yet been checked).
If you specify n (none) as an option, the notification dependency will never fail and notifications for the dependent service will always be sent out.

\r\n

Example: If you specify w in this field, the notifications for the dependent service will not be sent out if the master service is in a WARNING state.

\r\n

Parameter name: notification_failure_criteria
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(216, 'serviceextinfo', 'host_name', 'all', 'default', '

Serviceextinfo - host name

\r\n

This directive is used to identify the short name of the host that the service is associated with.

\r\n

Parameter name: host_name
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(217, 'serviceextinfo', 'icon_image', 'all', 'default', '

Serviceextinfo - icon image

\r\n

This variable is used to define the name of a GIF, PNG, or JPG image that should be associated with this host. This image will be displayed in the status and extended information CGIs.

\r\n

The image will look best if it is 40x40 pixels in size. Images for hosts are assumed to be in the logos/ subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).

\r\n

Parameter name: icon_image
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(218, 'serviceextinfo', 'service_description', 'all', 'default', '

Serviceextinfo - service description

\r\n

This directive is description of the service which the data is associated with.

\r\n

Parameter name: service_description
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(219, 'serviceextinfo', 'notes', 'all', 'default', '

Serviceextinfo - notes

\r\n

This directive is used to define an optional string of notes pertaining to the service. If you specify a note here, you will see the it in the extended information CGI (when you are viewing information about the specified service).

\r\n

Parameter name: notes
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(220, 'serviceextinfo', 'action_url', 'all', 'default', '

Serviceextinfo - action url

\r\n

This directive is used to define an optional URL that can be used to provide more actions to be performed on the service. If you specify an URL, you will see a link that says "Extra Service Actions" in the extended information CGI (when you are viewing information about the specified service). Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/).

\r\n

Parameter name: action_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(221, 'serviceextinfo', 'notes_url', 'all', 'default', '

Serviceextinfo - notes url

\r\n

This directive is used to define an optional URL that can be used to provide more information about the service. If you specify an URL, you will see a link that says "Extra Service Notes" in the extended information CGI (when you are viewing information about the specified service). Any valid URL can be used.

\r\n

If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/). This can be very useful if you want to make detailed information on the service, emergency contact methods, etc. available to other support staff.

\r\n

Parameter name: notes_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(222, 'serviceextinfo', 'icon_image_alt', 'all', 'default', '

Serviceextinfo - icon image alt

\r\n

This variable is used to define an optional string that is used in the ALT tag of the image specified by the <icon_image> argument. The ALT tag is used in the status, extended information and statusmap CGIs.

\r\n

Parameter name: icon_image_alt
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(223, 'host', 'services', 'all', 'default', '

Host - service settings

\r\n

This box can be used to allocate already existing services to a host. 

\r\n

This is an internal function of NagiosQL.

\r\n

Note: To activate the changes, the corresponding service definitions have to be rewritten!

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(224, 'timeperiod', 'name', 'all', 'default', '

Timeperiod - name

\r\n

Its just a "template" name that can be referenced in other object definitions so they can inherit the objects properties/variables. Template names must be unique amongst objects of the same type, so you can''t have two or more time definitions that have "mytemplate" as their template name.

\r\n

Parameter name: name
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(225, 'timeperiod', 'include', '3', 'default', '

Timeperiod - include

\r\n

This directive is used to specify the short names (template names) of other timeperiod definitions whose time ranges should be included to this timeperiod. Multiple timeperiod names should be separated with a comma.

\r\n

Parameter name: use
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(226, 'user', 'adminenable', 'all', 'default', '

User - enable group administration

\r\n

If this option is selected, the specified user is able to modify the access group for every object definition. This should be restricted only to administrators; otherwise a user might be able to lock himself out.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(227, 'group', 'userrights', 'all', 'default', '

Group - user rights

\r\n

Define the object access rights for a user.

\r\n

READ = The user can see the objects belong to this group
WRITE = The user can modify the objects belong to this group
LINK = The user can use the objects belong to this group to link them in other objects*

* Example: If a time object belongs to this group - the user can add (link) this time object to his contact objects.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(228, 'domain', 'conffile', 'all', 'default', '

Absolute path to your Nagios config file.

Examples:
/etc/nagios/nagios.cfg
/usr/local/nagios/etc/nagios.cfg

This is used to verify your Nagios configuration directly from NagiosQL.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(229, 'domain', 'enable_common', 'all', 'default', '

This option is used to enable or disable the global common domain functionality.

\r\n

If this option is enabled, all objects from the global common domain will be added to this domains configuration files. The global common domain can be used to define objects like timeperiods or contacts that are used in all domains the same.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(230, 'domain', 'utf8_decode', 'all', 'default', '

This is an experimental option!

\r\n

If this option is enabled, UTF8 data from database will be translated to ISO in configuration file. So, the configuration files will be in ISO mode. This could be helpful, if nagios does not understand the UTF8 data from NagiosQL.

\r\n

Tested only with western european configurations!

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(231, 'domain', 'picturedir', 'all', 'default', '

Relative path to your nagios icon images.

Example:
/my/own/images/

\r\n

This path is based on your nagios standard image path. Images are assumed to be in the logos/ subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).

\r\n

So in the example above, the images are located in:

\r\n

/usr/local/nagios/share/images/logos/my/own/images/

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(232, 'common', 'accessgroup', 'all', 'default', '

Access group

\r\n

Select an access group name to restrict this object to the group members.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(233, 'common', 'registered', 'all', 'default', '

Register

\r\n

This variable is used to indicate whether or not the object definition should be "registered" with Nagios. By default, all object definitions are registered. If you are using a partial object definition as a template, you would want to prevent it from being registered (an example of this is provided later). Values are as follows: 0 = do NOT register object definition, 1 = register object definition (this is the default). This variable is NOT inherited; every (partial) object definition used as a template must explicitly set the register directive to be 0. This prevents the need to override an inherited register directive with a value of 1 for every object that should be registered.

\r\n

Parameter name: register
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(234, 'servicedependency', 'dependent_servicegroup_name', 'all', 'default', '

Servicedependency - dependent servicegroup name

\r\n

This directive is used to identify the name of the dependent servicegroup.

\r\n

Parameter name: dependent_servicegroup_name
Required: yes (no, if a dependent service is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(235, 'servicedependency', 'servicegroup_name', 'all', 'default', '

Servicedependency - servicegroup name

\r\n

This directive is used to identify the name of the servicegroup that is being depended upon (also referred to as the master service).

\r\n

Parameter name: servicegroup_name
Required: yes (no, if a service is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(236, 'serviceescalation', 'servicegroup', 'all', 'default', '

Serviceescalation - servicegroup name

\r\n

This directive is used to identify the name of the servicegroup the escalation should apply to.

\r\n

Parameter name: servicegroup_name
Required: yes (no, if a service is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(237, 'user', 'language', 'all', 'default', '

User - language

\r\n

Defines a default UI language for the user.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(238, 'user', 'standarddomain', 'all', 'default', '

User - standard domain

\r\n

Defines a standard domain for the user. After the user has logged in, the defined domain is pre-selected.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(239, 'domain', 'targets', 'all', 'default', '

Select a configuration domain which is assigned to this data domain

\r\n

The settings where to store the configuration files are defined in a configuration domain. Select here the desired target for your configuration files.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(240, 'domain', 'ssh_host_key', 'all', 'default', 'Absolute path to the ssh key directory for the defined ssh user.

Examples:
/etc/nagiosql/ssh/
/usr/local/nagios/etc/.ssh/

This directory includes the key file (id_rsa) for the user to connect to the remote system. Note, that the file name is set to id_rsa!'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(241, 'contact', 'minimum_importance', 'all', 'default', '

Contact - minimum importance

\r\n

This directive is used as the value that the host or service importance value must equal before notification is sent to this contact. The importance values are intended to represent the value of a host or service to an organization. For example, you could set this value and the importance value of a host such that a system administrator would be notified when a development server goes down, but the CIO would only be notified when the company\'s production ecommerce database server was down. The minimum_importance value defaults to zero.

\r\n

In Nagios Core 4.0.0 to 4.0.3 this was known as minimum_value but has been replaced with minimum_importance.

\r\n

Parameter name: minimum_importance
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(242, 'domain', 'ftps_option', 'all', 'default', 'Use encrypted FTP (FTPS) to connect to the remote server. '); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(243, 'domain', 'cgifile', 'all', 'default', '

Absolute path to your Nagios CGI config file.

Examples:
/etc/nagios/cgi.cfg
/usr/local/nagios/etc/cgi.cfg

This is used to edit Nagios website options directly from NagiosQL.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(244, 'domain', 'resourcefile', 'all', 'default', '

Absolute path to your Nagios resource config file.

Examples:
/etc/nagios/resource.cfg
/usr/local/nagios/etc/resource.cfg

This file is used to verify your configuration in Nagios 4.x. Be sure this file is readably by your webserver\'s user!

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(245, 'host', 'importance', 'all', 'default', '

Host - importance

This directive is used to represent the importance of the host to your organization. The importance is used when determining whether to send notifications to a contact. If the host\'s importance value plus the importance values of all of the host\'s services is greater than or equal to the contact\'s minimum_importance, the contact will be notified. For example, you could set this value and the minimum_importance of contacts such that a system administrator would be notified when a development server goes down, but the CIO would only be notified when the company\'s production ecommerce database server was down. The importance could also be used as a sort criteria when generating reports or for calculating a good system administrator\'s bonus. The importance value defaults to zero. In Nagios Core 4.0.0 to 4.0.3 this was known as hourly_value but has been replaced with importance.

Parameter name: importance
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(246, 'service', 'importance', 'all', 'default', '

Service - importance

\r\n

This directive is used to represent the importance of the service to your organization. The importance is used when determining whether to send notifications to a contact. If the service\'s importance value is greater than or equal to the contact\'s minimum_importance, the contact will be notified. For example, you could set this value and the minimum_importance of contacts such that a system administrator would be notified of a disk full event on a development server, but the CIO would only be notified when the company\'s production ecommerce database was down. The importance could also be used as a sort criteria when generating reports or for calculating a good system administrator\'s bonus. The importance value defaults to zero. In Nagios Core 4.0.0 to 4.0.3 this was known as hourly_value but has been replaced with importance.

\r\n

Parameter name: importance
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(247, 'service', 'parents', 'all', 'default', '

Service - parents

\r\n

This directive is used to define a comma-delimited list of short names of the \"parent\" services for this particular service. Parent services are typically other services that need to be available in order for a check of this service to occur. For example, if a service checks the status of a disk using SSH, the disk check service would have the SSH service as a parent. If the service has no parent services, simply omit the \"parents\" directive. More complex service dependencies may be specified with service dependency objects.

\r\n

Parameter name: parents
Required: no

'); + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_language` +-- + +CREATE TABLE IF NOT EXISTS `tbl_language` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `language` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `locale` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL, + `last_modified` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_language` +-- + +INSERT INTO `tbl_language` (`id`, `language`, `locale`, `active`, `last_modified`) VALUES(1, 'English', 'en_GB', '1', NOW()); +INSERT INTO `tbl_language` (`id`, `language`, `locale`, `active`, `last_modified`) VALUES(2, 'German', 'de_DE', '1', NOW()); +INSERT INTO `tbl_language` (`id`, `language`, `locale`, `active`, `last_modified`) VALUES(3, 'Chinese (Simplified)', 'zh_CN', '1', NOW()); +INSERT INTO `tbl_language` (`id`, `language`, `locale`, `active`, `last_modified`) VALUES(5, 'Italian', 'it_IT', '1', NOW()); +INSERT INTO `tbl_language` (`id`, `language`, `locale`, `active`, `last_modified`) VALUES(6, 'French', 'fr_FR', '1', NOW()); +INSERT INTO `tbl_language` (`id`, `language`, `locale`, `active`, `last_modified`) VALUES(7, 'Russian', 'ru_RU', '1', NOW()); +INSERT INTO `tbl_language` (`id`, `language`, `locale`, `active`, `last_modified`) VALUES(8, 'Spanish', 'es_ES', '1', NOW()); +INSERT INTO `tbl_language` (`id`, `language`, `locale`, `active`, `last_modified`) VALUES(9, 'Portuguese (Brazilian)', 'pt_BR', '1', NOW()); +INSERT INTO `tbl_language` (`id`, `language`, `locale`, `active`, `last_modified`) VALUES(11, 'Dutch', 'nl_NL', '1', NOW()); +INSERT INTO `tbl_language` (`id`, `language`, `locale`, `active`, `last_modified`) VALUES(13, 'Danish', 'da_DK', '1', NOW()); + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContactgroupToContact` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContactgroupToContact` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContactgroupToContact` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContactgroupToContactgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContactgroupToContactgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContactgroupToContactgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContacttemplateToCommandHost` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContacttemplateToCommandHost` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContacttemplateToCommandHost` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContacttemplateToCommandService` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContacttemplateToCommandService` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContacttemplateToCommandService` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContacttemplateToContactgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContacttemplateToContactgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContacttemplateToContactgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContacttemplateToContacttemplate` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContacttemplateToContacttemplate` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `idSort` int(11) NOT NULL, + `idTable` tinyint(4) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`,`idTable`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContacttemplateToContacttemplate` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContacttemplateToVariabledefinition` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContacttemplateToVariabledefinition` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContacttemplateToVariabledefinition` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContactToCommandHost` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContactToCommandHost` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContactToCommandHost` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContactToCommandService` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContactToCommandService` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContactToCommandService` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContactToContactgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContactToContactgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContactToContactgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContactToContacttemplate` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContactToContacttemplate` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `idSort` int(11) NOT NULL, + `idTable` tinyint(4) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`,`idTable`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContactToContacttemplate` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContactToVariabledefinition` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContactToVariabledefinition` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContactToVariabledefinition` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkGroupToUser` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkGroupToUser` ( + `idMaster` int(10) unsigned NOT NULL, + `idSlave` int(10) unsigned NOT NULL, + `read` enum('0','1') NOT NULL DEFAULT '1', + `write` enum('0','1') NOT NULL DEFAULT '1', + `link` enum('0','1') NOT NULL DEFAULT '1', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkGroupToUser` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostdependencyToHostgroup_DH` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostdependencyToHostgroup_DH` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostdependencyToHostgroup_DH` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostdependencyToHostgroup_H` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostdependencyToHostgroup_H` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostdependencyToHostgroup_H` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostdependencyToHost_DH` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostdependencyToHost_DH` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostdependencyToHost_DH` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostdependencyToHost_H` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostdependencyToHost_H` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostdependencyToHost_H` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostescalationToContact` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostescalationToContact` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostescalationToContact` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostescalationToContactgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostescalationToContactgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostescalationToContactgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostescalationToHost` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostescalationToHost` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostescalationToHost` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostescalationToHostgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostescalationToHostgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostescalationToHostgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostgroupToHost` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostgroupToHost` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostgroupToHost` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostgroupToHostgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostgroupToHostgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostgroupToHostgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHosttemplateToContact` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHosttemplateToContact` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHosttemplateToContact` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHosttemplateToContactgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHosttemplateToContactgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHosttemplateToContactgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHosttemplateToHost` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHosttemplateToHost` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHosttemplateToHost` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHosttemplateToHostgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHosttemplateToHostgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHosttemplateToHostgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHosttemplateToHosttemplate` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHosttemplateToHosttemplate` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `idSort` int(11) NOT NULL, + `idTable` tinyint(4) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`,`idTable`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHosttemplateToHosttemplate` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHosttemplateToVariabledefinition` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHosttemplateToVariabledefinition` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHosttemplateToVariabledefinition` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostToContact` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostToContact` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostToContact` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostToContactgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostToContactgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostToContactgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostToHost` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostToHost` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostToHost` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostToHostgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostToHostgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostToHostgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostToHosttemplate` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostToHosttemplate` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `idSort` int(11) NOT NULL, + `idTable` tinyint(4) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`,`idTable`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostToHosttemplate` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostToVariabledefinition` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostToVariabledefinition` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostToVariabledefinition` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicedependencyToHostgroup_DH` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicedependencyToHostgroup_DH` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicedependencyToHostgroup_DH` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicedependencyToHostgroup_H` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicedependencyToHostgroup_H` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicedependencyToHostgroup_H` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicedependencyToHost_DH` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicedependencyToHost_DH` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicedependencyToHost_DH` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicedependencyToHost_H` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicedependencyToHost_H` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicedependencyToHost_H` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicedependencyToService_DS` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicedependencyToService_DS` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `strSlave` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicedependencyToService_DS` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicedependencyToService_S` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicedependencyToService_S` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `strSlave` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicedependencyToService_S` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicedependencyToServicegroup_DS` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicedependencyToServicegroup_DS` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicedependencyToServicegroup_DS` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicedependencyToServicegroup_S` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicedependencyToServicegroup_S` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicedependencyToServicegroup_S` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceescalationToContact` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceescalationToContact` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceescalationToContact` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceescalationToContactgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceescalationToContactgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceescalationToContactgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceescalationToHost` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceescalationToHost` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceescalationToHost` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceescalationToHostgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceescalationToHostgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceescalationToHostgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceescalationToService` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceescalationToService` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `strSlave` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceescalationToService` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceescalationToServicegroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceescalationToServicegroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceescalationToService` +-- + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicegroupToService` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicegroupToService` ( + `idMaster` int(11) NOT NULL, + `idSlaveH` int(11) NOT NULL, + `idSlaveHG` int(11) NOT NULL, + `idSlaveS` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlaveH`,`idSlaveHG`,`idSlaveS`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicegroupToService` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicegroupToServicegroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicegroupToServicegroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicegroupToServicegroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicetemplateToContact` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicetemplateToContact` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicetemplateToContact` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicetemplateToContactgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicetemplateToContactgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicetemplateToContactgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicetemplateToHost` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicetemplateToHost` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicetemplateToHost` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicetemplateToHostgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicetemplateToHostgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicetemplateToHostgroup` +-- + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicetemplateToService` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicetemplateToService` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `idHost` int(11) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicetemplateToService` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicetemplateToServicegroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicetemplateToServicegroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicetemplateToServicegroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicetemplateToServicetemplate` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicetemplateToServicetemplate` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `idSort` int(11) NOT NULL, + `idTable` tinyint(4) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`,`idTable`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicetemplateToServicetemplate` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicetemplateToVariabledefinition` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicetemplateToVariabledefinition` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicetemplateToVariabledefinition` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceToContact` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceToContact` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceToContact` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceToContactgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceToContactgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceToContactgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceToHost` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceToHost` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceToHost` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceToHostgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceToHostgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceToHostgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceToService` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceToService` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `idHost` int(11) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceToService` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceToServicegroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceToServicegroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceToServicegroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceToServicetemplate` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceToServicetemplate` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `idSort` int(11) NOT NULL, + `idTable` tinyint(4) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`,`idTable`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceToServicetemplate` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceToVariabledefinition` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceToVariabledefinition` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceToVariabledefinition` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkTimeperiodToTimeperiod` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkTimeperiodToTimeperiod` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkTimeperiodToTimeperiod` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkTimeperiodToTimeperiodUse` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkTimeperiodToTimeperiodUse` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkTimeperiodToTimeperiodUse` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_logbook` +-- + +CREATE TABLE IF NOT EXISTS `tbl_logbook` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `time` datetime NOT NULL, + `user` varchar(255) NOT NULL, + `ipadress` varchar(255) NOT NULL, + `domain` varchar(255) NOT NULL, + `entry` tinytext NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_logbook` +-- + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_menu` +-- + +CREATE TABLE IF NOT EXISTS `tbl_menu` ( + `mnuId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `mnuTopId` int(10) unsigned NOT NULL, + `mnuGrpId` int(10) unsigned NOT NULL DEFAULT '0', + `mnuCntId` int(10) unsigned NOT NULL, + `mnuName` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `mnuLink` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `mnuActive` tinyint(3) unsigned NOT NULL DEFAULT '1', + `mnuOrderId` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`mnuId`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_menu` +-- + +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(1, 0, 0, 1, 'Main page', 'admin.php', 1, 1); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(2, 0, 0, 1, 'Supervision', 'admin/monitoring.php', 1, 2); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(3, 0, 0, 1, 'Alarming', 'admin/alarming.php', 1, 3); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(4, 0, 0, 1, 'Commands', 'admin/commands.php', 1, 4); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(5, 0, 0, 1, 'Specialties', 'admin/specials.php', 1, 5); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(6, 0, 0, 1, 'Tools', 'admin/tools.php', 1, 6); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(7, 0, 0, 1, 'Administration', 'admin/administration.php', 1, 7); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(8, 2, 0, 1, 'Host', 'admin/hosts.php', 1, 1); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(9, 2, 0, 1, 'Services', 'admin/services.php', 1, 2); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(10, 2, 0, 1, 'Host groups', 'admin/hostgroups.php', 1, 3); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(11, 2, 0, 1, 'Service groups', 'admin/servicegroups.php', 1, 4); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(12, 2, 0, 1, 'Host templates', 'admin/hosttemplates.php', 1, 5); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(13, 2, 0, 1, 'Service templates', 'admin/servicetemplates.php', 1, 6); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(14, 3, 0, 1, 'Contact data', 'admin/contacts.php', 1, 1); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(15, 3, 0, 1, 'Contact groups', 'admin/contactgroups.php', 1, 2); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(16, 3, 0, 1, 'Time periods', 'admin/timeperiods.php', 1, 3); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(17, 3, 0, 1, 'Contact templates', 'admin/contacttemplates.php', 1, 4); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(18, 4, 0, 1, 'Definitions', 'admin/checkcommands.php', 1, 1); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(19, 5, 0, 1, 'Host dependency', 'admin/hostdependencies.php', 1, 1); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(20, 5, 0, 1, 'Host escalation', 'admin/hostescalations.php', 1, 2); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(21, 5, 0, 1, 'Extended Host', 'admin/hostextinfo.php', 1, 3); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(22, 5, 0, 1, 'Service dependency', 'admin/servicedependencies.php', 1, 4); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(23, 5, 0, 1, 'Service escalation', 'admin/serviceescalations.php', 1, 5); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(24, 5, 0, 1, 'Extended Service', 'admin/serviceextinfo.php', 1, 6); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(25, 6, 0, 1, 'Data import', 'admin/import.php', 1, 1); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(26, 6, 0, 1, 'Delete backup files', 'admin/delbackup.php', 1, 2); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(27, 6, 0, 1, 'Delete config files', 'admin/delconfig.php', 1, 3); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(28, 6, 0, 1, 'Nagios config', 'admin/nagioscfg.php', 1, 4); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(29, 6, 0, 1, 'CGI config', 'admin/cgicfg.php', 1, 5); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(30, 6, 0, 1, 'Nagios control', 'admin/verify.php', 1, 6); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(31, 7, 0, 1, 'New password', 'admin/password.php', 1, 1); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(32, 7, 0, 1, 'User admin', 'admin/user.php', 1, 2); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(33, 7, 0, 1, 'Group admin', 'admin/group.php', 1, 3); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(34, 7, 0, 1, 'Menu access', 'admin/menuaccess.php', 1, 4); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(35, 7, 0, 1, 'Data domains', 'admin/datadomain.php', 1, 5); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(36, 7, 0, 1, 'Config targets', 'admin/configtargets.php', 1, 6); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(37, 7, 0, 1, 'Logbook', 'admin/logbook.php', 1, 7); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(38, 7, 0, 1, 'Settings', 'admin/settings.php', 1, 8); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(39, 7, 0, 1, 'Help editor', 'admin/helpedit.php', 1, 9); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(40, 7, 0, 1, 'Support', 'admin/support.php', 1, 10); + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_relationinformation` +-- + +CREATE TABLE IF NOT EXISTS `tbl_relationinformation` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `master` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `tableName1` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `tableName2` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `fieldName` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `linkTable` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `target1` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `target2` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `targetKey` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `fullRelation` tinyint(3) unsigned NOT NULL DEFAULT '0', + `flags` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `type` tinyint(3) unsigned NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_relationinformation` +-- + +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(1, 'tbl_timeperiod', 'tbl_timeperiod', '', 'exclude', 'tbl_lnkTimeperiodToTimeperiod', 'timeperiod_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(2, 'tbl_contact', 'tbl_command', '', 'host_notification_commands', 'tbl_lnkContactToCommandHost', 'command_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(3, 'tbl_contact', 'tbl_command', '', 'service_notification_commands', 'tbl_lnkContactToCommandService', 'command_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(4, 'tbl_contact', 'tbl_contactgroup', '', 'contactgroups', 'tbl_lnkContactToContactgroup', 'contactgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(5, 'tbl_contact', 'tbl_timeperiod', '', 'host_notification_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(6, 'tbl_contact', 'tbl_timeperiod', '', 'service_notification_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(7, 'tbl_contact', 'tbl_contacttemplate', 'tbl_contact', 'use_template', 'tbl_lnkContactToContacttemplate', 'template_name', 'name', '', 0, '', 3); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(8, 'tbl_contact', 'tbl_variabledefinition', '', 'use_variables', 'tbl_lnkContactToVariabledefinition', 'name', '', '', 0, '', 4); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(9, 'tbl_contacttemplate', 'tbl_command', '', 'host_notification_commands', 'tbl_lnkContacttemplateToCommandHost', 'command_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(10, 'tbl_contacttemplate', 'tbl_command', '', 'service_notification_commands', 'tbl_lnkContacttemplateToCommandService', 'command_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(11, 'tbl_contacttemplate', 'tbl_contactgroup', '', 'contactgroups', 'tbl_lnkContacttemplateToContactgroup', 'contactgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(12, 'tbl_contacttemplate', 'tbl_timeperiod', '', 'host_notification_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(13, 'tbl_contacttemplate', 'tbl_timeperiod', '', 'service_notification_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(14, 'tbl_contacttemplate', 'tbl_contacttemplate', 'tbl_contact', 'use_template', 'tbl_lnkContacttemplateToContacttemplate', 'template_name', 'name', '', 0, '', 3); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(15, 'tbl_contacttemplate', 'tbl_variabledefinition', '', 'use_variables', 'tbl_lnkContacttemplateToVariabledefinition', 'name', '', '', 0, '', 4); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(16, 'tbl_contactgroup', 'tbl_contact', '', 'members', 'tbl_lnkContactgroupToContact', 'contact_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(17, 'tbl_contactgroup', 'tbl_contactgroup', '', 'contactgroup_members', 'tbl_lnkContactgroupToContactgroup', 'contactgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(18, 'tbl_hosttemplate', 'tbl_host', '', 'parents', 'tbl_lnkHosttemplateToHost', 'host_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(19, 'tbl_hosttemplate', 'tbl_hostgroup', '', 'hostgroups', 'tbl_lnkHosttemplateToHostgroup', 'hostgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(20, 'tbl_hosttemplate', 'tbl_contactgroup', '', 'contact_groups', 'tbl_lnkHosttemplateToContactgroup', 'contactgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(21, 'tbl_hosttemplate', 'tbl_contact', '', 'contacts', 'tbl_lnkHosttemplateToContact', 'contact_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(22, 'tbl_hosttemplate', 'tbl_timeperiod', '', 'check_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(23, 'tbl_hosttemplate', 'tbl_command', '', 'check_command', '', 'command_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(24, 'tbl_hosttemplate', 'tbl_timeperiod', '', 'notification_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(25, 'tbl_hosttemplate', 'tbl_command', '', 'event_handler', '', 'command_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(26, 'tbl_hosttemplate', 'tbl_hosttemplate', 'tbl_host', 'use_template', 'tbl_lnkHosttemplateToHosttemplate', 'template_name', 'name', '', 0, '', 3); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(27, 'tbl_hosttemplate', 'tbl_variabledefinition', '', 'use_variables', 'tbl_lnkHosttemplateToVariabledefinition', 'name', '', '', 0, '', 4); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(28, 'tbl_host', 'tbl_host', '', 'parents', 'tbl_lnkHostToHost', 'host_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(29, 'tbl_host', 'tbl_hostgroup', '', 'hostgroups', 'tbl_lnkHostToHostgroup', 'hostgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(30, 'tbl_host', 'tbl_contactgroup', '', 'contact_groups', 'tbl_lnkHostToContactgroup', 'contactgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(31, 'tbl_host', 'tbl_contact', '', 'contacts', 'tbl_lnkHostToContact', 'contact_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(32, 'tbl_host', 'tbl_timeperiod', '', 'check_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(33, 'tbl_host', 'tbl_command', '', 'check_command', '', 'command_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(34, 'tbl_host', 'tbl_timeperiod', '', 'notification_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(35, 'tbl_host', 'tbl_command', '', 'event_handler', '', 'command_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(36, 'tbl_host', 'tbl_hosttemplate', 'tbl_host', 'use_template', 'tbl_lnkHostToHosttemplate', 'template_name', 'name', '', 0, '', 3); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(37, 'tbl_host', 'tbl_variabledefinition', '', 'use_variables', 'tbl_lnkHostToVariabledefinition', 'name', '', '', 0, '', 4); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(38, 'tbl_hostgroup', 'tbl_host', '', 'members', 'tbl_lnkHostgroupToHost', 'host_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(39, 'tbl_hostgroup', 'tbl_hostgroup', '', 'hostgroup_members', 'tbl_lnkHostgroupToHostgroup', 'hostgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(40, 'tbl_servicetemplate', 'tbl_host', '', 'host_name', 'tbl_lnkServicetemplateToHost', 'host_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(41, 'tbl_servicetemplate', 'tbl_hostgroup', '', 'hostgroup_name', 'tbl_lnkServicetemplateToHostgroup', 'hostgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(42, 'tbl_servicetemplate', 'tbl_servicegroup', '', 'servicegroups', 'tbl_lnkServicetemplateToServicegroup', 'servicegroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(43, 'tbl_servicetemplate', 'tbl_contactgroup', '', 'contact_groups', 'tbl_lnkServicetemplateToContactgroup', 'contactgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(44, 'tbl_servicetemplate', 'tbl_contact', '', 'contacts', 'tbl_lnkServicetemplateToContact', 'contact_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(45, 'tbl_servicetemplate', 'tbl_timeperiod', '', 'check_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(46, 'tbl_servicetemplate', 'tbl_command', '', 'check_command', '', 'command_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(47, 'tbl_servicetemplate', 'tbl_timeperiod', '', 'notification_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(48, 'tbl_servicetemplate', 'tbl_command', '', 'event_handler', '', 'command_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(49, 'tbl_servicetemplate', 'tbl_servicetemplate', 'tbl_service', 'use_template', 'tbl_lnkServicetemplateToServicetemplate', 'template_name', 'name', '', 0, '', 3); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(50, 'tbl_servicetemplate', 'tbl_variabledefinition', '', 'use_variables', 'tbl_lnkServicetemplateToVariabledefinition', 'name', '', '', 0, '', 4); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(51, 'tbl_service', 'tbl_host', '', 'host_name', 'tbl_lnkServiceToHost', 'host_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(52, 'tbl_service', 'tbl_hostgroup', '', 'hostgroup_name', 'tbl_lnkServiceToHostgroup', 'hostgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(53, 'tbl_service', 'tbl_servicegroup', '', 'servicegroups', 'tbl_lnkServiceToServicegroup', 'servicegroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(54, 'tbl_service', 'tbl_contactgroup', '', 'contact_groups', 'tbl_lnkServiceToContactgroup', 'contactgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(55, 'tbl_service', 'tbl_contact', '', 'contacts', 'tbl_lnkServiceToContact', 'contact_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(56, 'tbl_service', 'tbl_timeperiod', '', 'check_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(57, 'tbl_service', 'tbl_command', '', 'check_command', '', 'command_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(58, 'tbl_service', 'tbl_timeperiod', '', 'notification_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(59, 'tbl_service', 'tbl_command', '', 'event_handler', '', 'command_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(60, 'tbl_service', 'tbl_servicetemplate', 'tbl_service', 'use_template', 'tbl_lnkServiceToServicetemplate', 'template_name', 'name', '', 0, '', 3); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(61, 'tbl_service', 'tbl_variabledefinition', '', 'use_variables', 'tbl_lnkServiceToVariabledefinition', 'name', '', '', 0, '', 4); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(62, 'tbl_servicegroup', 'tbl_host', 'tbl_service', 'members', 'tbl_lnkServicegroupToService', 'host_name', 'service_description', '', 0, '', 5); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(63, 'tbl_servicegroup', 'tbl_servicegroup', '', 'servicegroup_members', 'tbl_lnkServicegroupToServicegroup', 'servicegroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(64, 'tbl_hostdependency', 'tbl_host', '', 'dependent_host_name', 'tbl_lnkHostdependencyToHost_DH', 'host_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(65, 'tbl_hostdependency', 'tbl_host', '', 'host_name', 'tbl_lnkHostdependencyToHost_H', 'host_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(66, 'tbl_hostdependency', 'tbl_hostgroup', '', 'dependent_hostgroup_name', 'tbl_lnkHostdependencyToHostgroup_DH', 'hostgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(67, 'tbl_hostdependency', 'tbl_hostgroup', '', 'hostgroup_name', 'tbl_lnkHostdependencyToHostgroup_H', 'hostgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(68, 'tbl_hostdependency', 'tbl_timeperiod', '', 'dependency_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(69, 'tbl_hostescalation', 'tbl_host', '', 'host_name', 'tbl_lnkHostescalationToHost', 'host_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(70, 'tbl_hostescalation', 'tbl_hostgroup', '', 'hostgroup_name', 'tbl_lnkHostescalationToHostgroup', 'hostgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(71, 'tbl_hostescalation', 'tbl_contact', '', 'contacts', 'tbl_lnkHostescalationToContact', 'contact_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(72, 'tbl_hostescalation', 'tbl_contactgroup', '', 'contact_groups', 'tbl_lnkHostescalationToContactgroup', 'contactgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(73, 'tbl_hostescalation', 'tbl_timeperiod', '', 'escalation_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(74, 'tbl_hostextinfo', 'tbl_host', '', 'host_name', '', 'host_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(75, 'tbl_servicedependency', 'tbl_host', '', 'dependent_host_name', 'tbl_lnkServicedependencyToHost_DH', 'host_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(76, 'tbl_servicedependency', 'tbl_host', '', 'host_name', 'tbl_lnkServicedependencyToHost_H', 'host_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(77, 'tbl_servicedependency', 'tbl_hostgroup', '', 'dependent_hostgroup_name', 'tbl_lnkServicedependencyToHostgroup_DH', 'hostgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(78, 'tbl_servicedependency', 'tbl_hostgroup', '', 'hostgroup_name', 'tbl_lnkServicedependencyToHostgroup_H', 'hostgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(79, 'tbl_servicedependency', 'tbl_service', '', 'dependent_service_description', 'tbl_lnkServicedependencyToService_DS', 'service_description', '', '', 0, '', 6); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(80, 'tbl_servicedependency', 'tbl_service', '', 'service_description', 'tbl_lnkServicedependencyToService_S', 'service_description', '', '', 0, '', 6); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(81, 'tbl_servicedependency', 'tbl_timeperiod', '', 'dependency_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(82, 'tbl_serviceescalation', 'tbl_host', '', 'host_name', 'tbl_lnkServiceescalationToHost', 'host_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(83, 'tbl_serviceescalation', 'tbl_hostgroup', '', 'hostgroup_name', 'tbl_lnkServiceescalationToHostgroup', 'hostgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(84, 'tbl_serviceescalation', 'tbl_service', '', 'service_description', 'tbl_lnkServiceescalationToService', 'service_description', '', '', 0, '', 6); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(85, 'tbl_serviceescalation', 'tbl_contact', '', 'contacts', 'tbl_lnkServiceescalationToContact', 'contact_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(86, 'tbl_serviceescalation', 'tbl_contactgroup', '', 'contact_groups', 'tbl_lnkServiceescalationToContactgroup', 'contactgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(87, 'tbl_serviceescalation', 'tbl_timeperiod', '', 'escalation_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(88, 'tbl_serviceextinfo', 'tbl_host', '', 'host_name', '', 'host_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(89, 'tbl_serviceextinfo', 'tbl_service', '', 'service_description', '', 'service_description', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(90, 'tbl_command', 'tbl_lnkContacttemplateToCommandHost', '', 'idSlave', '', 'tbl_contacttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(91, 'tbl_command', 'tbl_lnkContacttemplateToCommandService', '', 'idSlave', '', 'tbl_contacttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(92, 'tbl_command', 'tbl_lnkContactToCommandHost', '', 'idSlave', '', 'tbl_contact', '', 'contact_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(93, 'tbl_command', 'tbl_lnkContactToCommandService', '', 'idSlave', '', 'tbl_contact', '', 'contact_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(94, 'tbl_command', 'tbl_host', '', 'check_command', '', '', '', 'host_name', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(95, 'tbl_command', 'tbl_host', '', 'event_handler', '', '', '', 'host_name', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(96, 'tbl_command', 'tbl_service', '', 'check_command', '', '', '', 'config_name,service_description', 1, '1,1,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(97, 'tbl_command', 'tbl_service', '', 'event_handler', '', '', '', 'config_name,service_description', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(98, 'tbl_contact', 'tbl_lnkContactgroupToContact', '', 'idSlave', '', 'tbl_contactgroup', '', 'contactgroup_name', 1, '1,2,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(99, 'tbl_contact', 'tbl_lnkContactToCommandHost', '', 'idMaster', '', 'tbl_command', '', 'command_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(100, 'tbl_contact', 'tbl_lnkContactToCommandService', '', 'idMaster', '', 'tbl_command', '', 'command_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(101, 'tbl_contact', 'tbl_lnkContactToContactgroup', '', 'idMaster', '', 'tbl_contactgroup', '', 'contactgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(102, 'tbl_contact', 'tbl_lnkContactToContacttemplate', '', 'idMaster', '', 'tbl_contacttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(103, 'tbl_contact', 'tbl_lnkContactToVariabledefinition', '', 'idMaster', '', 'tbl_variabledefinition', '', 'name', 1, '0,0,0,2', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(104, 'tbl_contact', 'tbl_lnkHostescalationToContact', '', 'idSlave', '', 'tbl_hostescalation', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(105, 'tbl_contact', 'tbl_lnkHosttemplateToContact', '', 'idSlave', '', 'tbl_hosttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(106, 'tbl_contact', 'tbl_lnkHostToContact', '', 'idSlave', '', 'tbl_host', '', 'host_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(107, 'tbl_contact', 'tbl_lnkServiceescalationToContact', '', 'idSlave', '', 'tbl_serviceescalation', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(108, 'tbl_contact', 'tbl_lnkServicetemplateToContact', '', 'idSlave', '', 'tbl_servicetemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(109, 'tbl_contact', 'tbl_lnkServiceToContact', '', 'idSlave', '', 'tbl_service', '', 'config_name,service_description', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(110, 'tbl_contactgroup', 'tbl_lnkContactgroupToContact', '', 'idMaster', '', 'tbl_contact', '', 'contact_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(111, 'tbl_contactgroup', 'tbl_lnkContactgroupToContactgroup', '', 'idMaster', '', 'tbl_contactgroup', '', 'contactgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(112, 'tbl_contactgroup', 'tbl_lnkContactgroupToContactgroup', '', 'idSlave', '', 'tbl_contactgroup', '', 'contactgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(113, 'tbl_contactgroup', 'tbl_lnkContacttemplateToContactgroup', '', 'idSlave', '', 'tbl_contacttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(114, 'tbl_contactgroup', 'tbl_lnkContactToContactgroup', '', 'idSlave', '', 'tbl_contact', '', 'contact_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(115, 'tbl_contactgroup', 'tbl_lnkHostescalationToContactgroup', '', 'idSlave', '', 'tbl_hostescalation', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(116, 'tbl_contactgroup', 'tbl_lnkHosttemplateToContactgroup', '', 'idSlave', '', 'tbl_hosttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(117, 'tbl_contactgroup', 'tbl_lnkHostToContactgroup', '', 'idSlave', '', 'tbl_host', '', 'host_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(118, 'tbl_contactgroup', 'tbl_lnkServiceescalationToContactgroup', '', 'idSlave', '', 'tbl_serviceescalation', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(119, 'tbl_contactgroup', 'tbl_lnkServicetemplateToContactgroup', '', 'idSlave', '', 'tbl_servicetemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(120, 'tbl_contactgroup', 'tbl_lnkServiceToContactgroup', '', 'idSlave', '', 'tbl_service', '', 'config_name,service_description', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(121, 'tbl_contacttemplate', 'tbl_lnkContacttemplateToCommandHost', '', 'idMaster', '', 'tbl_command', '', 'command_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(122, 'tbl_contacttemplate', 'tbl_lnkContacttemplateToCommandService', '', 'idMaster', '', 'tbl_command', '', 'command_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(123, 'tbl_contacttemplate', 'tbl_lnkContacttemplateToContactgroup', '', 'idMaster', '', 'tbl_contactgroup', '', 'contactgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(124, 'tbl_contacttemplate', 'tbl_lnkContacttemplateToContacttemplate', '', 'idMaster', '', 'tbl_contacttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(125, 'tbl_contacttemplate', 'tbl_lnkContacttemplateToContacttemplate', '', 'idSlave', '', 'tbl_contacttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(126, 'tbl_contacttemplate', 'tbl_lnkContacttemplateToVariabledefinition', '', 'idMaster', '', 'tbl_variabledefinition', '', 'name', 1, '0,0,0,2', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(127, 'tbl_contacttemplate', 'tbl_lnkContactToContacttemplate', '', 'idSlave', '', 'tbl_contact', '', 'contact_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(128, 'tbl_host', 'tbl_lnkHostdependencyToHost_DH', '', 'idSlave', '', 'tbl_hostdependency', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(129, 'tbl_host', 'tbl_lnkHostdependencyToHost_H', '', 'idSlave', '', 'tbl_hostdependency', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(130, 'tbl_host', 'tbl_lnkHostescalationToHost', '', 'idSlave', '', 'tbl_hostescalation', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(131, 'tbl_host', 'tbl_lnkHosttemplateToHost', '', 'idSlave', '', 'tbl_hosttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(132, 'tbl_host', 'tbl_lnkHostToContact', '', 'idMaster', '', 'tbl_contact', '', 'contact_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(133, 'tbl_host', 'tbl_lnkHostToContactgroup', '', 'idMaster', '', 'tbl_contactgroup', '', 'contactgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(134, 'tbl_host', 'tbl_lnkHostToHost', '', 'idMaster', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(135, 'tbl_host', 'tbl_lnkHostToHost', '', 'idSlave', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(136, 'tbl_host', 'tbl_lnkHostToHostgroup', '', 'idMaster', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(137, 'tbl_host', 'tbl_lnkHostgroupToHost', '', 'idSlave', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(138, 'tbl_host', 'tbl_lnkHostToHosttemplate', '', 'idMaster', '', 'tbl_hosttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(139, 'tbl_host', 'tbl_lnkHostToVariabledefinition', '', 'idMaster', '', 'tbl_variabledefinition', '', 'name', 1, '0,0,0,2', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(140, 'tbl_host', 'tbl_lnkServicedependencyToHost_DH', '', 'idSlave', '', 'tbl_servicedependency', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(141, 'tbl_host', 'tbl_lnkServicedependencyToHost_H', '', 'idSlave', '', 'tbl_servicedependency', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(142, 'tbl_host', 'tbl_lnkServiceescalationToHost', '', 'idSlave', '', 'tbl_serviceescalation', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(143, 'tbl_host', 'tbl_lnkServicetemplateToHost', '', 'idSlave', '', 'tbl_servicetemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(144, 'tbl_host', 'tbl_lnkServiceToHost', '', 'idSlave', '', 'tbl_service', '', 'config_name,service_description', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(145, 'tbl_host', 'tbl_lnkServicegroupToService', '', 'idSlaveH', '', 'tbl_servicegroup', '', 'servicegroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(146, 'tbl_host', 'tbl_hostextinfo', '', 'host_name', '', '', '', 'host_name', 1, '0,0,0,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(147, 'tbl_host', 'tbl_serviceextinfo', '', 'host_name', '', '', '', 'host_name', 1, '0,0,0,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(148, 'tbl_hostdependency', 'tbl_lnkHostdependencyToHostgroup_DH', '', 'idMaster', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(149, 'tbl_hostdependency', 'tbl_lnkHostdependencyToHostgroup_H', '', 'idMaster', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(150, 'tbl_hostdependency', 'tbl_lnkHostdependencyToHost_DH', '', 'idMaster', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(151, 'tbl_hostdependency', 'tbl_lnkHostdependencyToHost_H', '', 'idMaster', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(152, 'tbl_hostescalation', 'tbl_lnkHostescalationToContact', '', 'idMaster', '', 'tbl_contact', '', 'contact_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(153, 'tbl_hostescalation', 'tbl_lnkHostescalationToContactgroup', '', 'idMaster', '', 'tbl_contactgroup', '', 'contactgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(154, 'tbl_hostescalation', 'tbl_lnkHostescalationToHost', '', 'idMaster', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(155, 'tbl_hostescalation', 'tbl_lnkHostescalationToHostgroup', '', 'idMaster', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(156, 'tbl_hostgroup', 'tbl_lnkHostdependencyToHostgroup_DH', '', 'idSlave', '', 'tbl_hostdependency', '', 'config_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(157, 'tbl_hostgroup', 'tbl_lnkHostdependencyToHostgroup_H', '', 'idSlave', '', 'tbl_hostdependency', '', 'config_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(158, 'tbl_hostgroup', 'tbl_lnkHostescalationToHostgroup', '', 'idSlave', '', 'tbl_hostescalation', '', 'config_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(159, 'tbl_hostgroup', 'tbl_lnkHostgroupToHost', '', 'idMaster', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(160, 'tbl_hostgroup', 'tbl_lnkHostgroupToHostgroup', '', 'idMaster', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(161, 'tbl_hostgroup', 'tbl_lnkHostgroupToHostgroup', '', 'idSlave', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(162, 'tbl_hostgroup', 'tbl_lnkHosttemplateToHostgroup', '', 'idSlave', '', 'tbl_hosttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(163, 'tbl_hostgroup', 'tbl_lnkHostToHostgroup', '', 'idSlave', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(164, 'tbl_hostgroup', 'tbl_lnkServicedependencyToHostgroup_DH', '', 'idSlave', '', 'tbl_servicedependency', '', 'config_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(165, 'tbl_hostgroup', 'tbl_lnkServicedependencyToHostgroup_H', '', 'idSlave', '', 'tbl_servicedependency', '', 'config_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(166, 'tbl_hostgroup', 'tbl_lnkServiceescalationToHostgroup', '', 'idSlave', '', 'tbl_serviceescalation', '', 'config_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(167, 'tbl_hostgroup', 'tbl_lnkServicetemplateToHostgroup', '', 'idSlave', '', 'tbl_servicetemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(168, 'tbl_hostgroup', 'tbl_lnkServiceToHostgroup', '', 'idSlave', '', 'tbl_service', '', 'config_name,service_description', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(169, 'tbl_hostgroup', 'tbl_lnkServicegroupToService', '', 'idSlaveHG', '', 'tbl_servicegroup', '', 'servicegroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(170, 'tbl_hosttemplate', 'tbl_lnkHosttemplateToContact', '', 'idMaster', '', 'tbl_contact', '', 'contact_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(171, 'tbl_hosttemplate', 'tbl_lnkHosttemplateToContactgroup', '', 'idMaster', '', 'tbl_contactgroup', '', 'contactgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(172, 'tbl_hosttemplate', 'tbl_lnkHosttemplateToHost', '', 'idMaster', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(173, 'tbl_hosttemplate', 'tbl_lnkHosttemplateToHostgroup', '', 'idMaster', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(174, 'tbl_hosttemplate', 'tbl_lnkHosttemplateToHosttemplate', '', 'idMaster', '', 'tbl_service', '', 'config_name,service_description', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(175, 'tbl_hosttemplate', 'tbl_lnkHosttemplateToHosttemplate', '', 'idSlave', '', 'tbl_hosttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(176, 'tbl_hosttemplate', 'tbl_lnkHosttemplateToVariabledefinition', '', 'idMaster', '', 'tbl_variabledefinition', '', 'name', 1, '0,0,0,2', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(177, 'tbl_hosttemplate', 'tbl_lnkHostToHosttemplate', '', 'idSlave', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(178, 'tbl_service', 'tbl_lnkServicedependencyToService_DS', '', 'idSlave', '', 'tbl_servicedependency', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(179, 'tbl_service', 'tbl_lnkServicedependencyToService_S', '', 'idSlave', '', 'tbl_servicedependency', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(180, 'tbl_service', 'tbl_lnkServiceescalationToService', '', 'idSlave', '', 'tbl_serviceescalation', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(181, 'tbl_service', 'tbl_lnkServicegroupToService', '', 'idSlaveS', '', 'tbl_servicegroup', '', 'servicegroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(182, 'tbl_service', 'tbl_lnkServiceToContact', '', 'idMaster', '', 'tbl_contact', '', 'contact_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(183, 'tbl_service', 'tbl_lnkServiceToContactgroup', '', 'idMaster', '', 'tbl_contactgroup', '', 'contactgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(184, 'tbl_service', 'tbl_lnkServiceToHost', '', 'idMaster', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(185, 'tbl_service', 'tbl_lnkServiceToHostgroup', '', 'idMaster', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(186, 'tbl_service', 'tbl_lnkServiceToServicegroup', '', 'idMaster', '', 'tbl_servicegroup', '', 'servicegroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(187, 'tbl_service', 'tbl_lnkServiceToServicetemplate', '', 'idMaster', '', 'tbl_servicetemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(188, 'tbl_service', 'tbl_lnkServiceToVariabledefinition', '', 'idMaster', '', 'tbl_variabledefinition', '', 'name', 1, '0,0,0,2', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(189, 'tbl_service', 'tbl_serviceextinfo', '', 'service_description', '', '', '', 'host_name', 1, '0,0,0,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(190, 'tbl_servicedependency', 'tbl_lnkServicedependencyToHostgroup_DH', '', 'idMaster', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(191, 'tbl_servicedependency', 'tbl_lnkServicedependencyToHostgroup_H', '', 'idMaster', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(192, 'tbl_servicedependency', 'tbl_lnkServicedependencyToHost_DH', '', 'idMaster', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(193, 'tbl_servicedependency', 'tbl_lnkServicedependencyToHost_H', '', 'idMaster', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(194, 'tbl_servicedependency', 'tbl_lnkServicedependencyToService_DS', '', 'idMaster', '', 'tbl_service', '', 'config_name,service_description', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(195, 'tbl_servicedependency', 'tbl_lnkServicedependencyToService_S', '', 'idMaster', '', 'tbl_service', '', 'config_name,service_description', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(196, 'tbl_serviceescalation', 'tbl_lnkServiceescalationToContact', '', 'idMaster', '', 'tbl_contact', '', 'contact_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(197, 'tbl_serviceescalation', 'tbl_lnkServiceescalationToContactgroup', '', 'idMaster', '', 'tbl_contactgroup', '', 'contactgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(198, 'tbl_serviceescalation', 'tbl_lnkServiceescalationToHost', '', 'idMaster', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(199, 'tbl_serviceescalation', 'tbl_lnkServiceescalationToHostgroup', '', 'idMaster', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(200, 'tbl_serviceescalation', 'tbl_lnkServiceescalationToService', '', 'idMaster', '', 'tbl_service', '', 'config_name,service_description', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(201, 'tbl_servicegroup', 'tbl_lnkServicegroupToService', '', 'idMaster', '', 'tbl_service', '', 'config_name,service_description', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(202, 'tbl_servicegroup', 'tbl_lnkServicegroupToServicegroup', '', 'idMaster', '', 'tbl_servicegroup', '', 'servicegroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(203, 'tbl_servicegroup', 'tbl_lnkServicegroupToServicegroup', '', 'idSlave', '', 'tbl_servicegroup', '', 'servicegroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(204, 'tbl_servicegroup', 'tbl_lnkServicetemplateToServicegroup', '', 'idSlave', '', 'tbl_servicetemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(205, 'tbl_servicegroup', 'tbl_lnkServiceToServicegroup', '', 'idSlave', '', 'tbl_service', '', 'config_name,service_description', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(206, 'tbl_servicetemplate', 'tbl_lnkServicetemplateToContact', '', 'idMaster', '', 'tbl_contact', '', 'contact_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(207, 'tbl_servicetemplate', 'tbl_lnkServicetemplateToContactgroup', '', 'idMaster', '', 'tbl_contactgroup', '', 'contactgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(208, 'tbl_servicetemplate', 'tbl_lnkServicetemplateToHost', '', 'idMaster', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(209, 'tbl_servicetemplate', 'tbl_lnkServicetemplateToHostgroup', '', 'idMaster', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(210, 'tbl_servicetemplate', 'tbl_lnkServicetemplateToServicegroup', '', 'idMaster', '', 'tbl_servicegroup', '', 'servicegroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(211, 'tbl_servicetemplate', 'tbl_lnkServicetemplateToServicetemplate', '', 'idMaster', '', 'tbl_servicetemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(212, 'tbl_servicetemplate', 'tbl_lnkServicetemplateToServicetemplate', '', 'idSlave', '', 'tbl_servicetemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(213, 'tbl_servicetemplate', 'tbl_lnkServicetemplateToVariabledefinition', '', 'idMaster', '', 'tbl_variabledefinition', '', 'name', 1, '0,0,0,2', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(214, 'tbl_servicetemplate', 'tbl_lnkServiceToServicetemplate', '', 'idSlave', '', 'tbl_service', '', 'config_name,service_description', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(215, 'tbl_timeperiod', 'tbl_lnkTimeperiodToTimeperiod', '', 'idMaster', '', 'tbl_timeperiod', '', 'timeperiod_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(216, 'tbl_timeperiod', 'tbl_lnkTimeperiodToTimeperiod', '', 'idSlave', '', 'tbl_timeperiod', '', 'timeperiod_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(217, 'tbl_timeperiod', 'tbl_contact', '', 'host_notification_period', '', '', '', 'contact_name', 1, '1,1,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(218, 'tbl_timeperiod', 'tbl_contact', '', 'service_notification_period', '', '', '', 'contact_name', 1, '1,1,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(219, 'tbl_timeperiod', 'tbl_contacttemplate', '', 'host_notification_period', '', '', '', 'template_name', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(220, 'tbl_timeperiod', 'tbl_contacttemplate', '', 'service_notification_period', '', '', '', 'template_name', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(221, 'tbl_timeperiod', 'tbl_host', '', 'check_period', '', '', '', 'host_name', 1, '1,1,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(222, 'tbl_timeperiod', 'tbl_host', '', 'notification_period', '', '', '', 'host_name', 1, '1,1,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(223, 'tbl_timeperiod', 'tbl_hosttemplate', '', 'check_period', '', '', '', 'template_name', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(224, 'tbl_timeperiod', 'tbl_hosttemplate', '', 'notification_period', '', '', '', 'template_name', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(225, 'tbl_timeperiod', 'tbl_hostdependency', '', 'dependency_period', '', '', '', 'config_name', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(226, 'tbl_timeperiod', 'tbl_hostescalation', '', 'escalation_period', '', '', '', 'config_name', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(227, 'tbl_timeperiod', 'tbl_service', '', 'check_period', '', '', '', 'config_name,service_description', 1, '1,1,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(228, 'tbl_timeperiod', 'tbl_service', '', 'notification_period', '', '', '', 'config_name,service_description', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(229, 'tbl_timeperiod', 'tbl_servicetemplate', '', 'check_period', '', '', '', 'template_name', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(230, 'tbl_timeperiod', 'tbl_servicetemplate', '', 'notification_period', '', '', '', 'template_name', 1, '1,1,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(231, 'tbl_timeperiod', 'tbl_servicedependency', '', 'dependency_period', '', '', '', 'config_name', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(232, 'tbl_timeperiod', 'tbl_serviceescalation', '', 'escalation_period', '', '', '', 'config_name', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(233, 'tbl_timeperiod', 'tbl_timedefinition', '', 'tipId', '', '', '', 'id', 1, '0,0,0,3', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(234, 'tbl_timeperiod', 'tbl_timeperiod', '', 'use_template', 'tbl_lnkTimeperiodToTimeperiodUse', 'name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(235, 'tbl_timeperiod', 'tbl_lnkTimeperiodToTimeperiodUse', '', 'idMaster', '', 'tbl_timeperiod', '', 'name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(236, 'tbl_timeperiod', 'tbl_lnkTimeperiodToTimeperiodUse', '', 'idSlave', '', 'tbl_timeperiod', '', 'name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(237, 'tbl_group', 'tbl_user', '', 'users', 'tbl_lnkGroupToUser', 'username', '', '', 0, '', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(238, 'tbl_group', 'tbl_lnkGroupToUser', '', 'idMaster', '', 'tbl_user', '', 'username', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(239, 'tbl_servicedependency', 'tbl_servicegroup', '', 'dependent_servicegroup_name', 'tbl_lnkServicedependencyToServicegroup_DS', 'servicegroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(240, 'tbl_servicedependency', 'tbl_servicegroup', '', 'servicegroup_name', 'tbl_lnkServicedependencyToServicegroup_S', 'servicegroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(241, 'tbl_servicedependency', 'tbl_lnkServicedependencyToServicegroup_DS', '', 'idMaster', '', 'tbl_servicegroup', '', 'servicegroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(242, 'tbl_servicedependency', 'tbl_lnkServicedependencyToServicegroup_S', '', 'idMaster', '', 'tbl_servicegroup', '', 'servicegroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES (243,'tbl_serviceescalation', 'tbl_servicegroup', '', 'servicegroup_name', 'tbl_lnkServiceescalationToServicegroup', 'servicegroup_name', '', '', '0', '', '2'); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES (244,'tbl_serviceescalation', 'tbl_lnkServiceescalationToServicegroup', '', 'idMaster', '', 'tbl_servicegroup', '', 'servicegroup_name', '1', '0,0,0,1', '0'); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES (NULL, 'tbl_service', 'tbl_service', '', 'parents', 'tbl_lnkServiceToService', 'service_description', '', '', '0', '', '7'); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES (NULL, 'tbl_servicetemplate', 'tbl_service', '', 'parents', 'tbl_lnkServicetemplateToService', 'service_description', '', '', '0', '', '7'); + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_service` +-- + +CREATE TABLE IF NOT EXISTS `tbl_service` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `config_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `host_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `host_name_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `hostgroup_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `hostgroup_name_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `service_description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `display_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `parents` tinyint(3) unsigned NOT NULL DEFAULT '0', + `parents_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `importance` int(11) DEFAULT NULL, + `servicegroups` tinyint(3) unsigned NOT NULL DEFAULT '0', + `servicegroups_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `use_template` tinyint(3) unsigned NOT NULL DEFAULT '0', + `use_template_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_command` text COLLATE utf8_unicode_ci NOT NULL, + `is_volatile` tinyint(3) unsigned NOT NULL DEFAULT '2', + `initial_state` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `max_check_attempts` int(11) DEFAULT NULL, + `check_interval` int(11) DEFAULT NULL, + `retry_interval` int(11) DEFAULT NULL, + `active_checks_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `passive_checks_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_period` int(11) NOT NULL DEFAULT '0', + `parallelize_check` tinyint(3) unsigned NOT NULL DEFAULT '2', + `obsess_over_service` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_freshness` tinyint(3) unsigned NOT NULL DEFAULT '2', + `freshness_threshold` int(11) DEFAULT NULL, + `event_handler` int(11) NOT NULL DEFAULT '0', + `event_handler_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `low_flap_threshold` int(11) DEFAULT NULL, + `high_flap_threshold` int(11) DEFAULT NULL, + `flap_detection_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `flap_detection_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `process_perf_data` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_status_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_nonstatus_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `notification_interval` int(11) DEFAULT NULL, + `first_notification_delay` int(11) DEFAULT NULL, + `notification_period` int(11) NOT NULL DEFAULT '0', + `notification_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `notifications_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `contacts` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contacts_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `contact_groups` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contact_groups_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `stalking_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `notes` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `notes_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `action_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `icon_image` varchar(500) COLLATE utf8_unicode_ci NOT NULL, + `icon_image_alt` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `use_variables` tinyint(3) unsigned NOT NULL DEFAULT '0', + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + `import_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_service` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_servicedependency` +-- + +CREATE TABLE IF NOT EXISTS `tbl_servicedependency` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `config_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `dependent_host_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `dependent_hostgroup_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `dependent_service_description` tinyint(3) unsigned NOT NULL DEFAULT '0', + `dependent_servicegroup_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `host_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `hostgroup_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `service_description` tinyint(3) unsigned NOT NULL DEFAULT '0', + `servicegroup_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `inherits_parent` tinyint(3) unsigned NOT NULL DEFAULT '0', + `execution_failure_criteria` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `notification_failure_criteria` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `dependency_period` int(11) NOT NULL DEFAULT '0', + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + `import_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`config_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_servicedependency` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_serviceescalation` +-- + +CREATE TABLE IF NOT EXISTS `tbl_serviceescalation` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `config_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `host_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `hostgroup_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `service_description` tinyint(3) unsigned NOT NULL DEFAULT '0', + `servicegroup_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contacts` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contact_groups` tinyint(3) unsigned NOT NULL DEFAULT '0', + `first_notification` int(11) DEFAULT NULL, + `last_notification` int(11) DEFAULT NULL, + `notification_interval` int(11) DEFAULT NULL, + `escalation_period` int(11) NOT NULL DEFAULT '0', + `escalation_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + `import_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + KEY `config_name` (`config_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_serviceescalation` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_serviceextinfo` +-- + + +CREATE TABLE IF NOT EXISTS `tbl_serviceextinfo` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `host_name` int(11) NOT NULL, + `service_description` int(11) NOT NULL, + `notes` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `notes_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `action_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `statistic_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `icon_image` varchar(500) COLLATE utf8_unicode_ci NOT NULL, + `icon_image_alt` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + `import_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`host_name`,`service_description`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_serviceextinfo` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_servicegroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_servicegroup` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `servicegroup_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `members` tinyint(3) unsigned NOT NULL DEFAULT '0', + `servicegroup_members` tinyint(3) unsigned NOT NULL DEFAULT '0', + `notes` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `notes_url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `action_url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`servicegroup_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_servicegroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_servicetemplate` +-- + +CREATE TABLE IF NOT EXISTS `tbl_servicetemplate` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `template_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `host_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `host_name_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `hostgroup_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `hostgroup_name_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `service_description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `display_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `parents` tinyint(3) unsigned NOT NULL DEFAULT '0', + `parents_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `importance` int(11) DEFAULT NULL, + `servicegroups` tinyint(3) unsigned NOT NULL DEFAULT '0', + `servicegroups_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `use_template` tinyint(3) unsigned NOT NULL DEFAULT '0', + `use_template_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_command` text COLLATE utf8_unicode_ci NOT NULL, + `is_volatile` tinyint(3) unsigned NOT NULL DEFAULT '2', + `initial_state` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `max_check_attempts` int(11) DEFAULT NULL, + `check_interval` int(11) DEFAULT NULL, + `retry_interval` int(11) DEFAULT NULL, + `active_checks_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `passive_checks_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_period` int(11) NOT NULL DEFAULT '0', + `parallelize_check` tinyint(3) unsigned NOT NULL DEFAULT '2', + `obsess_over_service` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_freshness` tinyint(3) unsigned NOT NULL DEFAULT '2', + `freshness_threshold` int(11) DEFAULT NULL, + `event_handler` int(11) NOT NULL DEFAULT '0', + `event_handler_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `low_flap_threshold` int(11) DEFAULT NULL, + `high_flap_threshold` int(11) DEFAULT NULL, + `flap_detection_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `flap_detection_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `process_perf_data` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_status_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_nonstatus_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `notification_interval` int(11) DEFAULT NULL, + `first_notification_delay` int(11) DEFAULT NULL, + `notification_period` int(11) NOT NULL DEFAULT '0', + `notification_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `notifications_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `contacts` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contacts_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `contact_groups` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contact_groups_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `stalking_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `notes` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `notes_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `action_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `icon_image` varchar(500) COLLATE utf8_unicode_ci NOT NULL, + `icon_image_alt` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `use_variables` tinyint(3) unsigned NOT NULL DEFAULT '0', + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + `import_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`template_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_servicetemplate` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_settings` +-- + +CREATE TABLE IF NOT EXISTS `tbl_settings` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `category` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(30) COLLATE utf8_unicode_ci NOT NULL, + `value` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_settings` +-- + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_tablestatus` +-- + +CREATE TABLE IF NOT EXISTS `tbl_tablestatus` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `tableName` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `domainId` int(11) NOT NULL, + `updateTime` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_tablestatus` +-- + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_timedefinition` +-- + +CREATE TABLE IF NOT EXISTS `tbl_timedefinition` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `tipId` int(10) unsigned NOT NULL, + `definition` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `range` text COLLATE utf8_unicode_ci NOT NULL, + `last_modified` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_timedefinition` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_timeperiod` +-- + +CREATE TABLE IF NOT EXISTS `tbl_timeperiod` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `timeperiod_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + `use_template` tinyint(3) unsigned NOT NULL DEFAULT '0', + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `timeperiod_name` (`timeperiod_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_timeperiod` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_user` +-- + +CREATE TABLE IF NOT EXISTS `tbl_user` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `admin_enable` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', + `wsauth` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', + `nodelete` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', + `language` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `domain` int(10) unsigned NOT NULL DEFAULT '1', + `last_login` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `last_modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + UNIQUE KEY `username` (`username`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_user` +-- + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_variabledefinition` +-- + +CREATE TABLE IF NOT EXISTS `tbl_variabledefinition` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `value` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `last_modified` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_variabledefinition` +-- + diff --git a/install/sql/nagiosQL_v34_db_mysql.sql b/install/sql/nagiosQL_v34_db_mysql.sql index 0ab511c..4308460 100644 --- a/install/sql/nagiosQL_v34_db_mysql.sql +++ b/install/sql/nagiosQL_v34_db_mysql.sql @@ -5,12 +5,12 @@ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --- (c) 2005-2018 by Martin Willisegger +-- (c) 2005-2023 by Martin Willisegger -- -- Project : NagiosQL -- Component : Complete NagiosQL Database -- Website : https://sourceforge.net/projects/nagiosql/ --- Version : 3.4.0 +-- Version : 3.5.0 -- GIT Repo : https://gitlab.com/wizonet/NagiosQL -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff --git a/install/sql/nagiosQL_v35_db_mysql.sql b/install/sql/nagiosQL_v35_db_mysql.sql new file mode 100644 index 0000000..6db7446 --- /dev/null +++ b/install/sql/nagiosQL_v35_db_mysql.sql @@ -0,0 +1,2863 @@ +-- +-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +-- +-- NagiosQL +-- +-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +-- +-- (c) 2005-2022 by Martin Willisegger +-- +-- Project : NagiosQL +-- Component : Complete NagiosQL Database +-- Website : https://sourceforge.net/projects/nagiosql/ +-- Version : 3.5.0 +-- GIT Repo : https://gitlab.com/wizonet/NagiosQL +-- +-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; +SET NAMES 'utf8'; + +-- +-- Structure for table `tbl_command` +-- + +CREATE TABLE IF NOT EXISTS `tbl_command` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `command_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `command_line` text COLLATE utf8_unicode_ci NOT NULL, + `command_type` tinyint(3) unsigned NOT NULL DEFAULT '0', + `arg1_info` text COLLATE utf8_unicode_ci DEFAULT NULL, + `arg2_info` text COLLATE utf8_unicode_ci DEFAULT NULL, + `arg3_info` text COLLATE utf8_unicode_ci DEFAULT NULL, + `arg4_info` text COLLATE utf8_unicode_ci DEFAULT NULL, + `arg5_info` text COLLATE utf8_unicode_ci DEFAULT NULL, + `arg6_info` text COLLATE utf8_unicode_ci DEFAULT NULL, + `arg7_info` text COLLATE utf8_unicode_ci DEFAULT NULL, + `arg8_info` text COLLATE utf8_unicode_ci DEFAULT NULL, + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(10) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`command_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_command` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_configtarget` +-- + +CREATE TABLE `tbl_configtarget` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `target` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `server` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `port` int(10) UNSIGNED NOT NULL DEFAULT '22', + `method` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `user` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `ssh_key_path` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `ftp_secure` tinyint(3) UNSIGNED NOT NULL DEFAULT '0', + `basedir` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `hostconfig` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `serviceconfig` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `backupdir` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `hostbackup` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `servicebackup` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `nagiosbasedir` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `importdir` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `picturedir` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `commandfile` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `binaryfile` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `pidfile` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `conffile` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `cgifile` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `resourcefile` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `version` tinyint(3) UNSIGNED NOT NULL DEFAULT '3', + `access_group` int(10) UNSIGNED NOT NULL DEFAULT '0', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `nodelete` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', + `last_modified` datetime NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `target` (`target`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; +-- +-- Datasets for table `tbl_configtarget` +-- +INSERT INTO `tbl_configtarget` (`id`, `target`, `alias`, `server`, `method`, `user`, `password`, `ssh_key_path`, `ftp_secure`, `basedir`, `hostconfig`, `serviceconfig`, `backupdir`, `hostbackup`, `servicebackup`, `nagiosbasedir`, `importdir`, `picturedir`, `commandfile`, `binaryfile`, `pidfile`, `conffile`, `cgifile`, `resourcefile`, `version`, `access_group`, `active`, `nodelete`, `last_modified`) VALUES (1, 'localhost', 'Local installation', 'localhost', '1', '', '', '', 0, '/etc/nagiosql/', '/etc/nagiosql/hosts/', '/etc/nagiosql/services/', '/etc/nagiosql/backup/', '/etc/nagiosql/backup/hosts/', '/etc/nagiosql/backup/services/', '/etc/nagios/', '/opt/nagios/etc/objects/', '', '/var/nagios/rw/nagios.cmd', '/opt/nagios/bin/nagios', '/var/nagios/nagios.lock', '/etc/nagios/nagios.cfg', '/etc/nagios/cgi.cfg', '/etc/nagios/resource.cfg', 3, 0, '1', '1', NOW()); + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_contact` +-- +CREATE TABLE IF NOT EXISTS `tbl_contact` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `contact_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `contactgroups` int(10) unsigned NOT NULL DEFAULT '0', + `contactgroups_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `minimum_importance` int(11) DEFAULT NULL, + `host_notifications_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `service_notifications_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `host_notification_period` int(10) unsigned NOT NULL DEFAULT '0', + `service_notification_period` int(10) unsigned NOT NULL DEFAULT '0', + `host_notification_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `service_notification_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `host_notification_commands` int(10) unsigned NOT NULL DEFAULT '0', + `host_notification_commands_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `service_notification_commands` int(10) unsigned NOT NULL DEFAULT '0', + `service_notification_commands_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `can_submit_commands` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_status_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_nonstatus_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `pager` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address1` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address2` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address3` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address4` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address5` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address6` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `use_variables` tinyint(3) unsigned NOT NULL DEFAULT '0', + `use_template` tinyint(3) unsigned NOT NULL DEFAULT '0', + `use_template_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(10) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`contact_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_contact` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_contactgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_contactgroup` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `contactgroup_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `members` int(10) unsigned NOT NULL DEFAULT '0', + `contactgroup_members` int(10) unsigned NOT NULL DEFAULT '0', + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(10) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`contactgroup_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_contactgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_contacttemplate` +-- + +CREATE TABLE IF NOT EXISTS `tbl_contacttemplate` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `template_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `contactgroups` int(10) unsigned NOT NULL DEFAULT '0', + `contactgroups_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `minimum_importance` int(11) DEFAULT NULL, + `host_notifications_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `service_notifications_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `host_notification_period` int(11) NOT NULL DEFAULT '0', + `service_notification_period` int(11) NOT NULL DEFAULT '0', + `host_notification_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `service_notification_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `host_notification_commands` int(10) unsigned NOT NULL DEFAULT '0', + `host_notification_commands_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `service_notification_commands` int(10) unsigned NOT NULL DEFAULT '0', + `service_notification_commands_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `can_submit_commands` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_status_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_nonstatus_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `pager` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address1` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address2` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address3` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address4` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address5` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address6` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `use_variables` tinyint(3) unsigned NOT NULL DEFAULT '0', + `use_template` tinyint(3) unsigned NOT NULL DEFAULT '0', + `use_template_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(10) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`template_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_contacttemplate` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_datadomain` +-- + + +CREATE TABLE IF NOT EXISTS `tbl_datadomain` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `domain` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `targets` int(10) unsigned NOT NULL, + `version` tinyint(3) unsigned NOT NULL DEFAULT '3', + `enable_common` tinyint(3) unsigned NOT NULL DEFAULT '0', + `utf8_decode` tinyint(3) unsigned NOT NULL DEFAULT '0', + `access_group` int(10) unsigned NOT NULL DEFAULT '0', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `nodelete` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', + `last_modified` datetime NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `domain` (`domain`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_datadomain` +-- + +INSERT INTO `tbl_datadomain` (`id`, `domain`, `alias`, `targets`, `version`, `enable_common`, `utf8_decode`, `access_group`, `active`, `nodelete`, `last_modified`) VALUES(0, 'common', 'Global common domain', 0, 3, 0, 0, 0, '1', '1', NOW()); +UPDATE `tbl_datadomain` SET `id` = '0' WHERE `domain` = 'common'; +ALTER TABLE `tbl_datadomain` AUTO_INCREMENT = 1; +INSERT INTO `tbl_datadomain` (`id`, `domain`, `alias`, `targets`, `version`, `enable_common`, `utf8_decode`, `access_group`, `active`, `nodelete`, `last_modified`) VALUES(1, 'localhost', 'Local installation', 1, 3, 1, 0, 0, '1', '1', NOW()); + + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_group` +-- + +CREATE TABLE IF NOT EXISTS `tbl_group` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `groupname` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `users` tinyint(3) unsigned NOT NULL DEFAULT '0', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_group` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_host` +-- + +CREATE TABLE IF NOT EXISTS `tbl_host` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `host_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `display_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `address` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `parents` tinyint(3) unsigned NOT NULL DEFAULT '0', + `parents_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `importance` int(11) DEFAULT NULL, + `hostgroups` tinyint(3) unsigned NOT NULL DEFAULT '0', + `hostgroups_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_command` text COLLATE utf8_unicode_ci NOT NULL, + `use_template` tinyint(3) unsigned NOT NULL DEFAULT '0', + `use_template_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `initial_state` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `max_check_attempts` int(11) DEFAULT NULL, + `check_interval` int(11) DEFAULT NULL, + `retry_interval` int(11) DEFAULT NULL, + `active_checks_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `passive_checks_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_period` int(11) NOT NULL DEFAULT '0', + `obsess_over_host` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_freshness` tinyint(3) unsigned NOT NULL DEFAULT '2', + `freshness_threshold` int(11) DEFAULT NULL, + `event_handler` int(11) NOT NULL DEFAULT '0', + `event_handler_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `low_flap_threshold` int(11) DEFAULT NULL, + `high_flap_threshold` int(11) DEFAULT NULL, + `flap_detection_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `flap_detection_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `process_perf_data` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_status_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_nonstatus_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `contacts` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contacts_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `contact_groups` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contact_groups_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `notification_interval` int(11) DEFAULT NULL, + `notification_period` int(11) NOT NULL DEFAULT '0', + `first_notification_delay` int(11) DEFAULT NULL, + `notification_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `notifications_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `stalking_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `notes` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `notes_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `action_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `icon_image` varchar(500) COLLATE utf8_unicode_ci NOT NULL, + `icon_image_alt` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `vrml_image` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `statusmap_image` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `2d_coords` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `3d_coords` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `use_variables` tinyint(3) unsigned NOT NULL DEFAULT '0', + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(10) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`host_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_host` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_hostdependency` +-- + +CREATE TABLE IF NOT EXISTS `tbl_hostdependency` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `config_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `dependent_host_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `dependent_hostgroup_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `host_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `hostgroup_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `inherits_parent` tinyint(3) unsigned NOT NULL DEFAULT '0', + `execution_failure_criteria` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `notification_failure_criteria` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `dependency_period` int(11) NOT NULL DEFAULT '0', + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + `import_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`config_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_hostdependency` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_hostescalation` +-- + +CREATE TABLE IF NOT EXISTS `tbl_hostescalation` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `config_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `host_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `hostgroup_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contacts` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contact_groups` tinyint(3) unsigned NOT NULL DEFAULT '0', + `first_notification` int(11) DEFAULT NULL, + `last_notification` int(11) DEFAULT NULL, + `notification_interval` int(11) DEFAULT NULL, + `escalation_period` int(11) NOT NULL DEFAULT '0', + `escalation_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + `import_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`config_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_hostescalation` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_hostextinfo` +-- + +CREATE TABLE IF NOT EXISTS `tbl_hostextinfo` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `host_name` int(11) NOT NULL, + `notes` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `notes_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `action_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `statistik_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `icon_image` varchar(500) COLLATE utf8_unicode_ci NOT NULL, + `icon_image_alt` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `vrml_image` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `statusmap_image` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `2d_coords` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `3d_coords` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`host_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_hostextinfo` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_hostgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_hostgroup` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `hostgroup_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `members` tinyint(3) unsigned NOT NULL DEFAULT '0', + `hostgroup_members` tinyint(3) unsigned NOT NULL DEFAULT '0', + `notes` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `notes_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `action_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`hostgroup_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_hostgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_hosttemplate` +-- + +CREATE TABLE IF NOT EXISTS `tbl_hosttemplate` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `template_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `parents` tinyint(3) unsigned NOT NULL DEFAULT '0', + `parents_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `importance` int(11) DEFAULT NULL, + `hostgroups` tinyint(3) unsigned NOT NULL DEFAULT '0', + `hostgroups_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_command` text COLLATE utf8_unicode_ci NOT NULL, + `use_template` tinyint(3) unsigned NOT NULL DEFAULT '0', + `use_template_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `initial_state` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `max_check_attempts` int(11) DEFAULT NULL, + `check_interval` int(11) DEFAULT NULL, + `retry_interval` int(11) DEFAULT NULL, + `active_checks_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `passive_checks_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_period` int(11) NOT NULL DEFAULT '0', + `obsess_over_host` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_freshness` tinyint(3) unsigned NOT NULL DEFAULT '2', + `freshness_threshold` int(11) DEFAULT NULL, + `event_handler` int(11) NOT NULL DEFAULT '0', + `event_handler_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `low_flap_threshold` int(11) DEFAULT NULL, + `high_flap_threshold` int(11) DEFAULT NULL, + `flap_detection_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `flap_detection_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `process_perf_data` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_status_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_nonstatus_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `contacts` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contacts_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `contact_groups` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contact_groups_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `notification_interval` int(11) DEFAULT NULL, + `notification_period` int(11) NOT NULL DEFAULT '0', + `first_notification_delay` int(11) DEFAULT NULL, + `notification_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `notifications_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `stalking_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `notes` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `notes_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `action_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `icon_image` varchar(500) COLLATE utf8_unicode_ci NOT NULL, + `icon_image_alt` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `vrml_image` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `statusmap_image` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `2d_coords` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `3d_coords` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `use_variables` tinyint(3) unsigned NOT NULL DEFAULT '0', + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`template_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_hosttemplate` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_info` +-- + +CREATE TABLE IF NOT EXISTS `tbl_info` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `key1` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `key2` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `version` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `language` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `infotext` text COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + KEY `keypair` (`key1`,`key2`,`version`,`language`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_info` +-- + +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(1, 'domain', 'domain', 'all', 'default', 'Common name of this domain. This field is for internal use only.'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(2, 'domain', 'basedir', 'all', 'default', '

Absolute path to your NagiosQL configuration directory.

Examples:
/etc/nagiosql/
/usr/local/nagiosql/etc/

Be sure, that your configuration path settings are matching with your nagios.cfg! (cfg_file=/etc/nagiosql/timeperiods.cfg)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(3, 'domain', 'hostdir', 'all', 'default', 'NagiosQL writes one configuration file for every host. It is useful to store this files inside an own subdirectory below your Nagios configuration path.

Examples:
/etc/nagios/hosts
/usr/local/nagios/etc/hosts

Be sure, that your configuration settings are matching with your nagios.cfg!
(cfg_dir=/etc/nagios/hosts)'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(4, 'domain', 'servicedir', 'all', 'default', 'NagiosQL writes services grouped into files identified by the service configuration names. It is useful to store this files inside an own subdirectory below your Nagios configuration path.

Examples:
/etc/nagios/services
/usr/local/nagios/etc/services

Be sure, that your configuration settings are matching with your nagios.cfg!
(cfg_dir=/etc/nagios/services)'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(5, 'domain', 'backupdir', 'all', 'default', 'Absolute path to your NagiosQL configuration backup directory.

Examples:
/etc/nagios/backup
/usr/local/nagios/etc/backup

This directory is for internal configuration backups of NagiosQL and is not used by Nagios itself. '); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(6, 'domain', 'backuphostdir', 'all', 'default', 'Absolute path to your NagiosQL host configuration backup directory.

Examples:
/etc/nagios/backup/hosts
/usr/local/nagios/etc/backup/hosts

This directory is for internal configuration backups of NagiosQL only and is not used by Nagios itself.'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(7, 'domain', 'backupservicedir', 'all', 'default', 'Absolute path to your NagiosQL service configuration backup directory.

Examples:
/etc/nagios/backup/services
/usr/local/nagios/etc/backup/services

This directory is for internal configuration backups of NagiosQL only and is not used by Nagios itself.'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(8, 'domain', 'commandfile', 'all', 'default', 'Absolute path to your Nagios command file.

Examples:
/var/spool/nagios/nagios.cmd
/usr/local/nagios/var/rw/nagios.cmd

Be sure, that your command file path settings are matching with your nagios.cfg! (command_file=/var/spool/nagios/nagios.cmd)
(check_external_commands=1)

\r\nThis is used to reload Nagios directly from NagiosQL after changing a configuration.'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(9, 'common', 'accesskeys', 'all', 'default', '

Access key/keyholes

\r\n

NagiosQL uses a very simplified access control mechanism by using up to 8 keys.

\r\n

To access a secure object (menu, domain), a user must have a key for every defined keyhole.

\r\n

Example:

\r\n

User A has key 1,2,5,7 (can be defined in user management)
User B has key 3,5,7,8 (can be defined in user management)

\r\n

Menu 1 has keyhole 3,5
Menu 2 has keyhole 2,5,7
Menu 3 has no keyhole
Menu 4 has keyhole 4

User A has access to menu 2 and menu 3 (key 3 for menu 1 and key 4 for menu 4 are missing)
User B has access to menu 1 and menu 3 (key 2 for menu 2 and key 4 for menu 4 are missing)

\r\n

 

\r\n

 

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(10, 'user', 'webserverauth', 'all', 'default', '

User - webserver authentification

\r\n

If your webserver uses authentification and the NagiosQL user name is the same which is actually logged in - the NagiosQL login process will passed. This means, that NagiosQL no longer shows a login page if this user is already logged in by webserver authentification.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(11, 'domain', 'nagiosbasedir', 'all', 'default', '

Absolute path to your Nagios configuration directory.

Examples:
/etc/nagios/
/usr/local/nagios/etc/

\r\n

Be sure, that your nagios.cfg and cfg.cfg ist located inside this directory. NagiosQL uses this to handle this two files.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(12, 'domain', 'importdir', 'all', 'default', '

Absolute path to your configuration import directory.

Examples:
/etc/nagiosql/import/
/usr/local/nagios/etc/import/

\r\n

You can use this directory to store old or example configuration files in it which should be accessable by the importer of NagiosQL.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(13, 'domain', 'binary', 'all', 'default', '

Absolute path to your Nagios binary file.

Examples:
/usr/bin/nagios
/usr/local/nagios/bin/nagios

This is used to verify your configuration.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(14, 'domain', 'pidfile', 'all', 'default', '

Absolute path to your Nagios process file.

Examples:
/var/run/nagios/nagios.pid
/var/run/nagios/nagios.lock

This is used to check if nagios is running before sending a reload command to the nagios command file.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(15, 'domain', 'version', 'all', 'default', '

The nagios version which is running in this domain.

\r\n

Be sure you select the correct version here - otherwise not all configuration options are available or not supported options are shown.

\r\n

You can change this with a running configuration - NagiosQL will then upgrade or downgrade your configuration. Don\'t forget to write your complete configuration after a version change!

\r\n

Difference between version in data domain and configuration domain:

\r\n
    \r\n
  • The version information of the data domain is used to define the options offered in the web forms in NagiosQL.
  • \r\n
  • The version information of the configuration domain is used to define the options offered in the written configuration files.
  • \r\n
\r\n

This way you can create your data in a newer Nagios version and still write in an older version to keep the configuration compatible to the running Nagios version.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(16, 'host', 'hostname', 'all', 'default', '

Host - host name

This directive is used to define a short name used to identify the host. It is used in host group and service definitions to reference this particular host. Hosts can have multiple services (which are monitored) associated with them. When used properly, the $HOSTNAME$ macro will contain this short name.

\r\n

Parameter name: host_name
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(17, 'host', 'alias', 'all', 'default', '

Host - alias

This directive is used to define a longer name or description used to identify the host. It is provided in order to allow you to more easily identify a particular host. When used properly, the $HOSTALIAS$ macro will contain this alias/description.

\r\n

Parameter name: alias
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(18, 'host', 'address', 'all', 'default', '

Host - address

\r\n

This directive is used to define the address of the host. Normally, this is an IP address, although it could really be anything you want (so long as it can be used to check the status of the host). You can use a FQDN to identify the host instead of an IP address, but if DNS services are not availble this could cause problems. When used properly, the $HOSTADDRESS$ macro will contain this address.

\r\n

Note: If you do not specify an address directive in a host definition, the name of the host will be used as its address. A word of caution about doing this, however - if DNS fails, most of your service checks will fail because the plugins will be unable to resolve the host name.

\r\n

Parameter name: address
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(19, 'host', 'display_name', 'all', 'default', '

Host - display name

\r\n

This directive is used to define an alternate name that should be displayed in the web interface for this host. If not specified, this defaults to the value you specify for the host_name directive.

\r\n

Note: The current CGIs do not use this option, although future versions of the web interface will.

\r\n

Parameter name: display_name
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(20, 'host', 'parents', 'all', 'default', '

Host - parents

\r\n

This directive is used to define a comma-delimited list of short names of the "parent" hosts for this particular host. Parent hosts are typically routers, switches, firewalls, etc. that lie between the monitoring host and a remote hosts. A router, switch, etc. which is closest to the remote host is considered to be that host''s "parent". Read the "Determining Status and Reachability of Network Hosts" document for more information.

\r\n

If this host is on the same network segment as the host doing the monitoring (without any intermediate routers, etc.) the host is considered to be on the local network and will not have a parent host. Leave this value blank if the host does not have a parent host (i.e. it is on the same segment as the Nagios host). The order in which you specify parent hosts has no effect on how things are monitored.

\r\n

Parameter name: parents
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(21, 'host', 'hostgroups', 'all', 'default', '

Host - hostgroup names

\r\n

This directive is used to identify the short name(s) of the hostgroup(s) that the host belongs to. Multiple hostgroups should be separated by commas. This directive may be used as an alternative to (or in addition to) using the members directive in hostgroup definitions.

\r\n

NagiosQL: If a hostgroup is defined here - this host will not be selected inside the member field of the same hostgroup definition!

\r\n

Parameter name: hostgroups
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(22, 'common', 'tploptions', '3', 'default', '

Cancelling Inheritance of String Values

\r\n

In some cases you may not want your host, service, or contact definitions to inherit values of string variables from the templates they reference. If this is the case, you can specify "null" as the value of the variable that you do not want to inherit.

\r\n


Additive Inheritance of String Values

\r\n

Nagios gives preference to local variables instead of values inherited from templates. In most cases local variable values override those that are defined in templates. In some cases it makes sense to allow Nagios to use the values of inherited and local variables together.

\r\n

This "additive inheritance" can be accomplished by prepending the local variable value with a plus sign (+). This features is only available for standard (non-custom) variables that contain string values.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(23, 'host', 'check_command', 'all', 'default', '

Host - check command

This directive is used to specify the short name of the command that should be used to check if the host is up or down. Typically, this command would try and ping the host to see if it is "alive". The command must return a status of OK (0) or Nagios will assume the host is down.

\r\n

If you leave this argument blank, the host will not be actively checked. Thus, Nagios will likely always assume the host is up (it may show up as being in a "PENDING" state in the web interface). This is useful if you are monitoring printers or other devices that are frequently turned off. The maximum amount of time that the notification command can run is controlled by the host_check_timeout option.

\r\n

Parameter name: check_command
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(24, 'host', 'arguments', 'all', 'default', '

Host - arguments

\r\n

The values defined here will replace the according argument variable behind the selected command. Up to 8 argument variables are supported. Be sure, that you defines a valid value for each required argument variable.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(25, 'host', 'templateadd', 'all', 'default', '

Host - Templates

\r\n

You can add one or more host templates to a host configuration. Nagios will add the definitions from each template to a host configuration.

\r\n

If you add more than one template - the sort order will be used to overwrite configuration items which are defined inside templates before.

\r\n

The host configuration itselves will overwrite all values which are defined in templates before and pass all values which are not defined.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(26, 'host', 'initial_state', '3', 'default', '

Host - initial state

\r\n

By default Nagios will assume that all hosts are in UP states when in starts. You can override the initial state for a host by using this directive. Valid options are:
o
= UP,
d = DOWN, and
u = UNREACHABLE.

\r\n

Parameter name: initial_state
Required:
no

\r\n

 

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(27, 'host', 'retry_interval', '3', 'default', '

Host - retry interval

\r\n

This directive is used to define the number of "time units" to wait before scheduling a re-check of the hosts. Hosts are rescheduled at the retry interval when they have changed to a non-UP state. Once the host has been retried max_check_attempts times without a change in its status, it will revert to being scheduled at its "normal" rate as defined by the check_interval value. Unless you''ve changed the interval_length directive from the default value of 60, this number will mean minutes. More information on this value can be found in the check scheduling documentation.

\r\n

Parameter name: retry_interval
Required:
no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(28, 'host', 'max_check_attempts', 'all', 'default', '

Host - max check attempts

\r\n

This directive is used to define the number of times that Nagios will retry the host check command if it returns any state other than an OK state. Setting this value to 1 will cause Nagios to generate an alert without retrying the host check again. Note: If you do not want to check the status of the host, you must still set this to a minimum value of 1. To bypass the host check, just leave the check_command option blank.

\r\n

Parameter name: max_check_attempts
Required:
yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(29, 'host', 'check_interval', 'all', 'default', '

Host - check interval

\r\n

This directive is used to define the number of "time units" between regularly scheduled checks of the host. Unless you''ve changed the interval_length directive from the default value of 60, this number will mean minutes. More information on this value can be found in the check scheduling documentation.

\r\n

Parameter name: check_interval
Required:
no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(30, 'host', 'active_checks_enabled', 'all', 'default', '

Host - active checks enabled

\r\n

This directive is used to determine whether or not active checks (either regularly scheduled or on-demand) of this host are enabled. Values: 0 = disable active host checks, 1 = enable active host checks.

\r\n

Parameter name: active_checks_enabled
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(31, 'host', 'passive_checks_enabled', 'all', 'default', '

Host - passive checks enabled

\r\n

This directive is used to determine whether or not passive checks are enabled for this host. Values: 0 = disable passive host checks, 1 = enable passive host checks.

\r\n

Parameter name: passive_checks_enabled
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(32, 'host', 'check_period', 'all', 'default', '

Host - check period

\r\n

This directive is used to specify the short name of the time period during which active checks of this host can be made.

\r\n

Parameter name: check_period
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(33, 'host', 'freshness_threshold', 'all', 'default', '

Host - freshness threshold

\r\n

This directive is used to specify the freshness threshold (in seconds) for this host. If you set this directive to a value of 0, Nagios will determine a freshness threshold to use automatically.

\r\n

Parameter name: freshness_threshold
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(34, 'host', 'check_freshness', 'all', 'default', '

Host - check freshness

\r\n

This directive is used to determine whether or not freshness checks are enabled for this host. Values: 0 = disable freshness checks, 1 = enable freshness checks.

\r\n

Parameter name: check_freshness
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(35, 'host', 'obsess_over_host', 'all', 'default', '

Host - obsess over host

\r\n

This directive determines whether or not checks for the host will be "obsessed" over using the ochp_command.

\r\n

Parameter name: obsess_over_host
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(36, 'host', 'event_handler', 'all', 'default', '

Host - event handler

\r\n

This directive is used to specify the short name of the command that should be run whenever a change in the state of the host is detected (i.e. whenever it goes down or recovers). Read the documentation on event handlers for a more detailed explanation of how to write scripts for handling events. The maximum amount of time that the event handler command can run is controlled by the event_handler_timeout option.

\r\n

Parameter name: event_handler
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(37, 'host', 'event_handler_enabled', 'all', 'default', '

Host - event handler enabled

\r\n

This directive is used to determine whether or not the event handler for this host is enabled. Values: 0 = disable host event handler, 1 = enable host event handler.

\r\n

Parameter name: event_handler_enabled
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(38, 'host', 'low_flap_threshold', 'all', 'default', '

Host - low flap threshold

\r\n

This directive is used to specify the low state change threshold used in flap detection for this host. If you set this directive to a value of 0, the program-wide value specified by the low_host_flap_threshold directive will be used.

\r\n

Parameter name: low_flap_threshold
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(39, 'host', 'high_flap_threshold', 'all', 'default', '

Host - high flap threshold

\r\n

This directive is used to specify the high state change threshold used in flap detection for this host. If you set this directive to a value of 0, the program-wide value specified by the high_host_flap_threshold directive will be used.

\r\n

Parameter name: high_flap_threshold
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(40, 'host', 'flap_detection_enabled', 'all', 'default', '

Host - flap detection enabled

\r\n

This directive is used to determine whether or not flap detection is enabled for this host. Values: 0 = disable host flap detection, 1 = enable host flap detection.

\r\n

Parameter name: flap_detection_enabled
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(41, 'host', 'flap_detection_options', '3', 'default', '

Host - flap detection options

\r\n

This directive is used to determine what host states the flap detection logic will use for this host. Valid options are a combination of one or more of the following:
o
= UP states,
d = DOWN states,
u = UNREACHABLE states.

\r\n

Parameter name: flap_detection_options
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(42, 'host', 'retain_status_information', 'all', 'default', '

Host - retain status information

\r\n

This directive is used to determine whether or not status-related information about the host is retained across program restarts. This is only useful if you have enabled state retention using the retain_state_information directive. Value: 0 = disable status information retention, 1 = enable status information retention.

\r\n

Parameter name: retain_status_information
Required:
no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(43, 'host', 'retain_nonstatus_information', 'all', 'default', '

Host - retain nonstatus information

\r\n

This directive is used to determine whether or not non-status information about the host is retained across program restarts. This is only useful if you have enabled state retention using the retain_state_information directive. Value: 0 = disable non-status information retention, 1 = enable non-status information retention.

\r\n

Parameter name: retain_nonstatus_information
Required:
no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(45, 'host', 'contacts', '3', 'default', '

Host - contacts

\r\n

This is a list of the short names of the contacts that should be notified whenever there are problems (or recoveries) with this host. Multiple contacts should be separated by commas. Useful if you want notifications to go to just a few people and don''t want to configure contact groups. You must specify at least one contact or contact group in each host definition.

\r\n

Parameter name: contacs
Required:
yes (at least one contact or contact group)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(46, 'host', 'contactgroups', 'all', 'default', '

Host - contact groups

\r\n

This is a list of the short names of the contact groups that should be notified whenever there are problems (or recoveries) with this host. Multiple contact groups should be separated by commas. You must specify at least one contact or contact group in each host definition.

\r\n

Parameter name: contact_groups
Required: yes (at least one contact or contact group)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(47, 'host', 'notification_period', 'all', 'default', '

Host - notification period

\r\n

This directive is used to specify the short name of the time period during which notifications of events for this host can be sent out to contacts. If a host goes down, becomes unreachable, or recoveries during a time which is not covered by the time period, no notifications will be sent out.

\r\n

Parameter name: notification_period
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(48, 'host', 'notification_options', 'all', 'default', '

Host - notification options

\r\n

This directive is used to determine when notifications for the host should be sent out. Valid options are a combination of one or more of the following:
d = send notifications on a DOWN state,
u = send notifications on an UNREACHABLE state,
r
= send notifications on recoveries (OK state),
f = send notifications when the host starts and stops flapping, and
s = send notifications when scheduled downtime starts and ends.
If you do not specify any notification options, Nagios will assume that you want notifications to be sent out for all possible states.

\r\n

Example: If you specify d,r in this field, notifications will only be sent out when the host goes DOWN and when it recovers from a DOWN state.

\r\n

Parameter name: notification_options
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(51, 'host', 'notification_enabled', 'all', 'default', '

Host - notification enabled

\r\n

This directive is used to determine whether or not notifications for this host are enabled. Values: 0 = disable host notifications, 1 = enable host notifications.

\r\n

Parameter name: notification_enabled
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(52, 'host', 'stalking_options', 'all', 'default', '

Host - stalking options

\r\n

This directive determines which host states "stalking" is enabled for. Valid options are a combination of one or more of the following:
o
= stalk on UP states,
d = stalk on DOWN states, and
u = stalk on UNREACHABLE states.

\r\n

Parameter name: stalking_options
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(53, 'host', 'process_perf_data', 'all', 'default', '

Host - process performance data

\r\n

This directive is used to determine whether or not the processing of performance data is enabled for this host. Values: 0 = disable performance data processing, 1 = enable performance data processing.

\r\n

Parameter name: process_perf_data
Required:
no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(54, 'host', 'notification_intervall', 'all', 'default', '

Host - notification interval

\r\n

This directive is used to define the number of "time units" to wait before re-notifying a contact that this service is still down or unreachable. Unless you''ve changed the interval_length directive from the default value of 60, this number will mean minutes. If you set this value to 0, Nagios will not re-notify contacts about problems for this host - only one problem notification will be sent out.

\r\n

Parameter name: notification_interval
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(55, 'host', 'first_notification_delay', 'all', 'default', '

Host - first notification delay

\r\n

This directive is used to define the number of "time units" to wait before sending out the first problem notification when this host enters a non-UP state. Unless you''ve changed the interval_length directive from the default value of 60, this number will mean minutes. If you set this value to 0, Nagios will start sending out notifications immediately.

\r\n

Parameter name: first_notification_delay
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(56, 'host', 'notes', '3', 'default', '

Host - notes

\r\n

This directive is used to define an optional string of notes pertaining to the host. If you specify a note here, you will see the it in the extended information CGI (when you are viewing information about the specified host).

\r\n

Parameter name: notes
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(57, 'host', 'vrml_image', '3', 'default', '

Host - vrml image

\r\n

This variable is used to define the name of a GIF, PNG, or JPG image that should be associated with this host. This image will be used as the texture map for the specified host in the statuswrl CGI. Unlike the image you use for the icon_image variable, this one should probably not have any transparency.

\r\n

If it does, the host object will look a bit wierd. Images for hosts are assumed to be in the logos/ subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).

\r\n

Parameter name: vrml_image
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(58, 'host', 'notes_url', '3', 'default', '

Host - notes url

\r\n

This variable is used to define an optional URL that can be used to provide more information about the host. If you specify an URL, you will see a red folder icon in the CGIs (when you are viewing host information) that links to the URL you specify here. Any valid URL can be used.

\r\n

If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/). This can be very useful if you want to make detailed information on the host, emergency contact methods, etc. available to other support staff.

\r\n

Parameter name: notes_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(59, 'host', 'status_image', '3', 'default', '

Host - statusmap image

\r\n

This variable is used to define the name of an image that should be associated with this host in the statusmap CGI. You can specify a JPEG, PNG, and GIF image if you want, although I would strongly suggest using a GD2 format image, as other image formats will result in a lot of wasted CPU time when the statusmap image is generated.

\r\n

GD2 images can be created from PNG images by using the pngtogd2 utility supplied with Thomas Boutell''s gd library . The GD2 images should be created in uncompressed format in order to minimize CPU load when the statusmap CGI is generating the network map image.

\r\n

The image will look best if it is 40x40 pixels in size. You can leave these option blank if you are not using the statusmap CGI. Images for hosts are assumed to be in the logos/ subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).

\r\n

Parameter name: statusmap_image
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(60, 'host', 'action_url', '3', 'default', '

Host - action url

\r\n

This directive is used to define an optional URL that can be used to provide more actions to be performed on the host. If you specify an URL, you will see a red "splat" icon in the CGIs (when you are viewing host information) that links to the URL you specify here. Any valid URL can be used.

\r\n

If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/).

\r\n

Parameter name: action_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(61, 'host', 'icon_image', '3', 'default', '

Host - icon image

\r\n

This variable is used to define the name of a GIF, PNG, or JPG image that should be associated with this host. This image will be displayed in the various places in the CGIs. The image will look best if it is 40x40 pixels in size. Images for hosts are assumed to be in the logos/ subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).

\r\n

Parameter name: icon_image
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(62, 'host', '2d_coords', '3', 'default', '

Host - 2D coords

\r\n

This variable is used to define coordinates to use when drawing the host in the statusmap CGI. Coordinates should be given in positive integers, as they correspond to physical pixels in the generated image. The origin for drawing (0,0) is in the upper left hand corner of the image and extends in the positive x direction (to the right) along the top of the image and in the positive y direction (down) along the left hand side of the image.

\r\n

For reference, the size of the icons drawn is usually about 40x40 pixels (text takes a little extra space). The coordinates you specify here are for the upper left hand corner of the host icon that is drawn. Note: Don''t worry about what the maximum x and y coordinates that you can use are. The CGI will automatically calculate the maximum dimensions of the image it creates based on the largest x and y coordinates you specify.

\r\n

Parameter name: 2d_coords
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(63, 'host', 'icon_image_alt_text', '3', 'default', '

Host - icon image alt

\r\n

This variable is used to define an optional string that is used in the ALT tag of the image specified by the icon image argument.

\r\n

Parameter name: icon_image_alt
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(64, 'host', '3d_coords', '3', 'default', '

Host - 3D coords

\r\n

This variable is used to define coordinates to use when drawing the host in the statuswrl CGI. Coordinates can be positive or negative real numbers. The origin for drawing is (0.0,0.0,0.0). For reference, the size of the host cubes drawn is 0.5 units on each side (text takes a little more space). The coordinates you specify here are used as the center of the host cube.

\r\n

Parameter name: 3d_coords
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(65, 'common', 'free_variables_name', 'all', 'default', '

Free variables (custom object variables)

\r\n

NagiosQL supports custom object variables.

\r\n

There are a few important things that you should note about custom variables:

\r\n
    \r\n
  • Custom variable names must begin with an underscore (_) to prevent name collision with standard variables
  • \r\n
  • Custom variable names are case-insensitive
  • \r\n
  • Custom variables are inherited from object templates like normal variables
  • \r\n
  • Scripts can reference custom variable values with macros and environment variables
  • \r\n
\r\n

Examples

\r\n

define host{
       host_name linuxserver
       _mac_address 00:06:5B:A6:AD:AA ; <-- Custom MAC_ADDRESS variable
       _rack_number R32 ; <-- Custom RACK_NUMBER variable
       ...
}

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(66, 'common', 'free_variables_value', 'all', 'default', '

Free variables (custom object variables)

\r\n

NagiosQL supports custom object variables.

\r\n

There are a few important things that you should note about custom variables:

\r\n
    \r\n
  • Custom variable names must begin with an underscore (_) to prevent name collision with standard variables
  • \r\n
  • Custom variable names are case-insensitive
  • \r\n
  • Custom variables are inherited from object templates like normal variables
  • \r\n
  • Scripts can reference custom variable values with macros and environment variables
  • \r\n
\r\n

Examples

\r\n

define host{
       host_name linuxserver
       _mac_address 00:06:5B:A6:AD:AA ; <-- Custom MAC_ADDRESS variable
       _rack_number R32 ; <-- Custom RACK_NUMBER variable
       ...
}

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(67, 'host', 'genericname', 'all', 'default', '

Host or Service - generic name

\r\n

It is possible to use a host definition as a template for other host configurations. If this definition should be used as template, a generic template name must be defined.

\r\n

We do not recommend to do this - it is more open to define a separate host template than to use this option.

\r\n

Parameter name: name
Required:
no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(68, 'service', 'config_name', 'all', 'default', '

Service - config name

\r\n

This directive is used to specify a common config name for a group of service definitions. This is a NagiosQL parameter and it will not be written to the configuration file. Every service definitions with the same configuration name will stored in one file. The configuration name is also the file name of this configuration set.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(69, 'service', 'hosts', 'all', 'default', '

Service - host name

\r\n

This directive is used to specify the short name(s) of the host(s) that the service "runs" on or is associated with.

\r\n

Parameter name: host_name
Required: yes (no, if a hostgroup is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(70, 'service', 'hostgroups', 'all', 'default', '

Service - hostgroup name

\r\n

This directive is used to specify the short name(s) of the hostgroup(s) that the service "runs" on or is associated with. The hostgroup_name may be used instead of, or in addition to, the host_name directive.

\r\n

Parameter name: hostgroup_name
Required: no (yes, if no host is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(71, 'service', 'service_description', 'all', 'default', '

Service - service description

\r\n

This directive is used to define the description of the service, which may contain spaces, dashes, and colons (semicolons, apostrophes, and quotation marks should be avoided). No two services associated with the same host can have the same description. Services are uniquely identified with their host_name and service_description directives.

\r\n

Parameter name: service_description
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(72, 'service', 'service_groups', 'all', 'default', '

Service - servicegroups

\r\n

This directive is used to identify the short name(s) of the servicegroup(s) that the service belongs to. Multiple servicegroups should be separated by commas. This directive may be used as an alternative to using the members directive in servicegroup definitions.

\r\n

NagiosQL: If a servicegroup is defined here - this service will not be selected inside the member field of the same servicegroup definition!

\r\n

Parameter name: servicegroups
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(73, 'service', 'display_name', 'all', 'default', '

Service - display name

\r\n

This directive is used to define an alternate name that should be displayed in the web interface for this service. If not specified, this defaults to the value you specify for the service_description directive. Note: The current CGIs do not use this option, although future versions of the web interface will.

\r\n

Parameter name: display_name
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(74, 'service', 'check_command', 'all', 'default', '

Service - check command

\r\n

This directive is used to specify the short name of the command that Nagios will run in order to check the status of the service. The maximum amount of time that the service check command can run is controlled by the service_check_timeout option.

\r\n

Parameter name: check_command
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(75, 'service', 'argument', 'all', 'default', '

Service - arguments

\r\n

The values defined here will replace the according argument variable behind the selected command. Up to 8 argument variables are supported. Be sure, that you defines a valid value for each required argument variable.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(76, 'service', 'templateadd', 'all', 'default', '

Service - Templates

\r\n

You can add one or more service templates to a service configuration. Nagios will add the definitions from each template to a service configuration.

\r\n

If you add more than one template - the sort order will be used to overwrite configuration items which are defined inside templates before.

\r\n

The host configuration itselves will overwrite all values which are defined in templates before and pass all values which are not defined.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(77, 'service', 'initial_state', '3', 'default', '

Service - initial state

\r\n

By default Nagios will assume that all services are in OK states when in starts. You can override the initial state for a service by using this directive. Valid options are:
o
= OK,
w = WARNING,
u
= UNKNOWN, and
c
= CRITICAL.

\r\n

Parameter name: initial_state
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(78, 'service', 'retry_interval', '3', 'default', '

Service - retry interval

\r\n

This directive is used to define the number of "time units" to wait before scheduling a re-check of the service. Services are rescheduled at the retry interval when they have changed to a non-OK state. Once the service has been retried max_check_attempts times without a change in its status, it will revert to being scheduled at its "normal" rate as defined by the check_interval value. Unless you''ve changed the interval_length directive from the default value of 60, this number will mean minutes. More information on this value can be found in the check scheduling documentation.

\r\n

Parameter name: retry_interval
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(79, 'service', 'max_check_attempts', 'all', 'default', '

Service - max check attempts

\r\n

This directive is used to define the number of times that Nagios will retry the service check command if it returns any state other than an OK state. Setting this value to 1 will cause Nagios to generate an alert without retrying the service check again.

\r\n

Parameter name: max_check_attempts
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(80, 'service', 'check_interval', 'all', 'default', '

Service - check interval

\r\n

This directive is used to define the number of "time units" to wait before scheduling the next "regular" check of the service. "Regular" checks are those that occur when the service is in an OK state or when the service is in a non-OK state, but has already been rechecked max_check_attempts number of times. Unless you''ve changed the interval_length directive from the default value of 60, this number will mean minutes. More information on this value can be found in the check scheduling documentation.

\r\n

Parameter name: check_interval
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(81, 'service', 'active_checks_enabled', 'all', 'default', '

Service - active checks enabled

\r\n

This directive is used to determine whether or not active checks of this service are enabled. Values: 0 = disable active service checks, 1 = enable active service checks.

\r\n

Parameter name: active_checks_enabled
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(82, 'service', 'passive_checks_enabled', 'all', 'default', '

Service - passive checks enabled

\r\n

This directive is used to determine whether or not passive checks of this service are enabled. Values: 0 = disable passive service checks, 1 = enable passive service checks.

\r\n

Parameter name: passive_checks_enabled
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(83, 'service', 'parallelize_checks', '2', 'default', '

Service - parallelize check

\r\n

This directive is used to determine whether or not the service check can be parallelized. By default, all service checks are parallelized. Disabling parallel checks of services can result in serious performance problems. More information on service check parallelization can be found in the nagios documentation.

\r\n

Values: 0 = service check cannot be parallelized (use with caution!), 1 = service check can be parallelized.

\r\n

Parameter name: parallelize_check
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(84, 'service', 'check_period', 'all', 'default', '

Service - check period

\r\n

This directive is used to specify the short name of the time period during which active checks of this service can be made.

\r\n

Parameter name: check_period
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(85, 'service', 'freshness_threshold', 'all', 'default', '

Service - freshness threshold

\r\n

This directive is used to specify the freshness threshold (in seconds) for this service. If you set this directive to a value of 0, Nagios will determine a freshness threshold to use automatically.

\r\n

Parameter name: freshness_threshold
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(86, 'service', 'check_freshness', 'all', 'default', '

Service - check freshness

\r\n

This directive is used to determine whether or not freshness checks are enabled for this service. Values: 0 = disable freshness checks, 1 = enable freshness checks.

\r\n

Parameter name: check_freshness
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(87, 'service', 'obsess_over_service', 'all', 'default', '

Service - obsess over service

\r\n

This directive determines whether or not checks for the service will be "obsessed" over using the ocsp_command.

\r\n

Parameter name: obsess_over_service
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(88, 'service', 'event_handler', 'all', 'default', '

Service - event handler

\r\n

This directive is used to specify the short name of the command that should be run whenever a change in the state of the service is detected (i.e. whenever it goes down or recovers). Read the documentation on event handlers for a more detailed explanation of how to write scripts for handling events. The maximum amount of time that the event handler command can run is controlled by the event_handler_timeout option.

\r\n

Parameter name: event_handler
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(89, 'service', 'event_handler_enabled', 'all', 'default', '

Service - event handler enabled

\r\n

This directive is used to determine whether or not the event handler for this service is enabled. Values: 0 = disable service event handler, 1 = enable service event handler.

\r\n

Parameter name: event_handler_enabled
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(90, 'service', 'low_flap_threshold', 'all', 'default', '

Service - low flap threshold

\r\n

This directive is used to specify the low state change threshold used in flap detection for this service. More information on flap detection can be found in the nagios documentation. If you set this directive to a value of 0, the program-wide value specified by the low_service_flap_threshold directive will be used.

\r\n

Parameter name: low_flap_threshold
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(91, 'service', 'high_flap_threshold', 'all', 'default', '

Service - high flap threshold

\r\n

This directive is used to specify the high state change threshold used in flap detection for this service. More information on flap detection can be found in the nagios documentation. If you set this directive to a value of 0, the program-wide value specified by the high_service_flap_threshold directive will be used.

\r\n

Parameter name: high_flap_threshold
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(92, 'service', 'flap_detection_enabled', 'all', 'default', '

Service - flap detection enabled

\r\n

This directive is used to determine whether or not flap detection is enabled for this service. More information on flap detection can be found in the nagios documentation. Values: 0 = disable service flap detection, 1 = enable service flap detection.

\r\n

Parameter name: flap_detection_enabled
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(93, 'service', 'flap_detection_options', '3', 'default', '

Service - flap detection options

\r\n

This directive is used to determine what service states the flap detection logic will use for this service. Valid options are a combination of one or more of the following:
o
= OK states,
w = WARNING states,
c = CRITICAL states,
u = UNKNOWN states.

\r\n

Parameter name: flap_detection_options
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(94, 'service', 'retain_status_information', 'all', 'default', '

Service - retain status information

\r\n

This directive is used to determine whether or not status-related information about the service is retained across program restarts. This is only useful if you have enabled state retention using the retain_state_information directive. Value: 0 = disable status information retention, 1 = enable status information retention.

\r\n

Parameter name: retain_status_information
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(95, 'service', 'retain_nonstatus_information', 'all', 'default', '

Service - retain nonstatus information

\r\n

This directive is used to determine whether or not non-status information about the service is retained across program restarts. This is only useful if you have enabled state retention using the retain_state_information directive. Value: 0 = disable non-status information retention, 1 = enable non-status information retention.

\r\n

Parameter name: retain_nonstatus_information
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(96, 'service', 'process_perf_data', 'all', 'default', '

Service - process perf data

\r\n

This directive is used to determine whether or not the processing of performance data is enabled for this service. Values: 0 = disable performance data processing, 1 = enable performance data processing.

\r\n

Parameter name: process_perf_data
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(97, 'service', 'is_volatile', 'all', 'default', '

Service - is volatile

\r\n

This directive is used to denote whether the service is "volatile". Services are normally not volatile. More information on volatile service and how they differ from normal services can be found in the nagios documentation. Value: 0 = service is not volatile, 1 = service is volatile.

\r\n

Parameter name: is_volatile
Required:no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(98, 'service', 'contacts', '3', 'default', '

Service - contacts

\r\n

This is a list of the short names of the contacts that should be notified whenever there are problems (or recoveries) with this service. Multiple contacts should be separated by commas. Useful if you want notifications to go to just a few people and don''t want to configure contact groups. You must specify at least one contact or contact group in each service definition.

\r\n

Parameter name: contacts
Required: yes (no, if a contact group is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(99, 'service', 'contactgroups', 'all', 'default', '

Service - contact groups

\r\n

This is a list of the short names of the contact groups that should be notified whenever there are problems (or recoveries) with this service. Multiple contact groups should be separated by commas. You must specify at least one contact or contact group in each service definition.

\r\n

Parameter name: contact_groups
Required: yes (no, if a contact is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(100, 'service', 'notification_period', 'all', 'default', '

Service - notification period

\r\n

This directive is used to specify the short name of the time period during which notifications of events for this service can be sent out to contacts. No service notifications will be sent out during times which is not covered by the time period.

\r\n

Parameter name: notification_period
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(101, 'service', 'notification_options', 'all', 'default', '

Service - notification options

\r\n

This directive is used to determine when notifications for the service should be sent out. Valid options are a combination of one or more of the following:

w
= send notifications on a WARNING state,
u = send notifications on an UNKNOWN state,
c
= send notifications on a CRITICAL state,
r = send notifications on recoveries (OK state),
f
= send notifications when the service starts and stops flapping, and
s = send notifications when scheduled downtime starts and ends.

\r\n

If you do not specify any notification options, Nagios will assume that you want notifications to be sent out for all possible states.

\r\n

Example: If you specify w,r in this field, notifications will only be sent out when the service goes into a WARNING state and when it recovers from a WARNING state.

\r\n

Parameter name: notification_options
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(102, 'service', 'notification_intervall', 'all', 'default', '

Service - notification interval

\r\n

This directive is used to define the number of "time units" to wait before re-notifying a contact that this service is still in a non-OK state. Unless you''ve changed the interval_length directive from the default value of 60, this number will mean minutes. If you set this value to 0, Nagios will not re-notify contacts about problems for this service - only one problem notification will be sent out.

\r\n

Parameter name: notification_interval
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(103, 'service', 'first_notification_delay', 'all', 'default', '

Service - first notification delay

\r\n

This directive is used to define the number of "time units" to wait before sending out the first problem notification when this service enters a non-OK state. Unless you''ve changed the interval_length directive from the default value of 60, this number will mean minutes. If you set this value to 0, Nagios will start sending out notifications immediately.

\r\n

Parameter name: first_notification_delay
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(104, 'service', 'notification_enabled', 'all', 'default', '

Service - notifications enabled

\r\n

This directive is used to determine whether or not notifications for this service are enabled. Values: 0 = disable service notifications, 1 = enable service notifications.

\r\n

Parameter name: notifications_enabled
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(105, 'service', 'stalking_options', 'all', 'default', '

Service - stalking options

\r\n

This directive determines which service states "stalking" is enabled for. Valid options are a combination of one or more of the following:
o
= stalk on OK states,
w = stalk on WARNING states,
u
= stalk on UNKNOWN states, and
c
= stalk on CRITICAL states.

\r\n

More information on state stalking can be found in the nagios documentation.

\r\n

Parameter name: stalking_options
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(106, 'service', 'notes', '3', 'default', '

Service - notes

\r\n

This directive is used to define an optional string of notes pertaining to the service. If you specify a note here, you will see the it in the extended information CGI (when you are viewing information about the specified service).

\r\n

Parameter name: notes
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(107, 'service', 'icon_image', '3', 'default', '

Service - icon image

\r\n

This variable is used to define the name of a GIF, PNG, or JPG image that should be associated with this service. This image will be displayed in the status and extended information CGIs. The image will look best if it is 40x40 pixels in size. Images for services are assumed to be in the logos/ subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).

\r\n

Parameter name: icon_image
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(108, 'service', 'notes_url', '3', 'default', '

Service - notes url

\r\n

This directive is used to define an optional URL that can be used to provide more information about the service. If you specify an URL, you will see a red folder icon in the CGIs (when you are viewing service information) that links to the URL you specify here. Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/). This can be very useful if you want to make detailed information on the service, emergency contact methods, etc. available to other support staff.

\r\n

Parameter name: notes_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(109, 'service', 'icon_image_alt_text', '3', 'default', '

Service - icon image alt

\r\n

This variable is used to define an optional string that is used in the ALT tag of the image specified by the <icon_image> argument. The ALT tag is used in the status, extended information and statusmap CGIs.

\r\n

Parameter name: icon_image_alt
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(110, 'service', 'action_url', '3', 'default', '

Service - action url

\r\n

This directive is used to define an optional URL that can be used to provide more actions to be performed on the service. If you specify an URL, you will see a red "splat" icon in the CGIs (when you are viewing service information) that links to the URL you specify here. Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/).

\r\n

Parameter name: action_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(111, 'hostgroup', 'hostgroup_name', 'all', 'default', '

Hostgroup - hostgroup name

\r\n

This directive is used to define a short name used to identify the host group.

\r\n

Parameter name: hostgroup_name
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(112, 'hostgroup', 'members', 'all', 'default', '

Hostgroup - members

\r\n

This is a list of the short names of hosts that should be included in this group. Multiple host names should be separated by commas. This directive may be used as an alternative to (or in addition to) the hostgroups directive in host definitions.

\r\n

NagiosQL: If you select a hostgroup inside a host definition using the hostgroups directive in host definition, this host will not be selected here because these are two different ways to specify a hostgroup!

\r\n

Parameter name: members
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(113, 'hostgroup', 'description', 'all', 'default', '

Hostgroup - alias

\r\n

This directive is used to define is a longer name or description used to identify the host group. It is provided in order to allow you to more easily identify a particular host group.

\r\n

Parameter name: alias
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(114, 'hostgroup', 'notes', '3', 'default', '

Hostgroup - notes

\r\n

This directive is used to define an optional string of notes pertaining to the host. If you specify a note here, you will see the it in the extended information CGI (when you are viewing information about the specified host).

\r\n

Parameter name: notes
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(115, 'hostgroup', 'notes_url', '3', 'default', '

Hostgroup - notes url

\r\n

This variable is used to define an optional URL that can be used to provide more information about the host group. If you specify an URL, you will see a red folder icon in the CGIs (when you are viewing hostgroup information) that links to the URL you specify here. Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/). This can be very useful if you want to make detailed information on the host group, emergency contact methods, etc. available to other support staff.

\r\n

Parameter name: notes_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(116, 'hostgroup', 'action_url', '3', 'default', '

Hostgroup - action url

\r\n

This directive is used to define an optional URL that can be used to provide more actions to be performed on the host group. If you specify an URL, you will see a red "splat" icon in the CGIs (when you are viewing hostgroup information) that links to the URL you specify here. Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/).

\r\n

Parameter name: action_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(117, 'hostgroup', 'hostgroup_members', 'all', 'default', '

Hostgroup - hostgroup members

\r\n

This optional directive can be used to include hosts from other "sub" host groups in this host group. Specify a comma-delimited list of short names of other host groups whose members should be included in this group.

\r\n

Parameter name: hostgroup_members
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(118, 'servicegroup', 'servicegroup_name', 'all', 'default', '

Servicegroup - servicegroup name

\r\n

This directive is used to define a short name used to identify the service group.

\r\n

Parameter name: servicegroup_name
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(119, 'servicegroup', 'members', 'all', 'default', '

Servicegroup - members

\r\n

This is a list of the descriptions of services (and the names of their corresponding hosts) that should be included in this group. Host and service names should be separated by commas. This directive may be used as an alternative to the servicegroups directive in service definitions.

\r\n

NagiosQL: If you select a servicegroup inside a service definition using the servicegroups directive in service definition, this service will not be selected here because these are two different ways to specify a servicegroup!

\r\n

Parameter name: members
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(120, 'servicegroup', 'description', 'all', 'default', '

Servicegroup - alias

\r\n

This directive is used to define is a longer name or description used to identify the service group. It is provided in order to allow you to more easily identify a particular service group.

\r\n

Parameter name: alias
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(121, 'servicegroup', 'notes', '3', 'default', '

Servicegroup - notes

\r\n

This directive is used to define an optional string of notes pertaining to the service group. If you specify a note here, you will see the it in the extended information CGI (when you are viewing information about the specified service group).

\r\n

Parameter name: notes
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(122, 'servicegroup', 'notes_url', '3', 'default', '

Servicegroup - notes url

\r\n

This directive is used to define an optional URL that can be used to provide more information about the service group. If you specify an URL, you will see a red folder icon in the CGIs (when you are viewing service group information) that links to the URL you specify here. Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/). This can be very useful if you want to make detailed information on the service group, emergency contact methods, etc. available to other support staff.

\r\n

Parameter name: notes_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(123, 'servicegroup', 'action_url', '3', 'default', '

Servicegroup - action url

\r\n

This directive is used to define an optional URL that can be used to provide more actions to be performed on the service group. If you specify an URL, you will see a red "splat" icon in the CGIs (when you are viewing service group information) that links to the URL you specify here. Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/).

\r\n

Parameter name: action_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(124, 'servicegroup', 'servicegroup_members', 'all', 'default', '

Servicegroup - servicegroup members

\r\n

This optional directive can be used to include services from other "sub" service groups in this service group. Specify a comma-delimited list of short names of other service groups whose members should be included in this group.

\r\n

Parameter name: servicegroup_members
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(125, 'hosttemplate', 'template_name', 'all', 'default', '

Hosttemplate - template name

\r\n

This directive is used to define a short name used to identify the host template.

\r\n

Parameter name: name
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(126, 'servicetemplate', 'template_name', 'all', 'default', '

Servicetemplate - template name

\r\n

This directive is used to define a short name used to identify the service template.

\r\n

Parameter name: name
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(127, 'contact', 'contact_name', 'all', 'default', '

Contact - contact name

\r\n

This directive is used to define a short name used to identify the contact. It is referenced in contact group definitions. Under the right circumstances, the $CONTACTNAME$ macro will contain this value.

\r\n

Parameter name: contact_name
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(128, 'contact', 'contactgroups', 'all', 'default', '

Contact - contactgroups

\r\n

This directive is used to identify the short name(s) of the contactgroup(s) that the contact belongs to. Multiple contactgroups should be separated by commas. This directive may be used as an alternative to (or in addition to) using the members directive in contactgroup definitions.

\r\n

NagiosQL: If a contactgroup is defined here - this contact will not be selected inside the member field of the same contactgroup definition!

\r\n

Parameter name: contactgroups
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(129, 'contact', 'alias', 'all', 'default', '

Contact - alias

\r\n

This directive is used to define a longer name or description for the contact. Under the rights circumstances, the $CONTACTALIAS$ macro will contain this value. If not specified, the contact_name will be used as the alias.

\r\n

Parameter name: alias
Required: no (yes in Nagios 2.x)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(130, 'contact', 'email', 'all', 'default', '

Contact - email

\r\n

This directive is used to define an email address for the contact. Depending on how you configure your notification commands, it can be used to send out an alert email to the contact. Under the right circumstances, the $CONTACTEMAIL$ macro will contain this value.

\r\n

Parameter name: email
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(131, 'contact', 'pager', 'all', 'default', '

Contact - pager

\r\n

This directive is used to define a pager number for the contact. It can also be an email address to a pager gateway (i.e. pagejoe@pagenet.com). Depending on how you configure your notification commands, it can be used to send out an alert page to the contact. Under the right circumstances, the $CONTACTPAGER$ macro will contain this value.

\r\n

Parameter name: pager
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(132, 'contact', 'address', 'all', 'default', '

Contact - addressx

\r\n

Address directives are used to define additional "addresses" for the contact. These addresses can be anything - cell phone numbers, instant messaging addresses, etc. Depending on how you configure your notification commands, they can be used to send out an alert o the contact. Up to six addresses can be defined using these directives (address1 through address6). The $CONTACTADDRESSx$ macro will contain this value.

\r\n

Parameter name: addressx (x as number from 1 to 6)
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(133, 'contact', 'host_notifications_enabled', '3', 'default', '

Contact - host notifications enabled

\r\n

This directive is used to determine whether or not the contact will receive notifications about host problems and recoveries. Values: 0 = don''t send notifications, 1 = send notifications.

\r\n

Parameter name: host_notifications_enabled
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(134, 'contact', 'service_notifications_enabled', '3', 'default', '

Contact - service notifications enabled

\r\n

This directive is used to determine whether or not the contact will receive notifications about service problems and recoveries. Values: 0 = don''t send notifications, 1 = send notifications.

\r\n

Parameter name: service_notifications_enabled
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(135, 'contact', 'host_notification_period', 'all', 'default', '

Contact - host notification period

\r\n

This directive is used to specify the short name of the time period during which the contact can be notified about host problems or recoveries. You can think of this as an "on call" time for host notifications for the contact. Read the documentation on time periods for more information on how this works and potential problems that may result from improper use.

\r\n

Parameter name: host_notification_period
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(136, 'contact', 'service_notification_period', 'all', 'default', '

Contact - service notification period

\r\n

This directive is used to specify the short name of the time period during which the contact can be notified about service problems or recoveries. You can think of this as an "on call" time for service notifications for the contact. Read the documentation on time periods for more information on how this works and potential problems that may result from improper use.

\r\n

Parameter name: service_notification_period
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(137, 'contact', 'host_notification_options', '2', 'default', '

Contact - host notification options

\r\n

This directive is used to define the host states for which notifications can be sent out to this contact. Valid options are a combination of one or more of the following:
d
= notify on DOWN host states,
u = notify on UNREACHABLE host states,
r
= notify on host recoveries (UP states), and
f
= notify when the host starts and stops flapping.
If you specify n (none) as an option, the contact will not receive any type of host notifications.

\r\n

Parameter name: host_notification_options
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(138, 'contact', 'host_notification_options', '3', 'default', '

Contact - host notification options

\r\n

This directive is used to define the host states for which notifications can be sent out to this contact. Valid options are a combination of one or more of the following:
d = notify on DOWN host states,
u
= notify on UNREACHABLE host states,
r
= notify on host recoveries (UP states),
f
= notify when the host starts and stops flapping, and
s = send notifications when host or service scheduled downtime starts and ends.
If you specify n (none) as an option, the contact will not receive any type of host notifications.

\r\n

Parameter name: host_notification_options
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(139, 'contact', 'service_notification_options', '2', 'default', '

Contact - service notification options

\r\n

This directive is used to define the service states for which notifications can be sent out to this contact. Valid options are a combination of one or more of the following:
w
= notify on WARNING service states,
u
= notify on UNKNOWN service states,
c
= notify on CRITICAL service states,
r = notify on service recoveries (OK states), and
f = notify when the servuce starts and stops flapping.
If you specify n (none) as an option, the contact will not receive any type of host notifications.

\r\n

Parameter name: service_notification_options
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(140, 'contact', 'service_notification_options', '3', 'default', '

Contact - service notification options

\r\n

This directive is used to define the service states for which notifications can be sent out to this contact. Valid options are a combination of one or more of the following:
w
= notify on WARNING service states,
u = notify on UNKNOWN service states,
c = notify on CRITICAL service states,
r
= notify on service recoveries (OK states), and
f = notify when the host starts and stops flapping, and
s
= send notifications when host or service scheduled downtime starts and ends.
If you specify n (none) as an option, the contact will not receive any type of host notifications.

\r\n

Parameter name: service_notification_options
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(141, 'contact', 'host_notification_commands', 'all', 'default', '

Contact - host notification commands

\r\n

This directive is used to define a list of the short names of the commands used to notify the contact of a host problem or recovery. Multiple notification commands should be separated by commas. All notification commands are executed when the contact needs to be notified. The maximum amount of time that a notification command can run is controlled by the notification_timeout option.

\r\n

Parameter name: host_notification_commands
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(142, 'contact', 'service_notification_commands', 'all', 'default', '

Contact - service notification commands

\r\n

This directive is used to define a list of the short names of the commands used to notify the contact of a service problem or recovery. Multiple notification commands should be separated by commas. All notification commands are executed when the contact needs to be notified. The maximum amount of time that a notification command can run is controlled by the notification_timeout option.

\r\n

Parameter name: service_notification_commands
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(143, 'contact', 'retain_status_information', '3', 'default', '

Contact - retain status information

\r\n

This directive is used to determine whether or not status-related information about the contact is retained across program restarts. This is only useful if you have enabled state retention using the retain_state_information directive. Value: 0 = disable status information retention, 1 = enable status information retention.

\r\n

Parameter name: retain_status_information
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(144, 'contact', 'can_submit_commands', '3', 'default', '

Contact - can submit commands

\r\n

This directive is used to determine whether or not the contact can submit external commands to Nagios from the CGIs. Values: 0 = don''t allow contact to submit commands, 1 = allow contact to submit commands.

\r\n

Parameter name: can_submit_commands
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(145, 'contact', 'retain_nostatus_information', '3', 'default', '

Contact - retain nonstatus information

\r\n

This directive is used to determine whether or not non-status information about the contact is retained across program restarts. This is only useful if you have enabled state retention using the retain_state_information directive. Value: 0 = disable non-status information retention, 1 = enable non-status information retention.

\r\n

Parameter name: retain_nonstatus_information
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(146, 'contact', 'templateadd', 'all', 'default', '

Contact - Templates

\r\n

You can add one or more contact templates to a contact configuration. Nagios will add the definitions from each template to a contact configuration.

\r\n

If you add more than one template - the sort order will be used to overwrite configuration items which are defined inside templates before.

\r\n

The host configuration itselves will overwrite all values which are defined in templates before and pass all values which are not defined.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(147, 'contact', 'genericname', 'all', 'default', '

Contact - generic name

\r\n

It is possible to use a contact definition as a template for other contact configurations. If this definition should be used as template, a generic template name must be defined.

\r\n

We do not recommend to do this - it is more open to define a separate contact template than use this option.

\r\n

Parameter name: name
Required:
no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(148, 'contactgroup', 'contactgroup_name', 'all', 'default', '

Contactgroup - contactgroup name

\r\n

This directive is a short name used to identify the contact group.

\r\n

Parameter name: contactgroup_name
Required:
yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(149, 'contactgroup', 'members', 'all', 'default', '

Contactgroup - members

\r\n

This directive is used to define a list of the short names of contacts that should be included in this group. Multiple contact names should be separated by commas. This directive may be used as an alternative to (or in addition to) using the contactgroups directive in contact definitions.

\r\n

NagiosQL: If you select a contactgroup inside a contact definition using the contactgroups directive in contact definition, this contact will not be selected here because these are two different ways to specify a contactgroup!

\r\n

Parameter name: members
Required:
yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(150, 'contactgroup', 'alias', 'all', 'default', '

Contactgroup - alias

\r\n

This directive is used to define a longer name or description used to identify the contact group.

\r\n

Parameter name: alias
Required:
yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(151, 'contactgroup', 'contactgroup_members', 'all', 'default', '

Contactgroup - contactgroup members

\r\n

This optional directive can be used to include contacts from other "sub" contact groups in this contact group. Specify a comma-delimited list of short names of other contact groups whose members should be included in this group.

\r\n

Parameter name: contactgroup_members
Required:
no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(152, 'timeperiod', 'timeperiod_name', 'all', 'default', '

Timeperiod - timeperiod name

\r\n

This directives is the short name used to identify the time period.

\r\n

Parameter name: timeperiod_name
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(153, 'timeperiod', 'exclude', '3', 'default', '

Timeperiod - exclude

\r\n

This directive is used to specify the short names of other timeperiod definitions whose time ranges should be excluded from this timeperiod. Multiple timeperiod names should be separated with a comma.

\r\n

Parameter name: exclude
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(154, 'timeperiod', 'alias', 'all', 'default', '

Timeperiod - alias

\r\n

This directive is a longer name or description used to identify the time period.

\r\n

Parameter name: alias
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(155, 'timeperiod', 'templatename', '3', 'default', '

Timeperiod - template name

\r\n

Not yet implemented.

\r\n

Parameter name: name
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(156, 'timeperiod', 'weekday', '2', 'default', '

Timeperiod - time definition

\r\n

The sunday through saturday directives are comma-delimited lists of time ranges that are "valid" times for a particular day of the week. Notice that there are seven different days for which you can define time ranges (Sunday through Saturday).

\r\n

Parameter name: [weekday] [exception]
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(157, 'timeperiod', 'timerange', '2', 'default', '

Timeperiod - time range

\r\n

Each time range is in the form of HH:MM-HH:MM, where hours are specified on a 24 hour clock. For example, 00:15-24:00 means 12:15am in the morning for this day until 12:20am midnight (a 23 hour, 45 minute total time range). If you wish to exclude an entire day from the timeperiod, simply do not include it in the timeperiod definition.

\r\n

Parameter name: [weekday] [exception]
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(158, 'timeperiod', 'weekday', '3', 'default', '

Timeperiod - time definition

\r\n

The weekday directives ("sunday" through "saturday")are comma-delimited lists of time ranges that are "valid" times for a particular day of the week. Notice that there are seven different days for which you can define time ranges (Sunday through Saturday). 

\r\n

You can also specify several different types of exceptions to the standard rotating weekday schedule. Exceptions can take a number of different forms including single days of a specific or generic month, single weekdays in a month, or single calendar dates. You can also specify a range of days/dates and even specify skip intervals to obtain functionality described by "every 3 days between these dates". Rather than list all the possible formats for exception strings, Weekdays and different types of exceptions all have different levels of precedence, so its important to understand how they can affect each other. More information on this can be found in the documentation on timeperiods.

\r\n

Parameter name: [weekday] [exception]
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(159, 'timeperiod', 'timerange', '3', 'default', '

Timeperiod - time range

\r\n

Each time range is in the form of HH:MM-HH:MM, where hours are specified on a 24 hour clock. For example, 00:15-24:00 means 12:15am in the morning for this day until 12:00am midnight (a 23 hour, 45 minute total time range). If you wish to exclude an entire day from the timeperiod, simply do not include it in the timeperiod definition.

\r\n

Parameter name: [weekday] [exception]
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(160, 'contacttemplate', 'template_name', 'all', 'default', '

Contacttemplate - template name

\r\n

This directive is used to define a short name used to identify the contact template.

\r\n

Parameter name: name
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(161, 'command', 'command_name', 'all', 'default', '

Command - command name

\r\n

This directive is the short name used to identify the command. It is referenced in contact, host, and service definitions (in notification, check, and event handler directives), among other places.

\r\n

Parameter name: command_name
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(162, 'command', 'command_line', 'all', 'default', '

Command - command line

\r\n

This directive is used to define what is actually executed by Nagios when the command is used for service or host checks, notifications, or event handlers. Before the command line is executed, all valid macros are replaced with their respective values. See the documentation on macros for determining when you can use different macros. Note that the command line is not surrounded in quotes. Also, if you want to pass a dollar sign ($) on the command line, you have to escape it with another dollar sign.

\r\n

NOTE: You may not include a semicolon (;) in the command_line directive, because everything after it will be ignored as a config file comment. You can work around this limitation by setting one of the $USER$ macros in your resource file to a semicolon and then referencing the appropriate $USER$ macro in the command_line directive in place of the semicolon.

\r\n

If you want to pass arguments to commands during runtime, you can use $ARGn$ macros in the command_line directive of the command definition and then separate individual arguments from the command name (and from each other) using bang (!) characters in the object definition directive (host check command, service event handler command, etc) that references the command. More information on how arguments in command definitions are processed during runtime can be found in the documentation on macros.

\r\n

Parameter name: command_line
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(163, 'command', 'command_type', 'all', 'default', '

Command - command type

\r\n

This directive is used to differ checks and misc commands. Its a NagiosQL definition only.

\r\n

Commands tagged as "check command" will be displayed in services and hosts as check command.

\r\n

Commands tagged as "misc command" will be displayed in contacts, services and hosts as event command.

\r\n

Not classified commands will be displayed everywhere.

\r\n

This definition is only used to reduce the amount of commands shown in the selection fields and to have a more clear view.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(164, 'hostdependency', 'dependent_host', 'all', 'default', '

Hostdependency - dependent host name

\r\n

This directive is used to identify the short name(s) of the dependent host(s). Multiple hosts should be separated by commas

\r\n

Parameter name: dependent_host_name
Required: yes (no, if a dependent hostgroup is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(165, 'hostdependency', 'dependent_hostgroups', 'all', 'default', '

Hostdependency - dependent hostgroup name

\r\n

This directive is used to identify the short name(s) of the dependenthostgroup(s). Multiple hostgroups should be separated by commas. The dependent_hostgroup_name may be used instead of, or in addition to, the dependent_host_name directive.

\r\n

Parameter name: dependent_hostgroup_name
Required: no (yes, if no dependent host is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(166, 'hostdependency', 'host', 'all', 'default', '

Hostdependency - host name

\r\n

This directive is used to identify the short name(s) of the host(s) that is being depended upon (also referred to as the master host). Multiple hosts should be separated by commas.

\r\n

Parameter name: host_name
Required: yes (no, if  a hostgroup is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(167, 'hostdependency', 'hostgroup', 'all', 'default', '

Hostdependency - hostgroup name

\r\n

This directive is used to identify the short name(s) of the host(s) that is being depended upon (also referred to as the master host). Multiple hosts should be separated by commas.

\r\n

Parameter name: hostgroup_name
Required: no (yes, if a no host is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(168, 'hostdependency', 'config_name', 'all', 'default', '

Hostdependency - config name

\r\n

This directive is used to specify a common config name for a hostdependency configration. This is a NagiosQL parameter and it will not be written to the configuration file.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(169, 'hostdependency', 'inherit_parents', 'all', 'default', '

Hostdependency - inherits parent

\r\n

This directive indicates whether or not the dependency inherits dependencies of the host that is being depended upon (also referred to as the master host). In other words, if the master host is dependent upon other hosts and any one of those dependencies fail, this dependency will also fail.

\r\n

Parameter name: inherits_parent
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(170, 'hostdependency', 'dependency_period', '3', 'default', '

Hostdependency - dependency_period

\r\n

This directive is used to specify the short name of the time period during which this dependency is valid. If this directive is not specified, the dependency is considered to be valid during all times.

\r\n

Parameter name: dependency_period
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(171, 'hostdependency', 'execution_failure_criteria', 'all', 'default', '

Hostdependency - execution failure criteria

\r\n

This directive is used to specify the criteria that determine when the dependent host should not be actively checked. If the master host is in one of the failure states we specify, the dependent host will not be actively checked. Valid options are a combination of one or more of the following (multiple options are separated with commas):
o = fail on an UP state,
d = fail on a DOWN state,
u = fail on an UNREACHABLE state, and
p
= fail on a pending state (e.g. the host has not yet been checked).

\r\n

If you specify n (none) as an option, the execution dependency will never fail and the dependent host will always be actively checked (if other conditions allow for it to be).

\r\n

Example: If you specify u,d in this field, the dependent host will not be actively checked if the master host is in either an UNREACHABLE or DOWN state.

\r\n

Parameter name: execution_failure_criteria
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(172, 'hostdependency', 'notification_failure_criteria', 'all', 'default', '

Hostdependency - notification failure criteria

\r\n

This directive is used to define the criteria that determine when notifications for the dependent host should not be sent out. If the master host is in one of the failure states we specify, notifications for the dependent host will not be sent to contacts. Valid options are a combination of one or more of the following:
o = fail on an UP state,
d = fail on a DOWN state,
u = fail on an UNREACHABLE state, and
p = fail on a pending state (e.g. the host has not yet been checked).

\r\n

If you specify n (none) as an option, the notification dependency will never fail and notifications for the dependent host will always be sent out.

\r\n

Example: If you specify d in this field, the notifications for the dependent host will not be sent out if the master host is in a DOWN state.

\r\n

Parameter name: notification_failure_criteria
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(173, 'hostescalation', 'host', 'all', 'default', '

Hostescalation - host name

\r\n

This directive is used to identify the short name of the host that the escalation should apply to.

\r\n

Parameter name: host_name
Required: yes (no, if a hostgroup name is defined

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(174, 'hostescalation', 'hostgroup', 'all', 'default', '

Hostescalation - hostgroup name

\r\n

This directive is used to identify the short name(s) of the hostgroup(s) that the escalation should apply to. Multiple hostgroups should be separated by commas. If this is used, the escalation will apply to all hosts that are members of the specified hostgroup(s).

\r\n

Parameter name: hostgroup_name
Required: no (yes, if no host ist defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(175, 'hostescalation', 'contact', 'all', 'default', '

Hostescalation - contacts

\r\n

This is a list of the short names of the contacts that should be notified whenever there are problems (or recoveries) with this host. Multiple contacts should be separated by commas. Useful if you want notifications to go to just a few people and don''t want to configure contact groups. You must specify at least one contact or contact group in each host escalation definition.

\r\n

Parameter name: contacts
Required: yes (no, if a contactgroup is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(176, 'hostescalation', 'contactgroup', 'all', 'default', '

Hostescalation - contact groups

\r\n

This directive is used to identify the short name of the contact group that should be notified when the host notification is escalated. Multiple contact groups should be separated by commas. You must specify at least one contact or contact group in each host escalation definition.

\r\n

Parameter name: contact_groups
Required: yes (no, if a contact is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(177, 'hostescalation', 'config_name', 'all', 'default', '

Hostescalation - config name

\r\n

This directive is used to specify a common config name for a hostescalation configration. This is a NagiosQL parameter and it will not be written to the configuration file.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(178, 'hostescalation', 'escalation_period', 'all', 'default', '

Hostescalation - escalation period

\r\n

This directive is used to specify the short name of the time period during which this escalation is valid. If this directive is not specified, the escalation is considered to be valid during all times.

\r\n

Parameter name: escalation_period
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(179, 'hostescalation', 'escalation_options', 'all', 'default', '

Hostescalation - escalation options

\r\n

This directive is used to define the criteria that determine when this host escalation is used. The escalation is used only if the host is in one of the states specified in this directive. If this directive is not specified in a host escalation, the escalation is considered to be valid during all host states. Valid options are a combination of one or more of the following:
r = escalate on an UP (recovery) state,
d = escalate on a DOWN state, and
u
= escalate on an UNREACHABLE state.

\r\n

Example: If you specify d in this field, the escalation will only be used if the host is in a DOWN state.

\r\n

Parameter name: escalation_options
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(180, 'hostescalation', 'first_notification', 'all', 'default', '

Hostescalation - first notification

\r\n

This directive is a number that identifies the first notification for which this escalation is effective. For instance, if you set this value to 3, this escalation will only be used if the host is down or unreachable long enough for a third notification to go out.

\r\n

Parameter name: first_notification
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(181, 'hostescalation', 'last_notification', 'all', 'default', '

Hostescalation - last notification

\r\n

This directive is a number that identifies the last notification for which this escalation is effective. For instance, if you set this value to 5, this escalation will not be used if more than five notifications are sent out for the host. Setting this value to 0 means to keep using this escalation entry forever (no matter how many notifications go out).

\r\n

Parameter name: last_notification
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(182, 'hostescalation', 'notification_intervall', 'all', 'default', '

Hostescalation - notification interval

\r\n

This directive is used to determine the interval at which notifications should be made while this escalation is valid. If you specify a value of 0 for the interval, Nagios will send the first notification when this escalation definition is valid, but will then prevent any more problem notifications from being sent out for the host. Notifications are sent out again until the host recovers.

\r\n

This is useful if you want to stop having notifications sent out after a certain amount of time. Note: If multiple escalation entries for a host overlap for one or more notification ranges, the smallest notification interval from all escalation entries is used.

\r\n

Parameter name: notification_interval
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(183, 'hostextinfo', 'host_name', 'all', 'default', '

Hostextinfo - host name

\r\n

This variable is used to identify the short name of the host which the data is associated with.

\r\n

Parameter name: host_name
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(184, 'hostextinfo', 'icon_image', 'all', 'default', '

Hostextinfo - icon image

\r\n

This variable is used to define the name of a GIF, PNG, or JPG image that should be associated with this host. This image will be displayed in the status and extended information CGIs. The image will look best if it is 40x40 pixels in size.

\r\n

Images for hosts are assumed to be in the logos/ subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).

\r\n

Parameter name: icon_image
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(185, 'hostextinfo', 'notes', 'all', 'default', '

Hostextinfo - notes

\r\n

This directive is used to define an optional string of notes pertaining to the host. If you specify a note here, you will see the it in the extended information CGI (when you are viewing information about the specified host).

\r\n

Parameter name: notes
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(186, 'hostextinfo', 'icon_image_alt_text', 'all', 'default', '

Hostextinfo - icon image alt

\r\n

This variable is used to define an optional string that is used in the ALT tag of the image specified by the <icon_image> argument. The ALT tag is used in the status, extended information and statusmap CGIs.

\r\n

Parameter name: icon_image_alt
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(187, 'hostextinfo', 'notes_url', 'all', 'default', '

Hostextinfo - notes url

\r\n

This variable is used to define an optional URL that can be used to provide more information about the host. If you specify an URL, you will see a link that says "Extra Host Notes" in the extended information CGI (when you are viewing information about the specified host). Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/). This can be very useful if you want to make detailed information on the host, emergency contact methods, etc. available to other support staff.

\r\n

Parameter name: notes_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(188, 'hostextinfo', 'vrml_image', 'all', 'default', '

Hostextinfo - vrml image

\r\n

This variable is used to define the name of a GIF, PNG, or JPG image that should be associated with this host. This image will be used as the texture map for the specified host in the statuswrl CGI. Unlike the image you use for the icon_image variable, this one should probably not have any transparency. If it does, the host object will look a bit wierd.

\r\n

Images for hosts are assumed to be in the logos/ subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).

\r\n

Parameter name: vrml_image
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(189, 'hostextinfo', 'action_url', 'all', 'default', '

Hostextinfo - action url

\r\n

This directive is used to define an optional URL that can be used to provide more actions to be performed on the host. If you specify an URL, you will see a link that says "Extra Host Actions" in the extended information CGI (when you are viewing information about the specified host). Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/).

\r\n

Parameter name: action_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(190, 'hostextinfo', 'status_image', 'all', 'default', '

Hostextinfo - statusmap image

\r\n

This variable is used to define the name of an image that should be associated with this host in the statusmap CGI. You can specify a JPEG, PNG, and GIF image if you want, although I would strongly suggest using a GD2 format image, as other image formats will result in a lot of wasted CPU time when the statusmap image is generated.

\r\n

GD2 images can be created from PNG images by using the pngtogd2 utility supplied with Thomas Boutell''s gd library. The GD2 images should be created in uncompressed format in order to minimize CPU load when the statusmap CGI is generating the network map image.

\r\n

The image will look best if it is 40x40 pixels in size. You can leave these option blank if you are not using the statusmap CGI. Images for hosts are assumed to be in the logos/ subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).

\r\n

Parameter name: statusmap_image
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(191, 'hostextinfo', '2d_coords', 'all', 'default', '

Hostextinfo - 2d coords

\r\n

This variable is used to define coordinates to use when drawing the host in the statusmap CGI. Coordinates should be given in positive integers, as they correspond to physical pixels in the generated image. The origin for drawing (0,0) is in the upper left hand corner of the image and extends in the positive x direction (to the right) along the top of the image and in the positive y direction (down) along the left hand side of the image. For reference, the size of the icons drawn is usually about 40x40 pixels (text takes a little extra space). The coordinates you specify here are for the upper left hand corner of the host icon that is drawn.

\r\n

Note: Don''t worry about what the maximum x and y coordinates that you can use are. The CGI will automatically calculate the maximum dimensions of the image it creates based on the largest x and y coordinates you specify.

\r\n

Parameter name: 2d_coords
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(192, 'hostextinfo', '3d_coords', 'all', 'default', '

Hostextinfo - 3d coords

\r\n

This variable is used to define coordinates to use when drawing the host in the statuswrl CGI. Coordinates can be positive or negative real numbers. The origin for drawing is (0.0,0.0,0.0). For reference, the size of the host cubes drawn is 0.5 units on each side (text takes a little more space). The coordinates you specify here are used as the center of the host cube.

\r\n

Parameter name: 3d_coords
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(193, 'serviceescalation', 'host', 'all', 'default', '

Serviceescalation - host name

\r\n

This directive is used to identify the short name(s) of the host(s) that the service escalation should apply to or is associated with.

\r\n

Parameter name: host_name
Required: yes (no, if a hostgroup name is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(194, 'serviceescalation', 'hostgroup', 'all', 'default', '

Serviceescalation - hostgroup name

\r\n

This directive is used to specify the short name(s) of the hostgroup(s) that the service escalation should apply to or is associated with. Multiple hostgroups should be separated by commas. The hostgroup_name may be used instead of, or in addition to, the host_name directive.

\r\n

Parameter name: hostgroup_name
Required: yes (no, if a host name is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(195, 'serviceescalation', 'contact', 'all', 'default', '

Serviceescalation - contacts

\r\n

This is a list of the short names of the contacts that should be notified whenever there are problems (or recoveries) with this service. Multiple contacts should be separated by commas. Useful if you want notifications to go to just a few people and don''t want to configure contact groups. You must specify at least one contact or contact group in each service escalation definition.

\r\n

Parameter name: contacts
Required: yes (no, if a contact group is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(196, 'serviceescalation', 'contactgroup', 'all', 'default', '

Serviceescalation - contact groups

\r\n

This directive is used to identify the short name of the contact group that should be notified when the service notification is escalated. Multiple contact groups should be separated by commas. You must specify at least one contact or contact group in each service escalation definition.

\r\n

Parameter name: contact_groups
Required: yes (no, if a contact is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(197, 'serviceescalation', 'config_name', 'all', 'default', '

Serviceescalation - config name

\r\n

This directive is used to specify a common config name for a serviceescalation configration. This is a NagiosQL parameter and it will not be written to the configuration file.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(198, 'serviceescalation', 'service', 'all', 'default', '

Serviceescalation - service description

\r\n

This directive is used to identify the description of the service the escalation should apply to.

\r\n

Parameter name: service_description
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(199, 'serviceescalation', 'first_notification', 'all', 'default', '

Serviceescalation - first notification

\r\n

This directive is a number that identifies the first notification for which this escalation is effective. For instance, if you set this value to 3, this escalation will only be used if the service is in a non-OK state long enough for a third notification to go out.

\r\n

Parameter name: first_notification
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(200, 'serviceescalation', 'last_notification', 'all', 'default', '

Serviceescalation - last notification

\r\n

This directive is a number that identifies the last notification for which this escalation is effective. For instance, if you set this value to 5, this escalation will not be used if more than five notifications are sent out for the service. Setting this value to 0 means to keep using this escalation entry forever (no matter how many notifications go out).

\r\n

Parameter name: last_notification
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(201, 'serviceescalation', 'notification_intervall', 'all', 'default', '

Serviceescalation - notification interval

\r\n

This directive is used to determine the interval at which notifications should be made while this escalation is valid. If you specify a value of 0 for the interval, Nagios will send the first notification when this escalation definition is valid, but will then prevent any more problem notifications from being sent out for the host. Notifications are sent out again until the host recovers.

\r\n

This is useful if you want to stop having notifications sent out after a certain amount of time. Note: If multiple escalation entries for a host overlap for one or more notification ranges, the smallest notification interval from all escalation entries is used.

\r\n

Parameter name: notification_interval
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(202, 'serviceescalation', 'escalation_period', 'all', 'default', '

Serviceescalation - escalation period

\r\n

This directive is used to specify the short name of the time period during which this escalation is valid. If this directive is not specified, the escalation is considered to be valid during all times.

\r\n

Parameter name: escalation_period
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(203, 'serviceescalation', 'escalation_options', 'all', 'default', '

Serviceescalation - escalation options

\r\n

This directive is used to define the criteria that determine when this service escalation is used. The escalation is used only if the service is in one of the states specified in this directive. If this directive is not specified in a service escalation, the escalation is considered to be valid during all service states. Valid options are a combination of one or more of the following:
r
= escalate on an OK (recovery) state,
w = escalate on a WARNING state,
u
= escalate on an UNKNOWN state, and
c = escalate on a CRITICAL state.

\r\n

Example: If you specify w in this field, the escalation will only be used if the service is in a WARNING state.

\r\n

Parameter name: escalation_options
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(204, 'servicedependency', 'dependent_host', 'all', 'default', '

Servicedependency - dependent host

\r\n

This directive is used to identify the short name(s) of the host(s) that the dependent service "runs" on or is associated with. Multiple hosts should be separated by commas. Leaving this directive blank can be used to create "same host" dependencies.

\r\n

Parameter name: dependent_host
Required: yes (no, if a dependent hostgroup is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(205, 'servicedependency', 'host', 'all', 'default', '

Servicedependency - host name

\r\n

This directive is used to identify the short name(s) of the host(s) that the service that is being depended upon (also referred to as the master service) "runs" on or is associated with. Multiple hosts should be separated by commas.

\r\n

Parameter name: host_name
Required: yes (no, if a hostgroup is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(206, 'servicedependency', 'dependent_hostgroup', 'all', 'default', '

Servicedependency - dependent hostgroup

\r\n

This directive is used to specify the short name(s) of the hostgroup(s) that the dependent service "runs" on or is associated with. Multiple hostgroups should be separated by commas. The dependent_hostgroup may be used instead of, or in addition to, the dependent_host directive.

\r\n

Parameter name: dependent_hostgroup
Required: yes (no, if a dependent host is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(207, 'servicedependency', 'hostgroup', 'all', 'default', '

Servicedependency - hostgroup name

\r\n

This directive is used to identify the short name(s) of the hostgroup(s) that the service that is being depended upon (also referred to as the master service) "runs" on or is associated with. Multiple hostgroups should be separated by commas. The hostgroup_name may be used instead of, or in addition to, the host_name directive.

\r\n

Parameter name: hostgroup_name
Required: yes (no, if a host is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(208, 'servicedependency', 'dependent_services', 'all', 'default', '

Servicedependency - dependent service description

\r\n

This directive is used to identify the description of the dependent service.

\r\n

Parameter name: dependent_service_description
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(209, 'servicedependency', 'services', 'all', 'default', '

Servicedependency - service description

\r\n

This directive is used to identify the description of the service that is being depended upon (also referred to as the master service).

\r\n

Parameter name: service_description
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(210, 'servicedependency', 'config_name', 'all', 'default', '

Servicedependency - config name

\r\n

This directive is used to specify a common config name for a servicedependency configration. This is a NagiosQL parameter and it will not be written to the configuration file.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(211, 'servicedependency', 'inherit_parents', 'all', 'default', '

Servicedependency - inherits parent

\r\n

This directive indicates whether or not the dependency inherits dependencies of the service that is being depended upon (also referred to as the master service). In other words, if the master service is dependent upon other services and any one of those dependencies fail, this dependency will also fail.

\r\n

Parameter name: inherits_parent
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(212, 'servicedependency', 'dependency_period', 'all', 'default', '

Servicedependency - dependency period

\r\n

This directive is used to specify the short name of the time period during which this dependency is valid. If this directive is not specified, the dependency is considered to be valid during all times.

\r\n

Parameter name: dependency_period
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(213, 'servicedependency', 'execution_failure_criteria', 'all', 'default', '

Servicedependency - execution failure criteria

\r\n

This directive is used to specify the criteria that determine when the dependent service should not be actively checked. If the master service is in one of the failure states we specify, the dependent service will not be actively checked. Valid options are a combination of one or more of the following (multiple options are separated with commas):
o = fail on an OK state,
w = fail on a WARNING state,
u
= fail on an UNKNOWN state,
c = fail on a CRITICAL state, and
p = fail on a pending state (e.g. the service has not yet been checked).
If you specify n (none) as an option, the execution dependency will never fail and checks of the dependent service will always be actively checked (if other conditions allow for it to be).

\r\n

Example: If you specify o,c,u in this field, the dependent service will not be actively checked if the master service is in either an OK, a CRITICAL, or an UNKNOWN state.

\r\n

Parameter name: execution_failure_criteria
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(214, 'servicedependency', 'notification_failure_criteria', 'all', 'default', '

Servicedependency - notification failure criteria

\r\n

This directive is used to define the criteria that determine when notifications for the dependent service should not be sent out. If the master service is in one of the failure states we specify, notifications for the dependent service will not be sent to contacts. Valid options are a combination of one or more of the following:
o
= fail on an OK state,
w = fail on a WARNING state,
u
= fail on an UNKNOWN state,
c = fail on a CRITICAL state, and
p = fail on a pending state (e.g. the service has not yet been checked).
If you specify n (none) as an option, the notification dependency will never fail and notifications for the dependent service will always be sent out.

\r\n

Example: If you specify w in this field, the notifications for the dependent service will not be sent out if the master service is in a WARNING state.

\r\n

Parameter name: notification_failure_criteria
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(216, 'serviceextinfo', 'host_name', 'all', 'default', '

Serviceextinfo - host name

\r\n

This directive is used to identify the short name of the host that the service is associated with.

\r\n

Parameter name: host_name
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(217, 'serviceextinfo', 'icon_image', 'all', 'default', '

Serviceextinfo - icon image

\r\n

This variable is used to define the name of a GIF, PNG, or JPG image that should be associated with this host. This image will be displayed in the status and extended information CGIs.

\r\n

The image will look best if it is 40x40 pixels in size. Images for hosts are assumed to be in the logos/ subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).

\r\n

Parameter name: icon_image
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(218, 'serviceextinfo', 'service_description', 'all', 'default', '

Serviceextinfo - service description

\r\n

This directive is description of the service which the data is associated with.

\r\n

Parameter name: service_description
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(219, 'serviceextinfo', 'notes', 'all', 'default', '

Serviceextinfo - notes

\r\n

This directive is used to define an optional string of notes pertaining to the service. If you specify a note here, you will see the it in the extended information CGI (when you are viewing information about the specified service).

\r\n

Parameter name: notes
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(220, 'serviceextinfo', 'action_url', 'all', 'default', '

Serviceextinfo - action url

\r\n

This directive is used to define an optional URL that can be used to provide more actions to be performed on the service. If you specify an URL, you will see a link that says "Extra Service Actions" in the extended information CGI (when you are viewing information about the specified service). Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/).

\r\n

Parameter name: action_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(221, 'serviceextinfo', 'notes_url', 'all', 'default', '

Serviceextinfo - notes url

\r\n

This directive is used to define an optional URL that can be used to provide more information about the service. If you specify an URL, you will see a link that says "Extra Service Notes" in the extended information CGI (when you are viewing information about the specified service). Any valid URL can be used.

\r\n

If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. /cgi-bin/nagios/). This can be very useful if you want to make detailed information on the service, emergency contact methods, etc. available to other support staff.

\r\n

Parameter name: notes_url
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(222, 'serviceextinfo', 'icon_image_alt', 'all', 'default', '

Serviceextinfo - icon image alt

\r\n

This variable is used to define an optional string that is used in the ALT tag of the image specified by the <icon_image> argument. The ALT tag is used in the status, extended information and statusmap CGIs.

\r\n

Parameter name: icon_image_alt
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(223, 'host', 'services', 'all', 'default', '

Host - service settings

\r\n

This box can be used to allocate already existing services to a host. 

\r\n

This is an internal function of NagiosQL.

\r\n

Note: To activate the changes, the corresponding service definitions have to be rewritten!

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(224, 'timeperiod', 'name', 'all', 'default', '

Timeperiod - name

\r\n

Its just a "template" name that can be referenced in other object definitions so they can inherit the objects properties/variables. Template names must be unique amongst objects of the same type, so you can''t have two or more time definitions that have "mytemplate" as their template name.

\r\n

Parameter name: name
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(225, 'timeperiod', 'include', '3', 'default', '

Timeperiod - include

\r\n

This directive is used to specify the short names (template names) of other timeperiod definitions whose time ranges should be included to this timeperiod. Multiple timeperiod names should be separated with a comma.

\r\n

Parameter name: use
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(226, 'user', 'adminenable', 'all', 'default', '

User - enable group administration

\r\n

If this option is selected, the specified user is able to modify the access group for every object definition. This should be restricted only to administrators; otherwise a user might be able to lock himself out.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(227, 'group', 'userrights', 'all', 'default', '

Group - user rights

\r\n

Define the object access rights for a user.

\r\n

READ = The user can see the objects belong to this group
WRITE = The user can modify the objects belong to this group
LINK = The user can use the objects belong to this group to link them in other objects*

* Example: If a time object belongs to this group - the user can add (link) this time object to his contact objects.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(228, 'domain', 'conffile', 'all', 'default', '

Absolute path to your Nagios config file.

Examples:
/etc/nagios/nagios.cfg
/usr/local/nagios/etc/nagios.cfg

This is used to verify your Nagios configuration directly from NagiosQL.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(229, 'domain', 'enable_common', 'all', 'default', '

This option is used to enable or disable the global common domain functionality.

\r\n

If this option is enabled, all objects from the global common domain will be added to this domains configuration files. The global common domain can be used to define objects like timeperiods or contacts that are used in all domains the same.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(230, 'domain', 'utf8_decode', 'all', 'default', '

This is an experimental option!

\r\n

If this option is enabled, UTF8 data from database will be translated to ISO in configuration file. So, the configuration files will be in ISO mode. This could be helpful, if nagios does not understand the UTF8 data from NagiosQL.

\r\n

Tested only with western european configurations!

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(231, 'domain', 'picturedir', 'all', 'default', '

Relative path to your nagios icon images.

Example:
/my/own/images/

\r\n

This path is based on your nagios standard image path. Images are assumed to be in the logos/ subdirectory in your HTML images directory (i.e. /usr/local/nagios/share/images/logos).

\r\n

So in the example above, the images are located in:

\r\n

/usr/local/nagios/share/images/logos/my/own/images/

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(232, 'common', 'accessgroup', 'all', 'default', '

Access group

\r\n

Select an access group name to restrict this object to the group members.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(233, 'common', 'registered', 'all', 'default', '

Register

\r\n

This variable is used to indicate whether or not the object definition should be "registered" with Nagios. By default, all object definitions are registered. If you are using a partial object definition as a template, you would want to prevent it from being registered (an example of this is provided later). Values are as follows: 0 = do NOT register object definition, 1 = register object definition (this is the default). This variable is NOT inherited; every (partial) object definition used as a template must explicitly set the register directive to be 0. This prevents the need to override an inherited register directive with a value of 1 for every object that should be registered.

\r\n

Parameter name: register
Required: yes

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(234, 'servicedependency', 'dependent_servicegroup_name', 'all', 'default', '

Servicedependency - dependent servicegroup name

\r\n

This directive is used to identify the name of the dependent servicegroup.

\r\n

Parameter name: dependent_servicegroup_name
Required: yes (no, if a dependent service is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(235, 'servicedependency', 'servicegroup_name', 'all', 'default', '

Servicedependency - servicegroup name

\r\n

This directive is used to identify the name of the servicegroup that is being depended upon (also referred to as the master service).

\r\n

Parameter name: servicegroup_name
Required: yes (no, if a service is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(236, 'serviceescalation', 'servicegroup', 'all', 'default', '

Serviceescalation - servicegroup name

\r\n

This directive is used to identify the name of the servicegroup the escalation should apply to.

\r\n

Parameter name: servicegroup_name
Required: yes (no, if a service is defined)

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(237, 'user', 'language', 'all', 'default', '

User - language

\r\n

Defines a default UI language for the user.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(238, 'user', 'standarddomain', 'all', 'default', '

User - standard domain

\r\n

Defines a standard domain for the user. After the user has logged in, the defined domain is pre-selected.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(239, 'domain', 'targets', 'all', 'default', '

Select a configuration domain which is assigned to this data domain

\r\n

The settings where to store the configuration files are defined in a configuration domain. Select here the desired target for your configuration files.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(240, 'domain', 'ssh_host_key', 'all', 'default', 'Absolute path to the ssh key directory for the defined ssh user.

Examples:
/etc/nagiosql/ssh/
/usr/local/nagios/etc/.ssh/

This directory includes the key file (id_rsa) for the user to connect to the remote system. Note, that the file name is set to id_rsa!'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(241, 'contact', 'minimum_importance', 'all', 'default', '

Contact - minimum importance

\r\n

This directive is used as the value that the host or service importance value must equal before notification is sent to this contact. The importance values are intended to represent the value of a host or service to an organization. For example, you could set this value and the importance value of a host such that a system administrator would be notified when a development server goes down, but the CIO would only be notified when the company\'s production ecommerce database server was down. The minimum_importance value defaults to zero.

\r\n

In Nagios Core 4.0.0 to 4.0.3 this was known as minimum_value but has been replaced with minimum_importance.

\r\n

Parameter name: minimum_importance
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(242, 'domain', 'ftps_option', 'all', 'default', 'Use encrypted FTP (FTPS) to connect to the remote server. '); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(243, 'domain', 'cgifile', 'all', 'default', '

Absolute path to your Nagios CGI config file.

Examples:
/etc/nagios/cgi.cfg
/usr/local/nagios/etc/cgi.cfg

This is used to edit Nagios website options directly from NagiosQL.

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(244, 'domain', 'resourcefile', 'all', 'default', '

Absolute path to your Nagios resource config file.

Examples:
/etc/nagios/resource.cfg
/usr/local/nagios/etc/resource.cfg

This file is used to verify your configuration in Nagios 4.x. Be sure this file is readably by your webserver\'s user!

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(245, 'host', 'importance', 'all', 'default', '

Host - importance

This directive is used to represent the importance of the host to your organization. The importance is used when determining whether to send notifications to a contact. If the host\'s importance value plus the importance values of all of the host\'s services is greater than or equal to the contact\'s minimum_importance, the contact will be notified. For example, you could set this value and the minimum_importance of contacts such that a system administrator would be notified when a development server goes down, but the CIO would only be notified when the company\'s production ecommerce database server was down. The importance could also be used as a sort criteria when generating reports or for calculating a good system administrator\'s bonus. The importance value defaults to zero. In Nagios Core 4.0.0 to 4.0.3 this was known as hourly_value but has been replaced with importance.

Parameter name: importance
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(246, 'service', 'importance', 'all', 'default', '

Service - importance

\r\n

This directive is used to represent the importance of the service to your organization. The importance is used when determining whether to send notifications to a contact. If the service\'s importance value is greater than or equal to the contact\'s minimum_importance, the contact will be notified. For example, you could set this value and the minimum_importance of contacts such that a system administrator would be notified of a disk full event on a development server, but the CIO would only be notified when the company\'s production ecommerce database was down. The importance could also be used as a sort criteria when generating reports or for calculating a good system administrator\'s bonus. The importance value defaults to zero. In Nagios Core 4.0.0 to 4.0.3 this was known as hourly_value but has been replaced with importance.

\r\n

Parameter name: importance
Required: no

'); +INSERT INTO `tbl_info` (`id`, `key1`, `key2`, `version`, `language`, `infotext`) VALUES(247, 'service', 'parents', 'all', 'default', '

Service - parents

\r\n

This directive is used to define a comma-delimited list of short names of the \"parent\" services for this particular service. Parent services are typically other services that need to be available in order for a check of this service to occur. For example, if a service checks the status of a disk using SSH, the disk check service would have the SSH service as a parent. If the service has no parent services, simply omit the \"parents\" directive. More complex service dependencies may be specified with service dependency objects.

\r\n

Parameter name: parents
Required: no

'); + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_language` +-- + +CREATE TABLE IF NOT EXISTS `tbl_language` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `language` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `locale` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL, + `last_modified` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_language` +-- + +INSERT INTO `tbl_language` (`id`, `language`, `locale`, `active`, `last_modified`) VALUES(1, 'English', 'en_GB', '1', NOW()); +INSERT INTO `tbl_language` (`id`, `language`, `locale`, `active`, `last_modified`) VALUES(2, 'German', 'de_DE', '1', NOW()); +INSERT INTO `tbl_language` (`id`, `language`, `locale`, `active`, `last_modified`) VALUES(3, 'Chinese (Simplified)', 'zh_CN', '1', NOW()); +INSERT INTO `tbl_language` (`id`, `language`, `locale`, `active`, `last_modified`) VALUES(5, 'Italian', 'it_IT', '1', NOW()); +INSERT INTO `tbl_language` (`id`, `language`, `locale`, `active`, `last_modified`) VALUES(6, 'French', 'fr_FR', '1', NOW()); +INSERT INTO `tbl_language` (`id`, `language`, `locale`, `active`, `last_modified`) VALUES(7, 'Russian', 'ru_RU', '1', NOW()); +INSERT INTO `tbl_language` (`id`, `language`, `locale`, `active`, `last_modified`) VALUES(8, 'Spanish', 'es_ES', '1', NOW()); +INSERT INTO `tbl_language` (`id`, `language`, `locale`, `active`, `last_modified`) VALUES(9, 'Portuguese (Brazilian)', 'pt_BR', '1', NOW()); +INSERT INTO `tbl_language` (`id`, `language`, `locale`, `active`, `last_modified`) VALUES(11, 'Dutch', 'nl_NL', '1', NOW()); +INSERT INTO `tbl_language` (`id`, `language`, `locale`, `active`, `last_modified`) VALUES(13, 'Danish', 'da_DK', '1', NOW()); + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContactgroupToContact` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContactgroupToContact` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContactgroupToContact` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContactgroupToContactgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContactgroupToContactgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContactgroupToContactgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContacttemplateToCommandHost` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContacttemplateToCommandHost` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContacttemplateToCommandHost` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContacttemplateToCommandService` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContacttemplateToCommandService` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContacttemplateToCommandService` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContacttemplateToContactgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContacttemplateToContactgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContacttemplateToContactgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContacttemplateToContacttemplate` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContacttemplateToContacttemplate` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `idSort` int(11) NOT NULL, + `idTable` tinyint(4) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`,`idTable`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContacttemplateToContacttemplate` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContacttemplateToVariabledefinition` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContacttemplateToVariabledefinition` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContacttemplateToVariabledefinition` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContactToCommandHost` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContactToCommandHost` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContactToCommandHost` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContactToCommandService` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContactToCommandService` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContactToCommandService` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContactToContactgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContactToContactgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContactToContactgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContactToContacttemplate` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContactToContacttemplate` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `idSort` int(11) NOT NULL, + `idTable` tinyint(4) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`,`idTable`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContactToContacttemplate` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkContactToVariabledefinition` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkContactToVariabledefinition` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkContactToVariabledefinition` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkGroupToUser` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkGroupToUser` ( + `idMaster` int(10) unsigned NOT NULL, + `idSlave` int(10) unsigned NOT NULL, + `read` enum('0','1') NOT NULL DEFAULT '1', + `write` enum('0','1') NOT NULL DEFAULT '1', + `link` enum('0','1') NOT NULL DEFAULT '1', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkGroupToUser` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostdependencyToHostgroup_DH` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostdependencyToHostgroup_DH` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostdependencyToHostgroup_DH` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostdependencyToHostgroup_H` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostdependencyToHostgroup_H` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostdependencyToHostgroup_H` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostdependencyToHost_DH` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostdependencyToHost_DH` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostdependencyToHost_DH` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostdependencyToHost_H` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostdependencyToHost_H` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostdependencyToHost_H` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostescalationToContact` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostescalationToContact` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostescalationToContact` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostescalationToContactgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostescalationToContactgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostescalationToContactgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostescalationToHost` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostescalationToHost` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostescalationToHost` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostescalationToHostgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostescalationToHostgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostescalationToHostgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostgroupToHost` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostgroupToHost` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostgroupToHost` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostgroupToHostgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostgroupToHostgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostgroupToHostgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHosttemplateToContact` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHosttemplateToContact` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHosttemplateToContact` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHosttemplateToContactgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHosttemplateToContactgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHosttemplateToContactgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHosttemplateToHost` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHosttemplateToHost` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHosttemplateToHost` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHosttemplateToHostgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHosttemplateToHostgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHosttemplateToHostgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHosttemplateToHosttemplate` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHosttemplateToHosttemplate` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `idSort` int(11) NOT NULL, + `idTable` tinyint(4) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`,`idTable`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHosttemplateToHosttemplate` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHosttemplateToVariabledefinition` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHosttemplateToVariabledefinition` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHosttemplateToVariabledefinition` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostToContact` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostToContact` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostToContact` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostToContactgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostToContactgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostToContactgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostToHost` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostToHost` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostToHost` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostToHostgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostToHostgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostToHostgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostToHosttemplate` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostToHosttemplate` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `idSort` int(11) NOT NULL, + `idTable` tinyint(4) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`,`idTable`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostToHosttemplate` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkHostToVariabledefinition` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkHostToVariabledefinition` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkHostToVariabledefinition` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicedependencyToHostgroup_DH` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicedependencyToHostgroup_DH` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicedependencyToHostgroup_DH` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicedependencyToHostgroup_H` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicedependencyToHostgroup_H` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicedependencyToHostgroup_H` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicedependencyToHost_DH` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicedependencyToHost_DH` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicedependencyToHost_DH` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicedependencyToHost_H` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicedependencyToHost_H` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicedependencyToHost_H` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicedependencyToService_DS` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicedependencyToService_DS` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `strSlave` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicedependencyToService_DS` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicedependencyToService_S` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicedependencyToService_S` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `strSlave` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicedependencyToService_S` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicedependencyToServicegroup_DS` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicedependencyToServicegroup_DS` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicedependencyToServicegroup_DS` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicedependencyToServicegroup_S` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicedependencyToServicegroup_S` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicedependencyToServicegroup_S` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceescalationToContact` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceescalationToContact` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceescalationToContact` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceescalationToContactgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceescalationToContactgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceescalationToContactgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceescalationToHost` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceescalationToHost` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceescalationToHost` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceescalationToHostgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceescalationToHostgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceescalationToHostgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceescalationToService` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceescalationToService` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `strSlave` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceescalationToService` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceescalationToServicegroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceescalationToServicegroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceescalationToService` +-- + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicegroupToService` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicegroupToService` ( + `idMaster` int(11) NOT NULL, + `idSlaveH` int(11) NOT NULL, + `idSlaveHG` int(11) NOT NULL, + `idSlaveS` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlaveH`,`idSlaveHG`,`idSlaveS`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicegroupToService` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicegroupToServicegroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicegroupToServicegroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicegroupToServicegroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicetemplateToContact` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicetemplateToContact` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicetemplateToContact` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicetemplateToContactgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicetemplateToContactgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicetemplateToContactgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicetemplateToHost` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicetemplateToHost` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicetemplateToHost` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicetemplateToHostgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicetemplateToHostgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicetemplateToHostgroup` +-- + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicetemplateToService` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicetemplateToService` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `idHost` int(11) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicetemplateToService` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicetemplateToServicegroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicetemplateToServicegroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicetemplateToServicegroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicetemplateToServicetemplate` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicetemplateToServicetemplate` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `idSort` int(11) NOT NULL, + `idTable` tinyint(4) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`,`idTable`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicetemplateToServicetemplate` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServicetemplateToVariabledefinition` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServicetemplateToVariabledefinition` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServicetemplateToVariabledefinition` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceToContact` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceToContact` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceToContact` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceToContactgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceToContactgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceToContactgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceToHost` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceToHost` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceToHost` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceToHostgroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceToHostgroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceToHostgroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceToService` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceToService` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `idHost` int(11) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceToService` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceToServicegroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceToServicegroup` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceToServicegroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceToServicetemplate` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceToServicetemplate` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `idSort` int(11) NOT NULL, + `idTable` tinyint(4) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`,`idTable`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceToServicetemplate` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkServiceToVariabledefinition` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkServiceToVariabledefinition` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkServiceToVariabledefinition` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkTimeperiodToTimeperiod` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkTimeperiodToTimeperiod` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkTimeperiodToTimeperiod` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_lnkTimeperiodToTimeperiodUse` +-- + +CREATE TABLE IF NOT EXISTS `tbl_lnkTimeperiodToTimeperiodUse` ( + `idMaster` int(11) NOT NULL, + `idSlave` int(11) NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`idMaster`,`idSlave`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Datasets for table `tbl_lnkTimeperiodToTimeperiodUse` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_logbook` +-- + +CREATE TABLE IF NOT EXISTS `tbl_logbook` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `time` datetime NOT NULL, + `user` varchar(255) NOT NULL, + `ipadress` varchar(255) NOT NULL, + `domain` varchar(255) NOT NULL, + `entry` tinytext NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_logbook` +-- + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_menu` +-- + +CREATE TABLE IF NOT EXISTS `tbl_menu` ( + `mnuId` int(10) unsigned NOT NULL AUTO_INCREMENT, + `mnuTopId` int(10) unsigned NOT NULL, + `mnuGrpId` int(10) unsigned NOT NULL DEFAULT '0', + `mnuCntId` int(10) unsigned NOT NULL, + `mnuName` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `mnuLink` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `mnuActive` tinyint(3) unsigned NOT NULL DEFAULT '1', + `mnuOrderId` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`mnuId`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_menu` +-- + +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(1, 0, 0, 1, 'Main page', 'admin.php', 1, 1); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(2, 0, 0, 1, 'Supervision', 'admin/monitoring.php', 1, 2); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(3, 0, 0, 1, 'Alarming', 'admin/alarming.php', 1, 3); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(4, 0, 0, 1, 'Commands', 'admin/commands.php', 1, 4); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(5, 0, 0, 1, 'Specialties', 'admin/specials.php', 1, 5); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(6, 0, 0, 1, 'Tools', 'admin/tools.php', 1, 6); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(7, 0, 0, 1, 'Administration', 'admin/administration.php', 1, 7); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(8, 2, 0, 1, 'Host', 'admin/hosts.php', 1, 1); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(9, 2, 0, 1, 'Services', 'admin/services.php', 1, 2); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(10, 2, 0, 1, 'Host groups', 'admin/hostgroups.php', 1, 3); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(11, 2, 0, 1, 'Service groups', 'admin/servicegroups.php', 1, 4); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(12, 2, 0, 1, 'Host templates', 'admin/hosttemplates.php', 1, 5); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(13, 2, 0, 1, 'Service templates', 'admin/servicetemplates.php', 1, 6); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(14, 3, 0, 1, 'Contact data', 'admin/contacts.php', 1, 1); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(15, 3, 0, 1, 'Contact groups', 'admin/contactgroups.php', 1, 2); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(16, 3, 0, 1, 'Time periods', 'admin/timeperiods.php', 1, 3); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(17, 3, 0, 1, 'Contact templates', 'admin/contacttemplates.php', 1, 4); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(18, 4, 0, 1, 'Definitions', 'admin/checkcommands.php', 1, 1); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(19, 5, 0, 1, 'Host dependency', 'admin/hostdependencies.php', 1, 1); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(20, 5, 0, 1, 'Host escalation', 'admin/hostescalations.php', 1, 2); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(21, 5, 0, 1, 'Extended Host', 'admin/hostextinfo.php', 1, 3); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(22, 5, 0, 1, 'Service dependency', 'admin/servicedependencies.php', 1, 4); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(23, 5, 0, 1, 'Service escalation', 'admin/serviceescalations.php', 1, 5); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(24, 5, 0, 1, 'Extended Service', 'admin/serviceextinfo.php', 1, 6); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(25, 6, 0, 1, 'Data import', 'admin/import.php', 1, 1); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(26, 6, 0, 1, 'Delete backup files', 'admin/delbackup.php', 1, 2); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(27, 6, 0, 1, 'Delete config files', 'admin/delconfig.php', 1, 3); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(28, 6, 0, 1, 'Nagios config', 'admin/nagioscfg.php', 1, 4); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(29, 6, 0, 1, 'CGI config', 'admin/cgicfg.php', 1, 5); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(30, 6, 0, 1, 'Nagios control', 'admin/verify.php', 1, 6); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(31, 7, 0, 1, 'New password', 'admin/password.php', 1, 1); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(32, 7, 0, 1, 'User admin', 'admin/user.php', 1, 2); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(33, 7, 0, 1, 'Group admin', 'admin/group.php', 1, 3); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(34, 7, 0, 1, 'Menu access', 'admin/menuaccess.php', 1, 4); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(35, 7, 0, 1, 'Data domains', 'admin/datadomain.php', 1, 5); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(36, 7, 0, 1, 'Config targets', 'admin/configtargets.php', 1, 6); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(37, 7, 0, 1, 'Logbook', 'admin/logbook.php', 1, 7); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(38, 7, 0, 1, 'Settings', 'admin/settings.php', 1, 8); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(39, 7, 0, 1, 'Help editor', 'admin/helpedit.php', 1, 9); +INSERT INTO `tbl_menu` (`mnuId`, `mnuTopId`, `mnuGrpId`, `mnuCntId`, `mnuName`, `mnuLink`, `mnuActive`, `mnuOrderId`) VALUES(40, 7, 0, 1, 'Support', 'admin/support.php', 1, 10); + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_relationinformation` +-- + +CREATE TABLE IF NOT EXISTS `tbl_relationinformation` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `master` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `tableName1` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `tableName2` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `fieldName` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `linkTable` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `target1` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `target2` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `targetKey` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `fullRelation` tinyint(3) unsigned NOT NULL DEFAULT '0', + `flags` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `type` tinyint(3) unsigned NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_relationinformation` +-- + +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(1, 'tbl_timeperiod', 'tbl_timeperiod', '', 'exclude', 'tbl_lnkTimeperiodToTimeperiod', 'timeperiod_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(2, 'tbl_contact', 'tbl_command', '', 'host_notification_commands', 'tbl_lnkContactToCommandHost', 'command_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(3, 'tbl_contact', 'tbl_command', '', 'service_notification_commands', 'tbl_lnkContactToCommandService', 'command_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(4, 'tbl_contact', 'tbl_contactgroup', '', 'contactgroups', 'tbl_lnkContactToContactgroup', 'contactgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(5, 'tbl_contact', 'tbl_timeperiod', '', 'host_notification_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(6, 'tbl_contact', 'tbl_timeperiod', '', 'service_notification_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(7, 'tbl_contact', 'tbl_contacttemplate', 'tbl_contact', 'use_template', 'tbl_lnkContactToContacttemplate', 'template_name', 'name', '', 0, '', 3); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(8, 'tbl_contact', 'tbl_variabledefinition', '', 'use_variables', 'tbl_lnkContactToVariabledefinition', 'name', '', '', 0, '', 4); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(9, 'tbl_contacttemplate', 'tbl_command', '', 'host_notification_commands', 'tbl_lnkContacttemplateToCommandHost', 'command_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(10, 'tbl_contacttemplate', 'tbl_command', '', 'service_notification_commands', 'tbl_lnkContacttemplateToCommandService', 'command_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(11, 'tbl_contacttemplate', 'tbl_contactgroup', '', 'contactgroups', 'tbl_lnkContacttemplateToContactgroup', 'contactgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(12, 'tbl_contacttemplate', 'tbl_timeperiod', '', 'host_notification_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(13, 'tbl_contacttemplate', 'tbl_timeperiod', '', 'service_notification_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(14, 'tbl_contacttemplate', 'tbl_contacttemplate', 'tbl_contact', 'use_template', 'tbl_lnkContacttemplateToContacttemplate', 'template_name', 'name', '', 0, '', 3); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(15, 'tbl_contacttemplate', 'tbl_variabledefinition', '', 'use_variables', 'tbl_lnkContacttemplateToVariabledefinition', 'name', '', '', 0, '', 4); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(16, 'tbl_contactgroup', 'tbl_contact', '', 'members', 'tbl_lnkContactgroupToContact', 'contact_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(17, 'tbl_contactgroup', 'tbl_contactgroup', '', 'contactgroup_members', 'tbl_lnkContactgroupToContactgroup', 'contactgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(18, 'tbl_hosttemplate', 'tbl_host', '', 'parents', 'tbl_lnkHosttemplateToHost', 'host_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(19, 'tbl_hosttemplate', 'tbl_hostgroup', '', 'hostgroups', 'tbl_lnkHosttemplateToHostgroup', 'hostgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(20, 'tbl_hosttemplate', 'tbl_contactgroup', '', 'contact_groups', 'tbl_lnkHosttemplateToContactgroup', 'contactgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(21, 'tbl_hosttemplate', 'tbl_contact', '', 'contacts', 'tbl_lnkHosttemplateToContact', 'contact_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(22, 'tbl_hosttemplate', 'tbl_timeperiod', '', 'check_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(23, 'tbl_hosttemplate', 'tbl_command', '', 'check_command', '', 'command_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(24, 'tbl_hosttemplate', 'tbl_timeperiod', '', 'notification_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(25, 'tbl_hosttemplate', 'tbl_command', '', 'event_handler', '', 'command_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(26, 'tbl_hosttemplate', 'tbl_hosttemplate', 'tbl_host', 'use_template', 'tbl_lnkHosttemplateToHosttemplate', 'template_name', 'name', '', 0, '', 3); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(27, 'tbl_hosttemplate', 'tbl_variabledefinition', '', 'use_variables', 'tbl_lnkHosttemplateToVariabledefinition', 'name', '', '', 0, '', 4); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(28, 'tbl_host', 'tbl_host', '', 'parents', 'tbl_lnkHostToHost', 'host_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(29, 'tbl_host', 'tbl_hostgroup', '', 'hostgroups', 'tbl_lnkHostToHostgroup', 'hostgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(30, 'tbl_host', 'tbl_contactgroup', '', 'contact_groups', 'tbl_lnkHostToContactgroup', 'contactgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(31, 'tbl_host', 'tbl_contact', '', 'contacts', 'tbl_lnkHostToContact', 'contact_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(32, 'tbl_host', 'tbl_timeperiod', '', 'check_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(33, 'tbl_host', 'tbl_command', '', 'check_command', '', 'command_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(34, 'tbl_host', 'tbl_timeperiod', '', 'notification_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(35, 'tbl_host', 'tbl_command', '', 'event_handler', '', 'command_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(36, 'tbl_host', 'tbl_hosttemplate', 'tbl_host', 'use_template', 'tbl_lnkHostToHosttemplate', 'template_name', 'name', '', 0, '', 3); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(37, 'tbl_host', 'tbl_variabledefinition', '', 'use_variables', 'tbl_lnkHostToVariabledefinition', 'name', '', '', 0, '', 4); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(38, 'tbl_hostgroup', 'tbl_host', '', 'members', 'tbl_lnkHostgroupToHost', 'host_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(39, 'tbl_hostgroup', 'tbl_hostgroup', '', 'hostgroup_members', 'tbl_lnkHostgroupToHostgroup', 'hostgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(40, 'tbl_servicetemplate', 'tbl_host', '', 'host_name', 'tbl_lnkServicetemplateToHost', 'host_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(41, 'tbl_servicetemplate', 'tbl_hostgroup', '', 'hostgroup_name', 'tbl_lnkServicetemplateToHostgroup', 'hostgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(42, 'tbl_servicetemplate', 'tbl_servicegroup', '', 'servicegroups', 'tbl_lnkServicetemplateToServicegroup', 'servicegroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(43, 'tbl_servicetemplate', 'tbl_contactgroup', '', 'contact_groups', 'tbl_lnkServicetemplateToContactgroup', 'contactgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(44, 'tbl_servicetemplate', 'tbl_contact', '', 'contacts', 'tbl_lnkServicetemplateToContact', 'contact_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(45, 'tbl_servicetemplate', 'tbl_timeperiod', '', 'check_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(46, 'tbl_servicetemplate', 'tbl_command', '', 'check_command', '', 'command_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(47, 'tbl_servicetemplate', 'tbl_timeperiod', '', 'notification_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(48, 'tbl_servicetemplate', 'tbl_command', '', 'event_handler', '', 'command_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(49, 'tbl_servicetemplate', 'tbl_servicetemplate', 'tbl_service', 'use_template', 'tbl_lnkServicetemplateToServicetemplate', 'template_name', 'name', '', 0, '', 3); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(50, 'tbl_servicetemplate', 'tbl_variabledefinition', '', 'use_variables', 'tbl_lnkServicetemplateToVariabledefinition', 'name', '', '', 0, '', 4); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(51, 'tbl_service', 'tbl_host', '', 'host_name', 'tbl_lnkServiceToHost', 'host_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(52, 'tbl_service', 'tbl_hostgroup', '', 'hostgroup_name', 'tbl_lnkServiceToHostgroup', 'hostgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(53, 'tbl_service', 'tbl_servicegroup', '', 'servicegroups', 'tbl_lnkServiceToServicegroup', 'servicegroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(54, 'tbl_service', 'tbl_contactgroup', '', 'contact_groups', 'tbl_lnkServiceToContactgroup', 'contactgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(55, 'tbl_service', 'tbl_contact', '', 'contacts', 'tbl_lnkServiceToContact', 'contact_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(56, 'tbl_service', 'tbl_timeperiod', '', 'check_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(57, 'tbl_service', 'tbl_command', '', 'check_command', '', 'command_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(58, 'tbl_service', 'tbl_timeperiod', '', 'notification_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(59, 'tbl_service', 'tbl_command', '', 'event_handler', '', 'command_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(60, 'tbl_service', 'tbl_servicetemplate', 'tbl_service', 'use_template', 'tbl_lnkServiceToServicetemplate', 'template_name', 'name', '', 0, '', 3); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(61, 'tbl_service', 'tbl_variabledefinition', '', 'use_variables', 'tbl_lnkServiceToVariabledefinition', 'name', '', '', 0, '', 4); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(62, 'tbl_servicegroup', 'tbl_host', 'tbl_service', 'members', 'tbl_lnkServicegroupToService', 'host_name', 'service_description', '', 0, '', 5); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(63, 'tbl_servicegroup', 'tbl_servicegroup', '', 'servicegroup_members', 'tbl_lnkServicegroupToServicegroup', 'servicegroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(64, 'tbl_hostdependency', 'tbl_host', '', 'dependent_host_name', 'tbl_lnkHostdependencyToHost_DH', 'host_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(65, 'tbl_hostdependency', 'tbl_host', '', 'host_name', 'tbl_lnkHostdependencyToHost_H', 'host_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(66, 'tbl_hostdependency', 'tbl_hostgroup', '', 'dependent_hostgroup_name', 'tbl_lnkHostdependencyToHostgroup_DH', 'hostgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(67, 'tbl_hostdependency', 'tbl_hostgroup', '', 'hostgroup_name', 'tbl_lnkHostdependencyToHostgroup_H', 'hostgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(68, 'tbl_hostdependency', 'tbl_timeperiod', '', 'dependency_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(69, 'tbl_hostescalation', 'tbl_host', '', 'host_name', 'tbl_lnkHostescalationToHost', 'host_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(70, 'tbl_hostescalation', 'tbl_hostgroup', '', 'hostgroup_name', 'tbl_lnkHostescalationToHostgroup', 'hostgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(71, 'tbl_hostescalation', 'tbl_contact', '', 'contacts', 'tbl_lnkHostescalationToContact', 'contact_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(72, 'tbl_hostescalation', 'tbl_contactgroup', '', 'contact_groups', 'tbl_lnkHostescalationToContactgroup', 'contactgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(73, 'tbl_hostescalation', 'tbl_timeperiod', '', 'escalation_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(74, 'tbl_hostextinfo', 'tbl_host', '', 'host_name', '', 'host_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(75, 'tbl_servicedependency', 'tbl_host', '', 'dependent_host_name', 'tbl_lnkServicedependencyToHost_DH', 'host_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(76, 'tbl_servicedependency', 'tbl_host', '', 'host_name', 'tbl_lnkServicedependencyToHost_H', 'host_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(77, 'tbl_servicedependency', 'tbl_hostgroup', '', 'dependent_hostgroup_name', 'tbl_lnkServicedependencyToHostgroup_DH', 'hostgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(78, 'tbl_servicedependency', 'tbl_hostgroup', '', 'hostgroup_name', 'tbl_lnkServicedependencyToHostgroup_H', 'hostgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(79, 'tbl_servicedependency', 'tbl_service', '', 'dependent_service_description', 'tbl_lnkServicedependencyToService_DS', 'service_description', '', '', 0, '', 6); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(80, 'tbl_servicedependency', 'tbl_service', '', 'service_description', 'tbl_lnkServicedependencyToService_S', 'service_description', '', '', 0, '', 6); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(81, 'tbl_servicedependency', 'tbl_timeperiod', '', 'dependency_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(82, 'tbl_serviceescalation', 'tbl_host', '', 'host_name', 'tbl_lnkServiceescalationToHost', 'host_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(83, 'tbl_serviceescalation', 'tbl_hostgroup', '', 'hostgroup_name', 'tbl_lnkServiceescalationToHostgroup', 'hostgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(84, 'tbl_serviceescalation', 'tbl_service', '', 'service_description', 'tbl_lnkServiceescalationToService', 'service_description', '', '', 0, '', 6); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(85, 'tbl_serviceescalation', 'tbl_contact', '', 'contacts', 'tbl_lnkServiceescalationToContact', 'contact_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(86, 'tbl_serviceescalation', 'tbl_contactgroup', '', 'contact_groups', 'tbl_lnkServiceescalationToContactgroup', 'contactgroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(87, 'tbl_serviceescalation', 'tbl_timeperiod', '', 'escalation_period', '', 'timeperiod_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(88, 'tbl_serviceextinfo', 'tbl_host', '', 'host_name', '', 'host_name', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(89, 'tbl_serviceextinfo', 'tbl_service', '', 'service_description', '', 'service_description', '', '', 0, '', 1); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(90, 'tbl_command', 'tbl_lnkContacttemplateToCommandHost', '', 'idSlave', '', 'tbl_contacttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(91, 'tbl_command', 'tbl_lnkContacttemplateToCommandService', '', 'idSlave', '', 'tbl_contacttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(92, 'tbl_command', 'tbl_lnkContactToCommandHost', '', 'idSlave', '', 'tbl_contact', '', 'contact_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(93, 'tbl_command', 'tbl_lnkContactToCommandService', '', 'idSlave', '', 'tbl_contact', '', 'contact_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(94, 'tbl_command', 'tbl_host', '', 'check_command', '', '', '', 'host_name', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(95, 'tbl_command', 'tbl_host', '', 'event_handler', '', '', '', 'host_name', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(96, 'tbl_command', 'tbl_service', '', 'check_command', '', '', '', 'config_name,service_description', 1, '1,1,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(97, 'tbl_command', 'tbl_service', '', 'event_handler', '', '', '', 'config_name,service_description', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(98, 'tbl_contact', 'tbl_lnkContactgroupToContact', '', 'idSlave', '', 'tbl_contactgroup', '', 'contactgroup_name', 1, '1,2,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(99, 'tbl_contact', 'tbl_lnkContactToCommandHost', '', 'idMaster', '', 'tbl_command', '', 'command_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(100, 'tbl_contact', 'tbl_lnkContactToCommandService', '', 'idMaster', '', 'tbl_command', '', 'command_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(101, 'tbl_contact', 'tbl_lnkContactToContactgroup', '', 'idMaster', '', 'tbl_contactgroup', '', 'contactgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(102, 'tbl_contact', 'tbl_lnkContactToContacttemplate', '', 'idMaster', '', 'tbl_contacttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(103, 'tbl_contact', 'tbl_lnkContactToVariabledefinition', '', 'idMaster', '', 'tbl_variabledefinition', '', 'name', 1, '0,0,0,2', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(104, 'tbl_contact', 'tbl_lnkHostescalationToContact', '', 'idSlave', '', 'tbl_hostescalation', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(105, 'tbl_contact', 'tbl_lnkHosttemplateToContact', '', 'idSlave', '', 'tbl_hosttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(106, 'tbl_contact', 'tbl_lnkHostToContact', '', 'idSlave', '', 'tbl_host', '', 'host_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(107, 'tbl_contact', 'tbl_lnkServiceescalationToContact', '', 'idSlave', '', 'tbl_serviceescalation', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(108, 'tbl_contact', 'tbl_lnkServicetemplateToContact', '', 'idSlave', '', 'tbl_servicetemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(109, 'tbl_contact', 'tbl_lnkServiceToContact', '', 'idSlave', '', 'tbl_service', '', 'config_name,service_description', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(110, 'tbl_contactgroup', 'tbl_lnkContactgroupToContact', '', 'idMaster', '', 'tbl_contact', '', 'contact_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(111, 'tbl_contactgroup', 'tbl_lnkContactgroupToContactgroup', '', 'idMaster', '', 'tbl_contactgroup', '', 'contactgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(112, 'tbl_contactgroup', 'tbl_lnkContactgroupToContactgroup', '', 'idSlave', '', 'tbl_contactgroup', '', 'contactgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(113, 'tbl_contactgroup', 'tbl_lnkContacttemplateToContactgroup', '', 'idSlave', '', 'tbl_contacttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(114, 'tbl_contactgroup', 'tbl_lnkContactToContactgroup', '', 'idSlave', '', 'tbl_contact', '', 'contact_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(115, 'tbl_contactgroup', 'tbl_lnkHostescalationToContactgroup', '', 'idSlave', '', 'tbl_hostescalation', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(116, 'tbl_contactgroup', 'tbl_lnkHosttemplateToContactgroup', '', 'idSlave', '', 'tbl_hosttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(117, 'tbl_contactgroup', 'tbl_lnkHostToContactgroup', '', 'idSlave', '', 'tbl_host', '', 'host_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(118, 'tbl_contactgroup', 'tbl_lnkServiceescalationToContactgroup', '', 'idSlave', '', 'tbl_serviceescalation', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(119, 'tbl_contactgroup', 'tbl_lnkServicetemplateToContactgroup', '', 'idSlave', '', 'tbl_servicetemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(120, 'tbl_contactgroup', 'tbl_lnkServiceToContactgroup', '', 'idSlave', '', 'tbl_service', '', 'config_name,service_description', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(121, 'tbl_contacttemplate', 'tbl_lnkContacttemplateToCommandHost', '', 'idMaster', '', 'tbl_command', '', 'command_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(122, 'tbl_contacttemplate', 'tbl_lnkContacttemplateToCommandService', '', 'idMaster', '', 'tbl_command', '', 'command_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(123, 'tbl_contacttemplate', 'tbl_lnkContacttemplateToContactgroup', '', 'idMaster', '', 'tbl_contactgroup', '', 'contactgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(124, 'tbl_contacttemplate', 'tbl_lnkContacttemplateToContacttemplate', '', 'idMaster', '', 'tbl_contacttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(125, 'tbl_contacttemplate', 'tbl_lnkContacttemplateToContacttemplate', '', 'idSlave', '', 'tbl_contacttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(126, 'tbl_contacttemplate', 'tbl_lnkContacttemplateToVariabledefinition', '', 'idMaster', '', 'tbl_variabledefinition', '', 'name', 1, '0,0,0,2', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(127, 'tbl_contacttemplate', 'tbl_lnkContactToContacttemplate', '', 'idSlave', '', 'tbl_contact', '', 'contact_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(128, 'tbl_host', 'tbl_lnkHostdependencyToHost_DH', '', 'idSlave', '', 'tbl_hostdependency', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(129, 'tbl_host', 'tbl_lnkHostdependencyToHost_H', '', 'idSlave', '', 'tbl_hostdependency', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(130, 'tbl_host', 'tbl_lnkHostescalationToHost', '', 'idSlave', '', 'tbl_hostescalation', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(131, 'tbl_host', 'tbl_lnkHosttemplateToHost', '', 'idSlave', '', 'tbl_hosttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(132, 'tbl_host', 'tbl_lnkHostToContact', '', 'idMaster', '', 'tbl_contact', '', 'contact_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(133, 'tbl_host', 'tbl_lnkHostToContactgroup', '', 'idMaster', '', 'tbl_contactgroup', '', 'contactgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(134, 'tbl_host', 'tbl_lnkHostToHost', '', 'idMaster', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(135, 'tbl_host', 'tbl_lnkHostToHost', '', 'idSlave', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(136, 'tbl_host', 'tbl_lnkHostToHostgroup', '', 'idMaster', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(137, 'tbl_host', 'tbl_lnkHostgroupToHost', '', 'idSlave', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(138, 'tbl_host', 'tbl_lnkHostToHosttemplate', '', 'idMaster', '', 'tbl_hosttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(139, 'tbl_host', 'tbl_lnkHostToVariabledefinition', '', 'idMaster', '', 'tbl_variabledefinition', '', 'name', 1, '0,0,0,2', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(140, 'tbl_host', 'tbl_lnkServicedependencyToHost_DH', '', 'idSlave', '', 'tbl_servicedependency', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(141, 'tbl_host', 'tbl_lnkServicedependencyToHost_H', '', 'idSlave', '', 'tbl_servicedependency', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(142, 'tbl_host', 'tbl_lnkServiceescalationToHost', '', 'idSlave', '', 'tbl_serviceescalation', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(143, 'tbl_host', 'tbl_lnkServicetemplateToHost', '', 'idSlave', '', 'tbl_servicetemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(144, 'tbl_host', 'tbl_lnkServiceToHost', '', 'idSlave', '', 'tbl_service', '', 'config_name,service_description', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(145, 'tbl_host', 'tbl_lnkServicegroupToService', '', 'idSlaveH', '', 'tbl_servicegroup', '', 'servicegroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(146, 'tbl_host', 'tbl_hostextinfo', '', 'host_name', '', '', '', 'host_name', 1, '0,0,0,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(147, 'tbl_host', 'tbl_serviceextinfo', '', 'host_name', '', '', '', 'host_name', 1, '0,0,0,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(148, 'tbl_hostdependency', 'tbl_lnkHostdependencyToHostgroup_DH', '', 'idMaster', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(149, 'tbl_hostdependency', 'tbl_lnkHostdependencyToHostgroup_H', '', 'idMaster', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(150, 'tbl_hostdependency', 'tbl_lnkHostdependencyToHost_DH', '', 'idMaster', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(151, 'tbl_hostdependency', 'tbl_lnkHostdependencyToHost_H', '', 'idMaster', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(152, 'tbl_hostescalation', 'tbl_lnkHostescalationToContact', '', 'idMaster', '', 'tbl_contact', '', 'contact_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(153, 'tbl_hostescalation', 'tbl_lnkHostescalationToContactgroup', '', 'idMaster', '', 'tbl_contactgroup', '', 'contactgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(154, 'tbl_hostescalation', 'tbl_lnkHostescalationToHost', '', 'idMaster', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(155, 'tbl_hostescalation', 'tbl_lnkHostescalationToHostgroup', '', 'idMaster', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(156, 'tbl_hostgroup', 'tbl_lnkHostdependencyToHostgroup_DH', '', 'idSlave', '', 'tbl_hostdependency', '', 'config_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(157, 'tbl_hostgroup', 'tbl_lnkHostdependencyToHostgroup_H', '', 'idSlave', '', 'tbl_hostdependency', '', 'config_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(158, 'tbl_hostgroup', 'tbl_lnkHostescalationToHostgroup', '', 'idSlave', '', 'tbl_hostescalation', '', 'config_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(159, 'tbl_hostgroup', 'tbl_lnkHostgroupToHost', '', 'idMaster', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(160, 'tbl_hostgroup', 'tbl_lnkHostgroupToHostgroup', '', 'idMaster', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(161, 'tbl_hostgroup', 'tbl_lnkHostgroupToHostgroup', '', 'idSlave', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(162, 'tbl_hostgroup', 'tbl_lnkHosttemplateToHostgroup', '', 'idSlave', '', 'tbl_hosttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(163, 'tbl_hostgroup', 'tbl_lnkHostToHostgroup', '', 'idSlave', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(164, 'tbl_hostgroup', 'tbl_lnkServicedependencyToHostgroup_DH', '', 'idSlave', '', 'tbl_servicedependency', '', 'config_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(165, 'tbl_hostgroup', 'tbl_lnkServicedependencyToHostgroup_H', '', 'idSlave', '', 'tbl_servicedependency', '', 'config_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(166, 'tbl_hostgroup', 'tbl_lnkServiceescalationToHostgroup', '', 'idSlave', '', 'tbl_serviceescalation', '', 'config_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(167, 'tbl_hostgroup', 'tbl_lnkServicetemplateToHostgroup', '', 'idSlave', '', 'tbl_servicetemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(168, 'tbl_hostgroup', 'tbl_lnkServiceToHostgroup', '', 'idSlave', '', 'tbl_service', '', 'config_name,service_description', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(169, 'tbl_hostgroup', 'tbl_lnkServicegroupToService', '', 'idSlaveHG', '', 'tbl_servicegroup', '', 'servicegroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(170, 'tbl_hosttemplate', 'tbl_lnkHosttemplateToContact', '', 'idMaster', '', 'tbl_contact', '', 'contact_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(171, 'tbl_hosttemplate', 'tbl_lnkHosttemplateToContactgroup', '', 'idMaster', '', 'tbl_contactgroup', '', 'contactgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(172, 'tbl_hosttemplate', 'tbl_lnkHosttemplateToHost', '', 'idMaster', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(173, 'tbl_hosttemplate', 'tbl_lnkHosttemplateToHostgroup', '', 'idMaster', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(174, 'tbl_hosttemplate', 'tbl_lnkHosttemplateToHosttemplate', '', 'idMaster', '', 'tbl_service', '', 'config_name,service_description', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(175, 'tbl_hosttemplate', 'tbl_lnkHosttemplateToHosttemplate', '', 'idSlave', '', 'tbl_hosttemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(176, 'tbl_hosttemplate', 'tbl_lnkHosttemplateToVariabledefinition', '', 'idMaster', '', 'tbl_variabledefinition', '', 'name', 1, '0,0,0,2', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(177, 'tbl_hosttemplate', 'tbl_lnkHostToHosttemplate', '', 'idSlave', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(178, 'tbl_service', 'tbl_lnkServicedependencyToService_DS', '', 'idSlave', '', 'tbl_servicedependency', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(179, 'tbl_service', 'tbl_lnkServicedependencyToService_S', '', 'idSlave', '', 'tbl_servicedependency', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(180, 'tbl_service', 'tbl_lnkServiceescalationToService', '', 'idSlave', '', 'tbl_serviceescalation', '', 'config_name', 1, '1,1,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(181, 'tbl_service', 'tbl_lnkServicegroupToService', '', 'idSlaveS', '', 'tbl_servicegroup', '', 'servicegroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(182, 'tbl_service', 'tbl_lnkServiceToContact', '', 'idMaster', '', 'tbl_contact', '', 'contact_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(183, 'tbl_service', 'tbl_lnkServiceToContactgroup', '', 'idMaster', '', 'tbl_contactgroup', '', 'contactgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(184, 'tbl_service', 'tbl_lnkServiceToHost', '', 'idMaster', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(185, 'tbl_service', 'tbl_lnkServiceToHostgroup', '', 'idMaster', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(186, 'tbl_service', 'tbl_lnkServiceToServicegroup', '', 'idMaster', '', 'tbl_servicegroup', '', 'servicegroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(187, 'tbl_service', 'tbl_lnkServiceToServicetemplate', '', 'idMaster', '', 'tbl_servicetemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(188, 'tbl_service', 'tbl_lnkServiceToVariabledefinition', '', 'idMaster', '', 'tbl_variabledefinition', '', 'name', 1, '0,0,0,2', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(189, 'tbl_service', 'tbl_serviceextinfo', '', 'service_description', '', '', '', 'host_name', 1, '0,0,0,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(190, 'tbl_servicedependency', 'tbl_lnkServicedependencyToHostgroup_DH', '', 'idMaster', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(191, 'tbl_servicedependency', 'tbl_lnkServicedependencyToHostgroup_H', '', 'idMaster', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(192, 'tbl_servicedependency', 'tbl_lnkServicedependencyToHost_DH', '', 'idMaster', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(193, 'tbl_servicedependency', 'tbl_lnkServicedependencyToHost_H', '', 'idMaster', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(194, 'tbl_servicedependency', 'tbl_lnkServicedependencyToService_DS', '', 'idMaster', '', 'tbl_service', '', 'config_name,service_description', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(195, 'tbl_servicedependency', 'tbl_lnkServicedependencyToService_S', '', 'idMaster', '', 'tbl_service', '', 'config_name,service_description', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(196, 'tbl_serviceescalation', 'tbl_lnkServiceescalationToContact', '', 'idMaster', '', 'tbl_contact', '', 'contact_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(197, 'tbl_serviceescalation', 'tbl_lnkServiceescalationToContactgroup', '', 'idMaster', '', 'tbl_contactgroup', '', 'contactgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(198, 'tbl_serviceescalation', 'tbl_lnkServiceescalationToHost', '', 'idMaster', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(199, 'tbl_serviceescalation', 'tbl_lnkServiceescalationToHostgroup', '', 'idMaster', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(200, 'tbl_serviceescalation', 'tbl_lnkServiceescalationToService', '', 'idMaster', '', 'tbl_service', '', 'config_name,service_description', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(201, 'tbl_servicegroup', 'tbl_lnkServicegroupToService', '', 'idMaster', '', 'tbl_service', '', 'config_name,service_description', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(202, 'tbl_servicegroup', 'tbl_lnkServicegroupToServicegroup', '', 'idMaster', '', 'tbl_servicegroup', '', 'servicegroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(203, 'tbl_servicegroup', 'tbl_lnkServicegroupToServicegroup', '', 'idSlave', '', 'tbl_servicegroup', '', 'servicegroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(204, 'tbl_servicegroup', 'tbl_lnkServicetemplateToServicegroup', '', 'idSlave', '', 'tbl_servicetemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(205, 'tbl_servicegroup', 'tbl_lnkServiceToServicegroup', '', 'idSlave', '', 'tbl_service', '', 'config_name,service_description', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(206, 'tbl_servicetemplate', 'tbl_lnkServicetemplateToContact', '', 'idMaster', '', 'tbl_contact', '', 'contact_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(207, 'tbl_servicetemplate', 'tbl_lnkServicetemplateToContactgroup', '', 'idMaster', '', 'tbl_contactgroup', '', 'contactgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(208, 'tbl_servicetemplate', 'tbl_lnkServicetemplateToHost', '', 'idMaster', '', 'tbl_host', '', 'host_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(209, 'tbl_servicetemplate', 'tbl_lnkServicetemplateToHostgroup', '', 'idMaster', '', 'tbl_hostgroup', '', 'hostgroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(210, 'tbl_servicetemplate', 'tbl_lnkServicetemplateToServicegroup', '', 'idMaster', '', 'tbl_servicegroup', '', 'servicegroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(211, 'tbl_servicetemplate', 'tbl_lnkServicetemplateToServicetemplate', '', 'idMaster', '', 'tbl_servicetemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(212, 'tbl_servicetemplate', 'tbl_lnkServicetemplateToServicetemplate', '', 'idSlave', '', 'tbl_servicetemplate', '', 'template_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(213, 'tbl_servicetemplate', 'tbl_lnkServicetemplateToVariabledefinition', '', 'idMaster', '', 'tbl_variabledefinition', '', 'name', 1, '0,0,0,2', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(214, 'tbl_servicetemplate', 'tbl_lnkServiceToServicetemplate', '', 'idSlave', '', 'tbl_service', '', 'config_name,service_description', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(215, 'tbl_timeperiod', 'tbl_lnkTimeperiodToTimeperiod', '', 'idMaster', '', 'tbl_timeperiod', '', 'timeperiod_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(216, 'tbl_timeperiod', 'tbl_lnkTimeperiodToTimeperiod', '', 'idSlave', '', 'tbl_timeperiod', '', 'timeperiod_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(217, 'tbl_timeperiod', 'tbl_contact', '', 'host_notification_period', '', '', '', 'contact_name', 1, '1,1,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(218, 'tbl_timeperiod', 'tbl_contact', '', 'service_notification_period', '', '', '', 'contact_name', 1, '1,1,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(219, 'tbl_timeperiod', 'tbl_contacttemplate', '', 'host_notification_period', '', '', '', 'template_name', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(220, 'tbl_timeperiod', 'tbl_contacttemplate', '', 'service_notification_period', '', '', '', 'template_name', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(221, 'tbl_timeperiod', 'tbl_host', '', 'check_period', '', '', '', 'host_name', 1, '1,1,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(222, 'tbl_timeperiod', 'tbl_host', '', 'notification_period', '', '', '', 'host_name', 1, '1,1,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(223, 'tbl_timeperiod', 'tbl_hosttemplate', '', 'check_period', '', '', '', 'template_name', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(224, 'tbl_timeperiod', 'tbl_hosttemplate', '', 'notification_period', '', '', '', 'template_name', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(225, 'tbl_timeperiod', 'tbl_hostdependency', '', 'dependency_period', '', '', '', 'config_name', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(226, 'tbl_timeperiod', 'tbl_hostescalation', '', 'escalation_period', '', '', '', 'config_name', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(227, 'tbl_timeperiod', 'tbl_service', '', 'check_period', '', '', '', 'config_name,service_description', 1, '1,1,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(228, 'tbl_timeperiod', 'tbl_service', '', 'notification_period', '', '', '', 'config_name,service_description', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(229, 'tbl_timeperiod', 'tbl_servicetemplate', '', 'check_period', '', '', '', 'template_name', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(230, 'tbl_timeperiod', 'tbl_servicetemplate', '', 'notification_period', '', '', '', 'template_name', 1, '1,1,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(231, 'tbl_timeperiod', 'tbl_servicedependency', '', 'dependency_period', '', '', '', 'config_name', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(232, 'tbl_timeperiod', 'tbl_serviceescalation', '', 'escalation_period', '', '', '', 'config_name', 1, '0,2,2,0', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(233, 'tbl_timeperiod', 'tbl_timedefinition', '', 'tipId', '', '', '', 'id', 1, '0,0,0,3', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(234, 'tbl_timeperiod', 'tbl_timeperiod', '', 'use_template', 'tbl_lnkTimeperiodToTimeperiodUse', 'name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(235, 'tbl_timeperiod', 'tbl_lnkTimeperiodToTimeperiodUse', '', 'idMaster', '', 'tbl_timeperiod', '', 'name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(236, 'tbl_timeperiod', 'tbl_lnkTimeperiodToTimeperiodUse', '', 'idSlave', '', 'tbl_timeperiod', '', 'name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(237, 'tbl_group', 'tbl_user', '', 'users', 'tbl_lnkGroupToUser', 'username', '', '', 0, '', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(238, 'tbl_group', 'tbl_lnkGroupToUser', '', 'idMaster', '', 'tbl_user', '', 'username', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(239, 'tbl_servicedependency', 'tbl_servicegroup', '', 'dependent_servicegroup_name', 'tbl_lnkServicedependencyToServicegroup_DS', 'servicegroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(240, 'tbl_servicedependency', 'tbl_servicegroup', '', 'servicegroup_name', 'tbl_lnkServicedependencyToServicegroup_S', 'servicegroup_name', '', '', 0, '', 2); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(241, 'tbl_servicedependency', 'tbl_lnkServicedependencyToServicegroup_DS', '', 'idMaster', '', 'tbl_servicegroup', '', 'servicegroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES(242, 'tbl_servicedependency', 'tbl_lnkServicedependencyToServicegroup_S', '', 'idMaster', '', 'tbl_servicegroup', '', 'servicegroup_name', 1, '0,0,0,1', 0); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES (243,'tbl_serviceescalation', 'tbl_servicegroup', '', 'servicegroup_name', 'tbl_lnkServiceescalationToServicegroup', 'servicegroup_name', '', '', '0', '', '2'); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES (244,'tbl_serviceescalation', 'tbl_lnkServiceescalationToServicegroup', '', 'idMaster', '', 'tbl_servicegroup', '', 'servicegroup_name', '1', '0,0,0,1', '0'); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES (NULL, 'tbl_service', 'tbl_service', '', 'parents', 'tbl_lnkServiceToService', 'service_description', '', '', '0', '', '7'); +INSERT INTO `tbl_relationinformation` (`id`, `master`, `tableName1`, `tableName2`, `fieldName`, `linkTable`, `target1`, `target2`, `targetKey`, `fullRelation`, `flags`, `type`) VALUES (NULL, 'tbl_servicetemplate', 'tbl_service', '', 'parents', 'tbl_lnkServicetemplateToService', 'service_description', '', '', '0', '', '7'); + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_service` +-- + +CREATE TABLE IF NOT EXISTS `tbl_service` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `config_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `host_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `host_name_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `hostgroup_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `hostgroup_name_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `service_description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `display_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `parents` tinyint(3) unsigned NOT NULL DEFAULT '0', + `parents_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `importance` int(11) DEFAULT NULL, + `servicegroups` tinyint(3) unsigned NOT NULL DEFAULT '0', + `servicegroups_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `use_template` tinyint(3) unsigned NOT NULL DEFAULT '0', + `use_template_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_command` text COLLATE utf8_unicode_ci NOT NULL, + `is_volatile` tinyint(3) unsigned NOT NULL DEFAULT '2', + `initial_state` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `max_check_attempts` int(11) DEFAULT NULL, + `check_interval` int(11) DEFAULT NULL, + `retry_interval` int(11) DEFAULT NULL, + `active_checks_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `passive_checks_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_period` int(11) NOT NULL DEFAULT '0', + `parallelize_check` tinyint(3) unsigned NOT NULL DEFAULT '2', + `obsess_over_service` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_freshness` tinyint(3) unsigned NOT NULL DEFAULT '2', + `freshness_threshold` int(11) DEFAULT NULL, + `event_handler` int(11) NOT NULL DEFAULT '0', + `event_handler_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `low_flap_threshold` int(11) DEFAULT NULL, + `high_flap_threshold` int(11) DEFAULT NULL, + `flap_detection_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `flap_detection_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `process_perf_data` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_status_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_nonstatus_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `notification_interval` int(11) DEFAULT NULL, + `first_notification_delay` int(11) DEFAULT NULL, + `notification_period` int(11) NOT NULL DEFAULT '0', + `notification_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `notifications_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `contacts` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contacts_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `contact_groups` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contact_groups_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `stalking_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `notes` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `notes_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `action_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `icon_image` varchar(500) COLLATE utf8_unicode_ci NOT NULL, + `icon_image_alt` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `use_variables` tinyint(3) unsigned NOT NULL DEFAULT '0', + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + `import_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_service` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_servicedependency` +-- + +CREATE TABLE IF NOT EXISTS `tbl_servicedependency` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `config_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `dependent_host_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `dependent_hostgroup_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `dependent_service_description` tinyint(3) unsigned NOT NULL DEFAULT '0', + `dependent_servicegroup_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `host_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `hostgroup_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `service_description` tinyint(3) unsigned NOT NULL DEFAULT '0', + `servicegroup_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `inherits_parent` tinyint(3) unsigned NOT NULL DEFAULT '0', + `execution_failure_criteria` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `notification_failure_criteria` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `dependency_period` int(11) NOT NULL DEFAULT '0', + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + `import_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`config_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_servicedependency` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_serviceescalation` +-- + +CREATE TABLE IF NOT EXISTS `tbl_serviceescalation` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `config_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `host_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `hostgroup_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `service_description` tinyint(3) unsigned NOT NULL DEFAULT '0', + `servicegroup_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contacts` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contact_groups` tinyint(3) unsigned NOT NULL DEFAULT '0', + `first_notification` int(11) DEFAULT NULL, + `last_notification` int(11) DEFAULT NULL, + `notification_interval` int(11) DEFAULT NULL, + `escalation_period` int(11) NOT NULL DEFAULT '0', + `escalation_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + `import_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + KEY `config_name` (`config_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_serviceescalation` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_serviceextinfo` +-- + + +CREATE TABLE IF NOT EXISTS `tbl_serviceextinfo` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `host_name` int(11) NOT NULL, + `service_description` int(11) NOT NULL, + `notes` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `notes_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `action_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `statistic_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `icon_image` varchar(500) COLLATE utf8_unicode_ci NOT NULL, + `icon_image_alt` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + `import_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`host_name`,`service_description`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_serviceextinfo` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_servicegroup` +-- + +CREATE TABLE IF NOT EXISTS `tbl_servicegroup` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `servicegroup_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `members` tinyint(3) unsigned NOT NULL DEFAULT '0', + `servicegroup_members` tinyint(3) unsigned NOT NULL DEFAULT '0', + `notes` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `notes_url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `action_url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`servicegroup_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_servicegroup` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_servicetemplate` +-- + +CREATE TABLE IF NOT EXISTS `tbl_servicetemplate` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `template_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `host_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `host_name_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `hostgroup_name` tinyint(3) unsigned NOT NULL DEFAULT '0', + `hostgroup_name_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `service_description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `display_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `parents` tinyint(3) unsigned NOT NULL DEFAULT '0', + `parents_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `importance` int(11) DEFAULT NULL, + `servicegroups` tinyint(3) unsigned NOT NULL DEFAULT '0', + `servicegroups_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `use_template` tinyint(3) unsigned NOT NULL DEFAULT '0', + `use_template_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_command` text COLLATE utf8_unicode_ci NOT NULL, + `is_volatile` tinyint(3) unsigned NOT NULL DEFAULT '2', + `initial_state` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `max_check_attempts` int(11) DEFAULT NULL, + `check_interval` int(11) DEFAULT NULL, + `retry_interval` int(11) DEFAULT NULL, + `active_checks_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `passive_checks_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_period` int(11) NOT NULL DEFAULT '0', + `parallelize_check` tinyint(3) unsigned NOT NULL DEFAULT '2', + `obsess_over_service` tinyint(3) unsigned NOT NULL DEFAULT '2', + `check_freshness` tinyint(3) unsigned NOT NULL DEFAULT '2', + `freshness_threshold` int(11) DEFAULT NULL, + `event_handler` int(11) NOT NULL DEFAULT '0', + `event_handler_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `low_flap_threshold` int(11) DEFAULT NULL, + `high_flap_threshold` int(11) DEFAULT NULL, + `flap_detection_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `flap_detection_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `process_perf_data` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_status_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `retain_nonstatus_information` tinyint(3) unsigned NOT NULL DEFAULT '2', + `notification_interval` int(11) DEFAULT NULL, + `first_notification_delay` int(11) DEFAULT NULL, + `notification_period` int(11) NOT NULL DEFAULT '0', + `notification_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `notifications_enabled` tinyint(3) unsigned NOT NULL DEFAULT '2', + `contacts` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contacts_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `contact_groups` tinyint(3) unsigned NOT NULL DEFAULT '0', + `contact_groups_tploptions` tinyint(3) unsigned NOT NULL DEFAULT '2', + `stalking_options` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `notes` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `notes_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `action_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `icon_image` varchar(500) COLLATE utf8_unicode_ci NOT NULL, + `icon_image_alt` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `use_variables` tinyint(3) unsigned NOT NULL DEFAULT '0', + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + `import_hash` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `config_name` (`template_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_servicetemplate` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_settings` +-- + +CREATE TABLE IF NOT EXISTS `tbl_settings` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `category` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(30) COLLATE utf8_unicode_ci NOT NULL, + `value` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_settings` +-- +INSERT INTO `tbl_settings` (`id`, `category`, `name`, `value`) VALUES (NULL, 'install', 'hash', SHA2(UUID(), 256)); + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_tablestatus` +-- + +CREATE TABLE IF NOT EXISTS `tbl_tablestatus` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `tableName` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `domainId` int(11) NOT NULL, + `updateTime` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_tablestatus` +-- + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_timedefinition` +-- + +CREATE TABLE IF NOT EXISTS `tbl_timedefinition` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `tipId` int(10) unsigned NOT NULL, + `definition` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `range` text COLLATE utf8_unicode_ci NOT NULL, + `last_modified` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_timedefinition` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_timeperiod` +-- + +CREATE TABLE IF NOT EXISTS `tbl_timeperiod` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `timeperiod_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `exclude` tinyint(3) unsigned NOT NULL DEFAULT '0', + `use_template` tinyint(3) unsigned NOT NULL DEFAULT '0', + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `register` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `last_modified` datetime NOT NULL, + `access_group` int(8) unsigned NOT NULL DEFAULT '0', + `config_id` tinyint(3) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `timeperiod_name` (`timeperiod_name`,`config_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_timeperiod` +-- + + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_user` +-- + +CREATE TABLE IF NOT EXISTS `tbl_user` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `alias` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `admin_enable` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', + `wsauth` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', + `active` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', + `nodelete` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', + `language` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `domain` int(10) unsigned NOT NULL DEFAULT '1', + `last_login` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `last_modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + UNIQUE KEY `username` (`username`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_user` +-- + +-- -------------------------------------------------------- + +-- +-- Structure for table `tbl_variabledefinition` +-- + +CREATE TABLE IF NOT EXISTS `tbl_variabledefinition` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `value` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `last_modified` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Datasets for table `tbl_variabledefinition` +-- + diff --git a/install/sql/update_300_301.sql b/install/sql/update_300_301.sql index 0af28e5..6e3cbbb 100644 --- a/install/sql/update_300_301.sql +++ b/install/sql/update_300_301.sql @@ -5,12 +5,12 @@ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --- (c) 2005-2018 by Martin Willisegger +-- (c) 2005-2023 by Martin Willisegger -- -- Project : NagiosQL -- Component : Update from NagiosQL 3.0.0 to NagiosQL 3.0.1 -- Website : https://sourceforge.net/projects/nagiosql/ --- Version : 3.4.0 +-- Version : 3.5.0 -- GIT Repo : https://gitlab.com/wizonet/NagiosQL -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff --git a/install/sql/update_300_310.sql b/install/sql/update_300_310.sql index 93a6e3c..3b2034b 100644 --- a/install/sql/update_300_310.sql +++ b/install/sql/update_300_310.sql @@ -5,12 +5,12 @@ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --- (c) 2005-2018 by Martin Willisegger +-- (c) 2005-2023 by Martin Willisegger -- -- Project : NagiosQL -- Component : Update from NagiosQL 3.0.4 to NagiosQL 3.1.0 -- Website : https://sourceforge.net/projects/nagiosql/ --- Version : 3.4.0 +-- Version : 3.5.0 -- GIT Repo : https://gitlab.com/wizonet/NagiosQL -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff --git a/install/sql/update_301_302.sql b/install/sql/update_301_302.sql index f0a90cc..888adcc 100644 --- a/install/sql/update_301_302.sql +++ b/install/sql/update_301_302.sql @@ -5,12 +5,12 @@ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --- (c) 2005-2018 by Martin Willisegger +-- (c) 2005-2023 by Martin Willisegger -- -- Project : NagiosQL -- Component : Update from NagiosQL 3.0.1 to NagiosQL 3.0.2 -- Website : https://sourceforge.net/projects/nagiosql/ --- Version : 3.4.0 +-- Version : 3.5.0 -- GIT Repo : https://gitlab.com/wizonet/NagiosQL -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff --git a/install/sql/update_302_303.sql b/install/sql/update_302_303.sql index ad2eab9..6df1f40 100644 --- a/install/sql/update_302_303.sql +++ b/install/sql/update_302_303.sql @@ -5,12 +5,12 @@ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --- (c) 2005-2018 by Martin Willisegger +-- (c) 2005-2023 by Martin Willisegger -- -- Project : NagiosQL -- Component : Update from NagiosQL 3.0.2 to NagiosQL 3.0.3 -- Website : https://sourceforge.net/projects/nagiosql/ --- Version : 3.4.0 +-- Version : 3.5.0 -- GIT Repo : https://gitlab.com/wizonet/NagiosQL -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff --git a/install/sql/update_303_304.sql b/install/sql/update_303_304.sql index 3974c96..f27a146 100644 --- a/install/sql/update_303_304.sql +++ b/install/sql/update_303_304.sql @@ -5,12 +5,12 @@ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --- (c) 2005-2018 by Martin Willisegger +-- (c) 2005-2023 by Martin Willisegger -- -- Project : NagiosQL -- Component : Update from NagiosQL 3.0.3 to NagiosQL 3.0.4 -- Website : https://sourceforge.net/projects/nagiosql/ --- Version : 3.4.0 +-- Version : 3.5.0 -- GIT Repo : https://gitlab.com/wizonet/NagiosQL -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff --git a/install/sql/update_304_310.sql b/install/sql/update_304_310.sql index a8e4572..387e29b 100644 --- a/install/sql/update_304_310.sql +++ b/install/sql/update_304_310.sql @@ -5,12 +5,12 @@ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --- (c) 2005-2018 by Martin Willisegger +-- (c) 2005-2023 by Martin Willisegger -- -- Project : NagiosQL -- Component : Update from NagiosQL 3.0.4 to NagiosQL 3.1.0 -- Website : https://sourceforge.net/projects/nagiosql/ --- Version : 3.4.0 +-- Version : 3.5.0 -- GIT Repo : https://gitlab.com/wizonet/NagiosQL -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff --git a/install/sql/update_310_311.sql b/install/sql/update_310_311.sql index f15206a..00b8918 100644 --- a/install/sql/update_310_311.sql +++ b/install/sql/update_310_311.sql @@ -5,12 +5,12 @@ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --- (c) 2005-2018 by Martin Willisegger +-- (c) 2005-2023 by Martin Willisegger -- -- Project : NagiosQL -- Component : Update from NagiosQL 3.1.0 to NagiosQL 3.1.1 -- Website : https://sourceforge.net/projects/nagiosql/ --- Version : 3.4.0 +-- Version : 3.5.0 -- GIT Repo : https://gitlab.com/wizonet/NagiosQL -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff --git a/install/sql/update_310_320.sql b/install/sql/update_310_320.sql index ac9ee39..4361595 100644 --- a/install/sql/update_310_320.sql +++ b/install/sql/update_310_320.sql @@ -5,12 +5,12 @@ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --- (c) 2005-2018 by Martin Willisegger +-- (c) 2005-2023 by Martin Willisegger -- -- Project : NagiosQL -- Component : Update from NagiosQL 3.1.x to NagiosQL 3.2.0 -- Website : https://sourceforge.net/projects/nagiosql/ --- Version : 3.4.0 +-- Version : 3.5.0 -- GIT Repo : https://gitlab.com/wizonet/NagiosQL -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff --git a/install/sql/update_311_320.sql b/install/sql/update_311_320.sql index bbf07df..46f31a8 100644 --- a/install/sql/update_311_320.sql +++ b/install/sql/update_311_320.sql @@ -5,12 +5,12 @@ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --- (c) 2005-2018 by Martin Willisegger +-- (c) 2005-2023 by Martin Willisegger -- -- Project : NagiosQL -- Component : Update from NagiosQL 3.1.x to NagiosQL 3.2.0 -- Website : https://sourceforge.net/projects/nagiosql/ --- Version : 3.4.0 +-- Version : 3.5.0 -- GIT Repo : https://gitlab.com/wizonet/NagiosQL -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff --git a/install/sql/update_320_340.sql b/install/sql/update_320_340.sql index e7ed594..68f0e6e 100644 --- a/install/sql/update_320_340.sql +++ b/install/sql/update_320_340.sql @@ -5,19 +5,19 @@ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --- (c) 2005-2018 by Martin Willisegger +-- (c) 2005-2023 by Martin Willisegger -- -- Project : NagiosQL --- Component : Update from NagiosQL 3.2.0 to NagiosQL 3.4.0 +-- Component : Update from NagiosQL 3.2.0 to NagiosQL 3.4.1 -- Website : https://sourceforge.net/projects/nagiosql/ --- Version : 3.4.0 +-- Version : 3.5.0 -- GIT Repo : https://gitlab.com/wizonet/NagiosQL -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Modify existing tbl_settings -- -UPDATE `tbl_settings` SET `value` = '3.4.0' WHERE `tbl_settings`.`name` = 'version' LIMIT 1; +UPDATE `tbl_settings` SET `value` = '3.4.1' WHERE `tbl_settings`.`name` = 'version' LIMIT 1; -- -- Modify existing tbl_configtarget -- diff --git a/install/sql/update_340_341.sql b/install/sql/update_340_341.sql new file mode 100644 index 0000000..ae4c39b --- /dev/null +++ b/install/sql/update_340_341.sql @@ -0,0 +1,42 @@ +-- +-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +-- +-- NagiosQL +-- +-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +-- +-- (c) 2005-2023 by Martin Willisegger +-- +-- Project : NagiosQL +-- Component : Update from NagiosQL 3.4.0 to NagiosQL 3.4.1 +-- Website : https://sourceforge.net/projects/nagiosql/ +-- Version : 3.5.0 +-- GIT Repo : https://gitlab.com/wizonet/NagiosQL +-- +-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +-- +-- Modify table tbl_relationinformation +-- +UPDATE `tbl_relationinformation` SET `target1`='name' WHERE `master`='tbl_timeperiod' AND `fieldName`='use_template'; +UPDATE `tbl_relationinformation` SET `targetKey`='name' WHERE `master`='tbl_timeperiod' AND `tableName1`='tbl_lnkTimeperiodToTimeperiodUse' AND `fieldName`='idMaster'; +UPDATE `tbl_relationinformation` SET `targetKey`='name' WHERE `master`='tbl_timeperiod' AND `tableName1`='tbl_lnkTimeperiodToTimeperiodUse' AND `fieldName`='idSlave'; +-- +-- Modify table tbl_command +-- +ALTER TABLE `tbl_command` ADD `arg1_info` text NULL DEFAULT NULL AFTER `command_type`; +ALTER TABLE `tbl_command` ADD `arg2_info` text NULL DEFAULT NULL AFTER `arg1_info`; +ALTER TABLE `tbl_command` ADD `arg3_info` text NULL DEFAULT NULL AFTER `arg2_info`; +ALTER TABLE `tbl_command` ADD `arg4_info` text NULL DEFAULT NULL AFTER `arg3_info`; +ALTER TABLE `tbl_command` ADD `arg5_info` text NULL DEFAULT NULL AFTER `arg4_info`; +ALTER TABLE `tbl_command` ADD `arg6_info` text NULL DEFAULT NULL AFTER `arg5_info`; +ALTER TABLE `tbl_command` ADD `arg7_info` text NULL DEFAULT NULL AFTER `arg6_info`; +ALTER TABLE `tbl_command` ADD `arg8_info` text NULL DEFAULT NULL AFTER `arg7_info`; +-- +-- Modify table tbl_configtarget +-- +ALTER TABLE `tbl_configtarget` ADD `port` INT UNSIGNED NOT NULL DEFAULT '22' AFTER `server`; +-- +-- Modify existing tbl_settings +-- +INSERT INTO `tbl_settings` (`id`, `category`, `name`, `value`) VALUES (NULL,'performance', 'parents', '1'); +UPDATE `tbl_settings` SET `value` = '3.4.1' WHERE `tbl_settings`.`name` = 'version' LIMIT 1; diff --git a/install/sql/update_341_350.sql b/install/sql/update_341_350.sql new file mode 100644 index 0000000..2a06d67 --- /dev/null +++ b/install/sql/update_341_350.sql @@ -0,0 +1,21 @@ +-- +-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +-- +-- NagiosQL +-- +-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +-- +-- (c) 2005-2023 by Martin Willisegger +-- +-- Project : NagiosQL +-- Component : Update from NagiosQL 3.4.1 to NagiosQL 3.5.0 +-- Website : https://sourceforge.net/projects/nagiosql/ +-- Version : 3.5.0 +-- GIT Repo : https://gitlab.com/wizonet/NagiosQL +-- +-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +-- +-- Modify existing tbl_settings +-- +UPDATE `tbl_settings` SET `value` = '3.5.0' WHERE `tbl_settings`.`name` = 'version' LIMIT 1; +INSERT INTO `tbl_settings` (`id`, `category`, `name`, `value`) VALUES (NULL, 'install', 'hash', SHA2(UUID(),256)); diff --git a/install/step1.php b/install/step1.php index 54c79d9..3f85e06 100644 --- a/install/step1.php +++ b/install/step1.php @@ -1,80 +1,85 @@ 'session', 'Gettext' => 'gettext', - 'Filter' => 'filter' + 'Filter' => 'filter' ); $arrOptionalExt = array( - 'FTP' => 'ftp', - 'SSH2' => 'ssh2' + 'FTP' => 'ftp', + 'SSH2' => 'ssh2' ); $arrSupportedDBs = array( - 'MySQLi' => 'mysqli' + 'MySQLi' => 'mysqli' ); $arrIniCheck = array( - 'file_uploads' => 1, - 'session.auto_start' => 0, + 'file_uploads' => 1, + 'session.auto_start' => 0, 'suhosin.session.encrypt' => 0, - 'date.timezone' => '-NOTEMPTY-' + 'date.timezone' => '-NOTEMPTY-' ); $arrSourceURLs = array( - 'Sockets' => 'http://www.php.net/manual/en/book.sockets.php', - 'Session' => 'http://www.php.net/manual/en/book.session.php', - 'PCRE' => 'http://www.php.net/manual/en/book.pcre.php', - 'FileInfo' => 'http://www.php.net/manual/en/book.fileinfo.php', - 'Mcrypt' => 'http://www.php.net/manual/en/book.mcrypt.php', - 'OpenSSL' => 'http://www.php.net/manual/en/book.openssl.php', - 'JSON' => 'http://www.php.net/manual/en/book.json.php', - 'DOM' => 'http://www.php.net/manual/en/book.dom.php', - 'Intl' => 'http://www.php.net/manual/en/book.intl.php', - 'gettext' => 'http://www.php.net/manual/en/book.gettext.php', - 'curl' => 'http://www.php.net/manual/en/book.curl.php', - 'Filter' => 'http://www.php.net/manual/en/book.filter.php', - 'XML' => 'http://www.php.net/manual/en/book.xml.php', - 'SimpleXML' => 'http://www.php.net/manual/en/book.simplexml.php', - 'FTP' => 'http://www.php.net/manual/en/book.ftp.php', - 'MySQL' => 'http://php.net/manual/de/book.mysqli.php', - 'PEAR' => 'http://pear.php.net', - 'date.timezone' => 'http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone', - 'SSH2' => 'http://pecl.php.net/package/ssh2' + 'Sockets' => 'https://www.php.net/manual/en/book.sockets.php', + 'Session' => 'https://www.php.net/manual/en/book.session.php', + 'PCRE' => 'https://www.php.net/manual/en/book.pcre.php', + 'FileInfo' => 'https://www.php.net/manual/en/book.fileinfo.php', + 'Mcrypt' => 'https://www.php.net/manual/en/book.mcrypt.php', + 'OpenSSL' => 'https://www.php.net/manual/en/book.openssl.php', + 'JSON' => 'https://www.php.net/manual/en/book.json.php', + 'DOM' => 'https://www.php.net/manual/en/book.dom.php', + 'Intl' => 'https://www.php.net/manual/en/book.intl.php', + 'gettext' => 'https://www.php.net/manual/en/book.gettext.php', + 'curl' => 'https://www.php.net/manual/en/book.curl.php', + 'Filter' => 'https://www.php.net/manual/en/book.filter.php', + 'XML' => 'https://www.php.net/manual/en/book.xml.php', + 'SimpleXML' => 'https://www.php.net/manual/en/book.simplexml.php', + 'FTP' => 'https://www.php.net/manual/en/book.ftp.php', + 'MySQL' => 'https://php.net/manual/de/book.mysqli.php', + 'PEAR' => 'https://pear.php.net', + 'date.timezone' => 'https://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone', + 'SSH2' => 'https://pecl.php.net/package/ssh2' ); -// -// Build content -// ============= -$arrTemplate['STEP1_BOX'] = $myInstClass->translate('Requirements'); -$arrTemplate['STEP2_BOX'] = $myInstClass->translate('Installation'); -$arrTemplate['STEP3_BOX'] = $myInstClass->translate('Finish'); -$arrTemplate['STEP1_TITLE'] = 'NagiosQL ' .$myInstClass->translate('Installation'). ': ' . +/* +Build content +*/ +$arrTemplate['STEP1_BOX'] = $myInstClass->translate('Requirements'); +$arrTemplate['STEP2_BOX'] = $myInstClass->translate('Installation'); +$arrTemplate['STEP3_BOX'] = $myInstClass->translate('Finish'); +$arrTemplate['STEP1_TITLE'] = 'NagiosQL ' . $myInstClass->translate('Installation') . ': ' . $myInstClass->translate('Checking requirements'); $arrTemplate['STEP1_SUBTITLE1'] = $myInstClass->translate('Checking Client'); $arrTemplate['STEP1_SUBTITLE2'] = $myInstClass->translate('Checking PHP version'); @@ -82,17 +87,13 @@ $arrTemplate['STEP1_SUBTITLE3'] = $myInstClass->translate('Checking PHP extensio $arrTemplate['STEP1_SUBTITLE4'] = $myInstClass->translate('Checking available database interfaces'); $arrTemplate['STEP1_SUBTITLE5'] = $myInstClass->translate('Checking php.ini/.htaccess settings'); $arrTemplate['STEP1_SUBTITLE6'] = $myInstClass->translate('Checking System Permission'); -$arrTemplate['STEP1_TEXT3_1'] = $myInstClass->translate('The following modules/extensions are required ' - . 'to run NagiosQL'); -$arrTemplate['STEP1_TEXT3_2'] = $myInstClass->translate('The next couple of extensions are optional but ' - . 'recommended'); -$arrTemplate['STEP1_TEXT4_1'] = $myInstClass->translate('Check which of the supported extensions are installed. At ' - . 'least one of them is required.'); -$arrTemplate['STEP1_TEXT5_1'] = $myInstClass->translate('The following settings are required to run ' - . 'NagiosQL'); -// -// Conditional checks -// ======================= +$arrTemplate['STEP1_TEXT3_1'] = $myInstClass->translate('The following modules/extensions are required to run NagiosQL'); +$arrTemplate['STEP1_TEXT3_2'] = $myInstClass->translate('The next couple of extensions are optional but recommended'); +$arrTemplate['STEP1_TEXT4_1'] = $myInstClass->translate('Check which of the supported extensions are installed. At least one of them is required.'); +$arrTemplate['STEP1_TEXT5_1'] = $myInstClass->translate('The following settings are required to run NagiosQL'); +/* +Conditional checks +*/ $strHTMLPart1 = 'valid '; $strHTMLPart2 = 'invalid '; $strHTMLPart3 = 'warning '; @@ -102,62 +103,80 @@ $strHTMLPart6 = ': '; $strHTMLPart7 = 'online help'; -// Javascript check -if ($_SESSION['install']['jscript'] == 'yes') { - $arrTemplate['CHECK_1_PIC'] = 'valid'; +/* Javascript check */ +if ($_SESSION['install']['jscript'] === 'yes') { + $arrTemplate['CHECK_1_PIC'] = 'valid'; $arrTemplate['CHECK_1_CLASS'] = 'green'; $arrTemplate['CHECK_1_VALUE'] = $myInstClass->translate('ENABLED'); - $arrTemplate['CHECK_1_INFO'] = ''; + $arrTemplate['CHECK_1_INFO'] = ''; } else { - $arrTemplate['CHECK_1_PIC'] = 'invalid'; + $arrTemplate['CHECK_1_PIC'] = 'invalid'; $arrTemplate['CHECK_1_CLASS'] = 'green'; $arrTemplate['CHECK_1_VALUE'] = $myInstClass->translate('NOT ENABLED'); - $arrTemplate['CHECK_1_INFO'] = '(' .$myInstClass->translate('After enabling Javascript, the page must be updated ' - . 'twice so that the status changes'). ')'; + $arrTemplate['CHECK_1_INFO'] = '(' . $myInstClass->translate('After enabling Javascript, the page must be updated ' + . 'twice so that the status changes') . ')'; } -// PHP version check -$strMinPHPVersion = '5.5.0'; +/* PHP version check */ +$strMinPHPVersion = '7.2.0'; $arrTemplate['CHECK_2_TEXT'] = $myInstClass->translate('Version'); if (version_compare(PHP_VERSION, $strMinPHPVersion, '>=')) { - $arrTemplate['CHECK_2_PIC'] = 'valid'; + $arrTemplate['CHECK_2_PIC'] = 'valid'; $arrTemplate['CHECK_2_CLASS'] = 'green'; $arrTemplate['CHECK_2_VALUE'] = $myInstClass->translate('OK'); - $arrTemplate['CHECK_2_INFO'] = '(PHP ' . PHP_VERSION . ' ' .$myInstClass->translate('detected'). ')'; + $arrTemplate['CHECK_2_INFO'] = '(PHP ' . PHP_VERSION . ' ' . $myInstClass->translate('detected') . ')'; } else { - $arrTemplate['CHECK_2_PIC'] = 'invalid'; + $arrTemplate['CHECK_2_PIC'] = 'invalid'; $arrTemplate['CHECK_2_CLASS'] = 'green'; - $arrTemplate['CHECK_2_VALUE'] = 'PHP ' . PHP_VERSION . ' ' .$myInstClass->translate('detected'); - $arrTemplate['CHECK_2_INFO'] = '(PHP ' . $strMinPHPVersion . ' ' .$myInstClass->translate('or greater is ' - . 'required'). ')'; + $arrTemplate['CHECK_2_VALUE'] = 'PHP ' . PHP_VERSION . ' ' . $myInstClass->translate('detected'); + $arrTemplate['CHECK_2_INFO'] = '(PHP ' . $strMinPHPVersion . ' ' . $myInstClass->translate('or greater is ' + . 'required') . ')'; $intError = 1; } -// PHP modules / extensions +/* PHP modules / extensions */ $strExtPath = ini_get('extension_dir'); -$strPrefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : ''; -$strHTML1 = ''; +$strPrefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : ''; +$strHTML1 = ''; +/* Check for pear */ +$intErrorReporting = error_reporting(); +error_reporting(0); +include_once 'System.php'; +error_reporting($intErrorReporting); +$intPearResult = 0; +if (class_exists('System')) { + $intPearResult = 1; +} +if ($intPearResult === 1) { + $strHTML1 .= $strHTMLPart1 . 'PEAR' . $strHTMLPart4 . $myInstClass->translate('OK') . "\n"; +} else { + $strMsg = '' . $strHTMLPart7 . ''; + $strHTML1 .= $strHTMLPart2 . 'PEAR' . $strHTMLPart5 . $myInstClass->translate('NOT AVAILABLE') . ' (' . $strMsg . ')' + . "\n"; + $intError = 1; +} +$strHTML1 .= "
\n"; foreach ($arrRequiredExt as $key => $elem) { if (extension_loaded($elem)) { - $strHTML1 .= $strHTMLPart1.$key.$strHTMLPart4.$myInstClass->translate('OK')."\n"; + $strHTML1 .= $strHTMLPart1 . $key . $strHTMLPart4 . $myInstClass->translate('OK') . "\n"; } else { - $strPath = $strExtPath. '/' .$strPrefix.$elem. '.' .PHP_SHLIB_SUFFIX; - $strMsg = is_readable($strPath) ? $myInstClass->translate('Could be loaded. Please add in php.ini') - : '' .$strHTMLPart7. ''; - $strHTML1 .= $strHTMLPart2.$key.$strHTMLPart5.$myInstClass->translate('NOT AVAILABLE'). ' (' .$strMsg. ')' + $strPath = $strExtPath . '/' . $strPrefix . $elem . '.' . PHP_SHLIB_SUFFIX; + $strMsg = is_readable($strPath) ? $myInstClass->translate('Could be loaded. Please add in php.ini') + : '' . $strHTMLPart7 . ''; + $strHTML1 .= $strHTMLPart2 . $key . $strHTMLPart5 . $myInstClass->translate('NOT AVAILABLE') . ' (' . $strMsg . ')' . "\n"; - $intError = 1; + $intError = 1; } $strHTML1 .= "
\n"; } $arrTemplate['CHECK_3_CONTENT_1'] = $strHTML1; -$strHTML2 = ''; +$strHTML2 = ''; foreach ($arrOptionalExt as $key => $elem) { if (extension_loaded($elem)) { - $strHTML2 .= $strHTMLPart1.$key.$strHTMLPart4.$myInstClass->translate('OK')."\n"; + $strHTML2 .= $strHTMLPart1 . $key . $strHTMLPart4 . $myInstClass->translate('OK') . "\n"; } else { - $strPath = $strExtPath. '/' .$strPrefix.$elem. '.' .PHP_SHLIB_SUFFIX; - $strMsg = is_readable($strPath) ? $myInstClass->translate('Could be loaded. Please add in php.ini') - : '' .$strHTMLPart7. ''; - $strHTML2 .= $strHTMLPart3.$key.$strHTMLPart6.$myInstClass->translate('NOT AVAILABLE'). ' (' .$strMsg. ')' + $strPath = $strExtPath . '/' . $strPrefix . $elem . '.' . PHP_SHLIB_SUFFIX; + $strMsg = is_readable($strPath) ? $myInstClass->translate('Could be loaded. Please add in php.ini') + : '' . $strHTMLPart7 . ''; + $strHTML2 .= $strHTMLPart3 . $key . $strHTMLPart6 . $myInstClass->translate('NOT AVAILABLE') . ' (' . $strMsg . ')' . "\n"; //$intError = 1; } @@ -166,164 +185,162 @@ foreach ($arrOptionalExt as $key => $elem) { $arrTemplate['CHECK_3_CONTENT_2'] = $strHTML2; // PHP database interfaces $strHTML3 = ''; -$intTemp = 0; +$intTemp = 0; $_SESSION['install']['dbtype_available'] = array(); foreach ($arrSupportedDBs as $key => $elem) { if (extension_loaded($elem)) { $strNewInstallOnly = ''; - if (isset($_SESSION['install']['dbtype']) && ($_SESSION['install']['mode'] == 'Update') && - ($_SESSION['install']['dbtype'] != $elem) && + if (isset($_SESSION['install']['dbtype']) && ($_SESSION['install']['mode'] === 'Update') && + ($_SESSION['install']['dbtype'] !== $elem) && (0 !== strpos($_SESSION['install']['dbtype'], substr($elem, 0, 5)))) { - $strNewInstallOnly = ' (' .$myInstClass->translate('New installation only - updates are only supported ' - . 'using the same database interface!'). ')'; + $strNewInstallOnly = ' (' . $myInstClass->translate('New installation only - updates are only supported ' + . 'using the same database interface!') . ')'; } - $strHTML3 .= $strHTMLPart1.$key.$strHTMLPart4.$myInstClass->translate('OK')." $strNewInstallOnly\n"; - if ($strNewInstallOnly == '') { + $strHTML3 .= $strHTMLPart1 . $key . $strHTMLPart4 . $myInstClass->translate('OK') . " $strNewInstallOnly\n"; + if ($strNewInstallOnly === '') { $_SESSION['install']['dbtype_available'][] = $elem; } $intTemp++; } else { - $strPath = $strExtPath. '/' .$strPrefix.$elem. '.' .PHP_SHLIB_SUFFIX; - $strMsg = is_readable($strPath) ? $myInstClass->translate('Could be loaded. Please add in php.ini') - : '' .$strHTMLPart7. ''; - $strHTML3 .= $strHTMLPart2.$key.$strHTMLPart5.$myInstClass->translate('NOT AVAILABLE'). ' (' .$strMsg. ')' + $strPath = $strExtPath . '/' . $strPrefix . $elem . '.' . PHP_SHLIB_SUFFIX; + $strMsg = is_readable($strPath) ? $myInstClass->translate('Could be loaded. Please add in php.ini') + : '' . $strHTMLPart7 . ''; + $strHTML3 .= $strHTMLPart2 . $key . $strHTMLPart5 . $myInstClass->translate('NOT AVAILABLE') . ' (' . $strMsg . ')' . "\n"; } $strHTML3 .= "
\n"; } $arrTemplate['CHECK_4_CONTENT_1'] = $strHTML3; -if ($intTemp == 0) { +if ($intTemp === 0) { $intError = 1; } -// PHP ini checks +/* PHP ini checks */ $strHTML4 = ''; foreach ($arrIniCheck as $key => $elem) { $strStatus = ini_get($key); if ($elem === '-NOTEMPTY-') { if (empty($strStatus)) { - $strHTML4 .= $strHTMLPart2.$key.$strHTMLPart5.$myInstClass->translate('NOT AVAILABLE'). ' (' . - $myInstClass->translate('cannot be empty and needs to be set').")\n"; + $strHTML4 .= $strHTMLPart2 . $key . $strHTMLPart5 . $myInstClass->translate('NOT AVAILABLE') . ' (' . + $myInstClass->translate('cannot be empty and needs to be set') . ")\n"; $intError = 1; } else { - $strHTML4 .= $strHTMLPart1.$key.$strHTMLPart4.$myInstClass->translate('OK')."\n"; + $strHTML4 .= $strHTMLPart1 . $key . $strHTMLPart4 . $myInstClass->translate('OK') . "\n"; } + } else if (($strStatus === $elem) || ((int)$strStatus === $elem)) { + $strHTML4 .= $strHTMLPart1 . $key . $strHTMLPart4 . $myInstClass->translate('OK') . "\n"; } else { - if ($strStatus == $elem) { - $strHTML4 .= $strHTMLPart1.$key.$strHTMLPart4.$myInstClass->translate('OK')."\n"; - } else { - $strHTML4 .= $strHTMLPart2.$key.$strHTMLPart5.$strStatus. ' (' .$myInstClass->translate('should be'). ' ' . - $elem.")\n"; - $intError = 1; - } + $strHTML4 .= $strHTMLPart2 . $key . $strHTMLPart5 . $strStatus . ' (' . $myInstClass->translate('should be') . ' ' . + $elem . ")\n"; + $intError = 1; } $strHTML4 .= "
\n"; } $arrTemplate['CHECK_5_CONTENT_1'] = $strHTML4; -// File access checks +/* File access checks */ $strConfigFile = '../config/settings.php'; if (file_exists($strConfigFile) && is_readable($strConfigFile)) { - $arrTemplate['CHECK_6_CONTENT_1'] = $strHTMLPart1.$myInstClass->translate('Read test on settings file ' - . '(config/settings.php)').$strHTMLPart4.$myInstClass->translate('OK')."
\n"; -} elseif (file_exists($strConfigFile)&& !is_readable($strConfigFile)) { - $arrTemplate['CHECK_6_CONTENT_1'] = $strHTMLPart2.$myInstClass->translate('Read test on settings file ' - . '(config/settings.php)').$strHTMLPart5.$myInstClass->translate('failed')."
\n"; + $arrTemplate['CHECK_6_CONTENT_1'] = $strHTMLPart1 . $myInstClass->translate('Read test on settings file ' + . '(config/settings.php)') . $strHTMLPart4 . $myInstClass->translate('OK') . "
\n"; +} elseif (file_exists($strConfigFile) && !is_readable($strConfigFile)) { + $arrTemplate['CHECK_6_CONTENT_1'] = $strHTMLPart2 . $myInstClass->translate('Read test on settings file ' + . '(config/settings.php)') . $strHTMLPart5 . $myInstClass->translate('failed') . "
\n"; } elseif (!file_exists($strConfigFile)) { - $arrTemplate['CHECK_6_CONTENT_1'] = $strHTMLPart3.$myInstClass->translate('Settings file does not exists ' - . '(config/settings.php)').$strHTMLPart6.$myInstClass->translate('will be created')."
\n"; + $arrTemplate['CHECK_6_CONTENT_1'] = $strHTMLPart3 . $myInstClass->translate('Settings file does not exists ' + . '(config/settings.php)') . $strHTMLPart6 . $myInstClass->translate('will be created') . "
\n"; } if (file_exists($strConfigFile) && is_writable($strConfigFile)) { - $arrTemplate['CHECK_6_CONTENT_2'] = $strHTMLPart1.$myInstClass->translate('Write test on settings file ' - . '(config/settings.php)').$strHTMLPart4.$myInstClass->translate('OK')."
\n"; + $arrTemplate['CHECK_6_CONTENT_2'] = $strHTMLPart1 . $myInstClass->translate('Write test on settings file ' + . '(config/settings.php)') . $strHTMLPart4 . $myInstClass->translate('OK') . "
\n"; } elseif (is_writable('../config') && !file_exists($strConfigFile)) { - $arrTemplate['CHECK_6_CONTENT_2'] = $strHTMLPart1.$myInstClass->translate('Write test on settings directory ' - . '(config/)').$strHTMLPart4.$myInstClass->translate('OK')."
\n"; + $arrTemplate['CHECK_6_CONTENT_2'] = $strHTMLPart1 . $myInstClass->translate('Write test on settings directory ' + . '(config/)') . $strHTMLPart4 . $myInstClass->translate('OK') . "
\n"; } elseif (file_exists($strConfigFile) && !is_writable($strConfigFile)) { - $arrTemplate['CHECK_6_CONTENT_2'] = $strHTMLPart2.$myInstClass->translate('Write test on settings file ' - . '(config/settings.php)').$strHTMLPart5.$myInstClass->translate('failed')."
\n"; + $arrTemplate['CHECK_6_CONTENT_2'] = $strHTMLPart2 . $myInstClass->translate('Write test on settings file ' + . '(config/settings.php)') . $strHTMLPart5 . $myInstClass->translate('failed') . "
\n"; $intError = 1; } else { - $arrTemplate['CHECK_6_CONTENT_2'] = $strHTMLPart2.$myInstClass->translate('Write test on settings directory ' - . '(config/)').$strHTMLPart5.$myInstClass->translate('failed')."
\n"; + $arrTemplate['CHECK_6_CONTENT_2'] = $strHTMLPart2 . $myInstClass->translate('Write test on settings directory ' + . '(config/)') . $strHTMLPart5 . $myInstClass->translate('failed') . "
\n"; $intError = 1; } $strClassFile = '../functions/NagVisualClass.php'; if (file_exists($strClassFile) && is_readable($strClassFile)) { - $arrTemplate['CHECK_6_CONTENT_3'] = $strHTMLPart1.$myInstClass->translate('Read test on one class file ' - . '(functions/NagVisualClass.php)').$strHTMLPart4.$myInstClass->translate('OK')."
\n"; + $arrTemplate['CHECK_6_CONTENT_3'] = $strHTMLPart1 . $myInstClass->translate('Read test on one class file ' + . '(functions/NagVisualClass.php)') . $strHTMLPart4 . $myInstClass->translate('OK') . "
\n"; } else { - $arrTemplate['CHECK_6_CONTENT_3'] = $strHTMLPart2.$myInstClass->translate('Read test on one class file ' - . '(functions/NagVisualClass.php)').$strHTMLPart5.$myInstClass->translate('failed')."
\n"; + $arrTemplate['CHECK_6_CONTENT_3'] = $strHTMLPart2 . $myInstClass->translate('Read test on one class file ' + . '(functions/NagVisualClass.php)') . $strHTMLPart5 . $myInstClass->translate('failed') . "
\n"; $intError = 1; } $strFile1 = '../admin.php'; if (file_exists($strFile1) && is_readable($strFile1)) { - $arrTemplate['CHECK_6_CONTENT_4'] = $strHTMLPart1.$myInstClass->translate('Read test on home page file ' - . '(admin.php)').$strHTMLPart4.$myInstClass->translate('OK')."
\n"; + $arrTemplate['CHECK_6_CONTENT_4'] = $strHTMLPart1 . $myInstClass->translate('Read test on home page file ' + . '(admin.php)') . $strHTMLPart4 . $myInstClass->translate('OK') . "
\n"; } else { - $arrTemplate['CHECK_6_CONTENT_4'] = $strHTMLPart2.$myInstClass->translate('Read test on home page file ' - . '(admin.php)').$strHTMLPart5.$myInstClass->translate('failed')."
\n"; + $arrTemplate['CHECK_6_CONTENT_4'] = $strHTMLPart2 . $myInstClass->translate('Read test on home page file ' + . '(admin.php)') . $strHTMLPart5 . $myInstClass->translate('failed') . "
\n"; $intError = 1; } $strFile2 = '../templates/index.htm.tpl'; if (file_exists($strFile2) && is_readable($strFile2)) { - $arrTemplate['CHECK_6_CONTENT_5'] = $strHTMLPart1.$myInstClass->translate('Read test on one template file ' - . '(templates/index.tpl.htm)').$strHTMLPart4.$myInstClass->translate('OK')."
\n"; + $arrTemplate['CHECK_6_CONTENT_5'] = $strHTMLPart1 . $myInstClass->translate('Read test on one template file ' + . '(templates/index.tpl.htm)') . $strHTMLPart4 . $myInstClass->translate('OK') . "
\n"; } else { - $arrTemplate['CHECK_6_CONTENT_5'] = $strHTMLPart2.$myInstClass->translate('Read test on one template file ' - . '(templates/index.tpl.htm)').$strHTMLPart5.$myInstClass->translate('failed')."
\n"; + $arrTemplate['CHECK_6_CONTENT_5'] = $strHTMLPart2 . $myInstClass->translate('Read test on one template file ' + . '(templates/index.tpl.htm)') . $strHTMLPart5 . $myInstClass->translate('failed') . "
\n"; $intError = 1; } $strFile3 = '../templates/admin/datalist.htm.tpl'; if (file_exists($strFile3) && is_readable($strFile3)) { - $arrTemplate['CHECK_6_CONTENT_6'] = $strHTMLPart1.$myInstClass->translate('Read test on one admin template file ' - . '(templates/admin/datalist.htm.tpl)').$strHTMLPart4.$myInstClass->translate('OK')."
\n"; + $arrTemplate['CHECK_6_CONTENT_6'] = $strHTMLPart1 . $myInstClass->translate('Read test on one admin template file ' + . '(templates/admin/datalist.htm.tpl)') . $strHTMLPart4 . $myInstClass->translate('OK') . "
\n"; } else { - $arrTemplate['CHECK_6_CONTENT_6'] = $strHTMLPart2.$myInstClass->translate('Read test on one admin template file ' - . '(templates/admin/datalist.htm.tpl)').$strHTMLPart5.$myInstClass->translate('failed')."
\n"; + $arrTemplate['CHECK_6_CONTENT_6'] = $strHTMLPart2 . $myInstClass->translate('Read test on one admin template file ' + . '(templates/admin/datalist.htm.tpl)') . $strHTMLPart5 . $myInstClass->translate('failed') . "
\n"; $intError = 1; } $strFile4 = '../templates/files/contacts.tpl.dat'; if (file_exists($strFile4) && is_readable($strFile4)) { - $arrTemplate['CHECK_6_CONTENT_7'] = $strHTMLPart1.$myInstClass->translate('Read test on one file template ' - . '(templates/files/contacts.tpl.dat)').$strHTMLPart4.$myInstClass->translate('OK')."
\n"; + $arrTemplate['CHECK_6_CONTENT_7'] = $strHTMLPart1 . $myInstClass->translate('Read test on one file template ' + . '(templates/files/contacts.tpl.dat)') . $strHTMLPart4 . $myInstClass->translate('OK') . "
\n"; } else { - $arrTemplate['CHECK_6_CONTENT_7'] = $strHTMLPart2.$myInstClass->translate('Read test on one file template ' - . '(templates/files/contacts.tpl.dat)').$strHTMLPart5.$myInstClass->translate('failed')."
\n"; + $arrTemplate['CHECK_6_CONTENT_7'] = $strHTMLPart2 . $myInstClass->translate('Read test on one file template ' + . '(templates/files/contacts.tpl.dat)') . $strHTMLPart5 . $myInstClass->translate('failed') . "
\n"; $intError = 1; } $strFile5 = '../images/pixel.gif'; if (file_exists($strFile5) && is_readable($strFile5)) { - $arrTemplate['CHECK_6_CONTENT_8'] = $strHTMLPart1.$myInstClass->translate('Read test on one image file ' - . '(images/pixel.gif)').$strHTMLPart4.$myInstClass->translate('OK')."
\n"; + $arrTemplate['CHECK_6_CONTENT_8'] = $strHTMLPart1 . $myInstClass->translate('Read test on one image file ' + . '(images/pixel.gif)') . $strHTMLPart4 . $myInstClass->translate('OK') . "
\n"; } else { - $arrTemplate['CHECK_6_CONTENT_9'] = $strHTMLPart2.$myInstClass->translate('Read test on one image file ' - . '(images/pixel.gif)').$strHTMLPart5.$myInstClass->translate('failed')."
\n"; + $arrTemplate['CHECK_6_CONTENT_8'] = $strHTMLPart2 . $myInstClass->translate('Read test on one image file ' + . '(images/pixel.gif)') . $strHTMLPart5 . $myInstClass->translate('failed') . "
\n"; $intError = 1; } -if ($intError != 0) { - $arrTemplate['MESSAGE'] = '' .$myInstClass->translate('There are some errors - please ' - . 'check your system settings and read the requirements of NagiosQL!')."

\n"; - $arrTemplate['MESSAGE'] .= $myInstClass->translate('Read the INSTALLATION file in the NagiosQL doc directory ' +if ($intError !== 0) { + $arrTemplate['MESSAGE'] = '' . $myInstClass->translate('There are some errors - please ' + . 'check your system settings and read the requirements of NagiosQL!') . "

\n"; + $arrTemplate['MESSAGE'] .= $myInstClass->translate('Read the INSTALLATION file in the NagiosQL doc directory ' . 'or the installation PDF file on our'); - $arrTemplate['MESSAGE'] .= ' '; - $arrTemplate['MESSAGE'] .= $myInstClass->translate('online documentation'). '
' . - $myInstClass->translate('site to find out, how to fix them.') ."
\n"; - $arrTemplate['MESSAGE'] .= $myInstClass->translate('After that - refresh this page to proceed') ."...
\n"; - $arrTemplate['DIV_ID'] = 'install-center'; - $arrTemplate['FORM_CONTENT'] = 'translate('online documentation') . '
' . + $myInstClass->translate('site to find out, how to fix them.') . "
\n"; + $arrTemplate['MESSAGE'] .= $myInstClass->translate('After that - refresh this page to proceed') . "...
\n"; + $arrTemplate['DIV_ID'] = 'install-center'; + $arrTemplate['FORM_CONTENT'] = '
'; - $arrTemplate['FORM_CONTENT'] .= $myInstClass->translate('Refresh')."\n"; + $arrTemplate['FORM_CONTENT'] .= $myInstClass->translate('Refresh') . "\n"; } else { - $arrTemplate['MESSAGE'] = '' .$myInstClass->translate('Environment test completed ' - . 'successfully')."

\n"; - $arrTemplate['DIV_ID'] = 'install-next'; - $arrTemplate['FORM_CONTENT'] = "\n"; + $arrTemplate['MESSAGE'] = '' . $myInstClass->translate('Environment test completed ' + . 'successfully') . "

\n"; + $arrTemplate['DIV_ID'] = 'install-next'; + $arrTemplate['FORM_CONTENT'] = "\n"; $arrTemplate['FORM_CONTENT'] .= '
' .$myInstClass->translate('Next')."\n"; + . 'alt="next">
' . $myInstClass->translate('Next') . "\n"; } -// -// Write content -// ============= +/* +Write content +*/ $strContent = $myInstClass->parseTemplate($arrTemplate, $preIncludeContent); -echo $strContent; +echo $strContent; \ No newline at end of file diff --git a/install/step2.php b/install/step2.php index 6bef8c3..a1edef4 100644 --- a/install/step2.php +++ b/install/step2.php @@ -1,131 +1,136 @@ translate('The NagiosQL first passwords are not equal!'); $arrTemplate['FIELDS_MESSAGE'] = $myInstClass->translate('Please fill in all fields marked with an *'); -$arrTemplate['STEP1_BOX'] = $myInstClass->translate('Requirements'); -$arrTemplate['STEP2_BOX'] = $myInstClass->translate('Installation'); -$arrTemplate['STEP3_BOX'] = $myInstClass->translate('Finish'); -$arrTemplate['STEP2_TITLE'] = 'NagiosQL ' .$myInstClass->translate('Installation'). ': ' . - $myInstClass->translate('Setup'); -$arrTemplate['STEP2_TEXT1_1'] = $myInstClass->translate('Please complete the form below. Mandatory fields marked ' - . '*'); -$arrTemplate['STEP2_TEXT2_1'] = $myInstClass->translate('Database Configuration'); -$arrTemplate['STEP2_TEXT2_2'] = $myInstClass->translate('Database Type'); +$arrTemplate['STEP1_BOX'] = $myInstClass->translate('Requirements'); +$arrTemplate['STEP2_BOX'] = $myInstClass->translate('Installation'); +$arrTemplate['STEP3_BOX'] = $myInstClass->translate('Finish'); +$arrTemplate['STEP2_TITLE'] = 'NagiosQL ' . $myInstClass->translate('Installation') . ': ' . + $myInstClass->translate('Setup'); +$arrTemplate['STEP2_TEXT1_1'] = $myInstClass->translate('Please complete the form below. Mandatory fields marked ' + . '*'); +$arrTemplate['STEP2_TEXT2_1'] = $myInstClass->translate('Database Configuration'); +$arrTemplate['STEP2_TEXT2_2'] = $myInstClass->translate('Database Type'); $strSelected = ''; -if (is_array($_SESSION['install']['dbtype_available']) && (count($_SESSION['install']['dbtype_available']) != 0)) { - $strDBType = ''; +$strDBType = ''; +if (is_array($_SESSION['install']['dbtype_available']) && (count($_SESSION['install']['dbtype_available']) !== 0)) { foreach ((array)$_SESSION['install']['dbtype_available'] as $elem) { - if (isset($_SESSION['install']['dbtype']) && ($_SESSION['install']['dbtype'] == $elem)) { + if (isset($_SESSION['install']['dbtype']) && ($_SESSION['install']['dbtype'] === $elem)) { $strSelected = 'selected="selected"'; } - $strDBType .= '\n"; + $strDBType .= '\n"; } } else { $strDBType .= "\n"; } -$arrTemplate['STEP2_VALUE2_2'] = $strDBType; -$arrTemplate['STEP2_TEXT2_3'] = $myInstClass->translate('Database Server'); -$arrTemplate['STEP2_VALUE2_3'] = htmlspecialchars($_SESSION['install']['dbserver'], ENT_QUOTES, 'utf-8'); -$arrTemplate['STEP2_TEXT2_4'] = $myInstClass->translate('Local hostname or IP address'); -if (htmlspecialchars($_SESSION['install']['dbserver'], ENT_QUOTES, 'utf-8') == 'localhost') { +$arrTemplate['STEP2_VALUE2_2'] = $strDBType; +$arrTemplate['STEP2_TEXT2_3'] = $myInstClass->translate('Database Server'); +$arrTemplate['STEP2_VALUE2_3'] = htmlspecialchars($_SESSION['install']['dbserver'], ENT_QUOTES, 'utf-8'); +$arrTemplate['STEP2_TEXT2_4'] = $myInstClass->translate('Local hostname or IP address'); +if (htmlspecialchars($_SESSION['install']['dbserver'], ENT_QUOTES, 'utf-8') === 'localhost') { $arrTemplate['STEP2_VALUE2_4'] = htmlspecialchars($_SESSION['install']['dbserver'], ENT_QUOTES, 'utf-8'); } else { - $arrTemplate['STEP2_VALUE2_4'] = filter_input(INPUT_SERVER, 'SERVER_ADDR', FILTER_SANITIZE_STRING); + $arrTemplate['STEP2_VALUE2_4'] = filter_input(INPUT_SERVER, 'SERVER_ADDR'); } -$arrTemplate['STEP2_TEXT2_5'] = $myInstClass->translate('Database Server Port'); -$arrTemplate['STEP2_VALUE2_5'] = htmlspecialchars($_SESSION['install']['dbport'], ENT_QUOTES, 'utf-8'); -$arrTemplate['STEP2_TEXT2_6'] = $myInstClass->translate('Database name'); -$arrTemplate['STEP2_VALUE2_6'] = htmlspecialchars($_SESSION['install']['dbname'], ENT_QUOTES, 'utf-8'); -$arrTemplate['STEP2_TEXT2_7'] = $myInstClass->translate('NagiosQL DB User'); -$arrTemplate['STEP2_VALUE2_7'] = htmlspecialchars($_SESSION['install']['dbuser'], ENT_QUOTES, 'utf-8'); -$arrTemplate['STEP2_TEXT2_8'] = $myInstClass->translate('NagiosQL DB Password'); -$arrTemplate['STEP2_VALUE2_8'] = htmlspecialchars($_SESSION['install']['dbpass'], ENT_QUOTES, 'utf-8'); -$arrTemplate['STEP2_TEXT2_9'] = $myInstClass->translate('Administrative Database User'); -$arrTemplate['STEP2_VALUE2_9'] = htmlspecialchars($_SESSION['install']['admuser'], ENT_QUOTES, 'utf-8'); -$arrTemplate['STEP2_TEXT2_10'] = $myInstClass->translate('Administrative Database Password'); -$arrTemplate['STEP2_TEXT2_11'] = $myInstClass->translate('Drop database if already exists?'); -if ($_SESSION['install']['dbdrop'] == 1) { +$arrTemplate['STEP2_TEXT2_5'] = $myInstClass->translate('Database Server Port'); +$arrTemplate['STEP2_VALUE2_5'] = htmlspecialchars($_SESSION['install']['dbport'], ENT_QUOTES, 'utf-8'); +$arrTemplate['STEP2_TEXT2_6'] = $myInstClass->translate('Database name'); +$arrTemplate['STEP2_VALUE2_6'] = htmlspecialchars($_SESSION['install']['dbname'], ENT_QUOTES, 'utf-8'); +$arrTemplate['STEP2_TEXT2_7'] = $myInstClass->translate('NagiosQL DB User'); +$arrTemplate['STEP2_VALUE2_7'] = htmlspecialchars($_SESSION['install']['dbuser'], ENT_QUOTES, 'utf-8'); +$arrTemplate['STEP2_TEXT2_8'] = $myInstClass->translate('NagiosQL DB Password'); +$arrTemplate['STEP2_VALUE2_8'] = htmlspecialchars($_SESSION['install']['dbpass'], ENT_QUOTES, 'utf-8'); +$arrTemplate['STEP2_TEXT2_9'] = $myInstClass->translate('Administrative Database User'); +$arrTemplate['STEP2_VALUE2_9'] = htmlspecialchars($_SESSION['install']['admuser'], ENT_QUOTES, 'utf-8'); +$arrTemplate['STEP2_TEXT2_10'] = $myInstClass->translate('Administrative Database Password'); +$arrTemplate['STEP2_TEXT2_11'] = $myInstClass->translate('Drop database if already exists?'); +if ($_SESSION['install']['dbdrop'] === 1) { $arrTemplate['STEP2_VALUE2_11'] = 'checked'; } else { $arrTemplate['STEP2_VALUE2_11'] = ''; } -$arrTemplate['STEP2_TEXT3_1'] = $myInstClass->translate('NagiosQL User Setup'); -$arrTemplate['STEP2_TEXT3_2'] = $myInstClass->translate('Initial NagiosQL User'); +$arrTemplate['STEP2_TEXT3_1'] = $myInstClass->translate('NagiosQL User Setup'); +$arrTemplate['STEP2_TEXT3_2'] = $myInstClass->translate('Initial NagiosQL User'); $arrTemplate['STEP2_VALUE3_2'] = htmlspecialchars($_SESSION['install']['qluser'], ENT_QUOTES, 'utf-8'); -$arrTemplate['STEP2_TEXT3_3'] = $myInstClass->translate('Initial NagiosQL Password'); +$arrTemplate['STEP2_TEXT3_3'] = $myInstClass->translate('Initial NagiosQL Password'); $arrTemplate['STEP2_VALUE3_3'] = htmlspecialchars($_SESSION['install']['qlpass'], ENT_QUOTES, 'utf-8'); -$arrTemplate['STEP2_TEXT3_4'] = $myInstClass->translate('Please repeat the password'); -$arrTemplate['STEP2_TEXT4_1'] = $myInstClass->translate('Nagios Configuration'); -$arrTemplate['STEP2_TEXT4_2'] = $myInstClass->translate('Import Nagios sample config?'); -if ($_SESSION['install']['sample'] == 1) { +$arrTemplate['STEP2_TEXT3_4'] = $myInstClass->translate('Please repeat the password'); +$arrTemplate['STEP2_TEXT4_1'] = $myInstClass->translate('Nagios Configuration'); +$arrTemplate['STEP2_TEXT4_2'] = $myInstClass->translate('Import Nagios sample config?'); +if ($_SESSION['install']['sample'] === 1) { $arrTemplate['STEP2_VALUE4_2'] = 'checked'; } else { $arrTemplate['STEP2_VALUE4_2'] = ''; } -$arrTemplate['STEP2_FORM_1'] = $myInstClass->translate('Next'); +$arrTemplate['STEP2_FORM_1'] = $myInstClass->translate('Next'); $arrTemplate['STEP2_TEXT5_1'] = $myInstClass->translate('NagiosQL path values'); $arrTemplate['STEP2_TEXT5_2'] = $myInstClass->translate('Create NagiosQL config paths?'); -if ($_SESSION['install']['createpath'] == 1) { +if ($_SESSION['install']['createpath'] === 1) { $arrTemplate['STEP2_VALUE5_2'] = 'checked'; } else { $arrTemplate['STEP2_VALUE5_2'] = ''; } -$arrTemplate['STEP2_TEXT5_3'] = $myInstClass->translate('NagiosQL config path'); +$arrTemplate['STEP2_TEXT5_3'] = $myInstClass->translate('NagiosQL config path'); $arrTemplate['STEP2_VALUE5_3'] = htmlspecialchars($_SESSION['install']['qlpath'], ENT_QUOTES, 'utf-8'); -$arrTemplate['STEP2_TEXT5_4'] = $myInstClass->translate('Nagios config path'); +$arrTemplate['STEP2_TEXT5_4'] = $myInstClass->translate('Nagios config path'); $arrTemplate['STEP2_VALUE5_4'] = htmlspecialchars($_SESSION['install']['nagpath'], ENT_QUOTES, 'utf-8'); -$arrTemplate['STEP2_TEXT5_5'] = $myInstClass->translate('Both path values were stored in your configuration target ' - . 'settings for localhost.'); -$arrTemplate['STEP2_TEXT5_6'] = $myInstClass->translate('If you select the create path option, be sure that the ' - . 'NagiosQL base path exist and the webserver demon has write access to it. So the installer will create the ' - . "required subdirectories in your localhost's filesystem (hosts, services, backup etc.)"); +$arrTemplate['STEP2_TEXT5_5'] = $myInstClass->translate('Both path values were stored in your configuration target ' + . 'settings for localhost.'); +$arrTemplate['STEP2_TEXT5_6'] = $myInstClass->translate('If you select the create path option, be sure that the ' + . 'NagiosQL base path exist and the webserver demon has write access to it. So the installer will create the ' + . "required subdirectories in your localhost's filesystem (hosts, services, backup etc.)"); $arrTemplate['INSTALL_FIELDS'] = ''; -// -// Setting some template values to blank -// ===================================== +/* +Setting some template values to blank +*/ $arrTemplate['STEP2_TEXT1_2'] = ''; -// -// Conditional checks -// ======================= -if ($_SESSION['install']['mode'] == 'Update') { - $arrTemplate['STEP2_TEXT1_2'] = '

' .$myInstClass->translate('Please backup your ' - . 'database before proceeding!')."

\n"; - $arrTemplate['INST_VISIBLE'] = 'hidefield'; +/* +Conditional checks +*/ +if ($_SESSION['install']['mode'] === 'Update') { + $arrTemplate['STEP2_TEXT1_2'] = '

' . $myInstClass->translate('Please backup your ' + . 'database before proceeding!') . "

\n"; + $arrTemplate['INST_VISIBLE'] = 'hidefield'; } else { $arrTemplate['INSTALL_FIELDS'] = ',tfDBprivUser,tfDBprivPass,tfQLuser,tfQLpass'; - $arrTemplate['INST_VISIBLE'] = 'showfield'; + $arrTemplate['INST_VISIBLE'] = 'showfield'; } -// -// Write content -// ============= +/* +Write content +*/ $strContent = $myInstClass->parseTemplate($arrTemplate, $preIncludeContent); -echo $strContent; +echo $strContent; \ No newline at end of file diff --git a/install/step3.php b/install/step3.php index 11efceb..2af733b 100644 --- a/install/step3.php +++ b/install/step3.php @@ -1,62 +1,70 @@ translate('Requirements'); -$arrTemplate['STEP2_BOX'] = $myInstClass->translate('Installation'); -$arrTemplate['STEP3_BOX'] = $myInstClass->translate('Finish'); -$arrTemplate['STEP3_TITLE'] = 'NagiosQL ' .$myInstClass->translate('Installation'). ': ' . +/* +Build content +*/ +$arrTemplate['STEP1_BOX'] = $myInstClass->translate('Requirements'); +$arrTemplate['STEP2_BOX'] = $myInstClass->translate('Installation'); +$arrTemplate['STEP3_BOX'] = $myInstClass->translate('Finish'); +$arrTemplate['STEP3_TITLE'] = 'NagiosQL ' . $myInstClass->translate('Installation') . ': ' . $myInstClass->translate('Finishing Setup'); -$arrTemplate['INST_VISIBLE'] = 'showfield'; +$arrTemplate['INST_VISIBLE'] = 'showfield'; $arrTemplate['STEP4_SUB_TITLE'] = $myInstClass->translate('Deploy NagiosQL settings'); -$arrTemplate['STEP3_TEXT_01'] = $myInstClass->translate('Database server connection (privileged user)'); -$arrTemplate['STEP3_TEXT_03'] = $myInstClass->translate('Database server version'); -$arrTemplate['STEP3_TEXT_05'] = $myInstClass->translate('Database server support'); -$arrTemplate['STEP3_TEXT_07'] = $myInstClass->translate('Delete existing NagiosQL database'); -$arrTemplate['STEP3_TEXT_09'] = $myInstClass->translate('Creating new database'); -$arrTemplate['STEP3_TEXT_11'] = $myInstClass->translate('Installing NagiosQL database tables'); -$arrTemplate['STEP3_TEXT_13'] = $myInstClass->translate('Create NagiosQL database user'); -$arrTemplate['STEP3_TEXT_15'] = $myInstClass->translate('Set initial NagiosQL Administrator'); -$arrTemplate['STEP3_TEXT_17'] = $myInstClass->translate('Database server connection (NagiosQL user)'); -$arrTemplate['STEP4_TEXT_01'] = $myInstClass->translate('Writing global settings to database'); -$arrTemplate['STEP4_TEXT_03'] = $myInstClass->translate('Writing database configuration to settings.php'); -$arrTemplate['STEP4_TEXT_05'] = $myInstClass->translate('Import Nagios sample data'); -$arrTemplate['STEP4_TEXT_07'] = $myInstClass->translate('Create and/or store NagiosQL path settings'); - -$arrTemplate['STEP4_VISIBLE'] = 'hidefield'; +$arrTemplate['STEP3_TEXT_01'] = $myInstClass->translate('Database server connection (privileged user)'); +$arrTemplate['STEP3_TEXT_03'] = $myInstClass->translate('Database server version'); +$arrTemplate['STEP3_TEXT_05'] = $myInstClass->translate('Database server support'); +$arrTemplate['STEP3_TEXT_07'] = $myInstClass->translate('Delete existing NagiosQL database'); +$arrTemplate['STEP3_TEXT_09'] = $myInstClass->translate('Creating new database'); +$arrTemplate['STEP3_TEXT_11'] = $myInstClass->translate('Installing NagiosQL database tables'); +$arrTemplate['STEP3_TEXT_13'] = $myInstClass->translate('Create NagiosQL database user'); +$arrTemplate['STEP3_TEXT_15'] = $myInstClass->translate('Set initial NagiosQL Administrator'); +$arrTemplate['STEP3_TEXT_17'] = $myInstClass->translate('Database server connection (NagiosQL user)'); +$arrTemplate['STEP4_TEXT_01'] = $myInstClass->translate('Writing global settings to database'); +$arrTemplate['STEP4_TEXT_03'] = $myInstClass->translate('Writing database configuration to settings.php'); +$arrTemplate['STEP4_TEXT_05'] = $myInstClass->translate('Import Nagios sample data'); +$arrTemplate['STEP4_TEXT_07'] = $myInstClass->translate('Create and/or store NagiosQL path settings'); +$arrTemplate['STEP4_VISIBLE'] = 'hidefield'; $arrTemplate['STEP3_TEXT_02_SHOW'] = 'hidefield'; $arrTemplate['STEP3_TEXT_03_SHOW'] = 'hidefield'; $arrTemplate['STEP3_TEXT_05_SHOW'] = 'hidefield'; @@ -69,48 +77,48 @@ $arrTemplate['STEP3_TEXT_17_SHOW'] = 'hidefield'; $arrTemplate['STEP4_TEXT_03_SHOW'] = 'hidefield'; $arrTemplate['STEP4_TEXT_05_SHOW'] = 'hidefield'; $arrTemplate['STEP4_TEXT_07_SHOW'] = 'hidefield'; -// -// Check any data before installation -// ================================== +/* +Check any data before installation +*/ $intInstError = 0; -// -// Doing installation/upgrade -// ========================== -if ($_SESSION['install']['mode'] == 'Update') { +/* +Doing installation/upgrade +*/ +if ($_SESSION['install']['mode'] === 'Update') { $arrTemplate['STEP3_SUB_TITLE'] = $myInstClass->translate('Updating existing NagiosQL database'); - // - // Include database class - // ====================== - if ($_SESSION['install']['dbtype'] == 'mysqli') { - // Initialize mysqli class + /* + Include database class + */ + if ($_SESSION['install']['dbtype'] === 'mysqli') { + /* Initialize mysqli class */ $myDBClass = new functions\MysqliDbClass; } else { - $strErrorMessage .= $myInstClass->translate('Database type not defined!'). ' (' . - $_SESSION['install']['dbtype'].")
\n"; - $strStatusMessage = '' .$myInstClass->translate('failed'). ''; - $intError = 1; + $strErrorMessage .= $myInstClass->translate('Database type not defined!') . ' (' . + $_SESSION['install']['dbtype'] . ")
\n"; + $strStatusMessage = '' . $myInstClass->translate('failed') . ''; + $intError = 1; } - // Set DB parameters - $myDBClass->arrParams['server'] = $_SESSION['install']['dbserver']; - $myDBClass->arrParams['port'] = $_SESSION['install']['dbport']; + /* Set DB parameters */ + $myDBClass->arrParams['server'] = $_SESSION['install']['dbserver']; + $myDBClass->arrParams['port'] = $_SESSION['install']['dbport']; $myDBClass->arrParams['username'] = $_SESSION['install']['admuser']; $myDBClass->arrParams['password'] = $_SESSION['install']['admpass']; $myDBClass->arrParams['database'] = $_SESSION['install']['dbname']; - // Include classes - if ($intError == 0) { + /* Include classes */ + if ($intError === 0) { $myInstClass->myDBClass =& $myDBClass; } - // Check database connection - if ($intError == 0) { + /* Check database connection */ + if ($intError === 0) { $intError = $myInstClass->openAdmDBSrv($arrTemplate['STEP3_TEXT_02'], $strErrorMessage); } - if ($intError == 0) { + if ($intError === 0) { $intError = $myInstClass->openDatabase($arrTemplate['STEP3_TEXT_02'], $strErrorMessage); } - $arrTemplate['STEP3_TEXT_02_SHOW'] = 'showfield'; - // Check NagiosQL version - if ($intError == 0) { - $arrTemplate['STEP3_TEXT_03'] = $myInstClass->translate('Installed NagiosQL version'); + $arrTemplate['STEP3_TEXT_02_SHOW'] = 'showfield'; + /* Check NagiosQL version */ + if ($intError === 0) { + $arrTemplate['STEP3_TEXT_03'] = $myInstClass->translate('Installed NagiosQL version'); $arrTemplate['STEP3_TEXT_03_SHOW'] = 'showfield'; $intError = $myInstClass->checkQLVersion( $arrTemplate['STEP3_TEXT_04'], @@ -119,190 +127,189 @@ if ($_SESSION['install']['mode'] == 'Update') { $setQLVersion ); } - // Upgrade NagiosQL DB - if ($intError == 0) { - $arrTemplate['STEP3_TEXT_05'] = $myInstClass->translate('Upgrading from version'). ' ' .$setQLVersion - . ' ' . $myInstClass->translate('to'). ' ' .$preNagiosQL_ver; + /* Upgrade NagiosQL DB */ + if ($intError === 0) { + $arrTemplate['STEP3_TEXT_05'] = $myInstClass->translate('Upgrading from version') . ' ' . $setQLVersion + . ' ' . $myInstClass->translate('to') . ' ' . $preNagiosQL_ver; $arrTemplate['STEP3_TEXT_05_SHOW'] = 'showfield'; $intError = $myInstClass->updateQLDB($arrTemplate['STEP3_TEXT_06'], $strErrorMessage, $arrUpdate); } - if (($_SESSION['install']['dbtype'] == 'mysql') && (version_compare($setQLVersion, '3.4.0') == -1)) { - // Converting database to UTF8 - if ($intError == 0) { - $arrTemplate['STEP3_TEXT_07'] = $myInstClass->translate('Converting database to utf8 character set'); + if (($_SESSION['install']['dbtype'] === 'mysql') && (version_compare($setQLVersion, '3.5.0') === -1)) { + /* Converting database to UTF8 */ + if ($intError === 0) { + $arrTemplate['STEP3_TEXT_07'] = $myInstClass->translate('Converting database to utf8 character set'); $arrTemplate['STEP3_TEXT_07_SHOW'] = 'showfield'; $intError = $myInstClass->convQLDB($arrTemplate['STEP3_TEXT_08'], $strErrorMessage); } - // Converting database tables to UTF8 - if ($intError == 0) { - $arrTemplate['STEP3_TEXT_09'] = $myInstClass->translate('Converting database tables to utf8 character ' + /* Converting database tables to UTF8 */ + if ($intError === 0) { + $arrTemplate['STEP3_TEXT_09'] = $myInstClass->translate('Converting database tables to utf8 character ' . 'set'); $arrTemplate['STEP3_TEXT_09_SHOW'] = 'showfield'; $intError = $myInstClass->convQLDBTables($arrTemplate['STEP3_TEXT_10'], $strErrorMessage); } - // Converting database fields to UTF8 - if ($intError == 0) { - $arrTemplate['STEP3_TEXT_11'] = $myInstClass->translate('Converting database fields to utf8 ' + /* Converting database fields to UTF8 */ + if ($intError === 0) { + $arrTemplate['STEP3_TEXT_11'] = $myInstClass->translate('Converting database fields to utf8 ' . 'character set'); $arrTemplate['STEP3_TEXT_11_SHOW'] = 'showfield'; $intError = $myInstClass->convQLDBFields($arrTemplate['STEP3_TEXT_12'], $strErrorMessage); } } - // Reconnect Database with new user - if ($intError == 0) { + /* Reconnect Database with new user */ + if ($intError === 0) { $arrTemplate['STEP3_TEXT_17_SHOW'] = 'showfield'; $intError1 = $myInstClass->openAdmDBSrv($arrTemplate['STEP3_TEXT_18'], $strErrorMessage, 1); $intError2 = $myInstClass->openDatabase($arrTemplate['STEP3_TEXT_18'], $strErrorMessage, 1); - $intError = $intError1 + $intError2; + $intError = $intError1 + $intError2; } - // Deploy NagiosQL database settings - if ($intError == 0) { + /* Deploy NagiosQL database settings */ + if ($intError === 0) { $arrTemplate['STEP4_VISIBLE'] = 'showfield'; $intError = $myInstClass->updateSettingsDB($arrTemplate['STEP4_TEXT_02'], $strErrorMessage); } - // Write database settings to file - if ($intError == 0) { + /* Write database settings to file */ + if ($intError === 0) { $arrTemplate['STEP4_TEXT_03_SHOW'] = 'showfield'; $intError = $myInstClass->updateSettingsFile($arrTemplate['STEP4_TEXT_04'], $strErrorMessage); } } else { - $arrTemplate['STEP3_SUB_TITLE'] = $myInstClass->translate('Create new NagiosQL database'); - // - // Include database class - // ====================== - if ($_SESSION['install']['dbtype'] == 'mysqli') { + $arrTemplate['STEP3_SUB_TITLE'] = $myInstClass->translate('Create new NagiosQL database'); + /* + Include database class + */ + if ($_SESSION['install']['dbtype'] === 'mysqli') { // Initialize mysqli class $myDBClass = new functions\MysqliDbClass; } else { - $strErrorMessage .= $myInstClass->translate('Database type not defined!'). ' (' . - $_SESSION['install']['dbtype'].")
\n"; - $strStatusMessage = '' .$myInstClass->translate('failed'). ''; - $intError = 1; + $strErrorMessage .= $myInstClass->translate('Database type not defined!') . ' (' . + $_SESSION['install']['dbtype'] . ")
\n"; + $strStatusMessage = '' . $myInstClass->translate('failed') . ''; + $intError = 1; } - // Set DB parameters - $myDBClass->arrParams['server'] = $_SESSION['install']['dbserver']; - $myDBClass->arrParams['port'] = $_SESSION['install']['dbport']; + /* Set DB parameters */ + $myDBClass->arrParams['server'] = $_SESSION['install']['dbserver']; + $myDBClass->arrParams['port'] = $_SESSION['install']['dbport']; $myDBClass->arrParams['username'] = $_SESSION['install']['admuser']; $myDBClass->arrParams['password'] = $_SESSION['install']['admpass']; $myDBClass->arrParams['database'] = $_SESSION['install']['dbname']; - // Include classes - if ($intError == 0) { + /* Include classes */ + if ($intError === 0) { $myInstClass->myDBClass =& $myDBClass; } - // Check database connection + /* Check database connection */ $intOldDBStatus = 0; - if ($intError == 0) { + if ($intError === 0) { $intError = $myInstClass->openAdmDBSrv($arrTemplate['STEP3_TEXT_02'], $strErrorMessage); } - // Does the database already exist? - if ($intError == 0) { + /* Does the database already exist? */ + if ($intError === 0) { $intOldDBStatus = $myInstClass->openDatabase($strTmpMessage, $strTmpError); $myDBClass->strErrorMessage = ''; - if (($intOldDBStatus == 0) && ($_SESSION['install']['dbdrop'] == 0)) { + if (($intOldDBStatus === 0) && ($_SESSION['install']['dbdrop'] === 0)) { $strErrorMessage .= $myInstClass->translate('Database already exists and drop database was not ' - . 'selected, please correct or manage manually'). '
'; - $arrTemplate['STEP3_TEXT_02'] = '' .$myInstClass->translate('failed'). ''; + . 'selected, please correct or manage manually') . '
'; + $arrTemplate['STEP3_TEXT_02'] = '' . $myInstClass->translate('failed') . ''; $intError = 1; } else { $myInstClass->openAdmDBSrv($arrTemplate['STEP3_TEXT_02'], $strErrorMessage); } } $arrTemplate['STEP3_TEXT_02_SHOW'] = 'showfield'; - $arrTemplate['STEP3_TEXT_02'] .= ' (' .$_SESSION['install']['dbtype']. ')'; - // Check database version - if ($intError == 0) { + $arrTemplate['STEP3_TEXT_02'] .= ' (' . $_SESSION['install']['dbtype'] . ')'; + /* Check database version */ + if ($intError === 0) { $arrTemplate['STEP3_TEXT_03_SHOW'] = 'showfield'; $arrTemplate['STEP3_TEXT_05_SHOW'] = 'showfield'; $intError = $myInstClass->checkDBVersion($arrTemplate['STEP3_TEXT_06'], $strErrorMessage, $strVersion); - if ($strVersion == 'unknown') { - $arrTemplate['STEP3_TEXT_04'] = '' .$myInstClass->translate('unknown'). ''; + if ($strVersion === 'unknown') { + $arrTemplate['STEP3_TEXT_04'] = '' . $myInstClass->translate('unknown') . ''; } else { - $arrTemplate['STEP3_TEXT_04'] = '' .$strVersion. ''; + $arrTemplate['STEP3_TEXT_04'] = '' . $strVersion . ''; } } - // Drop existing database - if (($intError == 0) && ($_SESSION['install']['dbdrop'] == 1) && ($intOldDBStatus == 0)) { + /* Drop existing database */ + if (($intError === 0) && ($_SESSION['install']['dbdrop'] === 1) && ($intOldDBStatus === 0)) { $arrTemplate['STEP3_TEXT_07_SHOW'] = 'showfield'; $intError = $myInstClass->dropDB($arrTemplate['STEP3_TEXT_08'], $strErrorMessage); } - // Create new database - if ($intError == 0) { + /* Create new database */ + if ($intError === 0) { $arrTemplate['STEP3_TEXT_09_SHOW'] = 'showfield'; $intError = $myInstClass->createDB($arrTemplate['STEP3_TEXT_10'], $strErrorMessage); } - // Write initial SQL data to database - if ($intError == 0) { + /* Write initial SQL data to database */ + if ($intError === 0) { $intError = $myInstClass->openDatabase($strTmp, $strErrorMessage); } - if ($intError == 0) { + if ($intError === 0) { $arrTemplate['STEP3_TEXT_11_SHOW'] = 'showfield'; $arrInsert[] = $preSqlNewInstall; $intError = $myInstClass->updateQLDB($arrTemplate['STEP3_TEXT_12'], $strErrorMessage, $arrInsert); } - // Grant NagiosQL database user - if ($intError == 0) { + /* Grant NagiosQL database user */ + if ($intError === 0) { $arrTemplate['STEP3_TEXT_13_SHOW'] = 'showfield'; $intError = $myInstClass->grantDBUser($arrTemplate['STEP3_TEXT_14'], $strErrorMessage); } - // Create NagiosQL admin user - if ($intError == 0) { + /* Create NagiosQL admin user */ + if ($intError === 0) { $arrTemplate['STEP3_TEXT_15_SHOW'] = 'showfield'; $intError = $myInstClass->createNQLAdmin($arrTemplate['STEP3_TEXT_16'], $strErrorMessage); } - // Reconnect Database with new user - if ($intError == 0) { - $myDBClass->arrParams['username'] = $_SESSION['install']['dbuser']; - $myDBClass->arrParams['password'] = $_SESSION['install']['dbpass']; + /* Reconnect Database with new user */ + if ($intError === 0) { + $myDBClass->arrParams['username'] = $_SESSION['install']['dbuser']; + $myDBClass->arrParams['password'] = $_SESSION['install']['dbpass']; $arrTemplate['STEP3_TEXT_17_SHOW'] = 'showfield'; - if ($intError == 0) { + if ($intError === 0) { $intError = $myInstClass->openAdmDBSrv($arrTemplate['STEP3_TEXT_18'], $strErrorMessage, 1); } - if ($intError == 0) { + if ($intError === 0) { $intError = $myInstClass->openDatabase($arrTemplate['STEP3_TEXT_18'], $strErrorMessage, 1); } } - // Deploy NagiosQL settings - if ($intError == 0) { + /* Deploy NagiosQL settings */ + if ($intError === 0) { $arrTemplate['STEP4_VISIBLE'] = 'showfield'; $intError = $myInstClass->updateSettingsDB($arrTemplate['STEP4_TEXT_02'], $strErrorMessage); } - // Write database settings to file - if ($intError == 0) { + /* Write database settings to file */ + if ($intError === 0) { $arrTemplate['STEP4_TEXT_03_SHOW'] = 'showfield'; $intError = $myInstClass->updateSettingsFile($arrTemplate['STEP4_TEXT_04'], $strErrorMessage); } - // Write sample data to database - if (($intError == 0) && ($_SESSION['install']['sample'] == 1)) { + /* Write sample data to database */ + if (($intError === 0) && ($_SESSION['install']['sample'] === 1)) { $arrTemplate['STEP4_TEXT_05_SHOW'] = 'showfield'; $arrSample[] = 'sql/import_nagios_sample.sql'; $intError = $myInstClass->updateQLDB($arrTemplate['STEP4_TEXT_06'], $strErrorMessage, $arrSample); } - // Create NagiosQL path and write path settings to the database - if ($intError == 0) { + /* Create NagiosQL path and write path settings to the database */ + if ($intError === 0) { $arrTemplate['STEP4_TEXT_07_SHOW'] = 'showfield'; $intError = $myInstClass->updateQLpath($arrTemplate['STEP4_TEXT_08'], $strErrorMessage); } } -if ($intError != 0) { +if ($intError !== 0) { $arrTemplate['ERRORMESSAGE'] = '

' . - $strErrorMessage."

\n"; - $arrTemplate['INFO_TEXT'] = ''; - $arrTemplate['BUTTON'] = "
\n"; - $arrTemplate['BUTTON'] .= "\n"; - $arrTemplate['BUTTON'] .= "" - . '
' .$myInstClass->translate('Back')."\n"; - $arrTemplate['BUTTON'] .= "
\n"; + $strErrorMessage . "

\n"; + $arrTemplate['INFO_TEXT'] = ''; + $arrTemplate['BUTTON'] = "
\n"; + $arrTemplate['BUTTON'] .= "\n"; + $arrTemplate['BUTTON'] .= "" + . '
' . $myInstClass->translate('Back') . "\n"; } else { $arrTemplate['ERRORMESSAGE'] = ''; $arrTemplate['INST_VISIBLE'] = 'showfield'; - $arrTemplate['INFO_TEXT'] = $myInstClass->translate('Please delete the install directory to continue!'); - $arrTemplate['BUTTON'] = "
\n"; - $arrTemplate['BUTTON'] .= "finish
".$myInstClass->translate('Finish')."\n"; - $arrTemplate['BUTTON'] .= "
\n"; + $arrTemplate['INFO_TEXT'] = $myInstClass->translate('Please delete the install directory to continue!'); + $arrTemplate['BUTTON'] = "
\n"; + $arrTemplate['BUTTON'] .= "finish
" . $myInstClass->translate('Finish') . "\n"; } -// -// Write content -// ============= +$arrTemplate['BUTTON'] .= "
\n"; +/* +Write content +*/ $strContent = $myInstClass->parseTemplate($arrTemplate, $preIncludeContent); -echo $strContent; +echo $strContent; \ No newline at end of file diff --git a/install/templates/index.htm.tpl b/install/templates/index.htm.tpl index 59bbe85..ff84ed6 100644 --- a/install/templates/index.htm.tpl +++ b/install/templates/index.htm.tpl @@ -1,88 +1,98 @@ - + - + - - - - {PAGETITLE} - - - -
-
- -
-
-
-

{MAIN_TITLE}

-
{TEXT_PART_1}
{TEXT_PART_2}NagiosQL @ Sourceforge
-

{TEXT_PART_9}
-
-

{TEXT_PART_3}

-

{TEXT_PART_4}

-
    -
  • {TEXT_PART_5}
  • -
      -
    • {TEXT_PHP_REQ_1}
    • -
    • {TEXT_PHP_REQ_2}
    • -
    • {TEXT_PHP_REQ_3}
    • -
    • {TEXT_PHP_REQ_6}
    • -
    • {TEXT_PHP_REQ_8}
    • -
    • {TEXT_PHP_REQ_10}
    • -
    -
-
    -
  • {TEXT_PART_6}
  • -
      -
    • {TEXT_INI_REQ_1}
    • -
    • {TEXT_INI_REQ_2}
    • -
    -
-
    -
  • {TEXT_PART_7}
  • -
  • {TEXT_PART_8}
  • -
- {UPDATE_ERROR} -
- - - -

-

-

{ONLINE_DOC}

-
-
-
- -
+ + + + {PAGETITLE} + + + +
+
+ - - + + + \ No newline at end of file diff --git a/install/templates/install.htm.tpl b/install/templates/install.htm.tpl index b9aa0c4..50d6b54 100644 --- a/install/templates/install.htm.tpl +++ b/install/templates/install.htm.tpl @@ -1,35 +1,37 @@ - + - + - - - - {PAGETITLE} - - - -
-
- -
- {CONTENT} -
- + + + + {PAGETITLE} + + + +
+
+ - +
+ {CONTENT} +
+ +
+
+ \ No newline at end of file diff --git a/install/templates/step1.htm.tpl b/install/templates/step1.htm.tpl index 8327a7a..b9633cb 100644 --- a/install/templates/step1.htm.tpl +++ b/install/templates/step1.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -16,9 +16,11 @@

{STEP1_TITLE}

{STEP1_SUBTITLE1}

- {CHECK_1_PIC} Javascript: {CHECK_1_VALUE}{CHECK_1_INFO} + {CHECK_1_PIC} Javascript: + {CHECK_1_VALUE}{CHECK_1_INFO}

{STEP1_SUBTITLE2}

- {CHECK_2_PIC} {CHECK_2_TEXT}: {CHECK_2_VALUE} {CHECK_2_INFO} + {CHECK_2_PIC} {CHECK_2_TEXT} + : {CHECK_2_VALUE} {CHECK_2_INFO}

{STEP1_SUBTITLE3}

{STEP1_TEXT3_1}:

{CHECK_3_CONTENT_1} @@ -49,10 +51,10 @@
-
+
-
\ No newline at end of file +
\ No newline at end of file diff --git a/install/templates/step2.htm.tpl b/install/templates/step2.htm.tpl index 542c6a4..9750466 100644 --- a/install/templates/step2.htm.tpl +++ b/install/templates/step2.htm.tpl @@ -1,9 +1,9 @@ - + - + +



{STEP1_BOX}

@@ -72,46 +75,56 @@ {STEP2_TEXT2_2} * - {STEP2_VALUE2_2} {STEP2_TEXT2_3} * - + {STEP2_TEXT2_4} * - + {STEP2_TEXT2_5} * - + {STEP2_TEXT2_6} * - + {STEP2_TEXT2_7} * - + {STEP2_TEXT2_8} * - + {STEP2_TEXT2_9} * - + {STEP2_TEXT2_10} * - + {STEP2_TEXT2_11} - + @@ -120,15 +133,18 @@ - + - + - +
{STEP2_TEXT3_2} *
{STEP2_TEXT3_3} *
{STEP2_TEXT3_4} *
@@ -137,7 +153,8 @@ - +
{STEP2_TEXT4_2}
@@ -146,15 +163,18 @@ - + - + - + @@ -164,9 +184,10 @@
- {STEP2_FORM_1}
{STEP2_FORM_1} + {STEP2_FORM_1}
{STEP2_FORM_1}
- -
\ No newline at end of file + +
\ No newline at end of file diff --git a/install/templates/step3.htm.tpl b/install/templates/step3.htm.tpl index a768db0..ef21f6a 100644 --- a/install/templates/step3.htm.tpl +++ b/install/templates/step3.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -14,7 +14,7 @@
-

{STEP3_TITLE}

+

{STEP3_TITLE}

{STEP3_SUB_TITLE} @@ -62,27 +62,27 @@
{STEP4_SUB_TITLE}
{STEP2_TEXT5_2}
{STEP2_TEXT5_3}
{STEP2_TEXT5_4}
{STEP2_TEXT5_5}
{STEP2_TEXT5_6}
- - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + +
{STEP4_TEXT_02}
{STEP4_TEXT_04}
{STEP4_TEXT_06}
{STEP4_TEXT_08}
{STEP4_TEXT_02}
{STEP4_TEXT_04}
{STEP4_TEXT_06}
{STEP4_TEXT_08}
- +

{INFO_TEXT}

{BUTTON}
-
-
\ No newline at end of file +
+
\ No newline at end of file diff --git a/libraries/pear/HTML/Template/IT.php b/libraries/pear/HTML/Template/IT.php index a48faeb..ae78cc7 100644 --- a/libraries/pear/HTML/Template/IT.php +++ b/libraries/pear/HTML/Template/IT.php @@ -11,7 +11,7 @@ * with this package in the file LICENSE, and is available through * the world-wide-web at * http://www.opensource.org/licenses/bsd-license.php - * If you did not receive a copy of the new BSDlicense and are unable + * If you did not receive a copy of the new BSD license and are unable * to obtain it through the world-wide-web, please send a note to * pajoye@php.net so we can mail you a copy immediately. * @@ -23,13 +23,12 @@ * @package HTML_Template_IT * @author Ulf Wendel * @license BSD http://www.opensource.org/licenses/bsd-license.php - * @version CVS: $Id: IT.php 3 2017-06-22 07:32:17Z martin $ + * @version CVS: $Id$ * @link http://pear.php.net/packages/HTML_Template_IT * @access public */ require_once 'PEAR.php'; -$myPEAR = new PEAR(); define('IT_OK', 1); define('IT_ERROR', -1); @@ -49,7 +48,7 @@ define('IT_UNKNOWN_OPTION', -6); * one you can build. template::parse() [phplib template = Isotemplate] requests * you to name a source and a target where the current block gets parsed into. * Source and target can be block names or even handler names. This API gives you - * a maximum of fexibility but you always have to know what you do which is + * a maximum of flexibility but you always have to know what you do which is * quite unusual for php skripter like me. * * I noticed that I do not any control on which block gets parsed into which one. @@ -148,7 +147,6 @@ class HTML_Template_IT /** * Clear cache on get()? - * @var boolean * @acces public */ @@ -279,9 +277,9 @@ class HTML_Template_IT * should be preserved although they are empty (no placeholder replaced). * Think of a shopping basket. If it's empty you have to drop a message to * the user. If it's filled you have to show the contents of - * the shopping baseket. Now where do you place the message that the basket + * the shopping basket. Now where do you place the message that the basket * is empty? It's no good idea to place it in you applications as customers - * tend to like unecessary minor text changes. Having another template file + * tend to like unnecessary minor text changes. Having another template file * for an empty basket means that it's very likely that one fine day * the filled and empty basket templates have different layout. I decided * to introduce blocks that to not contain any placeholder but only @@ -289,7 +287,7 @@ class HTML_Template_IT * * Now if there is no replacement done in such a block the block will * be recognized as "empty" and by default ($removeEmptyBlocks = true) be - * stripped off. To avoid thisyou can now call touchBlock() to avoid this. + * stripped off. To avoid this you can now call touchBlock() to avoid this. * * The array $touchedBlocks stores a list of touched block which must not * be removed even if they are empty. @@ -298,15 +296,7 @@ class HTML_Template_IT * @see touchBlock(), $removeEmptyBlocks * @access private */ - var $touchedBlocks = array(); - - /** - * List of blocks which should not be shown even if not "empty" - * @var array $_hiddenBlocks - * @see hideBlock(), $removeEmptyBlocks - * @access private - */ - var $_hiddenBlocks = array(); + var $touchedBlocks = array(); /** * Variable cache. @@ -395,7 +385,7 @@ class HTML_Template_IT ); /** - * Builds some complex regular expressions and optinally sets the + * Builds some complex regular expressions and optionally sets the * file root directory. * * Make sure that you call this constructor if you derive your template @@ -415,15 +405,15 @@ class HTML_Template_IT } $this->variablesRegExp = '@' . $this->openingDelimiter . - '(' . $this->variablenameRegExp . ')' . - $this->closingDelimiter . '@sm'; + '(' . $this->variablenameRegExp . ')' . + $this->closingDelimiter . '@sm'; $this->removeVariablesRegExp = '@' . $this->openingDelimiter . - "\s*(" . $this->variablenameRegExp . - ")\s*" . $this->closingDelimiter .'@sm'; + "\s*(" . $this->variablenameRegExp . + ")\s*" . $this->closingDelimiter .'@sm'; $this->blockRegExp = '@(.*)@sm'; + ')\s+-->(.*)@sm'; $this->setRoot($root); } // end constructor @@ -440,8 +430,7 @@ class HTML_Template_IT */ function setOption($option, $value) { - global $myPEAR; - switch ($option) { + switch ($option) { case 'removeEmptyBlocks': $this->removeEmptyBlocks = $value; return IT_OK; @@ -452,7 +441,7 @@ class HTML_Template_IT return IT_OK; } - return $myPEAR->raiseError( + return PEAR::raiseError( $this->errorMessage(IT_UNKNOWN_OPTION) . ": '{$option}'", IT_UNKNOWN_OPTION ); @@ -472,12 +461,10 @@ class HTML_Template_IT */ function setOptions($options) { - global $myPEAR; if (is_array($options)) { foreach ($options as $option => $value) { $error = $this->setOption($option, $value); - if ($myPEAR->isError($error)) { - + if (PEAR::isError($error)) { return $error; } } @@ -512,13 +499,12 @@ class HTML_Template_IT */ function get($block = '__global__') { - global $myPEAR; - if ($block == '__global__' && !$this->flagGlobalParsed) { + if ($block == '__global__' && !$this->flagGlobalParsed) { $this->parse('__global__'); } if (!isset($this->blocklist[$block])) { - $this->err[] = $myPEAR->raiseError( + $this->err[] = PEAR::raiseError( $this->errorMessage(IT_BLOCK_NOT_FOUND) . '"' . $block . "'", IT_BLOCK_NOT_FOUND ); @@ -562,11 +548,10 @@ class HTML_Template_IT */ function parse($block = '__global__', $flag_recursion = false) { - global $myPEAR; - static $regs, $values; + static $regs, $values; if (!isset($this->blocklist[$block])) { - return $myPEAR->raiseError( + return PEAR::raiseError( $this->errorMessage(IT_BLOCK_NOT_FOUND) . '"' . $block . "'", IT_BLOCK_NOT_FOUND ); @@ -587,7 +572,7 @@ class HTML_Template_IT if ($this->clearCacheOnParse) { foreach ($this->variableCache as $name => $value) { $regs[] = $this->openingDelimiter . - $name . $this->closingDelimiter; + $name . $this->closingDelimiter; $values[] = $value; @@ -601,7 +586,7 @@ class HTML_Template_IT if (isset($this->variableCache[$allowedvar])) { $regs[] = $this->openingDelimiter . - $allowedvar . $this->closingDelimiter; + $allowedvar . $this->closingDelimiter; $values[] = $this->variableCache[$allowedvar]; unset($this->variableCache[$allowedvar]); @@ -622,7 +607,7 @@ class HTML_Template_IT } $placeholder = $this->openingDelimiter . "__" . - $innerblock . "__" . $this->closingDelimiter; + $innerblock . "__" . $this->closingDelimiter; $outer = str_replace( $placeholder, @@ -754,7 +739,7 @@ class HTML_Template_IT /** * Sets a variable value. * - * The function can be used eighter like setVariable( "varname", "value") + * The function can be used either like setVariable( "varname", "value") * or with one array $variables["varname"] = "value" * given setVariable($variables) quite like phplib templates set_var(). * @@ -791,9 +776,9 @@ class HTML_Template_IT */ function setCurrentBlock($block = '__global__') { - global $myPEAR; + if (!isset($this->blocklist[$block])) { - return $myPEAR->raiseError( + return PEAR::raiseError( $this->errorMessage(IT_BLOCK_NOT_FOUND) . '"' . $block . "'", IT_BLOCK_NOT_FOUND @@ -817,9 +802,8 @@ class HTML_Template_IT */ function touchBlock($block) { - global $myPEAR; - if (!isset($this->blocklist[$block])) { - return $myPEAR->raiseError( + if (!isset($this->blocklist[$block])) { + return PEAR::raiseError( $this->errorMessage(IT_BLOCK_NOT_FOUND) . '"' . $block . "'", IT_BLOCK_NOT_FOUND ); @@ -876,7 +860,7 @@ class HTML_Template_IT /** * Sets the template. * - * You can eighter load a template file from disk with + * You can either load a template file from disk with * LoadTemplatefile() or set the template manually using this function. * * @param string $template template content @@ -888,8 +872,8 @@ class HTML_Template_IT * @return boolean */ function setTemplate( $template, - $removeUnknownVariables = true, - $removeEmptyBlocks = true) { + $removeUnknownVariables = true, + $removeEmptyBlocks = true) { $this->removeUnknownVariables = $removeUnknownVariables; $this->removeEmptyBlocks = $removeEmptyBlocks; @@ -901,7 +885,7 @@ class HTML_Template_IT $this->currentBlock = '__global__'; } else { $this->template = '' . $template . - ''; + ''; $this->init(); } @@ -925,8 +909,8 @@ class HTML_Template_IT * $removeEmptyBlocks */ function loadTemplatefile( $filename, - $removeUnknownVariables = true, - $removeEmptyBlocks = true ) {; + $removeUnknownVariables = true, + $removeEmptyBlocks = true ) {; $template = ''; if (!$this->flagCacheTemplatefile || $this->lastTemplatefile != $filename @@ -936,9 +920,9 @@ class HTML_Template_IT $this->lastTemplatefile = $filename; return $template != '' ? - $this->setTemplate( - $template, - $removeUnknownVariables, + $this->setTemplate( + $template, + $removeUnknownVariables, $removeEmptyBlocks) : false; } // end func LoadTemplatefile @@ -999,7 +983,7 @@ class HTML_Template_IT foreach ($this->blockvariables['__global__'] as $allowedvar => $v) { if (isset($this->variableCache[$allowedvar])) { $regs[] = '@' . $this->openingDelimiter . - $allowedvar . $this->closingDelimiter . '@'; + $allowedvar . $this->closingDelimiter . '@'; $values[] = $this->variableCache[$allowedvar]; unset($this->variableCache[$allowedvar]); } @@ -1009,7 +993,7 @@ class HTML_Template_IT } // end func getGlobalvariables /** - * Recusively builds a list of all blocks within the template. + * Recursively builds a list of all blocks within the template. * * @param string $string string that gets scanned * @@ -1019,8 +1003,7 @@ class HTML_Template_IT */ function findBlocks($string) { - global $myPEAR; - $blocklist = array(); + $blocklist = array(); if (preg_match_all($this->blockRegExp, $string, $regs, PREG_SET_ORDER)) { foreach ($regs as $k => $match) { @@ -1030,7 +1013,7 @@ class HTML_Template_IT if (isset($this->blocklist[$blockname])) { $msg = $this->errorMessage(IT_BLOCK_DUPLICATE, $blockname); - $this->err[] = $myPEAR->raiseError($msg, IT_BLOCK_DUPLICATE); + $this->err[] = PEAR::raiseError($msg, IT_BLOCK_DUPLICATE); $this->flagBlocktrouble = true; } @@ -1073,15 +1056,14 @@ class HTML_Template_IT */ function getFile($filename) { - global $myPEAR; - if ($filename{0} == '/' && substr($this->fileRoot, -1) == '/') { + if ($filename[0] == '/' && substr($this->fileRoot, -1) == '/') { $filename = substr($filename, 1); } $filename = $this->fileRoot . $filename; if (!($fh = @fopen($filename, 'r'))) { - $this->err[] = $myPEAR->raiseError( + $this->err[] = PEAR::raiseError( $this->errorMessage(IT_TPL_NOT_FOUND) . ': "' .$filename .'"', IT_TPL_NOT_FOUND ); @@ -1097,10 +1079,9 @@ class HTML_Template_IT $content = fread($fh, $fsize); fclose($fh); - // "##ime", wma/PEAR error - return preg_replace( + return preg_replace_callback( "##im", - "\$this->getFile('\\1')", + function ($m) { return $this->getFile($m[1]); }, $content ); } // end func getFile @@ -1148,13 +1129,13 @@ class HTML_Template_IT function _preserveOpeningDelimiter($str) { return (false === strpos($str, $this->openingDelimiter))? - $str: - str_replace( - $this->openingDelimiter, - $this->openingDelimiter . - '%preserved%' . $this->closingDelimiter, - $str - ); + $str: + str_replace( + $this->openingDelimiter, + $this->openingDelimiter . + '%preserved%' . $this->closingDelimiter, + $str + ); } /** @@ -1169,8 +1150,7 @@ class HTML_Template_IT */ function errorMessage($value, $blockname = '') { - global $myPEAR; - static $errorMessages; + static $errorMessages; if (!isset($errorMessages)) { $errorMessages = array( IT_OK => '', @@ -1178,20 +1158,19 @@ class HTML_Template_IT IT_TPL_NOT_FOUND => 'Cannot read the template file', IT_BLOCK_NOT_FOUND => 'Cannot find this block', IT_BLOCK_DUPLICATE => 'The name of a block must be'. - ' uniquewithin a template.'. - ' Found "' . $blockname . '" twice.'. - 'Unpredictable results '. - 'may appear.', + ' uniquewithin a template.'. + ' Found "' . $blockname . '" twice.'. + 'Unpredictable results '. + 'may appear.', IT_UNKNOWN_OPTION => 'Unknown option' ); } - if ($myPEAR->isError($value)) { + if (PEAR::isError($value)) { $value = $value->getCode(); } return isset($errorMessages[$value]) ? - $errorMessages[$value] : $errorMessages[IT_ERROR]; + $errorMessages[$value] : $errorMessages[IT_ERROR]; } -} // end class IntegratedTemplate -?> +} // end class IntegratedTemplate \ No newline at end of file diff --git a/libraries/pear/HTML/Template/ITX.php b/libraries/pear/HTML/Template/ITX.php index 4753b78..211e87d 100644 --- a/libraries/pear/HTML/Template/ITX.php +++ b/libraries/pear/HTML/Template/ITX.php @@ -11,7 +11,7 @@ * with this package in the file LICENSE, and is available through * the world-wide-web at * http://www.opensource.org/licenses/bsd-license.php - * If you did not receive a copy of the new BSDlicense and are unable + * If you did not receive a copy of the new BSD license and are unable * to obtain it through the world-wide-web, please send a note to * pajoye@php.net so we can mail you a copy immediately. * @@ -23,7 +23,7 @@ * @package HTML_Template_IT * @author Ulf Wendel * @license BSD http://www.opensource.org/licenses/bsd-license.php - * @version CVS: $Id: ITX.php 3 2017-06-22 07:32:17Z martin $ + * @version CVS: $Id$ * @link http://pear.php.net/packages/HTML_Template_IT * @access public */ @@ -32,24 +32,24 @@ require_once 'HTML/Template/IT.php'; require_once 'HTML/Template/IT_Error.php'; /** -* Integrated Template Extension - ITX -* -* With this class you get the full power of the phplib template class. -* You may have one file with blocks in it but you have as well one main file -* and multiple files one for each block. This is quite usefull when you have -* user configurable websites. Using blocks not in the main template allows -* you to modify some parts of your layout easily. -* -* Note that you can replace an existing block and add new blocks at runtime. -* Adding new blocks means changing a variable placeholder to a block. -* + * Integrated Template Extension - ITX + * + * With this class you get the full power of the phplib template class. + * You may have one file with blocks in it but you have as well one main file + * and multiple files one for each block. This is quite useful when you have + * user configurable websites. Using blocks not in the main template allows + * you to modify some parts of your layout easily. + * + * Note that you can replace an existing block and add new blocks at runtime. + * Adding new blocks means changing a variable placeholder to a block. + * * @category HTML * @package HTML_Template_IT * @author Ulf Wendel * @license BSD http://www.opensource.org/licenses/bsd-license.php * @link http://pear.php.net/packages/HTML_Template_IT * @access public -*/ + */ class HTML_Template_ITX extends HTML_Template_IT { /** @@ -136,15 +136,15 @@ class HTML_Template_ITX extends HTML_Template_IT * @access public * @see HTML_Template_IT() */ - function HTML_Template_ITX($root = '') + function __construct($root = '') { $this->checkblocknameRegExp = '@' . $this->blocknameRegExp . '@'; $this->functionRegExp = '@' . $this->functionPrefix . '(' . - $this->functionnameRegExp . ')\s*\(@sm'; + $this->functionnameRegExp . ')\s*\(@sm'; - $this->HTML_Template_IT($root); + parent::__construct($root); } // end func constructor /** @@ -173,7 +173,7 @@ class HTML_Template_ITX extends HTML_Template_IT * Replaces an existing block with new content. * * This function will replace a block of the template and all blocks - * contained in the replaced block and add a new block insted, means + * contained in the replaced block and add a new block instead, means * you can dynamically change your template. * * Note that changing the template structure violates one of the IT[X] @@ -199,8 +199,8 @@ class HTML_Template_ITX extends HTML_Template_IT { if (!isset($this->blocklist[$block])) { return new IT_Error("The block "."'$block'". - " does not exist in the template and thus it can't be replaced.", - __FILE__, __LINE__); + " does not exist in the template and thus it can't be replaced.", + __FILE__, __LINE__); } if ($template == '') { @@ -287,17 +287,17 @@ class HTML_Template_ITX extends HTML_Template_IT // Don't trust any user even if it's a programmer or yourself... if ($placeholder == '') { return new IT_Error('No variable placeholder given.', - __FILE__, __LINE__); + __FILE__, __LINE__); } elseif ($blockname == '' || - !preg_match($this->checkblocknameRegExp, $blockname) + !preg_match($this->checkblocknameRegExp, $blockname) ) { return new IT_Error("No or invalid blockname '$blockname' given.", - __FILE__, __LINE__); + __FILE__, __LINE__); } elseif ($template == '') { return new IT_Error('No block content given.', __FILE__, __LINE__); } elseif (isset($this->blocklist[$blockname])) { return new IT_Error('The block already exists.', - __FILE__, __LINE__); + __FILE__, __LINE__); } // find out where to insert the new block @@ -305,25 +305,25 @@ class HTML_Template_ITX extends HTML_Template_IT if (count($parents) == 0) { return new IT_Error("The variable placeholder". - " '$placeholder' was not found in the template.", - __FILE__, __LINE__); + " '$placeholder' was not found in the template.", + __FILE__, __LINE__); } elseif (count($parents) > 1) { reset($parents); - while (list($k, $parent) = each($parents)) { + foreach ($parents as $k => $parent) { $msg .= "$parent, "; } $msg = substr($parent, -2); return new IT_Error("The variable placeholder "."'$placeholder'". - " must be unique, found in multiple blocks '$msg'.", - __FILE__, __LINE__); + " must be unique, found in multiple blocks '$msg'.", + __FILE__, __LINE__); } $template = "" - . $template - . ""; + . $template + . ""; $this->findBlocks($template); if ($this->flagBlocktrouble) { return false; // findBlocks() already throws an exception @@ -373,7 +373,7 @@ class HTML_Template_ITX extends HTML_Template_IT * * @return string Name of the (first) block that contains * the specified placeholder. - * If the placeholder was not found or an error occured + * If the placeholder was not found or an error occurred * an empty string is returned. * @throws IT_Error * @access public @@ -397,7 +397,7 @@ class HTML_Template_ITX extends HTML_Template_IT if (is_array($variables = $this->blockvariables[$block])) { // search the value in the list of blockvariables reset($variables); - while (list($k, $variable) = each($variables)) { + foreach ($variables as $k => $variable) { if ($k == $placeholder) { $found = $block; break; @@ -409,7 +409,7 @@ class HTML_Template_ITX extends HTML_Template_IT // search all blocks and return the name of the first block that // contains the placeholder reset($this->blockvariables); - while (list($blockname, $variables) = each($this->blockvariables)) { + foreach ($this->blockvariables as $blockname => $variables) { if (is_array($variables) && isset($variables[$placeholder])) { $found = $blockname; break; @@ -430,7 +430,7 @@ class HTML_Template_ITX extends HTML_Template_IT function performCallback() { reset($this->functions); - while (list($func_id, $function) = each($this->functions)) { + foreach ($this->functions as $func_id => $function) { if (isset($this->callback[$function['name']])) { if ($this->callback[$function['name']]['expandParameters']) { $callFunction = 'call_user_func_array'; @@ -439,14 +439,14 @@ class HTML_Template_ITX extends HTML_Template_IT } if ($this->callback[$function['name']]['object'] != '') { - $call = $callFunction( + $call = $callFunction( array( &$GLOBALS[$this->callback[$function['name']]['object']], $this->callback[$function['name']]['function']), $function['args']); } else { - $call = $callFunction( + $call = $callFunction( $this->callback[$function['name']]['function'], $function['args']); } @@ -493,7 +493,7 @@ class HTML_Template_ITX extends HTML_Template_IT * * This is an absolutely evil feature. If your application makes heavy * use of such callbacks and you're even implementing if-then etc. on - * the level of a template engine you're reiventing the wheel... - that's + * the level of a template engine you're reinventing the wheel... - that's * actually how PHP came into life. Anyway, sometimes it's handy. * * Consider also using XML/XSLT or native PHP. And please do not push @@ -528,22 +528,22 @@ class HTML_Template_ITX extends HTML_Template_IT * @return boolean False on failure. * @throws IT_Error * @access public - * @deprecated The $callbackobject parameter is depricated since + * @deprecated The $callbackobject parameter is deprecated since * version 1.2 and might be dropped in further versions. */ function setCallbackFunction($tplfunction, $callbackfunction, - $callbackobject = '', - $expandCallbackParameters = false) { + $callbackobject = '', + $expandCallbackParameters = false) { if ($tplfunction == '' || $callbackfunction == '') { return new IT_Error("No template function "."('$tplfunction')". - " and/or no callback function ('$callback') given.", - __FILE__, __LINE__); + " and/or no callback function ('$callbackfunction') given.", + __FILE__, __LINE__); } $this->callback[$tplfunction] = array( - 'function' => $callbackfunction, - 'object' => $callbackobject, - 'expandParameters' => (boolean) - $expandCallbackParameters); + 'function' => $callbackfunction, + 'object' => $callbackobject, + 'expandParameters' => (boolean) + $expandCallbackParameters); return true; } // end func setCallbackFunction @@ -567,7 +567,7 @@ class HTML_Template_ITX extends HTML_Template_IT } // end func setCallbackFunctiontable /** - * Recursively removes all data assiciated with a block, including + * Recursively removes all data associated with a block, including * all inner blocks * * @param string $block block to be removed @@ -610,7 +610,7 @@ class HTML_Template_ITX extends HTML_Template_IT } // end func getBlocklist /** - * Checks wheter a block exists. + * Checks whether a block exists. * * @param string $blockname Blockname * @@ -647,7 +647,7 @@ class HTML_Template_ITX extends HTML_Template_IT } // end func getBlockvariables /** - * Checks wheter a block variable exists. + * Checks whether a block variable exists. * * @param string $block Blockname * @param string $variable Variablename @@ -687,8 +687,8 @@ class HTML_Template_ITX extends HTML_Template_IT $search = $regs[0] . $head . ')'; $replace = $this->openingDelimiter . - '__function' . $num . '__' . - $this->closingDelimiter; + '__function' . $num . '__' . + $this->closingDelimiter; $this->template = str_replace($search, $replace, $this->template); $template = str_replace($search, $replace, $template); @@ -697,7 +697,7 @@ class HTML_Template_ITX extends HTML_Template_IT $arg2 = trim($args2); $args[] = ('"' == $arg2{0} || "'" == $arg2{0}) ? - substr($arg2, 1, -1) : $arg2; + substr($arg2, 1, -1) : $arg2; if ($arg2 == $head) { break; @@ -706,13 +706,13 @@ class HTML_Template_ITX extends HTML_Template_IT } $this->functions[$num++] = array('name' => $regs[1], - 'args' => $args); + 'args' => $args); } } // end func buildFunctionlist /** - * Truncates the given code from the first occurence of + * Truncates the given code from the first occurrence of * $delimiter but ignores $delimiter enclosed by " or '. * * @param string $code The code which should be parsed @@ -782,7 +782,7 @@ class HTML_Template_ITX extends HTML_Template_IT } reset($this->blockvariables[$block]); - while (list($varname, $val) = each($this->blockvariables[$block])) { + foreach ($this->blockvariables[$block] as $varname => $val) { if (isset($variables[$varname])) { unset($this->blockvariables[$block][$varname]); } @@ -840,10 +840,10 @@ class HTML_Template_ITX extends HTML_Template_IT { $parents = array(); reset($this->blocklist); - while (list($blockname, $content) = each($this->blocklist)) { + foreach ($this->blocklist as $blockname => $content) { reset($this->blockvariables[$blockname]); - while (list($varname, $val) = each($this->blockvariables[$blockname])) { + foreach ($this->blockvariables[$blockname] as $varname => $val) { if ($variable == $varname) { $parents[] = $blockname; } @@ -858,8 +858,8 @@ class HTML_Template_ITX extends HTML_Template_IT * calls die() depending on the flags * * @param string $message Warning - * @param string $file File where the warning occured - * @param int $line Linenumber where the warning occured + * @param string $file File where the warning occurred + * @param int $line Linenumber where the warning occurred * * @see $warn, $printWarning, $haltOnWarning * @access private @@ -885,5 +885,4 @@ class HTML_Template_ITX extends HTML_Template_IT } } // end func warning -} // end class HTML_Template_ITX -?> +} // end class HTML_Template_ITX \ No newline at end of file diff --git a/libraries/pear/HTML/Template/IT_Error.php b/libraries/pear/HTML/Template/IT_Error.php index b9a08e1..0f199ee 100644 --- a/libraries/pear/HTML/Template/IT_Error.php +++ b/libraries/pear/HTML/Template/IT_Error.php @@ -1,29 +1,29 @@ + * Pierre-Alain Joye + * David Soria Parra * - * This source file is subject to the New BSD license, That is bundled - * with this package in the file LICENSE, and is available through - * the world-wide-web at - * http://www.opensource.org/licenses/bsd-license.php - * If you did not receive a copy of the new BSDlicense and are unable - * to obtain it through the world-wide-web, please send a note to - * pajoye@php.net so we can mail you a copy immediately. - * - * Author: Ulf Wendel - * Pierre-Alain Joye - * David Soria Parra - * * @category HTML * @package HTML_Template_IT * @author Ulf Wendel * @license BSD http://www.opensource.org/licenses/bsd-license.php - * @version CVS: $Id: IT_Error.php 3 2017-06-22 07:32:17Z martin $ + * @version CVS: $Id$ * @link http://pear.php.net/packages/HTML_Template_IT * @access public */ @@ -31,35 +31,34 @@ require_once "PEAR.php"; /** -* IT[X] Error class -* + * IT[X] Error class + * * @category HTML * @package HTML_Template_IT * @author Ulf Wendel * @license BSD http://www.opensource.org/licenses/bsd-license.php * @link http://pear.php.net/packages/HTML_Template_IT * @access public -*/ + */ class IT_Error extends PEAR_Error { /** * Prefix of all error messages. - * + * * @var string */ var $error_message_prefix = "IntegratedTemplate Error: "; - + /** * Creates an cache error object. - * + * * @param string $msg error message - * @param string $file file where the error occured - * @param string $line linenumber where the error occured + * @param string $file file where the error occurred + * @param string $line linenumber where the error occurred */ - function IT_Error($msg, $file = __FILE__, $line = __LINE__) + function __construct($msg, $file = __FILE__, $line = __LINE__) { - $this->PEAR_Error(sprintf("%s [%s on line %d].", $msg, $file, $line)); + $this->PEAR_Error(sprintf("%s [%s on line %d].", $msg, $file, $line)); } // end func IT_Error - -} // end class IT_Error -?> + +} // end class IT_Error \ No newline at end of file diff --git a/scripts/do_config.php b/scripts/do_config.php index c621d32..19fe6b9 100644 --- a/scripts/do_config.php +++ b/scripts/do_config.php @@ -1,40 +1,51 @@ #!/usr/bin/php getFieldData($strSQL); -$strSQL = "SELECT `id` FROM `tbl_datadomain` WHERE `domain`='$argDomain'"; -$intDomain = $myDBClass->getFieldData($strSQL); -if ($intDomain == '') { - echo "Domain '".$argDomain."' doesn not exist\n"; +/* +Get domain ID +*/ +$strSQL = "SELECT `targets` FROM `tbl_datadomain` WHERE `domain`='$argDomain'"; +$intTarget = $myDBClass->getFieldData($strSQL); +$strSQL = "SELECT `id` FROM `tbl_datadomain` WHERE `domain`='$argDomain'"; +$intDomain = $myDBClass->getFieldData($strSQL); +if ($intDomain === '') { + echo "Domain '" . $argDomain . "' doesn not exist\n"; exit(1); } -if ($intDomain == '0') { - echo "Domain '".$argDomain."' cannot be used\n"; +if ($intDomain === '0') { + echo "Domain '" . $argDomain . "' cannot be used\n"; exit(1); } $myDataClass->intDomainId = $intDomain; $myConfigClass->intDomainId = $intDomain; $myImportClass->intDomainId = $intDomain; -$myConfigClass->getConfigData($intTarget, 'method', $intMethod); -// -// Process form variables -// ====================== -if ($argFunction == 'check') { +$strMethod = ''; +$intMethod = 0; +/* Get connection method */ +if ($myConfigClass->getConfigData($intTarget, 'method', $strMethod) === 0) { + $intMethod = (int)$strMethod; +} +/* +Process form variables +*/ +if ($argFunction === 'check') { $myConfigClass->getConfigData($intTarget, 'binaryfile', $strBinary); $myConfigClass->getConfigData($intTarget, 'basedir', $strBaseDir); $myConfigClass->getConfigData($intTarget, 'nagiosbasedir', $strNagiosBaseDir); $myConfigClass->getConfigData($intTarget, 'conffile', $strConffile); - if ($intMethod == 1) { + if ($intMethod === 1) { if (file_exists($strBinary) && is_executable($strBinary)) { - $resFile = popen($strBinary. ' -v ' .$strConffile, 'r'); + $resFile = popen($strBinary . ' -v ' . $strConffile, 'r'); } else { echo "Cannot find the Nagios binary or no execute permissions!\n"; exit(1); } - } elseif ($intMethod == 2) { + } elseif ($intMethod === 2) { $booReturn = 0; - if (empty($myConfigClass->resConnectId) || !is_resource($myConfigClass->resConnectId)) { + if (empty($myConfigClass->conFTPConId)) { $booReturn = $myConfigClass->getFTPConnection($intTarget); } - if ($booReturn == 1) { + if ($booReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { $intErrorReporting = error_reporting(); error_reporting(0); - if (!($resFile = ftp_exec($myConfigClass->resConnectId, $strBinary.' -v '.$strConffile))) { + if (!($resFile = ftp_exec($myConfigClass->conFTPConId, $strBinary . ' -v ' . $strConffile))) { echo "Remote execution (FTP SITE EXEC) is not supported on your system!\n"; error_reporting($intErrorReporting); exit(1); } - ftp_close($conn_id); + ftp_close($myConfigClass->conFTPConId); error_reporting($intErrorReporting); } - } elseif ($intMethod == 3) { + } elseif ($intMethod === 3) { $booReturn = 0; - if (empty($myConfigClass->resConnectId) || !is_resource($myConfigClass->resConnectId)) { + if (empty($myConfigClass->resSSHConId) || !is_resource($myConfigClass->resSSHConId)) { $booReturn = $myConfigClass->getSSHConnection($intTarget); } - if ($booReturn == 1) { - echo 'SSH connection failure: ' .str_replace('::', "\n", $myConfigClass->strErrorMessage); + if ($booReturn === 1) { + echo 'SSH connection failure: ' . str_replace('::', "\n", $myConfigClass->strErrorMessage); exit(1); } - $intRet1 = $myConfigClass->sendSSHCommand('ls '.$strBinary, $arrRet1); - $intRet2 = $myConfigClass->sendSSHCommand('ls '.$strConffile, $arrRet2); - if (($intRet1 == 0) && ($intRet2 == 0) && is_array($arrRet1) && is_array($arrRet2)) { - $intRet3 = $myConfigClass->sendSSHCommand($strBinary.' -v '.$strConffile, $arrResult); - if ($intRet3 != 0) { + $intRet1 = $myConfigClass->sendSSHCommand('ls ' . $strBinary, $arrRet1); + $intRet2 = $myConfigClass->sendSSHCommand('ls ' . $strConffile, $arrRet2); + if (($intRet1 === 0) && ($intRet2 === 0) && is_array($arrRet1) && is_array($arrRet2)) { + $intRet3 = $myConfigClass->sendSSHCommand($strBinary . ' -v ' . $strConffile, $arrResult); + if ($intRet3 !== 0) { echo "Remote execution of nagios verify command failed (remote SSH)!\n"; exit(1); } @@ -121,16 +136,16 @@ if ($argFunction == 'check') { } } } -if ($argFunction == 'restart') { - // Read config file +if ($argFunction === 'restart') { + /* Read config file */ $myConfigClass->getConfigData($intTarget, 'commandfile', $strCommandfile); $myConfigClass->getConfigData($intTarget, 'pidfile', $strPidfile); - // Check state nagios demon + /* Check state nagios demon */ clearstatcache(); - if ($intMethod == 1) { + if ($intMethod === 1) { if (file_exists($strPidfile)) { if (file_exists($strCommandfile) && is_writable($strCommandfile)) { - $strCommandString = '[' .time(). '] RESTART_PROGRAM;' .time()."\n"; + $strCommandString = '[' . time() . '] RESTART_PROGRAM;' . time() . "\n"; $timeout = 3; $old = ini_set('default_socket_timeout', $timeout); $resCmdFile = fopen($strCommandfile, 'wb'); @@ -150,24 +165,24 @@ if ($argFunction == 'restart') { echo "Nagios daemon is not running, cannot send restart command!\n"; exit(1); } - if ($intMethod == 2) { + if ($intMethod === 2) { echo "Nagios restart is not possible via FTP remote connection!\n"; exit(1); } - if ($intMethod == 3) { + if ($intMethod === 3) { $booReturn = 0; - if (empty($myConfigClass->resConnectId) || !is_resource($myConfigClass->resConnectId)) { + if (empty($myConfigClass->resSSHConId) || !is_resource($myConfigClass->resSSHConId)) { $booReturn = $myConfigClass->getSSHConnection($intTarget); } - if ($booReturn == 1) { + if ($booReturn === 1) { $myVisClass->processMessage($myDataClass->strErrorMessage, $strErrorMessage); } else { - $intRet1 = $myConfigClass->sendSSHCommand('ls '.$strBinary, $arrRet1); - if (($intRet1 == 0) && is_array($arrRet1)) { - $strCommandString = '[' .time(). '] RESTART_PROGRAM;' .time()."\n"; - $strCommand = 'echo "'.$strCommandString.'" >> '.$strCommandfile; - $intRet2 = $myConfigClass->sendSSHCommand($strCommand, $arrResult); - if ($intRet2 != 0) { + $intRet1 = $myConfigClass->sendSSHCommand('ls ' . $strCommandfile, $arrRet1); + if (($intRet1 === 0) && is_array($arrRet1)) { + $strCommandString = '[' . time() . '] RESTART_PROGRAM;' . time() . "\n"; + $strCommand = 'echo "' . $strCommandString . '" >> ' . $strCommandfile; + $intRet2 = $myConfigClass->sendSSHCommand($strCommand, $arrResult); + if ($intRet2 !== 0) { echo "Restart failed - Nagios command file not found or no rights to execute (remote SSH)!\n"; exit(1); } @@ -179,69 +194,69 @@ if ($argFunction == 'restart') { } } } -if ($argFunction == 'write') { - if (substr_count($argObject, 'tbl_') != 0) { +if ($argFunction === 'write') { + if (substr_count($argObject, 'tbl_') !== 0) { $argObject = str_replace('tbl_', '', $argObject); } - if (substr_count($argObject, '.cfg') != 0) { + if (substr_count($argObject, '.cfg') !== 0) { $argObject = str_replace('.cfg', '', $argObject); } - if ($argObject == 'host') { - // Write host configuration + if ($argObject === 'host') { + /* Write host configuration */ $strInfo = "Write host configurations ...\n"; - $strSQL = "SELECT `id` FROM `tbl_host` WHERE `config_id` = $intDomain AND `active`='1'"; + $strSQL = "SELECT `id` FROM `tbl_host` WHERE `config_id` = $intDomain AND `active`='1'"; $myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); $intError = 0; - if ($intDataCount != 0) { + if ($intDataCount !== 0) { foreach ($arrData as $data) { $intReturn = $myConfigClass->createConfigSingle('tbl_host', $data['id']); - if ($intReturn == 1) { + if ($intReturn === 1) { $intError++; } } } - if ($intError == 0) { + if ($intError === 0) { $strInfo .= "Host configuration files successfully written!\n"; } else { $strInfo .= "Cannot open/overwrite the configuration file (check the permissions)!\n"; } - } elseif ($argObject == 'service') { - // Write service configuration - $strInfo = "Write service configurations ...\n"; - $strSQL = 'SELECT `id`, `config_name` FROM `tbl_service` ' + } elseif ($argObject === 'service') { + /* Write service configuration */ + $strInfo = "Write service configurations ...\n"; + $strSQL = 'SELECT `id`, `config_name` FROM `tbl_service` ' . "WHERE `config_id` = $intDomain AND `active`='1' GROUP BY `config_name`"; $myDBClass->hasDataArray($strSQL, $arrData, $intDataCount); $intError = 0; - if ($intDataCount != 0) { + if ($intDataCount !== 0) { foreach ($arrData as $data) { $intReturn = $myConfigClass->createConfigSingle('tbl_service', $data['id']); - if ($intReturn == 1) { + if ($intReturn === 1) { $intError++; } } } - if ($intError == 0) { + if ($intError === 0) { $strInfo .= "Service configuration file successfully written!\n"; } else { $strInfo .= "Cannot open/overwrite the configuration file (check the permissions)!\n"; } } else { - $strInfo = 'Write ' .$argObject.".cfg ...\n"; - $booReturn = $myConfigClass->createConfig('tbl_' .$argObject); - if ($booReturn == 0) { - $strInfo .= 'Configuration file ' .$argObject.".cfg successfully written!\n"; + $strInfo = 'Write ' . $argObject . ".cfg ...\n"; + $booReturn = $myConfigClass->createConfig('tbl_' . $argObject); + if ($booReturn === 0) { + $strInfo .= 'Configuration file ' . $argObject . ".cfg successfully written!\n"; } else { echo $myConfigClass->strErrorMessage; - $strInfo .= 'Cannot open/overwrite the configuration file ' .$argObject. '.cfg (check the permissions or ' - . 'probably tbl_' .$argObject." does not exists)!\n"; + $strInfo .= 'Cannot open/overwrite the configuration file ' . $argObject . '.cfg (check the permissions or ' + . 'probably tbl_' . $argObject . " does not exists)!\n"; } } echo $strInfo; } -if ($argFunction == 'import') { - $strInfo = "Importing configurations ...\n"; - $intReturn = $myImportClass->fileImport($argObject, $intTarget, '1'); - if ($intReturn != 0) { +if ($argFunction === 'import') { + $strInfo = "Importing configurations ...\n"; + $intReturn = $myImportClass->fileImport($argObject, $intTarget, '1'); + if ($intReturn !== 0) { $strInfo .= $myImportClass->strErrorMessage; } else { $strInfo .= $myImportClass->strInfoMessage; @@ -249,27 +264,26 @@ if ($argFunction == 'import') { $strInfo = strip_tags($strInfo); echo str_replace('::', "\n", $strInfo); } - -// -// Output processing -// ================= -if (isset($resFile) && ($resFile != false)) { - $intError = 0; +/* +Output processing +*/ +if (isset($resFile) && ($resFile !== false)) { + $intError = 0; $intWarning = 0; - $strOutput = ''; + $strOutput = ''; while (!feof($resFile)) { $strLine = fgets($resFile, 1024); - if (substr_count($strLine, 'Error:') != 0) { + if (substr_count($strLine, 'Error:') !== 0) { $intError++; } - if (substr_count($strLine, 'Warning:') != 0) { + if (substr_count($strLine, 'Warning:') !== 0) { $intWarning++; } $strOutput .= $strLine; } pclose($resFile); echo $strOutput."\n"; - if (($intError == 0) && ($intWarning == 0)) { + if (($intError === 0) && ($intWarning === 0)) { echo "Written configuration files are valid, Nagios can be restarted!\n\n"; } } elseif (isset($arrResult) && is_array($arrResult)) { @@ -277,16 +291,16 @@ if (isset($resFile) && ($resFile != false)) { $intWarning = 0; $strOutput = ''; foreach ($arrResult as $elem) { - if (substr_count($elem, 'Error:') != 0) { + if (substr_count($elem, 'Error:') !== 0) { $intError++; } - if (substr_count($elem, 'Warning:') != 0) { + if (substr_count($elem, 'Warning:') !== 0) { $intWarning++; } $strOutput .= $elem."\n"; } echo $strOutput."\n"; - if (($intError == 0) && ($intWarning == 0)) { + if (($intError === 0) && ($intWarning === 0)) { echo "Written configuration files are valid, Nagios can be restarted!\n\n"; } -} +} \ No newline at end of file diff --git a/templates/admin/checkcommands.htm.tpl b/templates/admin/checkcommands.htm.tpl index 255fc7b..d5e5717 100644 --- a/templates/admin/checkcommands.htm.tpl +++ b/templates/admin/checkcommands.htm.tpl @@ -1,20 +1,21 @@ - + - +
{TITLE}
- - + + - - + + - - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - +
{LANG_COMMAND} *{LANG_HELP}{LANG_HELP}      
{LANG_COMMAND_LINE} *{LANG_HELP}{LANG_HELP}
{LANG_COMMAND_TYPE} - {LANG_HELP} + {LANG_HELP}
{LANG_ACCESS_GROUP} {LANG_HELP}{LANG_HELP}
{LANG_REGISTERED}{LANG_HELP}{LANG_HELP}
{LANG_HELP_TEXT} $ARG1$ {LANG_HELP_TEXT} $ARG2$
{LANG_HELP_TEXT} $ARG3$ {LANG_HELP_TEXT} $ARG4$
{LANG_HELP_TEXT} $ARG5$ {LANG_HELP_TEXT} $ARG6$
{LANG_HELP_TEXT} $ARG7$ {LANG_HELP_TEXT} $ARG8$
{LANG_ACTIVE} + @@ -105,14 +160,20 @@  
 * {LANG_REQUIRED} * {LANG_REQUIRED} {WARNING}
-
- [{LANG_SHOW_RELATION_DATA}][{LANG_HIDE_RELATION_DATA}]{CHECK_MUST_DATA} -
+
+ [{LANG_SHOW_RELATION_DATA}][{LANG_HIDE_RELATION_DATA}]{CHECK_MUST_DATA} +
diff --git a/templates/admin/configtargets.htm.tpl b/templates/admin/configtargets.htm.tpl index 0af4a87..8e5f747 100644 --- a/templates/admin/configtargets.htm.tpl +++ b/templates/admin/configtargets.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -15,6 +15,7 @@ function abort() { this.location.href = "{ACTION_INSERT}"; } + // Send form /** * @return {boolean} @@ -27,6 +28,7 @@ document.frmDomainInsert.subForm.disabled = true; } } + // Check form entries function checkForm() { // Are all required fields filled in? @@ -47,36 +49,37 @@ const header = "{LANG_FORMCHECK}"; const form = document.frmDomainInsert; let check; - check = checkfields(fields1,form,myFocusObject); + check = checkfields(fields1, form, myFocusObject); if (check === false) { - msginit(msg1,header,1); + msginit(msg1, header, 1); return false; } if (form.selValue1.value === '2') { let check2; - check2 = checkfields(fields2,form,myFocusObject); + check2 = checkfields(fields2, form, myFocusObject); if (check2 === false) { - msginit(msg1,header,1); + msginit(msg1, header, 1); return false; } } if (form.selValue1.value === '3') { let check2a; let check2b; - check2a = checkfields(fields2,form,myFocusObject); - check2b = checkfields(fields3,form,myFocusObject); + check2a = checkfields(fields2, form, myFocusObject); + check2b = checkfields(fields3, form, myFocusObject); if ((check2a === false) && (check2b === false)) { - msginit(msg1,header,1); + msginit(msg1, header, 1); return false; } } // Check for illegal chars if (form.tfValue1.value.match(/[^a-zA-Z0-9.@_-]/)) { - msginit(msg2+" {LANG_DOMAIN}",header,1); + msginit(msg2 + " {LANG_DOMAIN}", header, 1); form.tfValue1.focus(); return false; } } + // Check required fields function checkMust() { if (document.frmDomainInsert.hidId.value !== '0') { @@ -85,15 +88,15 @@ (document.frmDomainInsert.tfValue7.value === "")) { document.frmDomainInsert.tfValue5.className = "inpmust"; document.frmDomainInsert.tfValue6.className = "inpmust"; - document.frmDomainInsert.tfValue7.className = "inpmust"; + document.frmDomainInsert.tfValue7.className = "inpmust"; } else if (((document.frmDomainInsert.tfValue5.value !== "") || - (document.frmDomainInsert.tfValue6.value !== "")) && + (document.frmDomainInsert.tfValue6.value !== "")) && (document.frmDomainInsert.tfValue7.value === "")) { - document.frmDomainInsert.tfValue7.className = "inp"; + document.frmDomainInsert.tfValue7.className = "inp"; document.frmDomainInsert.tfValue5.className = "inpmust"; document.frmDomainInsert.tfValue6.className = "inpmust"; } else if (document.frmDomainInsert.tfValue7.value !== "") { - document.frmDomainInsert.tfValue7.className = "inpmust"; + document.frmDomainInsert.tfValue7.className = "inpmust"; document.frmDomainInsert.tfValue5.className = "inpmust"; document.frmDomainInsert.tfValue6.className = "inp"; } @@ -103,28 +106,32 @@ document.frmDomainInsert.tfValue6.className = "inpmust"; } } + // Enable hidden fields function showFields(key) { if (key === '1') { - document.getElementById('user').className = "elementHide"; - document.getElementById('passwd').className = "elementHide"; + document.getElementById('user').className = "elementHide"; + document.getElementById('passwd').className = "elementHide"; document.getElementById('keypath').className = "elementHide"; - document.getElementById('ftps').className = "elementHide"; + document.getElementById('ftps').className = "elementHide"; + document.getElementById('port').className = "elementHide"; } else if (key === '2') { - document.getElementById('user').className = "elementShow"; - document.getElementById('passwd').className = "elementShow"; + document.getElementById('user').className = "elementShow"; + document.getElementById('passwd').className = "elementShow"; document.getElementById('keypath').className = "elementHide"; - document.getElementById('ftps').className = "elementShow"; - document.frmDomainInsert.tfValue6.className = "inpmust"; - document.frmDomainInsert.tfValue5.className = "inpmust"; + document.getElementById('ftps').className = "elementShow"; + document.getElementById('port').className = "elementHide"; + document.frmDomainInsert.tfValue6.className = "inpmust"; + document.frmDomainInsert.tfValue5.className = "inpmust"; } else { - document.getElementById('user').className = "elementShow"; - document.getElementById('passwd').className = "elementShow"; + document.getElementById('user').className = "elementShow"; + document.getElementById('passwd').className = "elementShow"; document.getElementById('keypath').className = "elementShow"; - document.getElementById('ftps').className = "elementHide"; - document.frmDomainInsert.tfValue5.className = "inpmust"; - document.frmDomainInsert.tfValue6.className = "inpmust"; - document.frmDomainInsert.tfValue7.className = "inpmust"; + document.getElementById('ftps').className = "elementHide"; + document.getElementById('port').className = "elementShow"; + document.frmDomainInsert.tfValue5.className = "inpmust"; + document.frmDomainInsert.tfValue6.className = "inpmust"; + document.frmDomainInsert.tfValue7.className = "inpmust"; if (document.frmDomainInsert.tfValue7.value !== "") { document.frmDomainInsert.tfValue6.className = "inp"; } else if (document.frmDomainInsert.tfValue6.value !== "") { @@ -132,27 +139,38 @@ } } } + //-->
- - + + - + - + - + - + + + + + - - + + - - + + @@ -185,33 +216,45 @@ - - + + - - + + - - + + - - + + - - + + - - + + @@ -221,48 +264,66 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -270,14 +331,16 @@ - + @@ -291,11 +354,13 @@ - + - @@ -304,7 +369,12 @@ - +
{LANG_CONFIG_TARGET} *{LANG_HELP} + {LANG_HELP}
{LANG_DESCRIPTION} *
{LANG_SERVER_NAME} *
{LANG_METHOD} - @@ -161,21 +179,34 @@
{LANG_USERNAME} * +
{LANG_PASSWORD} *
{LANG_SSH_PORT}
{LANG_SSH_KEY} *{LANG_HELP}{LANG_HELP}
{LANG_FTPS}{LANG_HELP}{LANG_HELP}
 
{LANG_BASE_DIRECTORY} *{LANG_HELP}{LANG_HELP}
{LANG_HOST_DIRECTORY} *{LANG_HELP}{LANG_HELP}
{LANG_SERVICE_DIRECTORY} *{LANG_HELP}{LANG_HELP}
{LANG_BACKUP_DIRECTORY} *{LANG_HELP}{LANG_HELP}
{LANG_HOST_BACKUP_DIRECTORY} *{LANG_HELP}{LANG_HELP}
{LANG_SERVICE_BACKUP_DIRECTORY} *{LANG_HELP}{LANG_HELP}
 
{LANG_NAGIOS_BASEDIR} *{LANG_HELP}{LANG_HELP}
{LANG_IMPORT_DIRECTORY}{LANG_HELP}{LANG_HELP}
{LANG_PICTURE_DIRECTORY}{LANG_HELP}{LANG_HELP}
{LANG_NAGIOS_COMMAND_FILE}{LANG_HELP}{LANG_HELP}
{LANG_NAGIOS_BINARY_FILE}{LANG_HELP}{LANG_HELP}
{LANG_NAGIOS_PROCESS_FILE}{LANG_HELP}{LANG_HELP}
{LANG_NAGIOS_CONFIG_FILE} *{LANG_HELP}{LANG_HELP}
{LANG_NAGIOS_CGI_FILE} *{LANG_HELP}{LANG_HELP}
{LANG_NAGIOS_RESOURCE_FILE} *{LANG_HELP}{LANG_HELP}
 
{LANG_NAGIOS_VERSION} - {LANG_HELP}{LANG_HELP}
  {LANG_HELP}{LANG_HELP}
{LANG_ACTIVE} +  
 * {LANG_REQUIRED} * {LANG_REQUIRED}
diff --git a/templates/admin/contactgroups.htm.tpl b/templates/admin/contactgroups.htm.tpl index 56bb41f..5b065b3 100644 --- a/templates/admin/contactgroups.htm.tpl +++ b/templates/admin/contactgroups.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -11,12 +11,14 @@
- - + + - + - - + + @@ -94,16 +110,24 @@
{LANG_CONTACT_GROUP} *{LANG_HELP}{LANG_HELP} {LANG_MEMBERS} *
- + + +
{LANG_MODIFY}
{LANG_HELP}
{LANG_MODIFY}
{LANG_HELP}
{LANG_DESCRIPTION} *{LANG_HELP}{LANG_HELP} {LANG_CTRLINFO}
- + + +
- {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP} {LANG_CTRLINFO} @@ -112,24 +136,31 @@ {LANG_ACCESS_GROUP} - {LANG_HELP} + {LANG_HELP}   - {LANG_REGISTERED} - - {LANG_HELP} - + {LANG_REGISTERED} + + {LANG_HELP} + {LANG_ACTIVE} - + @@ -139,16 +170,22 @@   -  * {LANG_REQUIRED} +  * {LANG_REQUIRED} {WARNING}   -
-
-[{LANG_SHOW_RELATION_DATA}][{LANG_HIDE_RELATION_DATA}]{CHECK_MUST_DATA} + +
+[{LANG_SHOW_RELATION_DATA}][{LANG_HIDE_RELATION_DATA}]{CHECK_MUST_DATA}
diff --git a/templates/admin/contacts.htm.tpl b/templates/admin/contacts.htm.tpl index a1021fa..f32eabf 100644 --- a/templates/admin/contacts.htm.tpl +++ b/templates/admin/contacts.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -12,13 +12,15 @@
@@ -136,84 +143,130 @@ +
- - + +
{LANG_CONTACT_NAME} *{LANG_HELP}{LANG_HELP} {LANG_CONTACT_GROUP} -
- + + +
+
- {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP} {LANG_DESCRIPTION} {VERSION_20_STAR} - - {LANG_HELP} + + {LANG_HELP} {LANG_CTRLINFO} {LANG_MINIMUM_IMPORTANCE} - - {LANG_HELP} + + {LANG_HELP} -   - +   + - + - + - +
+ null {LANG_STANDARD}
- {LANG_HELP} + {LANG_HELP} {LANG_EMAIL_ADDRESS} - - {LANG_HELP} + + {LANG_HELP} {LANG_PAGER_NUMBER} - - {LANG_HELP} + + {LANG_HELP} {LANG_ADDON_ADDRESS} 1 - - {LANG_HELP} + + {LANG_HELP} {LANG_ADDON_ADDRESS} 2 - + {LANG_ADDON_ADDRESS} 3 - + {LANG_ADDON_ADDRESS} 4 - + {LANG_ADDON_ADDRESS} 5 - + {LANG_ADDON_ADDRESS} 6 - - + +   @@ -222,96 +275,168 @@ - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP}
- {LANG_HELP} + {LANG_HELP} {LANG_SERVICE_NOTIF_ENABLE} * - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP}
- {LANG_HELP} + {LANG_HELP} {LANG_TIME_PERIOD_HOSTS} * - + + + - {LANG_HELP} + {LANG_HELP} {LANG_TIME_PERIOD_SERVICES} * - + + + - {LANG_HELP} + {LANG_HELP} {LANG_HOST_OPTIONS} * - + - + - + - - - - - + + + + +
d u rfsf + s n
- {LANG_HELP} - {LANG_HELP} + {LANG_HELP} + {LANG_HELP} {LANG_SERVICE_OPTIONS} * - + - + - + - - - + + + - + - +
w u crr f + s n
- {LANG_HELP} - {LANG_HELP} + {LANG_HELP} + {LANG_HELP} {LANG_HOST_COMMAND} * @@ -319,31 +444,49 @@
- + + +
- {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP} {LANG_SERVICE_COMMAND} * -
- + + +
+ - {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP} {LANG_CTRLINFO} @@ -354,108 +497,177 @@ - + - +
+ {LANG_STANDARD}
- {LANG_HELP} + {LANG_HELP}   - + - +
+ {LANG_STANDARD}
- {LANG_HELP} + {LANG_HELP} -   +   {LANG_RETAIN_STATUS_INFO} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP} {LANG_CAN_SUBMIT_COMMANDS} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP} {LANG_RETAIN_NONSTATUS_INFO} - + - + - + - + -
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- - {LANG_HELP} + + + {LANG_HELP} - {LANG_REGISTERED} - - {LANG_HELP} + {LANG_REGISTERED} + + {LANG_HELP} - {LANG_ACTIVE} - - - - - - - -   - + {LANG_ACTIVE} + + + + + + -  * {LANG_REQUIRED} +   + + +  * {LANG_REQUIRED} {WARNING}   - +
-
+
@@ -471,40 +683,61 @@ - + - - + + - - - + + + - + - + - - + + @@ -519,8 +752,12 @@ - - + + @@ -532,40 +769,53 @@ - + - + -
{LANG_FREE_VARIABLE_DEFINITIONS}
+ +
{LANG_VARIABLE_NAME}{LANG_HELP}{LANG_HELP}
{LANG_VARIABLE_VALUE}{LANG_HELP}{LANG_HELP}
 
{LANG_ADDITIONAL_TEMPLATES}{LANG_ADDITIONAL_TEMPLATES} +
+ +
{LANG_TEMPLATE_NAME} {LANG_HELP}{LANG_HELP}
 
{LANG_GENERIC_NAME}{LANG_HELP}{LANG_HELP}
 {LANG_ACCESS_GROUP} {LANG_HELP}{LANG_HELP}
 
 * {LANG_REQUIRED} * {LANG_REQUIRED} {WARNING}
 
-
-
-
-
+ +
+
+
+ -
-
-[{LANG_SHOW_RELATION_DATA}][{LANG_HIDE_RELATION_DATA}]{CHECK_MUST_DATA} +
+
+[{LANG_SHOW_RELATION_DATA}][{LANG_HIDE_RELATION_DATA}]{CHECK_MUST_DATA}
diff --git a/templates/admin/contacttemplates.htm.tpl b/templates/admin/contacttemplates.htm.tpl index 9df4842..c15fc01 100644 --- a/templates/admin/contacttemplates.htm.tpl +++ b/templates/admin/contacttemplates.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -12,13 +12,15 @@
@@ -89,84 +95,130 @@ +
- - + +
{LANG_TEMPLATE_NAME} *{LANG_HELP}{LANG_HELP} {LANG_CONTACT_GROUP} -
- + + +
+
- {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP} {LANG_DESCRIPTION} - - {LANG_HELP} + + {LANG_HELP} {LANG_CTRLINFO} {LANG_MINIMUM_IMPORTANCE} - - {LANG_HELP} + + {LANG_HELP} -   - - + + - + - - + + - - + + - - + + - + - + - + - + - - + + @@ -175,96 +227,168 @@ - + - + - + - + - - + + - - + + @@ -272,31 +396,49 @@
  + - + - + - +
+ null {LANG_STANDARD}
{LANG_HELP}{LANG_HELP}
{LANG_EMAIL_ADDRESS}{LANG_HELP}{LANG_HELP} {LANG_PAGER_NUMBER}{LANG_HELP}{LANG_HELP}
{LANG_ADDON_ADDRESS} 1{LANG_HELP}{LANG_HELP} {LANG_ADDON_ADDRESS} 2
{LANG_ADDON_ADDRESS} 3 {LANG_ADDON_ADDRESS} 4
{LANG_ADDON_ADDRESS} 5 {LANG_ADDON_ADDRESS} 6
 
- + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP}
{LANG_HELP}{LANG_HELP} {LANG_SERVICE_NOTIF_ENABLE} - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP}
{LANG_HELP}{LANG_HELP}
{LANG_TIME_PERIOD_HOSTS} - + + + {LANG_HELP}{LANG_HELP} {LANG_TIME_PERIOD_SERVICES} - + + + {LANG_HELP}{LANG_HELP}
{LANG_HOST_OPTIONS} - + - + - + - - - - - + + + + +
d u rfsf + s n
{LANG_HELP}{LANG_HELP}{LANG_HELP}{LANG_HELP} {LANG_SERVICE_OPTIONS} - + - + - + - - - + + + - + - +
w u crr f + s n
{LANG_HELP}{LANG_HELP}{LANG_HELP}{LANG_HELP}
{LANG_HOST_COMMAND}
-
- + + +
+ - {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP} {LANG_SERVICE_COMMAND} -
- + + +
+ - {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP} {LANG_CTRLINFO} @@ -307,85 +449,144 @@ - + - +
+ {LANG_STANDARD}
- {LANG_HELP} + {LANG_HELP}   - + - +
+ {LANG_STANDARD}
- {LANG_HELP} + {LANG_HELP} -   +   {LANG_RETAIN_STATUS_INFO} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP} {LANG_CAN_SUBMIT_COMMANDS} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP} {LANG_RETAIN_NONSTATUS_INFO} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- - {LANG_HELP} + + {LANG_HELP} {LANG_ACTIVE} - + @@ -393,9 +594,15 @@   - - -  * {LANG_REQUIRED} + + +  * {LANG_REQUIRED} {WARNING} @@ -403,7 +610,7 @@
-
+
@@ -419,39 +626,60 @@ - + - - + + - - - + + + - + - + - - + + @@ -468,18 +696,28 @@ - + - + @@ -493,14 +731,17 @@ -
- -[{LANG_SHOW_RELATION_DATA}][{LANG_HIDE_RELATION_DATA}]{CHECK_MUST_DATA} +
+ +[{LANG_SHOW_RELATION_DATA}][{LANG_HIDE_RELATION_DATA}]{CHECK_MUST_DATA}
diff --git a/templates/admin/datadomain.htm.tpl b/templates/admin/datadomain.htm.tpl index 45c55d3..291be9d 100644 --- a/templates/admin/datadomain.htm.tpl +++ b/templates/admin/datadomain.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -13,8 +13,9 @@
{LANG_FREE_VARIABLE_DEFINITIONS}
+ +
{LANG_VARIABLE_NAME}{LANG_HELP}{LANG_HELP}
{LANG_VARIABLE_VALUE}{LANG_HELP}{LANG_HELP}
 
{LANG_ADDITIONAL_TEMPLATES}{LANG_ADDITIONAL_TEMPLATES} +
+ +
{LANG_TEMPLATE_NAME} {LANG_HELP}{LANG_HELP}
 {LANG_ACCESS_GROUP} {LANG_HELP}{LANG_HELP}
 
 * {LANG_REQUIRED} * {LANG_REQUIRED} {WARNING}
- - + + - + @@ -76,13 +87,17 @@ - + @@ -90,24 +105,28 @@ - + - + @@ -116,16 +135,18 @@ - + - @@ -134,7 +155,14 @@ - +
{LANG_DOMAIN} *{LANG_HELP} + {LANG_HELP}
{LANG_DESCRIPTION} *
 
{LANG_CONFIG_TARGET} * - + - + {LANG_HELP}{LANG_HELP}
 
{LANG_NAGIOS_VERSION} - {LANG_HELP}{LANG_HELP}
{LANG_ENABLE_COMMON_DOMAIN} - {LANG_HELP}{LANG_HELP}
 {LANG_ACCESS_GROUP} {LANG_HELP}{LANG_HELP}
{LANG_ACTIVE} +  
 * {LANG_REQUIRED}{WARNING} * {LANG_REQUIRED}{WARNING} +
diff --git a/templates/admin/datalist.htm.tpl b/templates/admin/datalist.htm.tpl index e4b1a28..5edeadb 100644 --- a/templates/admin/datalist.htm.tpl +++ b/templates/admin/datalist.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -12,42 +12,47 @@
- +
- - - + + + + + + + + + +
{LANG_SEARCH_STRING}:{LANG_SEARCH} {LANG_DELETE_SEARCH}{LANG_SEARCH_STRING}:{LANG_SEARCH} {LANG_DELETE_SEARCH} {LANG_FILTER}:{LANG_REGISTERED}: {LANG_ACTIVE}:
- - + + - + - + - +
 
{FIELD_1}
{SORT_IMAGE_1}
{FIELD_2}
{SORT_IMAGE_2}
+
{FIELD_1}
+
{SORT_IMAGE_1}
+
+
{FIELD_2}
+
{SORT_IMAGE_2}
+
{LANG_REGISTERED} {LANG_ACTIVE} {LANG_FUNCTION}
{DATA_FIELD_1} {DOMAIN_SPECIAL} {DATA_FIELD_2} {DATA_REGISTERED} {DATA_ACTIVE}{LANG_MODIFY} - {LANG_DUPLICATE} - {LANG_DELETE} - {INFO}{LANG_MODIFY} + {LANG_DUPLICATE} + {LANG_DELETE} + {INFO}
- + +
- - + + @@ -130,7 +184,9 @@ {LANG_MARKED}: - @@ -138,12 +194,15 @@ to Domain: - + - + -
@@ -160,6 +219,7 @@ {ERRORMESSAGE}
{LAST_MODIFIED_TABLE}
{LAST_MODIFIED_FILE}
- {MODIFICATION_STATUS}
+ {MODIFICATION_STATUS}
+

\ No newline at end of file diff --git a/templates/admin/datalist_common.htm.tpl b/templates/admin/datalist_common.htm.tpl index fed6349..04cbd57 100644 --- a/templates/admin/datalist_common.htm.tpl +++ b/templates/admin/datalist_common.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -11,35 +11,38 @@
- - + + @@ -77,15 +88,21 @@ + {LANG_MODIFY} + {LANG_COPY} + {DEL_HIDE_START}{LANG_DELETE}{DEL_HIDE_STOP}
 
{FIELD_1}
{SORT_IMAGE_1}
{FIELD_2}
{SORT_IMAGE_2}
+
{FIELD_1}
+
{SORT_IMAGE_1}
+
+
{FIELD_2}
+
{SORT_IMAGE_2}
+
{LANG_ACTIVE} {LANG_FUNCTION}
{DATA_FIELD_2} {DATA_ACTIVE} - {LANG_MODIFY} - {LANG_COPY} - {DEL_HIDE_START}{LANG_DELETE}{DEL_HIDE_STOP}
- + +
@@ -94,12 +111,14 @@ {LANG_MARKED}: - -
@@ -115,6 +134,7 @@ {ERRORMESSAGE}
{LAST_MODIFIED_TABLE}
{LAST_MODIFIED_FILE}
- {MODIFICATION_STATUS}
+ {MODIFICATION_STATUS}
+

\ No newline at end of file diff --git a/templates/admin/datalist_hosts.htm.tpl b/templates/admin/datalist_hosts.htm.tpl index 6303d6e..56b03b8 100644 --- a/templates/admin/datalist_hosts.htm.tpl +++ b/templates/admin/datalist_hosts.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -12,65 +12,72 @@
- +
- - - + + + + + + + + + +
{LANG_SEARCH_STRING}:{LANG_SEARCH} {LANG_DELETE_SEARCH}{LANG_SEARCH_STRING}:{LANG_SEARCH} {LANG_DELETE_SEARCH} {LANG_FILTER}:{LANG_REGISTERED}: {LANG_ACTIVE}:
- - - + + + - + - + - +
{FIELD_1}
{SORT_IMAGE_1}
{FIELD_2}
{SORT_IMAGE_2}
+ +
{FIELD_1}
+
{SORT_IMAGE_1}
+
+
{FIELD_2}
+
{SORT_IMAGE_2}
+
{LANG_REGISTERED} {LANG_ACTIVE} {LANG_FILE}
{LANG_FUNCTION}
+
{LANG_FUNCTION}
+
{DATA_FIELD_1} {DOMAIN_SPECIAL} {DATA_FIELD_2} {DATA_REGISTERED} {DATA_ACTIVE} {DATA_FILE}{LANG_MODIFY} - {LANG_DUPLICATE} - {LANG_DELETE} - {LANG_WRITE_CONFIG} - {LANG_DOWNLOAD} - {INFO}{LANG_MODIFY} + {LANG_DUPLICATE} + {LANG_DELETE} + {LANG_WRITE_CONFIG} + {LANG_DOWNLOAD} + {INFO}
- + +
- + @@ -156,7 +219,8 @@ {LANG_MARKED}: - @@ -165,12 +229,14 @@ to Domain: - -
@@ -187,6 +253,7 @@ {ERRORMESSAGE}
{LAST_MODIFIED_TABLE}
{LAST_MODIFIED_FILE}
- {MODIFICATION_STATUS}
+ {MODIFICATION_STATUS}
+

\ No newline at end of file diff --git a/templates/admin/datalist_services.htm.tpl b/templates/admin/datalist_services.htm.tpl index ac170b0..43db77a 100644 --- a/templates/admin/datalist_services.htm.tpl +++ b/templates/admin/datalist_services.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -12,71 +12,79 @@
- - - - - - +
{LANG_SEARCH_STRING}:{LANG_SEARCH} {LANG_DELETE_SEARCH}{LANG_CONFIGFILTER}:
+ + + + + +
{LANG_SEARCH_STRING}:{LANG_SEARCH} {LANG_DELETE_SEARCH}
+ + + + + + + + +
{LANG_FILTER}:{LANG_CONFIG_NAME}: - + + + + {LANG_REGISTERED}: {LANG_ACTIVE}:
- - - + + + - + - + - + - + - +
{FIELD_1}
{SORT_IMAGE_1}
{FIELD_2}
{SORT_IMAGE_2}
+ +
{FIELD_1}
+
{SORT_IMAGE_1}
+
+
{FIELD_2}
+
{SORT_IMAGE_2}
+
{LANG_REGISTERED} {LANG_ACTIVE} {LANG_FILE}
{LANG_FUNCTION}
+
{LANG_FUNCTION}
+
{DATA_FIELD_1} {DOMAIN_SPECIAL} {DATA_FIELD_2} {DATA_REGISTERED} {DATA_ACTIVE} {DATA_FILE}{LANG_MODIFY} - {LANG_DUPLICATE} - {LANG_DELETE} - {LANG_WRITE_CONFIG} - {LANG_DOWNLOAD} - {INFO}{LANG_MODIFY} + {LANG_DUPLICATE} + {LANG_DELETE} + {LANG_WRITE_CONFIG} + {LANG_DOWNLOAD} + {INFO}
- + +
- + @@ -169,7 +237,8 @@ {LANG_MARKED}: - @@ -178,17 +247,19 @@ to Domain: - + - + -

- +
@@ -200,6 +271,7 @@ {ERRORMESSAGE}
{LAST_MODIFIED_TABLE}
{LAST_MODIFIED_FILE}
- {MODIFICATION_STATUS}
+ {MODIFICATION_STATUS}
+

\ No newline at end of file diff --git a/templates/admin/delbackup.htm.tpl b/templates/admin/delbackup.htm.tpl index 6282205..6d2f292 100644 --- a/templates/admin/delbackup.htm.tpl +++ b/templates/admin/delbackup.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -14,34 +14,43 @@ function abort() { this.location.href = "{ACTION_INSERT}"; } + // Send form function LockButton() { - document.frmDeleteFile.hidStatus.value = 1; + document.frmDeleteFile.hidStatus.value = 1; document.frmDeleteFile.submit(); document.frmDeleteFile.subForm.disabled = true; } + function del(key) { if (key === "search") { document.frmDeleteFile.txtSearch.value = ""; document.frmDeleteFile.submit(); } } + //-->
- - + + @@ -51,8 +60,13 @@ - +
{LANG_SEARCH_STRING}{LANG_SEARCH} {LANG_DELETE_SEARCH}{LANG_SEARCH} {LANG_DELETE_SEARCH}
{BACKUPFILE} * - + - +
 
  - * {LANG_REQUIRED}  + * {LANG_REQUIRED}
diff --git a/templates/admin/group.htm.tpl b/templates/admin/group.htm.tpl index 326ee52..aab70a4 100644 --- a/templates/admin/group.htm.tpl +++ b/templates/admin/group.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -14,6 +14,7 @@ function abort() { this.location.href = "{ACTION_INSERT}?limit={LIMIT}"; } + // Send form /** * @return {boolean} @@ -27,6 +28,7 @@ document.frmGroupInsert.subForm.disabled = true; } } + // Check form entries function checkForm() { // Are all required fields filled in? @@ -37,53 +39,59 @@ const form = document.frmGroupInsert; let check = checkfields(fields1, form, myFocusObject); if (check === false) { - msginit(msg1,header,1); + msginit(msg1, header, 1); return false; } // Check for illegal chars if (form.tfValue1.value.match(/[^\w.-]/)) { - msginit(msg2+" {LANG_GROUPNAME}",header,1); + msginit(msg2 + " {LANG_GROUPNAME}", header, 1); form.tfValue1.focus(); return false; } } + // Insert group user function insertGroupUser() { const txtUser = document.frmGroupInsert.selValue1.value; let txtRights = ""; if (document.frmGroupInsert.chbRead.checked === true) { - txtRights=txtRights+"1-"; + txtRights = txtRights + "1-"; } else { - txtRights=txtRights+"0-"; + txtRights = txtRights + "0-"; } if (document.frmGroupInsert.chbWrite.checked === true) { - txtRights=txtRights+"1-"; + txtRights = txtRights + "1-"; } else { - txtRights=txtRights+"0-"; + txtRights = txtRights + "0-"; } if (document.frmGroupInsert.chbLink.checked === true) { - txtRights=txtRights+"1"; + txtRights = txtRights + "1"; } else { - txtRights=txtRights+"0"; + txtRights = txtRights + "0"; } if (txtUser === "") { const header = "{LANG_FORMCHECK}"; - msginit("{LANG_INSERT_ALL_VARIABLE}",header,1); + msginit("{LANG_INSERT_ALL_VARIABLE}", header, 1); return false; } - document.getElementById("variableframe").src = "{BASE_PATH}admin/groupusers.php?dataId={DAT_ID}&version={VERSION}&mode=add&user="+txtUser+"&rights="+txtRights; + document.getElementById("variableframe").src = "{BASE_PATH}admin/groupusers.php?dataId={DAT_ID}&version={VERSION}&mode=add&user=" + txtUser + "&rights=" + txtRights; } + //-->
- + - + @@ -102,11 +110,15 @@ - + @@ -142,7 +165,8 @@ - - + - +
{LANG_GROUPNAME} *
{LANG_DESCRIPTION} *
 
+ +
- +
- +
{LANG_USER_NAME} @@ -122,17 +134,28 @@ - + - + - + - +
{LANG_READ}    {LANG_WRITE}    {LANG_LINK}   {LANG_HELP}{LANG_HELP} +
{LANG_ACTIVE} + @@ -152,10 +176,15 @@  
 * {LANG_REQUIRED} * {LANG_REQUIRED}
{WARNING}{WARNING}
diff --git a/templates/admin/helpedit.htm.tpl b/templates/admin/helpedit.htm.tpl index 3b23d8c..be2428b 100644 --- a/templates/admin/helpedit.htm.tpl +++ b/templates/admin/helpedit.htm.tpl @@ -1,107 +1,119 @@ - + - +
{TITLE}
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - +
{INFOKEY_1} - -
{INFOKEY_2} - -
{INFO_VERSION} - -
{LOAD_DEFAULT}
 
 
  + + //--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -
{INFOKEY_1} + +
{INFOKEY_2} + +
{INFO_VERSION} + +
{LOAD_DEFAULT}
 
 
 
- +
+

{ERRORMESSAGE}{INFOMESSAGE}

diff --git a/templates/admin/hostdependencies.htm.tpl b/templates/admin/hostdependencies.htm.tpl index 7b88e4f..4fefb32 100644 --- a/templates/admin/hostdependencies.htm.tpl +++ b/templates/admin/hostdependencies.htm.tpl @@ -1,75 +1,78 @@ - + - - +
{TITLE}
- + -
+ check = checkfields(fields1, form, myFocusObject); + if (check === false) { + msginit(msg1, header, 1); + return false; + } + // Are dependent hosts or dependent hostgroups selected? + if ((form.mselValue1.value === "") && + (form.mselValue3.value === "")) { + msginit(msg1, header, 1); + return false; + } + // Are hosts or hostgroups selected? + if ((form.mselValue2.value === "") && + (form.mselValue4.value === "")) { + msginit(msg1, header, 1); + return false; + } + } + + //--> + + @@ -77,31 +80,47 @@
{LANG_DEPENDHOSTS} (*)
- -
- -
- - {LANG_MODIFY}
{LANG_HELP} - {LANG_DEPENDHOSTGRS} (*) - - - -
- + + +
- {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP} + + {LANG_DEPENDHOSTGRS} (*) + + + + + +
+ +
+ + {LANG_MODIFY}
{LANG_HELP} {LANG_CTRLINFO} @@ -113,31 +132,46 @@
- + + +
- {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP} {LANG_HOSTGROUPS} (*)
- + + +
- {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP} {LANG_CTRLINFO} @@ -148,79 +182,111 @@ {LANG_CONFIG_NAME} * - - {LANG_HELP} + + {LANG_HELP} {LANG_INHERIT} - - {LANG_HELP} + + {LANG_HELP} {LANG_DEPENDENCY_PERIOD} - {LANG_HELP} + {LANG_HELP} {LANG_EXECFAILCRIT} - + - + - + - + - +
o d u p n
- {LANG_HELP} + {LANG_HELP} {LANG_ACCESS_GROUP} - {LANG_HELP} + {LANG_HELP} {LANG_NOTIFFAILCRIT} - + - + - + - + - +
o d u p n
- {LANG_HELP} + {LANG_HELP} - {LANG_REGISTERED} - - {LANG_HELP} + {LANG_REGISTERED} + + {LANG_HELP} {LANG_ACTIVE} - + @@ -229,15 +295,20 @@   -  * {LANG_REQUIRED} +  * {LANG_REQUIRED} {WARNING}   -
-
+ +
diff --git a/templates/admin/hostescalations.htm.tpl b/templates/admin/hostescalations.htm.tpl index 2c9cb8e..18cfcfb 100644 --- a/templates/admin/hostescalations.htm.tpl +++ b/templates/admin/hostescalations.htm.tpl @@ -1,109 +1,124 @@ - + - +
{TITLE}
- + -
- + check = checkfields(fields1, form, myFocusObject); + if (check === false) { + msginit(msg1, header, 1); + return false; + } + if ((version >= 3) && (form.mselValue1.value === "") && (form.mselValue2.value === "")) { + msginit(msg1, header, 1); + return false; + } + if ((version < 3) && (form.mselValue2.value === "")) { + msginit(msg1, header, 1); + return false; + } + if ((form.mselValue3.value === "") && (form.mselValue4.value === "")) { + msginit(msg1, header, 1); + return false; + } + } + + //--> + + +
- + - + @@ -115,31 +130,49 @@
{LANG_HOSTS} (*)
- + + +
{LANG_MODIFY}
{LANG_HELP}
{LANG_MODIFY}
{LANG_HELP}
{LANG_HOSTGROUPS} (*)
- + + +
{LANG_MODIFY}
{LANG_HELP}
{LANG_MODIFY}
{LANG_HELP}
{LANG_CTRLINFO}
- + + +
- {LANG_MODIFY}
{LANG_HELP}
+ {LANG_MODIFY}
{LANG_HELP}
{LANG_CONTACT_GROUPS} (*) -
- + + +
+ - {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP} {LANG_CTRLINFO} @@ -147,63 +180,90 @@ {LANG_CONFIG_NAME} * - - {LANG_HELP} + + {LANG_HELP} {LANG_ESCALATION_PERIOD} - {LANG_HELP} + {LANG_HELP} + {LANG_FIRST_NOTIFICATION} * - - {LANG_HELP} + + {LANG_HELP} + {LANG_ESCALATION_OPTIONS} - + - + - +
d u r
- {LANG_HELP} + {LANG_HELP} + {LANG_LAST_NOTIFICATION} * - - {LANG_HELP} + + {LANG_HELP} + {LANG_ACCESS_GROUP} - {LANG_HELP} + {LANG_HELP} - {LANG_NOTIFICATION_INTERVAL} * - min - {LANG_HELP} - {LANG_REGISTERED} - - {LANG_HELP} + {LANG_NOTIFICATION_INTERVAL} * + min + {LANG_HELP} + {LANG_REGISTERED} + + {LANG_HELP}   {LANG_ACTIVE} - + @@ -212,14 +272,19 @@   -  * {LANG_REQUIRED} +  * {LANG_REQUIRED} {WARNING}   -
+

diff --git a/templates/admin/hostextinfo.htm.tpl b/templates/admin/hostextinfo.htm.tpl index 42f53a4..ccf4794 100644 --- a/templates/admin/hostextinfo.htm.tpl +++ b/templates/admin/hostextinfo.htm.tpl @@ -1,129 +1,170 @@ - + - +
{TITLE}
- -
+ let check = checkfields2(fields1, form, myFocusObject); + if (check === false) { + msginit(msg1, header, 1); + return false; + } + } + + //--> + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - + - + - +
{LANG_HOST_NAME} * - + + + {LANG_HELP}{LANG_HELP} {LANG_ICON_IMAGE}{LANG_HELP}{LANG_HELP}
{LANG_NOTES}{LANG_HELP}{LANG_HELP} {LANG_ICON_IMAGE_ALT_TEXT}{LANG_HELP}{LANG_HELP} +
{LANG_NOTES_URL}{LANG_HELP}{LANG_HELP} {LANG_VRML_IMAGE}{LANG_HELP}{LANG_HELP}
{LANG_ACTION_URL}{LANG_HELP}{LANG_HELP} {LANG_STATUS_IMAGE}{LANG_HELP}{LANG_HELP}
{LANG_REGISTERED}{LANG_HELP}{LANG_HELP} {LANG_2D_COORDS}(x,y){LANG_HELP}(x,y){LANG_HELP}
{LANG_ACTIVE} - - - + + + {LANG_3D_COORDS}(x,y,z){LANG_HELP} (x,y,z){LANG_HELP}
   {LANG_ACCESS_GROUP} {LANG_HELP}{LANG_HELP}
 
 * {LANG_REQUIRED} * {LANG_REQUIRED} {WARNING}
 
-
+
diff --git a/templates/admin/hostgroups.htm.tpl b/templates/admin/hostgroups.htm.tpl index 66c08b3..a109d43 100644 --- a/templates/admin/hostgroups.htm.tpl +++ b/templates/admin/hostgroups.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -11,12 +11,14 @@ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{LANG_HOSTGROUP_NAME} *{LANG_HELP}{LANG_MEMBERS} {VERSION_20_STAR} - - - - -
- -
-
{LANG_MODIFY}
{LANG_HELP}
{LANG_DESCRIPTION} *{LANG_HELP}{LANG_CTRLINFO}
{LANG_NOTES}{LANG_HELP}
{LANG_NOTES_URL}{LANG_HELP}
{LANG_ACTION_URL}{LANG_HELP}{LANG_HOSTGROUP_MEMBERS} - - - - -
- -
-
{LANG_MODIFY}
{LANG_HELP}
{LANG_ACCESS_GROUP} - - {LANG_HELP}{LANG_CTRLINFO}
 
{LANG_REGISTERED}{LANG_HELP}
{LANG_ACTIVE} - - - -
 
 * {LANG_REQUIRED}{WARNING}
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{LANG_HOSTGROUP_NAME} *{LANG_HELP}{LANG_MEMBERS} {VERSION_20_STAR} + + + + +
+ +
+
{LANG_MODIFY}
{LANG_HELP}
{LANG_DESCRIPTION} *{LANG_HELP}{LANG_CTRLINFO}
{LANG_NOTES} + {LANG_HELP}
{LANG_NOTES_URL} + {LANG_HELP}
{LANG_ACTION_URL}{LANG_HELP}{LANG_HOSTGROUP_MEMBERS} + + + + +
+ +
+
{LANG_MODIFY}
{LANG_HELP}
{LANG_ACCESS_GROUP} + + {LANG_HELP}{LANG_CTRLINFO}
 
{LANG_REGISTERED}{LANG_HELP}
{LANG_ACTIVE} + + + +
 
 * {LANG_REQUIRED}{WARNING}
 
{CHECK_MUST_DATA}
diff --git a/templates/admin/hosts.htm.tpl b/templates/admin/hosts.htm.tpl index 36b35b9..3826b9c 100644 --- a/templates/admin/hosts.htm.tpl +++ b/templates/admin/hosts.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -12,11 +12,11 @@ -
+
+
@@ -176,132 +190,242 @@ - - + + - - + + - - + + - - + + - + - + - + - + - + - + - + - - - - - + + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - + - @@ -309,25 +433,38 @@ - + - - + + - + @@ -337,7 +474,7 @@
{LANG_HOST_NAME} *{LANG_HELP}{LANG_HELP} {LANG_DESCRIPTION} *{LANG_HELP}{LANG_HELP}
{LANG_ADDRESS} *{LANG_HELP}{LANG_HELP} {LANG_DISPLAY_NAME}{LANG_HELP}{LANG_HELP}
{LANG_PARENTS}

{LANG_CTRLINFO}
{LANG_PARENTS}

{LANG_CTRLINFO}
+
- +
- + + +
{LANG_MODIFY}
{LANG_HELP}
{LANG_MODIFY}
{LANG_HELP}
{LANG_HOST_GROUPS}

{LANG_CTRLINFO}
- + + +
{LANG_MODIFY}
{LANG_HELP}
{LANG_MODIFY}
{LANG_HELP}
  - +
- + - + - +
+ null {LANG_STANDARD}
{LANG_HELP}{LANG_HELP}   - + - + - +
+ null {LANG_STANDARD}
{LANG_HELP}{LANG_HELP}
{LANG_CHECK_COMMAND} - + + + {LANG_HELP}{LANG_HELP}
{LANG_COMMAND_VIEW} + +
$ARG1${LANG_HELP}$ARG5$$ARG1$ {LANG_HELP}{LANG_HELP}$ARG5$ {LANG_HELP}
$ARG2$$ARG6$$ARG2$ {LANG_HELP}$ARG6$ {LANG_HELP}
$ARG3$$ARG7$$ARG3$ {LANG_HELP}$ARG7$ {LANG_HELP}
$ARG4$$ARG8$$ARG4$ {LANG_HELP}$ARG8$ {LANG_HELP}
 {LANG_REGISTERED}{LANG_HELP} {LANG_REGISTERED}{LANG_HELP}
{LANG_ADDITIONAL_TEMPLATES}{LANG_ADDITIONAL_TEMPLATES} + {LANG_ACTIVE} +
+ +
{LANG_TEMPLATE_NAME} - + + +
 
 * {LANG_REQUIRED} * {LANG_REQUIRED} {WARNING}
-
+
@@ -348,112 +485,202 @@ - + - - + + - - + + - - + + - + - - + + - + - - + + - +
{LANG_CHECK_SETTINGS} - + - + - +
o d u
{LANG_HELP}{LANG_HELP} {LANG_RETRY_INTERVAL}min{LANG_HELP}min + {LANG_HELP}
{LANG_MAX_CHECK_ATTEMPTS} *{LANG_HELP}{LANG_HELP} {LANG_CHECK_INTERVAL}min{LANG_HELP}min{LANG_HELP}
{LANG_ACTIVE_CHECKS_ENABLED} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
{LANG_HELP}{LANG_HELP} {LANG_PASSIVE_CHECKS_ENABLED} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
{LANG_HELP}
{LANG_HELP}
 
{LANG_CHECK_PERIOD} * - + + + {LANG_HELP}{LANG_HELP} {LANG_FRESHNESS_TRESHOLD}sec{LANG_HELP}sec{LANG_HELP}
{LANG_CHECK_FRESHNESS} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
{LANG_HELP}{LANG_HELP} {LANG_OBSESS_OVER_HOST} - + - + - + - + -
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
+
- {LANG_HELP} + {LANG_HELP}   @@ -461,72 +688,121 @@ {LANG_EVENT_HANDLER} - + - {LANG_HELP} + {LANG_HELP} {LANG_EVENT_HANDLER_ENABLED} - + - + - + - + -
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
+ - {LANG_HELP} + {LANG_HELP}   {LANG_LOW_FLAP_THRESHOLD} - % - {LANG_HELP} + % + + {LANG_HELP} {LANG_HIGH_FLAP_THRESHOLD} - % - {LANG_HELP} + % + + {LANG_HELP} {LANG_FLAP_DETECTION_ENABLED} - + - + - + - + -
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
+ - {LANG_HELP} + {LANG_HELP} {LANG_FLAP_DETECTION_OPTIONS} - + - + - +
o d u
- {LANG_HELP} + {LANG_HELP}   @@ -536,59 +812,108 @@ - + - + - + - + -
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
+ - {LANG_HELP} + {LANG_HELP} {LANG_RETAIN_NOSTATUS_INFORMATION} - + - + - + - + -
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
+ - {LANG_HELP} + {LANG_HELP} {LANG_PROCESS_PERF_DATA} - + - + - + - + -
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
+ - {LANG_HELP} + {LANG_HELP}     -  * {LANG_REQUIRED} +  * {LANG_REQUIRED} {WARNING} @@ -607,61 +932,97 @@ - -
- -
- - {LANG_MODIFY}
{LANG_HELP} - {LANG_CONTACTS} *

{LANG_CTRLINFO}
- - - -
- + + +
- {LANG_MODIFY}
{LANG_HELP}
+ {LANG_MODIFY}
{LANG_HELP} + {LANG_CONTACTS} *

{LANG_CTRLINFO}
+ + + + + + +
+ +
+ + {LANG_MODIFY}
{LANG_HELP}
  - + - + - + -
+ null {LANG_STANDARD}
+ - {LANG_HELP} + {LANG_HELP}   - + - + - + -
+ null {LANG_STANDARD}
+ - {LANG_HELP} + {LANG_HELP}   @@ -669,83 +1030,143 @@ {LANG_NOTIFICATION_PERIOD} * - + + + - - {LANG_HELP} + + {LANG_HELP} {LANG_NOTIFICATION_OPTIONS} {VERSION_20_STAR} - + - + - + - + - +
d u r f + s
- {LANG_HELP} + {LANG_HELP} {LANG_NOTIFICATION_INTERVAL} * - min - {LANG_HELP} + min + {LANG_HELP} {LANG_FIRST_NOTIFICATION_DELAY} - min - {LANG_HELP} + min + {LANG_HELP} {LANG_NOTIFICATION_ENABLED} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP} {LANG_STALKING_OPTIONS} - + - + - +
o d u
- {LANG_HELP} + {LANG_HELP} {LANG_IMPORTANCE} - - {LANG_HELP} + + {LANG_HELP}     -  * {LANG_REQUIRED} +  * {LANG_REQUIRED} {WARNING} @@ -754,46 +1175,74 @@
- +
- - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -802,12 +1251,16 @@ - + @@ -826,18 +1279,30 @@ - + - - + + - - - + + + @@ -847,8 +1312,12 @@ - - + + @@ -857,16 +1326,22 @@ - + -
{LANG_ADDON_SETTINGS}
{LANG_NOTES}{LANG_HELP}{LANG_HELP} + {LANG_VRML_IMAGE}{LANG_HELP}{LANG_HELP}
{LANG_NOTES_URL}{LANG_HELP}{LANG_HELP} {LANG_STATUS_IMAGE}{LANG_HELP}{LANG_HELP}
{LANG_ACTION_URL}{LANG_HELP}{LANG_HELP}
{LANG_ICON_IMAGE}{LANG_HELP}{LANG_HELP} {LANG_2D_COORDS}(x,y){LANG_HELP}(x,y){LANG_HELP}
{LANG_ICON_IMAGE_ALT_TEXT}{LANG_HELP}{LANG_HELP} {LANG_3D_COORDS}(x,y,z){LANG_HELP}(x,y,z){LANG_HELP}
 {LANG_ACCESS_GROUP} {LANG_HELP}{LANG_HELP}
 
+ +
{LANG_VARIABLE_NAME}{LANG_HELP}{LANG_HELP}
{LANG_VARIABLE_VALUE}{LANG_HELP}{LANG_HELP}
 
{LANG_GENERIC_NAME}{LANG_HELP}{LANG_HELP}       
 * {LANG_REQUIRED} * {LANG_REQUIRED} {WARNING}
 
+
- +
@@ -877,18 +1352,29 @@ - + @@ -904,9 +1390,14 @@ - + - + - + - + - + - - + - - + + - + - + - + - + - + - + - + - + - + - - + + - + @@ -294,112 +376,202 @@ - + - - + + - - + + - - + + - + - - + + - + - - + + - +
{LANG_SERVICE_SETTINGS}
 
{LANG_SERVICES}

{LANG_CTRLINFO}
{LANG_SERVICES} +

{LANG_CTRLINFO}
- +
- + + + {LANG_MODIFY}
{LANG_HELP}
{LANG_MODIFY}
{LANG_HELP}
- - - +
 * {LANG_REQUIRED}
+ +
 * {LANG_REQUIRED} {WARNING}
@@ -922,14 +1413,17 @@
- [{LANG_SHOW_RELATION_DATA}][{LANG_HIDE_RELATION_DATA}]{CHECK_MUST_DATA} - + [{LANG_SHOW_RELATION_DATA}][{LANG_HIDE_RELATION_DATA}]{CHECK_MUST_DATA} +
diff --git a/templates/admin/hosttemplates.htm.tpl b/templates/admin/hosttemplates.htm.tpl index 4d3f341..3ec6a9e 100644 --- a/templates/admin/hosttemplates.htm.tpl +++ b/templates/admin/hosttemplates.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -12,21 +12,23 @@ - +
+
@@ -135,11 +143,20 @@ - - + + - - + + @@ -147,133 +164,198 @@
{LANG_TEMPLATE_NAME} *{LANG_HELP}{LANG_HELP} {LANG_DESCRIPTION}{LANG_HELP}{LANG_HELP}
{LANG_PARENTS}

{LANG_CTRLINFO}
- + + +
{LANG_MODIFY}
{LANG_HELP}
{LANG_MODIFY}
{LANG_HELP}
{LANG_HOST_GROUPS}

{LANG_CTRLINFO}
- + + +
{LANG_MODIFY}
{LANG_HELP}
{LANG_MODIFY}
{LANG_HELP}
  - + - + - +
+ null {LANG_STANDARD}
{LANG_HELP}{LANG_HELP}   - + - + - +
+ null {LANG_STANDARD}
{LANG_HELP}{LANG_HELP}
{LANG_CHECK_COMMAND} - + + + {LANG_HELP}{LANG_HELP} {LANG_ACTIVE} +
{LANG_COMMAND_VIEW} + +
$ARG1${LANG_HELP}{LANG_HELP} $ARG5$
$ARG2$ $ARG6$
$ARG3$ $ARG7$
$ARG4$ $ARG8$
 
{LANG_ADDITIONAL_TEMPLATES}{LANG_ADDITIONAL_TEMPLATES} +
{LANG_TEMPLATE_NAME}
+ +
{LANG_TEMPLATE_NAME} - + + + {LANG_HELP}{LANG_HELP}
 
 * {LANG_REQUIRED} * {LANG_REQUIRED} {WARNING}
- + - + - +
o d u
{LANG_HELP}{LANG_HELP} {LANG_RETRY_INTERVAL}min{LANG_HELP}min + {LANG_HELP}
{LANG_MAX_CHECK_ATTEMPTS}{LANG_HELP}{LANG_HELP} {LANG_CHECK_INTERVAL}min{LANG_HELP}min{LANG_HELP}
{LANG_ACTIVE_CHECKS_ENABLED} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
{LANG_HELP}{LANG_HELP} {LANG_PASSIVE_CHECKS_ENABLED} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
{LANG_HELP}
{LANG_HELP}
 
{LANG_CHECK_PERIOD} - + + + {LANG_HELP}{LANG_HELP} {LANG_FRESHNESS_TRESHOLD}sec{LANG_HELP}sec{LANG_HELP}
{LANG_CHECK_FRESHNESS} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
{LANG_HELP}{LANG_HELP} {LANG_OBSESS_OVER_HOST} - + - + - + - + -
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
+
- {LANG_HELP} + {LANG_HELP}   @@ -407,72 +579,121 @@ {LANG_EVENT_HANDLER} - + + + - {LANG_HELP} + {LANG_HELP} {LANG_EVENT_HANDLER_ENABLED} - + - + - + - + -
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
+ - {LANG_HELP} + {LANG_HELP}   {LANG_LOW_FLAP_THRESHOLD} - % - {LANG_HELP} + % + + {LANG_HELP} {LANG_HIGH_FLAP_THRESHOLD} - % - {LANG_HELP} + % + + {LANG_HELP} {LANG_FLAP_DETECTION_ENABLED} - + - + - + - + -
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
+ - {LANG_HELP} + {LANG_HELP} {LANG_FLAP_DETECTION_OPTIONS} - + - + - +
o d u
- {LANG_HELP} + {LANG_HELP}   @@ -482,58 +703,108 @@ - + - + - + - + -
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
+ - {LANG_HELP} + {LANG_HELP} {LANG_RETAIN_NOSTATUS_INFORMATION} - + - + - + - + -
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
+ - {LANG_HELP} + {LANG_HELP} {LANG_PROCESS_PERF_DATA} - + - + - + - + -
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
+ - {LANG_HELP} + {LANG_HELP}   -  * {LANG_REQUIRED} +  * {LANG_REQUIRED} {WARNING} @@ -552,61 +823,97 @@
- + + +
- {LANG_MODIFY}
{LANG_HELP} - {LANG_CONTACTS}

{LANG_CTRLINFO} + {LANG_MODIFY}
{LANG_HELP} + {LANG_CONTACTS}

{LANG_CTRLINFO} +
- + + +
- {LANG_MODIFY}
{LANG_HELP}
+ {LANG_MODIFY}
{LANG_HELP}
  - + - + - + -
+ null {LANG_STANDARD}
+ - {LANG_HELP} + {LANG_HELP}   - + - + - + -
+ null {LANG_STANDARD}
+ - {LANG_HELP} + {LANG_HELP}   @@ -614,83 +921,143 @@ {LANG_NOTIFICATION_PERIOD} * - + + + - {LANG_HELP} + {LANG_HELP} {LANG_NOTIFICATION_OPTIONS} - + - + - + - + - +
d u r f + s
- {LANG_HELP} + {LANG_HELP} {LANG_NOTIFICATION_INTERVAL} - min - {LANG_HELP} + min + {LANG_HELP} {LANG_FIRST_NOTIFICATION_DELAY} - min - {LANG_HELP} + min + {LANG_HELP} {LANG_NOTIFICATION_ENABLED} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP} {LANG_STALKING_OPTIONS} - + - + - +
o d u
- {LANG_HELP} + {LANG_HELP} {LANG_IMPORTANCE} - - {LANG_HELP} + + {LANG_HELP}     -  * {LANG_REQUIRED} +  * {LANG_REQUIRED} {WARNING} @@ -698,47 +1065,80 @@
-
+
- - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -747,12 +1147,16 @@ - + @@ -771,24 +1175,40 @@ - + - - + + - - - + + + - + @@ -801,15 +1221,15 @@ - + + {CHECK_MUST_DATA}
- +
diff --git a/templates/admin/import.htm.tpl b/templates/admin/import.htm.tpl index 5795f08..933eac7 100644 --- a/templates/admin/import.htm.tpl +++ b/templates/admin/import.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -11,37 +11,46 @@
{LANG_ADDON_SETTINGS}
{LANG_NOTES}{LANG_HELP}{LANG_HELP} {LANG_VRML_IMAGE}{LANG_HELP} + {LANG_HELP}
{LANG_NOTES_URL}{LANG_HELP}{LANG_HELP} {LANG_STATUS_IMAGE}{LANG_HELP}{LANG_HELP}
{LANG_ACTION_URL}{LANG_HELP}{LANG_HELP}
{LANG_ICON_IMAGE}{LANG_HELP}{LANG_HELP} {LANG_2D_COORDS}(x,y){LANG_HELP}(x,y){LANG_HELP}
{LANG_ICON_IMAGE_ALT_TEXT}{LANG_HELP}{LANG_HELP} {LANG_3D_COORDS}(x,y,z){LANG_HELP}(x,y,z) + {LANG_HELP}
 {LANG_ACCESS_GROUP} {LANG_HELP}{LANG_HELP}
 
+ +
{LANG_VARIABLE_NAME}{LANG_HELP}{LANG_HELP}
{LANG_VARIABLE_VALUE}{LANG_HELP}{LANG_HELP}
 
 * {LANG_REQUIRED} * {LANG_REQUIRED} {WARNING}
- - + + @@ -53,20 +62,26 @@ - + - +
{LANG_SEARCH_STRING}{LANG_SEARCH} {LANG_DELETE_SEARCH}{LANG_SEARCH} {LANG_DELETE_SEARCH}
{IMPORTFILE} - + - +
{OVERWRITE}
 
  
 
- +

{IMPORT_INFO_1}{IMPORT_INFO_2}

-

{ERRORMESSAGE}{INFOMESSAGE}

+

{ERRORMESSAGE}{INFOMESSAGE}

\ No newline at end of file diff --git a/templates/admin/logbook.htm.tpl b/templates/admin/logbook.htm.tpl index dfb3eae..2d3c669 100644 --- a/templates/admin/logbook.htm.tpl +++ b/templates/admin/logbook.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -12,8 +12,9 @@ -
+ - - + +
{LANG_SEARCH_STRING}:{LANG_SEARCH} {LANG_DELETE_SEARCH}{LANG_SEARCH} {LANG_DELETE_SEARCH}
@@ -83,16 +92,26 @@
- + - - + + - - - + + +
{LANG_ENTRIES_BEFORE}{LANG_ENTRIES_BEFORE} +
{LANG_FROM}:{LANG_CALENDAR} {LANG_DELETE_SEARCH}{LANG_CALENDAR} {LANG_DELETE_SEARCH} {LANG_TO}:{LANG_CALENDAR} {LANG_DELETE_SEARCH}{LANG_CALENDAR} {LANG_DELETE_SEARCH}
diff --git a/templates/admin/mainpages.htm.tpl b/templates/admin/mainpages.htm.tpl index 47f118a..a88f74b 100644 --- a/templates/admin/mainpages.htm.tpl +++ b/templates/admin/mainpages.htm.tpl @@ -1,16 +1,16 @@ - + - +
{TITLE}

{DESC}


- +

{STATISTICS}

@@ -18,15 +18,15 @@ - + - +
{ACTIVE} {INACTIVE}
{NAME} {ACT_COUNT} {INACT_COUNT}
- +
diff --git a/templates/admin/menuaccess.htm.tpl b/templates/admin/menuaccess.htm.tpl index 3ccf3e3..bc59729 100644 --- a/templates/admin/menuaccess.htm.tpl +++ b/templates/admin/menuaccess.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -14,6 +14,7 @@ function update() { document.frmMenuAccess.submit(); } + //-->
diff --git a/templates/admin/mutdialog.htm.tpl b/templates/admin/mutdialog.htm.tpl index e71663c..dc8503c 100644 --- a/templates/admin/mutdialog.htm.tpl +++ b/templates/admin/mutdialog.htm.tpl @@ -1,25 +1,25 @@ - + - + - + none - - - + +
- - -
+ + + - -
+ + +
@@ -32,15 +32,28 @@ - + @@ -50,10 +63,10 @@
-   -
<-

->{DISABLE_HTML_BEGIN}

!->{DISABLE_HTML_END}
<-

->{DISABLE_HTML_BEGIN} +

!->{DISABLE_HTML_END}
 
-
-
+
+
\ No newline at end of file diff --git a/templates/admin/nagioscfg.htm.tpl b/templates/admin/nagioscfg.htm.tpl index f7ce1da..d167c19 100644 --- a/templates/admin/nagioscfg.htm.tpl +++ b/templates/admin/nagioscfg.htm.tpl @@ -1,20 +1,21 @@ - + - +
{TITLE}
- + -
 
  +  
diff --git a/templates/admin/password.htm.tpl b/templates/admin/password.htm.tpl index b8c4943..d22ea59 100644 --- a/templates/admin/password.htm.tpl +++ b/templates/admin/password.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -14,10 +14,8 @@ function abort() { this.location.href = "{ACTION_INSERT}"; } + // Send form - /** - * @return {boolean} - */ function LockButton() { if (checkForm() === false) { return false; @@ -26,6 +24,7 @@ document.frmPasswdInsert.subForm.disabled = true; } } + // Check form entries function checkForm() { // Are all required fields filled in? @@ -36,45 +35,54 @@ const header = "{LANG_FORMCHECK}"; const form = document.frmPasswdInsert; let check; - check = checkfields(fields1,form,myFocusObject); + check = checkfields(fields1, form, myFocusObject); if (check === false) { - msginit(msg1,header,1); + msginit(msg1, header, 1); return false; } - // Are the passwords not equal - if(form.tfValue2.value !== form.tfValue3.value) { - msginit(msg2,header,1); + // The passwords are not equal + if (form.tfValue2.value !== form.tfValue3.value) { + msginit(msg2, header, 1); form.tfValue2.focus(); return false; } - // Is the new passord too short - if((form.tfValue2.value !== "") && (form.tfValue2.value.length <= 5)) { - msginit(msg3,header,1); + // The new passord is too short + if ((form.tfValue2.value !== "") && (form.tfValue2.value.length <= 5)) { + msginit(msg3, header, 1); form.tfValue2.focus(); return false; } } + //--> - + - + - + - +
{LANG_OLD_PASSWORD} *
{LANG_NEW_PASSWORD} *
{LANG_CONFIRM_PASSWORD} *
 
 * {LANG_REQUIRED} * {LANG_REQUIRED}
diff --git a/templates/admin/servicedependencies.htm.tpl b/templates/admin/servicedependencies.htm.tpl index c000d33..7e5d1dd 100644 --- a/templates/admin/servicedependencies.htm.tpl +++ b/templates/admin/servicedependencies.htm.tpl @@ -1,174 +1,210 @@ - + - +
{TITLE}
- + -
- + let check = checkfields(fields1, form, myFocusObject); + if (check === false) { + msginit(msg1, header, 1); + return false; + } + // Are dependent services or dependent servicegroup selected? + if ((form.mselValue6.value === "") && + (form.mselValue8.value === "")) { + msginit(msg1, header, 1); + return false; + } + // Are services or servicegroups selected? + if ((form.mselValue5.value === "") && + (form.mselValue7.value === "")) { + msginit(msg1, header, 1); + return false; + } + } + + //--> + + +
- - - - + + + + - + - + - + @@ -180,32 +216,49 @@
{LANG_DEPENDHOSTS} (*) - -
- -
-
{LANG_MODIFY}
{LANG_HELP}
{LANG_HOSTS} (*) - - -
- + + +
{LANG_MODIFY}
{LANG_HELP}
{LANG_MODIFY}
{LANG_HELP}
{LANG_HOSTS} (*) + + + + +
+ +
+
{LANG_MODIFY}
{LANG_HELP}
{LANG_CTRLINFO} {LANG_CTRLINFO}
{LANG_DEPENDHOSTGRS} (*)
- + + +
{LANG_MODIFY}
{LANG_HELP}
{LANG_MODIFY}
{LANG_HELP}
{LANG_HOSTGROUPS} (*)
- + + +
{LANG_MODIFY}
{LANG_HELP}
{LANG_MODIFY}
{LANG_HELP}
{LANG_CTRLINFO}
- + + +
- {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP} {LANG_SERVICES} (*)
- + + +
- {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP} {LANG_CTRLINFO} @@ -217,32 +270,48 @@
- + + +
- {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP} {LANG_SERVICEGROUPS} (*)
- + + +
- {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP} {LANG_CTRLINFO} @@ -250,82 +319,116 @@ {LANG_CONFIG_NAME} * - - {LANG_HELP} + + {LANG_HELP} + {LANG_INHERIT} - - {LANG_HELP} + + {LANG_HELP} + {LANG_DEPENDENCY_PERIOD} - {LANG_HELP} + {LANG_HELP} {LANG_EXECFAILCRIT} - + - + - + - + - + - + -
o w u c p n
+ - {LANG_HELP} + {LANG_HELP} {LANG_ACCESS_GROUP} - + + + - {LANG_HELP} + {LANG_HELP} {LANG_NOTIFFAILCRIT} - + - + - + - + - + - + -
o w u c p n
+ - {LANG_HELP} + {LANG_HELP} - {LANG_REGISTERED} - - {LANG_HELP} + {LANG_REGISTERED} + + {LANG_HELP} {LANG_ACTIVE} - + @@ -334,14 +437,19 @@   -  * {LANG_REQUIRED} +  * {LANG_REQUIRED} {WARNING}   - -
+ +
diff --git a/templates/admin/serviceescalations.htm.tpl b/templates/admin/serviceescalations.htm.tpl index 17768e2..711c81b 100644 --- a/templates/admin/serviceescalations.htm.tpl +++ b/templates/admin/serviceescalations.htm.tpl @@ -1,129 +1,147 @@ - + - +
{TITLE}
- + -
- + let check = checkfields(fields1, form, myFocusObject); + if (check === false) { + msginit(msg1, header, 1); + return false; + } + if ((version >= 3) && (form.mselValue4.value === "") && (form.mselValue5.value === "")) { + msginit(msg1, header, 1); + return false; + } + if ((version < 3) && (form.mselValue5.value === "")) { + msginit(msg1, header, 1); + return false; + } + if ((form.mselValue1.value === "") && (form.mselValue2.value === "") && (form.mselValue6.value === "")) { + msginit(msg1, header, 1); + return false; + } + if ((form.mselValue3.value === "") && (form.mselValue6.value === "")) { + msginit(msg1, header, 1); + return false; + } + } + + //--> + + +
- - - - + + + + @@ -135,31 +153,47 @@
{LANG_HOSTS} (*) - -
- -
-
{LANG_MODIFY}
{LANG_HELP}
{LANG_CONTACT_GROUPS} (*) - - -
- + + +
{LANG_MODIFY}
{LANG_HELP}
{LANG_MODIFY}
{LANG_HELP}
{LANG_CONTACT_GROUPS} (*) + + + + +
+ +
+
{LANG_MODIFY}
{LANG_HELP} +
{LANG_CTRLINFO}
- + + +
- - {LANG_MODIFY}
{LANG_HELP} + + {LANG_MODIFY}
{LANG_HELP} {LANG_CONTACTS} (*)
- +
- {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP} {LANG_CTRLINFO} @@ -171,112 +205,163 @@
- +
- {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP} {LANG_SERVICEGROUPS} (*)
- +
- - {LANG_MODIFY}
{LANG_HELP} + + {LANG_MODIFY}
{LANG_HELP} + {LANG_CTRLINFO} {LANG_CTRLINFO} - {LANG_CONFIG_NAME} * - - {LANG_HELP} - {LANG_FIRST_NOTIFICATION} * - - {LANG_HELP} + {LANG_CONFIG_NAME} * + + {LANG_HELP} + + {LANG_FIRST_NOTIFICATION} * + + {LANG_HELP} - {LANG_NOTIFICATION_INTERVAL} * - - min - {LANG_HELP} - {LANG_LAST_NOTIFICATION} * - - {LANG_HELP} + {LANG_NOTIFICATION_INTERVAL} * + + min + {LANG_HELP} + {LANG_LAST_NOTIFICATION} * + + {LANG_HELP} {LANG_ESCALATION_PERIOD} - + + + - {LANG_HELP} + {LANG_HELP} {LANG_ESCALATION_OPTIONS} - + - + - + - +
w u c r
- {LANG_HELP} + {LANG_HELP} - {LANG_REGISTERED} - - {LANG_HELP} + {LANG_REGISTERED} + + {LANG_HELP} {LANG_ACCESS_GROUP} - + + + - {LANG_HELP} + {LANG_HELP} {LANG_ACTIVE} - + - + +   -  * {LANG_REQUIRED} +  * {LANG_REQUIRED} {WARNING}   -
+
diff --git a/templates/admin/serviceextinfo.htm.tpl b/templates/admin/serviceextinfo.htm.tpl index 750ae39..3b0a8b4 100644 --- a/templates/admin/serviceextinfo.htm.tpl +++ b/templates/admin/serviceextinfo.htm.tpl @@ -1,128 +1,170 @@ - + - +
{TITLE}
- -
- + let check = checkfields2(fields1, form, myFocusObject); + if (check === false) { + msginit(msg1, header, 1); + return false; + } + } + + //--> + + +
- + - - + + - + - - + + - - + + - - + + - - + + - - - + + + - - + - + -
{LANG_HOST_NAME} * - + {LANG_HELP}{LANG_HELP} {LANG_ICON_IMAGE}{LANG_HELP}{LANG_HELP}
{LANG_SERVICE_DESCRIPTION} * - + {LANG_HELP}{LANG_HELP} {LANG_ICON_IMAGE_ALT_TEXT}{LANG_HELP}{LANG_HELP} +
{LANG_NOTES}{LANG_HELP}{LANG_HELP} {LANG_ACTION_URL}{LANG_HELP}{LANG_HELP}
{LANG_NOTES_URL}{LANG_HELP}{LANG_HELP}
{LANG_REGISTERED}{LANG_HELP}{LANG_REGISTERED}{LANG_HELP}
{LANG_ACTIVE} + {LANG_ACCESS_GROUP} {LANG_HELP}{LANG_HELP}
 
 * {LANG_REQUIRED} * {LANG_REQUIRED} {WARNING}
 
-
-
+ + +
diff --git a/templates/admin/servicegroups.htm.tpl b/templates/admin/servicegroups.htm.tpl index 8187bc9..6127fd1 100644 --- a/templates/admin/servicegroups.htm.tpl +++ b/templates/admin/servicegroups.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -11,12 +11,14 @@
- - + + - + - - + + - - + + - - + + - - + + - + - + @@ -136,12 +176,16 @@ - - + + - - + diff --git a/templates/admin/services.htm.tpl b/templates/admin/services.htm.tpl index dd992d4..aaf8cf4 100644 --- a/templates/admin/services.htm.tpl +++ b/templates/admin/services.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -12,22 +12,25 @@ @@ -202,8 +218,15 @@
- - + + @@ -214,207 +237,357 @@
{LANG_SERVICEGROUP_NAME} *{LANG_HELP}{LANG_HELP} {LANG_MEMBERS} {VERSION_20_STAR}
- - +
{LANG_MODIFY}
{LANG_HELP}
{LANG_MODIFY}
{LANG_HELP}
{LANG_DESCRIPTION} *{LANG_HELP}{LANG_HELP} {LANG_CTRLINFO}
{LANG_NOTES}{LANG_HELP}{LANG_HELP}
{LANG_NOTES_URL}{LANG_HELP}{LANG_HELP}
{LANG_ACTION_URL}{LANG_HELP}{LANG_HELP} {LANG_SERVICEGROUP_MEMBERS}
- - +
{LANG_MODIFY}
{LANG_HELP}
{LANG_MODIFY}
{LANG_HELP}
{LANG_ACCESS_GROUP} {LANG_HELP}{LANG_HELP} {LANG_CTRLINFO}
{LANG_REGISTERED}{LANG_HELP}{LANG_HELP}
{LANG_ACTIVE} + @@ -151,7 +195,12 @@  
 * {LANG_REQUIRED} * {LANG_REQUIRED} {WARNING}
{LANG_CONFIG_NAME} *{LANG_HELP}{LANG_HELP}      
- - +
- {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP} {LANG_HOST_GROUPS} (*)

{LANG_CTRLINFO}
- - +
- {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP}   - + - + - +
+ null {LANG_STANDARD}
- {LANG_HELP} + {LANG_HELP}   - + - + - +
+ null {LANG_STANDARD}
- {LANG_HELP} + {LANG_HELP} - {LANG_PARENT_SERVICES}

{LANG_CTRLINFO}
+ {LANG_PARENT_SERVICES}

{LANG_CTRLINFO}
+ - +
- - +
- {LANG_MODIFY}
{LANG_HELP}
+ {LANG_MODIFY}
{LANG_HELP}
{LANG_SERVICEGROUPS}

{LANG_CTRLINFO}
- - +
- {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP}   - +
- + - + - +
+ null {LANG_STANDARD}
- {LANG_HELP} + {LANG_HELP} +   - + - + - +
+ null {LANG_STANDARD}
- {LANG_HELP} + {LANG_HELP} {LANG_SERVICE_DESCRIPTION} * - - {LANG_HELP} + + {LANG_HELP} {LANG_DISPLAY_NAME} - - {LANG_HELP} + + {LANG_HELP} {LANG_CHECK_COMMAND} * - - + - {LANG_HELP} + {LANG_HELP} {LANG_COMMAND_VIEW} - + + + - $ARG1$ - - {LANG_HELP} - $ARG5$ - + $ARG1$ {LANG_HELP} + + {LANG_HELP} + $ARG5$ {LANG_HELP} + - $ARG2$ - - $ARG6$ - + $ARG2$ {LANG_HELP} + + $ARG6$ {LANG_HELP} + - $ARG3$ - - $ARG7$ - + $ARG3$ {LANG_HELP} + + $ARG7$ {LANG_HELP} + - $ARG4$ - - $ARG8$ - + $ARG4$ {LANG_HELP} + + $ARG8$ {LANG_HELP} +   {LANG_REGISTERED} - - {LANG_HELP} + + {LANG_HELP} - {LANG_ADDITIONAL_TEMPLATES} + {LANG_ADDITIONAL_TEMPLATES} + {LANG_ACTIVE} - + {LANG_TEMPLATE_NAME} - + + + {LANG_TEMPLATE_NAME} - - + - {LANG_HELP} - + {LANG_HELP} +   -  * {LANG_REQUIRED} +  * {LANG_REQUIRED} {WARNING} @@ -435,131 +608,233 @@ - + - + - + - +
o w u c
- {LANG_HELP} + {LANG_HELP} {LANG_RETRY_INTERVAL} * - min - {LANG_HELP} + min + + {LANG_HELP} {LANG_MAX_CHECK_ATTEMPTS} * - - {LANG_HELP} + + {LANG_HELP} {LANG_CHECK_INTERVAL} * - min - {LANG_HELP} + min + + {LANG_HELP} {LANG_ACTIVE_CHECKS_ENABLED} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP} {LANG_PASSIVE_CHECKS_ENABLED} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP}   - + {LANG_PARALLELIZE_CHECK} - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP}
- {LANG_HELP} + {LANG_HELP}   {LANG_CHECK_PERIOD} * - - + - {LANG_HELP} + {LANG_HELP} {LANG_FRESHNESS_TRESHOLD} - sec - {LANG_HELP} + sec + {LANG_HELP} {LANG_CHECK_FRESHNESS} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP} {LANG_OBSESS_OVER_SERVICE} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP}   @@ -567,74 +842,125 @@ {LANG_EVENT_HANDLER} - - + - {LANG_HELP} + {LANG_HELP} {LANG_EVENT_HANDLER_ENABLED} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP}   {LANG_LOW_FLAP_THRESHOLD} - % - {LANG_HELP} + % + + {LANG_HELP} {LANG_HIGH_FLAP_THRESHOLD} - % - {LANG_HELP} + % + + {LANG_HELP} {LANG_FLAP_DETECTION_ENABLED} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP} {LANG_FLAP_DETECTION_OPTIONS} - + - + - + - +
o w u c
- {LANG_HELP} + {LANG_HELP}   @@ -644,74 +970,138 @@ - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP} {LANG_RETAIN_NOSTATUS_INFORMATION} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP} {LANG_PROCESS_PERF_DATA} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP} {LANG_IS_VOLATILE} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP}   -  * {LANG_REQUIRED} +  * {LANG_REQUIRED} {WARNING} @@ -730,62 +1120,98 @@
- - +
- {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP} - {LANG_CONTACTS} *

{LANG_CTRLINFO}
+ {LANG_CONTACTS} *

{LANG_CTRLINFO}
+
- - +
- {LANG_MODIFY}
{LANG_HELP}
+ {LANG_MODIFY}
{LANG_HELP}
  - + - + - +
+ null {LANG_STANDARD}
- {LANG_HELP} + {LANG_HELP}   - + - + - +
+ null {LANG_STANDARD}
- {LANG_HELP} + {LANG_HELP}   @@ -793,87 +1219,152 @@ {LANG_NOTIFICATION_PERIOD} * - - + - {LANG_HELP} + {LANG_HELP} {LANG_NOTIFICATION_OPTIONS} {VERSION_20_STAR} - + - + - + - + - + - +
w u c r f + s
- {LANG_HELP} + {LANG_HELP} {LANG_NOTIFICATION_INTERVAL} * - min - {LANG_HELP} + min + {LANG_HELP} {LANG_FIRST_NOTIFICATION_DELAY} - min - {LANG_HELP} + min + {LANG_HELP} {LANG_NOTIFICATION_ENABLED} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP} {LANG_STALKING_OPTIONS} - + - + - + - +
o d u c
- {LANG_HELP} + {LANG_HELP} {LANG_IMPORTANCE} - - {LANG_HELP} + + {LANG_HELP}     -  * {LANG_REQUIRED} +  * {LANG_REQUIRED} {WARNING} @@ -888,24 +1379,40 @@ {LANG_NOTES} - - {LANG_HELP} + + {LANG_HELP} {LANG_ICON_IMAGE} - - {LANG_HELP} + + {LANG_HELP} {LANG_NOTES_URL} - - {LANG_HELP} + + {LANG_HELP} {LANG_ICON_IMAGE_ALT_TEXT} - - {LANG_HELP} + + {LANG_HELP} {LANG_ACTION_URL} - - {LANG_HELP} + + {LANG_HELP}   @@ -915,11 +1422,14 @@ - {LANG_HELP} + {LANG_HELP}   @@ -938,18 +1448,30 @@ - + + + {LANG_VARIABLE_NAME} - - {LANG_HELP} + + {LANG_HELP} {LANG_VARIABLE_VALUE} - - {LANG_HELP} - + + {LANG_HELP} +   @@ -959,8 +1481,12 @@ {LANG_GENERIC_NAME} - - {LANG_HELP} + + {LANG_HELP}       @@ -969,7 +1495,11 @@   -  * {LANG_REQUIRED} +  * {LANG_REQUIRED} {WARNING} @@ -983,7 +1513,7 @@ @@ -149,8 +157,13 @@ {LANG_TEMPLATE_NAME} * - - {LANG_HELP} + + {LANG_HELP}       @@ -161,178 +174,276 @@
- - +
- {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP} {LANG_HOST_GROUPS}

{LANG_CTRLINFO}
- - +
- {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP}   - + - + - +
+ null {LANG_STANDARD}
- {LANG_HELP} + {LANG_HELP} - + - + - +
+ null {LANG_STANDARD}
- {LANG_HELP} + {LANG_HELP} - {LANG_PARENT_SERVICES}

{LANG_CTRLINFO}
+ {LANG_PARENT_SERVICES}

{LANG_CTRLINFO}
+
- - +
- {LANG_MODIFY}
{LANG_HELP}
+ {LANG_MODIFY}
{LANG_HELP}
{LANG_SERVICEGROUPS}

{LANG_CTRLINFO}
- - +
- {LANG_MODIFY}
{LANG_HELP} + {LANG_MODIFY}
{LANG_HELP}   - + - + - +
+ null {LANG_STANDARD}
- {LANG_HELP} + {LANG_HELP}   - + - + - +
+ null {LANG_STANDARD}
- {LANG_HELP} + {LANG_HELP} {LANG_SERVICE_DESCRIPTION} * - - {LANG_HELP} + + {LANG_HELP} {LANG_DISPLAY_NAME} - - {LANG_HELP} + + {LANG_HELP} {LANG_CHECK_COMMAND} - - + - {LANG_HELP} + {LANG_HELP} {LANG_COMMAND_VIEW} - + + + $ARG1$ - - {LANG_HELP} + + {LANG_HELP} $ARG5$ - + $ARG2$ - + $ARG6$ - + $ARG3$ - + $ARG7$ - + $ARG4$ - + $ARG8$ - +   - {LANG_ADDITIONAL_TEMPLATES} + {LANG_ADDITIONAL_TEMPLATES} + {LANG_ACTIVE} - + @@ -340,25 +451,38 @@   - + + + {LANG_TEMPLATE_NAME} - - + - {LANG_HELP} - + {LANG_HELP} +   -  * {LANG_REQUIRED} +  * {LANG_REQUIRED} {WARNING} @@ -379,63 +503,120 @@ - + - + - + - +
o w u c
- {LANG_HELP} + {LANG_HELP} {LANG_RETRY_INTERVAL} - min - {LANG_HELP} + min + + {LANG_HELP} {LANG_MAX_CHECK_ATTEMPTS} - - {LANG_HELP} + + {LANG_HELP} {LANG_CHECK_INTERVAL} - min - {LANG_HELP} + min + {LANG_HELP} {LANG_ACTIVE_CHECKS_ENABLED} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP} {LANG_PASSIVE_CHECKS_ENABLED} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP}   @@ -445,64 +626,109 @@ - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP}
- {LANG_HELP} + {LANG_HELP} {LANG_CHECK_PERIOD} - - + - {LANG_HELP} + {LANG_HELP} {LANG_FRESHNESS_TRESHOLD} - sec - {LANG_HELP} + sec + {LANG_HELP} {LANG_CHECK_FRESHNESS} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP} {LANG_OBSESS_OVER_SERVICE} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP}   @@ -510,74 +736,125 @@ {LANG_EVENT_HANDLER} - - + - {LANG_HELP} + {LANG_HELP} {LANG_EVENT_HANDLER_ENABLED} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP}   {LANG_LOW_FLAP_THRESHOLD} - % - {LANG_HELP} + % + + {LANG_HELP} {LANG_HIGH_FLAP_THRESHOLD} - % - {LANG_HELP} + % + + {LANG_HELP} {LANG_FLAP_DETECTION_ENABLED} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP} {LANG_FLAP_DETECTION_OPTIONS} - + - + - + - +
o w u c
- {LANG_HELP} + {LANG_HELP}   @@ -587,74 +864,138 @@ - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP} {LANG_RETAIN_NOSTATUS_INFORMATION} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP} {LANG_PROCESS_PERF_DATA} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP} {LANG_IS_VOLATILE} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP}   -  * {LANG_REQUIRED} +  * {LANG_REQUIRED} {WARNING} @@ -673,60 +1014,97 @@
- - +
- {LANG_MODIFY}
{LANG_HELP} - {LANG_CONTACTS}

{LANG_CTRLINFO}
+ {LANG_MODIFY}
{LANG_HELP} + {LANG_CONTACTS}

{LANG_CTRLINFO}
+
- - +
- {LANG_MODIFY}
{LANG_HELP}
+ {LANG_MODIFY}
{LANG_HELP}
  - + - + - +
+ null {LANG_STANDARD}
- {LANG_HELP} + {LANG_HELP} - + - + - +
+ null {LANG_STANDARD}
- {LANG_HELP} + {LANG_HELP}   @@ -734,87 +1112,150 @@ {LANG_NOTIFICATION_PERIOD} * - - + - {LANG_HELP} + {LANG_HELP} {LANG_NOTIFICATION_OPTIONS} - + - + - + - + - + - +
w u c r f + s
- {LANG_HELP} + {LANG_HELP} {LANG_NOTIFICATION_INTERVAL} - - {LANG_HELP} + + {LANG_HELP} {LANG_FIRST_NOTIFICATION_DELAY} - - {LANG_HELP} + + {LANG_HELP} {LANG_NOTIFICATION_ENABLED} - + - + - + - +
{LANG_ON} {LANG_OFF} {LANG_SKIP} + null
- {LANG_HELP} + {LANG_HELP} {LANG_STALKING_OPTIONS} - + - + - + - +
o w u c
- {LANG_HELP} + {LANG_HELP} {LANG_IMPORTANCE} - - {LANG_HELP} + + {LANG_HELP}     -  * {LANG_REQUIRED} +  * {LANG_REQUIRED} {WARNING} @@ -829,24 +1270,43 @@ {LANG_NOTES} - - {LANG_HELP} + + {LANG_HELP} {LANG_ICON_IMAGE} - - {LANG_HELP} + + + {LANG_HELP} {LANG_NOTES_URL} - - {LANG_HELP} + + {LANG_HELP} {LANG_ICON_IMAGE_ALT_TEXT} - - {LANG_HELP} + + {LANG_HELP} {LANG_ACTION_URL} - - {LANG_HELP} + + {LANG_HELP}   @@ -854,13 +1314,18 @@ {LANG_ACCESS_GROUP} - - + - {LANG_HELP} + {LANG_HELP}   @@ -879,24 +1344,40 @@ - + + + {LANG_VARIABLE_NAME} - - {LANG_HELP} + + {LANG_HELP} {LANG_VARIABLE_VALUE} - - {LANG_HELP} - + + {LANG_HELP} +   -  * {LANG_REQUIRED} +  * {LANG_REQUIRED} {WARNING} @@ -910,7 +1391,7 @@ @@ -118,18 +122,23 @@ {TEMPDIR_NAME} * - - {LANG_HELP} + + {LANG_HELP} {PROTOCOL_NAME} * - - - {LANG_HELP} + + + {LANG_HELP}   @@ -141,17 +150,20 @@ {LOCALE} - {LANG_HELP} + {LANG_HELP} {ENCODING_NAME} - - {LANG_HELP} + + + {LANG_HELP}   @@ -161,28 +173,38 @@ {SERVER_NAME} * - - {LANG_HELP} + + {LANG_HELP} {SERVER_PORT} * - - {LANG_HELP} + + {LANG_HELP} {DATABASE_NAME} * - - {LANG_HELP} + + {LANG_HELP} {USERNAME_NAME} * - - {LANG_HELP} + + {LANG_HELP} {PASSWORD_NAME} - - {LANG_HELP} + + {LANG_HELP}   @@ -192,18 +214,21 @@ {LOGOFFTIME_NAME} - - {LANG_HELP} + + {LANG_HELP} {WSAUTH_NAME} * - + - + - {LANG_HELP} + {LANG_HELP}   @@ -213,66 +238,114 @@ {PAGELINES_NAME} - - {LANG_HELP} + + + {LANG_HELP} {SELDISABLE_NAME} - + - - - {LANG_HELP} + + + {LANG_HELP} {TEMPLATE_CHECK} -
{LANG_ENABLE}
-
{LANG_DISABLE}
+ +
{LANG_ENABLE}
+ +
{LANG_DISABLE}
- {LANG_HELP} + {LANG_HELP} {UPDATE_CHECK} -
{LANG_ENABLE}
-
{LANG_DISABLE}
+ +
{LANG_ENABLE}
+ +
{LANG_DISABLE}
- {LANG_HELP} + {LANG_HELP} {UPD_PROXY_CHECK} -
{LANG_ENABLE}
-
{LANG_DISABLE}
+ +
{LANG_ENABLE}
+ +
{LANG_DISABLE}
- {LANG_HELP} + {LANG_HELP} {UPD_PROXY_SERVER} * - - {LANG_HELP} + + {LANG_HELP} {UPD_PROXY_USERNAME} - - {LANG_HELP} + + {LANG_HELP} {UPD_PROXY_PASSWORD} - - {LANG_HELP} + + {LANG_HELP}   -  * {LANG_REQUIRED} + {PERFORMANCE} + + + {SHOW_PARENTS} + + +
{LANG_ENABLE}
+ +
{LANG_DISABLE}
+ + {LANG_HELP} + + +   + + +  * {LANG_REQUIRED} -
+

{ERRORMESSAGE}{INFOMESSAGE}

diff --git a/templates/admin/support.htm.tpl b/templates/admin/support.htm.tpl index 9f10ebc..9aa0040 100644 --- a/templates/admin/support.htm.tpl +++ b/templates/admin/support.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -13,109 +13,119 @@

{WEBSITE_LINK}

{SUBTITLE_2}

{SUPPORT_TEXT_2}

-

{DONATE_LINK} +

{DONATE_LINK}

{SUBTITLE_3}

{SUPPORT_TEXT_3}

-

{TRANSLATION_LINK} +

{TRANSLATION_LINK}

{SUBTITLE_8}

{SUPPORT_TEXT_5}

{GIT_LINK}

{SUBTITLE_4}

{SUPPORT_TEXT_4}

- - -
Loading...
- + + +
Loading...
+ + + + + + + + +
{GIT_TITLE}{GIT_VERSION}  

{SUBTITLE_5}

- + - + - + - + - + - + - + - + - +
Javascript {FAILED} {INI_FILE_UPLOADS} {INI_FILE_UPLOADS_RESULT}
{PHP_VERSION} {PHP_RESULT} {INI_AUTO_START} {INI_AUTO_START_RESULT}
{PHP_SESSION_MODULE} {PHP_SESSION_RESULT} {INI_SUHO_SESS_ENC} {INI_SUHO_SESS_ENC_RESULT}
{PHP_GETTEXT_MODULE} {PHP_GETTEXT_RESULT} {INI_DATE_TIMEZONE} {INI_DATE_TIMEZONE_RESULT}
{PHP_FTP_MODULE} {PHP_FTP_RESULT} {RW_CONFIG} {RW_CONFIG_RESULT}
{PHP_SSH2_MODULE} {PHP_SSH2_RESULT}    
{DB_VERSION} {DB_RESULT}    
- +

{SUBTITLE_6}

{SUPPORT_TEXT_6}

- + - + - + - + - + - + - +
{DOMAIN_NAME} {DOMAIN_NAME_VALUE} {RW_NAG_CONF} {RW_NAG_CONF_RESULT}
{CONNECT_TYPE} {CONNECT_TYPE_RESULT} {CHECK_NAG_LOCK}{CHECK_NAG_LOCK_RESULT}{CHECK_NAG_LOCK_RESULT}
{CONNECT_CHECK} {CONNECT_CHECK_RESULT} {RW_NAG_COMMAND}{RW_NAG_COMMAND_RESULT}{RW_NAG_COMMAND_RESULT}
    {EXE_NAG_BINARY}{EXE_NAG_BINARY_RESULT}{EXE_NAG_BINARY_RESULT}

{SUBTITLE_7}

- +
- + - - -
{CONFIGURATION_NAME} {USED} {DEMON_CONFIG}
{CONFIG_NAME} {ACTIVE_CONFIG_COUNT} {DEMON_CFG_OK}
- + + + +

{ERRORMESSAGE}{INFOMESSAGE}

- + - +
-
+
\ No newline at end of file diff --git a/templates/admin/timeperiods.htm.tpl b/templates/admin/timeperiods.htm.tpl index d98a56e..01608cc 100644 --- a/templates/admin/timeperiods.htm.tpl +++ b/templates/admin/timeperiods.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -11,12 +11,14 @@
- - + + - + - - + + - + - + - - + + - - + @@ -173,7 +211,11 @@ - + @@ -188,30 +230,44 @@ - + - - + + - - + + - - + + - + @@ -219,7 +275,10 @@
{LANG_TIME_PERIOD} *{LANG_HELP}{LANG_HELP} {LANG_EXCLUDE}
- - +
{LANG_MODIFY}
{LANG_HELP}
{LANG_MODIFY}
{LANG_HELP}
{LANG_DESCRIPTION} *{LANG_HELP}{LANG_HELP} {LANG_CTRLINFO}
{LANG_TPLNAME} {LANG_HELP}{LANG_HELP}
{LANG_ACCESS_GROUP} {LANG_HELP}{LANG_HELP}
{LANG_REGISTERED}{LANG_HELP}{LANG_HELP}
{LANG_ACTIVE} + @@ -141,16 +169,26 @@
- - +
{LANG_MODIFY}
{LANG_HELP}
{LANG_MODIFY}
{LANG_HELP}
+
 
+ +
{LANG_WEEKDAY} {LANG_HELP}{LANG_HELP}
{LANG_TIME_RANGE} {LANG_HELP}{LANG_HELP}
{LANG_TIME_DEFINITION}{LANG_HELP} + {LANG_HELP}
{LANG_TIME_RANGE} {LANG_HELP}{LANG_HELP}
 
 * {LANG_REQUIRED} * {LANG_REQUIRED} {WARNING}
- [{LANG_SHOW_RELATION_DATA}][{LANG_HIDE_RELATION_DATA}]{CHECK_MUST_DATA} + [{LANG_SHOW_RELATION_DATA}][{LANG_HIDE_RELATION_DATA}]{CHECK_MUST_DATA}
diff --git a/templates/admin/user.htm.tpl b/templates/admin/user.htm.tpl index 01a944d..ef468cf 100644 --- a/templates/admin/user.htm.tpl +++ b/templates/admin/user.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -14,10 +14,8 @@ function abort() { this.location.href = "{ACTION_INSERT}"; } + // Send form - /** - * @return {boolean} - */ function LockButton() { if (checkForm() === false) { return false; @@ -26,6 +24,7 @@ document.frmUserInsert.subForm.disabled = true; } } + // Check form entries function checkForm() { // Are all required fields filled in? @@ -40,92 +39,115 @@ let check; check = checkfields(fields1, form, myFocusObject); if (check === false) { - msginit(msg1,header,1); + msginit(msg1, header, 1); return false; } // Check for illegal chars if (form.tfValue1.value.match(/[^a-zA-Z0-9.@_-]/)) { - msginit(msg2+" {LANG_USERNAME}",header,1); + msginit(msg2 + " {LANG_USERNAME}", header, 1); form.tfValue1.focus(); return false; } // The passwords do not match - if(form.tfValue3.value !== form.tfValue4.value) { - msginit(msg3,header,1); + if (form.tfValue3.value !== form.tfValue4.value) { + msginit(msg3, header, 1); form.tfValue3.focus(); return false; } // One password is missing - if((form.tfValue3.value === "") && (form.hidId.value === "")) { - msginit(msg4,header,1); + if ((form.tfValue3.value === "") && (form.hidId.value === "")) { + msginit(msg4, header, 1); form.tfValue3.focus(); return false; } // The password is too short - if((form.tfValue3.value !== "") && (form.tfValue3.value.length <= 5)) { - msginit(msg5,header,1); + if ((form.tfValue3.value !== "") && (form.tfValue3.value.length <= 5)) { + msginit(msg5, header, 1); form.tfValue3.focus(); return false; } } + //-->
- + - + - + - + - + - + - - + + - - + + - - +
{LANG_USERNAME} * +
{LANG_DESCRIPTION} * +
{LANG_PASSWORD} {PASSWORD_MUST_STAR}
{LANG_CONFIRM_PASSWORD} {PASSWORD_MUST_STAR}
{LANG_LANGUAGE} {LANG_HELP}{LANG_HELP}
{LANG_STANDARD_DOMAIN} {LANG_HELP}{LANG_HELP}
{LANG_ADMIN_ENABLE}{LANG_HELP}{LANG_HELP}
{LANG_WEBSERVER_AUTH}{LANG_HELP}{LANG_HELP}
 
{LANG_ACTIVE} + @@ -135,7 +157,12 @@  
 * {LANG_REQUIRED} * {LANG_REQUIRED}
diff --git a/templates/admin/verify.htm.tpl b/templates/admin/verify.htm.tpl index b6130b8..7bd1e03 100644 --- a/templates/admin/verify.htm.tpl +++ b/templates/admin/verify.htm.tpl @@ -1,9 +1,9 @@ - + - +
@@ -16,34 +16,34 @@   - + {WRITE_ADDITIONAL_DATA}   - + {CHECK_CONFIG}   - + {RESTART_NAGIOS}   - + - +

{ERRORMESSAGE}{INFOMESSAGE}

-{VERIFY_LINE}
- {DATA}

+ {VERIFY_LINE}
+ {DATA}

\ No newline at end of file diff --git a/templates/index.htm.tpl b/templates/index.htm.tpl index b8d1e69..4b04eeb 100644 --- a/templates/index.htm.tpl +++ b/templates/index.htm.tpl @@ -1,31 +1,34 @@ - + - + -
-

NagiosQL

-

{TITLE_LOGIN}

-
- - - - - - - - - - - -
{USERNAME}:
{PASSWORD}:
 
-
-

{MESSAGE}

-
-

{LOGIN_TEXT}

-
+
+

NagiosQL

+

{TITLE_LOGIN}

+
+ + + + + + + + + + + + + +
{USERNAME}:
{PASSWORD}:
 
+
+

{MESSAGE}

+
+

{LOGIN_TEXT}

+
\ No newline at end of file diff --git a/templates/main.htm.tpl b/templates/main.htm.tpl index 7ed84d9..29f7ba2 100644 --- a/templates/main.htm.tpl +++ b/templates/main.htm.tpl @@ -1,92 +1,94 @@ - + - + - - - - {PAGETITLE} - - - - - - - {SPECIALMETA} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{ADMIN} {MONITOR} {PLUGINS}  
{POSITION}  -
- - - - - - - - - - -
{DOMAIN_INFO} - -   {LOGIN_INFO} {LOGOUT_INFO}
-
-
- - - {MAINMENU} - - -
- - -
-

{VERSION_INFO}

- + + + + {PAGETITLE} + + + + + + + {SPECIALMETA} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{ADMIN} {MONITOR} {PLUGINS}  
{POSITION}  +
+ + + + + + + + + + +
{DOMAIN_INFO} + +   {LOGIN_INFO} {LOGOUT_INFO}
+
+
+ + + {MAINMENU} + + +
+ + +
+

{VERSION_INFO}

+ \ No newline at end of file