Bugfix for PR 3630: "get_contact_details_by_url" not always returned a value
This commit is contained in:
parent
cdc41d6018
commit
2d99e86b12
2 changed files with 6 additions and 5 deletions
|
@ -210,23 +210,24 @@ function get_contact_details_by_url($url, $uid = -1, $default = array()) {
|
|||
`keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, `self`
|
||||
FROM `contact` WHERE `nurl` = ? AND `uid` = ?",
|
||||
normalise_link($url), $uid);
|
||||
$r = dba::inArray($s);
|
||||
|
||||
// Fetch the data from the contact table with "uid=0" (which is filled automatically)
|
||||
if (!dbm::is_result($s))
|
||||
if (!dbm::is_result($r))
|
||||
$s = dba::p("SELECT `id`, 0 AS `cid`, `id` AS `zid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`,
|
||||
`keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, 0 AS `self`
|
||||
FROM `contact` WHERE `nurl` = ? AND `uid` = 0",
|
||||
normalise_link($url));
|
||||
$r = dba::inArray($s);
|
||||
|
||||
// Fetch the data from the gcontact table
|
||||
if (!dbm::is_result($s))
|
||||
if (!dbm::is_result($r))
|
||||
$s = dba::p("SELECT 0 AS `id`, 0 AS `cid`, `id` AS `gid`, 0 AS `zid`, 0 AS `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, '' AS `xmpp`,
|
||||
`keywords`, `gender`, `photo`, `photo` AS `thumb`, `photo` AS `micro`, `community` AS `forum`, 0 AS `prv`, `community`, `contact-type`, `birthday`, 0 AS `self`
|
||||
FROM `gcontact` WHERE `nurl` = ?",
|
||||
normalise_link($url));
|
||||
|
||||
if (dbm::is_result($s)) {
|
||||
$r = dba::inArray($s);
|
||||
if (dbm::is_result($r)) {
|
||||
// If there is more than one entry we filter out the connector networks
|
||||
if (count($r) > 1) {
|
||||
foreach ($r AS $id => $result) {
|
||||
|
|
Loading…
Reference in a new issue