Made input interface multilingual.
Set proper default for CSS file in password_protect.php.
This commit is contained in:
parent
9158b2eec4
commit
0eab8391dd
|
@ -10,7 +10,7 @@
|
||||||
require_once __DIR__ . "/inc/functions.php";
|
require_once __DIR__ . "/inc/functions.php";
|
||||||
|
|
||||||
ensureEnvironment(); // Ensure existence of system files.
|
ensureEnvironment(); // Ensure existence of system files.
|
||||||
$translations = loadLanguage(); // Load translations.
|
$translations = loadLanguage($settings['defaultLang']); // Load translations.
|
||||||
ensureBackendEnv(); // Ensure session is started etc.
|
ensureBackendEnv(); // Ensure session is started etc.
|
||||||
$pages = loadPages(); // Load overview of pages.
|
$pages = loadPages(); // Load overview of pages.
|
||||||
|
|
||||||
|
|
|
@ -55,16 +55,18 @@ function loadHttpToGlobals(array $vars) {
|
||||||
/**
|
/**
|
||||||
* Function for loading the language.
|
* Function for loading the language.
|
||||||
*
|
*
|
||||||
|
* @param string $default The default language to use.
|
||||||
|
*
|
||||||
* @return string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
function loadLanguage():array {
|
function loadLanguage($default):array {
|
||||||
|
|
||||||
if (isset($_GET['lan'])) $_SESSION['lan'] = $lan = $_GET['lan'];
|
if (isset($_GET['lan'])) $_SESSION['lan'] = $lan = $_GET['lan'];
|
||||||
else if (isset($_SESSION['lan'])) $lan = $_SESSION['lan'];
|
else if (isset($_SESSION['lan'])) $lan = $_SESSION['lan'];
|
||||||
|
|
||||||
// Default to English
|
// Default to English
|
||||||
if (!isset($lan) or !file_exists(__DIR__ . "/translations/$lan.php")) {
|
if (!isset($lan) or !file_exists(__DIR__ . "/translations/$lan.php")) {
|
||||||
$lan = "en";
|
$lan = $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
include __DIR__ . "/../translations/$lan.php";
|
include __DIR__ . "/../translations/$lan.php";
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
function printBackendHead(array $settings, string $page = "home", string $title = "Home", string $icon = ""):string {
|
function printBackendHead(array $settings, string $page = "home", string $title = "Home", string $icon = ""):string {
|
||||||
|
|
||||||
$output = '<!DOCTYPE html>
|
$output = '<!DOCTYPE html>
|
||||||
<html lang="en" id="' . $page . '">
|
<html lang="' . $settings['defaultLang'] . '" id="' . $page . '">
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
<!-- Content Security policies -->
|
<!-- Content Security policies -->
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
require_once __DIR__ . "/inc/functions.php";
|
require_once __DIR__ . "/inc/functions.php";
|
||||||
|
|
||||||
ensureEnvironment(); // Ensure existence of system files.
|
ensureEnvironment(); // Ensure existence of system files.
|
||||||
$translations = loadLanguage(); // Load translations.
|
$translations = loadLanguage($settings['defaultLang']); // Load translations.
|
||||||
ensureBackendEnv(); // Ensure session is started etc.
|
ensureBackendEnv(); // Ensure session is started etc.
|
||||||
$pages = loadPages(); // Load overview of pages.
|
$pages = loadPages(); // Load overview of pages.
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
require_once __DIR__ . "/inc/functions.php";
|
require_once __DIR__ . "/inc/functions.php";
|
||||||
|
|
||||||
ensureEnvironment(); // Ensure existence of system files.
|
ensureEnvironment(); // Ensure existence of system files.
|
||||||
$translations = loadLanguage(); // Load translations.
|
$translations = loadLanguage($settings['defaultLang']); // Load translations.
|
||||||
ensureBackendEnv(); // Ensure session is started etc.
|
ensureBackendEnv(); // Ensure session is started etc.
|
||||||
$pages = loadPages(); // Load overview of pages.
|
$pages = loadPages(); // Load overview of pages.
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
require_once __DIR__ . "/inc/functions.php";
|
require_once __DIR__ . "/inc/functions.php";
|
||||||
|
|
||||||
ensureEnvironment(); // Ensure existence of system files.
|
ensureEnvironment(); // Ensure existence of system files.
|
||||||
$translations = loadLanguage(); // Load translations.
|
$translations = loadLanguage($settings['defaultLang']); // Load translations.
|
||||||
ensureBackendEnv(); // Ensure session is started etc.
|
ensureBackendEnv(); // Ensure session is started etc.
|
||||||
$pages = loadPages(); // Load overview of pages.
|
$pages = loadPages(); // Load overview of pages.
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ define("loginLogFile", __DIR__ . "/../data/logins.csv");
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showLoginPasswordProtect($error_msg = "", $cssFile = "themes/default/default.css") {
|
function showLoginPasswordProtect($error_msg = "", $cssFile = "themes/default/theme.css") {
|
||||||
|
|
||||||
echo '<!DOCTYPE html>
|
echo '<!DOCTYPE html>
|
||||||
<html id="loginPage">
|
<html id="loginPage">
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
require_once __DIR__ . "/inc/functions.php";
|
require_once __DIR__ . "/inc/functions.php";
|
||||||
|
|
||||||
ensureEnvironment(); // Ensure existence of system files.
|
ensureEnvironment(); // Ensure existence of system files.
|
||||||
$translations = loadLanguage(); // Load translations.
|
$translations = loadLanguage($settings['defaultLang']); // Load translations.
|
||||||
ensureBackendEnv(); // Ensure session is started etc.
|
ensureBackendEnv(); // Ensure session is started etc.
|
||||||
$pages = loadPages(); // Load overview of pages.
|
$pages = loadPages(); // Load overview of pages.
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
require_once __DIR__ . "/inc/functions.php";
|
require_once __DIR__ . "/inc/functions.php";
|
||||||
|
|
||||||
ensureEnvironment(); // Ensure existence of system files.
|
ensureEnvironment(); // Ensure existence of system files.
|
||||||
$translations = loadLanguage(); // Load translations.
|
$translations = loadLanguage($settings['defaultLang']); // Load translations.
|
||||||
ensureBackendEnv(); // Ensure session is started etc.
|
ensureBackendEnv(); // Ensure session is started etc.
|
||||||
$pages = loadPages(); // Load overview of pages.
|
$pages = loadPages(); // Load overview of pages.
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user