. */ require_once(dirname(__DIR__) . "/helpers/auth.php"); require_once(ROOT_DIR . "/helpers/config.php"); require_once(ROOT_DIR . "/helpers/lang.php"); $config = uConfig::getInstance(); $lang = (new uLang($config))->getStrings(); $auth = new uAuth(); if (!$auth->isAdmin()) { uUtils::exitWithError($lang["notauthorized"]); } $olLayers = uUtils::postArray('olLayers'); $data = [ 'map_api' => uUtils::postString('mapApi'), 'latitude' => uUtils::postFloat('initLatitude'), 'longitude' => uUtils::postFloat('initLongitude'), 'google_key' => uUtils::postString('googleKey'), 'require_auth' => uUtils::postBool('requireAuth'), 'public_tracks' => uUtils::postBool('publicTracks'), 'pass_lenmin' => uUtils::postInt('passLenMin'), 'pass_strength' => uUtils::postInt('passStrength'), 'interval_seconds' => uUtils::postInt('interval'), 'lang' => uUtils::postString('lang'), 'units' => uUtils::postString('units'), 'stroke_weight' => uUtils::postInt('strokeWeight'), 'stroke_color' => uUtils::postString('strokeColor'), 'stroke_opacity' => uUtils::postFloat('strokeOpacity'), 'color_normal' => uUtils::postString('colorNormal'), 'color_start' => uUtils::postString('colorStart'), 'color_stop' => uUtils::postString('colorStop'), 'color_extra' => uUtils::postString('colorExtra'), 'color_hilite' => uUtils::postString('colorHilite'), 'upload_maxsize' => uUtils::postInt('uploadMaxSize') ]; $config->setFromArray($data); if (!is_null($olLayers)) { $config->olLayers = []; foreach ($olLayers as $json) { $obj = json_decode($json); if (json_last_error() === JSON_ERROR_NONE) { $config->olLayers[] = new uLayer($obj->id, $obj->name, $obj->url, $obj->priority); } } } if ($config->save() === false) { uUtils::exitWithError($lang["servererror"]); } uUtils::exitWithSuccess();