Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /********************************
- Author: Tymoteusz `Razor Meister` Bartnik
- Contact: battnik90@gmail.com
- Function: admin_list_online()
- ********************************/
- class admin_list_online
- {
- private static $name;
- private static $cfg;
- static public function construct($event_name)
- {
- global $cfg;
- self::$cfg = $cfg[$event_name];
- self::$name = $event_name;
- }
- static public function before_clients()
- {
- global $query, $clients, $language, $xbot;
- $desc = "[center][img]http://147.135.163.97/ftp/AdministracjaOnline.png[/img][/center]\n";
- $count_all = 0;
- foreach(self::$cfg['admins_server_groups'] as $admin_group)
- {
- $count = 0;
- $admins = array();
- if(!$xbot::check_group($admin_group, self::$name, $rang_name))
- continue;
- foreach($query->getElement('data', $query->serverGroupClientList($admin_group)) as $client_from_group)
- {
- if(isset($client_from_group['cldbid']) && $client_from_group['cldbid'] != 1)
- {
- foreach($clients as $client)
- {
- if(isset($client['client_database_id']) && $client['client_database_id'] != 1 && $client['client_database_id'] == $client_from_group['cldbid'] && !$xbot::has_group($client['client_servergroups'], self::$cfg['ignored_groups']))
- {
- $count++;
- $channel = $query->getElement('data', $query->channelInfo($client['cid']));
- array_push($admins, array
- (
- 'name' => $client['client_nickname'],
- 'type' => "online",
- 'channel' => $channel['channel_name'],
- 'channel_id' => $client['cid'],
- 'uid' => $client['client_unique_identifier'],
- 'clid' => $client['clid'],
- 'dbid' => $client['client_database_id'],
- 'time_online' => $xbot::convert_time(time() - $client['client_lastconnected']),
- ));
- echo time() - $client['client_lastconnected']."\n";
- }
- }
- }
- }
- if($count == 0)
- continue;
- $desc .= "[center][size=13][b]".$rang_name."[/b][/size]\n[size=9]Administratorzy online w grupie: [b]".$count."[/b][/size][/center]";
- if($admins == NULL)
- $desc .= "\n\n";
- foreach($admins as $admin)
- $desc .= "[size=9][list][*] Nick administratora: [b][URL=client://".$admin['clid']."/".$admin['uid']."]".$admin['name']."[/url]".$xbot::show_link($admin['dbid'])." [*] ".$language['function']['admin_list_online']['online']."[b][color=green]".$admin['time_online']."[/color][/b] [*] ".$language['function']['admin_list_online']['on_channel']." [b][url=channelId://".$admin['channel_id']."]".$admin['channel']."[/url][/list][/size]";
- unset($admins);
- $count_all += $count;
- }
- if($count_all == 0)
- $desc .= "\n ● [img]http://i.imgur.com/xf55jvq.png[/img][size=9] ".$language['function']['admin_list_online']['no_admins']."[/size]\n";
- $desc .= $language['function']['down_desc'];
- if($xbot::check_channel_desc(self::$cfg['channel_id'], $desc))
- if($xbot::check_error($query->channelEdit(self::$cfg['channel_id'], array('channel_description' => $desc)), self::$name, self::$cfg['channel_id'], true))
- $query->channelEdit(self::$cfg['channel_id'], array('channel_name' => str_replace('[ONLINE]', $count_all, self::$cfg['channel_name'])));
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement