diff options
author | Mario Vavti <mario@mariovavti.com> | 2015-10-15 09:36:51 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2015-10-15 09:36:51 +0200 |
commit | 2848f5dab4e0f904280e77d6403ab69926cabe1d (patch) | |
tree | bcb2f2a70660d7abe319b126035d2e0b2ddd2c41 /include/attach.php | |
parent | 3c7d2d4cea80fae5113de8c78ed522ce8b32c16d (diff) | |
parent | f0f5a8f2b510b92aa1fde2cbaf118a784c154432 (diff) | |
download | volse-hubzilla-2848f5dab4e0f904280e77d6403ab69926cabe1d.tar.gz volse-hubzilla-2848f5dab4e0f904280e77d6403ab69926cabe1d.tar.bz2 volse-hubzilla-2848f5dab4e0f904280e77d6403ab69926cabe1d.zip |
Merge branch 'master' of https://github.com/redmatrix/hubzilla
Diffstat (limited to 'include/attach.php')
-rw-r--r-- | include/attach.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/include/attach.php b/include/attach.php index fc95e3a75..0d4e4092b 100644 --- a/include/attach.php +++ b/include/attach.php @@ -1229,7 +1229,7 @@ function attach_delete($channel_id, $resource, $is_photo = 0) { $channel_address = (($c) ? $c[0]['channel_address'] : 'notfound'); $photo_sql = (($is_photo) ? " and is_photo = 1 " : ''); - $r = q("SELECT hash, flags, is_dir, folder FROM attach WHERE hash = '%s' AND uid = %d $photo_sql limit 1", + $r = q("SELECT hash, flags, is_dir, is_photo, folder FROM attach WHERE hash = '%s' AND uid = %d $photo_sql limit 1", dbesc($resource), intval($channel_id) ); @@ -1275,6 +1275,16 @@ function attach_delete($channel_id, $resource, $is_photo = 0) { intval($channel_id) ); + if($r[0]['is_photo']) { + $x = q("select id, item_hidden from item where resource_id = '%s' and resource_type = 'photo' and uid = %d", + dbesc($resource), + intval($channel_id) + ); + if($x) { + drop_item($x[0]['id'],false,(($x[0]['item_hidden']) ? DROPITEM_NORMAL : DROPITEM_PHASE1),true); + } + } + // update the parent folder's lastmodified timestamp $e = q("UPDATE attach SET edited = '%s' WHERE hash = '%s' AND uid = %d", dbesc(datetime_convert()), |