diff options
author | Alex AUVOLAT <alexis211@gmail.com> | 2012-06-21 16:34:27 +0200 |
---|---|---|
committer | Alex AUVOLAT <alexis211@gmail.com> | 2012-06-21 16:34:27 +0200 |
commit | 889e8eaf7c40817663dd602a21ac771062ccac3b (patch) | |
tree | ca8ac81ee202165333e5ffe16147d09e5cdaf2ab /lib/file/editfld.php | |
parent | 5c4caed8560d5fded00525844dfa8386b97e7918 (diff) | |
download | Bits-889e8eaf7c40817663dd602a21ac771062ccac3b.tar.gz Bits-889e8eaf7c40817663dd602a21ac771062ccac3b.zip |
Big change, sir. Can now upload any kind of files.
Diffstat (limited to 'lib/file/editfld.php')
-rw-r--r-- | lib/file/editfld.php | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/file/editfld.php b/lib/file/editfld.php new file mode 100644 index 0000000..db5a304 --- /dev/null +++ b/lib/file/editfld.php @@ -0,0 +1,44 @@ +<?php + +require("lib/markdown.php"); + +assert_redir(count($args) == 3, 'file'); +$fldid = intval($args[2]); + +$fld = mysql_fetch_assoc(sql( + "SELECT id, name, comment, public, owner ". + "FROM folders WHERE id = $fldid" + )); +assert_error($fld && $fld['owner'] == $user['id'], + "This folder does not exist, or you are not allowed to edit it."); + +$fld_name = $fld['name']; +$fld_comment = $fld['comment']; +$fld_public = $fld['public']; +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("UPDATE folders SET name = '" . escs($fld_name) . "', comment = '" . escs($fld_comment) . + "', comment_html = '" . escs($fld_comment_html) . "', public = " . ($fld_public?'1':'0') . + " WHERE id = $fldid"); + header("Location: folder-file-" . $fldid); + die(); + } + +} + +$title = "Edit folder"; +$fields = array( + array("label" => "Folder 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 = "Save"; + +require("tpl/general/form.php"); + |