use Friendica\Core\Renderer;
use Friendica\Core\Worker;
use Friendica\Database\Database;
+use Friendica\DI;
use Friendica\Model\Contact as ContactModel;
use Friendica\Network\HTTPException\ForbiddenException;
use Friendica\Network\HTTPException\NotFoundException;
{
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
- if (!local_user()) {
+ if (!DI::userSession()->getLocalUserId()) {
throw new ForbiddenException($this->t('Permission denied.'));
}
$cid = intval($this->parameters['contact']);
// We do query the "uid" as well to ensure that it is our contact
- if (!$this->dba->exists('contact', ['id' => $cid, 'uid' => local_user()])) {
+ if (!$this->dba->exists('contact', ['id' => $cid, 'uid' => DI::userSession()->getLocalUserId()])) {
throw new NotFoundException($this->t('Contact not found.'));
}
}
// We do query the "uid" as well to ensure that it is our contact
- $contact = $this->dba->selectFirst('contact', ['name', 'url', 'request', 'avatar'], ['id' => $suggest_contact_id, 'uid' => local_user()]);
+ $contact = $this->dba->selectFirst('contact', ['name', 'url', 'request', 'avatar'], ['id' => $suggest_contact_id, 'uid' => DI::userSession()->getLocalUserId()]);
if (empty($contact)) {
- notice($this->t('Suggested contact not found.'));
+ DI::sysmsg()->addNotice($this->t('Suggested contact not found.'));
return;
}
$note = Strings::escapeHtml(trim($_POST['note'] ?? ''));
$suggest = $this->friendSuggestRepo->save($this->friendSuggestFac->createNew(
- local_user(),
+ DI::userSession()->getLocalUserId(),
$cid,
$contact['name'],
$contact['url'],
Worker::add(Worker::PRIORITY_HIGH, 'Notifier', Delivery::SUGGESTION, $suggest->id);
- info($this->t('Friend suggestion sent.'));
+ DI::sysmsg()->addInfo($this->t('Friend suggestion sent.'));
}
protected function content(array $request = []): string
{
$cid = intval($this->parameters['contact']);
- $contact = $this->dba->selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
+ $contact = $this->dba->selectFirst('contact', [], ['id' => $cid, 'uid' => DI::userSession()->getLocalUserId()]);
if (empty($contact)) {
- notice($this->t('Contact not found.'));
+ DI::sysmsg()->addNotice($this->t('Contact not found.'));
$this->baseUrl->redirect();
}
AND NOT `archive`
AND NOT `deleted`
AND `notify` != ""',
- local_user(),
+ DI::userSession()->getLocalUserId(),
$cid,
Protocol::DFRN,
]);