X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FFriendSuggest.php;h=8567d9ef353e5bebb841959447eb8828c51e8d37;hb=3bca4fe2a64671d09e08346456cdfa6c12f996e9;hp=79d5fd81391f21ae887c4d0401d661a30dac3da1;hpb=8bdd90066f82a7ff1be36be3c6c3b49800a078c8;p=friendica.git diff --git a/src/Module/FriendSuggest.php b/src/Module/FriendSuggest.php index 79d5fd8139..8567d9ef35 100644 --- a/src/Module/FriendSuggest.php +++ b/src/Module/FriendSuggest.php @@ -1,6 +1,6 @@ getLocalUserId()) { throw new ForbiddenException($this->t('Permission denied.')); } @@ -61,12 +62,12 @@ class FriendSuggest extends BaseModule $this->friendSuggestFac = $friendSuggestFac; } - protected function post(array $request = [], array $post = []) + protected function post(array $request = []) { $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.')); } @@ -76,16 +77,16 @@ class FriendSuggest extends BaseModule } // 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'], @@ -94,18 +95,18 @@ class FriendSuggest extends BaseModule $note )); - Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::SUGGESTION, $suggest->id); + 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(); } @@ -119,7 +120,7 @@ class FriendSuggest extends BaseModule AND NOT `archive` AND NOT `deleted` AND `notify` != ""', - local_user(), + DI::userSession()->getLocalUserId(), $cid, Protocol::DFRN, ]);