[ticket/17371] Code fixes and hard-coded lang vars

PHPBB-17371

Signed-off-by: Matt Friedman <maf675@gmail.com>
This commit is contained in:
Matt Friedman 2024-07-17 09:30:08 -07:00
parent 7252345911
commit 5e80be96e4
No known key found for this signature in database

View file

@ -103,7 +103,7 @@ class webpush
{ {
if (!$this->request->is_ajax() || $this->user->data['is_bot'] || $this->user->data['user_type'] == USER_INACTIVE) if (!$this->request->is_ajax() || $this->user->data['is_bot'] || $this->user->data['user_type'] == USER_INACTIVE)
{ {
throw new http_exception(Response::HTTP_FORBIDDEN, 'Forbidden'); throw new http_exception(Response::HTTP_FORBIDDEN, 'NO_AUTH_OPERATION');
} }
if ($this->user->id() !== ANONYMOUS) if ($this->user->id() !== ANONYMOUS)
@ -132,7 +132,7 @@ class webpush
// Subscribe should only be available for logged-in "normal" users // Subscribe should only be available for logged-in "normal" users
if ($this->user->data['user_type'] == USER_IGNORE) if ($this->user->data['user_type'] == USER_IGNORE)
{ {
throw new http_exception(Response::HTTP_FORBIDDEN, 'Forbidden'); throw new http_exception(Response::HTTP_FORBIDDEN, 'NO_AUTH_OPERATION');
} }
$item_id = $this->request->variable('item_id', 0); $item_id = $this->request->variable('item_id', 0);
@ -192,7 +192,7 @@ class webpush
} }
} }
throw new http_exception(Response::HTTP_FORBIDDEN, 'Forbidden'); throw new http_exception(Response::HTTP_FORBIDDEN, 'NO_AUTH_OPERATION');
} }
/** /**
@ -251,7 +251,7 @@ class webpush
} }
// Subscribe should only be available for logged-in "normal" users // Subscribe should only be available for logged-in "normal" users
if (!$this->request->is_ajax() || $this->user->id() == ANONYMOUS || $this->user->data['is_bot'] if (!$this->request->is_ajax() || $this->user->id() === ANONYMOUS || $this->user->data['is_bot']
|| $this->user->data['user_type'] == USER_IGNORE || $this->user->data['user_type'] == USER_INACTIVE) || $this->user->data['user_type'] == USER_IGNORE || $this->user->data['user_type'] == USER_INACTIVE)
{ {
throw new http_exception(Response::HTTP_FORBIDDEN, 'NO_AUTH_OPERATION'); throw new http_exception(Response::HTTP_FORBIDDEN, 'NO_AUTH_OPERATION');