*/
public static function unmarkForArchival(array $contact)
{
- $condition = array('`id` => ? AND (`term-date` > ? OR `archive`)', $contact[`id`], NULL_DATE);
+ $condition = array('`id` = ? AND (`term-date` > ? OR `archive`)', $contact[`id`], NULL_DATE);
$exists = dba::exists('contact', $condition);
// We don't need to update, we never marked this contact for archival
"SELECT COUNT(*) AS `total`
FROM `contact`
WHERE `uid` = %d
- AND `self` = 0
+ AND NOT `self`
+ AND NOT `blocked`
+ AND NOT `pending`
AND `id` NOT IN (
SELECT DISTINCT(`contact-id`)
FROM `group_member`
WHERE `uid` = %d
- ) ", intval($uid), intval($uid)
+ )", intval($uid), intval($uid)
);
return $r;
"SELECT *
FROM `contact`
WHERE `uid` = %d
- AND `self` = 0
+ AND NOT `self`
+ AND NOT `blocked`
+ AND NOT `pending`
AND `id` NOT IN (
SELECT DISTINCT(`contact-id`)
FROM `group_member` WHERE `uid` = %d
)
- AND `blocked` = 0
- AND `pending` = 0
LIMIT %d, %d", intval($uid), intval($uid), intval($start), intval($count)
);
-
return $r;
}
'readonly' => 0, 'pending' => 0)
);
- $s = dba::select('contact', array('id'), array('nurl' => normalise_link($data["url"]), 'uid' => $uid), array('order' => 'id', 'limit' => 2));
+ $s = dba::select('contact', array('id'), array('nurl' => normalise_link($data["url"]), 'uid' => $uid), array('order' => array('id'), 'limit' => 2));
$contacts = dba::inArray($s);
if (!DBM::is_result($contacts)) {
return 0;
*/
public static function getPostsFromUrl($contact_url)
{
+ $a = self::getApp();
+
require_once 'include/conversation.php';
// There are no posts with "uid = 0" with connector networks
" ORDER BY `item`.`created` DESC LIMIT %d, %d", intval($author_id), intval(local_user()), intval($a->pager['start']), intval($a->pager['itemspage'])
);
- $a = self::getApp();
$o = conversation($a, $r, 'community', false);
return $account_type;
}
+
+ /**
+ * @brief Blocks a contact
+ *
+ * @param int $uid
+ * @return bool
+ */
+ public static function block($uid)
+ {
+ $return = dba::update('contact', ['blocked' => true], ['id' => $uid]);
+
+ return $return;
+ }
+
+ /**
+ * @brief Unblocks a contact
+ *
+ * @param int $uid
+ * @return bool
+ */
+ public static function unblock($uid)
+ {
+ $return = dba::update('contact', ['blocked' => false], ['id' => $uid]);
+
+ return $return;
+ }
}