Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class adminList
- {
- function start($clientList, $channelList, $serverInfo, $config)
- {
- global $query;
- global $instanceid;
- $adminsgroups = $config[$instanceid]['functions']['adminList']['adminsGroups'];
- $desc = '[hr][center][size=19][b][color=red]Lista Administracji[/color][/b][/size][/center]\n\n';
- foreach($adminsgroups as $group)
- {
- $group_name = self::getgroupname($group);
- $groupsclients = $query->getElement('data', $query->serverGroupClientList($group, $names = true));
- $desc.= '[size=13][b][' . $group_name . '][/b][/size]';
- if (!array_key_exists('client_nickname', $groupsclients[0]))
- {
- $desc .= '[list][*] Brak Administracji w tej grupie[/list]';
- }
- if (array_key_exists('client_nickname', $groupsclients[0]))
- {
- foreach($groupsclients as $groupclient)
- {
- foreach($clientList as $client)
- {
- if ($client['client_unique_identifier'] == $groupclient['client_unique_identifier'])
- {
- if($client['client_output_muted']==1 || $client['client_away']==1)
- {
- $online = true;
- $away = true;
- break;
- }
- else
- {
- $away = false;
- $online = true;
- break;
- }
- }
- else
- {
- $away = false;
- $online = false;
- }
- }
- if ($online && !$away)
- {
- $clIds = $query->getElement('data', $query->clientGetIds($groupclient['client_unique_identifier']));
- $clInfo = $query->getElement('data', $query->clientInfo($clIds[0]['clid']));
- $connectionTime = '';
- $init = $clInfo['connection_connected_time']/1000;
- $hours = floor($init / 3600);
- $minutes = floor(($init / 60) % 60);
- $seconds = $init % 60;
- if($hours>0)
- {
- $connectionTime .= ''.$hours.' godzin ';
- }
- if($minutes>0)
- {
- $connectionTime .= ''.$minutes.' minut ';
- }
- if($seconds>0)
- {
- $connectionTime .= ''.$seconds.' sekund';
- }
- $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
- [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
- [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]';
- }
- if(!$online)
- {
- $info = $query->getElement('data', $query->clientDbInfo($groupclient['cldbid']));
- $seconds = time() - $info['client_lastconnected'];
- $days = floor($seconds / 86400);
- $hours = floor(($seconds - ($days * 86400)) / 3600);
- $minutes = floor(($seconds - ($days * 86400) - ($hours * 3600))/60);
- $seconds = floor(($seconds - ($days * 86400) - ($hours * 3600) - ($minutes*60)));
- $time = '';
- if($days>0)
- {
- $time .= ''.$days.' dni ';
- }
- if($hours>0)
- {
- $time .= ''.$hours.' godzin ';
- }
- if($minutes>0)
- {
- $time .= ''.$minutes.' minut';
- }
- if($time=='')
- {
- $time .= ''.$seconds.' sekund';
- }
- $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
- [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]';
- }
- if($away && $online)
- {
- $clIds = $query->getElement('data', $query->clientGetIds($groupclient['client_unique_identifier']));
- $clInfo = $query->getElement('data', $query->clientInfo($clIds[0]['clid']));
- $awayTime = '';
- $init = $clInfo['client_idle_time']/1000;
- $hours = floor($init / 3600);
- $minutes = floor(($init / 60) % 60);
- $seconds = $init % 60;
- if($hours>0)
- {
- $awayTime .= ''.$hours.' godzin ';
- }
- if($minutes>0)
- {
- $awayTime .= ''.$minutes.' minut ';
- }
- if($seconds>0)
- {
- $awayTime .= ''.$seconds.' sekund';
- }
- $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]';
- }
- }
- }
- }
- $desc.= '\n';
- $desc.= '[center][b][color=red]Całkowity Zakaz Kopiowania[/color]
- [color=red]S[/color]-24[color=red]H[/color].PL
- Copyright © 2016[/center]';
- $desc.= '[right][url=http://www.teamspeak.com][img]http://teamperdox.bplaced.net/inc/tinymce_files/teamspeak3%20Kopie%20Kopie.png[/img][/url][/right]';
- $channel = $query->channelInfo($config[$instanceid]['functions']['adminList']['channel']);
- if (strcmp($channel['data']['channel_description'], $desc) != 0)
- {
- $query->channelEdit($config[$instanceid]['functions']['adminList']['channel'], array(
- 'channel_description' => $desc
- ));
- }
- }
- function getgroupname($grupa)
- {
- global $query;
- $groups = $query->getElement('data', $query->serverGroupList());
- $groupname = '';
- foreach($groups as $group)
- {
- if ($group['sgid'] == $grupa)
- {
- $groupname = $group['name'];
- }
- }
- return $groupname;
- }
- function getChannelName($cid)
- {
- global $query;
- $chInfo = $query->getElement('data', $query->channelInfo($cid));
- return $chInfo['channel_name'];
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement