Dalexhd

group_online.php

Oct 25th, 2017
404
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.89 KB | None | 0 0
  1. <?php
  2. include_once 'include/config.php';
  3. include_once 'include/ts3admin.class.php';
  4.  
  5. function group_online()
  6. {
  7.     global $query;
  8.     global $config;
  9.  
  10.     $channels = $query->getElement('data', $query->channelList("-topic"));
  11.  
  12.     foreach($channels as $channel)
  13.     {
  14.         $check = strpos($channel['channel_topic'], "show_group=");
  15.         if ($check !== false)
  16.         {
  17.             $group_id = filter_var($channel['channel_topic'], FILTER_SANITIZE_NUMBER_INT);
  18.             $group_name = getgroupname($group_id);
  19.            
  20.             $desc = '[center][size=15][b]'.$group_name.'[/b][/size][/center]\n\n';
  21.            
  22.             $groupsclients = $query->getElement('data', $query->serverGroupClientList($group_id, $names = true));
  23.             $clients = $query->getElement('data', $query->clientList("-uid -groups -times -voice"));
  24.  
  25.             if (array_key_exists('client_nickname', $groupsclients[0]))
  26.             {
  27.                 foreach($groupsclients as $groupclient)
  28.                 {
  29.                     foreach($clients as $client)
  30.                     {
  31.                         if ($client['client_unique_identifier'] == $groupclient['client_unique_identifier'])
  32.                         {
  33.                             $online = true;
  34.                             break;
  35.                         }
  36.                         else
  37.                         {
  38.                             $online = false;
  39.                         }
  40.                     }
  41.  
  42.                     if ($online)
  43.                     {
  44.                         $user_channel = $query->getElement('data', $query->channelInfo($client['cid']));
  45.  
  46.                         if( $client['client_input_muted'] != 0 ||
  47.                             $client['client_output_muted'] != 0 ||
  48.                             $client['client_idle_time'] > 15*60000)
  49.                         {
  50.                             $time = round($client['client_idle_time'] / 60000);
  51.                             $status = '[color=#FFC000][b]AFK (od '.$time.' minut)[/b][/color]';
  52.                         }
  53.                         else
  54.                         {
  55.                             $status = '[color=green][b]ONLINE[/b][/color]';
  56.                         }
  57.  
  58.                         $desc.= "[size=10][url=client://".$client['clid']."/".$groupclient['client_unique_identifier']."][b]".$groupclient['client_nickname']."[/b][/url] jest aktualnie ".$status." na kanale [B][URL=channelID://".$client['cid']."]".$user_channel['channel_name']."[/URL][/B][/size]\n";
  59.                            
  60.                     }
  61.                     else
  62.                     {
  63.                         $info = $query->getElement('data', $query->clientDbInfo($groupclient['cldbid']));
  64.                         $seconds = time() - $info['client_lastconnected'];
  65.  
  66.                         $days    = floor($seconds / 86400);
  67.                         $hours   = floor(($seconds - ($days * 86400)) / 3600);
  68.                         $minutes = floor(($seconds - ($days * 86400) - ($hours * 3600))/60);
  69.                         $seconds = floor(($seconds - ($days * 86400) - ($hours * 3600) - ($minutes*60)));
  70.                            
  71.                         $desc.= '[size=10][url=client://' . $client['clid'] . '/' . $groupclient['client_unique_identifier'] . '][b]' . $groupclient['client_nickname'] . '[/b][/url] jest aktualnie [color=red][b]OFFLINE[/b][/color] od '.$days.' dni, '.$hours.' godzin i '.$minutes.' minut[/size]\n';
  72.                        
  73.                     }
  74.                 }
  75.                 $desc.= '[hr]\n';
  76.             }
  77.             else
  78.             {
  79.                 $desc.= '[size=10][b]Brak![/b][/size]\n[hr]\n';
  80.             }
  81.             $query->channelEdit($channel['cid'], array(
  82.                 'channel_description' => $desc
  83.             ));
  84.         }
  85.     }
  86.  
  87.     unset($query);
  88.     unset($config);
  89. }
  90.  
  91. ?>
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment