Advertisement
BlaquuTM

Untitled

Jan 13th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. <?php
  2. /********************************
  3.  
  4. Author: Tymoteusz `Razor Meister` Bartnik
  5.  
  6.  
  7. Function: admin_list_online()
  8.  
  9. ********************************/
  10.  
  11. class admin_list_online
  12. {
  13. private static $name;
  14. private static $cfg;
  15.  
  16. static public function construct($event_name)
  17. {
  18. global $cfg;
  19. self::$cfg = $cfg[$event_name];
  20. self::$name = $event_name;
  21. }
  22.  
  23. static public function before_clients()
  24. {
  25. global $query, $clients, $language, $xbot;
  26.  
  27. $desc = "[center][img]http://147.135.163.97/ftp/AdministracjaOnline.png[/img][/center]\n";
  28. $count_all = 0;
  29.  
  30. foreach(self::$cfg['admins_server_groups'] as $admin_group)
  31. {
  32. $count = 0;
  33. $admins = array();
  34.  
  35. if(!$xbot::check_group($admin_group, self::$name, $rang_name))
  36. continue;
  37.  
  38. foreach($query->getElement('data', $query->serverGroupClientList($admin_group)) as $client_from_group)
  39. {
  40. if(isset($client_from_group['cldbid']) && $client_from_group['cldbid'] != 1)
  41. {
  42. foreach($clients as $client)
  43. {
  44. if(isset($client['client_database_id']) && $client['client_database_id'] != 1 && $client['client_database_id'] == $client_from_group['cldbid'] && !$xbot::has_group($client['client_servergroups'], self::$cfg['ignored_groups']))
  45. {
  46. $count++;
  47. $channel = $query->getElement('data', $query->channelInfo($client['cid']));
  48. array_push($admins, array
  49. (
  50. 'name' => $client['client_nickname'],
  51. 'type' => "online",
  52. 'channel' => $channel['channel_name'],
  53. 'channel_id' => $client['cid'],
  54. 'uid' => $client['client_unique_identifier'],
  55. 'clid' => $client['clid'],
  56. 'dbid' => $client['client_database_id'],
  57. 'time_online' => $xbot::convert_time(time() - $client['client_lastconnected']),
  58. ));
  59.  
  60. echo time() - $client['client_lastconnected']."\n";
  61. }
  62. }
  63. }
  64. }
  65. if($count == 0)
  66. continue;
  67.  
  68. $desc .= "[center][size=13][b]".$rang_name."[/b][/size]\n[size=9]Administratorzy online w grupie: [b]".$count."[/b][/size][/center]";
  69.  
  70. if($admins == NULL)
  71. $desc .= "\n\n";
  72.  
  73. foreach($admins as $admin)
  74. $desc .= "[size=9][list][*] Nick administratora: [b][URL=client://".$admin['clid']."/".$admin['uid']."]".$admin['name']."[/url]".$xbot::show_link($admin['dbid'])." [*] ".$language['function']['admin_list_online']['online']."[b][color=green]".$admin['time_online']."[/color][/b] [*] ".$language['function']['admin_list_online']['on_channel']." [b][url=channelId://".$admin['channel_id']."]".$admin['channel']."[/url][/list][/size]";
  75.  
  76. unset($admins);
  77. $count_all += $count;
  78. }
  79.  
  80. if($count_all == 0)
  81. $desc .= "\n ● [img]http://i.imgur.com/xf55jvq.png[/img][size=9] ".$language['function']['admin_list_online']['no_admins']."[/size]\n";
  82.  
  83. $desc .= $language['function']['down_desc'];
  84.  
  85. if($xbot::check_channel_desc(self::$cfg['channel_id'], $desc))
  86. if($xbot::check_error($query->channelEdit(self::$cfg['channel_id'], array('channel_description' => $desc)), self::$name, self::$cfg['channel_id'], true))
  87. $query->channelEdit(self::$cfg['channel_id'], array('channel_name' => str_replace('[ONLINE]', $count_all, self::$cfg['channel_name'])));
  88.  
  89. }
  90. }
  91. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement