OStatus replies should now work even if the thread starter isn't in the mentions.
This commit is contained in:
parent
788d3cf1ab
commit
d732d9d1a8
2 changed files with 40 additions and 13 deletions
|
@ -828,7 +828,6 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
|
||||
$ev = bbtoevent($Text);
|
||||
|
||||
|
||||
// Replace any html brackets with HTML Entities to prevent executing HTML or script
|
||||
// Don't use strip_tags here because it breaks [url] search by replacing & with amp
|
||||
|
||||
|
@ -885,8 +884,13 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
$MAILSearchString = $URLSearchString;
|
||||
|
||||
// Remove all hashtag addresses
|
||||
if (!$tryoembed OR $simplehtml)
|
||||
if ((!$tryoembed OR $simplehtml) AND ($simplehtml != 7))
|
||||
$Text = preg_replace("/([#@])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '$1$3', $Text);
|
||||
elseif ($simplehtml == 7)
|
||||
$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>',
|
||||
$Text);
|
||||
|
||||
|
||||
// Bookmarks in red - will be converted to bookmarks in friendica
|
||||
$Text = preg_replace("/#\^\[url\]([$URLSearchString]*)\[\/url\]/ism", '[bookmark=$1]$1[/bookmark]', $Text);
|
||||
|
@ -937,13 +941,13 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
// we may need to restrict this further if it picks up too many strays
|
||||
// link acct:user@host to a webfinger profile redirector
|
||||
|
||||
$Text = preg_replace('/acct:(.*?)@(.*?)([ ,])/', '<a href="' . $a->get_baseurl() . '/acctlink?addr=' . "$1@$2"
|
||||
$Text = preg_replace('/acct:(.*?)@(.*?)([ ,])/', '<a href="' . $a->get_baseurl() . '/acctlink?addr=' . "$1@$2"
|
||||
. '" target="extlink" >acct:' . "$1@$2$3" . '</a>',$Text);
|
||||
|
||||
// Perform MAIL Search
|
||||
$Text = preg_replace("/\[mail\]([$MAILSearchString]*)\[\/mail\]/", '<a href="mailto:$1">$1</a>', $Text);
|
||||
$Text = preg_replace("/\[mail\=([$MAILSearchString]*)\](.*?)\[\/mail\]/", '<a href="mailto:$1">$2</a>', $Text);
|
||||
|
||||
|
||||
// leave open the posibility of [map=something]
|
||||
// this is replaced in prepare_body() which has knowledge of the item location
|
||||
|
||||
|
@ -955,8 +959,8 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
}
|
||||
if (strpos($Text,'[map]') !== false) {
|
||||
$Text = preg_replace("/\[map\]/", '<div class="map"></div>', $Text);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check for headers
|
||||
$Text = preg_replace("(\[h1\](.*?)\[\/h1\])ism",'<h1>$1</h1>',$Text);
|
||||
$Text = preg_replace("(\[h2\](.*?)\[\/h2\])ism",'<h2>$1</h2>',$Text);
|
||||
|
@ -1004,8 +1008,8 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
$endlessloop = 0;
|
||||
|
||||
while ((((strpos($Text, "[/list]") !== false) && (strpos($Text, "[list") !== false)) ||
|
||||
((strpos($Text, "[/ol]") !== false) && (strpos($Text, "[ol]") !== false)) ||
|
||||
((strpos($Text, "[/ul]") !== false) && (strpos($Text, "[ul]") !== false)) ||
|
||||
((strpos($Text, "[/ol]") !== false) && (strpos($Text, "[ol]") !== false)) ||
|
||||
((strpos($Text, "[/ul]") !== false) && (strpos($Text, "[ul]") !== false)) ||
|
||||
((strpos($Text, "[/li]") !== false) && (strpos($Text, "[li]") !== false))) && (++$endlessloop < 20)) {
|
||||
$Text = preg_replace("/\[list\](.*?)\[\/list\]/ism", '<ul class="listbullet" style="list-style-type: circle;">$1</ul>' ,$Text);
|
||||
$Text = preg_replace("/\[list=\](.*?)\[\/list\]/ism", '<ul class="listnone" style="list-style-type: none;">$1</ul>' ,$Text);
|
||||
|
@ -1149,7 +1153,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
|||
$Text = preg_replace_callback("/\[vimeo\](https?:\/\/vimeo.com\/[0-9]+).*?\[\/vimeo\]/ism",'tryoembed',$Text);
|
||||
}
|
||||
|
||||
$Text = preg_replace("/\[vimeo\]https?:\/\/player.vimeo.com\/video\/([0-9]+)(.*?)\[\/vimeo\]/ism",'[vimeo]$1[/vimeo]',$Text);
|
||||
$Text = preg_replace("/\[vimeo\]https?:\/\/player.vimeo.com\/video\/([0-9]+)(.*?)\[\/vimeo\]/ism",'[vimeo]$1[/vimeo]',$Text);
|
||||
$Text = preg_replace("/\[vimeo\]https?:\/\/vimeo.com\/([0-9]+)(.*?)\[\/vimeo\]/ism",'[vimeo]$1[/vimeo]',$Text);
|
||||
|
||||
if ($tryoembed)
|
||||
|
|
31
mod/item.php
31
mod/item.php
|
@ -144,6 +144,7 @@ function item_post(&$a) {
|
|||
$parent_contact["nurl"] = normalise_link($probed_contact["url"]);
|
||||
$parent_contact["thumb"] = $probed_contact["photo"];
|
||||
$parent_contact["micro"] = $probed_contact["photo"];
|
||||
$parent_contact["addr"] = $probed_contact["addr"];
|
||||
}
|
||||
logger('parent contact: '.print_r($parent_contact, true), LOGGER_DEBUG);
|
||||
} else
|
||||
|
@ -569,10 +570,32 @@ function item_post(&$a) {
|
|||
* and we are replying, and there isn't one already
|
||||
*/
|
||||
|
||||
if(($parent_contact) && ($parent_contact['network'] === NETWORK_OSTATUS)
|
||||
&& ($parent_contact['nick']) && (!in_array('@'.$parent_contact['nick'].'+'.$parent_contact['id'],$tags))) {
|
||||
$body = '@'.$parent_contact['nick'].'+'.$parent_contact['id'].' '.$body;
|
||||
$tags[] = '@'.$parent_contact['nick'].'+'.$parent_contact['id'];
|
||||
if ($parent_contact['id'] != "")
|
||||
$contact = '@'.$parent_contact['nick'].'+'.$parent_contact['id'];
|
||||
//elseif ($parent_contact['addr'] != "")
|
||||
// $contact = '@'.$parent_contact['addr'];
|
||||
else
|
||||
$contact = '@[url='.$parent_contact['url'].']'.$parent_contact['nick'].'[/url]';
|
||||
|
||||
if ($parent_contact && ($parent_contact['network'] === NETWORK_OSTATUS)) {
|
||||
if (($parent_contact['nick']) && (!in_array($contact,$tags))) {
|
||||
$body = $contact.' '.$body;
|
||||
$tags[] = $contact;
|
||||
}
|
||||
|
||||
$toplevel_contact = "";
|
||||
$toplevel_parent = q("SELECT `contact`.* FROM `contact` INNER JOIN `item` ON `item`.`contact-id` = `contact`.`id`
|
||||
WHERE `item`.`id` = `item`.`parent` AND `item`.`parent` = %d", intval($parent));
|
||||
if ($toplevel_parent)
|
||||
$toplevel_contact = '@'.$toplevel_parent[0]['nick'].'+'.$toplevel_parent[0]['id'];
|
||||
else {
|
||||
$toplevel_parent = q("SELECT `author-link`, `author-name` FROM `item` WHERE `id` = `parent` AND `parent` = %d", intval($parent));
|
||||
$toplevel_contact = '@[url='.$toplevel_parent[0]['author-link'].']'.$toplevel_parent[0]['author-name'].'[/url]';
|
||||
}
|
||||
|
||||
if ($toplevel_contact != "")
|
||||
if (!in_array($toplevel_contact,$tags))
|
||||
$tags[] = $toplevel_contact;
|
||||
}
|
||||
|
||||
$tagged = array();
|
||||
|
|
Loading…
Reference in a new issue