diff options
author | Minteck <contact@minteck.org> | 2022-05-22 18:16:34 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-05-22 18:16:34 +0200 |
commit | bc4d21ddbc50a4295ad1be0f4797b09895a65fea (patch) | |
tree | f915c08fba577daf766628657558ce480790b06f /ajax/original/index.php | |
download | multisocial-mane.tar.gz multisocial-mane.tar.bz2 multisocial-mane.zip |
Diffstat (limited to 'ajax/original/index.php')
-rw-r--r-- | ajax/original/index.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ajax/original/index.php b/ajax/original/index.php new file mode 100644 index 0000000..d3a3f91 --- /dev/null +++ b/ajax/original/index.php @@ -0,0 +1,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"]);
\ No newline at end of file |