diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/Scrape.php | 30 | ||||
-rw-r--r-- | include/items.php | 2 | ||||
-rw-r--r-- | include/notifier.php | 7 | ||||
-rw-r--r-- | include/poller.php | 10 |
4 files changed, 46 insertions, 3 deletions
diff --git a/include/Scrape.php b/include/Scrape.php index 10ec54d13..8478ea407 100644 --- a/include/Scrape.php +++ b/include/Scrape.php @@ -22,6 +22,8 @@ function scrape_dfrn($url) { foreach($items as $item) { $x = $item->getAttribute('rel'); + if(($x === 'alternate') && ($item->getAttribute('type') === 'application/atom+xml')) + $ret['feed_atom'] = $item->getAttribute('href'); if(substr($x,0,5) == "dfrn-") $ret[$x] = $item->getAttribute('href'); if($x === 'lrdd') { @@ -135,3 +137,31 @@ function scrape_vcard($url) { return $ret; }} + + +if(! function_exists('scrape_feed')) { +function scrape_feed($url) { + + $ret = array(); + $s = fetch_url($url); + + if(! $s) + return $ret; + + $dom = HTML5_Parser::parse($s); + + if(! $dom) + return $ret; + + $items = $dom->getElementsByTagName('link'); + + // get Atom link elements + + foreach($items as $item) { + $x = $item->getAttribute('rel'); + if(($x === 'alternate') && ($item->getAttribute('type') === 'application/atom+xml')) + $ret['feed_atom'] = $item->getAttribute('href'); + } + + return $ret; +}}
\ No newline at end of file diff --git a/include/items.php b/include/items.php index f1169aeb4..5f8264beb 100644 --- a/include/items.php +++ b/include/items.php @@ -637,7 +637,7 @@ function item_store($arr) { $arr['body'] = str_replace( array('&amp;', '&gt;', '&lt;', '&quot;'), - array('&' , '>' , '<', '"'), + array('&' , '>' , '<', '"'), $arr['body'] ); diff --git a/include/notifier.php b/include/notifier.php index 39640e51a..4efdad4ce 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -280,7 +280,7 @@ ); } break; - default: + case 'stat': if($followup && $contact['notify']) { logger('notifier: slapdelivery: ' . $contact['name']); $deliver_status = slapper($owner,$contact['notify'],$slap); @@ -324,6 +324,11 @@ } } break; + case 'mail': + case 'dspr': + case 'feed': + default: + break; } } diff --git a/include/poller.php b/include/poller.php index fc45ff9c3..024b9fbcd 100644 --- a/include/poller.php +++ b/include/poller.php @@ -32,10 +32,18 @@ if(($argc > 1) && ($argv[1] == 'force')) $force = true; + if(($argc > 1) && intval($argv[1])) { + $manual_id = intval($argv[1]); + $force = true; + } + + $sql_extra = (($manual_id) ? " AND `id` = $manual_id " : ""); + // 'stat' clause is a temporary measure until we have federation subscriptions working both directions $contacts = q("SELECT * FROM `contact` WHERE ( ( `network` = 'dfrn' AND ( `dfrn-id` != '' OR (`issued-id` != '' AND `duplex` = 1))) - OR ( `network` = 'stat' AND `poll` != '' ) ) + OR ( `network` IN ( 'stat', 'feed' ) AND `poll` != '' )) + $sql_extra AND `self` = 0 AND `blocked` = 0 AND `readonly` = 0 ORDER BY RAND()"); if(! count($contacts)) |