Now the bugfix really should work

This commit is contained in:
Michael 2017-08-14 20:58:02 +00:00
parent 2d99e86b12
commit 4f6f47f714
3 changed files with 10 additions and 4 deletions

View file

@ -213,19 +213,22 @@ function get_contact_details_by_url($url, $uid = -1, $default = array()) {
$r = dba::inArray($s); $r = dba::inArray($s);
// Fetch the data from the contact table with "uid=0" (which is filled automatically) // Fetch the data from the contact table with "uid=0" (which is filled automatically)
if (!dbm::is_result($r)) 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`, $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` `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", FROM `contact` WHERE `nurl` = ? AND `uid` = 0",
normalise_link($url)); normalise_link($url));
$r = dba::inArray($s); $r = dba::inArray($s);
}
// Fetch the data from the gcontact table // Fetch the data from the gcontact table
if (!dbm::is_result($r)) 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`, $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` `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` = ?", FROM `gcontact` WHERE `nurl` = ?",
normalise_link($url)); normalise_link($url));
$r = dba::inArray($s);
}
if (dbm::is_result($r)) { if (dbm::is_result($r)) {
// If there is more than one entry we filter out the connector networks // If there is more than one entry we filter out the connector networks

View file

@ -1338,6 +1338,10 @@ class dba {
* @return array Data array * @return array Data array
*/ */
static public function inArray($stmt, $do_close = true) { static public function inArray($stmt, $do_close = true) {
if (is_bool($stmt)) {
return $stmt;
}
$data = array(); $data = array();
while ($row = self::fetch($stmt)) { while ($row = self::fetch($stmt)) {
$data[] = $row; $data[] = $row;

View file

@ -52,7 +52,6 @@ function hovercard_content() {
// Search for contact data // Search for contact data
$contact = get_contact_details_by_url($nurl); $contact = get_contact_details_by_url($nurl);
} }
if(!is_array($contact)) if(!is_array($contact))
return; return;