Advertisement
Guest User

Untitled

a guest
Apr 16th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. ?php
  2.  
  3. class adminStatusOnChannel
  4. {
  5. function start($clientList, $channelList, $serverInfo, $config)
  6. {
  7. global $query;
  8. global $instanceid;
  9.  
  10. $users = array();
  11. $uids = array();
  12. $groups = array();
  13.  
  14.  
  15. foreach($config[$instanceid]['functions']['adminStatusOnChannel']['adminsGroups'] as $sgid)
  16. {
  17. $user = $query->getElement('data', $query->serverGroupClientList($sgid, $names = true));
  18.  
  19.  
  20. foreach($user as $client)
  21. {
  22. if(array_key_exists('client_nickname', $client))
  23. {
  24. array_push($users, $client['client_nickname']);
  25. array_push($uids, $client['client_unique_identifier']);
  26. array_push($groups, $sgid);
  27. }
  28. }
  29.  
  30. }
  31.  
  32.  
  33. foreach($config[$instanceid]['functions']['adminStatusOnChannel']['channels'] as $channel)
  34. {
  35. for($i=0; $i<count($users); $i++)
  36. {
  37. if($uids[$i]==$channel['uid'])
  38. {
  39. foreach($clientList as $client)
  40. {
  41. if($client['client_unique_identifier']==$channel['uid'])
  42. {
  43. if($client['client_away']==1 || $client['client_output_muted']==1)
  44. {
  45. $status = 'Away';
  46.  
  47. break;
  48. }
  49. else
  50. {
  51. $status = 'Online';
  52. break;
  53. }
  54. }
  55. else
  56. {
  57. $status = 'Offline';
  58.  
  59. }
  60.  
  61. }
  62.  
  63.  
  64.  
  65. $name = str_replace(array('[group]','[nick]','[status]'), array(self::getGroupName($groups[$i]), $users[$i], $status), $config[$instanceid]['functions']['adminStatusOnChannel']['format']);
  66. $query->channelEdit($channel['cid'], array('channel_name'=>$name));
  67.  
  68. }
  69. }
  70. }
  71.  
  72. }
  73.  
  74. function getGroupName($grupa)
  75. {
  76. global $query;
  77. $groups = $query->getElement('data', $query->serverGroupList());
  78. $groupname = '';
  79. foreach($groups as $group)
  80. {
  81. if ($group['sgid'] == $grupa)
  82. {
  83. $groupname = $group['name'];
  84. }
  85. }
  86.  
  87. return $groupname;
  88. }
  89.  
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement