summaryrefslogtreecommitdiff
path: root/lib/file/newfld.php
diff options
context:
space:
mode:
authorAlex AUVOLAT <alexis211@gmail.com>2012-06-21 16:34:27 +0200
committerAlex AUVOLAT <alexis211@gmail.com>2012-06-21 16:34:27 +0200
commit889e8eaf7c40817663dd602a21ac771062ccac3b (patch)
treeca8ac81ee202165333e5ffe16147d09e5cdaf2ab /lib/file/newfld.php
parent5c4caed8560d5fded00525844dfa8386b97e7918 (diff)
downloadBits-889e8eaf7c40817663dd602a21ac771062ccac3b.tar.gz
Bits-889e8eaf7c40817663dd602a21ac771062ccac3b.zip
Big change, sir. Can now upload any kind of files.
Diffstat (limited to 'lib/file/newfld.php')
-rw-r--r--lib/file/newfld.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/file/newfld.php b/lib/file/newfld.php
new file mode 100644
index 0000000..6b5ba1f
--- /dev/null
+++ b/lib/file/newfld.php
@@ -0,0 +1,32 @@
+<?php
+
+require("lib/markdown.php");
+
+$fld_name = "";
+$fld_comment = "";
+$fld_public = true;
+if (isset($_POST['name']) && isset($_POST['comment'])) {
+ $fld_public = isset($_POST['public']);
+ $fld_name = esca($_POST['name']);
+ $fld_comment = esca($_POST['comment']);
+ $fld_comment_html = Markdown($fld_comment);
+ if ($fld_name == "") {
+ $error = "You must enter a name for your folder.";
+ } else {
+ sql("INSERT INTO folders(owner, name, comment, comment_html, public) ".
+ "VALUES(" . $user['id'] . ", '" . escs($fld_name) . "', '" . escs($fld_comment) .
+ "', '" . escs($fld_comment_html) . "', " . ($fld_public ? '1' : '0') . ")");
+ header("Location: folder-file-" . mysql_insert_id());
+ die();
+ }
+}
+
+$title = "New folder";
+$fields = array(
+ array("label" => "Name : ", "name" => "name", "value" => $fld_name),
+ array("label" => "Public ? ", "name" => "public", "type" => "checkbox", "checked" => $fld_public),
+ array("label" => "Comment : ", "name" => "comment", "type" => "textarea", "value" => $fld_comment),
+ );
+$validate = "Create folder";
+
+require("tpl/general/form.php");