]>
jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blob - api/channels.php
3 define('NO_EVENT_STREAM_HEADER',1);
4 require_once('common_api.php');
10 $channels = $rpc->channel()->getAll();
12 $columns = array_column($channels, 'num_users');
13 array_multisort($columns, SORT_DESC
, $channels);
16 foreach($channels as $channel)
18 $modes = (isset($channel->modes
)) ? "+" . explode(" ",$channel->modes
)[0] : "<none>";
20 if (isset($channel->topic
))
21 $topic = htmlentities(StripControlCharacters($channel->topic
), ENT_QUOTES
| ENT_SUBSTITUTE
| ENT_HTML401
| ENT_DISALLOWED
);
22 $date = explode("T", $channel->creation_time
)[0];
24 "Name" => htmlspecialchars($channel->name
),
25 "Users" => $channel->num_users
,
26 "Modes" => "<span data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"+".htmlspecialchars($channel->modes
)."\">$modes</span>",
28 "Created" => "<span data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"".$channel->creation_time
."\">$date</span>",
32 function custom_sort($a,$b)
34 return $b["Users"] <=> $a["Users"];
37 usort($out, "custom_sort");
39 echo json_encode($out);