aboutsummaryrefslogtreecommitdiff
path: root/mod/file/actions/delete.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-03-03 17:53:05 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-03-03 17:53:05 +0000
commit4766f36a4d74924f21ff329c4318ce4e069ffa04 (patch)
tree969b84632f2a8b0db79788a8a6db8e41d63e5cb4 /mod/file/actions/delete.php
parent57a217fd6b708844407486046a1faa23b46cac08 (diff)
downloadelgg-4766f36a4d74924f21ff329c4318ce4e069ffa04.tar.gz
elgg-4766f36a4d74924f21ff329c4318ce4e069ffa04.tar.bz2
Pulled in the interface changes.
git-svn-id: http://code.elgg.org/elgg/trunk@5257 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/file/actions/delete.php')
-rw-r--r--mod/file/actions/delete.php68
1 files changed, 68 insertions, 0 deletions
diff --git a/mod/file/actions/delete.php b/mod/file/actions/delete.php
new file mode 100644
index 000000000..ee6dab91e
--- /dev/null
+++ b/mod/file/actions/delete.php
@@ -0,0 +1,68 @@
+<?php
+
+ /**
+ * Elgg file delete
+ *
+ * @package ElggFile
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+ $guid = (int) get_input('file');
+ if ($file = get_entity($guid)) {
+
+ if ($file->canEdit()) {
+
+ $container = get_entity($file->container_guid);
+
+ $thumbnail = $file->thumbnail;
+ $smallthumb = $file->smallthumb;
+ $largethumb = $file->largethumb;
+ if ($thumbnail) {
+
+ $delfile = new ElggFile();
+ $delfile->owner_guid = $file->owner_guid;
+ $delfile->setFilename($thumbnail);
+ $delfile->delete();
+
+ }
+ if ($smallthumb) {
+
+ $delfile = new ElggFile();
+ $delfile->owner_guid = $file->owner_guid;
+ $delfile->setFilename($smallthumb);
+ $delfile->delete();
+
+ }
+ if ($largethumb) {
+
+ $delfile = new ElggFile();
+ $delfile->owner_guid = $file->owner_guid;
+ $delfile->setFilename($largethumb);
+ $delfile->delete();
+
+ }
+
+ if (!$file->delete()) {
+ register_error(elgg_echo("file:deletefailed"));
+ } else {
+ system_message(elgg_echo("file:deleted"));
+ }
+
+ } else {
+
+ $container = $_SESSION['user'];
+ register_error(elgg_echo("file:deletefailed"));
+
+ }
+
+ } else {
+
+ register_error(elgg_echo("file:deletefailed"));
+
+ }
+
+ forward("pg/file/" . $_SESSION['user']->username);
+
+?> \ No newline at end of file