*/ /* * 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", "mdVersion", "maxFileSize", "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, "/") . "/"; } foreach (["startPage", "pageTitle", "logo", "url", "mdVersion", "maxFileSize", "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($translations['settings'], $translations['settings'], $settings['logo']); echo printBackendHeader($translations['settings'], $translations['helpSettings']); echo '