]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Contact.php
Merge remote-tracking branch 'upstream/develop' into restricted
[friendica.git] / src / Model / Contact.php
index a18d6b9d0fee929d8d5e45007b4a02dee1a5b48b..243b48ad1d2124c6c08724f41f21bbdf1fe293f9 100644 (file)
@@ -533,6 +533,17 @@ class Contact
                return self::isSharing($cid, $uid, $strict);
        }
 
+       /**
+        * Checks if the provided public contact id has got followers on this system
+        *
+        * @param integer $cid
+        * @return boolean
+        */
+       public static function hasFollowers(int $cid): bool
+       {
+               return DBA::exists('account-user-view', ["`pid` = ? AND `uid` != ? AND `rel` IN (?, ?)", $cid, 0, self::SHARING, self::FRIEND]);
+       }
+
        /**
         * Get the basepath for a given contact link
         *
@@ -739,7 +750,7 @@ class Contact
                $user = DBA::selectFirst(
                        'user',
                        ['uid', 'username', 'nickname', 'pubkey', 'prvkey'],
-                       ['uid' => $uid, 'account_expired' => false]
+                       ['uid' => $uid, 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]
                );
                if (!DBA::isResult($user)) {
                        return false;
@@ -793,10 +804,10 @@ class Contact
        /**
         * Updates the self-contact for the provided user id
         *
-        * @param int   $uid
-        * @param bool  $update_avatar Force the avatar update
+        * @param int  $uid
+        * @param bool $update_avatar Force the avatar update
         * @return bool "true" if updated
-        * @throws HTTPException\InternalServerErrorException
+        * @throws \Exception
         */
        public static function updateSelfFromUserID(int $uid, bool $update_avatar = false): bool
        {
@@ -811,7 +822,7 @@ class Contact
                }
 
                $fields = ['uid', 'username', 'nickname', 'page-flags', 'account-type', 'prvkey', 'pubkey'];
-               $user = DBA::selectFirst('user', $fields, ['uid' => $uid, 'account_expired' => false]);
+               $user = DBA::selectFirst('user', $fields, ['uid' => $uid, 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]);
                if (!DBA::isResult($user)) {
                        return false;
                }