ghost
3 years ago
7 changed files with 114 additions and 20 deletions
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
<?php |
||||
|
||||
$response = [ |
||||
'success' => false, |
||||
'message' => _('Internal server error'), |
||||
'filter' => '', |
||||
'format' => '', |
||||
]; |
||||
|
||||
if (isset($_SESSION['userName'])) { |
||||
|
||||
if (isset($_POST['message'])) { |
||||
|
||||
$filter = Filter::post($_POST['message']); |
||||
$format = Format::post($filter); |
||||
|
||||
$response = [ |
||||
'success' => true, |
||||
'message' => _('Success'), |
||||
'filter' => $filter, |
||||
'format' => $format, |
||||
]; |
||||
} else { |
||||
|
||||
$response = [ |
||||
'success' => false, |
||||
'message' => _('Message required'), |
||||
'filter' => '', |
||||
'format' => '', |
||||
]; |
||||
} |
||||
|
||||
} else { |
||||
|
||||
$response = [ |
||||
'success' => false, |
||||
'message' => _('Session expired. Please, reload the page.'), |
||||
'filter' => '', |
||||
'format' => '', |
||||
]; |
||||
} |
||||
|
||||
header('Content-Type: application/json; charset=utf-8'); |
||||
echo json_encode($response); |
@ -1,13 +1,18 @@
@@ -1,13 +1,18 @@
|
||||
<div class="modulePost" id="modulePost"> |
||||
<form action="/" method="POST" name="post"> |
||||
<div class="avatar"> |
||||
<img src="" alt="" /> |
||||
<img src="" alt="" id="modulePostAvatar" /> |
||||
</div> |
||||
<div class="message"> |
||||
<textarea name="post" placeholder="<?php echo _('Enter your post...') ?>"></textarea> |
||||
<textarea name="post" placeholder="<?php echo _('Enter your post...') ?>" id="modulePostMessage"></textarea> |
||||
</div> |
||||
<div class="preview" id="modulePostPreview"> |
||||
<div class="title"> |
||||
<i class="bi bi-chat-right-dots" title="<?php echo _('Preview') ?>"></i> |
||||
</div> |
||||
<div class="text"></div> |
||||
</div> |
||||
<div class="action"> |
||||
<div class="button" onclick="ModulePost.add()"><?php echo _('Send') ?></div> |
||||
<div class="button" id="modulePostSend"><?php echo _('Send') ?></div> |
||||
</div> |
||||
</form> |
||||
</div> |
Loading…
Reference in new issue