X-Git-Url: https://jfr.im/git/irc/unrealircd/unrealircd-webpanel.git/blobdiff_plain/2494eefd4d76461f3e606b21ad5c24b609970482..012e85f7cb694ceda9d9295a4e9a12ea9bc29469:/index.php 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 ""; - echo ""; - echo "".$user['name'].""; - echo "".$user['id'].""; - echo "".$user['hostname']." (".$user['ip'].")"; - $account = (isset($user['user']['account'])) ? ''.$user['user']['account'].'' : 'None'; + echo ""; + $isBot = (strpos($user->user->modes, "B") !== false) ? ' Bot' : ""; + echo "".$user->name.$isBot.''; + echo "".$user->id.""; + echo "".$user->hostname." (".$user->ip.")"; + $account = (isset($user->user->account)) ? ''.$user->user->account.'' : 'None'; echo "".$account.""; - $modes = (isset($user['user']['modes'])) ? "+" . $user['user']['modes'] : ""; + $modes = (isset($user->user->modes)) ? "+" . $user->user->modes : ""; echo "".$modes.""; - $oper = (isset($user['user']['operlogin'])) ? ''.$user['user']['operlogin']." ".$user['user']['operclass']."" : ""; + $oper = (isset($user->user->operlogin)) ? ''.$user->user->operlogin." ".$user->user->operclass."" : ""; if (!strlen($oper)) - $oper = (strpos($user['user']['modes'], "S") !== false) ? 'Service' : ""; + $oper = (strpos($user->user->modes, "S") !== false) ? 'Service' : ""; echo "".$oper.""; - $secure = (isset($user['tls'])) ? "Secure" : "Insecure"; + $secure = (isset($user->tls)) ? "Secure" : "Insecure"; echo "".$secure.""; - echo "".$user['user']['servername'].""; - echo "".$user['user']['reputation'].""; + echo "".$user->user->servername.""; + echo "".$user->user->reputation.""; } ?>
@@ -287,14 +298,14 @@ rpc_pop_lists(); foreach(RPC_List::$channel as $channel) { echo ""; - echo "".$channel['name'].""; - echo "".$channel['creation_time'].""; - echo "".$channel['num_users'].""; - $topic = (isset($channel['topic'])) ? $channel['topic'] : ""; + echo "".$channel->name.""; + echo "".$channel->creation_time.""; + echo "".$channel->num_users.""; + $topic = (isset($channel->topic)) ? $channel->topic : ""; echo "".$topic.""; - $setby = (isset($channel['topic'])) ? "By ".$channel['topic_set_by'] .", at ".$channel['topic_set_at'] : ""; + $setby = (isset($channel->topic)) ? "By ".$channel->topic_set_by .", at ".$channel->topic_set_at : ""; echo "".$setby.""; - $modes = (isset($channel['modes'])) ? "+" . $channel['modes'] : ""; + $modes = (isset($channel->modes)) ? "+" . $channel->modes : ""; echo "".$modes.""; } ?> @@ -318,14 +329,14 @@ rpc_pop_lists(); foreach(RPC_List::$tkl as $tkl) { echo ""; - echo ""; - echo "".$tkl['name'].""; - echo "".$tkl['type_string'].""; - echo "".$tkl['set_by'].""; - echo "".$tkl['set_at_string'].""; - echo "".$tkl['expire_at_string'].""; - echo "".$tkl['duration_string'].""; - echo "".$tkl['reason'].""; + echo ""; + echo "".$tkl->name.""; + echo "".$tkl->type_string.""; + echo "".$tkl->set_by.""; + echo "".$tkl->set_at_string.""; + echo "".$tkl->expire_at_string.""; + echo "".$tkl->duration_string.""; + echo "".$tkl->reason.""; } ?>

@@ -352,18 +363,19 @@ rpc_pop_lists(); foreach(RPC_List::$spamfilter as $sf) { echo ""; - echo ""; - echo "".$sf['name'].""; - echo "".$sf['type_string'].""; - echo "".$sf['set_by'].""; - echo "".$sf['set_at_string'].""; - echo "".$sf['expire_at_string'].""; - echo "".$sf['duration_string'].""; - echo "".$sf['match_type'].""; - echo "".$sf['ban_action'].""; - echo "".$sf['ban_duration_string'].""; - for ($i = 0, $targs = ""; ($c = $sf['spamfilter_targets'][$i]); $i++) + echo ""; + echo "".$sf->name.""; + echo "".$sf->type_string.""; + echo "".$sf->set_by.""; + echo "".$sf->set_at_string.""; + echo "".$sf->expire_at_string.""; + echo "".$sf->duration_string.""; + echo "".$sf->match_type.""; + echo "".$sf->ban_action.""; + echo "".$sf->ban_duration_string.""; + for ($i = 0, $targs = ""; $i < strlen($sf->spamfilter_targets); $i++) { + $c = $sf->spamfilter_targets[$i]; if ($c == "c") $targs .= "Channel, "; else if ($c == "p") @@ -386,11 +398,10 @@ rpc_pop_lists(); $targs .= "MessageTag, "; else if ($c == "u") $targs .= "Usermask, "; - - $targs = rtrim($targs,", "); } + $targs = rtrim($targs,", "); echo "".$targs.""; - echo "".$sf['reason'].""; + echo "".$sf->reason.""; } ?>