forked from poweradmin/poweradmin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist_log_zones.php
57 lines (46 loc) · 1.79 KB
/
list_log_zones.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
<?php
/**
* Script that displays list of event logs
*
* @package Poweradmin
* @copyright 2007-2010 Rejo Zenger <[email protected]>
* @copyright 2010-2022 Poweradmin Development Team
* @license https://opensource.org/licenses/GPL-3.0 GPL
*/
use Poweradmin\AppFactory;
use Poweradmin\DbLog;
require_once 'inc/toolkit.inc.php';
require_once 'inc/pagination.inc.php';
include_once 'inc/header.inc.php';
$app = AppFactory::create();
if (!do_hook('verify_permission', 'user_is_ueberuser')) {
die("You do not have the permission to see any logs");
}
$selected_page = 1;
if (isset($_GET['start'])) {
is_numeric($_GET['start']) ? $selected_page = $_GET['start'] : die("Unknown page.");
if ($selected_page < 0) die('Unknown page.');
}
$number_of_logs = 0;
$logs_per_page = $app->config('iface_rowamount');
$logs = null;
if (isset($_GET['name'])) {
$number_of_logs = DbLog::count_logs_by_domain($_GET['name']);
$number_of_pages = ceil($number_of_logs / $logs_per_page);
if ($selected_page > $number_of_pages) die('Unknown page');
$logs = DbLog::get_logs_for_domain($_GET['name'], $logs_per_page, ($selected_page - 1) * $logs_per_page);
} else {
$number_of_logs = DbLog::count_all_logs();
$number_of_pages = ceil($number_of_logs / $logs_per_page);
if ($number_of_logs != 0 && $selected_page > $number_of_pages) die('Unknown page');
$logs = DbLog::get_all_logs($logs_per_page, ($selected_page - 1) * $logs_per_page);
}
$app->render('list_log_zones.html', [
'number_of_logs' => $number_of_logs,
'name' => isset($_GET['name']) ? htmlspecialchars($_GET['name']) : null,
'data' => $logs,
'selected_page' => $selected_page,
'logs_per_page' => $logs_per_page,
'pagination' => show_pages($number_of_logs, $logs_per_page),
]);
include_once('inc/footer.inc.php');