streams/Code/Module/Regmod.php

51 lines
862 B
PHP
Raw Normal View History

2016-04-19 03:38:38 +00:00
<?php
2022-02-16 04:08:28 +00:00
namespace Code\Module;
2016-04-19 03:38:38 +00:00
2021-12-02 22:33:36 +00:00
use App;
2022-02-16 04:08:28 +00:00
use Code\Web\Controller;
use Code\Lib\Account;
2022-01-25 01:26:12 +00:00
2021-12-02 23:02:31 +00:00
class Regmod extends Controller
{
public function get()
{
global $lang;
$_SESSION['return_url'] = App::$cmd;
if (!local_channel()) {
info(t('Please login.') . EOL);
return login();
}
if (!is_site_admin()) {
notice(t('Permission denied.') . EOL);
return '';
}
2021-12-03 03:01:39 +00:00
if (argc() != 3) {
2021-12-02 23:02:31 +00:00
killme();
2021-12-03 03:01:39 +00:00
}
2021-12-02 23:02:31 +00:00
$cmd = argv(1);
$hash = argv(2);
if ($cmd === 'deny') {
2022-01-25 01:26:12 +00:00
if (!Account::deny($hash)) {
2021-12-03 03:01:39 +00:00
killme();
}
2021-12-02 23:02:31 +00:00
}
if ($cmd === 'allow') {
2022-01-25 01:26:12 +00:00
if (!Account::allow($hash)) {
2021-12-03 03:01:39 +00:00
killme();
}
2021-12-02 23:02:31 +00:00
}
goaway('/admin/accounts');
}
2016-04-19 03:38:38 +00:00
}