* @return array with public and user's contact id
* @throws HTTPException\InternalServerErrorException
* @throws \ImagickException
* @return array with public and user's contact id
* @throws HTTPException\InternalServerErrorException
* @throws \ImagickException
* @param int $cid A contact ID
* @param int $uid The User ID
* @param array $fields The selected fields for the contact
* @param int $cid A contact ID
* @param int $uid The User ID
* @param array $fields The selected fields for the contact
{
$contact = DBA::selectFirst('contact', $fields, ['id' => $cid, 'uid' => $uid]);
{
$contact = DBA::selectFirst('contact', $fields, ['id' => $cid, 'uid' => $uid]);
{
$user = DBA::selectFirst('user', ['uid', 'username', 'nickname', 'pubkey', 'prvkey'],
['uid' => $uid, 'account_expired' => false]);
{
$user = DBA::selectFirst('user', ['uid', 'username', 'nickname', 'pubkey', 'prvkey'],
['uid' => $uid, 'account_expired' => false]);
{
$fields = ['id', 'uri-id', 'name', 'nick', 'location', 'about', 'keywords', 'avatar', 'prvkey', 'pubkey', 'manually-approve',
'xmpp', 'matrix', 'contact-type', 'forum', 'prv', 'avatar-date', 'url', 'nurl', 'unsearchable',
{
$fields = ['id', 'uri-id', 'name', 'nick', 'location', 'about', 'keywords', 'avatar', 'prvkey', 'pubkey', 'manually-approve',
'xmpp', 'matrix', 'contact-type', 'forum', 'prv', 'avatar-date', 'url', 'nurl', 'unsearchable',
{
// We want just to make sure that we don't delete our "self" contact
$contact = DBA::selectFirst('contact', ['uri-id', 'photo', 'thumb', 'micro', 'uid'], ['id' => $id, 'self' => false]);
{
// We want just to make sure that we don't delete our "self" contact
$contact = DBA::selectFirst('contact', ['uri-id', 'photo', 'thumb', 'micro', 'uid'], ['id' => $id, 'self' => false]);
* The local relationship is updated immediately, the eventual remote server is messaged in the background.
*
* @param array $contact User-specific contact array (uid != 0) to revoke the follow from
* The local relationship is updated immediately, the eventual remote server is messaged in the background.
*
* @param array $contact User-specific contact array (uid != 0) to revoke the follow from
* Completely severs a relationship with a contact
*
* @param array $contact User-specific contact (uid != 0) array
* Completely severs a relationship with a contact
*
* @param array $contact User-specific contact (uid != 0) array
* up or some other transient event and that there's a possibility we could recover from it.
*
* @param array $contact contact to mark for archival
* up or some other transient event and that there's a possibility we could recover from it.
*
* @param array $contact contact to mark for archival
* @throws HTTPException\InternalServerErrorException
*/
public static function markForArchival(array $contact)
* @throws HTTPException\InternalServerErrorException
*/
public static function markForArchival(array $contact)
- public static function getIdForURL($url, $uid = 0, $update = null, $default = [])
+ public static function getIdForURL(string $url = null, int $uid = 0, $update = null, array $default = []): int
Logger::notice('Empty url, quitting', ['url' => $url, 'user' => $uid, 'default' => $default]);
return 0;
}
Logger::notice('Empty url, quitting', ['url' => $url, 'user' => $uid, 'default' => $default]);
return 0;
}
$contact = self::getByURL($url, false, ['id', 'network', 'uri-id'], $uid);
if (!empty($contact)) {
$contact = self::getByURL($url, false, ['id', 'network', 'uri-id'], $uid);
if (!empty($contact)) {
if (empty($update) && (!empty($contact['uri-id']) || is_bool($update))) {
Logger::debug('Contact found', ['url' => $url, 'uid' => $uid, 'update' => $update, 'cid' => $contact_id]);
if (empty($update) && (!empty($contact['uri-id']) || is_bool($update))) {
Logger::debug('Contact found', ['url' => $url, 'uid' => $uid, 'update' => $update, 'cid' => $contact_id]);
- if (!empty($default) && !in_array($data["network"], array_merge(Protocol::NATIVE_SUPPORT, [Protocol::PUMPIO]))) {
+ if (!empty($default) && !in_array($data['network'], array_merge(Protocol::NATIVE_SUPPORT, [Protocol::PUMPIO]))) {
$data = array_merge($data, $default);
}
} elseif (!empty($default['network'])) {
$data = array_merge($data, $default);
}
} elseif (!empty($default['network'])) {
- public static function getPostsFromUrl($contact_url, $thread_mode = false, $update = 0, $parent = 0, bool $only_media = false)
+ public static function getPostsFromUrl(string $contact_url, bool $thread_mode = false, int $update = 0, int $parent = 0, bool $only_media = false): string
{
return self::getPostsFromId(self::getIdForURL($contact_url), $thread_mode, $update, $parent, $only_media);
}
{
return self::getPostsFromId(self::getIdForURL($contact_url), $thread_mode, $update, $parent, $only_media);
}
- public static function getPostsFromId($cid, $thread_mode = false, $update = 0, $parent = 0, bool $only_media = false)
+ public static function getPostsFromId(int $cid, bool $thread_mode = false, int $update = 0, int $parent = 0, bool $only_media = false): string
{
$contact = DBA::selectFirst('contact', ['contact-type', 'network'], ['id' => $cid]);
if (!DBA::isResult($contact)) {
{
$contact = DBA::selectFirst('contact', ['contact-type', 'network'], ['id' => $cid]);
if (!DBA::isResult($contact)) {
- public static function getAvatarUrlForId(int $cid, string $size = '', string $updated = '', string $guid = ''):string
+ public static function getAvatarUrlForId(int $cid, string $size = '', string $updated = '', string $guid = ''): string
{
// We have to fetch the "updated" variable when it wasn't provided
// The parameter can be provided to improve performance
{
// We have to fetch the "updated" variable when it wasn't provided
// The parameter can be provided to improve performance
{
$condition = ["`nurl` = ? AND ((`uid` = ? AND `network` IN (?, ?)) OR `uid` = ?)",
Strings::normaliseLink($url), $uid, Protocol::FEED, Protocol::MAIL, 0];
{
$condition = ["`nurl` = ? AND ((`uid` = ? AND `network` IN (?, ?)) OR `uid` = ?)",
Strings::normaliseLink($url), $uid, Protocol::FEED, Protocol::MAIL, 0];
- public static function getHeaderUrlForId(int $cid, string $size = '', string $updated = '', string $guid = ''):string
+ public static function getHeaderUrlForId(int $cid, string $size = '', string $updated = '', string $guid = ''): string
{
// We have to fetch the "updated" variable when it wasn't provided
// The parameter can be provided to improve performance
{
// We have to fetch the "updated" variable when it wasn't provided
// The parameter can be provided to improve performance
* @param integer $id contact id
* @param array $ret Probed data
* @return boolean
* @throws HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
* @param integer $id contact id
* @param array $ret Probed data
* @return boolean
* @throws HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
* @param integer $url contact url
* @return integer Contact id
* @throws HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
* @param integer $url contact url
* @return integer Contact id
* @throws HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
* Update the local relationship when a local user loses a follower
*
* @param array $contact User-specific contact (uid != 0) array
* Update the local relationship when a local user loses a follower
*
* @param array $contact User-specific contact (uid != 0) array