function tag_start($parser, $attr, $params) { global $sv_privateClients; global $gameType; global $mapName; global $sv_maxclients; global $sv_hostname; global $shortversion; global $supportedgames; global $ffa_modes; global $pll_noteams; global $nameTeamRed; global $nameTeamBlue; global $nameSpectators; if ($attr == 'CLIENT') { //global $clients; global $clientsRed; global $clientsBlue; global $clientsSpec; $tmp = ""; $cli = $params['NAME']; if (isset($params['SCORE'])) { $score = $params['SCORE']; } else { $score = 'n.a.'; } if (in_array($gameType, $ffa_modes) || $pll_noteams != 0) { $clientsSpec[$params['CID']] = new client($params['DBID'], $params['NAME'], $params['COLORNAME'], $params['LEVEL'], $params['CONNECTIONS'], $score, $params['CID'], $params['GUID'], $params['PBID'], $params['TEAM'], $params['STATE'], $params['IP']); } else { if ($params['TEAM'] == 2) { $clientsRed[$params['CID']] = new client($params['DBID'], $params['NAME'], $params['COLORNAME'], $params['LEVEL'], $params['CONNECTIONS'], $score, $params['CID'], $params['GUID'], $params['PBID'], $params['TEAM'], $params['STATE'], $params['IP']); } if ($params['TEAM'] == 3) { $clientsBlue[$params['CID']] = new client($params['DBID'], $params['NAME'], $params['COLORNAME'], $params['LEVEL'], $params['CONNECTIONS'], $score, $params['CID'], $params['GUID'], $params['PBID'], $params['TEAM'], $params['STATE'], $params['IP']); } if ($params['TEAM'] == -1 || $params['TEAM'] == 1) { $clientsSpec[$params['CID']] = new client($params['DBID'], $params['NAME'], $params['COLORNAME'], $params['LEVEL'], $params['CONNECTIONS'], $score, $params['CID'], $params['GUID'], $params['PBID'], $params['TEAM'], $params['STATE'], $params['IP']); } } } else { if ($attr == 'DATA') { if ($params['NAME'] == "sv_privateClients") { $sv_privateClients = $params['VALUE']; } if ($params['NAME'] == "gameType") { $gameType = $params['VALUE']; } if ($params['NAME'] == "sv_maxclients") { $sv_maxclients = $params['VALUE']; } if ($params['NAME'] == "sv_hostname") { $sv_hostname = removequake3color(htmlentities($params['VALUE'])); } if (in_array($params['NAME'], $supportedgames)) { $mapName = $params['MAP']; } if ($params['NAME'] == "shortversion") { $shortversion = $params['VALUE']; } else { if ($params['NAME'] == "version") { $shortversion = $params['VALUE']; } } if ($params['NAME'] == "g_teamnameblue") { $nameTeamBlue = $params['VALUE']; } if ($params['NAME'] == "g_teamnamered") { $nameTeamRed = $params['VALUE']; } } else { if ($attr == 'GAME') { if (in_array($params['NAME'], $supportedgames)) { $mapName = $params['MAP']; } } } } }
function configpicker($cpath = "config") { global $servernames; //globalize to be used in adminpanel global $currentconfignumber; //$currentconfignumber = trim(trim($currentconfig, "config/statsconfig"), ".php"); global $disable_configpicker; //always show config picker on admin panel $currentpage = substr($_SERVER["SCRIPT_NAME"], strrpos($_SERVER["SCRIPT_NAME"], "/") + 1); if ($disable_configpicker && $currentpage == "index.php") { return; } $c = true; $cnt = 0; //$configlist[]= ""; while ($c == true) { $cnt++; $filename = $cpath . "/statsconfig" . $cnt . ".php"; if (file_exists($filename)) { $configlist[] = $cnt; } else { $c = false; } } if ($cnt > 2) { //find all status file paths foreach ($configlist as $value) { $str = file($cpath . "/statsconfig" . $value . ".php"); foreach ($str as $phrase) { if (strstr($phrase, 'b3_status_url')) { $b3_status_url = explode('"', $phrase); } } $b3_status_url_list[] = $b3_status_url[1]; } //get server names from each status url $scnt = 0; foreach ($b3_status_url_list as $status) { $scnt++; $servername = "Server " . $scnt; if (@simplexml_load_file($status)) { $xml = new simpleXMLElement($status, NULL, TRUE); foreach ($xml->Game->Data as $serverdata) { if ($serverdata['Name'] == "sv_hostname") { $servername = removequake3color(htmlentities($serverdata['Value'])); } } } $servernames[] = $servername; //for adminpanel if (strlen($servername) > 24) { $serverlist[] = substr($servername, 0, 24) . '...'; } else { $serverlist[] = $servername; } } echo "<form name=\"configselector\" id=\"configselector\"><select name=\"config\" class=\"stylepicker\" onchange=\"XLR_configPicker('parent',this,0)\">"; foreach ($configlist as $value) { if ($value == $currentconfignumber) { echo "<option value=\"{$value}\" selected=\"selected\">" . $serverlist[$value - 1] . "</option>"; } else { echo "<option value=\"{$value}\">" . $serverlist[$value - 1] . "</option>"; } } echo "</select></form>"; } }