aboutsummaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-06-08 19:37:54 +0200
committerMinteck <contact@minteck.org>2022-06-08 19:37:54 +0200
commite78af7b6f3f775ccb8703091124c84ea9d1b59dd (patch)
tree0b6f74b3778ca3f700507fb7f8768d4670a12534 /index.php
parent1efab479fd6a90504472f3dd193028d756d03caa (diff)
downloadcore-e78af7b6f3f775ccb8703091124c84ea9d1b59dd.tar.gz
core-e78af7b6f3f775ccb8703091124c84ea9d1b59dd.tar.bz2
core-e78af7b6f3f775ccb8703091124c84ea9d1b59dd.zip
Improve i18n a bit more
Diffstat (limited to 'index.php')
-rw-r--r--index.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/index.php b/index.php
index cb35385..a153354 100644
--- a/index.php
+++ b/index.php
@@ -1,6 +1,7 @@
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/private/session.php";
+global $_FRENCH;
/** @var string $_FULLNAME
* @var string $_USER
@@ -167,7 +168,17 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/private/session.php";
</script>
<br>
<?php foreach (array_reverse(scandir($_SERVER["DOCUMENT_ROOT"] . "/private/news")) as $article): if (str_ends_with($article, ".json")): ?>
- <?php $data = json_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/private/news/" . $article), true); $html = file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/private/news/" . substr($article, 0, -5) . ".html"); $summary = trim(explode("<!---->", $html)[0]); $full = trim($html); ?>
+ <?php $data = json_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/private/news/" . $article), true);
+
+ if (!$_FRENCH && file_exists($_SERVER["DOCUMENT_ROOT"] . "/private/news/" . substr($article, 0, -5) . ".en.html")) {
+ $html = file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/private/news/" . substr($article, 0, -5) . ".en.html");
+ } else {
+ $html = file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/private/news/" . substr($article, 0, -5) . ".html");
+ }
+
+ $summary = trim(explode("<!---->", $html)[0]);
+ $full = trim($html);
+ ?>
<?php if ($data["limited"] === null || in_array($_USER, $data["limited"])): ?>
<div class="jumbotron">
<h5><?= $data["date"][l("fr","en")] ?></h5>