diaspora probe/scrape changes
This commit is contained in:
parent
3a0727d496
commit
7952961222
4 changed files with 26 additions and 14 deletions
2
boot.php
2
boot.php
|
@ -7,7 +7,7 @@ require_once('include/text.php');
|
||||||
require_once("include/pgettext.php");
|
require_once("include/pgettext.php");
|
||||||
|
|
||||||
|
|
||||||
define ( 'FRIENDIKA_VERSION', '2.2.1071' );
|
define ( 'FRIENDIKA_VERSION', '2.2.1072' );
|
||||||
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
|
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
|
||||||
define ( 'DB_UPDATE_VERSION', 1079 );
|
define ( 'DB_UPDATE_VERSION', 1079 );
|
||||||
|
|
||||||
|
|
|
@ -468,13 +468,6 @@ function probe_url($url) {
|
||||||
logger('probe_url: scrape_vcard: ' . print_r($vcard,true), LOGGER_DATA);
|
logger('probe_url: scrape_vcard: ' . print_r($vcard,true), LOGGER_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(! $profile) {
|
|
||||||
if($diaspora)
|
|
||||||
$profile = $hcard;
|
|
||||||
else
|
|
||||||
$profile = $url;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($twitter) {
|
if($twitter) {
|
||||||
logger('twitter: setup');
|
logger('twitter: setup');
|
||||||
$tid = basename($url);
|
$tid = basename($url);
|
||||||
|
@ -490,8 +483,16 @@ function probe_url($url) {
|
||||||
if(x($vcard,'nick'))
|
if(x($vcard,'nick'))
|
||||||
$vcard['fn'] = $vcard['nick'];
|
$vcard['fn'] = $vcard['nick'];
|
||||||
|
|
||||||
|
$check_feed = false;
|
||||||
|
|
||||||
if(((! isset($vcard)) && (! $poll) && (! $at_addr)) || ($twitter)) {
|
if($twitter || ! $poll)
|
||||||
|
$check_feed = true;
|
||||||
|
if((! isset($vcard)) || (! $profile))
|
||||||
|
$check_feed = true;
|
||||||
|
if(($at_addr) && (! count($links)))
|
||||||
|
$check_feed = false;
|
||||||
|
|
||||||
|
if($check_feed) {
|
||||||
|
|
||||||
$feedret = scrape_feed($url);
|
$feedret = scrape_feed($url);
|
||||||
logger('probe_url: scrape_feed returns: ' . print_r($feedret,true), LOGGER_DATA);
|
logger('probe_url: scrape_feed returns: ' . print_r($feedret,true), LOGGER_DATA);
|
||||||
|
@ -527,6 +528,8 @@ function probe_url($url) {
|
||||||
if(strpos($vcard['fn'],'@') !== false)
|
if(strpos($vcard['fn'],'@') !== false)
|
||||||
$vcard['fn'] = substr($vcard['fn'],0,strpos($vcard['fn'],'@'));
|
$vcard['fn'] = substr($vcard['fn'],0,strpos($vcard['fn'],'@'));
|
||||||
$email = unxmlify($author->get_email());
|
$email = unxmlify($author->get_email());
|
||||||
|
if(! $profile && $author->get_link())
|
||||||
|
$profile = trim(unxmlify($author->get_link()));
|
||||||
if(! $vcard['photo']) {
|
if(! $vcard['photo']) {
|
||||||
$rawtags = $feed->get_feed_tags( SIMPLEPIE_NAMESPACE_ATOM_10, 'author');
|
$rawtags = $feed->get_feed_tags( SIMPLEPIE_NAMESPACE_ATOM_10, 'author');
|
||||||
if($rawtags) {
|
if($rawtags) {
|
||||||
|
@ -547,6 +550,8 @@ function probe_url($url) {
|
||||||
if(strpos($vcard['fn'],'@') !== false)
|
if(strpos($vcard['fn'],'@') !== false)
|
||||||
$vcard['fn'] = substr($vcard['fn'],0,strpos($vcard['fn'],'@'));
|
$vcard['fn'] = substr($vcard['fn'],0,strpos($vcard['fn'],'@'));
|
||||||
$email = unxmlify($author->get_email());
|
$email = unxmlify($author->get_email());
|
||||||
|
if(! $profile && $author->get_link())
|
||||||
|
$profile = trim(unxmlify($author->get_link()));
|
||||||
}
|
}
|
||||||
if(! $vcard['photo']) {
|
if(! $vcard['photo']) {
|
||||||
$rawmedia = $item->get_item_tags('http://search.yahoo.com/mrss/','thumbnail');
|
$rawmedia = $item->get_item_tags('http://search.yahoo.com/mrss/','thumbnail');
|
||||||
|
@ -584,8 +589,10 @@ function probe_url($url) {
|
||||||
if(strpos($vcard['nick'],' '))
|
if(strpos($vcard['nick'],' '))
|
||||||
$vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
|
$vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
|
||||||
}
|
}
|
||||||
$network = 'feed';
|
if(! $network)
|
||||||
$priority = 2;
|
$network = 'feed';
|
||||||
|
if(! $priority)
|
||||||
|
$priority = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,8 +600,12 @@ function probe_url($url) {
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
$vcard['photo'] = $a->get_baseurl() . '/images/default-profile.jpg' ;
|
$vcard['photo'] = $a->get_baseurl() . '/images/default-profile.jpg' ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(! $profile)
|
||||||
|
$profile = $url;
|
||||||
|
|
||||||
$vcard['fn'] = notags($vcard['fn']);
|
$vcard['fn'] = notags($vcard['fn']);
|
||||||
$vcard['nick'] = notags($vcard['nick']);
|
$vcard['nick'] = str_replace(' ','',notags($vcard['nick']));
|
||||||
|
|
||||||
|
|
||||||
$result['name'] = $vcard['fn'];
|
$result['name'] = $vcard['fn'];
|
||||||
|
|
|
@ -205,7 +205,7 @@ if(strlen($a->module)) {
|
||||||
goaway($a->get_baseurl() . $_SERVER['REQUEST_URI']);
|
goaway($a->get_baseurl() . $_SERVER['REQUEST_URI']);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger('index.php: page not found: ' . $_SERVER['REQUEST_URI'] . ' QUERY: ' . $_SERVER['QUERY_STRING'], LOGGER_DEBUG);
|
logger('index.php: page not found: ' . $_SERVER['REQUEST_URI'] . ' ADDRESS: ' . $_SERVER['REMOTE_ADDR'] . ' QUERY: ' . $_SERVER['QUERY_STRING'], LOGGER_DEBUG);
|
||||||
header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . t('Not Found'));
|
header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . t('Not Found'));
|
||||||
notice( t('Page not found.' ) . EOL);
|
notice( t('Page not found.' ) . EOL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ function probe_content(&$a) {
|
||||||
$o .= '<br /><br />';
|
$o .= '<br /><br />';
|
||||||
|
|
||||||
if(x($_GET,'addr')) {
|
if(x($_GET,'addr')) {
|
||||||
|
|
||||||
$addr = trim($_GET['addr']);
|
$addr = trim($_GET['addr']);
|
||||||
$res = probe_url($addr);
|
$res = probe_url($addr);
|
||||||
$o .= '<pre>';
|
$o .= '<pre>';
|
||||||
|
|
Loading…
Reference in a new issue