Support sending threaded replies

main
Terence Eden 2024-03-03 11:27:52 +00:00
rodzic 5657d2938f
commit db46472041
1 zmienionych plików z 24 dodań i 11 usunięć

Wyświetl plik

@ -583,17 +583,22 @@ echo <<< HTML
</style>
</head>
<body>
<form action="/send" method="post" enctype="multipart/form-data">
<label for="content">Your message:</label><br>
<textarea id="content" name="content" rows="5" cols="32"></textarea><br>
<label for="image">Attach an image</label><br>
<input type="file" name="image" id="image" accept="image/*"><br>
<label for="alt">Alt Text</label>
<input type="text" name="alt" id="alt" size="32" /><br>
<label for="password">Password</label><br>
<input type="password" name="password" id="password" size="32"><br>
<input type="submit" value="Post Message">
</form>
<fieldset>
<legend>Send a message</legend>
<form action="/send" method="post" enctype="multipart/form-data">
<label for="content">Your message:</label><br>
<textarea id="content" name="content" rows="5" cols="32"></textarea><br>
<label for="inReplyTo">Reply to URl:</label>
<input type="url" name="inReplyTo" id="inReplyTo" size="32" /><br>
<label for="image">Attach an image</label><br>
<input type="file" name="image" id="image" accept="image/*"><br>
<label for="alt">Alt Text</label>
<input type="text" name="alt" id="alt" size="32" /><br>
<label for="password">Password</label><br>
<input type="password" name="password" id="password" size="32"><br><br>
<input type="submit" value="Post Message">
</form>
</fieldset>
</body>
</html>
HTML;
@ -614,6 +619,13 @@ HTML;
// Get the posted content
$content = $_POST["content"];
// Is this a reply?
if ( isset( $_POST["inReplyTo"] ) && filter_var( $_POST["inReplyTo"], FILTER_VALIDATE_URL ) ) {
$inReplyTo = $_POST["inReplyTo"];
} else {
$inReplyTo = null;
}
// Process the content into HTML to get hashtags etc
list( "HTML" => $content, "TagArray" => $tags ) = process_content( $content );
@ -669,6 +681,7 @@ HTML;
"type" => "Note",
"published" => $timestamp,
"attributedTo" => "https://{$server}/{$username}",
"inReplyTo" => $inReplyTo,
"content" => $content,
"contentMap" => ["en" => $content],
"to" => ["https://www.w3.org/ns/activitystreams#Public"],