summaryrefslogtreecommitdiff
path: root/src/application/views/form_newtopic.php
blob: d1d7e445c040f773006bc01959d0ec3677151e00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php

use mystic\forum\Messaging;
use mystic\forum\utils\RequestUtils;

$lastFormUri = "";
$lastForm = RequestUtils::getLastForm($lastFormUri) ?? [];
if ($lastFormUri !== $_SERVER["REQUEST_URI"]) $lastForm = [];
RequestUtils::clearLastForm();

?>
<div class="page-header margin-top-0">
    <h1><?= __("New topic") ?></h1>
</div>
<?php
if (($_formError = RequestUtils::getAndClearFormError("newtopic")) !== null) {
    _view("alert_error", ["message" => $_formError]);
}
?>
<form action="<?= htmlentities($_SERVER["REQUEST_URI"]) ?>#form" method="post" enctype="multipart/form-data">
<input type="hidden" name="form_id" value="newtopic">
<div class="form-group">
    <label for="i_message"><?= __("Topic title:") ?></label>
    <input type="text" class="form-control" id="i_title" name="title" value="<?= htmlentities($lastForm["title"] ?? "") ?>" required autofocus>
</div>
<div class="form-group">
    <label for="i_message"><?= __("Message:") ?></label>
    <textarea class="form-control" id="i_message" name="message" required rows="12" cols="60" style="resize:vertical;max-height:499px"><?= htmlentities($lastForm["message"] ?? "") ?></textarea>
</div>
<div class="form-group">
    <label for="i_files"><?= __("Attachments: <small>(max. %max_attachment_count% files, max. %max_attachment_size% MiB each)</small>", [
        "max_attachment_count" => strval(MAX_ATTACHMENT_COUNT),
        "max_attachment_size" => strval(MAX_ATTACHMENT_SIZE >> 20)
    ]) ?></label>
    <input type="file" name="files[]" id="i_files" multiple accept="*/*">
</div>
<button type="submit" class="btn btn-success"><?= __("Create topic") ?> <span class="fa fa-send" aria-hidden="true"></span></button>
</form>