diff options
author | Nicolas BERNSTEIN <alexis211@gmail.com> | 2012-03-18 14:08:31 +0100 |
---|---|---|
committer | Nicolas BERNSTEIN <alexis211@gmail.com> | 2012-03-18 14:08:31 +0100 |
commit | ccff9ce8d8a2818699ce4e20a310986fc95ea022 (patch) | |
tree | c585ead91c894c621c73b63bc84012709e795151 /lib/image/newfld.php | |
parent | 24547ccec6526fcef3cccb34bc35fb81f31236b3 (diff) | |
download | Bits-ccff9ce8d8a2818699ce4e20a310986fc95ea022.tar.gz Bits-ccff9ce8d8a2818699ce4e20a310986fc95ea022.zip |
Added a way of classifying images in folders.
Diffstat (limited to 'lib/image/newfld.php')
-rw-r--r-- | lib/image/newfld.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/image/newfld.php b/lib/image/newfld.php new file mode 100644 index 0000000..63afd17 --- /dev/null +++ b/lib/image/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 img_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-image-" . 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"); |