- public static function selectToArray(array $fields = [], array $condition = [], array $params = [])
+ public static function selectToArray(array $fields = [], array $condition = [], array $params = []): array
{
return DBA::selectToArray('contact', $fields, $condition, $params);
}
{
return DBA::selectToArray('contact', $fields, $condition, $params);
}
* @param array $fields Array of selected fields, empty for all
* @param array $condition Array of fields for condition
* @param array $params Array of several parameters
* @param array $fields Array of selected fields, empty for all
* @param array $condition Array of fields for condition
* @param array $params Array of several parameters
{
if (!empty($fields['baseurl']) && empty($fields['gsid'])) {
$fields['gsid'] = GServer::getID($fields['baseurl'], true);
{
if (!empty($fields['baseurl']) && empty($fields['gsid'])) {
$fields['gsid'] = GServer::getID($fields['baseurl'], true);
{
return DBA::selectFirst('contact', $fields, ['uri-id' => $uri_id], ['order' => ['uid']]);
}
{
return DBA::selectFirst('contact', $fields, ['uri-id' => $uri_id], ['order' => ['uid']]);
}
- public static function getByURL(string $url, $update = null, array $fields = [], int $uid = 0)
+ public static function getByURL(string $url, $update = null, array $fields = [], int $uid = 0): array
{
if ($update || is_null($update)) {
$cid = self::getIdForURL($url, $uid, $update);
{
if ($update || is_null($update)) {
$cid = self::getIdForURL($url, $uid, $update);
- public static function getByURLForUser(string $url, int $uid = 0, $update = false, array $fields = [])
+ public static function getByURLForUser(string $url, int $uid = 0, $update = false, array $fields = []): array
{
if ($uid != 0) {
$contact = self::getByURL($url, $update, $fields, $uid);
{
if ($uid != 0) {
$contact = self::getByURL($url, $update, $fields, $uid);
{
$contact = DBA::selectFirst('contact', ['id', 'baseurl'], ['uid' => 0, 'nurl' => Strings::normaliseLink($url)]);
if (!DBA::isResult($contact)) {
{
$contact = DBA::selectFirst('contact', ['id', 'baseurl'], ['uid' => 0, 'nurl' => Strings::normaliseLink($url)]);
if (!DBA::isResult($contact)) {
{
if (!parse_url($url, PHP_URL_SCHEME)) {
$addr_parts = explode('@', $url);
{
if (!parse_url($url, PHP_URL_SCHEME)) {
$addr_parts = explode('@', $url);
{
$contact = DBA::selectFirst('contact', ['url', 'baseurl'], ['id' => $cid]);
if (!DBA::isResult($contact)) {
{
$contact = DBA::selectFirst('contact', ['url', 'baseurl'], ['id' => $cid]);
if (!DBA::isResult($contact)) {
{
$self = DBA::selectFirst('contact', ['url'], ['self' => true, 'uid' => $uid]);
if (!DBA::isResult($self)) {
{
$self = DBA::selectFirst('contact', ['url'], ['self' => true, 'uid' => $uid]);
if (!DBA::isResult($self)) {
{
// We have to use the legacy function as long as the post update hasn't finished
if (DI::config()->get('system', 'post_update_version') < 1427) {
{
// We have to use the legacy function as long as the post update hasn't finished
if (DI::config()->get('system', 'post_update_version') < 1427) {
* @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)) {
* @param bool $no_update Don't perfom an update if no cached avatar was found
* @return string photo path
*/
* @param bool $no_update Don't perfom an update if no cached avatar was found
* @return string photo path
*/
* @param bool $no_update Don't perfom an update if no cached avatar was found
* @return string photo path
*/
* @param bool $no_update Don't perfom an update if no cached avatar was found
* @return string photo path
*/
* @param bool $no_update Don't perfom an update if no cached avatar was found
* @return string photo path
*/
* @param bool $no_update Don't perfom an update if no cached avatar was found
* @return string photo path
*/
* @param bool $no_update Don't perfom an update if no cached avatar was found
* @return string photo path
*/
* @param bool $no_update Don't perfom an update if no cached avatar was found
* @return string photo path
*/
* @param bool $no_update Don't perfom an update if no cached avatar was found
* @return array contact array with avatar cache fields
*/
* @param bool $no_update Don't perfom an update if no cached avatar was found
* @return array contact array with avatar cache fields
*/
- 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
*/
- public static function addRelationship(array $importer, array $contact, array $datarray, $sharing = false, $note = '')
+ public static function addRelationship(array $importer, array $contact, array $datarray, bool $sharing = false, string $note = '')
* 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
{
if (!Session::isAuthenticated()) {
return $url ?: $contact_url; // Equivalent to: ($url != '') ? $url : $contact_url;
{
if (!Session::isAuthenticated()) {
return $url ?: $contact_url; // Equivalent to: ($url != '') ? $url : $contact_url;
{
$contact = DBA::selectFirst('contact', ['id', 'network', 'url', 'uid'], ['id' => $cid]);
{
$contact = DBA::selectFirst('contact', ['id', 'network', 'url', 'uid'], ['id' => $cid]);
{
$protocol = $contact['network'] ?? $contact['protocol'] ?? Protocol::PHANTOM;
$self = $contact['self'] ?? false;
{
$protocol = $contact['network'] ?? $contact['protocol'] ?? Protocol::PHANTOM;
$self = $contact['self'] ?? false;
* @return array with search results
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
* @return array with search results
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
{
$contact = DBA::selectFirst('contact', ['id', 'network', 'url', 'uid'], [
"`uid` = ? AND `network` = ? AND NOT `failed` AND `last-item` > ?",
{
$contact = DBA::selectFirst('contact', ['id', 'network', 'url', 'uid'], [
"`uid` = ? AND `network` = ? AND NOT `failed` AND `last-item` > ?",