diff options
author | Mario Vavti <mario@mariovavti.com> | 2025-01-22 10:43:33 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2025-01-22 10:43:33 +0100 |
commit | ccd52584a419dfe98e074546fc4df6b8c35285c7 (patch) | |
tree | 355c914c2956974bc6ef23772c374b1b8e524e14 /include/feedutils.php | |
parent | ab0fdb13d42907d1e22091be8da30ca8c3111778 (diff) | |
download | volse-hubzilla-ccd52584a419dfe98e074546fc4df6b8c35285c7.tar.gz volse-hubzilla-ccd52584a419dfe98e074546fc4df6b8c35285c7.tar.bz2 volse-hubzilla-ccd52584a419dfe98e074546fc4df6b8c35285c7.zip |
make sure to provide uid to drop_item() where applicable and check ownership when imporing feed items
Diffstat (limited to 'include/feedutils.php')
-rw-r--r-- | include/feedutils.php | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/include/feedutils.php b/include/feedutils.php index 5894087b8..73a8999ae 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -1173,12 +1173,16 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) { intval($importer['channel_id']) ); - // Update content if 'updated' changes - if($r) { - if(activity_match($datarray['verb'], ['Delete', ACTIVITY_DELETE]) - && $datarray['author_xchan'] === $r[0]['author_xchan']) { + if ($r) { + // Check ownership + if ($datarray['author_xchan'] !== $r[0]['author_xchan']) { + logger('stored item author is not imported item author', LOGGER_DEBUG); + continue; + } + + if (activity_match($datarray['verb'], ['Delete', ACTIVITY_DELETE])) { if(! intval($r[0]['item_deleted'])) { logger('deleting item ' . $r[0]['id'] . ' mid=' . $datarray['mid'], LOGGER_DEBUG); drop_item($r[0]['id']); @@ -1444,12 +1448,17 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) { // Update content if 'updated' changes - if($r) { - if(isset($datarray['verb']) && activity_match($datarray['verb'], ['Delete', ACTIVITY_DELETE]) - && isset($datarray['author_xchan']) && $datarray['author_xchan'] === $r[0]['author_xchan']) { + if ($r) { + // Check ownership + if ($datarray['author_xchan'] !== $r[0]['author_xchan']) { + logger('stored item author is not imported item author', LOGGER_DEBUG); + continue; + } + + if (isset($datarray['verb']) && activity_match($datarray['verb'], ['Delete', ACTIVITY_DELETE])) { if(! intval($r[0]['item_deleted'])) { logger('deleting item ' . $r[0]['id'] . ' mid=' . $datarray['mid'], LOGGER_DEBUG); - drop_item($r[0]['id']); + drop_item($r[0]['id'], uid: $importer['channel_id']); } continue; } |