]>
jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blob - api/users.php
3 define ( 'NO_EVENT_STREAM_HEADER' , 1 );
4 require_once ( 'common_api.php' );
9 /* Get the user list */
10 $users = $rpc- > user ()-> getAll ();
13 foreach ( $users as $user )
15 $isBot = ( strpos ( $user- > user
-> modes
, "B" ) !== false ) ? ' <span class="badge rounded-pill badge-dark">Bot</span>' : "" ;
16 $nick = htmlspecialchars ( $user- > name
). $isBot ;
18 $country = isset ( $user- > geoip
-> country_code
) ? '<img src="https://flagcdn.com/48x36/' . htmlspecialchars ( strtolower ( $user- > geoip
-> country_code
)). '.png" width="20" height="15"> ' . htmlspecialchars ( $user- > geoip
-> country_code
) : "" ;
20 if ( $user- > hostname
== $user- > ip
)
22 else if ( $user- > ip
== null )
23 $hostip = $user- > hostname
;
25 $hostip = $user- > hostname
. " (" . $user- > ip
. ")" ;
26 $hostip = htmlspecialchars ( $hostip );
28 $account = ( isset ( $user- > user
-> account
)) ? "<a href= \" " . get_config ( "base_url" ). "users/?account=" . $user- > user
-> account
. " \" >" . htmlspecialchars ( $user- > user
-> account
). "</a>" : '<span class="badge rounded-pill badge-primary">None</span>' ;
29 $oper = ( isset ( $user- > user
-> operlogin
)) ? $user- > user
-> operlogin
. " <span class= \" badge rounded-pill badge-secondary \" >" . $user- > user
-> operclass
. "</span>" : "" ;
31 $oper = ( strpos ( $user- > user
-> modes
, "S" ) !== false ) ? '<span class="badge rounded-pill badge-warning">Services Bot</span>' : "" ;
32 $servername = $user- > user
-> servername
;
33 $reputation = $user- > user
-> reputation
;
35 $nick = "<a href= \" details.php?nick=" . $user- > id
. " \" > $nick </a>" ;
38 "Select" => "<input type= \" checkbox \" value='" . base64_encode ( $user- > id
). "' name= \" userch[] \" >" , /* yeah ridiculous to have here in this file and the feed ;) */
40 "Country" => $country ,
42 "Account" => $account ,
44 "Connected to" => $servername ,
45 "Reputation" => $reputation ,
49 function custom_sort ( $a , $b )
51 return strcmp ( strtoupper ( $a [ "Nick" ]), strtoupper ( $b [ "Nick" ]));
54 usort ( $out , "custom_sort" );
56 echo json_encode ( $out );