diff --git a/include/dfrn.php b/include/dfrn.php index 1c5ac2b012..d96805a56b 100644 --- a/include/dfrn.php +++ b/include/dfrn.php @@ -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,'&'))) $r->link = str_replace('&','&', $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"]) diff --git a/include/like.php b/include/like.php index 49534ea613..15633fc767 100644 --- a/include/like.php +++ b/include/like.php @@ -194,6 +194,7 @@ EOT; $arr = array(); + $arr['guid'] = get_guid(32); $arr['uri'] = $uri; $arr['uid'] = $owner_uid; $arr['contact-id'] = $contact['id']; diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index cc09021dca..5e0e5c85c5 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -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'] = '' . ACTIVITY_OBJ_PERSON . '' . $contact['name'] . '' diff --git a/mod/fbrowser.php b/mod/fbrowser.php index 0a2a7dead5..5836efbe52 100644 --- a/mod/fbrowser.php +++ b/mod/fbrowser.php @@ -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); diff --git a/mod/mood.php b/mod/mood.php index eee11e20c5..5e6ca0fcfc 100644 --- a/mod/mood.php +++ b/mod/mood.php @@ -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); diff --git a/mod/photos.php b/mod/photos.php index 2257a96653..4761b627d8 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -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; diff --git a/mod/poke.php b/mod/poke.php index 45a577cda6..4a643435be 100644 --- a/mod/poke.php +++ b/mod/poke.php @@ -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); diff --git a/mod/profiles.php b/mod/profiles.php index 0b8261422f..39382fbdd5 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -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']; diff --git a/mod/subthread.php b/mod/subthread.php index 1486a33b42..33cf7489c1 100644 --- a/mod/subthread.php +++ b/mod/subthread.php @@ -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]'; diff --git a/mod/tagger.php b/mod/tagger.php index 2c469a58bb..26166a3cc0 100644 --- a/mod/tagger.php +++ b/mod/tagger.php @@ -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('⌗') . '[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]';