summaryrefslogtreecommitdiff
path: root/lib/image/delfld.php
diff options
context:
space:
mode:
authorNicolas BERNSTEIN <alexis211@gmail.com>2012-03-18 14:08:31 +0100
committerNicolas BERNSTEIN <alexis211@gmail.com>2012-03-18 14:08:31 +0100
commitccff9ce8d8a2818699ce4e20a310986fc95ea022 (patch)
treec585ead91c894c621c73b63bc84012709e795151 /lib/image/delfld.php
parent24547ccec6526fcef3cccb34bc35fb81f31236b3 (diff)
downloadBits-ccff9ce8d8a2818699ce4e20a310986fc95ea022.tar.gz
Bits-ccff9ce8d8a2818699ce4e20a310986fc95ea022.zip
Added a way of classifying images in folders.
Diffstat (limited to 'lib/image/delfld.php')
-rw-r--r--lib/image/delfld.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/image/delfld.php b/lib/image/delfld.php
new file mode 100644
index 0000000..a018b7a
--- /dev/null
+++ b/lib/image/delfld.php
@@ -0,0 +1,16 @@
+<?php
+
+assert_redir(count($args) >= 3, 'image');
+$fldid = intval($args[2]);
+
+$fld = mysql_fetch_assoc(sql(
+ "SELECT id, name, comment, public, owner ".
+ "FROM img_folders WHERE id = $fldid"
+ ));
+assert_error($fld && $fld['owner'] == $user['id'],
+ "This folder does not exist, or you are not allowed to edit it.");
+
+token_validate("Do you really want to delete this folder ?", "folder-image-$fldid");
+sql("DELETE FROM img_folders WHERE id = $fldid");
+sql("UPDATE images SET folder = 0 WHERE folder = $fldid");
+header("location: image");