mirror of
https://github.com/OPSnet/Gazelle.git
synced 2026-01-16 18:04:34 -05:00
27 lines
702 B
PHP
27 lines
702 B
PHP
<?php
|
|
|
|
$Viewer = new Gazelle\User($LoggedUser['ID']);
|
|
if (!$Viewer->permitted('admin_manage_invite_source')) {
|
|
error(403);
|
|
}
|
|
$manager = new Gazelle\Manager\InviteSource;
|
|
|
|
if (!empty($_POST['name'])) {
|
|
authorize();
|
|
$manager->create(trim($_POST['name']));
|
|
}
|
|
$remove = array_keys(array_filter($_POST, function ($x) { return preg_match('/^remove-\d+$/', $x);}, ARRAY_FILTER_USE_KEY));
|
|
if ($remove) {
|
|
authorize();
|
|
foreach ($remove as $r) {
|
|
$manager->remove((int)explode('-', $r)[1]);
|
|
}
|
|
}
|
|
|
|
View::show_header('Invite Sources');
|
|
echo $Twig->render('admin/invite-source-config.twig', [
|
|
'auth' => $Viewer->auth(),
|
|
'list' => $manager->listByUse(),
|
|
]);
|
|
View::show_footer();
|