merge-requests/5/head
Terence Eden 2024-03-16 20:43:43 +00:00
rodzic 325f43fc70
commit 864315d5f7
1 zmienionych plików z 7 dodań i 5 usunięć

Wyświetl plik

@ -791,8 +791,10 @@ die();
}
// User Interface for Writing:
// This creates a basic HTML form. Type in your message and your password. It then POSTs the data to the `/send` endpoint.
// This creates a basic HTML form. Type in your message and your password. It then POSTs the data to the `/action/send` endpoint.
function write() {
$send = "/action/send";
if ( isset( $_GET["announce"] ) && filter_var( $_GET["announce"], FILTER_VALIDATE_URL ) ) {
$announceURl = $_GET["announce"];
} else {
@ -823,7 +825,7 @@ echo <<< HTML
<body>
<fieldset>
<legend>Send a message</legend>
<form action="/action/send" method="post" enctype="multipart/form-data">
<form action="{$send}" method="post" enctype="multipart/form-data">
<input type="hidden" id="type" name="type" value="Create">
<label for="content">Your message:</label><br>
<textarea id="content" name="content" rows="5" cols="32"></textarea><br>
@ -840,7 +842,7 @@ echo <<< HTML
</fieldset>
<fieldset>
<legend>Like a post</legend>
<form action="/send" method="post" enctype="multipart/form-data">
<form action="{$send}" method="post" enctype="multipart/form-data">
<input type="hidden" id="type" name="type" value="Like">
<label for="postURl">URl of post to like:</label>
<input type="url" name="postURl" id="postURl" size="32" value="{$likeURl}"><br>
@ -851,7 +853,7 @@ echo <<< HTML
</fieldset>
<fieldset>
<legend>Boost a post</legend>
<form action="/send" method="post" enctype="multipart/form-data">
<form action="{$send}" method="post" enctype="multipart/form-data">
<input type="hidden" id="type" name="type" value="Announce">
<label for="postURl">URl of post to boost:</label>
<input type="url" name="postURl" id="postURl" size="32" value="{$announceURl}"><br>
@ -875,7 +877,7 @@ HTML;
global $password, $server, $username, $key_private, $directories;
// Does the posted password match the stored password?
if( $password != $_POST["password"] ) { die(); }
if( $password != $_POST["password"] ) { echo "Wrong password."; die(); }
// What sort of message is being sent?
$type = $_POST["type"];