ini_set('pcre.backtrack_limit', 250000);
-define ( 'FRIENDIKA_VERSION', '2.2.1025' );
+define ( 'FRIENDIKA_VERSION', '2.2.1026' );
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
define ( 'DB_UPDATE_VERSION', 1070 );
$s = preg_replace('/\[code\](.*?)\[\/code\]/sm','',$s);
- if(preg_match_all('/([@#][^ \x0D\x0A,:?]+)([ \x0D\x0A,:?]|$)/',$s,$match)) {
+ if(preg_match_all('/([@#][^ \x0D\x0A,:?]+ [^ \x0D\x0A,:?]+)([ \x0D\x0A,:?]|$)/',$s,$match)) {
foreach($match[1] as $mtch) {
if(strstr($mtch,"]")) {
// we might be inside a bbcode color tag - leave it alone
}
}
+ if(preg_match_all('/([@#][^ \x0D\x0A,:?]+)([ \x0D\x0A,:?]|$)/',$s,$match)) {
+ foreach($match[1] as $mtch) {
+ if(strstr($mtch,"]")) {
+ // we might be inside a bbcode color tag - leave it alone
+ continue;
+ }
+ if(substr($mtch,-1,1) === '.')
+ $ret[] = substr($mtch,0,-1);
+ else
+ $ret[] = $mtch;
+ }
+ }
return $ret;
}}
}
+ /**
+ * Next link in any attachment references we find in the post.
+ */
+
$match = false;
if(preg_match_all("/\[attachment\](.*?)\[\/attachment\]/",$body,$match)) {
}
}
-
-
-
-
/**
* Fold multi-line [code] sequences
*/
$tags = get_tags($body);
- if(($parent_contact) && ($parent_contact['network'] === 'stat') && ($parent_contact['nick']) && (! in_array('@' . $parent_contact['nick'],$tags))) {
+ /**
+ * add a statusnet style reply tag if the original post was from there
+ * and we are replying, and there isn't one already
+ */
+
+ if(($parent_contact) && ($parent_contact['network'] === 'stat')
+ && ($parent_contact['nick']) && (! in_array('@' . $parent_contact['nick'],$tags))) {
$body = '@' . $parent_contact['nick'] . ' ' . $body;
$tags[] = '@' . $parent_contact['nick'];
}
if(count($tags)) {
foreach($tags as $tag) {
+ if(isset($profile))
+ unset($profile);
if(strpos($tag,'#') === 0) {
if(strpos($tag,'[url='))
continue;
else {
$newname = $name;
$alias = '';
- if(strstr($name,'_')) {
+ if(strstr($name,'_') || strstr($name,' ')) {
$newname = str_replace('_',' ',$name);
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
dbesc($newname),
if(count($tags)) {
foreach($tags as $tag) {
+ if(isset($profile))
+ unset($profile);
if(strpos($tag,'@') === 0) {
$name = substr($tag,1);
if((strpos($name,'@')) || (strpos($name,'http://'))) {
}
else {
$newname = $name;
- if(strstr($name,'_')) {
+ if(strstr($name,'_') || strstr($name,' ')) {
$newname = str_replace('_',' ',$name);
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
dbesc($newname),