blob: 7e826278cdc97bf4425f45f681abbd73b46fe906 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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/$container->username/");
?>
|