Fix syntax and error

This commit is contained in:
Miraty 2023-03-28 00:18:37 +02:00
parent b9af7fee09
commit 2d6f2745a6
2 changed files with 7 additions and 7 deletions

View file

@ -1,7 +1,7 @@
<?php
$locale = 'en';
foreach (explode(',', preg_replace('/[A-Z0-9]|q=|;|-|\./', '', $_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? '') as $client_locale)) {
foreach (explode(',', preg_replace('/[A-Z0-9]|q=|;|-|\./', '', $_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? '')) as $client_locale) {
if (in_array($client_locale, ['en', 'fr'], true)) {
$locale = $client_locale;
break;

View file

@ -72,6 +72,12 @@ if (!TITLES_LINEAGE[array_key_last(TITLES_LINEAGE)]) {
exit('Page not found.');
}
if (isset($_SERVER['SERVER_NAME']) !== true)
exit('Missing <code>$_SERVER[\'SERVER_NAME\']</code>');
if (in_array($_SERVER['SERVER_NAME'], CONF['common']['public_domains'], true) !== true)
exit('The current <code>$_SERVER[\'SERVER_NAME\']</code> is not allowed in configuration.');
define('SERVER_NAME', $_SERVER['SERVER_NAME']);
const SESSION_COOKIE_NAME = 'servnest-session-key';
function startSession() {
session_start([
@ -119,12 +125,6 @@ if (isset($_SESSION['id'])) {
}
}
if (isset($_SERVER['SERVER_NAME']) !== true)
output(500, 'Missing $_SERVER[\'SERVER_NAME\']');
if (in_array($_SERVER['SERVER_NAME'], CONF['common']['public_domains'], true) !== true)
output(500, 'The current server name is not allowed in configuration.');
define('SERVER_NAME', $_SERVER['SERVER_NAME']);
function displayFinalMessage($data) {
if (isset($data['final_message'])) {
echo $data['final_message'];