*/ /* * Require files and ensure environment. */ require_once __DIR__ . "/inc/functions.php"; ensureEnvironment(); // Ensure existence of system files. $translations = loadLanguage(); // Load translations. ensureBackendEnv(); // Ensure session is started etc. $pages = loadPages(); // Load overview of pages. /* * Load data. */ // Check for vars. loadHttpToGlobals(["task", "startPage", "pageTitle", "logo", "url", "css", "hideInstitution", "mdVersion", "mdImgFolder", "cacheRefreshInterval", "limitToInstitutions", "maxFileSize", "sendHTTPHeaders", "CSPimageSources", "CSPobjectSources", "defaultLang"]); if (isset($task) and $task == "update") { // Adding new users. if (isset($defaultLang) and !in_array("$defaultLang.php", scanDirConts(__DIR__ . "/translations"))) { $_SESSION["editHistory"] = ["changesAborted", $translations['languageUnavailable']]; header('Location: settings.php'); } // Ensure that URLs end with a trailing slash. if (isset($mdVersion)) $mdVersion = rtrim($mdVersion, "/") . "/"; if (isset($mdImgFolder)) $mdImgFolder = rtrim($mdImgFolder, "/") . "/"; if (isset($limitToInstitutions)) $settings['limitToInstitutions'] = array_diff(explode(',', $limitToInstitutions), ['']); foreach (["startPage", "pageTitle", "logo", "url", "css", "hideInstitution", "mdVersion", "mdImgFolder", "cacheRefreshInterval", "maxFileSize", "sendHTTPHeaders", "CSPimageSources", "CSPobjectSources", "defaultLang"] as $var) { if (isset($$var)) $settings[$var] = $$var; } // Store the users array. file_put_contents(__DIR__ . "/../data/settings.json", json_encode($settings), LOCK_EX); $_SESSION["editHistory"] = ["changesStored", $translations['settingsUpdated'] . " $username"]; header('Location: settings.php'); return; } /* * Output */ echo printBackendHead($settings, $translations['settings'], $translations['settings'], $settings['logo']); echo printBackendHeader($translations['settings'], $translations['helpSettings']); echo '