diff options
author | Michael Meer <michael@meer.name> | 2014-01-24 11:59:15 +0100 |
---|---|---|
committer | Michael Meer <michael@meer.name> | 2014-01-24 11:59:15 +0100 |
commit | 844df110586e6726581c620754fef5419f6bea5e (patch) | |
tree | c0d8cb4bd3ad946ca91fed3d5d90227d796c0bfe /mod/profiles.php | |
parent | a2b07ed2814972507bf971a5ac6ed09c399e29e7 (diff) | |
parent | 21f6549204f60670af55c7ba22a00f7d7eae9c2b (diff) | |
download | volse-hubzilla-844df110586e6726581c620754fef5419f6bea5e.tar.gz volse-hubzilla-844df110586e6726581c620754fef5419f6bea5e.tar.bz2 volse-hubzilla-844df110586e6726581c620754fef5419f6bea5e.zip |
Merge branch 'master' of https://github.com/friendica/red
to be in sync with master repro
Diffstat (limited to 'mod/profiles.php')
-rw-r--r-- | mod/profiles.php | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/mod/profiles.php b/mod/profiles.php index b94e4bf03..c71ad9733 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -256,35 +256,23 @@ function profiles_post(&$a) { if(strpos($lookup,'@') === 0) $lookup = substr($lookup,1); $lookup = str_replace('_',' ', $lookup); - if(strpos($lookup,'@') || (strpos($lookup,'http://'))) { - $newname = $lookup; - $links = @lrdd($lookup); - if(count($links)) { - foreach($links as $link) { - if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page') { - $prf = $link['@attributes']['href']; - } - } - } - } - else { - $newname = $lookup; - - $r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1", - dbesc($newname), + $newname = $lookup; + + $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(local_user()) + ); + if(! $r) { + $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash WHERE xchan_addr = '%s' AND abook_channel = %d LIMIT 1", + dbesc($lookup . '@%'), intval(local_user()) ); - if(! $r) { - $r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1", - dbesc($lookup), - intval(local_user()) - ); - } - if(count($r)) { - $prf = $r[0]['url']; - $newname = $r[0]['name']; - } } + if($r) { + $prf = $r[0]['xchan_url']; + $newname = $r[0]['xchan_name']; + } + if($prf) { $with = str_replace($lookup,'<a href="' . $prf . '">' . $newname . '</a>', $with); |