Made input interface multilingual.

Set proper default for CSS file in password_protect.php.
This commit is contained in:
Joshua Ramon Enslin 2018-06-18 17:18:06 +02:00 committed by Stefan Rohde-Enslin
parent 9158b2eec4
commit 0eab8391dd
9 changed files with 30 additions and 28 deletions

View File

@ -9,10 +9,10 @@
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.
ensureEnvironment(); // Ensure existence of system files.
$translations = loadLanguage($settings['defaultLang']); // Load translations.
ensureBackendEnv(); // Ensure session is started etc.
$pages = loadPages(); // Load overview of pages.
/*
* Load contents

View File

@ -55,16 +55,18 @@ function loadHttpToGlobals(array $vars) {
/**
* Function for loading the language.
*
* @param string $default The default language to use.
*
* @return string[]
*/
function loadLanguage():array {
function loadLanguage($default):array {
if (isset($_GET['lan'])) $_SESSION['lan'] = $lan = $_GET['lan'];
else if (isset($_SESSION['lan'])) $lan = $_SESSION['lan'];
// Default to English
if (!isset($lan) or !file_exists(__DIR__ . "/translations/$lan.php")) {
$lan = "en";
$lan = $default;
}
include __DIR__ . "/../translations/$lan.php";

View File

@ -21,7 +21,7 @@
function printBackendHead(array $settings, string $page = "home", string $title = "Home", string $icon = ""):string {
$output = '<!DOCTYPE html>
<html lang="en" id="' . $page . '">
<html lang="' . $settings['defaultLang'] . '" id="' . $page . '">
<head>
<!-- Content Security policies -->

View File

@ -12,10 +12,10 @@
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.
ensureEnvironment(); // Ensure existence of system files.
$translations = loadLanguage($settings['defaultLang']); // Load translations.
ensureBackendEnv(); // Ensure session is started etc.
$pages = loadPages(); // Load overview of pages.
/*
* Load data.

View File

@ -9,10 +9,10 @@
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.
ensureEnvironment(); // Ensure existence of system files.
$translations = loadLanguage($settings['defaultLang']); // Load translations.
ensureBackendEnv(); // Ensure session is started etc.
$pages = loadPages(); // Load overview of pages.
/*
* Load contents

View File

@ -12,10 +12,10 @@
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.
ensureEnvironment(); // Ensure existence of system files.
$translations = loadLanguage($settings['defaultLang']); // Load translations.
ensureBackendEnv(); // Ensure session is started etc.
$pages = loadPages(); // Load overview of pages.
/*
* Load data.

View File

@ -23,7 +23,7 @@ define("loginLogFile", __DIR__ . "/../data/logins.csv");
*
* @return void
*/
function showLoginPasswordProtect($error_msg = "", $cssFile = "themes/default/default.css") {
function showLoginPasswordProtect($error_msg = "", $cssFile = "themes/default/theme.css") {
echo '<!DOCTYPE html>
<html id="loginPage">

View File

@ -12,10 +12,10 @@
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.
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($translations['accessDenied']); return;

View File

@ -12,10 +12,10 @@
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.
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($translations['accessDenied']); return;