diff options
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 417 |
1 files changed, 320 insertions, 97 deletions
@@ -1,98 +1,321 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/private/session.php"; - -/** @var string $_FULLNAME - * @var string $_USER - * @var array $_PROFILE - * @var boolean $_ADMIN - * @var array $_CONFIG - */ - -?> - -<!DOCTYPE html> -<html lang="en"> -<head> - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <title>Familine</title> - <link rel="icon" href="/favicon.svg"> - <link rel="stylesheet" href="/styles.css"> - <?= strpos($_SERVER['HTTP_USER_AGENT'], "+Familine/") !== false ? '<link rel="stylesheet" href="/native.css">' : "" ?> - <?= strpos($_SERVER['HTTP_USER_AGENT'], "+Familine/") !== false ? '<script>$ = require(\'jquery\');jQuery = require(\'jquery\');</script>' : '<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>' ?> -</head> -<body> - <div class='progress' style="display:none;" id="progress_div"> - <div class='bar' id='bar1'></div> - <div class='percent' id='percent1'></div> - </div> - <input type="hidden" id="progress_width" value="0"> - <script src="/js/loading.js"></script> - <div id="loading"> - <img src="/loader.svg" style="filter:invert(1);width:96px;"> - </div> - - <div id="explore"> - <div> - <img src="/favicon.svg" width="128px" height="128px"> - <h1 style="font-size: 48px;">Familine</h1> - <div id="explore-grid"<?php if ($_ADMIN): ?> class="admin"<?php endif; ?>> - <?php if ($_ADMIN): ?> - <a href="https://console.<?= $_CONFIG["Global"]["domain"] ?>" class="explore-btn"> - <img src="/icns/familine-camera.svg" width="48px" height="48px" style="margin: 0 20px;"><br> - <span>Camera</span> - </a> - <?php endif; ?> - <a href="https://docs.<?= $_CONFIG["Global"]["domain"] ?>" class="explore-btn"> - <img src="/icns/familine-docs.svg" width="48px" height="48px" style="margin: 0 20px;"><br> - <span>Docs</span> - </a> - <a href="https://support.<?= $_CONFIG["Global"]["domain"] ?>" class="explore-btn"> - <img src="/icns/familine-help.svg" width="48px" height="48px" style="margin: 0 20px;"><br> - <span>Help</span> - </a> - <a href="https://money.<?= $_CONFIG["Global"]["domain"] ?>" class="explore-btn"> - <img src="/icns/familine-money.svg" width="48px" height="48px" style="margin: 0 20px;"><br> - <span>Money</span> - </a> - <a href="https://cinema.<?= $_CONFIG["Global"]["domain"] ?>" class="explore-btn"> - <img src="/icns/familine-movies.svg" width="48px" height="48px" style="margin: 0 20px;"><br> - <span>Movies</span> - </a> - <a href="https://photos.<?= $_CONFIG["Global"]["domain"] ?>" class="explore-btn"> - <img src="/icns/familine-photos.svg" width="48px" height="48px" style="margin: 0 20px;"><br> - <span>Photos</span> - </a> - <a href="https://cloud.<?= $_CONFIG["Global"]["domain"] ?>" class="explore-btn"> - <img src="/icns/familine-review.svg" width="48px" height="48px" style="margin: 0 20px;"><br> - <span>Review</span> - </a> - <a href="https://share.<?= $_CONFIG["Global"]["domain"] ?>" class="explore-btn"> - <img src="/icns/familine-share.svg" width="48px" height="48px" style="margin: 0 20px;"><br> - <span>Share</span> - </a> - <a href="https://chat.<?= $_CONFIG["Global"]["domain"] ?>" class="explore-btn"> - <img src="/icns/familine-you.svg" width="48px" height="48px" style="margin: 0 20px;"><br> - <span>Yikes</span> - </a> - </div> - </div> - </div> - - <?php - - $icons = scandir($_SERVER['DOCUMENT_ROOT'] . "/icns"); - foreach ($icons as $icon) { - if ($icon != "." && $icon != ".." && $icon != ".htaccess") { - echo("<img src='/icns/{$icon}' style='opacity:0;pointer-events:none;width:0;'>"); - } - } - - ?> - - <script src="/js/iframe.js"></script> - <script src="/js/navigation.js"></script> - <script src="/js/statusbar.js"></script> -</body> +<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/private/session.php";
+
+/** @var string $_FULLNAME
+ * @var string $_USER
+ * @var array $_PROFILE
+ * @var boolean $_ADMIN
+ * @var array $_CONFIG
+ */
+
+?>
+
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>Familine</title>
+ <link rel="icon" href="/favicon.svg">
+ <link rel="stylesheet" href="/styles.css">
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
+ <?= strpos($_SERVER['HTTP_USER_AGENT'], "+Familine/") !== false ? '<link rel="stylesheet" href="/native.css">' : "" ?>
+ <?= strpos($_SERVER['HTTP_USER_AGENT'], "+Familine/") !== false ? '<script>$ = require(\'jquery\');jQuery = require(\'jquery\');</script>' : '<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>' ?>
+ <style>
+ #statusbar {
+ background: linear-gradient(180deg, whitesmoke 0%, rgba(255,255,255,0) 100%) !important;
+ }
+
+ @media (prefers-color-scheme: dark) {
+ div#statusbar {
+ background: linear-gradient(180deg, rgba(34,34,34,1) 0%, rgba(255,255,255,0) 100%) !important;
+ }
+ }
+ </style>
+</head>
+<body>
+ <div class='progress' style="display:none;" id="progress_div">
+ <div class='bar' id='bar1'></div>
+ <div class='percent' id='percent1'></div>
+ </div>
+ <input type="hidden" id="progress_width" value="0">
+ <script src="/js/loading.js"></script>
+ <div id="loading">
+ <img src="/loader.svg" style="filter:invert(1);width:96px;">
+ </div>
+
+ <div id="explore-outer" style="margin-top: -32px;height: max-content;">
+ <div id="explore">
+ <div>
+ <img src="/favicon.svg" width="128px" height="128px">
+ <h1 style="color:white !important;font-size: 48px;">Familine</h1>
+ <div id="explore-list" class="container">
+ <a href="https://docs.<?= $_CONFIG["Global"]["domain"] ?>" class="explore-btn">
+ <img src="/icns/familine-docs.svg" width="48px" height="48px" style="height:32px;width:32px;margin: 0 5px;">
+ <span>Docs</span>
+ <span class="explore-description">Une encyclopédie de toutes les personnes de la famille</span>
+ </a>
+ <a href="https://support.<?= $_CONFIG["Global"]["domain"] ?>" class="explore-btn">
+ <img src="/icns/familine-help.svg" width="48px" height="48px" style="height:32px;width:32px;margin: 0 5px;">
+ <span>Help</span>
+ <span class="explore-description">Votre point d'accès à l'aide de Familine</span>
+ </a>
+ <a href="https://money.<?= $_CONFIG["Global"]["domain"] ?>" class="explore-btn">
+ <img src="/icns/familine-money.svg" width="48px" height="48px" style="height:32px;width:32px;margin: 0 5px;">
+ <span>Money</span>
+ <span class="explore-description">Compte bancaire interne pour la famille</span>
+ </a>
+ <a href="https://cinema.<?= $_CONFIG["Global"]["domain"] ?>" class="explore-btn">
+ <img src="/icns/familine-movies.svg" width="48px" height="48px" style="height:32px;width:32px;margin: 0 5px;">
+ <span>Movies</span>
+ <span class="explore-description">Regardez tous les films produits par la famille</span>
+ </a>
+ <a href="https://photos.<?= $_CONFIG["Global"]["domain"] ?>" class="explore-btn">
+ <img src="/icns/familine-photos.svg" width="48px" height="48px" style="height:32px;width:32px;margin: 0 5px;">
+ <span>Photos</span>
+ <span class="explore-description">Des photos de qualité par la famille</span>
+ </a>
+ <a href="https://genealogy.<?= $_CONFIG["Global"]["domain"] ?>" class="explore-btn">
+ <img src="/icns/familine-recall.svg" width="48px" height="48px" style="height:32px;width:32px;margin: 0 5px;">
+ <span>Recall</span>
+ <span class="explore-description">Un accès plus simple à la généalogie</span>
+ </a>
+ <a href="https://share.<?= $_CONFIG["Global"]["domain"] ?>" class="explore-btn">
+ <img src="/icns/familine-share.svg" width="48px" height="48px" style="height:32px;width:32px;margin: 0 5px;">
+ <span>Share</span>
+ <span class="explore-description">Partagez des fichiers avec qui vous voulez</span>
+ </a>
+ <a href="https://chat.<?= $_CONFIG["Global"]["domain"] ?>" class="explore-btn">
+ <img src="/icns/familine-you.svg" width="48px" height="48px" style="height:32px;width:32px;margin: 0 5px;">
+ <span>Yikes</span>
+ <span class="explore-description">Discuttez en toute sécurité avec la famille</span>
+ </a>
+ </div>
+ <div style="color: white;text-align: center;margin-top: 10px;opacity: .5;font-size: 14px;">
+ <?php if ($_ADMIN): ?><a style="color:white;display:inline-block;" href="https://console.familine.minteck.org">Familine Camera</a><?php endif; ?> · <a target="_blank" style="color:white;display:inline-block;" href="https://gitlab.minteck.org/explore/projects/topics/Familine">Code source</a> · version <?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/version.txt") ?>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <?php
+
+ $icons = scandir($_SERVER['DOCUMENT_ROOT'] . "/icns");
+ foreach ($icons as $icon) {
+ if ($icon != "." && $icon != ".." && $icon != ".htaccess") {
+ echo("<img src='/icns/{$icon}' style='opacity:0;pointer-events:none;width:0;'>");
+ }
+ }
+
+ ?>
+
+ <br>
+ <div class="container">
+ <h1><span id="home-greeting">Bienvenue</span> <?php $p = explode(" ", $_FULLNAME); array_shift($p); echo(implode(" ", $p)) ?></h1>
+ <script>
+ hours = new Date().getHours();
+ switch (hours) {
+ case 23:
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ document.getElementById("home-greeting").innerText = "Bonne nuit";
+ break;
+ case 5:
+ case 6:
+ case 7:
+ document.getElementById("home-greeting").innerText = "Bon matin";
+ break;
+ case 8:
+ case 9:
+ case 10:
+ case 11:
+ document.getElementById("home-greeting").innerText = "Bonne journée";
+ break;
+ case 12:
+ case 13:
+ document.getElementById("home-greeting").innerText = "Bon appétit";
+ break;
+ case 14:
+ case 15:
+ case 16:
+ case 17:
+ document.getElementById("home-greeting").innerText = "Bonne après-midi";
+ break;
+ case 18:
+ document.getElementById("home-greeting").innerText = "Bonne fin de journée";
+ break;
+ case 19:
+ case 20:
+ document.getElementById("home-greeting").innerText = "Bon appétit";
+ break;
+ case 21:
+ case 22:
+ document.getElementById("home-greeting").innerText = "Bonne soirée";
+ break;
+ }
+ </script>
+ <br>
+ </div>
+
+ <?php
+
+ exec('echo $(curl "http://127.0.0.1:444/index.php?title=Stats&action=render" 2>/dev/null)', $ret);
+ $docs = json_decode(trim(explode("</p>", explode("<p>", implode("\n", $ret))[1])[0]), true);
+
+ ?>
+ <div class="container">
+ <img src="/icns/familine-docs.svg" width="48px" height="48px" style="height:32px;width:32px;margin: 0 5px;"><?= $docs["articles"] ?> article<?= (int)$docs["articles"] > 1 ? "s" : "" ?>, <a href="https://docs.familine.minteck.org/index.php/<?php $p = explode(" ", $_FULLNAME); array_shift($p); echo(implode(" ", $p)) ?>_<?= ucwords(strtolower(explode(" ", $_FULLNAME)[0])) ?>">voir le votre</a>
+
+ <br>
+
+ <img src="/icns/familine-money.svg" width="48px" height="48px" style="height:32px;width:32px;margin: 0 5px;"><?php
+
+ $gcount = 0.0;
+ foreach (scandir($_SERVER['DOCUMENT_ROOT'] . "/app/money/public") as $file) {
+ if (is_file($_SERVER['DOCUMENT_ROOT'] . "/app/money/public/" . $file) && !is_link($_SERVER['DOCUMENT_ROOT'] . "/app/money/public/" . $file) && substr($file, -5) === ".json") {
+ $gcount += (float)json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/app/money/public/" . $file))->credit;
+ }
+ }
+
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/app/money/public/" . $_USER . ".json")) {
+ echo(number_format((float)json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/app/money/public/" . $_USER . ".json"))->credit, 2, ',', '') . "€");
+ } else {
+ echo("0,00€");
+ }
+
+ ?> (<?= str_replace(".", ",", round(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/app/money/public/" . $_USER . ".json"))->credit/$gcount*100, 2)) ?>% de tous les comptes), <a href="https://money.familine.minteck.org/credit">créditer</a>
+
+ <br>
+
+ <?php
+
+ $times = json_decode(file_get_contents("/mnt/faminema/data/durations.json"), true);
+
+ function id3time($file) {
+ $fparts = explode("/", $file);
+ $afile = $fparts[count($fparts) - 1];
+
+ global $times;
+ $date = (int)date('U');
+
+ return $times[$afile]["duration"];
+ }
+
+ function cmp_by_date($a, $b) {
+ return $a["date"] <=> $b["date"];
+ }
+
+ $list = scandir("/mnt/faminema/data/films/metadata");
+ $films = [];
+
+ foreach ($list as $item) {
+ if ($item !== "." && $item !== "..") {
+ $films[substr($item, 0, -5)] = json_decode(file_get_contents("/mnt/faminema/data/films/metadata/" . $item), true);
+ $films[substr($item, 0, -5)]["id"] = substr($item, 0, -5);
+ }
+ }
+
+ usort($films, function ($a, $b) {
+ return $a['date'] <=> $b['date'];
+ });
+
+ $films = array_reverse($films);
+
+ $seconds = 0;
+ foreach ($times as $titem => $tdata) {
+ if ($titem !== "@items") {
+ $seconds = $seconds + $tdata["seconds"];
+ }
+ }
+
+ $secstr = $seconds . " secondes";
+ if ($seconds > 60) {
+ $secstr = round($seconds / 60) . " minutes";
+ if ($seconds > 3600) {
+ $secstr = round($seconds / 3600) . " heures";
+ }
+ }
+
+ ?>
+
+ <img src="/icns/familine-movies.svg" width="48px" height="48px" style="height:32px;width:32px;margin: 0 5px;"><?= $secstr ?> de contenu, <a href="https://movies.familine.minteck.org/tv">regarder un film</a>
+
+ <br>
+
+ <?php
+
+ exec('curl "http://192.168.1.51:441/api.php?action=query&list=allpages&apnamespace=6&aplimit=500&format=json"', $ret2);
+ $photos = json_decode(implode("\n", $ret2), true);
+
+ $count = -1;
+ if (is_integer(count($photos["query"]["allpages"]))) {
+ $count = count($photos["query"]["allpages"]);
+ }
+
+ ?>
+ <img src="/icns/familine-photos.svg" width="48px" height="48px" style="height:32px;width:32px;margin: 0 5px;"><?= $count ?> photos, <a href="https://photos.familine.minteck.org/index.php?title=Spécial:Page_au_hasard">galerie aléatoire</a>
+
+ <br>
+
+ <img src="/icns/familine-recall.svg" width="48px" height="48px" style="height:32px;width:32px;margin: 0 5px;"><?= count(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/app/genealogy/private/data/people.json"), true)) ?> personnes, <a href="https://genealogy.familine.minteck.org/me">voir ma fiche</a>
+
+ <br>
+
+ <img src="/icns/familine-share.svg" width="48px" height="48px" style="height:32px;width:32px;margin: 0 5px;"><?php
+
+ function allfilessize() {
+ global $_USER;
+ $_CONF_USP = json_decode(file_get_contents("/mnt/famishare/private/profiles/" . $_USER . ".json"), true);
+
+ $size = 0;
+ foreach ($_CONF_USP['files'] as $file) {
+ $size = $size + $file['size'];
+ }
+ return $size;
+ }
+
+ if (file_exists("/mnt/famishare/private/profiles/" . $_USER . ".json")) {
+ $share = json_decode(file_get_contents("/mnt/famishare/private/profiles/" . $_USER . ".json"), true);
+ if (count($share["files"]) > 0) {
+ $used = allfilessize();
+ $total = 200000000;
+
+ $usedm = ($used/1000)/1000;
+ $totalm = ($total/1000)/1000;
+ $perc = ($used/$total)*100;
+
+ $usedmp = round(($used/1000)/1000, 2);
+ $totalmp = round(($total/1000)/1000, 2);
+ $percp = round(($used/$total)*100, 2);
+
+ echo($usedmp . " Mo/200 Mo");
+ } else {
+ echo("0 Mo/200 Mo");
+ }
+ } else {
+ echo("0 Mo/200 Mo");
+ }
+
+ ?> utilisés, <a href="https://share.familine.minteck.org/share">partager un fichier</a>
+
+ <br><br>
+
+ <h2>En ce moment...</h2>
+
+ </div>
+
+ <br>
+
+ <script src="/js/iframe.js"></script>
+ <script src="/js/navigation.js"></script>
+ <script src="/js/statusbar.js"></script>
+</body>
</html>
\ No newline at end of file |