$author, 'contents' => substr($_POST['post-text'], 0, 500), 'date' => $date, 'image' => null, 'audio' => null, 'comments' => [], 'edits' => [] ])); } header("Location: /profile") and die(); } else if (isset($_POST['post']) && $_POST['post'] === "1" && isset($_POST['edit']) && $_POST['edit'] === "1" && isset($_POST['edit-post'])) { $posts = array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/data/" . $_PROFILE['mmsp_username'] . "/posts"), function ($item) { return str_ends_with($item, ".json"); }); if (!in_array($_POST['edit-post'] . ".json", $posts)) header("Location: /profile") and die(); $id = $_POST['edit-post']; $post = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/" . $_PROFILE['mmsp_username'] . "/posts/" . $id . ".json"), true); $plurality = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/" . $_PROFILE['mmsp_username'] . "/settings/plurality.json"), true); $date = date('c'); $author = $plurality['members'][0]; foreach ($plurality['members'] as $member) { if ($member['name'] === $_POST['post-member']) { $author = $member; } } $post['author'] = $author; $post['contents'] = substr($_POST['post-text'], 0, 500); $post['edits'][] = [ "date" => $date, "before" => $post['contents'] ]; file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/" . $_PROFILE['mmsp_username'] . "/posts/" . $id . ".json", json_encode($post)); header("Location: /profile") and die(); } } $plurality = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/" . $search . "/settings/plurality.json"), true); if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/" . $_PROFILE['mmsp_username'] . "/settings/favorites.json")) { $favorites = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/" . $_PROFILE['mmsp_username'] . "/settings/favorites.json"), true); } else { $favorites = []; } $titlec = $plurality['displayname'] . " (@" . $search . ")"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/gui/header.app.php"; global $lang; global $Parsedown; ?>

@ · 1 ? $lang['profile']['plural.2'] : $lang['profile']['plural.1'] ?>   · 1) echo(count($posts) . " " . $lang['profile']['posts.2']); ?>

setSafeMode(true); $Parsedown->setMarkupEscaped(true); echo $Parsedown->line($post['contents']) ?>