Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
100
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()
  6. {
  7. global $query;
  8. global $config;
  9. global $instanceid;
  10.  
  11. $users = array();
  12. $uids = array();
  13. $groups = array();
  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. $clients = $query->getElement('data', $query->clientList('-uid -away -voice'));
  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($clients 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. break;
  47. }
  48. else
  49. {
  50. $status = 'Online';
  51. break;
  52. }
  53. }
  54.  
  55. }
  56.  
  57.  
  58.  
  59. $name = str_replace(array('[group]','[nick]','[status]'), array(self::getGroupName($groups[$i]), $users[$i], $status), $config[$instanceid]['functions']['adminStatusOnChannel']['format']);
  60. $query->channelEdit($channel['cid'], array('channel_name'=>$name));
  61.  
  62. }
  63. }
  64. }
  65.  
  66. }
  67.  
  68. function getGroupName($grupa)
  69. {
  70. global $query;
  71. $groups = $query->getElement('data', $query->serverGroupList());
  72. $groupname = '';
  73. foreach($groups as $group)
  74. {
  75. if ($group['sgid'] == $grupa)
  76. {
  77. $groupname = $group['name'];
  78. }
  79. }
  80.  
  81. return $groupname;
  82. }
  83.  
  84. }
  85.  
  86. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement