blob: d3a3f91b90c243dfe905627f3da08c0e2cb1a745 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.locked.php"; global $_PROFILE;
if (!isset($_GET['p'])) header("HTTP/1.1 500 Internal Server Error") and die();
$user = $_PROFILE['mmsp_username'];
$posts = array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/data/" . $user . "/posts"), function ($item) {
return str_ends_with($item, ".json");
});
if (!in_array($_GET['p'] . ".json", $posts)) header("HTTP/1.1 500 Internal Server Error") and die("No such post");
$post = $_GET['p'];
die(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/" . $user . "/posts/" . $post . ".json"), true)["contents"]);
|