catche edge case of tag "@abcdef +1", which tags the first entry in your abook, regardless of abcdef. This holds true for other similar patterns as well.
This commit is contained in:
parent
37f0bd6c9d
commit
c024668cf2
@ -843,7 +843,7 @@ function diaspora_post($importer,$xml,$msg) {
|
||||
|
||||
|
||||
// Look for tags and linkify them
|
||||
$results = linkify_tags(get_app(), $body, $importer['channel_id']);
|
||||
$results = linkify_tags(get_app(), $body, $importer['channel_id'], true);
|
||||
|
||||
$datarray['term'] = array();
|
||||
|
||||
@ -1062,7 +1062,7 @@ function diaspora_reshare($importer,$xml,$msg) {
|
||||
$datarray = array();
|
||||
|
||||
// Look for tags and linkify them
|
||||
$results = linkify_tags(get_app(), $body, $importer['channel_id']);
|
||||
$results = linkify_tags(get_app(), $body, $importer['channel_id'], true);
|
||||
|
||||
$datarray['term'] = array();
|
||||
|
||||
@ -1397,7 +1397,7 @@ function diaspora_comment($importer,$xml,$msg) {
|
||||
$datarray = array();
|
||||
|
||||
// Look for tags and linkify them
|
||||
$results = linkify_tags(get_app(), $body, $importer['channel_id']);
|
||||
$results = linkify_tags(get_app(), $body, $importer['channel_id'], true);
|
||||
|
||||
$datarray['term'] = array();
|
||||
|
||||
|
@ -2105,7 +2105,7 @@ function extra_query_args() {
|
||||
*
|
||||
* @return boolean true if replaced, false if not replaced
|
||||
*/
|
||||
function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) {
|
||||
function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag, $diaspora = false) {
|
||||
|
||||
$replaced = false;
|
||||
$r = null;
|
||||
@ -2173,7 +2173,7 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) {
|
||||
if(strpos($tag,'@') === 0) {
|
||||
|
||||
// The @! tag will alter permissions
|
||||
$exclusive = ((strpos($tag,'!') === 1) ? true : false);
|
||||
$exclusive = ((strpos($tag,'!') === 1 && (! $diaspora)) ? true : false);
|
||||
|
||||
//is it already replaced?
|
||||
if(strpos($tag,'[zrl='))
|
||||
@ -2202,10 +2202,19 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) {
|
||||
// Here we're looking for an address book entry as provided by the auto-completer
|
||||
// of the form something+nnn where nnn is an abook_id or the first chars of xchan_hash
|
||||
|
||||
if(strrpos($newname,'+')) {
|
||||
|
||||
// If there's a +nnn in the string make sure there isn't a space preceding it
|
||||
|
||||
$t1 = strpos($newname,' ');
|
||||
$t2 = strrpos($newname,'+');
|
||||
|
||||
if($t1 && $t2 && $t1 < $t2)
|
||||
$t2 = 0;
|
||||
|
||||
if(($t2) && (! $diaspora)) {
|
||||
//get the id
|
||||
|
||||
$tagcid = substr($newname,strrpos($newname,'+') + 1);
|
||||
$tagcid = substr($newname,$t2 + 1);
|
||||
|
||||
if(strrpos($tagcid,' '))
|
||||
$tagcid = substr($tagcid,0,strrpos($tagcid,' '));
|
||||
@ -2350,7 +2359,7 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) {
|
||||
return array('replaced' => $replaced, 'termtype' => $termtype, 'term' => $newname, 'url' => $url, 'contact' => $r[0]);
|
||||
}
|
||||
|
||||
function linkify_tags($a, &$body, $uid) {
|
||||
function linkify_tags($a, &$body, $uid, $diaspora = false) {
|
||||
$str_tags = '';
|
||||
$tagged = array();
|
||||
$results = array();
|
||||
@ -2374,7 +2383,7 @@ function linkify_tags($a, &$body, $uid) {
|
||||
if($fullnametagged)
|
||||
continue;
|
||||
|
||||
$success = handle_tag($a, $body, $access_tag, $str_tags, ($uid) ? $uid : $a->profile_uid , $tag);
|
||||
$success = handle_tag($a, $body, $access_tag, $str_tags, ($uid) ? $uid : $a->profile_uid , $tag, $diaspora);
|
||||
$results[] = array('success' => $success, 'access_tag' => $access_tag);
|
||||
if($success['replaced']) $tagged[] = $tag;
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
2015-03-23.980
|
||||
2015-03-24.981
|
||||
|
Reference in New Issue
Block a user