prevent duplicate @ tags

This commit is contained in:
Friendika 2011-11-02 18:52:55 -07:00
parent 8582701b70
commit a9ec56ace1
2 changed files with 13 additions and 7 deletions

View File

@ -9,7 +9,7 @@ require_once('include/nav.php');
require_once('include/cache.php'); require_once('include/cache.php');
define ( 'FRIENDIKA_PLATFORM', 'Friendica'); define ( 'FRIENDIKA_PLATFORM', 'Friendica');
define ( 'FRIENDIKA_VERSION', '2.3.1152' ); define ( 'FRIENDIKA_VERSION', '2.3.1153' );
define ( 'DFRN_PROTOCOL_VERSION', '2.22' ); define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
define ( 'DB_UPDATE_VERSION', 1101 ); define ( 'DB_UPDATE_VERSION', 1101 );

View File

@ -455,17 +455,23 @@ function item_post(&$a) {
if($profile) { if($profile) {
$body = str_replace('@' . $name, '@' . '[url=' . $profile . ']' . $newname . '[/url]', $body); $body = str_replace('@' . $name, '@' . '[url=' . $profile . ']' . $newname . '[/url]', $body);
$profile = str_replace(',','%2c',$profile); $profile = str_replace(',','%2c',$profile);
if(strlen($str_tags)) $newtag = '@[url=' . $profile . ']' . $newname . '[/url]';
$str_tags .= ','; if(! stristr($str_tags,$newtag)) {
$str_tags .= '@[url=' . $profile . ']' . $newname . '[/url]'; if(strlen($str_tags))
$str_tags .= ',';
$str_tags .= $newtag;
}
// Status.Net seems to require the numeric ID URL in a mention if the person isn't // Status.Net seems to require the numeric ID URL in a mention if the person isn't
// subscribed to you. But the nickname URL is OK if they are. Grrr. We'll tag both. // subscribed to you. But the nickname URL is OK if they are. Grrr. We'll tag both.
if(strlen($alias)) { if(strlen($alias)) {
if(strlen($str_tags)) $newtag = '@[url=' . $alias . ']' . $newname . '[/url]';
$str_tags .= ','; if(! stristr($str_tags,$newtag)) {
$str_tags .= '@[url=' . $alias . ']' . $newname . '[/url]'; if(strlen($str_tags))
$str_tags .= ',';
$str_tags .= $newtag;
}
} }
} }
} }