*/
const MIRROR_DEACTIVATED = 0;
- const MIRROR_FORWARDED = 1;
+ const MIRROR_FORWARDED = 1; // Deprecated, now does the same like MIRROR_OWN_POST
const MIRROR_OWN_POST = 2;
const MIRROR_NATIVE_RESHARE = 3;
return $contact;
}
+ /**
+ * @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
+ * @return array
+ * @throws \Exception
+ */
+ public static function selectAccountToArray(array $fields = [], array $condition = [], array $params = []): array
+ {
+ return DBA::selectToArray('account-user-view', $fields, $condition, $params);
+ }
+
/**
* @param array $fields Array of selected fields, empty for all
* @param array $condition Array of fields for condition
}
if ($data['network'] == Protocol::DIASPORA) {
- FContact::updateFromProbeArray($data);
+ DI::dsprContact()->updateFromProbeArray($data);
}
self::updateFromProbeArray($contact_id, $data);
* @param integer $cid contact id
* @param string $size One of the Proxy::SIZE_* constants
* @param string $updated Contact update date
+ * @param bool $static If "true" a parameter is added to convert the avatar to a static one
* @return string avatar link
*/
- 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 = '', bool $static = false): string
{
// We have to fetch the "updated" variable when it wasn't provided
// The parameter can be provided to improve performance
$url .= Proxy::PIXEL_LARGE . '/';
break;
}
- return $url . ($guid ?: $cid) . ($updated ? '?ts=' . strtotime($updated) : '');
+ $query_params = [];
+ if ($updated) {
+ $query_params['ts'] = strtotime($updated);
+ }
+ if ($static) {
+ $query_params['static'] = true;
+ }
+
+ return $url . ($guid ?: $cid) . (!empty($query_params) ? '?' . http_build_query($query_params) : '');
}
/**
* @param integer $cid contact id
* @param string $size One of the Proxy::SIZE_* constants
* @param string $updated Contact update date
+ * @param bool $static If "true" a parameter is added to convert the header to a static one
* @return string header link
*/
- 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 = '', bool $static = false): string
{
// We have to fetch the "updated" variable when it wasn't provided
// The parameter can be provided to improve performance
break;
}
- return $url . ($guid ?: $cid) . ($updated ? '?ts=' . strtotime($updated) : '');
+ $query_params = [];
+ if ($updated) {
+ $query_params['ts'] = strtotime($updated);
+ }
+ if ($static) {
+ $query_params['static'] = true;
+ }
+
+ return $url . ($guid ?: $cid) . (!empty($query_params) ? '?' . http_build_query($query_params) : '');
}
/**
$ret = Probe::uri($contact['url'], $network, $contact['uid']);
if ($ret['network'] == Protocol::DIASPORA) {
- FContact::updateFromProbeArray($ret);
+ DI::dsprContact()->updateFromProbeArray($ret);
}
return self::updateFromProbeArray($id, $ret);
return;
}
+ Worker::add(Worker::PRIORITY_LOW, 'ContactDiscoveryForUser', $contact['uid']);
+
self::clearFollowerFollowingEndpointCache($contact['uid']);
$cdata = self::getPublicAndUserContactID($contact['id'], $contact['uid']);
} else {
self::update(['rel' => self::FOLLOWER], ['id' => $contact['id']]);
}
+
+ Worker::add(Worker::PRIORITY_LOW, 'ContactDiscoveryForUser', $contact['uid']);
}
/**
["(NOT `unsearchable` OR `nurl` IN (SELECT `nurl` FROM `owner-view` WHERE `publish` OR `net-publish`))
AND (`addr` LIKE ? OR `name` LIKE ? OR `nick` LIKE ?)", $search, $search, $search]);
- $contacts = self::selectToArray([], $condition, $params);
- return $contacts;
+ return self::selectToArray([], $condition, $params);
}
/**