Advertisement
Guest User

Untitled

a guest
May 24th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.71 KB | None | 0 0
  1. <?php
  2.  
  3. class adminList
  4. {
  5. function start($clientList, $channelList, $serverInfo, $config)
  6. {
  7. global $query;
  8. global $instanceid;
  9.  
  10. $adminsgroups = $config[$instanceid]['functions']['adminList']['adminsGroups'];
  11.  
  12. $desc = '[hr][center][size=19][b][color=red]Lista Administracji[/color][/b][/size][/center]\n\n';
  13. foreach($adminsgroups as $group)
  14. {
  15. $group_name = self::getgroupname($group);
  16. $groupsclients = $query->getElement('data', $query->serverGroupClientList($group, $names = true));
  17.  
  18. $desc.= '[size=13][b][' . $group_name . '][/b][/size]';
  19. if (!array_key_exists('client_nickname', $groupsclients[0]))
  20. {
  21. $desc .= '[list][*] Brak Administracji w tej grupie[/list]';
  22. }
  23. if (array_key_exists('client_nickname', $groupsclients[0]))
  24. {
  25. foreach($groupsclients as $groupclient)
  26. {
  27. foreach($clientList as $client)
  28. {
  29. if ($client['client_unique_identifier'] == $groupclient['client_unique_identifier'])
  30. {
  31. if($client['client_output_muted']==1 || $client['client_away']==1)
  32. {
  33. $online = true;
  34. $away = true;
  35. break;
  36. }
  37. else
  38. {
  39. $away = false;
  40. $online = true;
  41. break;
  42. }
  43.  
  44. }
  45. else
  46. {
  47. $away = false;
  48. $online = false;
  49. }
  50. }
  51.  
  52. if ($online && !$away)
  53. {
  54. $clIds = $query->getElement('data', $query->clientGetIds($groupclient['client_unique_identifier']));
  55. $clInfo = $query->getElement('data', $query->clientInfo($clIds[0]['clid']));
  56. $connectionTime = '';
  57. $init = $clInfo['connection_connected_time']/1000;
  58. $hours = floor($init / 3600);
  59. $minutes = floor(($init / 60) % 60);
  60. $seconds = $init % 60;
  61.  
  62. if($hours>0)
  63. {
  64. $connectionTime .= ''.$hours.' godzin ';
  65. }
  66. if($minutes>0)
  67. {
  68. $connectionTime .= ''.$minutes.' minut ';
  69. }
  70. if($seconds>0)
  71. {
  72. $connectionTime .= ''.$seconds.' sekund';
  73. }
  74. $desc.= '[list][*][img]https://cdn1.iconfinder.com/data/icons/unique-round-blue/93/user-16.png[/img] [b]Nick:[/b] [url=client://0/' . $groupclient['client_unique_identifier'] . '][b]' . $groupclient['client_nickname'] . '[/b][/url]\n\n
  75. [img]https://cdn1.iconfinder.com/data/icons/unique-round-blue/93/search-16.png[/img] [b]Status:[/b] [color=green][b]ONLINE[/b][/color] od [b]'.$connectionTime.'[/b]\n\n
  76. [img]https://cdn1.iconfinder.com/data/icons/unique-round-blue/93/location-16.png[/img] [b]Lokalizacja: [url=channelID://'.$clInfo['cid'].']'.self::getChannelName($clInfo['cid']).'[/url][/b][/list]';
  77.  
  78. }
  79. if(!$online)
  80. {
  81. $info = $query->getElement('data', $query->clientDbInfo($groupclient['cldbid']));
  82.  
  83. $seconds = time() - $info['client_lastconnected'];
  84.  
  85. $days = floor($seconds / 86400);
  86. $hours = floor(($seconds - ($days * 86400)) / 3600);
  87. $minutes = floor(($seconds - ($days * 86400) - ($hours * 3600))/60);
  88. $seconds = floor(($seconds - ($days * 86400) - ($hours * 3600) - ($minutes*60)));
  89. $time = '';
  90. if($days>0)
  91. {
  92. $time .= ''.$days.' dni ';
  93. }
  94. if($hours>0)
  95. {
  96. $time .= ''.$hours.' godzin ';
  97. }
  98. if($minutes>0)
  99. {
  100. $time .= ''.$minutes.' minut';
  101. }
  102. if($time=='')
  103. {
  104. $time .= ''.$seconds.' sekund';
  105. }
  106. $desc.= '[list][*][img]https://cdn1.iconfinder.com/data/icons/unique-round-blue/93/user-16.png[/img] [b]Nick:[/b] [url=client://' . $client['clid'] . '/' . $groupclient['client_unique_identifier'] . '][b]' . $groupclient['client_nickname'] . '[/b][/url]\n\n
  107. [img]https://cdn1.iconfinder.com/data/icons/unique-round-blue/93/search-16.png[/img] [b]Status:[/b] [color=red][b]OFFLINE[/b][/color] od [b]'.$time.'[/b][/list]';
  108.  
  109. }
  110. if($away && $online)
  111. {
  112. $clIds = $query->getElement('data', $query->clientGetIds($groupclient['client_unique_identifier']));
  113. $clInfo = $query->getElement('data', $query->clientInfo($clIds[0]['clid']));
  114.  
  115. $awayTime = '';
  116. $init = $clInfo['client_idle_time']/1000;
  117. $hours = floor($init / 3600);
  118. $minutes = floor(($init / 60) % 60);
  119. $seconds = $init % 60;
  120.  
  121. if($hours>0)
  122. {
  123. $awayTime .= ''.$hours.' godzin ';
  124. }
  125. if($minutes>0)
  126. {
  127. $awayTime .= ''.$minutes.' minut ';
  128. }
  129. if($seconds>0)
  130. {
  131. $awayTime .= ''.$seconds.' sekund';
  132. }
  133.  
  134. $desc.= '[list][*][url=client://0/' . $groupclient['client_unique_identifier'] . '][b][size=11]' . $groupclient['client_nickname'] . '[/b][/url][size=11] jest aktualnie [color=orange][b]AWAY[/b][/color] od [b]'.$awayTime.'[/b] na kanale [b][url=channelID://'.$clInfo['cid'].']'.self::getChannelName($clInfo['cid']).'[/url][/b][/size][/list]';
  135. }
  136. }
  137.  
  138.  
  139.  
  140. }
  141. }
  142. $desc.= '\n';
  143. $desc.= '[center][b][color=red]Całkowity Zakaz Kopiowania[/color]
  144. [color=red]S[/color]-24[color=red]H[/color].PL
  145. Copyright © 2016[/center]';
  146. $desc.= '[right][url=http://www.teamspeak.com][img]http://teamperdox.bplaced.net/inc/tinymce_files/teamspeak3%20Kopie%20Kopie.png[/img][/url][/right]';
  147. $channel = $query->channelInfo($config[$instanceid]['functions']['adminList']['channel']);
  148. if (strcmp($channel['data']['channel_description'], $desc) != 0)
  149. {
  150. $query->channelEdit($config[$instanceid]['functions']['adminList']['channel'], array(
  151. 'channel_description' => $desc
  152. ));
  153. }
  154. }
  155.  
  156. function getgroupname($grupa)
  157. {
  158. global $query;
  159. $groups = $query->getElement('data', $query->serverGroupList());
  160. $groupname = '';
  161. foreach($groups as $group)
  162. {
  163. if ($group['sgid'] == $grupa)
  164. {
  165. $groupname = $group['name'];
  166. }
  167. }
  168.  
  169. return $groupname;
  170. }
  171.  
  172. function getChannelName($cid)
  173. {
  174. global $query;
  175.  
  176. $chInfo = $query->getElement('data', $query->channelInfo($cid));
  177.  
  178. return $chInfo['channel_name'];
  179. }
  180. }
  181.  
  182. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement