-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathlog.php
268 lines (251 loc) · 15 KB
/
log.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<?php
/**
*
* Hestia Web Interface
*
* Copyright (C) 2020 Carter Roeser <[email protected]>
* https://cdgco.github.io/HestiaWebInterface
*
* Hestia Web Interface is free software: you can redistribute it and/or modify
* it under the terms of version 3 of the GNU General Public License as published
* by the Free Software Foundation.
*
* Hestia Web Interface 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 Hestia Web Interface. If not, see
* <https://github.com/cdgco/HestiaWebInterface/blob/master/LICENSE>.
*
*/
session_start();
$configlocation = "includes/";
if (file_exists( 'includes/config.php' )) { require( 'includes/includes.php'); } else { header( 'Location: install' ); exit(); };
if(base64_decode($_SESSION['loggedin']) == 'true') {}
else { header('Location: login.php?to=log.php' . $urlquery . $_SERVER['QUERY_STRING']); exit(); }
if(isset($profileenabled) && $profileenabled != 'true'){ header("Location: error-pages/403.html"); }
if (isset($_GET['user']) && $_GET['user'] != '' && $username == 'admin') { $logusername = $_GET['user'];}
else { $logusername = $username;}
$postvars = array(
array('hash' => $vst_apikey, 'user' => $vst_username,'password' => $vst_password,'cmd' => 'v-list-user','arg1' => $username,'arg2' => 'json'),
array('hash' => $vst_apikey, 'user' => $vst_username,'password' => $vst_password,'cmd' => 'v-list-user-log','arg1' => $logusername,'arg2' => 'json'),
array('hash' => $vst_apikey, 'user' => $vst_username,'password' => $vst_password,'cmd' => 'v-list-users','arg1' => 'json'));
$curl0 = curl_init();
$curl1 = curl_init();
$curl2 = curl_init();
$curlstart = 0;
while($curlstart <= 2) {
curl_setopt(${'curl' . $curlstart}, CURLOPT_URL, $vst_url);
curl_setopt(${'curl' . $curlstart}, CURLOPT_RETURNTRANSFER,true);
curl_setopt(${'curl' . $curlstart}, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt(${'curl' . $curlstart}, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt(${'curl' . $curlstart}, CURLOPT_POST, true);
curl_setopt(${'curl' . $curlstart}, CURLOPT_POSTFIELDS, http_build_query($postvars[$curlstart]));
$curlstart++;
}
$admindata = json_decode(curl_exec($curl0), true)[$username];
$useremail = $admindata['CONTACT'];
$logname = array_keys(json_decode(curl_exec($curl1), true));
$logdata = array_values(json_decode(curl_exec($curl1), true));
$sysusers = array_keys(json_decode(curl_exec($curl2), true));
if(isset($admindata['LANGUAGE'])){ $locale = $ulang[$admindata['LANGUAGE']]; }
_setlocale('LC_CTYPE', $locale); _setlocale('LC_MESSAGES', $locale);
_bindtextdomain('messages', '../locale');
_textdomain('messages');
foreach ($plugins as $result) {
if (file_exists('plugins/' . $result)) {
if (file_exists('plugins/' . $result . '/manifest.xml')) {
$get = file_get_contents('plugins/' . $result . '/manifest.xml');
$xml = simplexml_load_string($get, 'SimpleXMLElement', LIBXML_NOCDATA);
$arr = json_decode(json_encode((array)$xml), TRUE);
if (isset($arr['name']) && !empty($arr['name']) && isset($arr['fa-icon']) && !empty($arr['fa-icon']) && isset($arr['section']) && !empty($arr['section']) && isset($arr['admin-only']) && !empty($arr['admin-only']) && isset($arr['new-tab']) && !empty($arr['new-tab']) && isset($arr['hide']) && !empty($arr['hide'])){
array_push($pluginlinks,$result);
array_push($pluginnames,$arr['name']);
array_push($pluginicons,$arr['fa-icon']);
array_push($pluginsections,$arr['section']);
array_push($pluginadminonly,$arr['admin-only']);
array_push($pluginnewtab,$arr['new-tab']);
array_push($pluginhide,$arr['hide']);
}
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/ico" href="plugins/images/<?php echo $cpfavicon; ?>">
<title><?php echo $sitetitle; ?> - <?php echo __("Log"); ?></title>
<link href="plugins/components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="plugins/components/bootstrap-select/css/bootstrap-select.min.css" rel="stylesheet">
<link href="plugins/components/footable/footable.bootstrap.css" rel="stylesheet">
<link href="plugins/components/metismenu/dist/metisMenu.min.css" rel="stylesheet">
<link href="plugins/components/animate.css/animate.min.css" rel="stylesheet">
<link rel="stylesheet" href="plugins/components/sweetalert2/sweetalert2.min.css" />
<link href="css/style.css" rel="stylesheet">
<link href="css/colors/<?php if(isset($_COOKIE['theme']) && $themecolor != 'custom.css') { echo base64_decode($_COOKIE['theme']); } else {echo $themecolor; } ?>" id="theme" rel="stylesheet">
<?php if($themecolor == "custom.css") { require( 'css/colors/custom.php'); } ?>
<?php if(GOOGLE_ANALYTICS_ID != ''){ echo "<script async src='https://www.googletagmanager.com/gtag/js?id=" . GOOGLE_ANALYTICS_ID . "'></script>
<script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '" . GOOGLE_ANALYTICS_ID . "');</script>"; } ?>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="fix-header">
<div class="preloader">
<svg class="circular" viewBox="25 25 50 50">
<circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10" />
</svg>
</div>
<div id="wrapper">
<nav class="navbar navbar-default navbar-static-top m-b-0">
<div class="navbar-header">
<div class="top-left-part">
<a class="logo" href="index.php">
<img src="plugins/images/<?php echo $cpicon; ?>" alt="home" class="logo-1 dark-logo" />
<img src="plugins/images/<?php echo $cplogo; ?>" alt="home" class="hidden-xs dark-logo" />
</a>
</div>
<ul class="nav navbar-top-links navbar-left">
<li><a href="javascript:void(0)" class="open-close waves-effect waves-light visible-xs"><i class="ti-close ti-menu"></i></a></li>
<?php notifications(); ?>
</ul>
<ul class="nav navbar-top-links navbar-right pull-right">
<li>
<form class="app-search m-r-10" id="searchform" action="process/search.php" method="get">
<input type="text" placeholder="<?php echo __("Search..."); ?>" class="form-control" name="q"> <a href="javascript:void(0);" onclick="document.getElementById('searchform').submit();"><i class="fa fa-search"></i></a> </form>
</li>
<li class="dropdown">
<a class="dropdown-toggle profile-pic" data-toggle="dropdown" href="#"><b class="hidden-xs"><?php print_r($displayname); ?></b><span class="caret"></span> </a>
<ul class="dropdown-menu dropdown-user animated flipInY">
<li>
<div class="dw-user-box">
<div class="u-text">
<h4><?php print_r($displayname); ?></h4>
<p class="text-muted"><?php print_r($useremail); ?></p></div>
</div>
</li>
<li role="separator" class="divider"></li>
<li><a href="profile.php"><i class="ti-home"></i> <?php echo __("My Account"); ?></a></li>
<li><a href="profile.php?settings=open"><i class="ti-settings"></i> <?php echo __("Account Settings"); ?></a></li>
<li role="separator" class="divider"></li>
<li><a href="process/logout.php"><i class="fa fa-power-off"></i> <?php echo __("Logout"); ?></a></li>
</ul>
</li>
</ul>
</div>
</nav>
<div class="navbar-default sidebar" role="navigation">
<div class="sidebar-nav slimscrollsidebar">
<div class="sidebar-head">
<h3>
<span class="fa-fw open-close">
<i class="ti-menu hidden-xs"></i>
<i class="ti-close visible-xs"></i>
</span>
<span class="hide-menu"><?php echo __("Navigation"); ?></span>
</h3>
</div>
<ul class="nav" id="side-menu">
<?php indexMenu("./");
adminMenu("admin/list/", "");
profileMenu("./");
primaryMenu("list/", "process/", "");
?>
</ul>
</div>
</div>
<div id="page-wrapper">
<div class="container-fluid">
<div class="row bg-title" style="overflow:visible;">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title"><?php echo __("User Log"); ?></h4>
</div>
<?php if($username == 'admin'){ echo
'<div class="col-lg-2 col-sm-8 col-md-8 col-xs-12 pull-right">
<div style="margin-right:257px;width:220px;" class="btn-group bootstrap-select input-group-btn">
<form id="loguserform" action="log.php" method="get">
<select class="selectpicker pull-right m-l-20" id="loguser" name="user" data-style="form-control">';
if($sysusers[0] != '') {
$x2 = 0;
do {
echo '<option value="' . $sysusers[$x2] . '">' . $sysusers[$x2] . '</option>';
$x2++;
} while ($sysusers[$x2] != ''); }
echo '</select>
</form>
</div>
<div class="input-group-btn">
<button type="button" onclick=\'document.getElementById("loguserform").submit();Swal.fire({title: "' . __('Processing') . '", text: "",timer: 5000,onOpen: function () {swal.showLoading();}}).then(function () {},function (dismiss) {if (dismiss === "timer") {}})\' class=" pull-right btn waves-effect waves-light color-button"><i class="ti-angle-right"></i></button>
</div>
</div>'; } ?>
<?php headerad(); ?>
</div>
<div class="row">
<div class="col-lg-12">
<div class="white-box">
<div class="table-responsive">
<table class="table footable m-b-0" data-sorting="true">
<thead>
<tr>
<th data-type="date" data-format-string="YYYY-MM-DD" data-sorted="true" data-direction="DESC"> <?php echo __("Date"); ?> </th>
<th data-sortable="false"> <?php echo __("Time"); ?> </th>
<th data-sortable="false"> <?php echo __("Log"); ?> </th>
</tr>
</thead>
<tbody>
<?php
if($logname[0] != '') {
$x1 = 0;
do {
echo '<tr>
<td data-sort-value="' . $logdata[$x1]['DATE'] . '">' . $logdata[$x1]['DATE'] . '</td>
<td>' . $logdata[$x1]['TIME'] . '</td>
<td>' . $logdata[$x1]['CMD'] . '</td>
</tr>';
$x1++;
} while ($logname[$x1] != ''); }
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<?php hotkeys($configlocation); ?>
<?php footerad(); ?><footer class="footer text-center"><?php footer(); ?></footer>
</div>
</div>
<script src="plugins/components/jquery/jquery.min.js"></script>
<script src="plugins/components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
<script src="plugins/components/sweetalert2/sweetalert2.min.js"></script>
<script src="plugins/components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="plugins/components/bootstrap-select/js/bootstrap-select.min.js"></script>
<script src="plugins/components/metismenu/dist/metisMenu.min.js"></script>
<script src="plugins/components/moment/moment.min.js"></script>
<script src="plugins/components/footable/footable.min.js"></script>
<script src="plugins/components/waves/waves.js"></script>
<script src="js/notifications.js"></script>
<script src="js/main.js"></script>
<script type="text/javascript">
Waves.attach('.button', ['waves-effect']);
Waves.init();
var processLocation = "process/";
jQuery(function($){
$('.footable').footable();
});
<?php
processPlugins();
includeScript();
if ($username = 'admin') { echo 'document.getElementById("loguser").value = \'' . $logusername . '\';';}
?>
</script>
</body>
</html>