X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fdiaspora.php;h=ac78beb2f9e58a9d2037307d01e19e577a71a7ac;hb=a9ec56ace1756726517650d96192df5320f445fe;hp=ad5e2adb2a4d10f601111875348e30af64178c13;hpb=dc212de9606422be6e912a0bb7f3569192942938;p=friendica.git diff --git a/include/diaspora.php b/include/diaspora.php index ad5e2adb2a..ac78beb2f9 100644 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -451,13 +451,14 @@ function diaspora_request($importer,$xml) { $batch = (($ret['batch']) ? $ret['batch'] : implode('/', array_slice(explode('/',$ret['url']),0,3)) . '/receive/public'); - $r = q("INSERT INTO `contact` (`uid`, `network`,`addr`,`created`,`url`,`batch`,`name`,`nick`,`photo`,`pubkey`,`notify`,`poll`,`blocked`,`priority`) - VALUES ( %d, '%s', '%s', '%s','%s','%s','%s','%s','%s','%s','%s','%s',%d,%d) ", + $r = q("INSERT INTO `contact` (`uid`, `network`,`addr`,`created`,`url`,`nurl`,`batch`,`name`,`nick`,`photo`,`pubkey`,`notify`,`poll`,`blocked`,`priority`) + VALUES ( %d, '%s', '%s', '%s', '%s','%s','%s','%s','%s','%s','%s','%s','%s',%d,%d) ", intval($importer['uid']), dbesc($ret['network']), dbesc($ret['addr']), datetime_convert(), dbesc($ret['url']), + dbesc(normalise_link($ret['url'])), dbesc($batch), dbesc($ret['name']), dbesc($ret['nick']), @@ -635,12 +636,18 @@ function diaspora_reshare($importer,$xml) { $x = str_replace(array('',''),array('',''),$x); $source_xml = parse_xml_string($x,false); - if(strlen($source_xml->post->asphoto->objectId) && ($source_xml->post->asphoto->objectId != 0) && ($source_xml->post->asphoto->image_url)) + if(strlen($source_xml->post->asphoto->objectId) && ($source_xml->post->asphoto->objectId != 0) && ($source_xml->post->asphoto->image_url)) { $body = '[url=' . notags(unxmlify($source_xml->post->asphoto->image_url)) . '][img]' . notags(unxmlify($source_xml->post->asphoto->objectId)) . '[/img][/url]' . "\n"; - elseif($source_xml->post->asphoto->image_url) + $body = scale_diaspora_images($body,false); + } + elseif($source_xml->post->asphoto->image_url) { $body = '[img]' . notags(unxmlify($source_xml->post->asphoto->image_url)) . '[/img]' . "\n"; + $body = scale_diaspora_images($body); + } elseif($source_xml->post->status_message) { $body = diaspora2bb($source_xml->post->status_message->raw_message); + $body = scale_diaspora_images($body); + } else { logger('diaspora_reshare: no reshare content found: ' . print_r($source_xml,true)); @@ -771,16 +778,19 @@ function diaspora_asphoto($importer,$xml) { $created = unxmlify($xml->created_at); $private = ((unxmlify($xml->public) == 'false') ? 1 : 0); - if(strlen($xml->objectId) && ($xml->objectId != 0) && ($xml->image_url)) + if(strlen($xml->objectId) && ($xml->objectId != 0) && ($xml->image_url)) { $body = '[url=' . notags(unxmlify($xml->image_url)) . '][img]' . notags(unxmlify($xml->objectId)) . '[/img][/url]' . "\n"; - elseif($xml->image_url) + $body = scale_diaspora_images($body,false); + } + elseif($xml->image_url) { $body = '[img]' . notags(unxmlify($xml->image_url)) . '[/img]' . "\n"; + $body = scale_diaspora_images($body); + } else { logger('diaspora_asphoto: no photo url found.'); return; } - $datarray = array(); @@ -1019,6 +1029,8 @@ function diaspora_photo($importer,$xml,$msg) { $link_text = '[img]' . $remote_photo_path . $remote_photo_name . '[/img]' . "\n"; + $link_text = scale_diaspora_images($link_text); + if(strpos($parent_item['body'],$link_text) === false) { $r = q("update item set `body` = '%s', `visible` = 1 where `id` = %d and `uid` = %d limit 1", dbesc($link_text . $parent_item['body']), @@ -1406,6 +1418,17 @@ function diaspora_send_status($item,$owner,$contact,$public_batch = false) { $body = xmlify(html_entity_decode(bb2diaspora($body))); + if($item['attach']) { + $cnt = preg_match_all('/href=\"(.*?)\"(.*?)title=\"(.*?)\"/ism',$item['attach'],$matches,PREG_SET_ORDER); + if(cnt) { + $body .= "\n" . t('Attachments:') . "\n"; + foreach($matches as $mtch) { + $body .= '[' . $mtch[3] . '](' . $mtch[1] . ')' . "\n"; + } + } + } + + $public = (($item['private']) ? 'false' : 'true'); require_once('include/datetime.php');