diff options
author | zotlabs <mike@macgirvin.com> | 2018-05-02 18:23:42 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2018-05-02 18:23:42 -0700 |
commit | 9713436f497a031e4369130dda40b415ff285fd8 (patch) | |
tree | b0054c391d3477d935f14e51e1ec98dbefc3cfcb /Zotlabs/Module/Item.php | |
parent | 406ea67bbc9b67ca4bd80d80eb012bc68afc5262 (diff) | |
download | volse-hubzilla-9713436f497a031e4369130dda40b415ff285fd8.tar.gz volse-hubzilla-9713436f497a031e4369130dda40b415ff285fd8.tar.bz2 volse-hubzilla-9713436f497a031e4369130dda40b415ff285fd8.zip |
backend work to allow admin to delete photos. Still requires frontend work to give admin access to either the photos and/or the delete link.
Diffstat (limited to 'Zotlabs/Module/Item.php')
-rw-r--r-- | Zotlabs/Module/Item.php | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 87f83e877..fd99c4a64 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -1084,6 +1084,8 @@ class Item extends \Zotlabs\Web\Controller { if((argc() == 3) && (argv(1) === 'drop') && intval(argv(2))) { require_once('include/items.php'); + + $i = q("select id, uid, item_origin, author_xchan, owner_xchan, source_xchan, item_type from item where id = %d limit 1", intval(argv(2)) ); @@ -1091,9 +1093,16 @@ class Item extends \Zotlabs\Web\Controller { if($i) { $can_delete = false; $local_delete = false; - if(local_channel() && local_channel() == $i[0]['uid']) + + if(local_channel() && local_channel() == $i[0]['uid']) { $local_delete = true; + } + $ob_hash = get_observer_hash(); + if($ob_hash && ($ob_hash === $i[0]['author_xchan'] || $ob_hash === $i[0]['owner_xchan'] || $ob_hash === $i[0]['source_xchan'])) { + $can_delete = true; + } + // The site admin can delete any post/item on the site. // If the item originated on this site+channel the deletion will propagate downstream. // Otherwise just the local copy is removed. @@ -1104,10 +1113,6 @@ class Item extends \Zotlabs\Web\Controller { $can_delete = true; } - $ob_hash = get_observer_hash(); - if($ob_hash && ($ob_hash === $i[0]['author_xchan'] || $ob_hash === $i[0]['owner_xchan'] || $ob_hash === $i[0]['source_xchan'])) { - $can_delete = true; - } if(! ($can_delete || $local_delete)) { notice( t('Permission denied.') . EOL); |