-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy patheveryz.php
134 lines (120 loc) · 4.67 KB
/
everyz.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php
/*
* * Purpose: Add support for external modules to extend Zabbix native functions
* * Adail Horst - http://spinola.net.br/blog
* *
* * This program is free software; you can redistribute it and/or modify
* * it under the terms of the GNU General Public License as published by
* * the Free Software Foundation; either version 2 of the License, or
* * (at your option) any later version.
* *
* * This program is distributed in the hope that it will be useful,
* * but WITHOUT ANY WARRANTY; without even the implied warranty of
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* * GNU General Public License for more details.
* *
* * You should have received a copy of the GNU General Public License
* * along with this program; if not, write to the Free Software
* * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* */
// Global definitions ==========================================================
require_once dirname(__FILE__) . '/include/config.inc.php';
/**
* Base path to profiles on Zabbix Database
*/
$baseProfile = "everyz.";
$page['title'] = _('EveryZ');
$page['file'] = 'everyz.php';
$filter = $fields = [];
$TINYPAGE = true;
switch (getRequest('format')) {
case PAGE_TYPE_CSV:
$page['file'] = 'everyz_export.csv';
$page['type'] = detect_page_type(PAGE_TYPE_CSV);
break;
case PAGE_TYPE_JSON:
$page['file'] = 'everyz_export.json';
$page['type'] = detect_page_type(PAGE_TYPE_CSV);
break;
default:
$page['type'] = detect_page_type(PAGE_TYPE_HTML);
break;
}
$page['scripts'] = array('class.calendar.js', 'multiselect.js', 'gtlc.js');
require_once dirname(__FILE__) . '/include/page_header.php';
if ($page['type'] === detect_page_type(PAGE_TYPE_HTML)) {
?>
<link href="local/app/everyz/css/everyz.css" rel="stylesheet" type="text/css" id="skinSheet">
<?php
}
$TINYPAGE = getRequest2("shorturl") !== "";
if ($TINYPAGE) {
?>
<style type="text/css">
body {
min-width: 100%;
margin-bottom: 0px;
}
.filter-space, .filter-container, .filter-btn-container {
display: none;
}
article, .article {
padding: 0px 0px 0 0px;
}
</style>
<?php
}
zbxeCheckDBConfig();
addFilterParameter("action", T_ZBX_STR, "dashboard", false, false, false);
addFilterParameter("shorturl", T_ZBX_STR, '', false, false, false);
zbxeTranslateURL();
/* =============================================================================
* Permissions
============================================================================== */
$config = select_config();
$action = getRequest2("action");
$module = "dashboard";
if (hasRequest('zbxe_reset_all') && getRequest2('zbxe_reset_all') == "EveryZ ReseT" && $action == "zbxe-config") {
try {
show_message(_zeT('EveryZ configuration back to default factory values! Please click on "EveryZ" menu!'));
DBexecute(zbxeStandardDML("DROP TABLE `zbxe_preferences` "));
DBexecute(zbxeStandardDML("DROP TABLE `zbxe_translation` "));
DBexecute(zbxeStandardDML("DROP TABLE `zbxe_shorten` "));
DBexecute(zbxeStandardDML("DELETE FROM `profiles` where idx like 'everyz%' "));
$path = str_replace("local/app/views", "local/app/everyz/init", dirname(__FILE__));
if (!file_exists($path . '/everyz.initdb.php')) {
$path = dirname(__FILE__) . '/local/app/everyz/init';
}
require_once $path . '/everyz.initdb.php';
exit;
} catch (Exception $e) {
}
}
$res = DBselect('SELECT userid, tx_option, tx_value from zbxe_preferences zpre '
. ' WHERE userid in (0,' . CWebUser::$data['userid'] . ') '
. ' and tx_value like ' . quotestr($action . '|%')
. ' order by userid, tx_option');
while ($row = DBfetch($res)) {
$tmp = explode("|", $row['tx_value']);
$module = $tmp[0];
}
/* * ***************************************************************************
* Access Control
* ************************************************************************** */
if ($module == "dashboard") {
zbxeCheckUserLevel(zbxeMenuUserType());
include_once dirname(__FILE__) . "/local/app/views/everyz.dashboard.view.php";
} else {
zbxeCheckUserLevel((count($tmp) > 2 ? (int) $tmp[2] : 3));
$file = dirname(__FILE__) . "/local/app/views/everyz." . $module . ".view.php";
if (file_exists($file)) {
include_once $file;
} else {
echo "Não existe o arquivo do modulo (" . $module . ")";
}
}
if (!$TINYPAGE) {
echo "<!-- Everyz Version - " . EVERYZVERSION . " -->\n";
zbxeFullScreen();
require_once dirname(__FILE__) . '/include/page_footer.php';
}