diff options
Diffstat (limited to 'includes/header.php')
-rw-r--r-- | includes/header.php | 45 |
1 files changed, 41 insertions, 4 deletions
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 "<div class='artwork-credits-box--back'><div><h3>{$name}</h3>{$description}</div></div><img class='artwork-credits-image--back' src='{$image}' alt='{$name}'>"; + } else { + return "<img class='artwork-credits-image' src='{$image}' alt='{$name}'><div class='artwork-credits-box'><div><h3>{$name}</h3>{$description}</div></div>"; + } +} + +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/telemetry.json", json_encode($db, JSON_PRETTY_PRINT)); + ?> <!DOCTYPE html> <html lang="<?= $lang === "fr" ? "fr" : "en" ?>"> @@ -20,6 +56,7 @@ function l($en, $fr) { <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" href="/logo.svg"> <link href="/static/css/darktheme.css" rel="stylesheet"> + <link href="/static/css/fonts" rel="stylesheet"> <link href="/static/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> <title><?php @@ -30,8 +67,8 @@ function l($en, $fr) { ?><?= l("Minteck's space", "L'espace de Minteck") ?></title> </head> <body style="background-size: cover;background-position: center;background-repeat: no-repeat;background-attachment: fixed;"> - <div style="height:24px;background:orange;position:fixed;color:black;text-align:center;z-index:999;top:0;left:0;right:0;">Private beta of Minteck's space. Please report all bugs, issues or design details at <a href="mailto:nekostarfan@gmail.com">nekostarfan@gmail.com</a> or <a href="https://jetbrains.minteck.ro.lt:1024/youtrack/issues/MSS" target="_blank">on Minteck's YouTrack instance</a></div> - <nav class="navbar fixed-top navbar-expand-lg navbar-light bg-light" style="margin-top:24px;"> + <!--<div style="height:16px;background:orange;position:fixed;color:black;font-size:12px;font-weight:bold;text-align:center;z-index:999;top:0;left:0;right:0;">Private beta of Minteck's space. Please report all bugs, issues or design details at <a href="mailto:nekostarfan@gmail.com">nekostarfan@gmail.com</a> or <a href="https://jetbrains.minteck.ro.lt:1024/youtrack/issues/MSS" target="_blank">on Minteck's YouTrack instance</a></div>--> + <nav style="z-index:99;" class="navbar fixed-top navbar-expand-lg navbar-light bg-light"> <div class="container-fluid"> <a class="navbar-brand" href="/"><img src="/logo.svg" alt="" width="36px"> <span style="vertical-align: middle;"><?= l("Minteck's space", "L'espace de Minteck") ?></span></a> <button class="navbar-toggler" style="filter:invert(1);" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> |