isExpired()) { $cacheutils->setValue([getAdminList(), date('d-m-Y H:i:s')], 120); } $adminlist = $cacheutils->getValue(); // FUNCTIONS function getAdminList() { global $config; global $lang; $admingroups = $config["adminlist"]; $localIcons = array(100, 200, 300, 400, 500, 600); try { $tsAdmin = getTeamspeakConnection(); $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 = 'Group icon '; } } elseif (in_array($group["iconid"], $localIcons)) { $icon = 'Group icon '; } } $output .= "

$icon$group

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

' . translate($lang["adminlist"]["emptygroup"]) . '

'; continue; } $onlineClients = []; $offlineClients = []; foreach ($clients as $userInfo) { $user = getClientByDbid($tsAdmin, $userInfo['cldbid']); if($user["client_type"]) continue; if (!$user) { $offlineClients[] = '

' . htmlentities($userInfo['client_nickname']) . '' . translate($lang["adminlist"]["status"]["offline"]) . '

'; continue; } $onlineClients[] = '

User status' . '' . htmlentities($user) . '' . ($user['client_away'] ? '' . translate($lang["adminlist"]["status"]["away"]) . '' : '' . translate($lang["adminlist"]["status"]["online"]) . '') . '

'; } foreach (array_merge($onlineClients, $offlineClients) as $str) $output .= $str; } return $output; } catch (TeamSpeak3_Exception $e) { return '

' . translate($lang["general"]["scripterror"], [$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();