Updated 9 files and added 4 files (automated)
parent
7da58b75da
commit
3ce34ca7e1
@ -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 |
@ -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");
|
Loading…
Reference in New Issue