Updated 15 files and added 6 files (automated)

mane
Mia Raindrops 4 weeks ago
parent d23fe2e21d
commit 30c7a27273
Signed by: Mia Raindrops
GPG Key ID: EFBDC68435A574B7

@ -66,17 +66,17 @@ if (!isset($id)):
<div style="display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 20px;">
<div>
<?php $index = 1; foreach ($data["images"] as $image): if ($index % 3 === 1): ?>
<a href="#" onclick="showGalleryItem(<?= $index ?>);"><img id="gallery-item-<?= $index ?>" title="<?= l("lang_gallery_uploader") . " " . resolveUser($image["author"]) . " " . timeAgo($image["date"]) ?>" src="/uploads/<?= $image["id"] ?>.jpg" style="width: 100%; margin-top: 20px; border-radius: 10px;" data-bs-toggle="tooltip"></a>
<a href="#" onclick="showGalleryItem(<?= $index ?>);"><img id="gallery-item-<?= $index ?>" title="<?= l("lang_gallery_uploader") . " " . resolveUser($image["author"]) . " " . timeAgo($image["date"]) ?>" src="/uploads/<?= $image["id"] ?>.webp" style="width: 100%; margin-top: 20px; border-radius: 10px;" data-bs-toggle="tooltip"></a>
<?php endif; $index++; endforeach; ?>
</div>
<div>
<?php $index = 1; foreach ($data["images"] as $image): if ($index % 3 === 2): ?>
<a href="#" onclick="showGalleryItem(<?= $index ?>);"><img id="gallery-item-<?= $index ?>" title="<?= l("lang_gallery_uploader") . " " . resolveUser($image["author"]) . " " . timeAgo($image["date"]) ?>" src="/uploads/<?= $image["id"] ?>.jpg" style="width: 100%; margin-top: 20px; border-radius: 10px;" data-bs-toggle="tooltip"></a>
<a href="#" onclick="showGalleryItem(<?= $index ?>);"><img id="gallery-item-<?= $index ?>" title="<?= l("lang_gallery_uploader") . " " . resolveUser($image["author"]) . " " . timeAgo($image["date"]) ?>" src="/uploads/<?= $image["id"] ?>.webp" style="width: 100%; margin-top: 20px; border-radius: 10px;" data-bs-toggle="tooltip"></a>
<?php endif; $index++; endforeach; ?>
</div>
<div>
<?php $index = 1; foreach ($data["images"] as $image): if ($index % 3 === 0): ?>
<a href="#" onclick="showGalleryItem(<?= $index ?>);"><img id="gallery-item-<?= $index ?>" title="<?= l("lang_gallery_uploader") . " " . resolveUser($image["author"]) . " " . timeAgo($image["date"]) ?>" src="/uploads/<?= $image["id"] ?>.jpg" style="width: 100%; margin-top: 20px; border-radius: 10px;" data-bs-toggle="tooltip"></a>
<a href="#" onclick="showGalleryItem(<?= $index ?>);"><img id="gallery-item-<?= $index ?>" title="<?= l("lang_gallery_uploader") . " " . resolveUser($image["author"]) . " " . timeAgo($image["date"]) ?>" src="/uploads/<?= $image["id"] ?>.webp" style="width: 100%; margin-top: 20px; border-radius: 10px;" data-bs-toggle="tooltip"></a>
<?php endif; $index++; endforeach; ?>
</div>
</div>

@ -69,7 +69,7 @@ if (!isset($id)):
<div class="card">
<div class="card-body">
<h5 style="text-align: center;"><?= $data["first_name"] . " " . $data["last_name"] ?></h5>
<img src="<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $id . ".jpg") ? "/uploads/" . $id . ".jpg" : "/icons/defaultpage.svg" ?>" style="width: 100%;">
<img src="<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $id . ".webp") ? "/uploads/" . $id . ".webp" : "/icons/defaultpage.svg" ?>" style="width: 100%;">
<hr>
<div style="display: grid; grid-template-columns: 50% 50%; grid-column-gap: 10px; grid-row-gap: 5px;">
<?php if (isset($data["state"])): ?>

@ -102,7 +102,7 @@ foreach (array_filter(scandir($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people
<div id="profile-grid-user" style="display: grid; grid-template-columns: <?= hasProfileSetting("photo", true) ? "64px max-content" : "1fr" ?>; grid-gap: 10px;">
<?php if (hasProfileSetting("photo", true)): ?>
<div style="display: flex; align-items: center;">
<img src="<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $id . ".jpg") ? "/uploads/" . $id . ".jpg" : "/icons/defaultuser.svg" ?>" style="width: 64px; height: 64px; border-radius: 100%;">
<img src="<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $id . ".webp") ? "/uploads/" . $id . ".webp" : "/icons/defaultuser.svg" ?>" style="width: 64px; height: 64px; border-radius: 100%;">
</div>
<?php endif; ?>
<table>

@ -54,7 +54,23 @@ switch ($_FILES["file"]["type"]) {
break;
}
imagejpeg($im, $_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $uuid . ".jpg");
imagewebp($im, $_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $uuid . ".webp");
$size = getimagesize($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $uuid . ".webp");
$ratio_orig = $size[0] / $size[1];
$width = 1080;
$height = 1080;
if ($width / $height > $ratio_orig) {
$width = $height * $ratio_orig;
} else {
$height = $width / $ratio_orig;
}
if ($size[0] > 1080 || $size[1] > 1080) {
imagescale($im, $width, $height);
imagewebp($im, $_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $uuid . ".webp");
}
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $uuid . ".json", pf_utf8_encode(json_encode([
"type" => "galleryupload",

@ -41,8 +41,8 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $reques
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json", pf_utf8_encode(json_encode($profile, JSON_PRETTY_PRINT)));
}
if ($request["type"] === "galleryupload" && file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $id . ".jpg")) {
rename($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $id . ".jpg", $_SERVER['DOCUMENT_ROOT'] . "/includes/data/olduploads/" . $id . ".jpg");
if ($request["type"] === "galleryupload" && file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $id . ".webp")) {
rename($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $id . ".webp", $_SERVER['DOCUMENT_ROOT'] . "/includes/data/olduploads/" . $id . ".webp");
}
rename($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $id . ".json", $_SERVER['DOCUMENT_ROOT'] . "/includes/data/archive/" . $id . ".json");

@ -74,7 +74,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/navigation.php";
</details>
<?php if ($request["type"] === "galleryupload"): ?>
<p><img src="/uploads/<?= $request["_id"] ?>.jpg" style="max-width: 30vw; max-height: 30vh;"></p>
<p><img src="/uploads/<?= $request["_id"] ?>.webp" style="max-width: 30vw; max-height: 30vh;"></p>
<?php elseif(isset($request["contents"]) && trim($request["contents"]) !== ""): ?>
<div style="max-height: 300px; overflow: auto; background-color: rgba(0, 0, 0, .25); padding: 5px 10px; border-radius: 10px; margin-bottom: 20px;">
<?= $request["contents"] ?>

@ -55,8 +55,8 @@ foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/reques
file_put_contents("$name2/$name4/" . $file, json_encode($data, JSON_PRETTY_PRINT));
}
if ($data["type"] === "galleryupload" && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/olduploads/" . $id . ".jpg")) {
file_put_contents("$name3/$name6/" . $id . ".jpg", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $id . ".jpg"));
if ($data["type"] === "galleryupload" && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/olduploads/" . $id . ".webp")) {
file_put_contents("$name3/$name6/" . $id . ".webp", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $id . ".webp"));
}
}
@ -68,8 +68,8 @@ foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/archiv
file_put_contents("$name2/$name5/" . $file, json_encode($data, JSON_PRETTY_PRINT));
}
if ($data["type"] === "galleryupload" && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/olduploads/" . $id . ".jpg")) {
file_put_contents("$name3/$name7/" . $id . ".jpg", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/olduploads/" . $id . ".jpg"));
if ($data["type"] === "galleryupload" && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/olduploads/" . $id . ".webp")) {
file_put_contents("$name3/$name7/" . $id . ".webp", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/olduploads/" . $id . ".webp"));
}
}
@ -81,22 +81,22 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history/" . $_USER .
file_put_contents("$name1/$name8.json", "{}");
}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $_USER . ".jpg")) {
file_put_contents("$name1/$name10.jpg", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $_USER . ".jpg"));
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $_USER . ".webp")) {
file_put_contents("$name1/$name10.webp", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $_USER . ".webp"));
} else {
file_put_contents("$name1/$name10.jpg", "");
file_put_contents("$name1/$name10.webp", "");
}
$list = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/embeds.json")), true);
foreach ($list as $item) {
if ($item["author"] === $_USER) {
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $item["id"] . ".jpg")) {
file_put_contents("$name11/$name6/$item[id].jpg", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $item["id"] . ".jpg"));
} elseif (file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/archive/" . $item["id"] . ".jpg")) {
file_put_contents("$name11/$name7/$item[id].jpg", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/uploads/archive/" . $item["id"] . ".jpg"));
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $item["id"] . ".webp")) {
file_put_contents("$name11/$name6/$item[id].webp", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $item["id"] . ".webp"));
} elseif (file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/archive/" . $item["id"] . ".webp")) {
file_put_contents("$name11/$name7/$item[id].webp", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/uploads/archive/" . $item["id"] . ".webp"));
} else {
file_put_contents("$name11/$name7/$item[id].jpg", "");
file_put_contents("$name11/$name7/$item[id].webp", "");
}
}
}

@ -61,20 +61,36 @@ switch ($_FILES["upload"]["type"]) {
break;
}
imagejpeg($im, $_SERVER['DOCUMENT_ROOT'] . "/uploads/temp-" . $uuid . ".jpg");
imagewebp($im, $_SERVER['DOCUMENT_ROOT'] . "/uploads/temp-" . $uuid . ".webp");
$size = getimagesize($_SERVER['DOCUMENT_ROOT'] . "/uploads/temp-" . $uuid . ".webp");
$ratio_orig = $size[0] / $size[1];
$width = 1080;
$height = 1080;
if ($width / $height > $ratio_orig) {
$width = $height * $ratio_orig;
} else {
$height = $width / $ratio_orig;
}
if ($size[0] > 1080 || $size[1] > 1080) {
imagescale($im, $width, $height);
imagewebp($im, $_SERVER['DOCUMENT_ROOT'] . "/uploads/temp-" . $uuid . ".webp");
}
$list = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/embeds.json")), true);
foreach ($list as $item) {
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $item["id"] . ".jpg") && file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/uploads/temp-" . $uuid . ".jpg") === file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $item["id"] . ".jpg")) {
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $item["id"] . ".webp") && file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/uploads/temp-" . $uuid . ".webp") === file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $item["id"] . ".webp")) {
$uuid = $item["id"];
unlink($_SERVER['DOCUMENT_ROOT'] . "/uploads/temp-" . $uuid . ".jpg");
} elseif (file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/archive/" . $item["id"] . ".jpg") && file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/uploads/temp-" . $uuid . ".jpg") === file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/uploads/archive/" . $item["id"] . ".jpg")) {
unlink($_SERVER['DOCUMENT_ROOT'] . "/uploads/temp-" . $uuid . ".webp");
} elseif (file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/archive/" . $item["id"] . ".webp") && file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/uploads/temp-" . $uuid . ".webp") === file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/uploads/archive/" . $item["id"] . ".webp")) {
$uuid = $item["id"];
unlink($_SERVER['DOCUMENT_ROOT'] . "/uploads/temp-" . $uuid . ".jpg");
rename($_SERVER['DOCUMENT_ROOT'] . "/uploads/archive/" . $item["id"] . ".jpg", $_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $item["id"] . ".jpg");
unlink($_SERVER['DOCUMENT_ROOT'] . "/uploads/temp-" . $uuid . ".webp");
rename($_SERVER['DOCUMENT_ROOT'] . "/uploads/archive/" . $item["id"] . ".webp", $_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $item["id"] . ".web");
} else {
rename($_SERVER['DOCUMENT_ROOT'] . "/uploads/temp-" . $uuid . ".jpg", $_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $uuid . ".jpg");
rename($_SERVER['DOCUMENT_ROOT'] . "/uploads/temp-" . $uuid . ".webp", $_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $uuid . ".web");
$list[] = [
"id" => $uuid,
@ -86,5 +102,5 @@ foreach ($list as $item) {
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/embeds.json", pf_utf8_encode(json_encode($list)));
die(json_encode([
"url" => "/uploads/" . $uuid . ".jpg"
"url" => "/uploads/" . $uuid . ".webp"
]));

@ -87,17 +87,17 @@ if (isset($_GET["token"])) {
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $_USER; global $_PROFILE;
if ($data["loggedIn"] && file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $_USER . ".jpg")) {
if ($data["loggedIn"] && file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $_USER . ".webp")) {
header("Content-Type: image/png");
$id = bin2hex(random_bytes(32));
$out = [];
$out2 = [];
$size = getimagesize($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $_USER . ".jpg");
$size = getimagesize($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $_USER . ".webp");
exec('convert -size 128x128 xc:none -draw "roundrectangle 0,0,128,128,128,128" /tmp/' . $id . '-mask.png', $out);
exec('convert -resize 128x128 "' . $_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $_USER . ".jpg" . '" /tmp/' . $id . '-source.png');
exec('convert -resize 128x128 "' . $_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $_USER . ".webp" . '" /tmp/' . $id . '-source.png');
exec('convert /tmp/' . $id . '-source.png -matte /tmp/' . $id . '-mask.png -compose DstIn -composite /tmp/' . $id . '.png', $out2);
if ($_PROFILE["plus"]) {

@ -6,6 +6,7 @@ $obj = json_decode($json, true);
header("Content-Type: application/json");
$data = [
"loggedIn" => false,
"admin" => false,
"subscription" => "base",
"blocked" => false,
"session" => $_COOKIE["DeltaSession"] ?? (isset($obj["session"]) && trim($obj["session"]) !== "" ? $obj["session"] : null),
@ -27,6 +28,8 @@ if (isset($_PROFILE)) {
$data["subscription"] = "plus";
}
$admin = $_PROFILE["admin"] ?? false;
$data["name"] = $_PROFILE["nick_name"] ?? $_PROFILE["first_name"] . " " . $_PROFILE["last_name"];
}

@ -0,0 +1,8 @@
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.php";
initLang();
global $_PROFILE; global $_USER;
?>

@ -0,0 +1,26 @@
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.php";
initLang();
global $_PROFILE; global $_USER;
$birthdays = array_values(array_filter(array_map(function ($i) {
$r = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/$i")), true);
$r["_id"] = substr($i, 0, -5);
return $r;
}, array_values(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles"), function ($i) { return str_ends_with($i, ".json"); }))), function ($i) {
return hasProfileSetting("birth", true, $i) && substr($i["birth"], 5) === date('m-d');
}));
if (count($birthdays) > 0): ?>
<div class="alert alert-primary">
<img class="icon" src="/icons/age-home.svg"><span style="vertical-align: middle; margin-left: 5px;"><?= str_replace("%1", enumerate(array_map(function ($i) {
return str_replace("%1", "<a href='/profile/" . $i["_id"] . "'>" . ($i["nick_name"] ?? $i["first_name"]) . "</a>", l("lang_home_name"));
}, $birthdays), l("lang_home_and")), l("lang_home_birthday")) ?></span>
</div>
<?php else: ?>
<div class="alert alert-secondary">
<img class="icon" src="/icons/events.svg"><span style="vertical-align: middle; margin-left: 5px;"><?= str_replace("%1", formatDate(time()), l("lang_home_date")) ?></span>
</div>
<?php endif; ?>

@ -0,0 +1,22 @@
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.php";
initLang();
global $_PROFILE; global $_USER;
?>
<?php $results = array_values(array_filter(search($_PROFILE["first_name"] . " " . $_PROFILE["last_name"], true, true), function ($i) use ($_PROFILE) { return str_ends_with($i["value"]["name"], " " . $_PROFILE["last_name"]); })); if (count($results)): ?>
<h3 style="margin-bottom: 15px; margin-top: 30px;"><?= l("lang_home_family") ?></h3>
<div class="list-group">
<?php $index = 0; foreach ($results as $entry): if ($index <= 4): ?>
<a href="<?= $entry["value"]["url"] ?>" class="list-group-item-action list-group-item">
<p style="margin-bottom:.5rem;">
<img class="icon" src="/icons/<?= $entry["value"]["type"] ?>.svg" style="margin-right:5px;"><b style="vertical-align: middle;"><?= $entry["value"]["name"] ?></b>
</p>
<span><?= trim($entry["value"]["extract"]) !== "" ? substr(trim($entry["value"]["extract"]), 0, 150) . (strlen(trim($entry["value"]["extract"])) > 150 ? "…" : "") : $entry["value"]["name"] ?></span>
</a>
<?php $index++; endif; endforeach; ?>
</div>
<?php endif; ?>

@ -0,0 +1,35 @@
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.php";
initLang();
global $_PROFILE; global $_USER;
?>
<?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history/" . $_USER . ".json")):
$history = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history/" . $_USER . ".json")), true);
if (count(array_keys($history)) > 0):
uasort($history, function ($a, $b) { return $b - $a; });
$top = array_keys($history)[rand(0, count($history) >= 3 ? 2 : count($history) - 1)];
$topName = getNameFromId($top);
if (count(search($topName, true)) > 0):
?>
<h3 style="margin-bottom: 15px; margin-top: 30px;"><?= str_replace("%1", $topName, l("lang_home_because")) ?></h3>
<div class="list-group">
<?php $index = 0; foreach (search($topName, true) as $entry): if ($index <= 4): ?>
<a href="<?= $entry["value"]["url"] ?>" class="list-group-item-action list-group-item">
<p style="margin-bottom:.5rem;">
<img class="icon" src="/icons/<?= $entry["value"]["type"] ?>.svg" style="margin-right:5px;"><b style="vertical-align: middle;"><?= $entry["value"]["name"] ?></b>
</p>
<span><?= trim($entry["value"]["extract"]) !== "" ? substr(trim($entry["value"]["extract"]), 0, 150) . (strlen(trim($entry["value"]["extract"])) > 150 ? "…" : "") : $entry["value"]["name"] ?></span>
</a>
<?php $index++; endif; endforeach; ?>
</div>
<?php endif; endif; endif; ?>

@ -0,0 +1,62 @@
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.php";
initLang();
global $_PROFILE; global $_USER;
function showPage($item) { ?>
<a href="/<?= $item["_type"] ?>/<?= $item["_id"] ?>" class="list-group-item list-group-item-action">
<p style="margin-bottom: 10px;"><img class="icon" src="/icons/<?= $item["_type"] ?>.svg" style="margin-right:5px;"><span style="vertical-align: middle;"><b><?= getNameFromId($item["_id"]) ?></b> <?= l("lang_home_update") ?> <b><?= timeAgo($item["update"]) ?></b></span></p><?= trim(strip_tags($item["contents"])) !== "" ? substr(trim(strip_tags($item["contents"])), 0, 150) . (strlen(trim(strip_tags($item["contents"]))) > 150 ? "…" : "") : "-" ?>
</a>
<?php } ?>
<h3 style="margin-bottom: 15px; margin-top: 30px;"><?= l("lang_home_recent") ?></h3>
<div class="list-group">
<?php
$list = [];
foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/articles"), function ($i) { return !str_starts_with($i, "."); }) as $id) {
$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/articles/$id")), true);
$id = substr($id, 0, -5);
$data["_type"] = "articles";
$data["_id"] = $id;
$list[$id] = $data;
}
foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery"), function ($i) { return !str_starts_with($i, "."); }) as $id) {
$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/$id")), true);
$id = substr($id, 0, -5);
$data["_type"] = "gallery";
$data["_id"] = $id;
$list[$id] = $data;
}
foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people"), function ($i) { return !str_starts_with($i, "."); }) as $id) {
$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/$id")), true);
$id = substr($id, 0, -5);
$data["_type"] = "people";
$data["_id"] = $id;
$list[$id] = $data;
}
uasort($list, function ($a, $b) {
return strtotime($a["update"]) - strtotime($b["update"]);
});
$list = array_reverse($list);
$index = 0; foreach ($list as $item): if ($index <= 4): ?>
<?php showPage($item); ?>
<?php $index++; endif; endforeach; ?>
</div>

@ -0,0 +1,7 @@
#!/bin/bash
cd /app/uploads
for i in *.jpg; do
echo $i
convert -resize "1080x1080>" -quality 75 $i $(basename $i .jpg).webp
done

@ -73,6 +73,9 @@ if (isset($_GET["__"])) {
<!doctype html>
<html lang="en">
<head>
<link rel="preload" as="font" href="/title.ttf">
<link rel="preload" as="font" href="/font-italic.ttf">
<link rel="preload" as="font" href="/font-regular.ttf">
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
@ -350,6 +353,41 @@ if (isset($_GET["__"])) {
}
}
.spinner {
animation: rotator 1.1s linear infinite;
}
@keyframes rotator {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(270deg);
}
}
.path {
stroke-dasharray: 187;
stroke-dashoffset: 0;
transform-origin: center;
stroke: var(--bs-link-color);
animation: dash 1.1s ease-in-out infinite;
}
@keyframes dash {
0% {
stroke-dashoffset: 187;
}
50% {
stroke-dashoffset: 46.75;
transform: rotate(135deg);
}
100% {
stroke-dashoffset: 187;
transform: rotate(450deg);
}
}
@media (max-width: 767px) {
#profile-grid, #profile-grid-2 {
grid-template-columns: 1fr !important;
@ -432,23 +470,21 @@ if (isset($_GET["__"])) {
@font-face {
src: url("/title.ttf");
font-family: "Josefin Sans";
font-display: swap;
}
@font-face {
src: url("/font-regular.ttf");
font-family: "Nunito";
font-style: normal;
font-display: swap;
}
@font-face {
src: url("/font-italic.ttf");
font-family: "Nunito";
font-style: italic;
}
@font-face {
src: url("/title.ttf");
font-family: "Josefin Sans";
font-display: swap;
}
.newnav-link:hover {

@ -97,7 +97,7 @@
</div>
<div style="background-color: var(--bs-light); padding: 10px;">
<div class="dropdown" style="display:inline-block;">
<span class="user-nav nav-link no-opacity" data-bs-toggle="dropdown"><div style="margin-top: <?= $_PROFILE["plus"] ? "0" : "2px" ?>;" class="profile-border <?= $_PROFILE["ultra"] ? "profile-border-ultra" : ($_PROFILE["plus"] ? "profile-border-plus" : "") ?>"><div class="profile-border-inner <?= $_PROFILE["plus"] ? "profile-border-inner-active" : "" ?>"><img src="<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $_USER . ".jpg") ? "/uploads/" . $_USER . ".jpg" : "/icons/defaultuser.svg" ?>" style="width: 32px;border-radius: 999px;"></div></div></span>
<span class="user-nav nav-link no-opacity" data-bs-toggle="dropdown"><div style="margin-top: <?= $_PROFILE["plus"] ? "0" : "2px" ?>;" class="profile-border <?= $_PROFILE["ultra"] ? "profile-border-ultra" : ($_PROFILE["plus"] ? "profile-border-plus" : "") ?>"><div class="profile-border-inner <?= $_PROFILE["plus"] ? "profile-border-inner-active" : "" ?>"><img src="<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $_USER . ".webp") ? "/uploads/" . $_USER . ".jpg" : "/icons/defaultuser.svg" ?>" style="width: 32px;border-radius: 999px;"></div></div></span>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="/">

@ -6,13 +6,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/header.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/navigation.php";
global $_PROFILE; global $_USER;
function showPage($item) { ?>
<a href="/<?= $item["_type"] ?>/<?= $item["_id"] ?>" class="list-group-item list-group-item-action">
<p style="margin-bottom: 10px;"><img class="icon" src="/icons/<?= $item["_type"] ?>.svg" style="margin-right:5px;"><span style="vertical-align: middle;"><b><?= getNameFromId($item["_id"]) ?></b> <?= l("lang_home_update") ?> <b><?= timeAgo($item["update"]) ?></b></span></p><?= trim(strip_tags($item["contents"])) !== "" ? substr(trim(strip_tags($item["contents"])), 0, 150) . (strlen(trim(strip_tags($item["contents"]))) > 150 ? "…" : "") : "-" ?>
</a>
<?php } ?>
?>
<div class="container">
<br><br>
@ -41,120 +35,53 @@ function showPage($item) { ?>
<b>Vous utilisez une version expérimentale de Delta.</b> Attendez-vous à rencontrer des bugs et autres problèmes importants. Dans tous les cas, vous pouvez <a href="/support">contacter le support technique</a> pour les signaler.
</div>
<?php
$birthdays = array_values(array_filter(array_map(function ($i) {
$r = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/$i")), true);
$r["_id"] = substr($i, 0, -5);
return $r;
}, array_values(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles"), function ($i) { return str_ends_with($i, ".json"); }))), function ($i) {
return hasProfileSetting("birth", true, $i) && substr($i["birth"], 5) === date('m-d');
}));
?>
<?php if (count($birthdays) > 0): ?>
<div class="alert alert-primary">
<img class="icon" src="/icons/age-home.svg"><span style="vertical-align: middle; margin-left: 5px;"><?= str_replace("%1", enumerate(array_map(function ($i) {
return str_replace("%1", "<a href='/profile/" . $i["_id"] . "'>" . ($i["nick_name"] ?? $i["first_name"]) . "</a>", l("lang_home_name"));
}, $birthdays), l("lang_home_and")), l("lang_home_birthday")) ?></span>
</div>
<?php else: ?>
<div class="alert alert-secondary">
<img class="icon" src="/icons/events.svg"><span style="vertical-align: middle; margin-left: 5px;"><?= str_replace("%1", formatDate(time()), l("lang_home_date")) ?></span>
</div>
<?php endif; ?>
<?php $results = array_values(array_filter(search($_PROFILE["first_name"] . " " . $_PROFILE["last_name"], true, true), function ($i) use ($_PROFILE) { return str_ends_with($i["value"]["name"], " " . $_PROFILE["last_name"]); })); if (count($results)): ?>
<h3 style="margin-bottom: 15px; margin-top: 30px;"><?= l("lang_home_family") ?></h3>
<div class="list-group">
<?php $index = 0; foreach ($results as $entry): if ($index <= 4): ?>
<a href="<?= $entry["value"]["url"] ?>" class="list-group-item-action list-group-item">
<p style="margin-bottom:.5rem;">
<img class="icon" src="/icons/<?= $entry["value"]["type"] ?>.svg" style="margin-right:5px;"><b style="vertical-align: middle;"><?= $entry["value"]["name"] ?></b>
</p>
<span><?= trim($entry["value"]["extract"]) !== "" ? substr(trim($entry["value"]["extract"]), 0, 150) . (strlen(trim($entry["value"]["extract"])) > 150 ? "…" : "") : $entry["value"]["name"] ?></span>
</a>
<?php $index++; endif; endforeach; ?>
</div>
<?php endif; ?>
<?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history/" . $_USER . ".json")):
$history = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history/" . $_USER . ".json")), true);
<div id="homepage-content"></div>
if (count(array_keys($history)) > 0):
uasort($history, function ($a, $b) { return $b - $a; });
$top = array_keys($history)[rand(0, count($history) >= 3 ? 2 : count($history) - 1)];
$topName = getNameFromId($top);
if (count(search($topName, true)) > 0):
?>
<h3 style="margin-bottom: 15px; margin-top: 30px;"><?= str_replace("%1", $topName, l("lang_home_because")) ?></h3>
<div class="list-group">
<?php $index = 0; foreach (search($topName, true) as $entry): if ($index <= 4): ?>
<a href="<?= $entry["value"]["url"] ?>" class="list-group-item-action list-group-item">
<p style="margin-bottom:.5rem;">
<img class="icon" src="/icons/<?= $entry["value"]["type"] ?>.svg" style="margin-right:5px;"><b style="vertical-align: middle;"><?= $entry["value"]["name"] ?></b>
</p>
<span><?= trim($entry["value"]["extract"]) !== "" ? substr(trim($entry["value"]["extract"]), 0, 150) . (strlen(trim($entry["value"]["extract"])) > 150 ? "…" : "") : $entry["value"]["name"] ?></span>
</a>
<?php $index++; endif; endforeach; ?>
<div style="display: flex; align-items: center; justify-content: center; margin-top: 30px;" id="homepage-loader">
<svg class="spinner" width="32px" height="32px" viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg">
<circle class="path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle>
</svg>
</div>
<?php endif; endif; endif; ?>
<h3 style="margin-bottom: 15px; margin-top: 30px;"><?= l("lang_home_recent") ?></h3>
<div class="list-group">
<?php
$list = [];
foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/articles"), function ($i) { return !str_starts_with($i, "."); }) as $id) {
$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/articles/$id")), true);
$id = substr($id, 0, -5);
$data["_type"] = "articles";
$data["_id"] = $id;
$list[$id] = $data;
}
foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery"), function ($i) { return !str_starts_with($i, "."); }) as $id) {
$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/$id")), true);
$id = substr($id, 0, -5);
$data["_type"] = "gallery";
$data["_id"] = $id;
$list[$id] = $data;
}
foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people"), function ($i) { return !str_starts_with($i, "."); }) as $id) {
$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/$id")), true);
$id = substr($id, 0, -5);
$data["_type"] = "people";
$data["_id"] = $id;
<br><br><br>
$list[$id] = $data;
<script>
window.list = [
"birthday.php",
"family.php",
"history.php",
"recent.php"
];
function nextItem() {
let item = list[0];
try {
window.fetch("/home/" + item).then((res) => {
res.text().then((data) => {
document.getElementById("homepage-content").innerHTML += data;
list.shift();
if (list.length > 0) {
nextItem();
} else {
document.getElementById("homepage-loader").style.display = "none";
}
});
})
} catch (e) {
list.shift();
if (list.length > 0) {
nextItem();
} else {
document.getElementById("homepage-loader").style.display = "none";
}
}
}
uasort($list, function ($a, $b) {
return strtotime($a["update"]) - strtotime($b["update"]);
window.addEventListener("load", () => {
nextItem();
});
$list = array_reverse($list);
$index = 0; foreach ($list as $item): if ($index <= 4): ?>
<?php showPage($item); ?>
<?php $index++; endif; endforeach; ?>
</div>
<br><br><br>
</script>
</div>
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/footer.php"; ?>

@ -44,7 +44,7 @@ global $palette;
new QRCode(document.getElementById("qrcode"), "<?= $tag ?>");
</script>
<?php if (isset($_PROFILE["organizer"])): ?>
<?php if (isset($_PROFILE["organizer"]) && !isset($_COOKIE["DeltaHandoffPalette"])): ?>
<div style="margin-top: 10px;">
<a href="/pass/scan"><?= l("lang_pass_scan") ?></a>
</div>

@ -6,7 +6,13 @@ if (!isset($_GET['_'])) die();
$name = preg_replace("/[\/]/m", "", $_GET['_']);
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $name) && is_file($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $name)) {
if (str_ends_with($name, ".jpg") && file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . substr($name, 0, -4) . ".webp") && is_file($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . substr($name, 0, -4) . ".webp")) {
header("Cache-Control: max-age=31536000");
header("Content-Type: " . mime_content_type($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . substr($name, 0, -4) . ".webp"));
header("Content-Length: " . filesize($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . substr($name, 0, -4) . ".webp"));
readfile($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . substr($name, 0, -4) . ".webp");
} elseif (file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $name) && is_file($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $name)) {
header("Cache-Control: max-age=31536000");
header("Content-Type: " . mime_content_type($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $name));
header("Content-Length: " . filesize($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $name));
readfile($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $name);

Loading…
Cancel
Save