aboutsummaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php237
1 files changed, 56 insertions, 181 deletions
diff --git a/index.php b/index.php
index bdd2445..b41879e 100644
--- a/index.php
+++ b/index.php
@@ -1,28 +1,4 @@
<?php
-/*
- * MIT License
- *
- * Copyright (c) 2022- Minteck
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- */
require_once $_SERVER['DOCUMENT_ROOT'] . "/private/session.php";
@@ -41,8 +17,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/private/session.php";
<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">
+ <link rel="icon" href="https://<?= $_CONFIG["Global"]["cdn"] ?>/favicon.svg">
<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>
@@ -50,17 +25,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/private/session.php";
<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>
+ <link rel="stylesheet" href="https://<?= $_CONFIG["Global"]["cdn"] ?>/styles.css">
</head>
<body>
<div class='progress' style="display:none;" id="progress_div">
@@ -78,6 +43,22 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/private/session.php";
<div>
<img src="/favicon.svg" width="128px" height="128px">
<h1 style="color:white !important;font-size: 48px;">Familine</h1>
+ <p style="color:white !important;">Familine soutient la population ukrainienne. <a href="/ukraine" style="color:white;">En savoir plus.</a><br>
+ <?php
+
+ $list = array_reverse(scandir($_SERVER["DOCUMENT_ROOT"] . "/private/news"));
+ foreach ($list as $paf) {
+ if (str_ends_with($paf, ".json")) {
+ $pa = json_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/private/news/" . $paf), true);
+ if ($pa["limited"] === null || in_array($_USER, $pa["limited"])) {
+ $article = $paf;
+ $data = $pa;
+ break;
+ }
+ }
+ }
+
+ ?><a href="/news/<?= substr($article, 0, -5) ?>" style="color:white;">En ce moment : <?= $data["title"] ?></a></p>
<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;">
@@ -89,21 +70,16 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/private/session.php";
<span>Aide</span>
<span class="explore-description">Votre point d'accès à l'aide de Familine</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>Films</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://planning.<?= $_CONFIG["Global"]["domain"] ?>" class="explore-btn">
- <img src="/icns/familine-planning.svg" width="48px" height="48px" style="height:32px;width:32px;margin: 0 5px;">
- <span>Planning</span>
- <span class="explore-description">Gérez vos présences et absences aux événements de Familine</span>
+ <a href="https://media.<?= $_CONFIG["Global"]["domain"] ?>" class="explore-btn">
+ <img src="/icns/familine-media.svg" width="48px" height="48px" style="height:32px;width:32px;margin: 0 5px;">
+ <span>Média</span>
+ <span class="explore-description">Musique, photos et vidéos de la famille au même endroit</span>
</a>
+<!-- <a href="https://planning.--><?//= $_CONFIG["Global"]["domain"] ?><!--" class="explore-btn">-->
+<!-- <img src="/icns/familine-planning.svg" width="48px" height="48px" style="height:32px;width:32px;margin: 0 5px;">-->
+<!-- <span>Planning</span>-->
+<!-- <span class="explore-description">Gérez vos présences et absences aux événements de Familine</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>Généalogie</span>
@@ -121,7 +97,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/private/session.php";
</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 style="color:white;display:inline-block;" href="https://familine.minteck.org/known">Problèmes connus</a> · <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") ?>
+ <?php if ($_ADMIN): ?><a style="color:white;display:inline-block;" href="https://console.familine.minteck.org">Familine Camera</a> · <?php endif; ?><a style="color:white;display:inline-block;" href="https://app.familine.minteck.org/known">Problèmes connus</a> · <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>
<br>
<br>
@@ -132,10 +108,10 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/private/session.php";
<?php
- $icons = scandir($_SERVER['DOCUMENT_ROOT'] . "/icns");
+ $icons = scandir($_SERVER['DOCUMENT_ROOT'] . "/icons");
foreach ($icons as $icon) {
if ($icon != "." && $icon != ".." && $icon != ".htaccess") {
- echo("<img src='/icns/{$icon}' style='opacity:0;pointer-events:none;width:0;'>");
+ echo("<img src='/icons/{$icon}' style='opacity:0;pointer-events:none;width:0;'>");
}
}
@@ -190,133 +166,16 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/private/session.php";
}
</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>
-
- <?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://cinema.familine.minteck.org/app/home">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>
+ <?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 if ($data["limited"] === null || in_array($_USER, $data["limited"])): ?>
+ <div class="jumbotron">
+ <h5><?= $data["date"] ?></h5>
+ <h3><?= $data["title"] ?></h3>
+ <p><?= $summary ?></p>
+ <a class="news-link" href="/news/<?= substr($article, 0, -5) ?>">En lire plus...</a>
+ </div>
+ <?php endif; endif; endforeach; ?>
</div>
@@ -325,5 +184,21 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/private/session.php";
<script src="/js/iframe.js"></script>
<script src="/js/navigation.js"></script>
<script src="/js/statusbar.js"></script>
+ <script>
+ function openNews(news) {
+ document.getElementById("news_internal-" + news + "-open").style.display = "none";
+ document.getElementById("news_internal-" + news + "-close").style.display = "";
+ document.getElementById("news_internal-" + news).open = true;
+ }
+
+ function closeNews(news) {
+ document.getElementById("news_internal-" + news + "-close").style.display = "none";
+ document.getElementById("news_internal-" + news + "-open").style.display = "";
+ document.getElementById("news_internal-" + news).open = false;
+ }
+ </script>
+ <style>
+ summary { display: none; }
+ </style>
</body>
</html>