]>
jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blob - Classes/class-rpc.php
3 * RPC Functionality for UnrealIRCd Admin Webpanel
4 * License: GPLv3 or later
6 * GitHub URI: ValwareIRC/unrealircd-webpanel
10 if (!defined('UPATH'))
13 require UPATH
. '/vendor/autoload.php';
15 use UnrealIRCd\Connection
;
17 use UnrealIRCd\Channel
;
24 static $spamfilter = [];
27 static $exception = [];
29 static $opercount = 0;
30 static $services_count = 0;
31 static $most_populated_channel = NULL;
32 static $channel_pop_count = 0;
35 function rpc_pop_lists()
39 /* Get the user list */
40 $ret = $rpc->user()->getAll();
41 // TODO: error checking
45 RPC_List
::$user[] = $r;
46 if (strpos($r->user
->modes
,"o") !== false && strpos($r->user
->modes
,"S") == false)
47 RPC_List
::$opercount++
;
48 elseif (strpos($r->user
->modes
,"S") !== false)
49 RPC_List
::$services_count++
;
52 /* Get the channels list */
53 $ret = $rpc->channel()->getAll();
56 RPC_List
::$channel[] = $r;
57 if ($r->num_users
> RPC_List
::$channel_pop_count)
59 RPC_List
::$channel_pop_count = $r->num_users
;
60 RPC_List
::$most_populated_channel = $r->name
;
64 /* Get the tkl list */
65 $ret = $rpc->serverban()->getAll();
67 RPC_List
::$tkl[] = $r;
69 /* Get the spamfilter list */
70 $ret = $rpc->spamfilter()->getAll();
72 RPC_List
::$spamfilter[] = $r;
74 foreach ($rpc->nameban()->getAll() as $r)
75 RPC_List
::$nameban[] = $r;
77 foreach ($rpc->serverbanexception()->getAll() as $r)
78 RPC_List
::$exception[] = $r;
80 foreach ($rpc->server()->getAll() as $r)
81 RPC_List
::$server[] = $r;
84 /** Convert the duration_string */
85 function rpc_convert_duration_string($str)
87 $tok = explode("w", $str);
89 $tok = explode("d", $tok[1]);
91 $tok = explode("h", $tok[1]);
93 return "$weeks weeks, $days days and $hours hours";