2021-11-25 22:36:21 +01:00
|
|
|
<?php // This file is part of LibreQR, which is distributed under the GNU AGPLv3+ license
|
|
|
|
|
|
|
|
// ----- This file is included everywhere -----
|
2020-07-01 20:47:02 +02:00
|
|
|
|
|
|
|
require "config.inc.php";
|
|
|
|
|
2022-02-13 01:24:34 +01:00
|
|
|
define("DEFAULT_REDUNDANCY", "high");
|
2021-11-06 00:33:15 +01:00
|
|
|
define("DEFAULT_MARGIN", NULL);
|
|
|
|
define("DEFAULT_SIZE", NULL);
|
2021-07-11 14:00:35 +02:00
|
|
|
define("DEFAULT_BGCOLOR", "FFFFFF");
|
|
|
|
define("DEFAULT_MAINCOLOR", "000000");
|
|
|
|
|
2021-07-11 22:22:43 +02:00
|
|
|
$libreqrVersion = "1.4.0dev";
|
2020-10-25 18:02:57 +01:00
|
|
|
|
|
|
|
// Defines the locale to be used
|
2021-07-11 21:50:22 +02:00
|
|
|
if ($forceLocale == false AND isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
2020-10-12 18:48:53 +02:00
|
|
|
$clientLocales = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
|
|
|
|
$clientLocales = preg_replace("#[A-Z0-9]|q=|;|-|\.#", "", $clientLocales);
|
|
|
|
$clientLocales = explode(',', $clientLocales);
|
2021-01-01 16:42:36 +01:00
|
|
|
$availableLocales = array('en', 'fr', 'oc', 'template');
|
2020-10-12 18:48:53 +02:00
|
|
|
foreach ($clientLocales as $clientLocale) {
|
|
|
|
if (in_array($clientLocale, $availableLocales)) {
|
|
|
|
$locale = $clientLocale;
|
|
|
|
break;
|
|
|
|
}
|
2020-07-01 20:47:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
require "locales/" . $locale . ".php";
|
|
|
|
|
2020-10-12 18:48:53 +02:00
|
|
|
// Defines the root URL
|
2020-07-01 20:47:02 +02:00
|
|
|
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')
|
|
|
|
$protocol = "https";
|
|
|
|
else
|
|
|
|
$protocol = "http";
|
2020-10-12 18:48:53 +02:00
|
|
|
$rootPath = $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
|
|
|
$rootPath = preg_replace('#\?.*$#', '', $rootPath);
|
|
|
|
$rootPath = preg_replace('#(manifest|opensearch|index).php$#i', '', $rootPath);
|
2020-07-01 20:47:02 +02:00
|
|
|
|
|
|
|
require "themes/" . $theme . "/theme.php"; // Load theme
|