aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-02-01 14:55:29 -0800
committerFriendika <info@friendika.com>2011-02-01 14:55:29 -0800
commit8c5c07b2654f5ff28cea1a7012198f74c5b1af03 (patch)
tree1e5e05f75614e7b001895c060f5385021c717db2
parentb4f2aac7e76d8d8a8330ade4116a015593f001a6 (diff)
downloadvolse-hubzilla-8c5c07b2654f5ff28cea1a7012198f74c5b1af03.tar.gz
volse-hubzilla-8c5c07b2654f5ff28cea1a7012198f74c5b1af03.tar.bz2
volse-hubzilla-8c5c07b2654f5ff28cea1a7012198f74c5b1af03.zip
don't try to scrape atom/rss feeds. missing param in contact store (mod_follow)
-rw-r--r--boot.php3
-rw-r--r--include/Scrape.php58
-rw-r--r--mod/follow.php2
3 files changed, 62 insertions, 1 deletions
diff --git a/boot.php b/boot.php
index ac010c19d..6bd82bb08 100644
--- a/boot.php
+++ b/boot.php
@@ -1374,6 +1374,9 @@ function lrdd($uri) {
$link = $matches[1];
break;
}
+ // don't try and run feeds through the html5 parser
+ if(stristr($line,'content-type:') && ((stristr($line,'application/atom+xml')) || (stristr($line,'application/rss+xml'))))
+ return array();
}
}
if(! isset($link)) {
diff --git a/include/Scrape.php b/include/Scrape.php
index e4f7a0878..bb42c3bdd 100644
--- a/include/Scrape.php
+++ b/include/Scrape.php
@@ -5,12 +5,25 @@ require_once('library/HTML5/Parser.php');
if(! function_exists('scrape_dfrn')) {
function scrape_dfrn($url) {
+ $a = get_app();
+
$ret = array();
$s = fetch_url($url);
if(! $s)
return $ret;
+ $headers = $a->get_curl_headers();
+ $lines = explode("\n",$headers);
+ if(count($lines)) {
+ foreach($lines as $line) {
+ // don't try and run feeds through the html5 parser
+ if(stristr($line,'content-type:') && ((stristr($line,'application/atom+xml')) || (stristr($line,'application/rss+xml'))))
+ return ret;
+ }
+ }
+
+
$dom = HTML5_Parser::parse($s);
if(! $dom)
@@ -77,12 +90,26 @@ function validate_dfrn($a) {
if(! function_exists('scrape_meta')) {
function scrape_meta($url) {
+ $a = get_app();
+
$ret = array();
$s = fetch_url($url);
if(! $s)
return $ret;
+ $headers = $a->get_curl_headers();
+ $lines = explode("\n",$headers);
+ if(count($lines)) {
+ foreach($lines as $line) {
+ // don't try and run feeds through the html5 parser
+ if(stristr($line,'content-type:') && ((stristr($line,'application/atom+xml')) || (stristr($line,'application/rss+xml'))))
+ return ret;
+ }
+ }
+
+
+
$dom = HTML5_Parser::parse($s);
if(! $dom)
@@ -105,12 +132,24 @@ function scrape_meta($url) {
if(! function_exists('scrape_vcard')) {
function scrape_vcard($url) {
+ $a = get_app();
+
$ret = array();
$s = fetch_url($url);
if(! $s)
return $ret;
+ $headers = $a->get_curl_headers();
+ $lines = explode("\n",$headers);
+ if(count($lines)) {
+ foreach($lines as $line) {
+ // don't try and run feeds through the html5 parser
+ if(stristr($line,'content-type:') && ((stristr($line,'application/atom+xml')) || (stristr($line,'application/rss+xml'))))
+ return ret;
+ }
+ }
+
$dom = HTML5_Parser::parse($s);
if(! $dom)
@@ -142,12 +181,31 @@ function scrape_vcard($url) {
if(! function_exists('scrape_feed')) {
function scrape_feed($url) {
+ $a = get_app();
+
$ret = array();
$s = fetch_url($url);
if(! $s)
return $ret;
+ $headers = $a->get_curl_headers();
+ $lines = explode("\n",$headers);
+ if(count($lines)) {
+ foreach($lines as $line) {
+ if(stristr($line,'content-type:')) {
+ if(stristr($line,'application/atom+xml')) {
+ $ret['feed_atom'] = $url;
+ return $ret;
+ }
+ if(stristr($line,'application/rss+xml')) {
+ $ret['feed_rss'] = $url;
+ return ret;
+ }
+ }
+ }
+ }
+
$dom = HTML5_Parser::parse($s);
if(! $dom)
diff --git a/mod/follow.php b/mod/follow.php
index 62ba2585c..c5f6d9e3f 100644
--- a/mod/follow.php
+++ b/mod/follow.php
@@ -161,7 +161,7 @@ function follow_post(&$a) {
// create contact record
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `notify`, `poll`, `name`, `nick`, `photo`, `network`, `rel`, `priority`,
`blocked`, `readonly`, `pending` )
- VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, 0, 0, 0 ) ",
+ VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, 0, 0, 0 ) ",
intval(local_user()),
dbesc(datetime_convert()),
dbesc($profile),