mirror of
https://github.com/OPSnet/Gazelle.git
synced 2026-01-16 18:04:34 -05:00
38 lines
1.0 KiB
PHP
38 lines
1.0 KiB
PHP
<?php
|
|
/** @phpstan-var \Gazelle\User $Viewer */
|
|
/** @phpstan-var \Twig\Environment $Twig */
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Gazelle;
|
|
|
|
if (!$Viewer->permittedAny('users_mod', 'users_view_ips')) {
|
|
Error403::error();
|
|
}
|
|
|
|
$user = new Manager\User()->findById((int)($_GET['userid'] ?? 0));
|
|
$ipaddr = $_GET['ip'] ?? null;
|
|
if (is_null($user) && !preg_match(IP_REGEXP, $ipaddr)) {
|
|
Error403::error();
|
|
}
|
|
|
|
$snatchInfo = new SnatchInfo();
|
|
if ($user) {
|
|
$snatchInfo->setContextUser($user);
|
|
} else {
|
|
$snatchInfo->setContextIpaddr($ipaddr);
|
|
}
|
|
|
|
$paginator = new Util\Paginator(IPS_PER_PAGE, (int)($_GET['page'] ?? 1));
|
|
$paginator->setTotal($snatchInfo->total());
|
|
|
|
echo $Twig->render('admin/history-ip-tracker.twig', [
|
|
'details' => $snatchInfo->page($paginator->limit(), $paginator->offset()),
|
|
'ipaddr' => $ipaddr,
|
|
'is_mod' => $Viewer->permitted('users_mod'),
|
|
'paginator' => $paginator,
|
|
'summary' => $snatchInfo->summary(),
|
|
'urlstem' => $_SERVER['SCRIPT_NAME'] . '?action=tracker_ips&',
|
|
'user' => $user,
|
|
]);
|