Imported Upstream version 3.4.0

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

View File

@@ -5,18 +5,22 @@
//
///////////////////////////////////////////////////////////////////////////////
//
// (c) 2005-2017 by Martin Willisegger
// (c) 2005-2018 by Martin Willisegger
//
// Project : NagiosQL
// Component : Download config file
// Website : http://www.nagiosql.org
// Date : $LastChangedDate: 2017-06-22 09:29:35 +0200 (Thu, 22 Jun 2017) $
// Author : $LastChangedBy: martin $
// Version : 3.3.0
// Revision : $LastChangedRevision: 2 $
// Website : https://sourceforge.net/projects/nagiosql/
// Version : 3.4.0
// GIT Repo : https://gitlab.com/wizonet/NagiosQL
//
///////////////////////////////////////////////////////////////////////////////
//
// 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));
//
// Version control
// ===============
session_cache_limiter('private_no_expire');
@@ -25,44 +29,33 @@ session_cache_limiter('private_no_expire');
// ==========================
$preNoMain = 1;
$preNoLogin = 1;
require("../functions/prepend_adm.php");
require $preBasePath.'functions/prepend_adm.php';
//
// Process post parameters
// =======================
$chkTable = isset($_GET['table']) ? htmlspecialchars($_GET['table'], ENT_QUOTES, 'utf-8') : "";
$chkConfig = isset($_GET['config']) ? htmlspecialchars($_GET['config'], ENT_QUOTES, 'utf-8') : "";
$chkLine = isset($_GET['line']) ? htmlspecialchars($_GET['line'], ENT_QUOTES, 'utf-8') : 0;
$chkTable = filter_input(INPUT_GET, 'table', FILTER_SANITIZE_STRING);
$chkConfig = filter_input(INPUT_GET, 'config', FILTER_SANITIZE_STRING);
$chkLine = filter_input(INPUT_GET, 'line', FILTER_VALIDATE_INT, array('options' => array('default' => 0)));
//
// Header output
// ===============
switch($chkTable) {
case "tbl_timeperiod": $strFile = "timeperiods.cfg"; break;
case "tbl_command": $strFile = "commands.cfg"; break;
case "tbl_contact": $strFile = "contacts.cfg"; break;
case "tbl_contacttemplate": $strFile = "contacttemplates.cfg"; break;
case "tbl_contactgroup": $strFile = "contactgroups.cfg"; break;
case "tbl_hosttemplate": $strFile = "hosttemplates.cfg"; break;
case "tbl_servicetemplate": $strFile = "servicetemplates.cfg"; break;
case "tbl_hostgroup": $strFile = "hostgroups.cfg"; break;
case "tbl_servicegroup": $strFile = "servicegroups.cfg"; break;
case "tbl_servicedependency": $strFile = "servicedependencies.cfg"; break;
case "tbl_hostdependency": $strFile = "hostdependencies.cfg"; break;
case "tbl_serviceescalation": $strFile = "serviceescalations.cfg"; break;
case "tbl_hostescalation": $strFile = "hostescalations.cfg"; break;
case "tbl_hostextinfo": $strFile = "hostextinfo.cfg"; break;
case "tbl_serviceextinfo": $strFile = "serviceextinfo.cfg"; break;
default: $strFile = $chkConfig.".cfg";
$arrConfig = $myConfigClass->getConfData();
if (isset($arrConfig[$chkTable])) {
$strFile = $arrConfig[$chkTable]['filename'];
} else {
$strFile = $chkConfig. '.cfg';
}
if ($strFile == ".cfg") exit;
header("Content-Disposition: attachment; filename=".$strFile);
header("Content-Type: text/plain");
if ($strFile == '.cfg') {
exit;
}
header('Content-Disposition: attachment; filename=' .$strFile);
header('Content-Type: text/plain');
//
// Get data
// ========
if ($chkLine == 0) {
$myConfigClass->createConfig($chkTable,1);
$myConfigClass->createConfig($chkTable, 1);
} else {
$myConfigClass->createConfigSingle($chkTable,$chkLine,1);
$myConfigClass->createConfigSingle($chkTable, $chkLine, 1);
}
$myDataClass->writeLog(translate('Download')." ".$strFile);
?>
$myDataClass->writeLog(translate('Download'). ' ' .$strFile);