From 9852b6cd074cceec0d0b549bb6c9bd7fe50c86f2 Mon Sep 17 00:00:00 2001 From: Minteck <46352972+Minteck@users.noreply.github.com> Date: Sun, 1 Aug 2021 22:28:15 +0200 Subject: Update --- includes/header.php | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) (limited to 'includes/header.php') diff --git a/includes/header.php b/includes/header.php index ea8fb50..3f16582 100644 --- a/includes/header.php +++ b/includes/header.php @@ -2,16 +2,52 @@ $lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); -function l($en, $fr) { +function l($en, $fr = null) { global $lang; - if (($lang === "fr" && isset($fr)) || isset($_GET['fr'])) { + if ((($lang === "fr" && isset($fr)) || (isset($_GET['fr']) && isset($fr) || isset($_COOKIE['fr']))) && !isset($_GET['en']) && !isset($_COOKIE['en']) && isset($fr)) { + setlocale(LC_TIME, array('fr_FR.UTF-8','fr_FR@euro','fr_FR','french')); return $fr; } else { return $en; } } +$db = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/telemetry.json"), true); + +$ip = md5($_SERVER['REMOTE_ADDR']); +$day = date('d'); +$month = date('m'); +$year = date('y'); +$url = explode("?", $_SERVER['REQUEST_URI'])[0]; + +if (!isset($db[$year])) { + $db[$year] = []; +} +if (!isset($db[$year][$month])) { + $db[$year][$month] = []; +} +if (!isset($db[$year][$month][$day])) { + $db[$year][$month][$day] = []; +} +if (!isset($db[$year][$month][$day][$url])) { + $db[$year][$month][$day][$url] = []; +} + +if (!in_array($ip, $db[$year][$month][$day][$url])) { + array_push($db[$year][$month][$day][$url], $ip); +} + +function credit(string $name, string $description, string $image, bool $backwards) { + if ($backwards) { + return "

{$name}

{$description}
{$name}"; + } else { + return "{$name}

{$name}

{$description}
"; + } +} + +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/telemetry.json", json_encode($db, JSON_PRETTY_PRINT)); + ?> "> @@ -20,6 +56,7 @@ function l($en, $fr) { + <?php @@ -30,8 +67,8 @@ function l($en, $fr) { ?><?= l("Minteck's space", "L'espace de Minteck") ?> -
Private beta of Minteck's space. Please report all bugs, issues or design details at nekostarfan@gmail.com or on Minteck's YouTrack instance
-