]>
Commit | Line | Data |
---|---|---|
1 | <?php | |
2 | define('NO_EVENT_STREAM_HEADER',1); | |
3 | require_once('common_api.php'); | |
4 | ||
5 | if (!$rpc) | |
6 | die(json_encode([])); | |
7 | ||
8 | ||
9 | $tkls = $rpc->serverban()->getAll(); | |
10 | ||
11 | $out = []; | |
12 | foreach($tkls as $tkl) | |
13 | { | |
14 | $set_in_config = ((isset($tkl->set_in_config) && $tkl->set_in_config) || ($tkl->set_by == "-config-")) ? true : false; | |
15 | $set_by = $set_in_config ? "<span class=\"badge rounded-pill badge-secondary\">Config</span>" : show_nick_only(htmlspecialchars($tkl->set_by)); | |
16 | $select = ''; | |
17 | if (!$set_in_config) | |
18 | $select = "<input type=\"checkbox\" value='" . base64_encode($tkl->name).",".base64_encode($tkl->type) . "' name=\"tklch[]\">"; | |
19 | ||
20 | $out[] = [ | |
21 | "Select" => $select, | |
22 | "Mask" => htmlspecialchars($tkl->name), | |
23 | "Type" => $tkl->type_string, | |
24 | "Duration" => $tkl->duration_string, | |
25 | "Reason" => htmlspecialchars($tkl->reason), | |
26 | "Set By" => $set_by, | |
27 | "Set On" => $tkl->set_at_string, | |
28 | "Expires" => $tkl->expire_at_string, | |
29 | ]; | |
30 | } | |
31 | ||
32 | function custom_sort($a,$b) | |
33 | { | |
34 | return strcmp(strtoupper($a["Mask"]), strtoupper($b["Mask"])); | |
35 | } | |
36 | ||
37 | usort($out, "custom_sort"); | |
38 | ||
39 | echo json_encode($out); |