- This will ensure headers set in BaseModule->run will be carried in jsonExit scenarios
- Deprecate jsonExit() method in Core\System
$this->httpExit($content);
}
+
+ /**
+ * Display the response using JSON to encode the content
+ *
+ * @param mixed $content
+ * @param string $content_type
+ * @param int $options A combination of json_encode() binary flags
+ * @return void
+ * @throws HTTPException\InternalServerErrorException
+ * @see json_encode()
+ */
+ public function jsonExit($content, string $content_type = 'application/json', int $options = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)
+ {
+ $this->httpExit(json_encode($content, $options), ICanCreateResponses::TYPE_JSON, $content_type);
+ }
}
* @param mixed $content The input content
* @param string $content_type Type of the input (Default: 'application/json')
* @param integer $options JSON options
- * @throws \Friendica\Network\HTTPException\InternalServerErrorException
+ * @throws InternalServerErrorException
+ * @deprecated since 2023.09 Use BaseModule->jsonExit instead
*/
- public static function jsonExit($content, $content_type = 'application/json', int $options = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) {
- DI::apiResponse()->setType(Response::TYPE_JSON, $content_type);
- DI::apiResponse()->addContent(json_encode($content, $options));
- self::echoResponse(DI::apiResponse()->generate());
-
- self::exit();
+ public static function jsonExit($content, string $content_type = 'application/json', int $options = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)
+ {
+ self::httpExit(json_encode($content, $options), Response::TYPE_JSON, $content_type);
}
/**
],
];
- System::jsonExit($output);
+ $this->jsonExit($output);
}
}
$featured = ActivityPub\Transmitter::getFeatured($owner, $page);
- System::jsonExit($featured, 'application/activity+json');
+ $this->jsonExit($featured, 'application/activity+json');
}
}
$followers = ActivityPub\Transmitter::getContacts($owner, [Contact::FOLLOWER, Contact::FRIEND], 'followers', $page, (string)HTTPSignature::getSigner('', $_SERVER));
- System::jsonExit($followers, 'application/activity+json');
+ $this->jsonExit($followers, 'application/activity+json');
}
}
$following = ActivityPub\Transmitter::getContacts($owner, [Contact::SHARING, Contact::FRIEND], 'following', $page);
- System::jsonExit($following, 'application/activity+json');
+ $this->jsonExit($following, 'application/activity+json');
}
}
$inbox = ActivityPub\ClientToServer::getPublicInbox($uid, $page, $request['max_id'] ?? null);
}
- System::jsonExit($inbox, 'application/activity+json');
+ $this->jsonExit($inbox, 'application/activity+json');
}
protected function post(array $request = [])
// Relaxed CORS header for public items
header('Access-Control-Allow-Origin: *');
- System::jsonExit($data, 'application/activity+json');
+ $this->jsonExit($data, 'application/activity+json');
}
}
$outbox = ActivityPub\ClientToServer::getOutbox($owner, $uid, $page, $request['max_id'] ?? null, HTTPSignature::getSigner('', $_SERVER));
- System::jsonExit($outbox, 'application/activity+json');
+ $this->jsonExit($outbox, 'application/activity+json');
}
protected function post(array $request = [])
throw new \Friendica\Network\HTTPException\BadRequestException();
}
- System::jsonExit(ActivityPub\ClientToServer::processActivity($activity, $uid, self::getCurrentApplication() ?? []));
+ $this->jsonExit(ActivityPub\ClientToServer::processActivity($activity, $uid, self::getCurrentApplication() ?? []));
}
}
];
$data['generator'] = ActivityPub\Transmitter::getService();
- System::jsonExit($data, 'application/activity+json');
+ $this->jsonExit($data, 'application/activity+json');
}
}
Item::performActivity($item['id'], 'dislike', $uid);
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
+ $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
}
}
$accounts[] = DI::mstdnAccount()->createFromContactId($activity['author-id'], $uid);
}
- System::jsonExit($accounts);
+ $this->jsonExit($accounts);
}
}
Item::performActivity($item['id'], 'undislike', $uid);
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
+ $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
}
}
}
$account = DI::mstdnAccount()->createFromContactId($id, $uid);
- System::jsonExit($account);
+ $this->jsonExit($account);
}
}
}
}
- System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
+ $this->jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
}
}
{
self::checkAllowedScope(self::SCOPE_READ);
- System::jsonExit([]);
+ $this->jsonExit([]);
}
}
Contact::update(['notify_new_posts' => $request['notify']], ['id' => $result['cid']]);
- System::jsonExit(DI::mstdnRelationship()->createFromContactId($result['cid'], $uid)->toArray());
+ $this->jsonExit(DI::mstdnRelationship()->createFromContactId($result['cid'], $uid)->toArray());
}
}
}
self::setLinkHeader();
- System::jsonExit($accounts);
+ $this->jsonExit($accounts);
}
}
}
self::setLinkHeader();
- System::jsonExit($accounts);
+ $this->jsonExit($accounts);
}
}
{
self::checkAllowedScope(self::SCOPE_READ);
- System::jsonExit([]);
+ $this->jsonExit([]);
}
}
DBA::close($circles);
}
- System::jsonExit($lists);
+ $this->jsonExit($lists);
}
}
Contact\User::setIgnored($this->parameters['id'], $uid, true);
- System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
+ $this->jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
}
}
Contact::update(['info' => $request['comment']], ['id' => $cdata['user']]);
- System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
+ $this->jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
}
}
$relationships[] = DI::mstdnRelationship()->createFromContactId($id, $uid);
}
- System::jsonExit($relationships);
+ $this->jsonExit($relationships);
}
}
DBA::close($contacts);
}
- System::jsonExit($accounts);
+ $this->jsonExit($accounts);
}
}
}
self::setLinkHeader($request['friendica_order'] != TimelineOrderByTypes::ID);
- System::jsonExit($statuses);
+ $this->jsonExit($statuses);
}
}
Contact\User::setBlocked($this->parameters['id'], $uid, false);
- System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
+ $this->jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
}
}
Contact::unfollow($contact);
- System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
+ $this->jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
}
}
Contact\User::setIgnored($this->parameters['id'], $uid, false);
- System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
+ $this->jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
}
}
self::checkAllowedScope(self::SCOPE_READ);
// @todo Possibly use the message from the pageheader addon for this
- System::jsonExit([]);
+ $this->jsonExit([]);
}
}
if (!empty($request['redirect_uris']) && is_array($request['redirect_uris'])) {
$request['redirect_uris'] = $request['redirect_uris'][0];
- }
+ }
}
if (empty($request['client_name']) || empty($request['redirect_uris'])) {
DI::mstdnError()->InternalError();
}
- System::jsonExit(DI::mstdnApplication()->createFromApplicationId(DBA::lastInsertId())->toArray());
+ $this->jsonExit(DI::mstdnApplication()->createFromApplicationId(DBA::lastInsertId())->toArray());
}
}
DI::mstdnError()->Unauthorized();
}
- System::jsonExit(DI::mstdnApplication()->createFromApplicationId($application['id']));
+ $this->jsonExit(DI::mstdnApplication()->createFromApplicationId($application['id']));
}
}
}
self::setLinkHeader();
- System::jsonExit($accounts);
+ $this->jsonExit($accounts);
}
}
}
self::setLinkHeader();
- System::jsonExit($statuses);
+ $this->jsonExit($statuses);
}
}
DBA::delete('conv', ['id' => $this->parameters['id'], 'uid' => $uid]);
DBA::delete('mail', ['convid' => $this->parameters['id'], 'uid' => $uid]);
- System::jsonExit([]);
+ $this->jsonExit([]);
}
/**
}
self::setLinkHeader();
- System::jsonExit($conversations);
+ $this->jsonExit($conversations);
}
}
DBA::update('mail', ['seen' => true], ['convid' => $this->parameters['id'], 'uid' => $uid]);
- System::jsonExit(DI::mstdnConversation()->createFromConvId($this->parameters['id'])->toArray());
+ $this->jsonExit(DI::mstdnConversation()->createFromConvId($this->parameters['id'])->toArray());
}
}
{
$emojis = DI::mstdnEmoji()->createCollectionFromSmilies(Smilies::getList());
- System::jsonExit($emojis->getArrayCopy());
+ $this->jsonExit($emojis->getArrayCopy());
}
}
}
DBA::close($contacts);
- System::jsonExit($accounts);
+ $this->jsonExit($accounts);
}
}
*/
protected function rawContent(array $request = [])
{
- System::jsonExit([]);
+ $this->jsonExit([]);
}
}
}
self::setLinkHeader();
- System::jsonExit($statuses);
+ $this->jsonExit($statuses);
}
}
{
self::checkAllowedScope(self::SCOPE_READ);
- System::jsonExit([]);
+ $this->jsonExit([]);
}
}
throw new HTTPException\BadRequestException('Unexpected action parameter, expecting "authorize", "ignore" or "reject"');
}
- System::jsonExit($relationship);
+ $this->jsonExit($relationship);
}
/**
}
self::setLinkHeader();
- System::jsonExit($return);
+ $this->jsonExit($return);
}
}
}
self::setLinkHeader();
- System::jsonExit($return);
+ $this->jsonExit($return);
}
}
*/
protected function rawContent(array $request = [])
{
- System::jsonExit(new InstanceEntity($this->config, $this->baseUrl, $this->database, System::getRules()));
+ $this->jsonExit(new InstanceEntity($this->config, $this->baseUrl, $this->database, System::getRules()));
}
}
}
DBA::close($instances);
- System::jsonExit($return);
+ $this->jsonExit($return);
}
}
*/
protected function rawContent(array $request = [])
{
- System::jsonExit(System::getRules());
+ $this->jsonExit(System::getRules());
}
}
$contact = $this->buildContactInfo();
$friendica_extensions = $this->buildFriendicaExtensionInfo();
$rules = System::getRules();
- System::jsonExit(new InstanceEntity(
+ $this->jsonExit(new InstanceEntity(
$domain,
$title,
$version,
DI::mstdnError()->InternalError();
}
- System::jsonExit([]);
+ $this->jsonExit([]);
}
protected function post(array $request = [])
DI::mstdnError()->InternalError();
}
- System::jsonExit(DI::mstdnList()->createFromCircleId($id));
+ $this->jsonExit(DI::mstdnList()->createFromCircleId($id));
}
public function put(array $request = [])
$lists = DI::mstdnList()->createFromCircleId($id);
}
- System::jsonExit($lists);
+ $this->jsonExit($lists);
}
}
}
self::setLinkHeader();
- System::jsonExit($accounts);
+ $this->jsonExit($accounts);
}
}
$fields = ['last_read_id' => $last_read_id, 'version' => $version, 'updated_at' => DateTimeFormat::utcNow()];
DBA::update('application-marker', $fields, $condition, true);
- System::jsonExit($this->fetchTimelines($application['id'], $uid));
+ $this->jsonExit($this->fetchTimelines($application['id'], $uid));
}
/**
$uid = self::getCurrentUserID();
$application = self::getCurrentApplication();
- System::jsonExit($this->fetchTimelines($application['id'], $uid));
+ $this->jsonExit($this->fetchTimelines($application['id'], $uid));
}
private function fetchTimelines(int $application_id, int $uid)
Logger::info('Uploaded photo', ['media' => $media]);
- System::jsonExit(DI::mstdnAttachment()->createFromPhoto($media['id']));
+ $this->jsonExit(DI::mstdnAttachment()->createFromPhoto($media['id']));
}
public function put(array $request = [])
DI::mstdnError()->RecordNotFound();
}
Post\Media::updateById(['description' => $request['description']], $this->parameters['id']);
- System::jsonExit(DI::mstdnAttachment()->createFromId($this->parameters['id']));
+ $this->jsonExit(DI::mstdnAttachment()->createFromId($this->parameters['id']));
}
Photo::update(['desc' => $request['description']], ['resource-id' => $photo['resource-id']]);
- System::jsonExit(DI::mstdnAttachment()->createFromPhoto($this->parameters['id']));
+ $this->jsonExit(DI::mstdnAttachment()->createFromPhoto($this->parameters['id']));
}
/**
DI::mstdnError()->RecordNotFound();
}
- System::jsonExit(DI::mstdnAttachment()->createFromPhoto($id));
+ $this->jsonExit(DI::mstdnAttachment()->createFromPhoto($id));
}
}
}
self::setLinkHeader();
- System::jsonExit($accounts);
+ $this->jsonExit($accounts);
}
}
$id = $this->parameters['id'];
try {
$notification = DI::notification()->selectOneForUser($uid, ['id' => $id]);
- System::jsonExit(DI::mstdnNotification()->createFromNotification($notification, self::appSupportsQuotes()));
+ $this->jsonExit(DI::mstdnNotification()->createFromNotification($notification, self::appSupportsQuotes()));
} catch (\Exception $e) {
DI::mstdnError()->RecordNotFound();
}
if ($request['summary']) {
$count = DI::notification()->countForUser($uid, $condition);
- System::jsonExit(['count' => $count]);
+ $this->jsonExit(['count' => $count]);
} else {
$mstdnNotifications = [];
}
self::setLinkHeader();
- System::jsonExit($mstdnNotifications);
+ $this->jsonExit($mstdnNotifications);
}
}
}
DI::notification()->setAllDismissedForUser($uid);
- System::jsonExit([]);
+ $this->jsonExit([]);
}
}
$Notification->setDismissed();
DI::notification()->save($Notification);
- System::jsonExit([]);
+ $this->jsonExit([]);
}
}
DI::mstdnError()->UnprocessableEntity();
}
- System::jsonExit(DI::mstdnPoll()->createFromId($this->parameters['id'], $uid));
+ $this->jsonExit(DI::mstdnPoll()->createFromId($this->parameters['id'], $uid));
}
}
$preferences = new \Friendica\Object\Api\Mastodon\Preferences($visibility, $sensitive, $language, $media, $spoilers);
- System::jsonExit($preferences);
+ $this->jsonExit($preferences);
}
}
$this->reportRepo->save($report);
- System::jsonExit([]);
+ $this->jsonExit([]);
}
}
Post\Delayed::deleteById($this->parameters['id']);
- System::jsonExit([]);
+ $this->jsonExit([]);
}
/**
$uid = self::getCurrentUserID();
if (isset($this->parameters['id'])) {
- System::jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId($this->parameters['id'], $uid)->toArray());
+ $this->jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId($this->parameters['id'], $uid)->toArray());
}
$request = $this->getRequest([
}
self::setLinkHeader();
- System::jsonExit($statuses);
+ $this->jsonExit($statuses);
}
}
$result['hashtags'] = self::searchHashtags($request['q'], $request['exclude_unreviewed'], $limit, $request['offset'], $this->parameters['version']);
}
- System::jsonExit($result);
+ $this->jsonExit($result);
}
/**
Item::updateDisplayCache($post['uri-id']);
- System::jsonExit(DI::mstdnStatus()->createFromUriId($post['uri-id'], $uid, self::appSupportsQuotes()));
+ $this->jsonExit(DI::mstdnStatus()->createFromUriId($post['uri-id'], $uid, self::appSupportsQuotes()));
}
protected function post(array $request = [])
if (empty($id)) {
DI::mstdnError()->InternalError();
}
- System::jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId($id, $uid)->toArray());
+ $this->jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId($id, $uid)->toArray());
}
$id = Item::insert($item, true);
if (!empty($id)) {
$item = Post::selectFirst(['uri-id'], ['id' => $id]);
if (!empty($item['uri-id'])) {
- System::jsonExit(DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, self::appSupportsQuotes()));
+ $this->jsonExit(DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, self::appSupportsQuotes()));
}
}
DI::mstdnError()->RecordNotFound();
}
- System::jsonExit([]);
+ $this->jsonExit([]);
}
/**
DI::mstdnError()->UnprocessableEntity();
}
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), false));
+ $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), false));
}
private function getApp(): string
if (preg_match("/\[url=[^\[\]]*\](.*)\[\/url\]\z/ism", $status, $matches)) {
$status = preg_replace("/\[url=[^\[\]]*\].*\[\/url\]\z/ism", PageInfo::getFooterFromUrl($matches[1]), $status);
}
-
+
return $status;
}
}
// Issue tracking the behavior of createFromUriId: https://github.com/friendica/friendica/issues/13350
$isReblog = $item['uri-id'] != $this->parameters['id'];
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray());
+ $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray());
}
}
$card = DI::mstdnCard()->createFromUriId($post['uri-id']);
- System::jsonExit($card->toArray());
+ $this->jsonExit($card->toArray());
}
}
$statuses['descendants'][] = DI::mstdnStatus()->createFromUriId($descendant, $uid, $display_quotes);
}
- System::jsonExit($statuses);
+ $this->jsonExit($statuses);
}
private static function getParents(int $id, array $parents, array $list = [])
// Issue tracking the behavior of createFromUriId: https://github.com/friendica/friendica/issues/13350
$isReblog = $item['uri-id'] != $this->parameters['id'];
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray());
+ $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray());
}
}
$accounts[] = DI::mstdnAccount()->createFromContactId($activity['author-id'], $uid);
}
- System::jsonExit($accounts);
+ $this->jsonExit($accounts);
}
}
// Issue tracking the behavior of createFromUriId: https://github.com/friendica/friendica/issues/13350
$isReblog = $item['uri-id'] != $this->parameters['id'];
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray());
+ $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray());
}
}
// Issue tracking the behavior of createFromUriId: https://github.com/friendica/friendica/issues/13350
$isReblog = $item['uri-id'] != $this->parameters['id'];
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(),$isReblog)->toArray());
+ $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(),$isReblog)->toArray());
}
}
// Issue tracking the behavior of createFromUriId: https://github.com/friendica/friendica/issues/13350
$isReblog = $item['uri-id'] != $this->parameters['id'];
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray());
+ $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray());
}
}
$accounts[] = DI::mstdnAccount()->createFromContactId($activity['author-id'], $uid);
}
- System::jsonExit($accounts);
+ $this->jsonExit($accounts);
}
}
$source = DI::mstdnStatusSource()->createFromUriId($id, $uid);
- System::jsonExit($source->toArray());
+ $this->jsonExit($source->toArray());
}
}
// Issue tracking the behavior of createFromUriId: https://github.com/friendica/friendica/issues/13350
$isReblog = $item['uri-id'] != $this->parameters['id'];
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray());
+ $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray());
}
}
// Issue tracking the behavior of createFromUriId: https://github.com/friendica/friendica/issues/13350
$isReblog = $item['uri-id'] != $this->parameters['id'];
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray());
+ $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray());
}
}
// Issue tracking the behavior of createFromUriId: https://github.com/friendica/friendica/issues/13350
$isReblog = $item['uri-id'] != $this->parameters['id'];
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray());
+ $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray());
}
}
// Issue tracking the behavior of createFromUriId: https://github.com/friendica/friendica/issues/13350
$isReblog = $item['uri-id'] != $this->parameters['id'];
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray());
+ $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray());
}
}
// Issue tracking the behavior of createFromUriId: https://github.com/friendica/friendica/issues/13350
$isReblog = $item['uri-id'] != $this->parameters['id'];
- System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray());
+ $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray());
}
}
];
}
- System::jsonExit($accounts);
+ $this->jsonExit($accounts);
}
}
$following = DBA::exists('search', ['uid' => $uid, 'term' => '#' . $tag]);
$hashtag = new \Friendica\Object\Api\Mastodon\Tag($this->baseUrl, ['name' => $tag], [], $following);
- System::jsonExit($hashtag->toArray());
+ $this->jsonExit($hashtag->toArray());
}
}
}
$hashtag = new \Friendica\Object\Api\Mastodon\Tag($this->baseUrl, ['name' => ltrim($this->parameters['hashtag'])], [], true);
- System::jsonExit($hashtag->toArray());
+ $this->jsonExit($hashtag->toArray());
}
}
DBA::delete('search', $term);
$hashtag = new \Friendica\Object\Api\Mastodon\Tag($this->baseUrl, ['name' => ltrim($this->parameters['hashtag'])], [], false);
- System::jsonExit($hashtag->toArray());
+ $this->jsonExit($hashtag->toArray());
}
}
}
self::setLinkHeader();
- System::jsonExit($statuses);
+ $this->jsonExit($statuses);
}
}
self::setLinkHeader($request['friendica_order'] != TimelineOrderByTypes::ID);
- System::jsonExit($statuses);
+ $this->jsonExit($statuses);
}
}
}
self::setLinkHeader($request['friendica_order'] != TimelineOrderByTypes::ID);
- System::jsonExit($statuses);
+ $this->jsonExit($statuses);
}
}
}
self::setLinkHeader($request['friendica_order'] != TimelineOrderByTypes::ID);
- System::jsonExit($statuses);
+ $this->jsonExit($statuses);
}
}
}
self::setLinkHeader();
- System::jsonExit($statuses);
+ $this->jsonExit($statuses);
}
}
self::setLinkHeaderByOffsetLimit($request['offset'], $request['limit']);
}
- System::jsonExit($trending);
+ $this->jsonExit($trending);
}
}
self::setLinkHeaderByOffsetLimit($request['offset'], $request['limit']);
}
- System::jsonExit($trending);
+ $this->jsonExit($trending);
}
}
self::setLinkHeaderByOffsetLimit($request['offset'], $request['limit']);
}
- System::jsonExit($trending);
+ $this->jsonExit($trending);
}
}
self::setLinkHeader();
- System::jsonExit($return);
+ $this->jsonExit($return);
}
}
self::setLinkHeader();
- System::jsonExit($return);
+ $this->jsonExit($return);
}
}
self::setLinkHeader();
- System::jsonExit($return);
+ $this->jsonExit($return);
}
}
'page' => $pager->getPage(),
];
- System::jsonExit($notifications);
+ $this->jsonExit($notifications);
}
/**
$events = Event::getListByDate($owner['uid'], $request['start'] ?? '', $request['end'] ?? '');
}
- System::jsonExit($events ? self::map($events) : []);
+ $this->jsonExit($events ? self::map($events) : []);
}
private static function map(array $events): array
}
DI::sysmsg()->addInfo($message);
- System::jsonExit(['status' => 'OK', 'message' => $message]);
+ $this->jsonExit(['status' => 'OK', 'message' => $message]);
} catch (\Exception $e) {
DI::sysmsg()->addNotice($e->getMessage());
System::jsonError($e->getCode(), ['status' => 'error', 'message' => $e->getMessage()]);
$data = ActivityPub\Transmitter::getProfile(0);
header('Access-Control-Allow-Origin: *');
header('Cache-Control: max-age=23200, stale-while-revalidate=23200');
- System::jsonExit($data, 'application/activity+json');
+ $this->jsonExit($data, 'application/activity+json');
} catch (HTTPException\NotFoundException $e) {
System::jsonError(404, ['error' => 'Record not found']);
}
'no_scrape_url' => $this->baseUrl . '/noscrape',
];
- System::jsonExit($data);
+ $this->jsonExit($data);
}
}
$result = [];
if (empty($request['t'])) {
- System::jsonExit($result);
+ $this->jsonExit($result);
}
$taglist = DBA::select(
}
DBA::close($taglist);
- System::jsonExit($result);
+ $this->jsonExit($result);
}
}
'state' => 1,
];
- System::jsonExit($return);
+ $this->jsonExit($return);
}
}
'state' => 1
];
- System::jsonExit($return);
+ $this->jsonExit($return);
}
}
'state' => $ignored,
];
- System::jsonExit($return);
+ $this->jsonExit($return);
}
}
'state' => (int)$pinned,
];
- System::jsonExit($return);
+ $this->jsonExit($return);
}
}
'state' => (int)$starred,
];
- System::jsonExit($return);
+ $this->jsonExit($return);
}
}
$manifest['theme_color'] = $theme_color;
}
- Core\System::jsonExit($manifest, 'application/manifest+json');
+ $this->jsonExit($manifest, 'application/manifest+json');
}
}
if (!$owner['net-publish']) {
$json_info['hide'] = true;
- System::jsonExit($json_info);
+ $this->jsonExit($json_info);
}
$keywords = $owner['pub_keywords'] ?? '';
}
}
- System::jsonExit($json_info);
+ $this->jsonExit($json_info);
}
}
$success = false;
}
- System::jsonExit(['result' => (($success) ? 'success' : 'fail')]);
+ $this->jsonExit(['result' => (($success) ? 'success' : 'fail')]);
}
}
// JSONP support
$this->httpExit($_GET['callback'] . '(' . json_encode(['result' => $data]) . ')', Response::TYPE_BLANK, 'application/javascript');
} else {
- System::jsonExit(['result' => $data]);
+ $this->jsonExit(['result' => $data]);
}
}
}
}
DBA::delete('application-token', ['application-id' => $token['id']]);
- System::jsonExit([]);
+ $this->jsonExit([]);
}
}
$object = new \Friendica\Object\Api\Mastodon\Token($token['access_token'], 'Bearer', $application['scopes'], $token['created_at'], $me);
- System::jsonExit($object->toArray());
+ $this->jsonExit($object->toArray());
}
}
}
}
}
- System::jsonExit($ret, 'application/x-zot+json');
+ $this->jsonExit($ret, 'application/x-zot+json');
}
}
if ($arr['text']) {
if ($format == 'json') {
- System::jsonExit($arr['text']);
+ $this->jsonExit($arr['text']);
} else {
$this->httpExit($arr['text']);
}
$ret['success'] = true;
}
- System::jsonExit($ret);
+ $this->jsonExit($ret);
} else {
$this->httpExit(BBCode::embedURL($url, empty($_GET['noAttachment']), $title, $description, $_GET['tags'] ?? ''));
}
$data = ActivityPub\Transmitter::getProfile($user['uid'], ActivityPub::isAcceptedRequester($user['uid']));
header('Access-Control-Allow-Origin: *');
header('Cache-Control: max-age=23200, stale-while-revalidate=23200');
- System::jsonExit($data, 'application/activity+json');
+ $this->jsonExit($data, 'application/activity+json');
} catch (HTTPException\NotFoundException $e) {
System::jsonError(404, ['error' => 'Record not found']);
}
$o = $this->regularContactSearch($request, $type);
}
- System::jsonExit($o);
+ $this->jsonExit($o);
}
private function globalContactSearch(array $request): array
$results = [];
if (empty($tags)) {
- System::jsonExit([
+ $this->jsonExit([
'total' => 0,
'items_page' => $perPage,
'page' => $page,
$totalCount = $this->database->count('owner-view', $condition);
if ($totalCount === 0) {
- System::jsonExit([
+ $this->jsonExit([
'total' => 0,
'items_page' => $perPage,
'page' => $page,
$this->database->close($searchStmt);
- System::jsonExit([
+ $this->jsonExit([
'total' => $totalCount,
'items_page' => $perPage,
'page' => $page,
for ($i = 0; $i < count($smilies['texts']); $i++) {
$results[] = ['text' => $smilies['texts'][$i], 'icon' => $smilies['icons'][$i]];
}
- System::jsonExit($results);
+ $this->jsonExit($results);
}
}
], $services);
$this->logger->debug("statistics.", ['statistics' => $statistics]);
- System::jsonExit($statistics);
+ $this->jsonExit($statistics);
}
}
$version = $info['version'] ?? '';
$credits = $info['credits'] ?? '';
- System::jsonExit([
+ $this->jsonExit([
'img' => Theme::getScreenshot($theme),
'desc' => $description,
'version' => $version,
$this->logger->info('End of poco');
- System::jsonExit($return);
+ $this->jsonExit($return);
}
}
class NodeInfo extends BaseModule
{
protected function rawContent(array $request = [])
- {
- self::printWellKnown();
- }
-
- /**
- * Prints the well-known nodeinfo redirect
- *
- * @throws \Friendica\Network\HTTPException\NotFoundException
- */
- private static function printWellKnown()
{
$nodeinfo = [
'links' => [
['rel' => 'http://nodeinfo.diaspora.software/ns/schema/1.0',
- 'href' => DI::baseUrl() . '/nodeinfo/1.0'],
+ 'href' => DI::baseUrl() . '/nodeinfo/1.0'],
['rel' => 'http://nodeinfo.diaspora.software/ns/schema/2.0',
- 'href' => DI::baseUrl() . '/nodeinfo/2.0'],
+ 'href' => DI::baseUrl() . '/nodeinfo/2.0'],
]
];
- System::jsonExit($nodeinfo);
+ $this->jsonExit($nodeinfo);
}
}
$relay['protocols']['diaspora'] = ['receive' => DI::baseUrl() . '/receive/public'];
}
- System::jsonExit($relay);
+ $this->jsonExit($relay);
}
}
]
];
header('Access-Control-Allow-Origin: *');
- System::jsonExit($json, 'application/jrd+json; charset=utf-8');
+ $this->jsonExit($json, 'application/jrd+json; charset=utf-8');
}
private function printJSON(string $alias, array $owner, array $avatar)
];
header('Access-Control-Allow-Origin: *');
- System::jsonExit($json, 'application/jrd+json; charset=utf-8');
+ $this->jsonExit($json, 'application/jrd+json; charset=utf-8');
}
private function printXML(string $alias, array $owner, array $avatar)