From decd0dc035cce0918519bef77742ff87db23e3f3 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 12 Jun 2019 11:27:39 +0200 Subject: more work on event item deletion --- include/zot.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'include/zot.php') diff --git a/include/zot.php b/include/zot.php index a37b7cdb5..9dd9aceff 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2278,6 +2278,25 @@ function delete_imported_item($sender, $item, $uid, $relay) { return false; } + if ($item['obj_type'] == ACTIVITY_OBJ_EVENT) { + $i = q("SELECT * FROM event WHERE event_hash = '%s' AND uid = %d LIMIT 1", + dbesc($item['uuid']), + intval($uid) + ); + if ($i) { + if ($i[0]['event_xchan'] === $sender['hash']) { + q("delete from event where event_hash = '%s' and uid = %d", + dbesc($item['uuid']), + intval($uid) + ); + } + else { + logger('delete linked event: not owner'); + return; + } + } + } + require_once('include/items.php'); if($item_found) { -- cgit v1.2.3