diff options
author | Friendika <info@friendika.com> | 2011-04-04 19:36:18 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-04-04 19:36:18 -0700 |
commit | 793967a1d3c23fcf1f3b00a2832f51e6f473f4bd (patch) | |
tree | ec045409190c042c621874f10cf38cf00488b9b3 /mod | |
parent | 178362e50b846aef1caf4e191ea0394c5d636857 (diff) | |
download | volse-hubzilla-793967a1d3c23fcf1f3b00a2832f51e6f473f4bd.tar.gz volse-hubzilla-793967a1d3c23fcf1f3b00a2832f51e6f473f4bd.tar.bz2 volse-hubzilla-793967a1d3c23fcf1f3b00a2832f51e6f473f4bd.zip |
better handling of troublesome feeds.
Diffstat (limited to 'mod')
-rw-r--r-- | mod/dfrn_confirm.php | 2 | ||||
-rw-r--r-- | mod/dfrn_poll.php | 4 | ||||
-rw-r--r-- | mod/follow.php | 14 |
3 files changed, 14 insertions, 6 deletions
diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index 1bf1ba954..2db745d25 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -240,7 +240,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) { notice( t('Unexpected response from remote site: ') . EOL . $leading_junk . EOL ); } - $xml = simplexml_load_string($res); + $xml = parse_xml_string($res); $status = (int) $xml->status; $message = unxmlify($xml->message); // human readable text of what may have gone wrong. switch($status) { diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php index 5149dc3b2..2ccfadd03 100644 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -69,7 +69,7 @@ function dfrn_poll_init(&$a) { if(strlen($s)) { - $xml = simplexml_load_string($s); + $xml = parse_xml_string($s); if((int) $xml->status == 1) { $_SESSION['authenticated'] = 1; @@ -468,7 +468,7 @@ function dfrn_poll_content(&$a) { if(strlen($s) && strstr($s,'<?xml')) { - $xml = simplexml_load_string($s); + $xml = parse_xml_string($s); logger('dfrn_poll: profile: parsed xml: ' . print_r($xml,true), LOGGER_DATA); diff --git a/mod/follow.php b/mod/follow.php index 4ce3ccb82..06e81ceed 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -15,7 +15,8 @@ function follow_post(&$a) { $email_conversant = false; if($url) { - $links = @lrdd($url); + $links = lrdd($url); + if(count($links)) { foreach($links as $link) { if($link['@attributes']['rel'] === NAMESPACE_DFRN) @@ -107,7 +108,7 @@ function follow_post(&$a) { if((! isset($vcard)) && (! $poll)) { $ret = scrape_feed($url); - + logger('mod_follow: scrape_feed returns: ' . print_r($ret,true), LOGGER_DATA); if(count($ret) && ($ret['feed_atom'] || $ret['feed_rss'])) { $poll = ((x($ret,'feed_atom')) ? unamp($ret['feed_atom']) : unamp($ret['feed_rss'])); $vcard = array(); @@ -156,7 +157,14 @@ function follow_post(&$a) { } if((! $vcard['photo']) && strlen($email)) $vcard['photo'] = gravatar_img($email); - + if($poll === $profile) + $lnk = $feed->get_permalink(); + if(isset($lnk) && strlen($lnk)) + $profile = $lnk; + if(! (x($vcard,'fn'))) + $vcard['fn'] = notags($feed->get_title()); + if(! (x($vcard,'fn'))) + $vcard['fn'] = notags($feed->get_description()); $network = 'feed'; $priority = 2; } |