*/
protected function post(array $request = [])
{
- if (!local_user()) {
+ if (!DI::userSession()->getLocalUserId()) {
throw new HTTPException\UnauthorizedException($this->l10n->t('Permission denied.'));
}
$request_id = $this->parameters['id'] ?? false;
if ($request_id) {
- $intro = $this->introductionRepo->selectOneById($request_id, local_user());
+ $intro = $this->introductionRepo->selectOneById($request_id, DI::userSession()->getLocalUserId());
switch ($_POST['submit']) {
case $this->l10n->t('Discard'):
*/
protected function rawContent(array $request = [])
{
- if (!local_user()) {
+ if (!DI::userSession()->getLocalUserId()) {
throw new HTTPException\UnauthorizedException($this->l10n->t('Permission denied.'));
}
if ($this->args->get(1) === 'mark' && $this->args->get(2) === 'all') {
try {
- $this->notificationRepo->setAllSeenForUser(local_user());
- $success = $this->notifyRepo->setAllSeenForUser(local_user());
+ $this->notificationRepo->setAllSeenForUser(DI::userSession()->getLocalUserId());
+ $success = $this->notifyRepo->setAllSeenForUser(DI::userSession()->getLocalUserId());
} catch (\Exception $e) {
$this->logger->warning('set all seen failed.', ['exception' => $e]);
$success = false;
*/
protected function content(array $request = []): string
{
- if (!local_user()) {
+ if (!DI::userSession()->getLocalUserId()) {
DI::sysmsg()->addNotice($this->l10n->t('You must be logged in to show this page.'));
return Login::form();
}
private function handleNotify(int $notifyId)
{
$Notify = $this->notifyRepo->selectOneById($notifyId);
- if ($Notify->uid !== local_user()) {
+ if ($Notify->uid !== DI::userSession()->getLocalUserId()) {
throw new HTTPException\ForbiddenException();
}
- if ($this->pconfig->get(local_user(), 'system', 'detailed_notif')) {
+ if ($this->pconfig->get(DI::userSession()->getLocalUserId(), 'system', 'detailed_notif')) {
$Notify->setSeen();
$this->notifyRepo->save($Notify);
} else {
private function handleNotification(int $notificationId)
{
$Notification = $this->notificationRepo->selectOneById($notificationId);
- if ($Notification->uid !== local_user()) {
+ if ($Notification->uid !== DI::userSession()->getLocalUserId()) {
throw new HTTPException\ForbiddenException();
}
- if ($this->pconfig->get(local_user(), 'system', 'detailed_notif')) {
+ if ($this->pconfig->get(DI::userSession()->getLocalUserId(), 'system', 'detailed_notif')) {
$Notification->setSeen();
$this->notificationRepo->save($Notification);
} else {