shr3dd3r 62b7b68976 Функция поиска по постам
Мне это всё расписывать что-ли? Смотрите в содержание коммита, мне феерически индифферентно
2024-03-07 19:58:39 +03:00

63 lines
1.7 KiB
PHP

<?php
// Post creation page
// Includes
require_once("api/post/create.php");
// Markup includes
require_once("front/pages/main_nav.php");
require_once("front/notifications.php");
// Redirecting to main page if not logged in
if (!$LOGGED_IN) {
header("Location: .");
exit();
}
// Processing POST-request
if (isset($_POST) && $_POST) {
if (isset($_POST["tags"]) && $_POST["tags"] && isset($_FILES["pic"])) {
if (isset($_POST["title"]) && !$_POST["title"])
unset($_POST["title"]);
$result = Post_Create_Method($_POST, $_FILES);
if ($result->IsError()) { // Something happened
NTFY_AddNotice("Failed to create post! Reason:<br>" . $result->GetError());
} /*else { // All OK
header("Location: .");
exit();
} TODO: redirect to page with new post */
} else {
NTFY_AddNotice("You must supply image and tags for post");
}
}
NTFY_EchoAllNotices();
?>
<div class="visualbox">
<h1>New post</h1>
<form class="basicform" action="./?do=new_post" accept-charset="UTF-8" method="post" enctype="multipart/form-data">
<div>
<label for="pic">Select image:</label><br>
<input type="file" name="pic" id="pic">
</div>
<div>
<label for="tags">Comma-separated tags list:</label><br>
<textarea placeholder="tag_1, tag_2, tag_3, ..., tag_N" name="tags" id="tags" style="width: 98%;" rows="1"><?php if (isset($_POST["tags"])) { echo $_POST["tags"]; } ?></textarea>
</div>
<div>
<label for="title">Post title:</label><br>
<textarea placeholder="Lorem ipsum dolor sit amet..." name="title" id="title" style="width: 98%;" rows="2"><?php if (isset($_POST["title"]) && $_POST["title"]) { echo $_POST["title"]; } ?></textarea>
</div>
<div>
<input type="submit" value="Submit">
</div>
</form>
</div>