This repository has been archived by the owner on Jun 10, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
do.php
134 lines (112 loc) · 3.24 KB
/
do.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
<?php
spl_autoload_register(
function ($class) {
include 'inc/' . strtolower($class) . '_class.php';
});
session_start();
if (! isset($_REQUEST['a'])) {
header('Location: index.php');
exit();
} // if
if (isset($_SESSION[LggrState::SESSIONNAME])) {
$state = $_SESSION[LggrState::SESSIONNAME];
} else {
$state = new LggrState();
} // if
// Are we talking to the user or is this an internal call?
$isAjax = false;
switch ($_REQUEST['a']) {
case 'reset':
$state = new LggrState();
break;
case 'search':
$state = new LggrState();
if ('' != trim($_POST['prog'])) {
$state->setSearchProg(trim($_POST['prog']));
}
if ('' != trim($_POST['q'])) {
$state->setSearch(trim($_POST['q']));
} // if
break;
case 'host':
$config = new Config();
$l = new Lggr($state, $config);
$id = intval($_GET['hostid']);
$state->setHostName($l->getServersName($id));
$state->setHostId($id);
$state->setPage(0);
$state->setResultSize(0);
break;
case 'level':
$state->setLevel($_GET['level']);
$state->setPage(0);
$state->setResultSize(0);
break;
case 'range':
$state->setRange(intval($_GET['range']));
$state->setPage(0);
$state->setResultSize(0);
$state->setFromTo(null, null);
break;
case 'fromto':
$sFrom = $_POST['tsfrom'];
$sTo = $_POST['tsto'];
$state->setFromTo($sFrom, $sTo);
$state->setRange(null);
$state->setPage(0);
$state->setResultSize(0);
break;
case 'paginate':
if (isset($_GET['page'])) {
$i = intval($_GET['page']);
if ($i < 0) {
$i = 0;
}
$page = $i;
$state->setPage($page);
} // if
break;
case 'panelopen':
$state->setPanelOpen(true);
$isAjax = true;
$sAjaxReply = 'OK';
break;
case 'panelclose':
$state->setPanelOpen(false);
$isAjax = true;
$sAjaxReply = 'OK';
break;
case 'archive':
$config = new AdminConfig();
$l = new Lggr($state, $config);
$iID = intval($_REQUEST['id']);
$l->setArchive($iID, true);
$isAjax = true;
$sAjaxReply = $iID;
break;
case 'unarchive':
$config = new AdminConfig();
$l = new Lggr($state, $config);
$iID = intval($_REQUEST['id']);
$l->setArchive($iID, false);
$isAjax = true;
$sAjaxReply = $iID;
break;
case 'exportarchive':
$config = new Config();
$l = new Lggr($state, $config);
$csv = new LggrCsv($l);
$csv->generiere();
exit();
break;
default:
// no idea what to do, just ignore it
break;
} // switch
$_SESSION[LggrState::SESSIONNAME] = $state;
if ($isAjax) {
header('Content-Type: text/plain');
echo $sAjaxReply;
} else {
header('Location: index.php');
} // if