Support sending threaded replies
rodzic
5657d2938f
commit
db46472041
35
index.php
35
index.php
|
@ -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"],
|
||||
|
|
Ładowanie…
Reference in New Issue