Updated 22 files, added 9 files and deleted upload/index.php (automated)

mane
Mia Raindrops 1 month ago
parent af4145a296
commit 21b1d34b71
Signed by: Mia Raindrops
GPG Key ID: EFBDC68435A574B7

@ -1,6 +1,7 @@
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php";
$id = array_values(array_filter(array_keys($_GET), function ($i) {
return str_starts_with($i, "/") && strlen($i) > 1;
@ -26,7 +27,6 @@ if (isset($id)) {
$title = "lang_articles_title";
}
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/header.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/navigation.php";
@ -48,9 +48,9 @@ if (!isset($id)):
<div class="container">
<br><br>
<h1>
<h1 id="btn-area-container" style="display: grid; grid-template-columns: 1fr max-content;">
<span><?= getNameFromId($id) ?></span>
<span id="btn-area" style="float: right;"><a href="/request/?type=rename&id=<?= $id ?>" class="btn btn-outline-dark"><?= l("lang_articles_rename") ?></a> <a href="/edit/<?= $id ?>" class="btn btn-outline-dark"><?= l("lang_people_edit") ?></a></span>
<span id="btn-area" class="btn-group"><a style="height: 38px;" href="/request/?type=rename&id=<?= $id ?>" class="btn btn-outline-dark btn-with-img" title="<?= l("lang_articles_rename") ?>" data-bs-toggle="tooltip"><img src="/icons/rename.svg" style="width: 24px;"></a><a style="height: 38px;" href="/edit/<?= $id ?>" class="btn btn-outline-dark btn-with-img" title="<?= l("lang_people_edit") ?>" data-bs-toggle="tooltip"><img src="/icons/edit.svg" style="width: 24px;"></a><a style="height: 38px;" onclick="copy('<?= uuidToId($id) ?>', true)" class="btn btn-outline-dark btn-with-img" title="<?= l("lang_shortener_copy") ?>" data-bs-toggle="tooltip"><img src="/icons/copy.svg" style="width: 24px;"></a></span>
</h1>
<div>

@ -50,15 +50,13 @@ if (!isset($_PROFILE["requests"][$id])):
<form method="post" action="/_edit/save/?id=<?= $id ?>" id="main-form">
<div class="container">
<br><br>
<h1>
<h1 id="btn-area-container" style="display: grid; grid-template-columns: 1fr max-content;">
<?php if ($id !== $_USER): ?>
<span><?= getNameFromId($id) ?></span>
<span id="btn-area" style="float: right;"><input id="form-btn" type="button" value="<?= l("lang_edit_save") ?>" class="btn btn-outline-primary" <?= $_PROFILE["blocked"] >= 2 ? "disabled" : "" ?>> <a href="/<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/" . $id . ".json") ? "people" : "articles" ?>/<?= $id ?>" class="btn btn-outline-dark"><?= l("lang_edit_cancel") ?></a></span>
<?php else: ?>
<span><?= $data["nick_name"] ?? $data["first_name"] . " " . $data["last_name"] ?><?php if (isset($data["nick_name"]) && trim($data["nick_name"]) !== ""): ?> <small><small><small>(<?= $data["first_name"] . " " . $data["last_name"] ?>)</small></small></small><?php endif; ?></span>
<span id="btn-area" style="float: right;"><input id="form-btn" type="button" value="<?= l($id === $_USER ? "lang_profile_save" : "lang_edit_save") ?>" class="btn btn-outline-primary" <?= $_PROFILE["blocked"] >= 1 ? "disabled" : "" ?>> <a href="/<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/" . $id . ".json") ? "people" : (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/articles/" . $id . ".json") ? "articles" : (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/" . $id . ".json") ? "gallery" : "profile")) ?>/<?= $id ?>" class="btn btn-outline-dark"><?= l("lang_edit_cancel") ?></a></span>
<?php endif; ?>
</span>
<span id="btn-area" class="btn-group"><a style="height: 38px;" id="form-btn" title="<?= l("lang_edit_save") ?>" class="btn btn-outline-primary btn-with-img <?= $_PROFILE["blocked"] >= 2 ? "disabled" : "" ?>" data-bs-toggle="tooltip"><img src="/icons/save.svg<?= $_PROFILE["blocked"] >= 2 ? "" : "?p" ?>" style="width: 24px;"></a><a style="height: 38px;" href="/<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/" . $id . ".json") ? "people" : "articles" ?>/<?= $id ?>" class="btn btn-outline-dark btn-with-img" title="<?= l("lang_edit_cancel") ?>" data-bs-toggle="tooltip"><img src="/icons/close.svg" style="width: 24px;"></a></span>
</h1>
<?php if ($self && $_PROFILE["blocked"] === 1): ?>
@ -125,9 +123,13 @@ if (!isset($_PROFILE["requests"][$id])):
<?php else: ?>
<div class="container">
<br><br>
<h1>
<h1 id="btn-area-container" style="display: grid; grid-template-columns: 1fr max-content;">
<?php if ($id !== $_USER): ?>
<span><?= getNameFromId($id) ?></span>
<span id="btn-area" style="float: right;"><input disabled id="form-btn" type="button" value="<?= l("lang_edit_save") ?>" class="btn btn-outline-primary"> <a href="/<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/" . $id . ".json") ? "people" : (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/" . $id . ".json") ? "gallery" : "articles") ?>/<?= $id ?>" class="btn btn-outline-dark"><?= l("lang_edit_cancel") ?></a></span>
<?php else: ?>
<span><?= $data["nick_name"] ?? $data["first_name"] . " " . $data["last_name"] ?><?php if (isset($data["nick_name"]) && trim($data["nick_name"]) !== ""): ?> <small><small><small>(<?= $data["first_name"] . " " . $data["last_name"] ?>)</small></small></small><?php endif; ?></span>
<?php endif; ?>
<span id="btn-area" class="btn-group"><a style="height: 38px;" id="form-btn" title="<?= l("lang_edit_save") ?>" class="btn btn-outline-primary btn-with-img disabled" data-bs-toggle="tooltip"><img src="/icons/save.svg" style="width: 24px;"></a><a style="height: 38px;" href="/<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/" . $id . ".json") ? "people" : "articles" ?>/<?= $id ?>" class="btn btn-outline-dark btn-with-img" title="<?= l("lang_edit_cancel") ?>" data-bs-toggle="tooltip"><img src="/icons/close.svg" style="width: 24px;"></a></span>
</h1>
<div class="alert alert-warning">

@ -73,6 +73,24 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/" . $id . ".j
$_PROFILE["update"] = date('c');
}
$config = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/email.json"), true);
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/" . $id . ".json") || file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/" . $id . ".json") || file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/articles/" . $id . ".json")) {
file_get_contents('https://notifications.equestria.dev/delta', false, stream_context_create([
'http' => [
'method' => 'POST',
'header' =>
"Content-Type: text/plain\r\n" .
"Title: " . formatPonypush("New change request published") . "\r\n" .
"Priority: default\r\n" .
"Tags: requests\r\n" .
"Actions: view, Open change requests, https://delta.equestria.dev/admin/requests/, clear=true\r\n" .
"Authorization: Basic " . base64_encode($config["ntfyuser"] . ":" . $config["ntfypass"]),
'content' => formatPonypush($_PROFILE['first_name'] . " " . $_PROFILE["last_name"] . " published a request to change " . getNameFromId($id) . (isset($_POST["summary"]) && trim($_POST["summary"]) !== "" ? ": " . $_POST["summary"] : ""))
]
]));
}
if ($id === $_USER) {
saveProfile();
header("Location: /profile/" . $id);

@ -1,6 +1,7 @@
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php";
$id = array_values(array_filter(array_keys($_GET), function ($i) {
return str_starts_with($i, "/") && strlen($i) > 1;
@ -26,7 +27,6 @@ if (isset($id)) {
$title = "lang_gallery_title";
}
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/header.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/navigation.php";
@ -48,9 +48,9 @@ if (!isset($id)):
<div class="container">
<br><br>
<h1>
<h1 id="btn-area-container" style="display: grid; grid-template-columns: 1fr max-content;">
<span><?= getNameFromId($id) ?></span>
<span id="btn-area" style="float: right;"><a href="/upload/<?= $id ?>" class="btn btn-outline-primary"><?= l("lang_gallery_upload") ?></a> <a href="/request/?type=rename&id=<?= $id ?>" class="btn btn-outline-dark"><?= l("lang_articles_rename") ?></a> <a href="/edit/<?= $id ?>" class="btn btn-outline-dark"><?= l("lang_people_edit") ?></a></span>
<span id="btn-area" class="btn-group"><a style="height: 38px;" href="/upload/<?= $id ?>" class="btn btn-outline-primary btn-with-img" title="<?= l("lang_gallery_upload") ?>" data-bs-toggle="tooltip"><img src="/icons/upload.svg?p" style="width: 24px;"></a><a style="height: 38px;" href="/request/?type=rename&id=<?= $id ?>" class="btn btn-outline-dark btn-with-img" title="<?= l("lang_articles_rename") ?>" data-bs-toggle="tooltip"><img src="/icons/rename.svg" style="width: 24px;"></a><a style="height: 38px;" href="/edit/<?= $id ?>" class="btn btn-outline-dark btn-with-img" title="<?= l("lang_people_edit") ?>" data-bs-toggle="tooltip"><img src="/icons/edit.svg" style="width: 24px;"></a><a style="height: 38px;" onclick="copy('<?= uuidToId($id) ?>', true)" class="btn btn-outline-dark btn-with-img" title="<?= l("lang_shortener_copy") ?>" data-bs-toggle="tooltip"><img src="/icons/copy.svg" style="width: 24px;"></a></span>
</h1>
<div>

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg>

After

Width:  |  Height:  |  Size: 284 B

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M2.5 4v3h5v12h3V7h5V4h-13zm19 5h-9v3h3v7h3v-7h3V9z"/></svg>

After

Width:  |  Height:  |  Size: 207 B

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7l-4-4zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm3-10H5V5h10v4z"/></svg>

After

Width:  |  Height:  |  Size: 299 B

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"/></svg>

After

Width:  |  Height:  |  Size: 194 B

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 96 960 960" width="48"><path d="M250.769 920.385q-23.058 0-39.221-16.164-16.164-16.163-16.164-39.221V389.692h30.77V865q0 9.231 7.692 16.923 7.692 7.693 16.923 7.693h350.924v30.769H250.769Zm101.538-101.539q-23.057 0-39.221-16.163-16.163-16.164-16.163-39.221V295.769q0-23.058 16.163-39.221 16.164-16.164 39.221-16.164H700q23.058 0 39.221 16.164 16.164 16.163 16.164 39.221v467.693q0 23.057-16.164 39.221-16.163 16.163-39.221 16.163H352.307Zm0-30.769H700q9.231 0 16.923-7.692 7.692-7.693 7.692-16.923V295.769q0-9.231-7.692-16.923-7.692-7.692-16.923-7.692H352.307q-9.23 0-16.923 7.692-7.692 7.692-7.692 16.923v467.693q0 9.23 7.692 16.923 7.693 7.692 16.923 7.692Zm-24.615 0V271.154v516.923Z" fill="#000000"/></svg>

After

Width:  |  Height:  |  Size: 773 B

@ -13,7 +13,7 @@ if (isset($_PROFILE) && !isset($_COOKIE["DeltaKiosk"])) {
}
if (isset($_SERVER["HTTP_REFERER"]) && isset($_PROFILE)) {
$id = preg_replace("/^http(s|):\/\/.*\/profile\/([\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})$/i", "$2", $_SERVER['HTTP_REFERER']);
$id = preg_replace("/^http(s|):\/\/.*\/(edit|profiles)\/([\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})$/i", "$3", $_SERVER['HTTP_REFERER']);
if (isset($id) && trim($id) !== "") {
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $id . ".json")) {
@ -40,12 +40,20 @@ if (isset($_GET["__"]) && trim($_GET["__"]) !== "") {
header("Content-Type: " . mime_content_type($_SERVER['DOCUMENT_ROOT'] . "/_icons/_mdi/" . $name));
header("Content-Length: " . filesize($_SERVER['DOCUMENT_ROOT'] . "/_icons/_mdi/" . $name));
echo(str_replace('fill="#084298"', 'fill="#' . $palette[0] . '"', str_replace('fill="#000000"', 'fill="#' . $palette[6] . '"', file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/_icons/_mdi/" . $name))));
if (isset($_GET['p'])) {
echo(str_replace('fill="#084298"', 'fill="#' . $palette[0] . '"', str_replace('fill="#000000"', 'fill="#' . $palette[9] . '"', file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/_icons/_mdi/" . $name))));
} else {
echo(str_replace('fill="#084298"', 'fill="#' . $palette[0] . '"', str_replace('fill="#000000"', 'fill="#' . $palette[6] . '"', file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/_icons/_mdi/" . $name))));
}
} else {
header("Content-Type: " . mime_content_type($_SERVER['DOCUMENT_ROOT'] . "/_icons/" . $name));
header("Content-Length: " . filesize($_SERVER['DOCUMENT_ROOT'] . "/_icons/" . $name));
echo(str_replace('fill="#084298"', 'fill="#' . $palette[0] . '"', str_replace('fill="#000000"', 'fill="#' . $palette[6] . '"', file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/_icons/" . $name))));
if (isset($_GET['p'])) {
echo(str_replace('fill="#084298"', 'fill="#' . $palette[0] . '"', str_replace('fill="#000000"', 'fill="#' . $palette[9] . '"', file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/_icons/" . $name))));
} else {
echo(str_replace('fill="#084298"', 'fill="#' . $palette[0] . '"', str_replace('fill="#000000"', 'fill="#' . $palette[6] . '"', file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/_icons/" . $name))));
}
}
} else {
header("Content-Type: " . mime_content_type($_SERVER['DOCUMENT_ROOT'] . "/_icons/" . $name));

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 96 960 960" width="48"><path d="M320 860.616V331.385H115.384v-40.001h449.232v40.001H360v529.231h-40Zm360 0V531.385H555.384v-40.001h289.232v40.001H720v329.231h-40Z" fill="#000000"/></svg>

After

Width:  |  Height:  |  Size: 249 B

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 96 960 960" width="48"><path d="M800 391.461v449.155q0 23.057-16.163 39.221Q767.673 896 744.616 896H215.384q-23.057 0-39.221-16.163Q160 863.673 160 840.616V311.384q0-23.057 16.163-39.221Q192.327 256 215.384 256h449.155L800 391.461Zm-30.769 13.924L650.615 286.769H215.384q-10.769 0-17.692 6.923t-6.923 17.692v529.232q0 10.769 6.923 17.692t17.692 6.923h529.232q10.769 0 17.692-6.923t6.923-17.692V405.385ZM479.765 754.846q29.838 0 51.267-21.194 21.43-21.194 21.43-51.032 0-29.838-21.195-51.267-21.194-21.43-51.032-21.43-29.838 0-51.267 21.194-21.43 21.195-21.43 51.032 0 29.838 21.195 51.268 21.194 21.429 51.032 21.429Zm-212.15-279h295.693V363.615H267.615v112.231Zm-76.846-70.461v459.846-578.462 118.616Z" fill="#000000"/></svg>

After

Width:  |  Height:  |  Size: 789 B

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 96 960 960" width="48"><path d="M255.384 856q-23.057 0-39.221-16.163Q200 823.673 200 800.616V694.538h30.769v106.078q0 9.23 7.692 16.923 7.693 7.692 16.923 7.692h449.232q9.23 0 16.923-7.692 7.692-7.693 7.692-16.923V694.538H760v106.078q0 23.057-16.163 39.221Q727.673 856 704.616 856H255.384Zm209.231-147.615V342L363.846 442l-22.231-21.461L480 282.154l138.385 138.385L596.154 442 495.385 342v366.385h-30.77Z" fill="#000000"/></svg>

After

Width:  |  Height:  |  Size: 491 B

@ -8,6 +8,7 @@ $id = array_values(array_filter(array_keys($_GET), function ($i) {
if (isset($id)) {
$id = substr($id, 1);
if (!preg_match("/[a-zA-Z0-6]/m", $id)) {
header("Location: /people");
die();
@ -48,9 +49,9 @@ if (!isset($id)):
<div class="container">
<br><br>
<h1>
<h1 id="btn-area-container" style="display: grid; grid-template-columns: 1fr max-content;">
<span><?= getNameFromId($id) ?><?php if (isset($data["born"]) && trim($data["born"]) !== ""): ?> <small><small><small>(<?= $data["first_name"] . " " . $data["born"] ?>)</small></small></small><?php endif; ?></span>
<span id="btn-area" style="float: right;"><a href="/edit/<?= $id ?>" class="btn btn-outline-dark"><?= l("lang_people_edit") ?></a></span>
<span id="btn-area" class="btn-group"><a style="height: 38px;" href="/edit/<?= $id ?>" class="btn btn-outline-dark btn-with-img" title="<?= l("lang_people_edit") ?>" data-bs-toggle="tooltip"><img src="/icons/edit.svg" style="width: 24px;"></a><a style="height: 38px;" onclick="copy('<?= uuidToId($id) ?>', true)" class="btn btn-outline-dark btn-with-img" title="<?= l("lang_shortener_copy") ?>" data-bs-toggle="tooltip"><img src="/icons/copy.svg" style="width: 24px;"></a></span>
</h1>
<div style="display: grid; grid-template-columns: 1fr 400px; grid-gap: 20px;" id="infobox">

@ -48,13 +48,13 @@ foreach (array_filter(scandir($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people
<br><br>
<h1>
<span><?= $data["nick_name"] ?? $data["first_name"] . " " . $data["last_name"] ?><?php if (isset($data["nick_name"]) && trim($data["nick_name"]) !== ""): ?> <small><small><small>(<?= $data["first_name"] . " " . $data["last_name"] ?>)</small></small></small><?php endif; ?></span>
<span id="btn-area" style="float: right;">
<div id="btn-area" style="float: right;">
<div id="badges-desktop" style="display: inline-block; margin-right: 10px;">
<?php badges($data) ?>
</div>
<?php if ($id === $_USER): ?><a href="/edit/<?= $id ?>" class="btn btn-outline-dark"><?= l("lang_people_edit") ?></a><?php endif; ?>
<div class="dropdown" style="display: inline-block;">
<button type="button" class="btn btn-outline-dark dropdown-toggle" data-bs-toggle="dropdown"><?= l("lang_profile_options") ?></button>
<div class="btn-group">
<a style="height: 38px;" href="/edit/<?= $id ?>" class="btn btn-outline-dark btn-with-img <?= $id !== $_USER ? "disabled" : "" ?>" title="<?= l("lang_articles_rename") ?>" data-bs-toggle="tooltip"><img src="/icons/edit.svg" style="width: 24px;"></a><a style="height: 38px;" onclick="copy('<?= uuidToId($id) ?>', true)" class="btn btn-outline-dark btn-with-img" title="<?= l("lang_shortener_copy") ?>" data-bs-toggle="tooltip"><img src="/icons/copy.svg" style="width: 24px;"></a>
<button style="height: 38px;" type="button" class="btn btn-outline-dark dropdown-toggle btn-with-img" title="<?= l("lang_profile_options") ?>" data-bs-toggle2="tooltip" data-bs-toggle="dropdown"><img src="/icons/admin.svg" style="width: 24px;"></button>
<ul class="dropdown-menu">
<li><a class="dropdown-item <?= $id === $_USER ? "disabled" : "" ?>" href="/request/?type=userreport&id=<?= $id ?>">
<img src="/icons/report.svg" style="vertical-align: middle; width: 24px;<?= $id === $_USER ? "opacity:.5;" : "" ?>">
@ -70,7 +70,7 @@ foreach (array_filter(scandir($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people
</a></li>
</ul>
</div>
</span>
</div>
<div id="badges-mobile" style="display: none;">
<?php badges($data) ?>
</div>

@ -65,6 +65,22 @@ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $uuid
"date" => date('c')
])));
$config = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/email.json"), true);
file_get_contents('https://notifications.equestria.dev/delta', false, stream_context_create([
'http' => [
'method' => 'POST',
'header' =>
"Content-Type: text/plain\r\n" .
"Title: " . formatPonypush("New change request published") . "\r\n" .
"Priority: default\r\n" .
"Tags: requests\r\n" .
"Actions: view, Open change requests, https://delta.equestria.dev/admin/requests/, clear=true\r\n" .
"Authorization: Basic " . base64_encode($config["ntfyuser"] . ":" . $config["ntfypass"]),
'content' => formatPonypush($_PROFILE['first_name'] . " " . $_PROFILE["last_name"] . " published a request to upload an image to " . getNameFromId($id) . (isset($_POST["summary"]) && trim($_POST["summary"]) !== "" ? ": " . $_POST["summary"] : ""))
]
]));
$_PROFILE["requests"][$id . ":" . $uuid] = $uuid;
saveProfile();

@ -0,0 +1,15 @@
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.php";
if (str_starts_with($_GET["_"], "ogo") && file_exists($_SERVER['DOCUMENT_ROOT'] . "/l" . str_replace("/", "-", $_GET["_"]))) {
header("Content-Type: " . mime_content_type($_SERVER['DOCUMENT_ROOT'] . "/l" . str_replace("/", "-", $_GET["_"])));
header("Content-Length: " . filesize($_SERVER['DOCUMENT_ROOT'] . "/l" . str_replace("/", "-", $_GET["_"])));
die(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/l" . str_replace("/", "-", $_GET["_"])));
}
$id = $_GET["_"];
$data = parseId($id);
header("Location: " . (isset($data) ? $data['url'] : "/"));
die();

@ -31,6 +31,7 @@ $name7 = l("lang_download_files_deleted");
$name8 = l("lang_download_files_history");
$name9 = l("lang_download_files_profile");
$name10 = l("lang_download_files_avatar");
$name11 = l("lang_download_files_uploads");
mkdir($name1);
@ -42,6 +43,10 @@ mkdir($name3);
mkdir("$name3/$name6");
mkdir("$name3/$name7");
mkdir($name11);
mkdir("$name11/$name6");
mkdir("$name11/$name7");
foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests"), function ($i) { return !str_starts_with($i, "."); }) as $file) {
$id = substr($file, 0, -5);
$data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $file), true);
@ -82,6 +87,20 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $_USER . ".jpg")) {
file_put_contents("$name1/$name10.jpg", "");
}
$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"));
} else {
file_put_contents("$name11/$name7/$item[id].jpg", "");
}
}
}
$zip = new ZipArchive;
$tmp_file = $tempDir . ".zip";

@ -61,11 +61,27 @@ switch ($_FILES["upload"]["type"]) {
break;
}
imagejpeg($im, $_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $uuid . ".jpg");
imagejpeg($im, $_SERVER['DOCUMENT_ROOT'] . "/uploads/temp-" . $uuid . ".jpg");
$list = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/embeds.json")), true);
$list[] = $uuid;
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")) {
$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")) {
$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");
} else {
rename($_SERVER['DOCUMENT_ROOT'] . "/uploads/temp-" . $uuid . ".jpg", $_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $uuid . ".jpg");
$list[] = [
"id" => $uuid,
"author" => $_USER
];
}
}
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/embeds.json", pf_utf8_encode(json_encode($list)));

@ -24,8 +24,8 @@
"fr": "Il y a du nouveau sur Delta !"
},
"message": {
"en": "Hi there! We just released Delta EAP 4.0, which fixes numerous bugs while adding new ways to login to Delta (using an Equestria.horse account), a button to send an account application, technical support pricing (on the support page) and smart page linking.",
"fr": "Vous revoilà ! Nous venons de sortir Delta EAP 4.0, qui corrige de nombreux bugs tout en ajoutant de nouvelles façons de se connecter à Delta (en utilisant un compte Equestria.horse), un bouton pour envoyer une demande de création de compte, les tarifs du support technique (sur la page d'aide) et une création de liens intelligente."
"en": "Hi there! We just released Delta EAP 4.0, which fixes numerous bugs while adding new ways to login to Delta (using an Equestria.dev account), a button to send an account application, technical support pricing (on the support page) and smart page linking.",
"fr": "Vous revoilà ! Nous venons de sortir Delta EAP 4.0, qui corrige de nombreux bugs tout en ajoutant de nouvelles façons de se connecter à Delta (en utilisant un compte Equestria.dev), un bouton pour envoyer une demande de création de compte, les tarifs du support technique (sur la page d'aide) et une création de liens intelligente."
},
"version": "5.0.0-eap4.0",
"affects": {

@ -3,10 +3,18 @@
<br><br>
<script>
let tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
let tooltipTriggerList = [...[].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')), ...[].slice.call(document.querySelectorAll('[data-bs-toggle2="tooltip"]'))]
let tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl)
})
function copy(text, url) {
if (url) {
navigator.clipboard.writeText("https://pone.eu.org/" + text);
} else {
navigator.clipboard.writeText(text);
}
}
</script>
</body>

@ -4,6 +4,40 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/maintenance")) die();
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/lang.php";
function formatPonypush($message) {
return "Update to Ponypush 3.1.0 or later — (\$PA1$\$" . base64_encode($message) . "\$\$)";
}
function base64url_encode($input) {
return strtr(base64_encode($input), '+/=', '._-');
}
function base64url_decode($input) {
return base64_decode(strtr($input, '._-', '+/='));
}
function uuidToId($uuid) {
return "ls" . substr(base64url_encode(hex2bin(sha1(str_replace("-", "", $uuid)))), 0, 7);
}
function parseId($id) {
if (str_contains($id, "-")) {
return $id;
} else {
foreach (getSearchEntries() as $entry) {
$url = $entry["url"];
$uuid = $entry["id"];
if (uuidToId($uuid) === "l" . $id) {
return [
"id" => $uuid,
"url" => $url
];
}
}
}
}
function pf_utf8_decode(string $string): string {
return iconv("UTF-8", "ISO-8859-1", $string);
}
@ -56,7 +90,7 @@ function initLang(): void {
initLang();
function search($query, $ignoreExact = false, $ignoreProfiles = false): array {
function getSearchEntries($ignoreProfiles = false) {
$entries = [
...array_map(function ($i) {
$id = substr($i, 0, -5);
@ -117,6 +151,12 @@ function search($query, $ignoreExact = false, $ignoreProfiles = false): array {
}, array_values(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles"), function ($i) { return str_ends_with($i, ".json"); }))));
}
return $entries;
}
function search($query, $ignoreExact = false, $ignoreProfiles = false): array {
$entries = getSearchEntries($ignoreProfiles);
$scored = array_map(function ($i) use ($query, $ignoreExact) {
$name = explode(" ", trim(strtolower(preg_replace("/ +/m", " ", preg_replace("/[^a-zA-Z0-9-_'\"+=]/m", " ", $i['name'])))));
$extract = explode(" ", trim(strtolower(preg_replace("/ +/m", " ", preg_replace("/[^a-zA-Z0-9-_'\"+=]/m", " ", $i['extract'])))));

@ -87,6 +87,10 @@ if (isset($_GET["__"])) {
height: 24px;
}
.btn-with-img:hover img, .btn-with-img.dropdown-toggle.show img {
filter: brightness(0%);
}
<?php if (!isset($_GET["frameless"])): ?>
@media print {
<?php endif; ?>
@ -361,10 +365,12 @@ if (isset($_GET["__"])) {
}
#btn-area {
float: initial !important;
display: block;
margin-left: auto;
margin-right: auto;
display: flex !important;
margin-top: 10px;
}
#btn-area-container {
grid-template-columns: 1fr !important;
}
}

@ -35,8 +35,8 @@ foreach ($list as $file) {
$data["nick_name"] = null;
}
// FIXME: Commented out because it would repeat multiple times
/*if (substr($data["birth"], 5) === date('m-d')) {
if (substr($data["birth"], 5) === date('m-d') && (!isset($data["birthday_given"]) || !$data["birthday_given"])) {
$data["birthday_given"] = true;
println(" Birthday");
if ($data["balance"] !== -1) $data["balance"] += 4;
$data["alerts"][] = [
@ -45,7 +45,9 @@ foreach ($list as $file) {
"date" => date('c'),
"read" => false
];
}*/
} elseif (!(substr($data["birth"], 5) === date('m-d'))) {
$data["birthday_given"] = false;
}
if ($data["blocked"] !== $data["last_blocked"]) {
println(" Block level update");
@ -236,7 +238,7 @@ foreach ($list as $file) {
println(" ", $alert["title"]);
foreach ($data["devices"] as $device) {
exec('node "' . $_SERVER['DOCUMENT_ROOT'] . "/includes/fcm/index.js" . '" "' . str_replace('"', '\\"', $device) . '" "' . str_replace('"', '\\"', $alert["title"]) . '" "' . str_replace('"', '\\"', $alert["message"]) . '"', $d);
exec('node "' . $_SERVER['DOCUMENT_ROOT'] . "/includes/fcm/index.js" . '" "' . str_replace('"', '\\"', $device["token"]) . '" "' . str_replace('"', '\\"', $alert["title"]) . '" "' . str_replace('"', '\\"', $alert["message"]) . '"', $d);
}
}
}
@ -266,4 +268,24 @@ foreach ($codes as $name => $code) {
}
}
println("Cleaning up unused images...");
foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/uploads/"), function ($i) { return !str_starts_with($i, "."); }) as $upload) {
$used = false;
if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/archive")) mkdir($_SERVER['DOCUMENT_ROOT'] . "/uploads/archive");
foreach (getSearchEntries() as $entry) {
$data = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $entry["type"] . "/" . $entry["id"] . ".json");
if (str_contains($data, $upload) || $entry["id"] === explode(".", $upload)[0]) {
$used = true;
}
}
if (!$used) {
println(" " . $upload);
rename($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $upload, $_SERVER['DOCUMENT_ROOT'] . "/uploads/archive/" . $upload);
}
}
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/codes.json", json_encode($codes, JSON_PRETTY_PRINT));

@ -21,6 +21,46 @@ function doLinking($text) {
}, array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people"), function ($i) {
return !str_starts_with($i, ".");
})),
...array_map(function ($i) {
return [
"link" => "/people/" . substr($i, 0, -5),
"name" => json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $i)), true)["first_name"] . " " . (json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $i)), true)["born"] ?? json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $i)), true)["last_name"])
];
}, array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people"), function ($i) {
return !str_starts_with($i, ".");
})),
...array_map(function ($i) {
return [
"link" => "/people/" . substr($i, 0, -5),
"name" => strtoupper(json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $i)), true)["last_name"]) . " " . json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $i)), true)["first_name"]
];
}, array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people"), function ($i) {
return !str_starts_with($i, ".");
})),
...array_map(function ($i) {
return [
"link" => "/people/" . substr($i, 0, -5),
"name" => strtoupper(json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $i)), true)["born"] ?? json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $i)), true)["last_name"]) . " " . json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $i)), true)["first_name"]
];
}, array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people"), function ($i) {
return !str_starts_with($i, ".");
})),
...array_map(function ($i) {
return [
"link" => "/people/" . substr($i, 0, -5),
"name" => json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $i)), true)["alts"][0]
];
}, array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people"), function ($i) {
return !str_starts_with($i, ".") && isset(json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $i)), true)["alts"]) && isset(json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $i)), true)["alts"][0]);
})),
...array_map(function ($i) {
return [
"link" => "/people/" . substr($i, 0, -5),
"name" => json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $i)), true)["alts"][1]
];
}, array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people"), function ($i) {
return !str_starts_with($i, ".") && isset(json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $i)), true)["alts"]) && isset(json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $i)), true)["alts"][1]);
})),
...array_map(function ($i) {
return [
"link" => "/gallery/" . substr($i, 0, -5),

@ -27,7 +27,7 @@ if (isset($_COOKIE["DeltaSession"])) {
}
if (!isset($api)) die();
} elseif ($_PROFILE["blocked"] < 3 && $_SERVER['PHP_SELF'] === "/login/blocked/index.php") {
if (!isset($api)) header("Location: /");
if (!isset($api)) header("Location: " . ($_GET["return"] ?? "/"));
if (!isset($api)) die();
}
} else {

@ -829,7 +829,8 @@
"deleted": "Deleted",
"history": "History",
"profile": "Profile info",
"avatar": "Profile picture"
"avatar": "Profile picture",
"uploads": "Images uploaded to pages"
},
"name": "Delta data export for %1",
"kiosk": "Downloading a copy of your personal data is not possible when using a Delta kiosk. Open this page on your own device to continue."
@ -1020,5 +1021,8 @@
"devtools": "Toggle developer options",
"disable": "Disable this kiosk",
"reload": "Reload this page"
},
"shortener": {
"copy": "Copy shortened link"
}
}

@ -829,7 +829,8 @@
"deleted": "Supprimées",
"history": "Historique",
"profile": "Informations de profil",
"avatar": "Photo de profil"
"avatar": "Photo de profil",
"uploads": "Images importées sur les pages"
},
"name": "Export de données Delta pour %1",
"kiosk": "Télécharger une copie de vos données personnelles n'est pas possible depuis un kiosque Delta. Ouvrez cette page sur votre propre appareil pour continuer."
@ -1020,5 +1021,8 @@
"devtools": "Options de développement",
"disable": "Désactiver ce kiosque",
"reload": "Recharger la page"
},
"shortener": {
"copy": "Copier le lien raccourci"
}
}

@ -71,6 +71,10 @@ if (!isset($_GET["return"])) {
$_GET["return"] = "/";
}
if (!isset($_GET["method"])) {
$_GET["method"] = null;
}
if ($step === 0 && $_GET["method"] === "hub") {
setcookie("DeltaReturnPage", $_GET["return"], 0, "/");
header("Location: https://auth.equestria.horse/hub/api/rest/oauth2/auth?client_id=" . $app["oauth2_id"] . "&response_type=code&redirect_uri=https://" . ($_SERVER["HTTP_HOST"] === "192.168.1.121:81" ? "delta-staging" : "delta") . ".equestria.dev/login/oauth&scope=Hub&request_credentials=default&access_type=offline");

@ -26,6 +26,22 @@ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $rid
"date" => date('c')
])));
$config = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/email.json"), true);
file_get_contents('https://notifications.equestria.dev/delta', false, stream_context_create([
'http' => [
'method' => 'POST',
'header' =>
"Content-Type: text/plain\r\n" .
"Title: " . formatPonypush("New change request published") . "\r\n" .
"Priority: default\r\n" .
"Tags: requests\r\n" .
"Actions: view, Open change requests, https://delta.equestria.dev/admin/requests/, clear=true\r\n" .
"Authorization: Basic " . base64_encode($config["ntfyuser"] . ":" . $config["ntfypass"]),
'content' => formatPonypush($_PROFILE['first_name'] . " " . $_PROFILE["last_name"] . " published a request to " . json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/lang/en.json"), true)["request"]["types"][$type] . (isset($_POST["summary"]) && trim($_POST["summary"]) !== "" ? ": " . $_POST["summary"] : ""))
]
]));
$_PROFILE["requests"]["r:" . $id] = $rid;
saveProfile();

@ -1,72 +0,0 @@
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.php";
global $_PROFILE; global $_USER;
$id = $_GET['id'] ?? null;
$uuid = uuid();
header("Content-Type: text/plain");
var_dump($_POST, $_FILES["file"], $uuid);
if (!isset($_FILES["file"])) {
header("Location: /upload/$id&error=unreceived");
die();
}
if ($_FILES["file"]["error"] !== 0) {
header("Location: /upload/$id&error=internal");
die();
}
if ($_FILES["file"]["type"] !== "image/png" && $_FILES["file"]["type"] !== "image/jpeg" && $_FILES["file"]["type"] !== "image/webp" && $_FILES["file"]["type"] !== "image/gif" && $_FILES["file"]["type"] !== "image/bmp" && $_FILES["file"]["type"] !== "image/avif") {
header("Location: /upload/$id&error=type");
die();
}
$im = imagecreate(1, 1);
switch ($_FILES["file"]["type"]) {
case "image/png":
$im = imagecreatefrompng($_FILES["file"]["tmp_name"]);
break;
case "image/jpeg":
$im = imagecreatefromjpeg($_FILES["file"]["tmp_name"]);
break;
case "image/webp":
$im = imagecreatefromwebp($_FILES["file"]["tmp_name"]);
break;
case "image/gif":
$im = imagecreatefromgif($_FILES["file"]["tmp_name"]);
break;
case "image/bmp":
$im = imagecreatefrombmp($_FILES["file"]["tmp_name"]);
break;
case "image/avif":
$im = imagecreatefromavif($_FILES["file"]["tmp_name"]);
break;
}
imagejpeg($im, $_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $uuid . ".jpg");
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $uuid . ".json", pf_utf8_encode(json_encode([
"type" => "galleryupload",
"author" => $_USER,
"id" => $id,
"contents" => null,
"summary" => $_POST["summary"],
"date" => date('c')
])));
$_PROFILE["requests"][$id . ":" . $uuid] = $uuid;
saveProfile();
header("Location: /upload/$id&success");
die();

@ -1 +1 @@
5.0.0-eap5.10
5.12.0-rc1
Loading…
Cancel
Save