*/ /* * Require files and ensure environment. */ require_once __DIR__ . "/inc/functions.php"; ensureEnvironment(); // Ensure existence of system files. $translations = loadLanguage($settings['defaultLang']); // Load translations. ensureBackendEnv(); // Ensure session is started etc. $pages = loadPages(); // Load overview of pages. if (!$_SESSION['admin']) { echo printErrorPage($settings, $translations['accessDenied']); return; } /* * Load data. */ // Check for vars. loadHttpToGlobals(["task", "startPage", "pageTitle", "logo", "url", "css", "hideInstitution", "mdVersion", "mdImgFolder", "cacheRefreshInterval", "limitToInstitutions", "maxFileSize", "sendHTTPHeaders", "CSPimageSources", "CSPobjectSources", "defaultLang"]); /** * Part for editing settings. */ if (isset($task) and $task == "update") { 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 '
'; echo printBackendNav($translations); echo '
' . $translations['general'] . '
' . generateHelpToolTip("helpStartPage", $translations['startPage'], $translations['helpStartPage']) . '
' . generateHelpToolTip("helpSettingsPageTitle", $translations['settingsPageTitle'], $translations['helpSettingsPageTitle']) . '
' . generateHelpToolTip("helpLogo", $translations['logo'], $translations['helpLogo']) . '
' . generateHelpToolTip("helpURL", $translations['url'], $translations['helpURL']) . '
' . generateHelpToolTip("helpSettingsUsedCSS", $translations['settingsUsedCSS'], $translations['helpSettingsUsedCSS']) . '
' . generateHelpToolTip("helpLanguage", $translations['language'], $translations['helpLanguage']) . '
' . $translations['integrationWithMD'] . '
' . generateHelpToolTip("helpMDVersion", $translations['mdVersion'], $translations['helpMDVersion']) . '
' . generateHelpToolTip("helpMDimgFolder", $translations['mdImgFolder'], $translations['helpMDimgFolder']) . '
' . generateHelpToolTip("helpCacheRefreshInterval", $translations['cacheRefreshInterval'], $translations['helpCacheRefreshInterval']) . '
' . generateHelpToolTip("helpLimitToInstitutions", $translations['limitToInstitutions'], $translations['helpLimitToInstitutions']) . '
' . generateHelpToolTip("helpHideInstitution", $translations['hideInstitution'], $translations['helpHideInstitution']) . '
' . $translations['security'] . '
' . generateHelpToolTip("helpMaxFileSize", $translations['maxFileSize'], $translations['helpMaxFileSize']) . '
' . generateHelpToolTip("helpSendHTTPHeaders", $translations['sendHTTPHeaders'], $translations['helpSendHTTPHeaders']) . '
' . generateHelpToolTip("helpCSPimageSources", $translations['CSPimageSources'], $translations['helpCSPimageSources']) . '
' . generateHelpToolTip("helpCSPobjectSources", $translations['CSPobjectSources'], $translations['helpCSPobjectSources']) . '
' . printHiddenInputs(['task' => 'update'], 16) . '
'; echo printBackendEnd(); ?>