New upstream version 3.5.0
This commit is contained in:
@@ -1,61 +1,66 @@
|
||||
<?php
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// NagiosQL
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (c) 2005-2018 by Martin Willisegger
|
||||
//
|
||||
// Project : NagiosQL
|
||||
// Component : Download config file
|
||||
// Website : https://sourceforge.net/projects/nagiosql/
|
||||
// Version : 3.4.0
|
||||
// GIT Repo : https://gitlab.com/wizonet/NagiosQL
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Path settings
|
||||
// ===================
|
||||
/* ----------------------------------------------------------------------------
|
||||
NagiosQL
|
||||
-------------------------------------------------------------------------------
|
||||
(c) 2005-2023 by Martin Willisegger
|
||||
|
||||
Project : NagiosQL
|
||||
Component : Download config file
|
||||
Website : https://sourceforge.net/projects/nagiosql/
|
||||
Version : 3.5.0
|
||||
GIT Repo : https://gitlab.com/wizonet/NagiosQL
|
||||
-----------------------------------------------------------------------------*/
|
||||
|
||||
use functions\NagConfigClass;
|
||||
use functions\NagDataClass;
|
||||
|
||||
/**
|
||||
* Class and variable includes
|
||||
* @var NagDataClass $myDataClass NagiosQL data class
|
||||
* @var NagConfigClass $myConfigClass NagiosQL configuration class
|
||||
*/
|
||||
/*
|
||||
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
|
||||
// ===============
|
||||
$preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF'));
|
||||
$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME'));
|
||||
/*
|
||||
Version control
|
||||
*/
|
||||
session_cache_limiter('private_no_expire');
|
||||
//
|
||||
// Include preprocessing file
|
||||
// ==========================
|
||||
$preNoMain = 1;
|
||||
$preNoLogin = 1;
|
||||
require $preBasePath.'functions/prepend_adm.php';
|
||||
//
|
||||
// Process post parameters
|
||||
// =======================
|
||||
$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
|
||||
// ===============
|
||||
/*
|
||||
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);
|
||||
Reference in New Issue
Block a user