From: Adam Magness Date: Thu, 23 Nov 2017 04:13:12 +0000 (-0500) Subject: Review updates X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f5d682fe0ace90a0ede89fe5d1fe9f3e051ef3a9;p=friendica.git Review updates Updates based on review. --- diff --git a/src/Object/Contact.php b/src/Object/Contact.php index ffa71be27d..9fceb927af 100644 --- a/src/Object/Contact.php +++ b/src/Object/Contact.php @@ -38,11 +38,11 @@ class Contact extends BaseObject $condition = array('`id` = ? AND NOT `self`', $id); $r = dba::select('contact', array('uid'), $condition, array('limit' => 1)); - if (!DBM::is_result($r) || !intval($r[0]['uid'])) { + if (!DBM::is_result($r) || !intval($r['uid'])) { return; } - $archive = PConfig::get($r[0]['uid'], 'system', 'archive_removed_contacts'); + $archive = PConfig::get($r['uid'], 'system', 'archive_removed_contacts'); if ($archive) { dba::update('contact', array('archive' => 1, 'network' => 'none', 'writable' => 0), array('id' => $id)); return; @@ -59,6 +59,7 @@ class Contact extends BaseObject * * @param array $user User unfriending * @param array $contact Contact unfriended + * @return void */ public static function terminateFriendship(array $user, array $contact) { @@ -383,7 +384,7 @@ class Contact extends BaseObject $r = dba::select('contact', array(), array('nurl' => $contact['nurl'], 'network' => $contact['network'], 'uid' => $uid)); if ($r) { - return self::photoMenu($r[0], $uid); + return self::photoMenu(dba::fetch($r), $uid); } else { $profile_link = zrl($contact['url']); $connlnk = 'follow/?url=' . $contact['url']; @@ -477,13 +478,13 @@ class Contact extends BaseObject $condition = array('`uid` = ? AND `self` = 0 AND `id` NOT IN (SELECT DISTINCT(`contact-id`) FROM `group_member` WHERE `uid` = ?', $uid, $uid); $r = dba::select('contact', $fields, $condition); - return $r; + return dba::inArray($r); } $innerCondition = array('`id` NOT IN (SELECT DISTINCT(`contact-id`) FROM `group_member` WHERE `uid` = ?', $uid); $r = dba::select('contact', array(), array('uid' => $uid, 'self' => 0, $innerCondition, 'blocked' => 0, 'pending' => 0), array('limit ?, ?', $start, $count)); - return $r; + return dba::inArray($r); } /** @@ -720,21 +721,22 @@ class Contact extends BaseObject // There are no posts with "uid = 0" with connector networks // This speeds up the query a lot - $r = dba::select('contact', array('network', 'id AS author-id', 'contact-type'), array('nurl' => normalise_link($contact_url), 'uid' => 0)); + $s = dba::select('contact', array('network', 'id AS author-id', 'contact-type'), array('nurl' => normalise_link($contact_url), 'uid' => 0)); + $r = dba::inArray($s); if (!DBM::is_result($r)) { return ''; } - if (in_array($r[0]["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""))) { + if (in_array($r["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""))) { $sql = "(`item`.`uid` = 0 OR (`item`.`uid` = %d AND NOT `item`.`global`))"; } else { $sql = "`item`.`uid` = %d"; } - $author_id = intval($r[0]["author-id"]); + $author_id = intval($r["author-id"]); - $contact = ($r[0]["contact-type"] == ACCOUNT_TYPE_COMMUNITY ? 'owner-id' : 'author-id'); + $contact = ($r["contact-type"] == ACCOUNT_TYPE_COMMUNITY ? 'owner-id' : 'author-id'); $r = q(item_query() . " AND `item`.`" . $contact . "` = %d AND " . $sql . " ORDER BY `item`.`created` DESC LIMIT %d, %d", intval($author_id), intval(local_user()), intval($a->pager['start']), intval($a->pager['itemspage'])