aboutsummaryrefslogtreecommitdiff
path: root/templates/postform.inc.php
diff options
context:
space:
mode:
authorArno Richter <oelna@oelna.de>2022-12-21 15:05:28 +0100
committerArno Richter <oelna@oelna.de>2022-12-21 15:05:28 +0100
commit482fd7adee5e9e0990bf5904ed7d754d315de649 (patch)
tree7523a6f3482b6cb024624310f21fa7eeb05e9866 /templates/postform.inc.php
parent057cace8b32e6c3d105695b517eae262071601f4 (diff)
downloadmicroblog-482fd7adee5e9e0990bf5904ed7d754d315de649.tar.gz
microblog-482fd7adee5e9e0990bf5904ed7d754d315de649.tar.bz2
microblog-482fd7adee5e9e0990bf5904ed7d754d315de649.zip
first attempt at image attachments!
Diffstat (limited to 'templates/postform.inc.php')
-rw-r--r--templates/postform.inc.php19
1 files changed, 15 insertions, 4 deletions
diff --git a/templates/postform.inc.php b/templates/postform.inc.php
index 149028b..df7566c 100644
--- a/templates/postform.inc.php
+++ b/templates/postform.inc.php
@@ -10,7 +10,7 @@
$message = array();
if(!empty($_POST['content'])) {
-
+
$id = db_insert($_POST['content'], NOW);
if($id > 0) {
@@ -19,6 +19,11 @@
'message' => 'Successfully posted status #'.$id
);
+ // handle files
+ if(!empty($_FILES['attachments'])) {
+ attach_uploaded_files($_FILES['attachments'], $id);
+ }
+
rebuild_feeds();
if($config['ping'] == true) ping_microblog();
if($config['crosspost_to_twitter'] == true) {
@@ -43,10 +48,16 @@
<?php if(isset($message['status']) && isset($message['message'])): ?>
<p class="message <?= $message['status'] ?>"><?= $message['message'] ?></p>
<?php endif; ?>
- <form action="" method="post">
+ <form action="" method="post" enctype="multipart/form-data" id="post-new-form" data-redirect="<?= $config['url'] ?>">
<textarea name="content" maxlength="<?= $config['max_characters'] ?>"></textarea>
- <p id="count"><?= $config['max_characters'] ?></p>
- <input type="submit" name="" value="Post" />
+
+ <div class="post-nav">
+ <label id="post-attachments-label">Add Files<input type="file" multiple="multiple" name="attachments[]" id="post-attachments" accept="image/*" /></label>
+ <div id="post-droparea" class="hidden">Add Files</div>
+ <ul id="post-attachments-list"></ul>
+ <p id="count"><?= $config['max_characters'] ?></p>
+ <input type="submit" name="" value="Post" />
+ </div>
</form>
</div>
<?php require(ROOT.DS.'snippets'.DS.'footer.snippet.php'); ?>