make @tags half-ass work

This commit is contained in:
friendica 2013-01-23 01:26:38 -08:00
parent bf98cf8c0a
commit 2c1ba66016
2 changed files with 13 additions and 16 deletions

View file

@ -201,8 +201,8 @@ function acl_init(&$a){
"name" => $g['name'],
"id" => $g['id'],
"xid" => $g['hash'],
"link" => $g['url'],
"nick" => $g['nick'],
"link" => $g['nick'],
"nick" => substr($g['nick'],0,strpos($g['nick'],'@'))
);
}
}

View file

@ -889,29 +889,34 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
}
}
if($tagcid) { //if there was an id
//select contact with that id from the logged in user's contact list
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
$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($profile_uid)
);
}
else {
$newname = str_replace('_',' ',$name);
//select someone from this user's contacts by name
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
$r = q("SELECT * FROM abook left join xchan on abook_xchan - xchan_hash
WHERE xchan_name = '%s' AND abook_channel = %d LIMIT 1",
dbesc($newname),
intval($profile_uid)
);
if(! $r) {
//select someone by attag or nick and the name passed in
$r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
/* $r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
dbesc($name),
dbesc($name),
intval($profile_uid)
);
}
*/ }
}
/* } elseif(strstr($name,'_') || strstr($name,' ')) { //no id
//get the real name
@ -931,16 +936,8 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
}*/
//$r is set, if someone could be selected
if(count($r)) {
$profile = $r[0]['url'];
//set newname to nick, find alias
if($r[0]['network'] === 'stat') {
$newname = $r[0]['nick'];
$stat = true;
if($r[0]['alias'])
$alias = $r[0]['alias'];
}
else
$newname = $r[0]['name'];
$profile = $r[0]['xchan_url'];
$newname = $r[0]['xchan_name'];
//add person's id to $inform
if(strlen($inform))
$inform .= ',';