mirror of
https://github.com/OPSnet/Gazelle.git
synced 2026-10-21 16:03:29 -04:00
39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
/** @phpstan-var \Gazelle\User $Viewer */
|
|
/** @phpstan-var \Twig\Environment $Twig */
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Gazelle;
|
|
|
|
if (!$Viewer->permitted('users_mod')) {
|
|
Error403::error();
|
|
}
|
|
|
|
$userMan = new Manager\User();
|
|
$amount = (int)($_POST['numtokens'] ?? 0);
|
|
$flAdded = false;
|
|
$flCleared = false;
|
|
if (isset($_POST['addtokens'])) {
|
|
authorize();
|
|
if ($amount < 1) {
|
|
Error400::error('Please enter a valid number of tokens.');
|
|
}
|
|
$flAdded = $userMan->addMassTokens($amount, isset($_POST['allowleechdisabled']));
|
|
} elseif (isset($_POST['cleartokens'])) {
|
|
authorize();
|
|
if ($amount < 0) {
|
|
Error400::error('Please enter a valid number of tokens.');
|
|
}
|
|
$flCleared = $userMan->clearMassTokens($amount, isset($_POST['allowleechdisabled']), isset($_POST['onlydrop']));
|
|
}
|
|
|
|
echo $Twig->render('admin/freeleech-tokens.twig', [
|
|
'amount' => $amount,
|
|
'fl_added' => $flAdded,
|
|
'fl_cleared' => $flCleared,
|
|
'leech_disabled' => $_POST['allowleechdisabled'] ?? true,
|
|
'only_drop' => $_POST['onlydrop'] ?? false,
|
|
'viewer' => $Viewer,
|
|
]);
|