summaryrefslogtreecommitdiff
path: root/lib/list/rmbatch.php
diff options
context:
space:
mode:
authorNicolas BERNSTEIN <alexis211@gmail.com>2011-11-20 13:39:47 +0100
committerNicolas BERNSTEIN <alexis211@gmail.com>2011-11-20 13:39:47 +0100
commitd45c7f14891d951f8a6987cc6492073b97e05b5b (patch)
treed6467b1202c27f67fd8e894d25fd4aea0085b559 /lib/list/rmbatch.php
parent4d7e065c2d2ec407b6a7ebfc7569628bac9149d1 (diff)
downloadBits-d45c7f14891d951f8a6987cc6492073b97e05b5b.tar.gz
Bits-d45c7f14891d951f8a6987cc6492073b97e05b5b.zip
Added the bit list study system
Diffstat (limited to 'lib/list/rmbatch.php')
-rw-r--r--lib/list/rmbatch.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/list/rmbatch.php b/lib/list/rmbatch.php
new file mode 100644
index 0000000..90ea370
--- /dev/null
+++ b/lib/list/rmbatch.php
@@ -0,0 +1,20 @@
+<?php
+
+assert_redir(count($args) >= 3, 'list');
+$batchid = intval($args[2]);
+
+$batch = mysql_fetch_assoc(sql(
+ "SELECT lists.id AS listid, lists.owner AS listowner, lists.name AS listname, batches.name AS name, ".
+ "batches.model AS model, batches.contents AS contents ".
+ "FROM batches LEFT JOIN lists ON lists.id = batches.list ".
+ "WHERE batches.id = $batchid"));
+assert_error($batch && $batch['listowner'] == $user['id'],
+ "this batch does not exist, or you are not allowed to edit it.");
+
+token_validate("Do you really want to delete this batch ?", "view-list-" . $batch['listid']);
+
+sql("DELETE FROM batches WHERE id = $batchid");
+sql("DELETE FROM batch_study WHERE batch = $batchid");
+sql("DELETE FROM batch_review WHERE batch = $batchid");
+header("Location: view-list-" . $batch['listid']);
+die();