mirror of
https://github.com/php/web-php.git
synced 2026-03-23 23:02:13 +01:00
@@ -2,19 +2,14 @@
|
||||
|
||||
use phpweb\I18n\Languages;
|
||||
|
||||
$_GET["lang"] = "en";
|
||||
if (!isset($_GET["lang"])) {
|
||||
header("Location: http://php.net");
|
||||
exit;
|
||||
}
|
||||
$lang = $_GET["lang"] ?? "en";
|
||||
if (empty($_SERVER["DOCUMENT_ROOT"])) {
|
||||
$_SERVER["DOCUMENT_ROOT"] = __DIR__ . "/../";
|
||||
}
|
||||
include __DIR__ . '/../include/prepend.inc';
|
||||
if (!isset(Languages::ACTIVE_ONLINE_LANGUAGES[$_GET["lang"]])) {
|
||||
if (!isset(Languages::ACTIVE_ONLINE_LANGUAGES[$lang])) {
|
||||
header("Location: http://php.net");
|
||||
}
|
||||
$lang = $_GET["lang"];
|
||||
|
||||
/*
|
||||
$types = array(
|
||||
|
||||
@@ -137,11 +137,11 @@ const initPHPSearch = async (language) => {
|
||||
*/
|
||||
const loadIndexWithFallback = async () => {
|
||||
try {
|
||||
const searchItems = await loadIndex();
|
||||
return searchItems;
|
||||
return await loadIndex();
|
||||
} catch (error) {
|
||||
if (language !== "en") {
|
||||
return loadIndexWithFallback("en");
|
||||
language = "en";
|
||||
return loadIndexWithFallback();
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user