diff options
author | Mike Macgirvin <mike@macgirvin.com> | 2010-07-26 03:33:56 -0700 |
---|---|---|
committer | Mike Macgirvin <mike@macgirvin.com> | 2010-07-26 03:33:56 -0700 |
commit | 557ebe4700c477aeba043594f7b929b1129be191 (patch) | |
tree | 0a55f2bc94ac9b825ccfe5242c504d0ff813010f /include/poller.php | |
parent | 9f81c3345b40d635a34f0448dd625b17f20508c3 (diff) | |
download | volse-hubzilla-557ebe4700c477aeba043594f7b929b1129be191.tar.gz volse-hubzilla-557ebe4700c477aeba043594f7b929b1129be191.tar.bz2 volse-hubzilla-557ebe4700c477aeba043594f7b929b1129be191.zip |
working on delete
Diffstat (limited to 'include/poller.php')
-rw-r--r-- | include/poller.php | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/include/poller.php b/include/poller.php index ab030a709..c7108d13c 100644 --- a/include/poller.php +++ b/include/poller.php @@ -74,16 +74,45 @@ echo "Length:" . strlen($xml) . "\r\n"; foreach($feed->get_items() as $item) { + $deleted = false; + $rawdelete = $item->get_item_tags("http://purl.org/atompub/tombstones/1.0", 'deleted-entry'); - print_r($rawdelete); + if(isset($rawdelete[0]['attribs']['']['ref'])) { + $uri = $rawthread[0]['attribs']['']['ref']; + $deleted = true; + if(isset($rawdelete[0]['attribs']['']['when'])) { + $when = $rawthread[0]['attribs']['']['when']; + $when = datetime_convert('UTC','UTC', $when, 'Y-m-d H:i:s'); + } + else + $when = datetime_convert('UTC','UTC','now','Y-m-d H:i:s'); + } if($deleted) { - // pick out ref and when from attribs - // check hasn't happened already, verify ownership and then process it - - + $r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", + dbesc($uri), + intval($importer['uid']) + ); + if(count($r)) { + if($r[0]['uri'] == $r[0]['parent-uri']) { + $r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s' + WHERE `parent-uri` = '%s'" + dbesc($when), + dbesc($r[0]['uri']) + ); + } + else { + $r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s' + WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", + dbesc($when), + dbesc($uri), + intval($importer['uid']) + ); + } + } continue; } + $is_reply = false; $item_id = $item->get_id(); $rawthread = $item->get_item_tags("http://purl.org/syndication/thread/1.0",'in-reply-to'); |