Updated 9 files and added 4 files (automated)

mane
Mia Raindrops 1 month ago
parent 7da58b75da
commit 3ce34ca7e1
Signed by: Mia Raindrops
GPG Key ID: EFBDC68435A574B7

@ -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="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/></svg>

After

Width:  |  Height:  |  Size: 198 B

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 96 960 960" width="48"><path d="M264 859q-27.5 0-47.25-19.431T197 792v-96h35v96q0 12 10 22t22 10h432q12 0 22-10t10-22v-96h35v96q0 28.138-19.75 47.569T696 859H264Zm217-158L339 559l25-23 99 98V271h35v363l99-98 26 23-142 142Z" fill="#000000"/></svg>

After

Width:  |  Height:  |  Size: 309 B

@ -50,6 +50,10 @@ $requests = array_reverse($data["requests"]);
<img src="/icons/report.svg" style="vertical-align: middle; width: 24px;<?= $id === $_USER ? "opacity:.5;" : "" ?>">
<span style="vertical-align: middle;"><?= l("lang_profile_report") ?></span>
</a></li>
<li><a class="dropdown-item <?= $id !== $_USER ? "disabled" : "" ?>" href="/download">
<img src="/icons/download.svg" style="vertical-align: middle; width: 24px;">
<span style="vertical-align: middle;"><?= l("lang_download_action") ?></span>
</a></li>
<li><a class="dropdown-item" href="/request/?type=<?= $id === $_USER ? "profile" : "profileother" ?>&id=<?= $id ?>">
<img src="/icons/edit.svg" style="vertical-align: middle; width: 24px;">
<span style="vertical-align: middle;"><?= l("lang_profile_request") ?></span>

@ -21,7 +21,7 @@ if (isset($id)) {
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/" . $id . ".json")) {
$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/" . $id . ".json")), true);
$title_pre = $data["title"];
$title_pre = getNameFromId($id);
} else {
header("Location: /");
die();
@ -42,7 +42,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/navigation.php";
<br><br>
<h1>
<?php if ($id !== $_USER): ?>
<span><?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/" . $id . ".json") ? $data["first_name"] . " " . $data["last_name"] : $data["title"] ?></span>
<span><?= getNameFromId($id) ?></span>
<span style="float: right;"><a href="/gallery/<?= $id ?>" class="btn btn-outline-dark"><?= l("lang_edit_cancel") ?></a></span>
<?php endif; ?>
</span>

@ -70,7 +70,7 @@ if (($request["type"] === "gallerymeta" || $request["type"] === "article" || $re
file_put_contents($file, pf_utf8_encode(json_encode($d)));
}
unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $id . ".json");
rename($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $id . ".json", $_SERVER['DOCUMENT_ROOT'] . "/includes/data/archive/" . $id . ".json");
header("Location: /admin");
die();

@ -42,10 +42,10 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $reques
}
if ($request["type"] === "galleryupload" && file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $id . ".jpg")) {
unlink($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $id . ".jpg");
rename($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $id . ".jpg", $_SERVER['DOCUMENT_ROOT'] . "/includes/data/olduploads/" . $id . ".jpg");
}
unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $id . ".json");
rename($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $id . ".json", $_SERVER['DOCUMENT_ROOT'] . "/includes/data/archive/" . $id . ".json");
header("Location: /admin");
die();

@ -0,0 +1,26 @@
<?php
$title = "lang_download_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";
global $unreadAlerts;
?>
<div class="container">
<br><br>
<h1><?= l("lang_download_title2") ?></h1>
<p><?= l("lang_download_intro_0") ?></p>
<p><?= l("lang_download_intro_1") ?></p>
<p><?= l("lang_download_intro_2") ?></p>
<a href="/download/start" onclick="this.classList.add('disabled');" class="btn btn-primary"><?= l("lang_download_start") ?></a>
<br><br>
</div>
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/footer.php"; ?>

@ -0,0 +1,121 @@
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $_PROFILE; global $_USER;
function recursive_rmdir($dir) {
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (is_dir($dir. DIRECTORY_SEPARATOR .$object) && !is_link($dir."/".$object))
recursive_rmdir($dir. DIRECTORY_SEPARATOR .$object);
else
unlink($dir. DIRECTORY_SEPARATOR .$object);
}
}
rmdir($dir);
}
}
$tempDir = "/tmp/delta-takeout-" . bin2hex(random_bytes(32));
mkdir($tempDir);
chdir($tempDir);
$name1 = l("lang_download_files_user");
$name2 = l("lang_download_files_requests");
$name3 = l("lang_download_files_gallery");
$name4 = l("lang_download_files_pending");
$name5 = l("lang_download_files_closed");
$name6 = l("lang_download_files_public");
$name7 = l("lang_download_files_deleted");
$name8 = l("lang_download_files_history");
$name9 = l("lang_download_files_profile");
$name10 = l("lang_download_files_avatar");
mkdir($name1);
mkdir($name2);
mkdir("$name2/$name4");
mkdir("$name2/$name5");
mkdir($name3);
mkdir("$name3/$name6");
mkdir("$name3/$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);
if ($data["author"] === $_USER) {
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"));
}
}
foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/archive"), 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/archive/" . $file), true);
if ($data["author"] === $_USER) {
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"));
}
}
file_put_contents("$name1/$name9.json", json_encode($_PROFILE, JSON_PRETTY_PRINT));
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history/" . $_USER . ".json")) {
file_put_contents("$name1/$name8.json", json_encode(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history/" . $_USER . ".json"), true), JSON_PRETTY_PRINT));
} else {
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"));
} else {
file_put_contents("$name1/$name10.jpg", "");
}
$zip = new ZipArchive;
$tmp_file = $tempDir . ".zip";
if ($zip->open($tmp_file, ZipArchive::CREATE)) {
foreach (array_filter(scandir($tempDir), function ($i) { return !str_starts_with($i, "."); }) as $file) {
if (is_dir($file)) {
$zip->addEmptyDir($file);
foreach (array_filter(scandir($tempDir . "/" . $file), function ($i) { return !str_starts_with($i, "."); }) as $file2) {
if (is_dir($file . "/" . $file2)) {
$zip->addEmptyDir($file . "/" . $file2);
foreach (array_filter(scandir($tempDir . "/" . $file . "/" . $file2), function ($i) { return !str_starts_with($i, "."); }) as $file3) {
$zip->addFile($file . "/" . $file2 . "/" . $file3, $file . "/" . $file2 . "/" . $file3);
}
} else {
$zip->addFile($file . "/" . $file2, $file . "/" . $file2);
}
}
} else {
$zip->addFile($file, $file);
}
}
$zip->close();
}
recursive_rmdir($tempDir);
header("Content-type: application/zip");
header("Content-Disposition: attachment; filename=" . str_replace("%1", $_PROFILE["first_name"] . " " . $_PROFILE["last_name"], l("lang_download_name")) . ".zip");
header("Content-length: " . filesize($tempDir . ".zip"));
header("Pragma: no-cache");
header("Expires: 0");
readfile($tempDir . ".zip");
unlink($tempDir . ".zip");

@ -11,7 +11,6 @@ set_error_handler(function($errno, $errstr, $errfile, $errline) {
});
$json = file_get_contents('php://input');
file_put_contents("/tmp/handoff.json", $json);
$obj = json_decode($json, true);
header("Content-Type: application/json");
@ -39,17 +38,22 @@ if (isset($_PROFILE) && isset($data["session"])) {
$GLOBALS["dump"][] = $users;
$userData = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $user)), true);
$userData["devices"] = array_values(array_filter($userData["devices"], function ($i) use ($data) {
return $i !== $data["session"];
return $i["token"] !== $data["session"];
}));
while (trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $user)) === "") {}
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $user, pf_utf8_encode(json_encode($userData, JSON_PRETTY_PRINT)));
}
$_PROFILE["devices"][] = $data["session"];
$_PROFILE["devices"][] = [
"token" => $data["session"],
"date" => date('c')
];
} else {
die(json_encode([
"error" => "Not updated"
]));
foreach ($_PROFILE["devices"] as $index => $device) {
if ($device["token"] === $data["session"]) {
$_PROFILE["devices"][$index]["date"] = date('c');
}
}
}
saveProfile();

@ -13,16 +13,16 @@ function sendCode($email, $code) {
$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host = 'in-v3.mailjet.com';
$mail->Host = 'smtp-relay.sendinblue.com';
$mail->SMTPAuth = true;
$mail->Username = $emailConfig["username"];
$mail->Password = $emailConfig["password"];
$mail->SMTPSecure = "none";
$mail->Port = 587;
$mail->setFrom('delta@auto.minteck.org', 'Delta');
$mail->setFrom('delta@apps.equestria.dev', 'Delta');
$mail->addAddress($email);
$mail->addReplyTo('contact@minteck.org', 'Equestria.dev');
$mail->addReplyTo(trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/email")), 'Equestria.dev');
$mail->isHTML();
$mail->Subject = l("lang_email_code_title");
@ -64,16 +64,16 @@ function sendPlanUpdate($email, $plan) {
$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host = 'in-v3.mailjet.com';
$mail->Host = 'smtp-relay.sendinblue.com';
$mail->SMTPAuth = true;
$mail->Username = $emailConfig["username"];
$mail->Password = $emailConfig["password"];
$mail->SMTPSecure = "none";
$mail->Port = 587;
$mail->setFrom('delta@auto.minteck.org', 'Delta');
$mail->setFrom('delta@apps.equestria.dev', 'Delta');
$mail->addAddress($email);
$mail->addReplyTo('contact@minteck.org', 'Equestria.dev');
$mail->addReplyTo(trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/email")), 'Equestria.dev');
$mail->isHTML();
$mail->Subject = l("lang_email_plan_title");
@ -95,16 +95,16 @@ function sendAlerts($email, $alerts) {
$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host = 'in-v3.mailjet.com';
$mail->Host = 'smtp-relay.sendinblue.com';
$mail->SMTPAuth = true;
$mail->Username = $emailConfig["username"];
$mail->Password = $emailConfig["password"];
$mail->SMTPSecure = "none";
$mail->Port = 587;
$mail->setFrom('delta@auto.minteck.org', 'Delta');
$mail->setFrom('delta@apps.equestria.dev', 'Delta');
$mail->addAddress($email);
$mail->addReplyTo('contact@minteck.org', 'Equestria.dev');
$mail->addReplyTo(trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/email")), 'Equestria.dev');
$mail->isHTML();
@ -138,16 +138,16 @@ function sendLogin($email) {
$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host = 'in-v3.mailjet.com';
$mail->Host = 'smtp-relay.sendinblue.com';
$mail->SMTPAuth = true;
$mail->Username = $emailConfig["username"];
$mail->Password = $emailConfig["password"];
$mail->SMTPSecure = "none";
$mail->Port = 587;
$mail->setFrom('delta@auto.minteck.org', 'Delta');
$mail->setFrom('delta@apps.equestria.dev', 'Delta');
$mail->addAddress($email);
$mail->addReplyTo('contact@minteck.org', 'Equestria.dev');
$mail->addReplyTo(trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/email")), 'Equestria.dev');
$mail->isHTML();
$mail->Subject = l("lang_email_login_title");

@ -102,6 +102,36 @@ foreach ($list as $file) {
$data["last_blocked"] = $data["blocked"];
}
if (count($data["devices"]) > 0) {
println(" Old devices removal");
$removed = 0;
foreach ($data["devices"] as $index => $device) {
if (time() - strtotime($device["date"]) > 86400*30) {
$removed++;
unset($data["devices"][$index]);
}
}
println(" Removed " . $removed . " device(s)");
}
println(" Old sessions removal");
$removed = 0;
foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens"), function ($i) { return !str_starts_with($i, "."); }) as $token) {
$tokenData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token), true);
if ($tokenData["user"] === substr($file, 0, -5)) {
if (time() - strtotime($tokenData["date"]) >= 86400 * 90) {
$removed++;
unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token);
}
}
}
println(" Removed " . $removed . " session(s)");
if ($data["plus"]) {
println(" Subscription renewal");
@ -213,4 +243,26 @@ foreach ($list as $file) {
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/$file", pf_utf8_encode(json_encode($data, JSON_PRETTY_PRINT)));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/users.json", pf_utf8_encode(json_encode($users, JSON_PRETTY_PRINT)));
}
}
println("Cleaning up support codes...");
$support = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/supportcodes.json"), true);
foreach ($support as $index => $code) {
if (time() - strtotime($code["date"]) > 86400*14) {
unset($support[$index]);
}
}
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/supportcodes.json", json_encode($support, JSON_PRETTY_PRINT));
println("Cleaning up login codes...");
$codes = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/codes.json"), true);
foreach ($codes as $name => $code) {
if (time() - strtotime($code["date"]) > 900) {
unset($codes[$name]);
}
}
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/codes.json", json_encode($codes, JSON_PRETTY_PRINT));

@ -746,5 +746,29 @@
"admin": "Delta staff",
"eap": "Early supporter",
"hunter": "Delta bug hunters"
},
"download": {
"action": "Download data",
"title": "Download personal data",
"title2": "Download a copy of your personal data",
"intro": [
"Following the European General Data Protection Regulation, Delta gives you the option to download a copy of all your personal data. This includes your profile, the edits you made, your browsing history, and more.",
"Note, however, that we cannot guarantee the data you receive will be easy to read for non-tech savvy people. If you need help reading your data from what you downloaded, you can contact the administrators. Once your data is exported, you cannot upload it back to Delta. If you need to make changes to your personal data, do it yourself or contact the administrators so they can do it for you.",
"Gathering all the bits of data for you might take a while, so be patient."
],
"start": "Start downloading",
"files": {
"user": "User info",
"requests": "Change requests",
"gallery": "Gallery uploads",
"pending": "Pending",
"closed": "Closed",
"public": "Public",
"deleted": "Deleted",
"history": "History",
"profile": "Profile info",
"avatar": "Profile picture"
},
"name": "Delta data export for %1"
}
}

@ -746,5 +746,29 @@
"admin": "Personnel Delta",
"eap": "Accès anticipé",
"hunter": "Chasseurs de bugs Delta"
},
"download": {
"action": "Télécharger les données",
"title": "Télécharger les données personnelles",
"title2": "Télécharger une copie de vos données personnelles",
"intro": [
"Conformément au Règlement Général sur la Protection des Données de l'Union européenne, Delta vous fournit une option pour télécharger toutes vos données personnelles. Cela inclut votre profil, les modifications que vous avez fait, votre historique de navigation, et plus.",
"Notez, cependant, que nous ne pouvons pas garantir que ces données sont facilement lisibles pour des personnes non-expertes. Si vous avez besoin d'aide pour lire les données que vous téléchargez, vous pouvez contacter les administrateurs. Une fois vos données exportées, vous ne pouvez pas les importer à nouveau sur Delta. Si vous voulez apporter des modifications à vos données personnelles, faites le vous-même ou contactez les administrateurs pour le faire à votre place.",
"Récupérer tous les morceaux de données pour vous peut prendre un certain temps, alors soyez patient·e."
],
"start": "Commencer le téléchargement",
"files": {
"user": "Informations utilisateur",
"requests": "Demandes de changement",
"gallery": "Images de galerie",
"pending": "En attente",
"closed": "Fermées",
"public": "Publiques",
"deleted": "Supprimées",
"history": "Historique",
"profile": "Informations de profil",
"avatar": "Photo de profil"
},
"name": "Export de données Delta pour %1"
}
}
Loading…
Cancel
Save