X-Git-Url: https://jfr.im/git/irc/unrealircd/unrealircd-webpanel.git/blobdiff_plain/2494eefd4d76461f3e606b21ad5c24b609970482..012e85f7cb694ceda9d9295a4e9a12ea9bc29469:/index.php?ds=inline diff --git a/index.php b/index.php index 8cab3bd..5706cc4 100644 --- a/index.php +++ b/index.php @@ -16,10 +16,13 @@ set_method("user.get"); - $rpc->set_params(["nick" => "$user"]); - $rpc->execute(); - $nick = ($rpc->result) ? $rpc->fetch_assoc() : NULL; + $nick = $rpc->user()->get($user); if (!$nick) { Message::Fail("Could not find that user. Maybe they disconnected after you clicked this?"); return; } - $msg_msg = ($duration == "0" || $duration == "0w0d0h") ? "permanently" : "for $duration"; + $msg_msg = ($duration == "0" || $duration == "0w0d0h") ? "permanently" : "for ".rpc_convert_duration_string($duration); $reason = (isset($_POST['ban_reason'])) ? $_POST['ban_reason'] : "No reason"; - if (rpc_tkl_add($user, $bantype, $duration, $reason)) + if ($rpc->serverban()->add($user, $bantype, $duration, $reason)) { - $c = $nick['result']['client']; - Message::Success($c['name'] . " (*@".$c['hostname'].") has been $bantype" . "d $msg_msg: $reason"); + $c = $nick->client; + Message::Success($c->name . " (*@".$c->hostname.") has been $bantype" . "d $msg_msg: $reason"); } } } @@ -79,8 +78,12 @@ if (!empty($_POST)) { foreach ($_POST as $key => $value) { foreach ($value as $tok) { $tok = explode(",", $tok); - if (rpc_tkl_del(base64_decode($tok[0]), base64_decode($tok[1]))) - Message::Success(base64_decode($tok[1])." has been removed for ".base64_decode($tok[0])); + $ban = base64_decode($tok[0]); + $type = base64_decode($tok[1]); + if ($rpc->serverban()->delete($ban, $type)) + Message::Success("$type has been removed for $ban"); + else + Message::Fail("Unable to remove $type on $ban: $rpc->error"); } } @@ -88,7 +91,14 @@ if (!empty($_POST)) { foreach ($_POST as $key => $value) { foreach ($value as $tok) { $tok = explode(",", $tok); - rpc_sf_del(base64_decode($tok[0]), base64_decode($tok[1]), base64_decode($tok[2]), base64_decode($tok[3])); + $name = base64_decode($tok[0]); + $match_type = base64_decode($tok[1]); + $spamfilter_targets = base64_decode($tok[2]); + $ban_action = base64_decode($tok[3]); + if ($rpc->spamfilter()->delete($name, $match_type, $spamfilter_targets, $ban_action)) + Message::Success("Spamfilter on $name has been removed"); + else + Message::Fail("Unable to remove spamfilter on $name: $rpc->error"); } } } @@ -172,45 +182,46 @@ rpc_pop_lists(); /* Some basic filtering for NICK */ if (isset($_POST['uf_nick']) && strlen($_POST['uf_nick']) && - strpos(strtolower($user['name']), strtolower($_POST['uf_nick'])) !== 0 && - strpos(strtolower($user['name']), strtolower($_POST['uf_nick'])) == false) + strpos(strtolower($user->name), strtolower($_POST['uf_nick'])) !== 0 && + strpos(strtolower($user->name), strtolower($_POST['uf_nick'])) == false) continue; /* Some basic filtering for HOST */ if (isset($_POST['uf_host']) && strlen($_POST['uf_host']) && - strpos(strtolower($user['hostname']), strtolower($_POST['uf_host'])) !== 0 && - strpos(strtolower($user['hostname']), strtolower($_POST['uf_host'])) == false) + strpos(strtolower($user->hostname), strtolower($_POST['uf_host'])) !== 0 && + strpos(strtolower($user->hostname), strtolower($_POST['uf_host'])) == false) continue; /* Some basic filtering for IP */ if (isset($_POST['uf_ip']) && strlen($_POST['uf_ip']) && - strpos(strtolower($user['ip']), strtolower($_POST['uf_ip'])) !== 0 && - strpos(strtolower($user['ip']), strtolower($_POST['uf_ip'])) == false) + strpos(strtolower($user->ip), strtolower($_POST['uf_ip'])) !== 0 && + strpos(strtolower($user->ip), strtolower($_POST['uf_ip'])) == false) continue; /* Some basic filtering for ACCOUNT */ if (isset($_POST['uf_account']) && strlen($_POST['uf_account']) && - strpos(strtolower($user['user']['account']), strtolower($_POST['uf_account'])) !== 0 && - strpos(strtolower($user['user']['account']), strtolower($_POST['uf_account'])) == false) + strpos(strtolower($user->user->account), strtolower($_POST['uf_account'])) !== 0 && + strpos(strtolower($user->user->account), strtolower($_POST['uf_account'])) == false) continue; echo "