} // Fonction de rappel pour le remplacement des caractères spéciaux function replaceFilename($str) { return Str::replaceChars($str); } // Jeu if (SERVER_VERSION_NAME == 'TmForever') { $queries = array('insert' => 'InsertChallenge', 'add' => 'AddChallenge', 'type' => $type); } else { $queries = array('insert' => 'InsertMap', 'add' => 'AddMap', 'type' => $type); } // Taille max if (AdminServConfig::SIZE_LIMIT == 'auto') { $sizeLimit1 = intval(ini_get('post_max_size')) * 1024 * 1024; $sizeLimit2 = intval(ini_get('upload_max_filesize')) * 1024 * 1024; $sizeLimit = min($sizeLimit1, $sizeLimit2); } else { $sizeLimit = intval(AdminServConfig::SIZE_LIMIT) * 1024 * 1024; } // Enregistrement du fichier $result = FileUploader::saveUploadedFileToManiaPlanetServer($client, $path, $queries, AdminServConfig::$ALLOWED_EXTENSIONS, $sizeLimit, 'replaceFilename'); // Sauvegarde du MatchSettings if ($mset && SERVER_MATCHSET && $type != 'local' && isset($result['success']) && $result['success'] == true) { if (!$client->query('SaveMatchSettings', $mapDirectoryPath . SERVER_MATCHSET)) { $result['error'] = '[' . $client->getErrorCode() . '] ' . $client->getErrorMessage(); } } } $client->Terminate(); echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);