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