$author = unxmlify($data->author);
$recipient = unxmlify($data->recipient);
-- if (!$author || !$recipient)
++ if (!$author || !$recipient) {
return false;
++ }
// the current protocol version doesn't know these fields
// That means that we will assume their existance
-- if (isset($data->following))
++ if (isset($data->following)) {
$following = (unxmlify($data->following) == "true");
-- else
++ } else {
$following = true;
++ }
-- if (isset($data->sharing))
++ if (isset($data->sharing)) {
$sharing = (unxmlify($data->sharing) == "true");
-- else
++ } else {
$sharing = true;
++ }
$contact = self::contact_by_handle($importer["uid"],$author);
// Normally we needn't to do so, but the first message could have been vanished.
if (in_array($contact["rel"], array(CONTACT_IS_FRIEND, CONTACT_IS_FOLLOWER))) {
$u = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval($importer["uid"]));
-- if($u) {
++ if ($u) {
logger("Sending share message to author ".$author." - Contact: ".$contact["id"]." - User: ".$importer["uid"], LOGGER_DEBUG);
$ret = self::send_share($u[0], $contact);
}
$created_at = datetime_convert("UTC", "UTC", notags(unxmlify($data->created_at)));
$contact = self::allowed_contact_by_handle($importer, $author, false);
-- if (!$contact)
++ if (!$contact) {
return false;
++ }
$message_id = self::message_exists($importer["uid"], $guid);
-- if ($message_id)
++ if ($message_id) {
return $message_id;
++ }
$original_item = self::original_item($root_guid, $root_author, $author);
-- if (!$original_item)
++ if (!$original_item) {
return false;
++ }
$orig_url = App::get_baseurl()."/display/".$original_item["guid"];
self::fetch_guid($datarray);
$message_id = item_store($datarray);
-- if ($message_id)
++ if ($message_id) {
logger("Stored reshare ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
++ }
return $message_id;
}
// Diaspora isn't able to do likes on comments - but red does
if (($item["item_network"] == NETWORK_DIASPORA) AND ($indent == 'comment') AND
- !diaspora::is_redmatrix($item["owner-link"]) AND isset($buttons["like"])) {
- !Diaspora::is_redmatrix($item["owner-link"]) AND isset($buttons["like"]))
++ !Diaspora::is_redmatrix($item["owner-link"]) AND isset($buttons["like"])) {
unset($buttons["like"]);
+ }
// Diaspora doesn't has multithreaded comments
- if (($item["item_network"] == NETWORK_DIASPORA) AND ($indent == 'comment'))
+ if (($item["item_network"] == NETWORK_DIASPORA) AND ($indent == 'comment')) {
unset($comment);
+ }
// Facebook can like comments - but it isn't programmed in the connector yet.
- if (($item["item_network"] == NETWORK_FACEBOOK) AND ($indent == 'comment') AND isset($buttons["like"]))
+ if (($item["item_network"] == NETWORK_FACEBOOK) AND ($indent == 'comment') AND isset($buttons["like"])) {
unset($buttons["like"]);
+ }
$tmp_item = array(
- 'template' => $this->get_template(),
-
- 'type' => implode("",array_slice(explode("/",$item['verb']),-1)),
- 'tags' => $item['tags'],
- 'hashtags' => $item['hashtags'],
- 'mentions' => $item['mentions'],
- 'txt_cats' => t('Categories:'),
- 'txt_folders' => t('Filed under:'),
- 'has_cats' => ((count($categories)) ? 'true' : ''),
- 'has_folders' => ((count($folders)) ? 'true' : ''),
- 'categories' => $categories,
- 'folders' => $folders,
- 'body' => $body_e,
- 'text' => $text_e,
- 'id' => $this->get_id(),
- 'guid' => urlencode($item['guid']),
- 'isevent' => $isevent,
- 'attend' => $attend,
- 'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
- 'olinktitle' => sprintf( t('View %s\'s profile @ %s'), htmlentities($this->get_owner_name()), ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])),
- 'to' => t('to'),
- 'via' => t('via'),
- 'wall' => t('Wall-to-Wall'),
- 'vwall' => t('via Wall-To-Wall:'),
- 'profile_url' => $profile_link,
+ 'template' => $this->get_template(),
+ 'type' => implode("",array_slice(explode("/",$item['verb']),-1)),
+ 'tags' => $item['tags'],
+ 'hashtags' => $item['hashtags'],
+ 'mentions' => $item['mentions'],
+ 'txt_cats' => t('Categories:'),
+ 'txt_folders' => t('Filed under:'),
+ 'has_cats' => ((count($categories)) ? 'true' : ''),
+ 'has_folders' => ((count($folders)) ? 'true' : ''),
+ 'categories' => $categories,
+ 'folders' => $folders,
+ 'body' => $body_e,
+ 'text' => $text_e,
+ 'id' => $this->get_id(),
+ 'guid' => urlencode($item['guid']),
+ 'isevent' => $isevent,
+ 'attend' => $attend,
+ 'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
+ 'olinktitle' => sprintf( t('View %s\'s profile @ %s'), htmlentities($this->get_owner_name()), ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])),
+ 'to' => t('to'),
+ 'via' => t('via'),
+ 'wall' => t('Wall-to-Wall'),
+ 'vwall' => t('via Wall-To-Wall:'),
+ 'profile_url' => $profile_link,
'item_photo_menu' => item_photo_menu($item),
- 'name' => $name_e,
- 'thumb' => $a->remove_baseurl(proxy_url($item['author-thumb'], false, PROXY_SIZE_THUMB)),
- 'osparkle' => $osparkle,
- 'sparkle' => $sparkle,
- 'title' => $title_e,
- 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'),
- 'ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
- 'app' => $item['app'],
- 'created' => relative_date($item['created']),
- 'lock' => $lock,
- 'location' => $location_e,
- 'indent' => $indent,
- 'shiny' => $shiny,
- 'owner_url' => $this->get_owner_url(),
- 'owner_photo' => $a->remove_baseurl(proxy_url($item['owner-thumb'], false, PROXY_SIZE_THUMB)),
- 'owner_name' => htmlentities($owner_name_e),
- 'plink' => get_plink($item),
- 'edpost' => ((feature_enabled($conv->get_profile_owner(),'edit_posts')) ? $edpost : ''),
- 'isstarred' => $isstarred,
- 'star' => ((feature_enabled($conv->get_profile_owner(),'star_posts')) ? $star : ''),
- 'ignore' => ((feature_enabled($conv->get_profile_owner(),'ignore_posts')) ? $ignore : ''),
- 'tagger' => $tagger,
- 'filer' => ((feature_enabled($conv->get_profile_owner(),'filing')) ? $filer : ''),
- 'drop' => $drop,
- 'vote' => $buttons,
- 'like' => $responses['like']['output'],
- 'dislike' => $responses['dislike']['output'],
- 'responses' => $responses,
- 'switchcomment' => t('Comment'),
- 'comment' => $comment,
- 'previewing' => ($conv->is_preview() ? ' preview ' : ''),
- 'wait' => t('Please wait'),
- 'thread_level' => $thread_level,
- 'postopts' => $langstr,
- 'edited' => $edited,
- 'network' => $item["item_network"],
- 'network_name' => network_to_name($item['item_network'], $profile_link),
+ 'name' => $name_e,
+ 'thumb' => $a->remove_baseurl(proxy_url($item['author-thumb'], false, PROXY_SIZE_THUMB)),
+ 'osparkle' => $osparkle,
+ 'sparkle' => $sparkle,
+ 'title' => $title_e,
+ 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'),
+ 'ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
+ 'app' => $item['app'],
+ 'created' => relative_date($item['created']),
+ 'lock' => $lock,
+ 'location' => $location_e,
+ 'indent' => $indent,
+ 'shiny' => $shiny,
+ 'owner_url' => $this->get_owner_url(),
+ 'owner_photo' => $a->remove_baseurl(proxy_url($item['owner-thumb'], false, PROXY_SIZE_THUMB)),
+ 'owner_name' => htmlentities($owner_name_e),
+ 'plink' => get_plink($item),
+ 'edpost' => ((feature_enabled($conv->get_profile_owner(),'edit_posts')) ? $edpost : ''),
+ 'isstarred' => $isstarred,
+ 'star' => ((feature_enabled($conv->get_profile_owner(),'star_posts')) ? $star : ''),
+ 'ignore' => ((feature_enabled($conv->get_profile_owner(),'ignore_posts')) ? $ignore : ''),
+ 'tagger' => $tagger,
+ 'filer' => ((feature_enabled($conv->get_profile_owner(),'filing')) ? $filer : ''),
+ 'drop' => $drop,
+ 'vote' => $buttons,
+ 'like' => $responses['like']['output'],
+ 'dislike' => $responses['dislike']['output'],
+ 'responses' => $responses,
+ 'switchcomment' => t('Comment'),
+ 'comment' => $comment,
+ 'previewing' => ($conv->is_preview() ? ' preview ' : ''),
+ 'wait' => t('Please wait'),
+ 'thread_level' => $thread_level,
+ 'postopts' => $langstr,
+ 'edited' => $edited,
+ 'network' => $item["item_network"],
+ 'network_name' => network_to_name($item['item_network'], $profile_link),
);
$arr = array('item' => $item, 'output' => $tmp_item);