user()->getAll();
$out = [];
foreach($users as $user)
{
$isBot = (strpos($user->user->modes, "B") !== false) ? ' Bot' : "";
$nick = htmlspecialchars($user->name).$isBot;
$country = isset($user->geoip->country_code) ? ' '.htmlspecialchars($user->geoip->country_code) : "";
if ($user->hostname == $user->ip)
$hostip = $user->ip;
else if ($user->ip == null)
$hostip = $user->hostname;
else
$hostip = $user->hostname . " (".$user->ip.")";
$hostip = htmlspecialchars($hostip);
$account = (isset($user->user->account)) ? "user->account."\">".htmlspecialchars($user->user->account)."" : 'None';
$oper = (isset($user->user->operlogin)) ? $user->user->operlogin." ".$user->user->operclass."" : "";
if (!strlen($oper))
$oper = (strpos($user->user->modes, "S") !== false) ? 'Services Bot' : "";
$servername = $user->user->servername;
$reputation = $user->user->reputation;
$nick = "id."\">$nick";
$out[] = [
"Select" => "", /* yeah ridiculous to have here in this file and the feed ;) */
"Nick" => $nick,
"Country" => $country,
"Host/IP" => $hostip,
"Account" => $account,
"Oper" => $oper,
"Connected to" => $servername,
"Reputation" => $reputation,
];
}
function custom_sort($a,$b)
{
return strcmp(strtoupper($a["Nick"]), strtoupper($b["Nick"]));
}
usort($out, "custom_sort");
echo json_encode($out);