summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-05-07 13:51:35 +0200
committerRaindropsSys <contact@minteck.org>2023-05-07 13:51:35 +0200
commit21b1d34b71d32e2c2867d420b2c04b45dc4095c2 (patch)
treeb983f9942e0e76f22c65ce25008088510abe8de6
parentaf4145a2961308ca88dd287d7057fcb4e8a896b6 (diff)
downloaddelta-21b1d34b71d32e2c2867d420b2c04b45dc4095c2.tar.gz
delta-21b1d34b71d32e2c2867d420b2c04b45dc4095c2.tar.bz2
delta-21b1d34b71d32e2c2867d420b2c04b45dc4095c2.zip
Updated 22 files, added 9 files and deleted upload/index.php (automated)
-rw-r--r--_articles/index.php6
-rw-r--r--_edit/index.php14
-rw-r--r--_edit/save/index.php18
-rw-r--r--_gallery/index.php6
-rw-r--r--_icons/_mdi/copy.svg1
-rw-r--r--_icons/_mdi/rename.svg1
-rw-r--r--_icons/_mdi/save.svg1
-rw-r--r--_icons/_mdi/upload.svg1
-rw-r--r--_icons/copy.svg1
-rw-r--r--_icons/index.php14
-rw-r--r--_icons/rename.svg1
-rw-r--r--_icons/save.svg1
-rw-r--r--_icons/upload.svg1
-rw-r--r--_people/index.php5
-rw-r--r--_profile/index.php10
-rw-r--r--_upload/save/index.php16
-rw-r--r--_url.php15
-rw-r--r--download/start/index.php19
-rw-r--r--embed/index.php20
-rw-r--r--includes/changes.json4
-rw-r--r--includes/footer.php10
-rw-r--r--includes/functions.php42
-rw-r--r--includes/header.php14
-rw-r--r--includes/jobs-handler.php30
-rw-r--r--includes/linking.php40
-rw-r--r--includes/session.php2
-rw-r--r--lang/en.json6
-rw-r--r--lang/fr.json6
-rw-r--r--login/index.php4
-rw-r--r--request/save/index.php16
-rw-r--r--upload/index.php72
-rw-r--r--version2
32 files changed, 287 insertions, 112 deletions
diff --git a/_articles/index.php b/_articles/index.php
index 95b918f..21b760b 100644
--- a/_articles/index.php
+++ b/_articles/index.php
@@ -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>
diff --git a/_edit/index.php b/_edit/index.php
index 53a9b46..c2b72ff 100644
--- a/_edit/index.php
+++ b/_edit/index.php
@@ -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">
diff --git a/_edit/save/index.php b/_edit/save/index.php
index 6a777b3..3e16871 100644
--- a/_edit/save/index.php
+++ b/_edit/save/index.php
@@ -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);
diff --git a/_gallery/index.php b/_gallery/index.php
index 0a4dd28..5dd66ff 100644
--- a/_gallery/index.php
+++ b/_gallery/index.php
@@ -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>
diff --git a/_icons/_mdi/copy.svg b/_icons/_mdi/copy.svg
new file mode 100644
index 0000000..31873cb
--- /dev/null
+++ b/_icons/_mdi/copy.svg
@@ -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> \ No newline at end of file
diff --git a/_icons/_mdi/rename.svg b/_icons/_mdi/rename.svg
new file mode 100644
index 0000000..f9c44e6
--- /dev/null
+++ b/_icons/_mdi/rename.svg
@@ -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> \ No newline at end of file
diff --git a/_icons/_mdi/save.svg b/_icons/_mdi/save.svg
new file mode 100644
index 0000000..f5b5c7c
--- /dev/null
+++ b/_icons/_mdi/save.svg
@@ -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> \ No newline at end of file
diff --git a/_icons/_mdi/upload.svg b/_icons/_mdi/upload.svg
new file mode 100644
index 0000000..ee50f7e
--- /dev/null
+++ b/_icons/_mdi/upload.svg
@@ -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> \ No newline at end of file
diff --git a/_icons/copy.svg b/_icons/copy.svg
new file mode 100644
index 0000000..fb056dc
--- /dev/null
+++ b/_icons/copy.svg
@@ -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> \ No newline at end of file
diff --git a/_icons/index.php b/_icons/index.php
index 9c20dfb..1449557 100644
--- a/_icons/index.php
+++ b/_icons/index.php
@@ -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));
diff --git a/_icons/rename.svg b/_icons/rename.svg
new file mode 100644
index 0000000..ba1a24b
--- /dev/null
+++ b/_icons/rename.svg
@@ -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> \ No newline at end of file
diff --git a/_icons/save.svg b/_icons/save.svg
new file mode 100644
index 0000000..000cfd4
--- /dev/null
+++ b/_icons/save.svg
@@ -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> \ No newline at end of file
diff --git a/_icons/upload.svg b/_icons/upload.svg
new file mode 100644
index 0000000..42b362e
--- /dev/null
+++ b/_icons/upload.svg
@@ -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> \ No newline at end of file
diff --git a/_people/index.php b/_people/index.php
index b7e8182..61bc122 100644
--- a/_people/index.php
+++ b/_people/index.php
@@ -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">
diff --git a/_profile/index.php b/_profile/index.php
index 9bf63fe..a4c10f1 100644
--- a/_profile/index.php
+++ b/_profile/index.php
@@ -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>
diff --git a/_upload/save/index.php b/_upload/save/index.php
index 3c81f4b..23c245e 100644
--- a/_upload/save/index.php
+++ b/_upload/save/index.php
@@ -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();
diff --git a/_url.php b/_url.php
new file mode 100644
index 0000000..f953982
--- /dev/null
+++ b/_url.php
@@ -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(); \ No newline at end of file
diff --git a/download/start/index.php b/download/start/index.php
index 1c4042b..085c798 100644
--- a/download/start/index.php
+++ b/download/start/index.php
@@ -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";
diff --git a/embed/index.php b/embed/index.php
index ea0e526..99e4c49 100644
--- a/embed/index.php
+++ b/embed/index.php
@@ -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)));
diff --git a/includes/changes.json b/includes/changes.json
index 5928750..7eb74a4 100644
--- a/includes/changes.json
+++ b/includes/changes.json
@@ -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": {
diff --git a/includes/footer.php b/includes/footer.php
index 6cb79a9..dc379d4 100644
--- a/includes/footer.php
+++ b/includes/footer.php
@@ -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>
diff --git a/includes/functions.php b/includes/functions.php
index 7a0e758..17c81ed 100644
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -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'])))));
diff --git a/includes/header.php b/includes/header.php
index 96abcbd..bf5de78 100644
--- a/includes/header.php
+++ b/includes/header.php
@@ -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;
}
}
diff --git a/includes/jobs-handler.php b/includes/jobs-handler.php
index 8908728..b437a6b 100644
--- a/includes/jobs-handler.php
+++ b/includes/jobs-handler.php
@@ -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)); \ No newline at end of file
diff --git a/includes/linking.php b/includes/linking.php
index f149f75..5ca7223 100644
--- a/includes/linking.php
+++ b/includes/linking.php
@@ -23,6 +23,46 @@ function doLinking($text) {
})),
...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),
"name" => getNameFromId(substr($i, 0, -5))
];
diff --git a/includes/session.php b/includes/session.php
index b84678c..cd155af 100644
--- a/includes/session.php
+++ b/includes/session.php
@@ -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 {
diff --git a/lang/en.json b/lang/en.json
index 440012e..bd059fc 100644
--- a/lang/en.json
+++ b/lang/en.json
@@ -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"
}
} \ No newline at end of file
diff --git a/lang/fr.json b/lang/fr.json
index 5818880..f27ef34 100644
--- a/lang/fr.json
+++ b/lang/fr.json
@@ -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"
}
} \ No newline at end of file
diff --git a/login/index.php b/login/index.php
index 3cde374..ecba733 100644
--- a/login/index.php
+++ b/login/index.php
@@ -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");
diff --git a/request/save/index.php b/request/save/index.php
index 54f9bed..427f4df 100644
--- a/request/save/index.php
+++ b/request/save/index.php
@@ -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();
diff --git a/upload/index.php b/upload/index.php
deleted file mode 100644
index 3c81f4b..0000000
--- a/upload/index.php
+++ /dev/null
@@ -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(); \ No newline at end of file
diff --git a/version b/version
index 7a0ce1a..46584a8 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-5.0.0-eap5.10 \ No newline at end of file
+5.12.0-rc1 \ No newline at end of file