Merge remote-tracking branch 'upstream/develop' into 1602-diaspora

This commit is contained in:
Michael Vogel 2016-03-21 06:47:47 +01:00
commit 206c26ae30
10 changed files with 43 additions and 22 deletions

View File

@ -85,7 +85,7 @@ class dfrn {
$converse = true;
if($a->argv[$x] == 'starred')
$starred = true;
if($a->argv[$x] === 'category' && $a->argc > ($x + 1) && strlen($a->argv[$x+1]))
if($a->argv[$x] == 'category' && $a->argc > ($x + 1) && strlen($a->argv[$x+1]))
$category = $a->argv[$x+1];
}
}
@ -244,7 +244,7 @@ class dfrn {
foreach($items as $item) {
// prevent private email from leaking.
if($item['network'] === NETWORK_MAIL)
if($item['network'] == NETWORK_MAIL)
continue;
// public feeds get html, our own nodes use bbcode
@ -628,7 +628,7 @@ class dfrn {
if($r->title)
xml_add_element($doc, $entry, "title", $r->title);
if($r->link) {
if(substr($r->link,0,1) === '<') {
if(substr($r->link,0,1) == '<') {
if(strstr($r->link,'&') && (! strstr($r->link,'&amp;')))
$r->link = str_replace('&','&amp;', $r->link);
@ -759,7 +759,7 @@ class dfrn {
// The "content" field is not read by the receiver. We could remove it when the type is "text"
// We keep it at the moment, maybe there is some old version that doesn't read "dfrn:env"
xml_add_element($doc, $entry, "content", (($type === 'html') ? $htmlbody : $body), array("type" => $type));
xml_add_element($doc, $entry, "content", (($type == 'html') ? $htmlbody : $body), array("type" => $type));
// We save this value in "plink". Maybe we should read it from there as well?
xml_add_element($doc, $entry, "link", "", array("rel" => "alternate", "type" => "text/html",
@ -1773,6 +1773,9 @@ class dfrn {
* @return bool Should the processing of the entries be continued?
*/
private function process_verbs($entrytype, $importer, &$item, &$is_like) {
logger("Process verb ".$item["verb"]." and object-type ".$item["object-type"]." for entrytype ".$entrytype, LOGGER_DEBUG);
if (($entrytype == DFRN_TOP_LEVEL)) {
// The filling of the the "contact" variable is done for legcy reasons
// The functions below are partly used by ostatus.php as well - where we have this variable
@ -1803,11 +1806,11 @@ class dfrn {
return false;
}
} else {
if(($item["verb"] === ACTIVITY_LIKE)
|| ($item["verb"] === ACTIVITY_DISLIKE)
|| ($item["verb"] === ACTIVITY_ATTEND)
|| ($item["verb"] === ACTIVITY_ATTENDNO)
|| ($item["verb"] === ACTIVITY_ATTENDMAYBE)) {
if(($item["verb"] == ACTIVITY_LIKE)
|| ($item["verb"] == ACTIVITY_DISLIKE)
|| ($item["verb"] == ACTIVITY_ATTEND)
|| ($item["verb"] == ACTIVITY_ATTENDNO)
|| ($item["verb"] == ACTIVITY_ATTENDMAYBE)) {
$is_like = true;
$item["type"] = "activity";
$item["gravity"] = GRAVITY_LIKE;
@ -1833,7 +1836,7 @@ class dfrn {
} else
$is_like = false;
if(($item["verb"] === ACTIVITY_TAG) && ($item["object-type"] === ACTIVITY_OBJ_TAGTERM)) {
if(($item["verb"] == ACTIVITY_TAG) && ($item["object-type"] == ACTIVITY_OBJ_TAGTERM)) {
$xo = parse_xml_string($item["object"],false);
$xt = parse_xml_string($item["target"],false);
@ -2261,15 +2264,17 @@ class dfrn {
else
return;
if($item["object-type"] === ACTIVITY_OBJ_EVENT) {
if($item["object-type"] == ACTIVITY_OBJ_EVENT) {
logger("Deleting event ".$item["event-id"], LOGGER_DEBUG);
event_delete($item["event-id"]);
}
if(($item["verb"] === ACTIVITY_TAG) && ($item["object-type"] === ACTIVITY_OBJ_TAGTERM)) {
if(($item["verb"] == ACTIVITY_TAG) && ($item["object-type"] == ACTIVITY_OBJ_TAGTERM)) {
$xo = parse_xml_string($item["object"],false);
$xt = parse_xml_string($item["target"],false);
if($xt->type === ACTIVITY_OBJ_NOTE) {
if($xt->type == ACTIVITY_OBJ_NOTE) {
$i = q("SELECT `id`, `contact-id`, `tag` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($xt->id),
intval($importer["importer_uid"])

View File

@ -194,6 +194,7 @@ EOT;
$arr = array();
$arr['guid'] = get_guid(32);
$arr['uri'] = $uri;
$arr['uid'] = $owner_uid;
$arr['contact-id'] = $contact['id'];

View File

@ -448,6 +448,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
if(count($self)) {
$arr = array();
$arr['guid'] = get_guid(32);
$arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), $uid);
$arr['uid'] = $uid;
$arr['contact-id'] = $self[0]['id'];
@ -466,7 +467,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$BPhoto = '[url=' . $contact['url'] . ']' . '[img]' . $contact['thumb'] . '[/img][/url]';
$arr['verb'] = ACTIVITY_FRIEND;
$arr['object-type'] = ACTIVITY_OBJ_PERSON;
$arr['object-type'] = ACTIVITY_OBJ_PERSON;
$arr['body'] = sprintf( t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$BPhoto;
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $contact['name'] . '</title>'

View File

@ -74,10 +74,18 @@ function fbrowser_content($a){
$filename_e = $rr['filename'];
}
// Take the second largest picture as preview
$p = q("SELECT `scale` FROM `photo` WHERE `resource-id` = '%s' AND `scale` > %d ORDER BY `resource-id`, `scale` LIMIT 1",
dbesc($rr['resource-id']), intval($rr['hiq']));
if ($p)
$scale = $p[0]["scale"];
else
$scale = $rr['loq'];
return array(
$a->get_baseurl() . '/photos/' . $a->user['nickname'] . '/image/' . $rr['resource-id'],
$filename_e,
$a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['loq'] . '.'. $ext
$a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $scale . '.'. $ext
);
}
$files = array_map("_map_files1", $r);

View File

@ -62,7 +62,7 @@ function mood_init(&$a) {
$action = sprintf( t('%1$s is currently %2$s'), '[url=' . $poster['url'] . ']' . $poster['name'] . '[/url]' , $verbs[$verb]);
$arr = array();
$arr['guid'] = get_guid(32);
$arr['uid'] = $uid;
$arr['uri'] = $uri;
$arr['parent-uri'] = (($parent_uri) ? $parent_uri : $uri);

View File

@ -488,7 +488,7 @@ function photos_post(&$a) {
$uri = item_new_uri($a->get_hostname(),$page_owner_uid);
$arr = array();
$arr['guid'] = get_guid(32);
$arr['uid'] = $page_owner_uid;
$arr['uri'] = $uri;
$arr['parent-uri'] = $uri;
@ -677,7 +677,7 @@ function photos_post(&$a) {
$uri = item_new_uri($a->get_hostname(),$page_owner_uid);
$arr = array();
$arr['guid'] = get_guid(32);
$arr['uid'] = $page_owner_uid;
$arr['uri'] = $uri;
$arr['parent-uri'] = $uri;
@ -904,6 +904,7 @@ function photos_post(&$a) {
if($lat && $lon)
$arr['coord'] = $lat . ' ' . $lon;
$arr['guid'] = get_guid(32);
$arr['uid'] = $page_owner_uid;
$arr['uri'] = $uri;
$arr['parent-uri'] = $uri;

View File

@ -91,6 +91,7 @@ function poke_init(&$a) {
$arr = array();
$arr['guid'] = get_guid(32);
$arr['uid'] = $uid;
$arr['uri'] = $uri;
$arr['parent-uri'] = (($parent_uri) ? $parent_uri : $uri);

View File

@ -526,6 +526,8 @@ function profile_activity($changed, $value) {
return;
$arr = array();
$arr['guid'] = get_guid(32);
$arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), local_user());
$arr['uid'] = local_user();
$arr['contact-id'] = $self[0]['id'];

View File

@ -103,10 +103,11 @@ EOT;
$bodyverb = t('%1$s is following %2$s\'s %3$s');
if(! isset($bodyverb))
return;
return;
$arr = array();
$arr['guid'] = get_guid(32);
$arr['uri'] = $uri;
$arr['uid'] = $owner_uid;
$arr['contact-id'] = $contact['id'];
@ -123,7 +124,7 @@ EOT;
$arr['author-name'] = $contact['name'];
$arr['author-link'] = $contact['url'];
$arr['author-avatar'] = $contact['thumb'];
$ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
$alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
$plink = '[url=' . $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . ']' . $post_type . '[/url]';

View File

@ -95,12 +95,13 @@ EOT;
$bodyverb = t('%1$s tagged %2$s\'s %3$s with %4$s');
if(! isset($bodyverb))
return;
return;
$termlink = html_entity_decode('&#x2317;') . '[url=' . $a->get_baseurl() . '/search?tag=' . urlencode($term) . ']'. $term . '[/url]';
$arr = array();
$arr['guid'] = get_guid(32);
$arr['uri'] = $uri;
$arr['uid'] = $owner_uid;
$arr['contact-id'] = $contact['id'];
@ -115,7 +116,7 @@ EOT;
$arr['author-name'] = $contact['name'];
$arr['author-link'] = $contact['url'];
$arr['author-avatar'] = $contact['thumb'];
$ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
$alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
$plink = '[url=' . $item['plink'] . ']' . $post_type . '[/url]';