diff --git a/include/bbcode.php b/include/bbcode.php
index b47a51432..01a141956 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -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$3',
+ $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:(.*?)@(.*?)([ ,])/', 'acct:' . "$1@$2$3" . '',$Text);
// Perform MAIL Search
$Text = preg_replace("/\[mail\]([$MAILSearchString]*)\[\/mail\]/", '$1', $Text);
$Text = preg_replace("/\[mail\=([$MAILSearchString]*)\](.*?)\[\/mail\]/", '$2', $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\]/", '
', $Text);
- }
-
+ }
+
// Check for headers
$Text = preg_replace("(\[h1\](.*?)\[\/h1\])ism",'$1
',$Text);
$Text = preg_replace("(\[h2\](.*?)\[\/h2\])ism",'$1
',$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", '' ,$Text);
$Text = preg_replace("/\[list=\](.*?)\[\/list\]/ism", '' ,$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)
diff --git a/mod/item.php b/mod/item.php
index aecfc1bb8..27bd5108d 100644
--- a/mod/item.php
+++ b/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();