+ /**
+ * @brief Tests if the given contact is a follower
+ *
+ * @param int $cid Either public contact id or user's contact id
+ * @param int $uid User ID
+ *
+ * @return boolean is the contact id a follower?
+ */
+ public static function isFollower($cid, $uid)
+ {
+ if (self::isBlockedByUser($cid, $uid)) {
+ return false;
+ }
+
+ $cdata = self::getPublicAndUserContacID($cid, $uid);
+ if (empty($cdata['user'])) {
+ return false;
+ }
+
+ $condition = ['id' => $cdata['user'], 'rel' => [self::FOLLOWER, self::FRIEND]];
+ return DBA::exists('contact', $condition);
+ }
+