summaryrefslogtreecommitdiff
path: root/session.php
diff options
context:
space:
mode:
Diffstat (limited to 'session.php')
-rw-r--r--session.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/session.php b/session.php
index 9a1fbaf..9d7ce99 100644
--- a/session.php
+++ b/session.php
@@ -35,6 +35,7 @@ if (!file_exists("/mnt/familine/private/welcomed.json")) {
file_put_contents("/mnt/familine/private/welcomed.json", "[]");
}
$_WELCOMED = json_decode(file_get_contents("/mnt/familine/private/welcomed.json"), true);
+$_FRENCH = str_starts_with($_SERVER['HTTP_ACCEPT_LANGUAGE'], "fr");
if (isset($_COOKIE['FL_SESSION_TOKEN'])) {
if (str_contains($_COOKIE['FL_SESSION_TOKEN'], ".") || str_contains($_COOKIE['FL_SESSION_TOKEN'], "/")) {
@@ -51,6 +52,7 @@ if (isset($_COOKIE['FL_SESSION_TOKEN'])) {
$_USER = $_PROFILE['login'];
$_SUID = $_PROFILE['login'];
$_FULLNAME = $_PROFILE['name'];
+ $_FRENCH = $_PROFILE['locale']['name'] === "fr";
$loggedIn = true;
if (!in_array($_USER, $_WELCOMED)) {
@@ -61,4 +63,14 @@ if (isset($_COOKIE['FL_SESSION_TOKEN'])) {
}
} else {
$loggedIn = false;
+}
+
+function l($fr, $en) {
+ global $_FRENCH;
+
+ if ($_FRENCH) {
+ return $fr;
+ } else {
+ return $en;
+ }
} \ No newline at end of file