get('adminlist'); // $cache->clean(); if (is_null($adminlist)) { $adminlist = array(getAdminList(), date('d-m-Y H:i:s')); $cache->set('adminlist', $adminlist, 30); } // FUNCTIONS function getAdminList() { global $config; $admingroups = $config["adminlist"]; $localIcons = array(100, 200, 300, 400, 500, 600); try { $tsAdmin = TeamSpeak3::factory(getTeamspeakURI(). "#no_query_clients"); $output = ""; foreach ($admingroups as $group) { if(!array_key_exists((string) $group, $tsAdmin->serverGroupList())) continue; $group = $tsAdmin->serverGroupGetById($group); $icon = ''; if($group["iconid"]) { if(!$group->iconIsLocal("iconid")) { $groupicon = getGroupIcon($tsAdmin, $group); if($groupicon) { $icon = ' '; } } elseif(in_array($group["iconid"], $localIcons)) { $icon = ' '; } } $output .= "

$icon$group

"; $clients = $group->clientList(); if(empty($clients)) { $output .= '

Ta grupa jest pusta

'; continue; } foreach ($clients as $userInfo) { $user = getClientByDbid($tsAdmin, $userInfo['cldbid']); if(!$user) { $output .= '

' . $userInfo['client_nickname'] . 'Offline

'; continue; } $output .= '

' . '' . $user . '' . ($user['client_away'] ? 'Away' : 'Online') . '

'; } } return $output; } catch(TeamSpeak3_Exception $e) { return '

Wystąpił błąd ' . $e->getCode() . ': ' . $e->getMessage() . '

'; } } function getClientByDbid($tsAdmin, $cldbid) { try { return $tsAdmin->clientGetByDbid($cldbid); } catch(TeamSpeak3_Exception $e) { return false; } } function getGroupIcon($tsAdmin, $group) { try { return $group->iconDownload(); } catch(TeamSpeak3_Exception $e) { return false; } } // echo getAdminList();