X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fdiaspora.php;h=c5b724509c0d5858b63ba8686d819297c035edbc;hb=a41e78a06da0963187cc67c3e8e8c589e0d900a2;hp=baee0420ba6439f907eb8d2bfbab417fa47b9249;hpb=1581e02f8f2dd6c4515cbb33f3cb85b8f66ec8e0;p=friendica.git diff --git a/include/diaspora.php b/include/diaspora.php index baee0420ba..c5b724509c 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -141,6 +141,17 @@ function diaspora_get_contact_by_handle($uid,$handle) { ); if($r && count($r)) return $r[0]; + + $handle_parts = explode("@", $handle); + $nurl_sql = '%%://' . $handle_parts[1] . '%%/profile/' . $handle_parts[0]; + $r = q("SELECT * FROM contact WHERE network = '%s' AND uid = %d AND nurl LIKE '%s' LIMIT 1", + dbesc(NETWORK_DFRN), + intval($uid), + dbesc($nurl_sql) + ); + if($r && count($r)) + return $r[0]; + return false; } @@ -1949,7 +1960,7 @@ function diaspora_signed_retraction($importer,$xml,$msg) { $contact = diaspora_get_contact_by_handle($importer['uid'],$diaspora_handle); if(! $contact) { - logger('diaspora_signed_retraction: no contact'); + logger('diaspora_signed_retraction: no contact ' . $diaspora_handle . ' for ' . $importer['uid']); return; } @@ -2061,11 +2072,20 @@ function diaspora_profile($importer,$xml,$msg) { $image_url = unxmlify($xml->image_url); $birthday = unxmlify($xml->birthday); - $r = q("SELECT DISTINCT ( `resource-id` ) FROM `photo` WHERE `uid` = %d AND `contact-id` = %d AND `album` = 'Contact Photos' ", + + $handle_parts = explode("@", $diaspora_handle); + if($name === '') { + $name = $handle_parts[0]; + } + if(strpos($image_url, $handle_parts[1]) === false) { + $image_url = "http://" . $handle_parts[1] . $image_url; + } + +/* $r = q("SELECT DISTINCT ( `resource-id` ) FROM `photo` WHERE `uid` = %d AND `contact-id` = %d AND `album` = 'Contact Photos' ", intval($importer['uid']), intval($contact['id']) ); - $oldphotos = ((count($r)) ? $r : null); + $oldphotos = ((count($r)) ? $r : null);*/ require_once('include/Photo.php'); @@ -2098,7 +2118,7 @@ function diaspora_profile($importer,$xml,$msg) { intval($importer['uid']) ); - if($r) { +/* if($r) { if($oldphotos) { foreach($oldphotos as $ph) { q("DELETE FROM `photo` WHERE `uid` = %d AND `contact-id` = %d AND `album` = 'Contact Photos' AND `resource-id` = '%s' ", @@ -2108,7 +2128,7 @@ function diaspora_profile($importer,$xml,$msg) { ); } } - } + } */ return;