aboutsummaryrefslogtreecommitdiffstats
path: root/mod/item.php
diff options
context:
space:
mode:
authorsirius <sirius83@gmx.de>2014-04-20 01:07:36 +0200
committerjmankiewicz <sirius83@gmx.de>2014-04-20 01:12:47 +0200
commitc946d926103a3bce94dcf99a137f3329ce011e2a (patch)
tree36749769bbd342f078a5315b2736b80e89e4542c /mod/item.php
parent6cf5a69d7e8ac12c9c946397ca5c9a1126665974 (diff)
parent891a7fb0f5651447c43560210126a86a6b69aa29 (diff)
downloadvolse-hubzilla-c946d926103a3bce94dcf99a137f3329ce011e2a.tar.gz
volse-hubzilla-c946d926103a3bce94dcf99a137f3329ce011e2a.tar.bz2
volse-hubzilla-c946d926103a3bce94dcf99a137f3329ce011e2a.zip
Merge branch 'master' of https://github.com/friendica/red into mod-profpicperm
Diffstat (limited to 'mod/item.php')
-rw-r--r--mod/item.php21
1 files changed, 17 insertions, 4 deletions
diff --git a/mod/item.php b/mod/item.php
index e88f9a2a3..be59bd4c7 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -981,24 +981,37 @@ 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
+ // of the form something+nnn where nnn is an abook_id or the first chars of xchan_hash
if(strrpos($newname,'+')) {
//get the id
- $tagcid = intval(substr($newname,strrpos($newname,'+') + 1));
+
+ if(strrpos($tagcid,' '))
+ $tagcid = substr($tagcid,0,strrpos($tagcid,' '));
+
+ $tagcid = substr($newname,strrpos($newname,'+') + 1);
+
+ if(strlen($tagcid) < 16)
+ $abook_id = intval($tagcid);
//remove the next word from tag's name
if(strpos($name,' ')) {
$name = substr($name,0,strpos($name,' '));
}
- if($tagcid) { // if there was an id
+ if($abook_id) { // if there was an id
// select channel with that id from the logged in user's address book
$r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash
WHERE abook_id = %d AND abook_channel = %d LIMIT 1",
- intval($tagcid),
+ intval($abook_id),
intval($profile_uid)
);
}
+ else {
+ $r = q("SELECT * FROM xchan
+ WHERE xchan_hash like '%s%%' LIMIT 1",
+ dbesc($tagcid)
+ );
+ }
}
if(! $r) {