Renamed
This commit is contained in:
parent
2fc79e3886
commit
e71f497295
4 changed files with 20 additions and 20 deletions
|
@ -63,7 +63,7 @@ class APContact extends BaseObject
|
||||||
* @param boolean $update true = always update, false = never update, null = update when not found
|
* @param boolean $update true = always update, false = never update, null = update when not found
|
||||||
* @return array profile array
|
* @return array profile array
|
||||||
*/
|
*/
|
||||||
public static function getProfileByURL($url, $update = null)
|
public static function getByURL($url, $update = null)
|
||||||
{
|
{
|
||||||
if (empty($url)) {
|
if (empty($url)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -312,9 +312,9 @@ class ActivityPub
|
||||||
$activity = json_decode($conversation['source'], true);
|
$activity = json_decode($conversation['source'], true);
|
||||||
|
|
||||||
$actor = JsonLD::fetchElement($activity, 'actor', 'id');
|
$actor = JsonLD::fetchElement($activity, 'actor', 'id');
|
||||||
$profile = APContact::getProfileByURL($actor);
|
$profile = APContact::getByURL($actor);
|
||||||
|
|
||||||
$item_profile = APContact::getProfileByURL($item['author-link']);
|
$item_profile = APContact::getByURL($item['author-link']);
|
||||||
$exclude[] = $item['author-link'];
|
$exclude[] = $item['author-link'];
|
||||||
|
|
||||||
if ($item['gravity'] == GRAVITY_PARENT) {
|
if ($item['gravity'] == GRAVITY_PARENT) {
|
||||||
|
@ -356,7 +356,7 @@ class ActivityPub
|
||||||
|
|
||||||
$data = array_merge($data, self::fetchPermissionBlockFromConversation($item));
|
$data = array_merge($data, self::fetchPermissionBlockFromConversation($item));
|
||||||
|
|
||||||
$actor_profile = APContact::getProfileByURL($item['author-link']);
|
$actor_profile = APContact::getByURL($item['author-link']);
|
||||||
|
|
||||||
$terms = Term::tagArrayFromItemId($item['id'], TERM_MENTION);
|
$terms = Term::tagArrayFromItemId($item['id'], TERM_MENTION);
|
||||||
|
|
||||||
|
@ -369,7 +369,7 @@ class ActivityPub
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($terms as $term) {
|
foreach ($terms as $term) {
|
||||||
$profile = APContact::getProfileByURL($term['url'], false);
|
$profile = APContact::getByURL($term['url'], false);
|
||||||
if (!empty($profile) && empty($contacts[$profile['url']])) {
|
if (!empty($profile) && empty($contacts[$profile['url']])) {
|
||||||
$data['cc'][] = $profile['url'];
|
$data['cc'][] = $profile['url'];
|
||||||
$contacts[$profile['url']] = $profile['url'];
|
$contacts[$profile['url']] = $profile['url'];
|
||||||
|
@ -405,7 +405,7 @@ class ActivityPub
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$profile = APContact::getProfileByURL($parent['author-link'], false);
|
$profile = APContact::getByURL($parent['author-link'], false);
|
||||||
if (!empty($profile) && empty($contacts[$profile['url']])) {
|
if (!empty($profile) && empty($contacts[$profile['url']])) {
|
||||||
$data['cc'][] = $profile['url'];
|
$data['cc'][] = $profile['url'];
|
||||||
$contacts[$profile['url']] = $profile['url'];
|
$contacts[$profile['url']] = $profile['url'];
|
||||||
|
@ -415,7 +415,7 @@ class ActivityPub
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$profile = APContact::getProfileByURL($parent['owner-link'], false);
|
$profile = APContact::getByURL($parent['owner-link'], false);
|
||||||
if (!empty($profile) && empty($contacts[$profile['url']])) {
|
if (!empty($profile) && empty($contacts[$profile['url']])) {
|
||||||
$data['cc'][] = $profile['url'];
|
$data['cc'][] = $profile['url'];
|
||||||
$contacts[$profile['url']] = $profile['url'];
|
$contacts[$profile['url']] = $profile['url'];
|
||||||
|
@ -449,9 +449,9 @@ class ActivityPub
|
||||||
$inboxes = [];
|
$inboxes = [];
|
||||||
|
|
||||||
if ($item['gravity'] == GRAVITY_ACTIVITY) {
|
if ($item['gravity'] == GRAVITY_ACTIVITY) {
|
||||||
$item_profile = APContact::getProfileByURL($item['author-link']);
|
$item_profile = APContact::getByURL($item['author-link']);
|
||||||
} else {
|
} else {
|
||||||
$item_profile = APContact::getProfileByURL($item['owner-link']);
|
$item_profile = APContact::getByURL($item['owner-link']);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (['to', 'cc', 'bto', 'bcc'] as $element) {
|
foreach (['to', 'cc', 'bto', 'bcc'] as $element) {
|
||||||
|
@ -470,7 +470,7 @@ class ActivityPub
|
||||||
}
|
}
|
||||||
DBA::close($contacts);
|
DBA::close($contacts);
|
||||||
} else {
|
} else {
|
||||||
$profile = APContact::getProfileByURL($receiver);
|
$profile = APContact::getByURL($receiver);
|
||||||
if (!empty($profile)) {
|
if (!empty($profile)) {
|
||||||
$target = defaults($profile, 'sharedinbox', $profile['inbox']);
|
$target = defaults($profile, 'sharedinbox', $profile['inbox']);
|
||||||
$inboxes[$target] = $target;
|
$inboxes[$target] = $target;
|
||||||
|
@ -725,7 +725,7 @@ class ActivityPub
|
||||||
*/
|
*/
|
||||||
public static function transmitActivity($activity, $target, $uid)
|
public static function transmitActivity($activity, $target, $uid)
|
||||||
{
|
{
|
||||||
$profile = APContact::getProfileByURL($target);
|
$profile = APContact::getByURL($target);
|
||||||
|
|
||||||
$owner = User::getOwnerDataById($uid);
|
$owner = User::getOwnerDataById($uid);
|
||||||
|
|
||||||
|
@ -751,7 +751,7 @@ class ActivityPub
|
||||||
*/
|
*/
|
||||||
public static function transmitContactAccept($target, $id, $uid)
|
public static function transmitContactAccept($target, $id, $uid)
|
||||||
{
|
{
|
||||||
$profile = APContact::getProfileByURL($target);
|
$profile = APContact::getByURL($target);
|
||||||
|
|
||||||
$owner = User::getOwnerDataById($uid);
|
$owner = User::getOwnerDataById($uid);
|
||||||
$data = ['@context' => 'https://www.w3.org/ns/activitystreams',
|
$data = ['@context' => 'https://www.w3.org/ns/activitystreams',
|
||||||
|
@ -778,7 +778,7 @@ class ActivityPub
|
||||||
*/
|
*/
|
||||||
public static function transmitContactReject($target, $id, $uid)
|
public static function transmitContactReject($target, $id, $uid)
|
||||||
{
|
{
|
||||||
$profile = APContact::getProfileByURL($target);
|
$profile = APContact::getByURL($target);
|
||||||
|
|
||||||
$owner = User::getOwnerDataById($uid);
|
$owner = User::getOwnerDataById($uid);
|
||||||
$data = ['@context' => 'https://www.w3.org/ns/activitystreams',
|
$data = ['@context' => 'https://www.w3.org/ns/activitystreams',
|
||||||
|
@ -804,7 +804,7 @@ class ActivityPub
|
||||||
*/
|
*/
|
||||||
public static function transmitContactUndo($target, $uid)
|
public static function transmitContactUndo($target, $uid)
|
||||||
{
|
{
|
||||||
$profile = APContact::getProfileByURL($target);
|
$profile = APContact::getByURL($target);
|
||||||
|
|
||||||
$id = System::baseUrl() . '/activity/' . System::createGUID();
|
$id = System::baseUrl() . '/activity/' . System::createGUID();
|
||||||
|
|
||||||
|
@ -847,7 +847,7 @@ class ActivityPub
|
||||||
*/
|
*/
|
||||||
public static function probeProfile($url)
|
public static function probeProfile($url)
|
||||||
{
|
{
|
||||||
$apcontact = APContact::getProfileByURL($url, true);
|
$apcontact = APContact::getByURL($url, true);
|
||||||
if (empty($apcontact)) {
|
if (empty($apcontact)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1141,7 +1141,7 @@ class ActivityPub
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($actor)) {
|
if (!empty($actor)) {
|
||||||
$profile = APContact::getProfileByURL($actor);
|
$profile = APContact::getByURL($actor);
|
||||||
$followers = defaults($profile, 'followers', '');
|
$followers = defaults($profile, 'followers', '');
|
||||||
|
|
||||||
logger('Actor: ' . $actor . ' - Followers: ' . $followers, LOGGER_DEBUG);
|
logger('Actor: ' . $actor . ' - Followers: ' . $followers, LOGGER_DEBUG);
|
||||||
|
@ -1706,7 +1706,7 @@ class ActivityPub
|
||||||
}
|
}
|
||||||
|
|
||||||
logger('Updating profile for ' . $activity['object']['id'], LOGGER_DEBUG);
|
logger('Updating profile for ' . $activity['object']['id'], LOGGER_DEBUG);
|
||||||
APContact::getProfileByURL($activity['object']['id'], true);
|
APContact::getByURL($activity['object']['id'], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -424,12 +424,12 @@ class HTTPSignature
|
||||||
{
|
{
|
||||||
$url = (strpos($id, '#') ? substr($id, 0, strpos($id, '#')) : $id);
|
$url = (strpos($id, '#') ? substr($id, 0, strpos($id, '#')) : $id);
|
||||||
|
|
||||||
$profile = APContact::getProfileByURL($url);
|
$profile = APContact::getByURL($url);
|
||||||
if (!empty($profile)) {
|
if (!empty($profile)) {
|
||||||
logger('Taking key from id ' . $id, LOGGER_DEBUG);
|
logger('Taking key from id ' . $id, LOGGER_DEBUG);
|
||||||
return ['url' => $url, 'pubkey' => $profile['pubkey']];
|
return ['url' => $url, 'pubkey' => $profile['pubkey']];
|
||||||
} elseif ($url != $actor) {
|
} elseif ($url != $actor) {
|
||||||
$profile = APContact::getProfileByURL($actor);
|
$profile = APContact::getByURL($actor);
|
||||||
if (!empty($profile)) {
|
if (!empty($profile)) {
|
||||||
logger('Taking key from actor ' . $actor, LOGGER_DEBUG);
|
logger('Taking key from actor ' . $actor, LOGGER_DEBUG);
|
||||||
return ['url' => $actor, 'pubkey' => $profile['pubkey']];
|
return ['url' => $actor, 'pubkey' => $profile['pubkey']];
|
||||||
|
|
|
@ -30,7 +30,7 @@ class LDSignature
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$profile = APContact::getProfileByURL($actor);
|
$profile = APContact::getByURL($actor);
|
||||||
if (empty($profile['pubkey'])) {
|
if (empty($profile['pubkey'])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue