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() { try { $tsAdmin = TeamSpeak3::factory(getTeamspeakURI(). "#no_query_clients"); $serverGroupList = $tsAdmin->serverGroupList(); $output = ""; foreach ($serverGroupList as $group) { if(!isAdminGroup($group->getId())) continue; $output .= "

$group

"; foreach ($group->clientList() 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 isAdminGroup($groupid) { global $config; $admingroups = $config["adminlist"]; return in_array($groupid, $admingroups); } function getClientByDbid($tsAdmin, $cldbid) { try { return $tsAdmin->clientGetByDbid($cldbid); } catch(TeamSpeak3_Exception $e) { return false; } } // echo getAdminList();