Updated 26 files and added router.php (automated)

mane
Mia Raindrops 2 months ago
parent 28fca88e2c
commit ee7daaafbd
Signed by: Mia Raindrops
GPG Key ID: EFBDC68435A574B7

@ -16,7 +16,7 @@ if (isset($id)) {
die();
}
$data = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/articles/" . $id . ".json")), true);
$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/articles/" . $id . ".json")), true);
$title_pre = $data["title"];
$title = "lang_articles_title";
@ -46,7 +46,7 @@ if (!isset($id)):
?>
<div class="list-group">
<?php foreach ($articles as $person): $data = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/articles/" . $person)), true); ?>
<?php foreach ($articles as $person): $data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/articles/" . $person)), true); ?>
<a href="/articles/<?= explode(".", $person)[0] ?>" class="list-group-item list-group-item-action"><?= $data["title"] ?></a>
<?php endforeach; ?>
</div>

@ -22,13 +22,13 @@ if (isset($id)) {
}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/" . $id . ".json")) {
$data = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/" . $id . ".json")), true);
$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/" . $id . ".json")), true);
$title_pre = $data["first_name"] . " " . $data["last_name"];
} else if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/articles/" . $id . ".json")) {
$data = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/articles/" . $id . ".json")), true);
$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/articles/" . $id . ".json")), true);
$title_pre = $data["title"];
} else if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/" . $id . ".json")) {
$data = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/" . $id . ".json")), true);
$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/" . $id . ".json")), true);
$title_pre = $data["title"];
} else {
$self = true;
@ -134,7 +134,7 @@ if (!isset($_PROFILE["requests"][$id])):
<p><b><?= l("lang_edit_alert_title") ?></b></p>
<?php
$request = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $_PROFILE["requests"][$id] . ".json")), true);
$request = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $_PROFILE["requests"][$id] . ".json")), true);
?>
<p><?= str_replace("%1", timeAgo($request["date"]), l("lang_edit_alert_message")) ?></p>

@ -30,7 +30,7 @@ $rid = uuid();
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/" . $id . ".json")) {
if ($_PROFILE["blocked"] >= $blockLevel) die();
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $rid . ".json", utf8_encode(json_encode([
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $rid . ".json", pf_utf8_encode(json_encode([
"type" => "userpage",
"author" => $_USER,
"id" => $id,
@ -41,7 +41,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/" . $id . ".j
} elseif (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/articles/" . $id . ".json")) {
if ($_PROFILE["blocked"] >= $blockLevel) die();
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $rid . ".json", utf8_encode(json_encode([
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $rid . ".json", pf_utf8_encode(json_encode([
"type" => "article",
"author" => $_USER,
"id" => $id,
@ -52,7 +52,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/" . $id . ".j
} elseif (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/" . $id . ".json")) {
if ($_PROFILE["blocked"] >= $blockLevel) die();
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $rid . ".json", utf8_encode(json_encode([
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $rid . ".json", pf_utf8_encode(json_encode([
"type" => "gallerymeta",
"author" => $_USER,
"id" => $id,

@ -16,7 +16,7 @@ if (isset($id)) {
die();
}
$data = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/" . $id . ".json")), true);
$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/" . $id . ".json")), true);
$title_pre = $data["title"];
$title = "lang_gallery_title";
@ -46,7 +46,7 @@ if (!isset($id)):
?>
<div class="list-group">
<?php foreach ($articles as $person): $data = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/" . $person)), true); ?>
<?php foreach ($articles as $person): $data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/" . $person)), true); ?>
<a href="/gallery/<?= explode(".", $person)[0] ?>" class="list-group-item list-group-item-action"><?= $data["title"] ?></a>
<?php endforeach; ?>
</div>

@ -1,5 +1,7 @@
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.php";
$id = array_values(array_filter(array_keys($_GET), function ($i) {
return str_starts_with($i, "/") && strlen($i) > 1;
}))[0] ?? null;
@ -16,7 +18,7 @@ if (isset($id)) {
die();
}
$data = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/" . $id . ".json")), true);
$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/" . $id . ".json")), true);
$title_pre = $data["first_name"] . " " . $data["last_name"];
$title = "lang_people_title";
@ -46,7 +48,7 @@ if (!isset($id)):
?>
<div class="list-group">
<?php foreach ($people as $person): $data = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/" . $person)), true); ?>
<?php foreach ($people as $person): $data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/" . $person)), true); ?>
<a href="/people/<?= explode(".", $person)[0] ?>" class="list-group-item list-group-item-action"><?= $data["first_name"] . " " . $data["last_name"] ?></a>
<?php endforeach; ?>
</div>
@ -169,7 +171,7 @@ if (!isset($id)):
$text = "<code class='text-danger'>" . $nid . "</code>";
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/" . $nid . ".json")) {
$d = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/" . $nid . ".json")), true);
$d = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/" . $nid . ".json")), true);
$text = $d["first_name"] . " " . $d["last_name"];
}

@ -18,7 +18,7 @@ if (isset($id)) {
die();
}
$data = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $id . ".json")), true);
$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $id . ".json")), true);
$title_pre = $data["nick_name"] ?? $data["first_name"] . " " . $data["last_name"];
$title = "lang_profile_title";

@ -20,7 +20,7 @@ if (isset($id)) {
}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/" . $id . ".json")) {
$data = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/" . $id . ".json")), true);
$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/" . $id . ".json")), true);
$title_pre = $data["title"];
} else {
header("Location: /");

@ -56,7 +56,7 @@ switch ($_FILES["file"]["type"]) {
imagejpeg($im, $_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $uuid . ".jpg");
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $uuid . ".json", utf8_encode(json_encode([
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $uuid . ".json", pf_utf8_encode(json_encode([
"type" => "galleryupload",
"author" => $_USER,
"id" => $id,

@ -17,12 +17,12 @@ if (isset($id)) {
die();
}
$request = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $id . ".json")), true);
$request = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $id . ".json")), true);
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json")) {
while (trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json")) === "") {}
$profile = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json")), true);
$profile = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json")), true);
loadLang(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/lang/" . $profile["language"] . ".json"), true), "lang");
$index = array_search($id, $profile["requests"]);
@ -38,12 +38,12 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $reques
"read" => false
];
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json", utf8_encode(json_encode($profile, JSON_PRETTY_PRINT)));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json", pf_utf8_encode(json_encode($profile, JSON_PRETTY_PRINT)));
}
if ($request["type"] === "galleryupload" && !isset($_GET['mark'])) {
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/" . $request["id"] . ".json")) {
$gallery = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/" . $request["id"] . ".json")), true);
$gallery = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/" . $request["id"] . ".json")), true);
$gallery["images"][] = [
"id" => $id,
"author" => $request["author"],
@ -52,7 +52,7 @@ if ($request["type"] === "galleryupload" && !isset($_GET['mark'])) {
$gallery["update"] = date('c');
$gallery["update_user"] = $request["author"];
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/" . $request["id"] . ".json", utf8_encode(json_encode($gallery)));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/" . $request["id"] . ".json", pf_utf8_encode(json_encode($gallery)));
}
}
@ -62,12 +62,12 @@ if (($request["type"] === "gallerymeta" || $request["type"] === "article" || $re
if ($request["type"] === "article") $file = $_SERVER['DOCUMENT_ROOT'] . "/includes/data/articles/" . $request["id"] . ".json";
if ($request["type"] === "userpage") $file = $_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/" . $request["id"] . ".json";
$d = json_decode(utf8_decode(file_get_contents($file)), true);
$d = json_decode(pf_utf8_decode(file_get_contents($file)), true);
$d["contents"] = $request["contents"];
$d["update"] = date('c');
$d["update_user"] = $request["author"];
file_put_contents($file, utf8_encode(json_encode($d)));
file_put_contents($file, pf_utf8_encode(json_encode($d)));
}
unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $id . ".json");

@ -21,7 +21,7 @@ if (isset($_GET["skel"])) {
$d["update"] = date('c');
$d["update_user"] = $_USER;
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $_GET["skel"] . "/" . $id . ".json", utf8_encode(json_encode(json_decode($_POST["contents"]), JSON_PRETTY_PRINT)));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $_GET["skel"] . "/" . $id . ".json", pf_utf8_encode(json_encode(json_decode($_POST["contents"]), JSON_PRETTY_PRINT)));
header("Location: /admin/edit/?id=$id");
die();
} else {

@ -35,7 +35,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/navigation.php";
<form action="/admin/edit/save/?id=<?= $_GET['id'] ?>" method="post">
<p>
<textarea name="contents" style="width: 100%; max-height: 90vh; resize: none; outline: none; font-family: monospace;" rows="15"><?= $_POST["contents"] ?? json_encode(json_decode(utf8_decode(file_get_contents(getFileFromId($_GET['id'])))), JSON_PRETTY_PRINT) ?></textarea>
<textarea name="contents" style="width: 100%; max-height: 90vh; resize: none; outline: none; font-family: monospace;" rows="15"><?= $_POST["contents"] ?? json_encode(json_decode(pf_utf8_decode(file_get_contents(getFileFromId($_GET['id'])))), JSON_PRETTY_PRINT) ?></textarea>
</p>
<p>

@ -17,7 +17,7 @@ if (isset($_GET["id"])) {
die();
} else {
if (isJson($_POST["contents"])) {
file_put_contents(getFileFromId($_GET["id"]), utf8_encode(json_encode(json_decode($_POST["contents"]), JSON_PRETTY_PRINT)));
file_put_contents(getFileFromId($_GET["id"]), pf_utf8_encode(json_encode(json_decode($_POST["contents"]), JSON_PRETTY_PRINT)));
header("Location: /admin/edit/?id=$_GET[id]");
die();
} else {

@ -12,7 +12,7 @@ foreach (array_filter(scandir($_SERVER["DOCUMENT_ROOT"] . "/includes/data/articl
$keys[] = [
"type" => "articles",
"id" => $id,
"name" => json_decode(utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/articles/" . $_id)), true)["title"] ?? null
"name" => json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/articles/" . $_id)), true)["title"] ?? null
];
}
@ -21,7 +21,7 @@ foreach (array_filter(scandir($_SERVER["DOCUMENT_ROOT"] . "/includes/data/galler
$keys[] = [
"type" => "gallery",
"id" => $id,
"name" => json_decode(utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/gallery/" . $_id)), true)["title"] ?? null
"name" => json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/gallery/" . $_id)), true)["title"] ?? null
];
}
@ -30,7 +30,7 @@ foreach (array_filter(scandir($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people
$keys[] = [
"type" => "people",
"id" => $id,
"name" => json_decode(utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $_id)), true)["nick_name"] ?? (isset(json_decode(utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $_id)), true)["first_name"]) && isset(json_decode(utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $_id)), true)["last_name"]) ? json_decode(utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $_id)), true)["first_name"] . " " . json_decode(utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $_id)), true)["last_name"] : null)
"name" => json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $_id)), true)["nick_name"] ?? (isset(json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $_id)), true)["first_name"]) && isset(json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $_id)), true)["last_name"]) ? json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $_id)), true)["first_name"] . " " . json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $_id)), true)["last_name"] : null)
];
}
@ -39,7 +39,7 @@ foreach (array_filter(scandir($_SERVER["DOCUMENT_ROOT"] . "/includes/data/profil
$keys[] = [
"type" => "profiles",
"id" => $id,
"name" => json_decode(utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/profiles/" . $_id)), true)["nick_name"] ?? (isset(json_decode(utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/profiles/" . $_id)), true)["first_name"]) && isset(json_decode(utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/profiles/" . $_id)), true)["last_name"]) ? json_decode(utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/profiles/" . $_id)), true)["first_name"] . " " . json_decode(utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/profiles/" . $_id)), true)["last_name"] : null)
"name" => json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/profiles/" . $_id)), true)["nick_name"] ?? (isset(json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/profiles/" . $_id)), true)["first_name"]) && isset(json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/profiles/" . $_id)), true)["last_name"]) ? json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/profiles/" . $_id)), true)["first_name"] . " " . json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/profiles/" . $_id)), true)["last_name"] : null)
];
}
@ -67,36 +67,36 @@ usort($keys, function ($a, $b) {
$requestsNonPlus = array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests"), function ($i) { return !str_starts_with($i, "."); });
$requestsNonPlus = array_values(array_filter($requestsNonPlus, function ($i) {
$request = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/$i")), true);
$adata = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json")), true);
$request = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/$i")), true);
$adata = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json")), true);
return !$adata["plus"];
}));
usort($requestsNonPlus, function ($a, $b) {
return strtotime(json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/$a")), true)["date"]) - strtotime(json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/$b")), true)["date"]);
return strtotime(json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/$a")), true)["date"]) - strtotime(json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/$b")), true)["date"]);
});
$requestsPlus = array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests"), function ($i) { return !str_starts_with($i, "."); });
$requestsPlus = array_values(array_filter($requestsPlus, function ($i) {
$request = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/$i")), true);
$adata = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json")), true);
$request = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/$i")), true);
$adata = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json")), true);
return $adata["plus"];
}));
usort($requestsPlus, function ($a, $b) {
return strtotime(json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/$a")), true)["date"]) - strtotime(json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/$b")), true)["date"]);
return strtotime(json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/$a")), true)["date"]) - strtotime(json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/$b")), true)["date"]);
});
$requests = [...array_map(function ($i) {
$id = $i;
$i = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/$i")), true);
$i = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/$i")), true);
$i["_id"] = explode(".", $id)[0];
$i["_plus"] = true;
return $i;
}, $requestsPlus), ...array_map(function ($i) {
$id = $i;
$i = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/$i")), true);
$i = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/$i")), true);
$i["_id"] = explode(".", $id)[0];
$i["_plus"] = false;
return $i;
@ -108,13 +108,13 @@ usort($keys, function ($a, $b) {
<div class="list-group">
<?php foreach ($requests as $request): ?>
<details class="list-group-item list-group-item-action <?= $request["_plus"] ? "list-group-item-warning" : "" ?>">
<summary><?= json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/lang/en.json"), true)["request"]["types"][$request["type"]] ?> (<?php if (isset($request["id"]) && trim($request["id"]) !== "" && $request["id"] !== $request["author"]): ?>on <a href="/<?= str_starts_with("gallery", $request["type"]) ? "gallery" : ($request["type"] === "userpage" ? "people" : "article") ?>/<?= $request["id"] ?>" target="_blank"><?= getNameFromId($request["id"]) ?></a>; <?php endif; ?>from <a href="/profile/<?= $request["author"] ?>" target="_blank"><?php $adata = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json")), true); ?> <?= isset($adata["nick_name"]) && trim($adata["nick_name"]) !== "" ? $adata["nick_name"] : $adata["first_name"] . " " . $adata["last_name"] ?></a>; <?= timeAgo($request["date"]) ?>)</summary>
<summary><?= json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/lang/en.json"), true)["request"]["types"][$request["type"]] ?> (<?php if (isset($request["id"]) && trim($request["id"]) !== "" && $request["id"] !== $request["author"]): ?>on <a href="/<?= str_starts_with("gallery", $request["type"]) ? "gallery" : ($request["type"] === "userpage" ? "people" : "article") ?>/<?= $request["id"] ?>" target="_blank"><?= getNameFromId($request["id"]) ?></a>; <?php endif; ?>from <a href="/profile/<?= $request["author"] ?>" target="_blank"><?php $adata = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json")), true); ?> <?= isset($adata["nick_name"]) && trim($adata["nick_name"]) !== "" ? $adata["nick_name"] : $adata["first_name"] . " " . $adata["last_name"] ?></a>; <?= timeAgo($request["date"]) ?>)</summary>
<div class="list-group-item" style="margin-top: 10px;">
<p>
<b>ID:</b> <?= $request["_id"] ?><br>
<b>Publish date:</b> <?= date('r', strtotime($request["date"])) ?><br>
<b>User:</b> <?php $adata = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json")), true); ?> <?= isset($adata["nick_name"]) && trim($adata["nick_name"]) !== "" ? $adata["nick_name"] : $adata["first_name"] . " " . $adata["last_name"] ?> (<?= $request["author"] ?>)<br>
<b>User:</b> <?php $adata = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json")), true); ?> <?= isset($adata["nick_name"]) && trim($adata["nick_name"]) !== "" ? $adata["nick_name"] : $adata["first_name"] . " " . $adata["last_name"] ?> (<?= $request["author"] ?>)<br>
<b>Target:</b> <?= isset($request["id"]) && trim($request["id"]) !== "" && $request["id"] !== $request["author"] ? getNameFromId($request["id"]) . " (" . $request["id"] . ")" : "<span class='text-muted'>Not applicable</span>" ?><br>
<b>Summary:</b> <?= isset($request["summary"]) && trim($request["summary"]) !== "" ? strip_tags($request["summary"]) : "<span class='text-muted'>Not applicable</span>" ?>
</p>

@ -17,12 +17,12 @@ if (isset($id)) {
die();
}
$request = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $id . ".json")), true);
$request = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $id . ".json")), true);
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json")) {
while (trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json")) === "") {}
$profile = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json")), true);
$profile = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json")), true);
loadLang(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/lang/" . $profile["language"] . ".json"), true), "lang");
$index = array_search($id, $profile["requests"]);
@ -38,7 +38,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $reques
"read" => false
];
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json", utf8_encode(json_encode($profile, JSON_PRETTY_PRINT)));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json", pf_utf8_encode(json_encode($profile, JSON_PRETTY_PRINT)));
}
if ($request["type"] === "galleryupload" && file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $id . ".jpg")) {

@ -18,7 +18,7 @@ global $_PROFILE;
$list = [];
foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/articles"), function ($i) { return !str_starts_with($i, "."); }) as $id) {
$data = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/articles/$id")), true);
$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/articles/$id")), true);
$id = substr($id, 0, -5);
$data["_type"] = "articles";
@ -28,7 +28,7 @@ global $_PROFILE;
}
foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery"), function ($i) { return !str_starts_with($i, "."); }) as $id) {
$data = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/$id")), true);
$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/$id")), true);
$id = substr($id, 0, -5);
$data["_type"] = "gallery";
@ -38,7 +38,7 @@ global $_PROFILE;
}
foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people"), function ($i) { return !str_starts_with($i, "."); }) as $id) {
$data = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/$id")), true);
$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/$id")), true);
$id = substr($id, 0, -5);
$data["_type"] = "people";

@ -37,12 +37,12 @@ if (isset($_PROFILE) && isset($data["session"])) {
if (!in_array($data["session"], $_PROFILE["devices"])) {
foreach ($users as $user) {
$GLOBALS["dump"][] = $users;
$userData = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $user)), true);
$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"];
}));
while (trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $user)) === "") {}
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $user, utf8_encode(json_encode($userData, JSON_PRETTY_PRINT)));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $user, pf_utf8_encode(json_encode($userData, JSON_PRETTY_PRINT)));
}
$_PROFILE["devices"][] = $data["session"];

@ -2,6 +2,14 @@
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/lang.php";
function pf_utf8_decode(string $string): string {
return iconv("UTF-8", "ISO-8859-1", $string);
}
function pf_utf8_encode(string $string): string {
return iconv("ISO-8859-1", "UTF-8", $string);
}
function initLang(): void {
if (isset($_PROFILE) && isset($_PROFILE["language"])) {
genLang("en");
@ -155,7 +163,7 @@ function timeAgo($time, $showTense = true, $strict = false, $daysOnly = false):
function resolveUser($id) {
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $id . ".json")) {
$p = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $id . ".json")), true);
$p = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $id . ".json")), true);
if (isset($p["nick_name"]) && trim($p["nick_name"]) !== "") {
return $p["nick_name"];
@ -264,13 +272,13 @@ function formatDate($date, $withYear = true) {
function getNameFromId($id) {
if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $id . ".json")) {
return json_decode(utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $id . ".json")), true)["first_name"] . " " . json_decode(utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $id . ".json")), true)["last_name"];
return json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $id . ".json")), true)["first_name"] . " " . json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/people/" . $id . ".json")), true)["last_name"];
} elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . "/includes/data/gallery/" . $id . ".json")) {
return json_decode(utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/gallery/" . $id . ".json")), true)["title"];
return json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/gallery/" . $id . ".json")), true)["title"];
} elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . "/includes/data/articles/" . $id . ".json")) {
return json_decode(utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/articles/" . $id . ".json")), true)["title"];
return json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/articles/" . $id . ".json")), true)["title"];
} elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . "/includes/data/profiles/" . $id . ".json")) {
$d = json_decode(utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/profiles/" . $id . ".json")), true);
$d = json_decode(pf_utf8_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/includes/data/profiles/" . $id . ".json")), true);
return $d["nick_name"] ?? $d["first_name"] . " " . $d["last_name"];
}

@ -16,7 +16,7 @@ $price = (float)trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/plusprice")
$list = array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles"), function ($i) { return !str_starts_with($i, "."); });
foreach ($list as $file) {
$data = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/$file")), true);
$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/$file")), true);
genLang($data["language"]);
println($data["first_name"], " ", $data["last_name"]);
@ -211,6 +211,6 @@ foreach ($list as $file) {
}
}
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/$file", utf8_encode(json_encode($data, JSON_PRETTY_PRINT)));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/users.json", utf8_encode(json_encode($users, JSON_PRETTY_PRINT)));
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)));
}

@ -1,18 +1,20 @@
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.php";
global $_USER;
global $_PROFILE;
if (isset($_COOKIE["DeltaSession"])) {
if (preg_match("/^[a-zA-Z0-9]*$/m", $_COOKIE['DeltaSession']) !== false) {
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $_COOKIE['DeltaSession'])) {
$_SessionCheck_Data = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $_COOKIE['DeltaSession'])), true);
$_SessionCheck_Data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $_COOKIE['DeltaSession'])), true);
if (time() - strtotime($_SessionCheck_Data["date"]) < 86400 * 90) {
$_USER = $_SessionCheck_Data["user"];
while (trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $_SessionCheck_Data["user"] . ".json")) === "") {}
$_PROFILE = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $_SessionCheck_Data["user"] . ".json")), true);
$_PROFILE = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $_SessionCheck_Data["user"] . ".json")), true);
if (isset($api)) $data["loggedIn"] = true;
@ -55,7 +57,7 @@ function saveProfile(): void {
while (trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $_USER . ".json")) === "") {}
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $_USER . ".json", utf8_encode(json_encode($_PROFILE, JSON_PRETTY_PRINT)));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $_USER . ".json", pf_utf8_encode(json_encode($_PROFILE, JSON_PRETTY_PRINT)));
}
$userLang = $_COOKIE["DeltaLanguage"] ?? substr($_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? "en", 0, 2);
@ -73,10 +75,10 @@ if (!isset($api) && date('d-m-Y') !== date('d-m-Y', strtotime($_PROFILE["last_se
function addToUserHistory($id) {
global $_USER;
if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history/" . $_USER . ".json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history/" . $_USER . ".json", utf8_encode("{}"));
if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history/" . $_USER . ".json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history/" . $_USER . ".json", pf_utf8_encode("{}"));
while (trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history/" . $_USER . ".json")) === "") {}
$history = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history/" . $_USER . ".json")), true);
$history = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history/" . $_USER . ".json")), true);
if (isset($history[$id])) {
$history[$id]++;
@ -84,5 +86,5 @@ function addToUserHistory($id) {
$history[$id] = 1;
}
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history/" . $_USER . ".json", utf8_encode(json_encode($history, JSON_PRETTY_PRINT)));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history/" . $_USER . ".json", pf_utf8_encode(json_encode($history, JSON_PRETTY_PRINT)));
}

@ -34,7 +34,7 @@ function showPage($item) { ?>
<?php
$birthdays = array_values(array_filter(array_map(function ($i) {
$r = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/$i")), true);
$r = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/$i")), true);
$r["_id"] = substr($i, 0, -5);
return $r;
}, array_values(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles"), function ($i) { return str_ends_with($i, ".json"); }))), function ($i) {
@ -71,7 +71,7 @@ function showPage($item) { ?>
<?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history/" . $_USER . ".json")):
$history = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history/" . $_USER . ".json")), true);
$history = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history/" . $_USER . ".json")), true);
if (count(array_keys($history)) > 0):
@ -104,7 +104,7 @@ function showPage($item) { ?>
$list = [];
foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/articles"), function ($i) { return !str_starts_with($i, "."); }) as $id) {
$data = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/articles/$id")), true);
$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/articles/$id")), true);
$id = substr($id, 0, -5);
$data["_type"] = "articles";
@ -114,7 +114,7 @@ function showPage($item) { ?>
}
foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery"), function ($i) { return !str_starts_with($i, "."); }) as $id) {
$data = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/$id")), true);
$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gallery/$id")), true);
$id = substr($id, 0, -5);
$data["_type"] = "gallery";
@ -124,7 +124,7 @@ function showPage($item) { ?>
}
foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people"), function ($i) { return !str_starts_with($i, "."); }) as $id) {
$data = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/$id")), true);
$data = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/people/$id")), true);
$id = substr($id, 0, -5);
$data["_type"] = "people";

@ -14,7 +14,7 @@ function encode($string) {
return preg_replace("/[^a-zA-Z0-9.]/m", "", base64_encode($string));
}
$users = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/users.json")), true);
$users = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/users.json")), true);
if (isset($_POST["p"]) && $_POST["p"] === "1") {
if (in_array($_POST["email"], array_keys($users))) {
@ -26,7 +26,7 @@ if (isset($_POST["p"]) && $_POST["p"] === "1") {
$code = substr(hexdec(bin2hex(openssl_random_pseudo_bytes(6))), 0, 10);
if (!$error) {
$list = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/codes.json")), true);
$list = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/codes.json")), true);
$list[$code] = [
"date" => date('c'),
"email" => $_POST["email"],
@ -35,10 +35,10 @@ if (isset($_POST["p"]) && $_POST["p"] === "1") {
sendCode($_POST["email"], $code);
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/codes.json", utf8_encode(json_encode($list)));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/codes.json", pf_utf8_encode(json_encode($list)));
}
} elseif (isset($_POST["p"]) && $_POST["p"] === "2") {
$list = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/codes.json")), true);
$list = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/codes.json")), true);
if (in_array($_POST['code'], array_keys($list)) && $list[$_POST['code']]["email"] === $_POST["email"]) {
if (time() - strtotime($list[$_POST['code']]["date"]) > 900) {
@ -47,14 +47,14 @@ if (isset($_POST["p"]) && $_POST["p"] === "1") {
sendLogin($_POST["email"]);
$token = encode(openssl_random_pseudo_bytes(128));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token, utf8_encode(json_encode([
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token, pf_utf8_encode(json_encode([
"user" => $users[$_POST["email"]],
"date" => date('c')
])));
$_USER = $users[$_POST["email"]];
setcookie("DeltaSession", $token, time() + (86400 * 90), "/", "", false, true);
unset($list[$_POST['code']]);
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/codes.json", utf8_encode(json_encode($list)));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/codes.json", pf_utf8_encode(json_encode($list)));
$step = 2;
}
} else {
@ -131,7 +131,7 @@ $title = "lang_login_title"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes
<input type="submit" class="btn btn-primary" value="<?= l("lang_login_continue") ?>">
</form>
<?php endif; ?>
<?php else: global $_USER; $user = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $_USER . ".json")), true); ?>
<?php else: global $_USER; $user = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $_USER . ".json")), true); ?>
<img src="/icons/finish.svg" style="width: 48px; margin-bottom: 10px;">
<p><b><?= str_replace('%1', $user["nick_name"] ?? $user["first_name"] . " " . $user["last_name"], l("lang_login_back")) ?></b></p>
<p><?= l("lang_login_done") ?></p>

@ -55,7 +55,7 @@ if (!isset($_PROFILE["requests"]["r:" . $_GET['id']])):
<p><b><?= l("lang_edit_alert_title") ?></b></p>
<?php
$request = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $_PROFILE["requests"]["r:" . $_GET['id']] . ".json")), true);
$request = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $_PROFILE["requests"]["r:" . $_GET['id']] . ".json")), true);
?>
<p><?= str_replace("%1", timeAgo($request["date"]), l("lang_edit_alert_message")) ?></p>

@ -17,7 +17,7 @@ if (isset($_PROFILE["requests"]["r:" . $id]) || !isset($description)) {
}
$rid = uuid();
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $rid . ".json", utf8_encode(json_encode([
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $rid . ".json", pf_utf8_encode(json_encode([
"type" => $type,
"author" => $_USER,
"id" => $id,

@ -19,14 +19,14 @@ if (isset($id)) {
die();
}
$request = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $id . ".json")), true);
$request = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/" . $id . ".json")), true);
if ($request["author"] !== $_USER) die();
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json")) {
while (trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json")) === "") {}
$profile = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json")), true);
$profile = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json")), true);
loadLang(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/lang/" . $profile["language"] . ".json"), true), "lang");
$index = array_search($id, $profile["requests"]);
@ -35,7 +35,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $reques
unset($profile["requests"][$index]);
}
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json", utf8_encode(json_encode($profile, JSON_PRETTY_PRINT)));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/profiles/" . $request["author"] . ".json", pf_utf8_encode(json_encode($profile, JSON_PRETTY_PRINT)));
}
if ($request["type"] === "galleryupload" && file_exists($_SERVER['DOCUMENT_ROOT'] . "/uploads/" . $id . ".jpg")) {

@ -9,12 +9,12 @@ global $_PROFILE; global $_USER;
$requests = array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests"), function ($i) { return !str_starts_with($i, "."); });
usort($requests, function ($a, $b) {
return strtotime(json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/$a")), true)["date"]) - strtotime(json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/$b")), true)["date"]);
return strtotime(json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/$a")), true)["date"]) - strtotime(json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/$b")), true)["date"]);
});
$requests = [...array_map(function ($i) {
$id = $i;
$i = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/$i")), true);
$i = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/requests/$i")), true);
$i["_id"] = explode(".", $id)[0];
return $i;
}, $requests)];

@ -0,0 +1,71 @@
<?php
if (str_contains($_SERVER['REQUEST_URI'], "..")) die();
if (str_starts_with($_SERVER['REQUEST_URI'], "/people/") || $_SERVER['REQUEST_URI'] === "/people") {
$parts = explode("/", $_SERVER['REQUEST_URI']);
array_shift($parts); array_shift($parts);
$_GET["__"] = implode("/", $parts);
$_GET["/" . implode("/", $parts)] = null;
require_once $_SERVER['DOCUMENT_ROOT'] . "/_people/index.php";
} else if (str_starts_with($_SERVER['REQUEST_URI'], "/articles/") || $_SERVER['REQUEST_URI'] === "/articles") {
$parts = explode("/", $_SERVER['REQUEST_URI']);
array_shift($parts); array_shift($parts);
$_GET["__"] = implode("/", $parts);
$_GET["/" . implode("/", $parts)] = null;
require_once $_SERVER['DOCUMENT_ROOT'] . "/_articles/index.php";
} else if (str_starts_with($_SERVER['REQUEST_URI'], "/gallery/") || $_SERVER['REQUEST_URI'] === "/gallery") {
$parts = explode("/", $_SERVER['REQUEST_URI']);
array_shift($parts); array_shift($parts);
$_GET["__"] = implode("/", $parts);
$_GET["/" . implode("/", $parts)] = null;
require_once $_SERVER['DOCUMENT_ROOT'] . "/_gallery/index.php";
} else if (str_starts_with($_SERVER['REQUEST_URI'], "/edit/") || $_SERVER['REQUEST_URI'] === "/edit") {
$parts = explode("/", $_SERVER['REQUEST_URI']);
array_shift($parts); array_shift($parts);
$_GET["__"] = implode("/", $parts);
$_GET["/" . implode("/", $parts)] = null;
require_once $_SERVER['DOCUMENT_ROOT'] . "/_edit/index.php";
} else if (str_starts_with($_SERVER['REQUEST_URI'], "/profile/") || $_SERVER['REQUEST_URI'] === "/profile") {
$parts = explode("/", $_SERVER['REQUEST_URI']);
array_shift($parts); array_shift($parts);
$_GET["__"] = implode("/", $parts);
$_GET["/" . implode("/", $parts)] = null;
require_once $_SERVER['DOCUMENT_ROOT'] . "/_profile/index.php";
} else {
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/" . $_SERVER['REQUEST_URI'])) {
if (!is_dir($_SERVER['DOCUMENT_ROOT'] . "/" . $_SERVER['REQUEST_URI'])) {
if (str_ends_with($_SERVER['DOCUMENT_ROOT'] . "/" . $_SERVER['REQUEST_URI'], ".css")) {
header("Content-Type: text/css");
} else if (str_ends_with($_SERVER['DOCUMENT_ROOT'] . "/" . $_SERVER['REQUEST_URI'], ".js")) {
header("Content-Type: application/javascript");
} else {
header("Content-Type: " . mime_content_type($_SERVER['DOCUMENT_ROOT'] . "/" . $_SERVER['REQUEST_URI']));
}
header("Content-Length: " . filesize($_SERVER['DOCUMENT_ROOT'] . "/" . $_SERVER['REQUEST_URI']));
readfile($_SERVER['DOCUMENT_ROOT'] . "/" . $_SERVER['REQUEST_URI']);
} else {
require_once $_SERVER['SCRIPT_FILENAME'];
}
} else if (str_starts_with($_SERVER['REQUEST_URI'], "/icons/")) {
$parts = explode("/", $_SERVER['REQUEST_URI']);
array_shift($parts); array_shift($parts);
$name = implode("/", $parts);
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/_icons/" . $name)) {
header("Content-Type: " . mime_content_type($_SERVER['DOCUMENT_ROOT'] . "/_icons/" . $name));
header("Content-Length: " . filesize($_SERVER['DOCUMENT_ROOT'] . "/_icons/" . $name));
readfile($_SERVER['DOCUMENT_ROOT'] . "/_icons/" . $name);
} else {
die("Not found");
}
} else {
require_once $_SERVER['SCRIPT_FILENAME'];
}
}

@ -40,13 +40,13 @@ $emailSupport = file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/email") && tr
$code = substr(hexdec(bin2hex(random_bytes(6))), 0, 9);
$codePretty = implode(" ", str_split($code, 3));
$codes = json_decode(utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/supportcodes.json")), true);
$codes = json_decode(pf_utf8_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/supportcodes.json")), true);
$codes[$code] = [
"user" => $_USER,
"type" => [$p1, $p2],
"date" => date('c')
];
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/supportcodes.json", utf8_encode(json_encode($codes, JSON_PRETTY_PRINT)));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/supportcodes.json", pf_utf8_encode(json_encode($codes, JSON_PRETTY_PRINT)));
?>
<h1><?= l("lang_support_types_" . $p1 . "_" . $p2) ?></h1>

Loading…
Cancel
Save