Merge pull request #1751 from annando/1507-diaspora-contact-links

Diaspora: Shared posts looking better, mentions are now links
This commit is contained in:
Tobias Diekershoff 2015-07-12 13:54:41 +02:00
commit 7134c01cb2
6 changed files with 27 additions and 4 deletions

View File

@ -34,6 +34,15 @@ function diaspora2bb($s) {
$s = str_replace('#','#',$s); $s = str_replace('#','#',$s);
$search = array(" \n", "\n ");
$replace = array("\n", "\n");
do {
$oldtext = $s;
$s = str_replace($search, $replace, $s);
} while ($oldtext != $s);
$s = str_replace("\n\n", "<br>", $s);
$s = html2bbcode($s); $s = html2bbcode($s);
// protect the recycle symbol from turning into a tag, but without unescaping angles and naked ampersands // protect the recycle symbol from turning into a tag, but without unescaping angles and naked ampersands

View File

@ -887,8 +887,12 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
$MAILSearchString = $URLSearchString; $MAILSearchString = $URLSearchString;
// Remove all hashtag addresses // Remove all hashtag addresses
if ((!$tryoembed OR $simplehtml) AND ($simplehtml != 7)) if ((!$tryoembed OR $simplehtml) AND !in_array($simplehtml, array(3, 7)))
$Text = preg_replace("/([#@])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '$1$3', $Text); $Text = preg_replace("/([#@])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '$1$3', $Text);
elseif ($simplehtml == 3)
$Text = preg_replace("/([@])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
'$1<a href="$2">$3</a>',
$Text);
elseif ($simplehtml == 7) elseif ($simplehtml == 7)
$Text = preg_replace("/([@])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", $Text = preg_replace("/([@])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
'$1<span class="vcard"><a href="$2" class="url" title="$3"><span class="fn nickname mention">$3</span></a></span>', '$1<span class="vcard"><a href="$2" class="url" title="$3"><span class="fn nickname mention">$3</span></a></span>',

View File

@ -1,5 +1,10 @@
<?php <?php
/*
To-Do:
- GET /people/9aed8882b9f64896/stream
*/
require_once('include/crypto.php'); require_once('include/crypto.php');
require_once('include/items.php'); require_once('include/items.php');
require_once('include/bb2diaspora.php'); require_once('include/bb2diaspora.php');

View File

@ -406,9 +406,13 @@ function notifier_run(&$argv, &$argc){
} }
} }
} }
}
$r = q("SELECT * FROM `contact` WHERE `id` IN ( $conversant_str ) AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0"); // It only makes sense to distribute answers to OStatus messages to Friendica and OStatus - but not Diaspora
$sql_extra = " AND `network` IN ('".NETWORK_OSTATUS."', '".NETWORK_DFRN."')";
} else
$sql_extra = "";
$r = q("SELECT * FROM `contact` WHERE `id` IN ($conversant_str) AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0".$sql_extra);
if(count($r)) if(count($r))
$contacts = $r; $contacts = $r;

View File

@ -325,7 +325,7 @@ class Item extends BaseObject {
'body' => $body_e, 'body' => $body_e,
'text' => $text_e, 'text' => $text_e,
'id' => $this->get_id(), 'id' => $this->get_id(),
'guid' => $item['guid'], 'guid' => urlencode($item['guid']),
'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])), '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'), $this->get_owner_name(), ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])), 'olinktitle' => sprintf( t('View %s\'s profile @ %s'), $this->get_owner_name(), ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])),
'to' => t('to'), 'to' => t('to'),

View File

@ -1216,6 +1216,7 @@ section.minimal {
.wall-item-container .wall-item-content img { .wall-item-container .wall-item-content img {
max-width: 100%; max-width: 100%;
vertical-align: middle;
/* max-width: 650px; */ /* max-width: 650px; */
/* max-width: 580px; */ /* max-width: 580px; */
} }