1<?php
2///////////////////////////////////////////////////////////////////////////////
3//
4// NagiosQL
5//
6///////////////////////////////////////////////////////////////////////////////
7//
8// (c) 2005-2020 by Martin Willisegger
9//
10// Project   : NagiosQL
11// Component : Admin information dialog
12// Website   : https://sourceforge.net/projects/nagiosql/
13// Version   : 3.4.1
14// GIT Repo  : https://gitlab.com/wizonet/NagiosQL
15//
16///////////////////////////////////////////////////////////////////////////////
17//
18// Path settings
19// ===================
20$strPattern = '(admin/[^/]*.php)';
21$preRelPath  = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING));
22$preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME', FILTER_SANITIZE_STRING));
23//
24// Include preprocessing file
25// ==========================
26$preNoMain = 1;
27require $preBasePath.'functions/prepend_adm.php';
28//
29// Process get parameters
30// ======================
31$chkKey1    = filter_input(INPUT_GET, 'key1', FILTER_SANITIZE_STRING);
32$chkKey2    = filter_input(INPUT_GET, 'key2', FILTER_SANITIZE_STRING);
33$chkVersion = filter_input(INPUT_GET, 'version', FILTER_SANITIZE_STRING);
34//
35// Get information data
36// ===================================================
37if ($chkKey1 == 'admin' and isset($_SESSION['updInfo'])) {
38    // Exception for version check at admin.php
39    $strContentDB = $_SESSION['updInfo'];
40} elseif ($chkKey1 == 'settings') {
41    // Exception for settings page to have gettext translated text
42    $arrTrans = array(
43        'txtRootPath' => translate('This is relative path of your NagiosQL Installation'),
44        'txtBasePath' => translate('This is the absolut path to your NagiosQL Installation'),
45        'selProtocol' => translate('If you need a secure connection, select HTTPS instead of HTTP'),
46        'txtTempdir' => translate('Please choose a temporary directory with write permissions. The default is the ' .
47            'temp directory provided by your OS'),
48        'selLanguage' => translate('Please choose your application language for new users and login portal'),
49        'txtEncoding' => translate('Encoding should be set to nothing else than utf-8. Any changes at your own risk'),
50        'txtDBserver' => translate('IP-Address or hostname of the database server<br>e.g. localhost'),
51        'txtDBport' => translate('MySQL Server Port, default is 3306'),
52        'txtDBname' => translate('Name of the NagiosQL database<br>e.g. db_nagiosql_v3'),
53        'txtDBuser' => translate('User with sufficient permission for the NagiosQL database<br>At least this user ' .
54            'should have SELECT, INSERT, UPDATE, DELETE permissions'),
55        'txtDBpass' => translate('Password for the above mentioned user'),
56        'txtLogoff' => translate('After the defined amount of seconds the session will terminate for security ' .
57            'reasons'),
58        'selWSAuth' => translate('Decide between authentication based on your Webserver<br>e.g. Apache ' .
59            'configuration (config file or htaccess) or NagiosQL'),
60        'txtLines' => translate('Number of entries per side that should be visible (e.g. services or hosts)'),
61        'selSeldisable' => translate('Method of selection of multiple entries by using the new dialog or by holding ' .
62            'CTRL + left mouse button, as in NagiosQL 2'),
63        'templatecheck' => translate('Enable or disable the warning if a required field contains no data in objects ' .
64            'with templates'),
65        'updatecheck' => translate('Enable or disable the automatic online version check.'),
66        'chkUpdProxy' => translate('If you require a Proxyserver to connect to the Internet (Port 80), please ' .
67            'define one.'),
68        'txtProxyServer' => translate('Address of your Proxyserver e.g. proxy.yourdomain.com:3128'),
69        'txtProxyUser' => translate('Username to connect through your proxy (optional)'),
70        'txtProxyPasswd' => translate('Password to connect through your proxy (optional)'),
71        '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.')
72    );
73    $strContentDB = $arrTrans[$chkKey2];
74} elseif ($chkKey1 == 'cmd_arguments') {
75    // Get information from tbl_command
76    $strSQL       = 'SELECT `arg' .$chkVersion. '_info` FROM `tbl_command` WHERE `id`='.$chkKey2;
77    $strContentDB = nl2br($myDBClass->getFieldData($strSQL));
78} else {
79    // Get information from tbl_info
80    $strSQL       = 'SELECT `infotext` FROM `tbl_info` ' .
81                    "WHERE `key1` = '$chkKey1' AND `key2` = '$chkKey2' AND `version` = '$chkVersion' ".
82                    "AND `language` = 'private'";
83    $strContentDB = $myDBClass->getFieldData($strSQL);
84    if ($strContentDB == '') {
85        $strSQL       = 'SELECT `infotext` FROM `tbl_info` ' .
86                        "WHERE `key1` = '$chkKey1' AND `key2` = '$chkKey2' AND `version` = '$chkVersion' ".
87                        "AND `language` = 'default'";
88        $strContentDB = $myDBClass->getFieldData($strSQL);
89    }
90}
91?>
92<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
93        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
94<html xmlns="http://www.w3.org/1999/xhtml">
95    <head>
96        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
97        <title><?php echo translate('Information PopUp');?></title>
98        <style type="text/css">
99            .infobody {
100                font-family:"Courier New", Courier, monospace;
101                font-size:12px;
102            }
103        </style>
104    </head>
105    <body class="infobody">
106<?php
107if (trim($strContentDB) != '') {
108    echo $strContentDB;
109} else {
110    echo translate('No information available');
111}
112?>
113    </body>
114</html>