Пример #1
0
 /**
  * Importe les options du serveur depuis un fichier
  *
  * @param  string $file -> Chemin du fichier à lire
  * @return array
  */
 public static function importServerOptions($file)
 {
     global $client;
     $out = array();
     if (file_exists($file)) {
         $dom = new DOMDocument();
         $dom->load($file);
         $srvopts = $dom->childNodes->item(0);
         for ($i = 0; $i < $srvopts->childNodes->length; $i++) {
             $srvoptsElement = $srvopts->childNodes->item($i);
             if ($srvoptsElement->nodeName != '#text') {
                 $out[$srvoptsElement->nodeName] = Str::setValueType($srvoptsElement->nodeValue, $srvoptsElement->getAttribute('type'));
             }
         }
     } else {
         self::error(Utils::t('No such file or file is not readable') . ' : ' . $file);
     }
     return $out;
 }
Пример #2
0
    $method = null;
}
if (isset($_POST['params'])) {
    $params = $_POST['params'];
} else {
    $params = null;
}
// DATA
$out = null;
if (AdminServ::initialize()) {
    if (SERVER_VERSION_NAME == 'ManiaPlanet') {
        if ($method == 'set' && $params != null) {
            $scriptSettings = array();
            if (count($params) > 0) {
                foreach ($params as $param) {
                    $scriptSettings[$param['name']] = Str::setValueType($param['value'], $param['type']);
                }
            }
            if (!$client->query('SetModeScriptSettings', $scriptSettings)) {
                $out = '[' . $client->getErrorCode() . '] ' . $client->getErrorMessage();
            } else {
                $out = true;
            }
        } else {
            if (!$client->query('GetModeScriptInfo')) {
                $out = '[' . $client->getErrorCode() . '] ' . $client->getErrorMessage();
            } else {
                $out = $client->getResponse();
            }
        }
    }