]> git.mxchange.org Git - friendica.git/commitdiff
Merge remote-tracking branch 'upstream/develop' into contact-tabs
authorMichael <heluecht@pirati.ca>
Mon, 3 Aug 2020 16:06:07 +0000 (16:06 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 3 Aug 2020 16:06:07 +0000 (16:06 +0000)
1  2 
src/Model/Contact.php

diff --combined src/Model/Contact.php
index 9bd63f83dd61f37361a4f19de49526c431a206d0,b6b0fec5d93739fc4379f9c0c6a9a10501599480..1adf2427587ca8e7463dc741acaeb23190a55c8e
@@@ -3056,47 -3056,13 +3056,47 @@@ class Contac
                return array_slice($contacts, $start, $limit);
        }
  
 +      /**
 +       * Returns a list of all common friends between two given public contact ids.
 +       *
 +       * @param int $cid1  first public contact id
 +       * @param int $cid2  second public contact id
 +       * @return int
 +       */
 +      public static function countContactsOfContact(int $cid)
 +      {
 +              return DBA::count('contact',
 +                      ["`id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ?)
 +                      OR `id` IN (SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ?)",
 +                      $cid, $cid]
 +              );
 +      }
 +
 +      /**
 +       * Returns a list of all contacts of a given public contact id.
 +       *
 +       * @param int $cid   public contact id
 +       * @param int $start optional, default 0
 +       * @param int $limit optional, default 80
 +       * @return array
 +       */
 +      public static function getContactsOfContact(int $cid, int $start = 0, int $limit = 80)
 +      {
 +              return DBA::selectToArray('contact', [],
 +                      ["`id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ?)
 +                      OR `id` IN (SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ?)",
 +                      $cid, $cid],
 +                      ['limit' => [$start, $limit]]
 +              );
 +      }
 +
        /**
         * Add public contacts from an array
         *
         * @param array $urls
         * @return array result "count", "added" and "updated"
         */
-       public static function addContactsByArray(array $urls)
+       public static function addByUrls(array $urls)
        {
                $added = 0;
                $updated = 0;