<?php
/**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
$uid = self::getCurrentUserID();
if (empty($this->parameters['id']) && empty($this->parameters['name'])) {
- DI::mstdnError()->UnprocessableEntity();
+ $this->logErrorAndJsonExit(422, $this->errorFactory->UnprocessableEntity());
}
if (!empty($this->parameters['id'])) {
$id = $this->parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
- DI::mstdnError()->RecordNotFound();
+ $this->logErrorAndJsonExit(404, $this->errorFactory->RecordNotFound());
}
} else {
$contact = Contact::selectFirst(['id'], ['nick' => $this->parameters['name'], 'uid' => 0]);
if (!empty($contact['id'])) {
$id = $contact['id'];
} elseif (!($id = Contact::getIdForURL($this->parameters['name'], 0, false))) {
- DI::mstdnError()->RecordNotFound();
+ $this->logErrorAndJsonExit(404, $this->errorFactory->RecordNotFound());
}
}
$account = DI::mstdnAccount()->createFromContactId($id, $uid);
- System::jsonExit($account);
+ $this->jsonExit($account);
}
}