/** * Fetches a hell of a lot of data about a GBX challenge * * @param String $filename * The challenge filename (must include full path) * @param Boolean $parsexml * If true, the script also parses the XML block * @param Boolean $tnimage * If true, the script also extracts the thumbnail image; if GD/JPEG * libraries are present, image will be flipped upright, otherwise * it will be in the original upside-down format * Warning: this is binary data in JPEG format, 256x256 pixels for * TMU/TMF or 512x512 pixels for MP * @return GBXChallengeFetcher * If $uid is empty, GBX data couldn't be extracted */ public function __construct($filename, $parsexml = false, $tnimage = false) { parent::__construct($parsexml, $tnimage, false); try { $this->processFile($filename); $this->authortm = $this->authorTime; $this->goldtm = $this->goldTime; $this->silvertm = $this->silverTime; $this->bronzetm = $this->bronzeTime; $this->ascore = $this->authorScore; $this->azone = $this->authorZone; $this->multi = $this->multiLap; $this->editor = $this->simpleEdit; $this->pub = $this->authorBg; $this->nblaps = $this->nbLaps; $this->parsedxml = $this->xmlParsed; $this->xmlver = $this->xmlVer; $this->exever = $this->exeVer; $this->exebld = $this->exeBld; $this->songfile = $this->songFile; $this->songurl = $this->songUrl; $this->modname = $this->modName; $this->modfile = $this->modFile; $this->modurl = $this->modUrl; } catch (Exception $e) { $this->uid = ''; } }
/** * Met en forme les données des maps à partir d'un MatchSettings * * @global resource $client -> Le client doit être initialisé * @param array $maps -> Le tableau extrait du matchsettings : assoc array(ident => filename) * @return array */ public static function getMapListFromMatchSetting($maps) { global $client; $out = array(); $path = self::getMapsDirectoryPath(); $countMapList = count($maps); if ($countMapList > 0) { $i = 0; foreach ($maps as $mapUId => $mapFileName) { if (in_array(File::getDoubleExtension($mapFileName), AdminServConfig::$MAP_EXTENSION)) { // Données if (SERVER_VERSION_NAME == 'TmForever') { $Gbx = new GBXChallengeFetcher($path . Str::toSlash($mapFileName)); } else { $Gbx = new GBXChallMapFetcher(); $Gbx->processFile($path . Str::toSlash($mapFileName)); } // Name $name = htmlspecialchars($Gbx->name, ENT_QUOTES, 'UTF-8'); $out['lst'][$i]['Name'] = TmNick::toHtml($name, 10, true); // Environnement $env = $Gbx->envir; if ($env == 'Speed') { $env = 'Desert'; } else { if ($env == 'Alpine') { $env = 'Snow'; } } $out['lst'][$i]['Environment'] = $env; // Autres $out['lst'][$i]['FileName'] = $mapFileName; $out['lst'][$i]['UId'] = $Gbx->uid; $out['lst'][$i]['Author'] = $Gbx->author; $i++; } } } // Nombre de maps $out += self::getNbMaps($out); if ($out['nbm']['count'] == 0) { $out['lst'] = Utils::t('No map'); } return $out; }