summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Kohl2024-10-11 14:44:38 +0200
committerJonas Kohl2024-10-11 14:44:38 +0200
commit023788b93d8c2eb6f5128c09f74aeccb9144b74e (patch)
tree8e94d4df34ebcef79cfc958ab30cdfd8f0b0a10b
parent307b61ad625956e478c16f406061c9751baa928a (diff)
Change from exceptions to error pages
-rw-r--r--src/application/actions/attachment/get.php6
-rw-r--r--src/application/actions/lookupuser/get.php6
-rw-r--r--src/application/actions/profilepicture/get.php6
-rw-r--r--src/application/actions/thumb/get.php6
-rw-r--r--src/application/actions/verifyemail/get.php12
-rw-r--r--src/application/actions/viewtopic/_common.php6
-rw-r--r--src/application/actions/viewuser/_common.php6
7 files changed, 40 insertions, 8 deletions
diff --git a/src/application/actions/attachment/get.php b/src/application/actions/attachment/get.php
index 39f14a3..8c6996f 100644
--- a/src/application/actions/attachment/get.php
+++ b/src/application/actions/attachment/get.php
@@ -9,7 +9,11 @@ if (!$currentUser) {
exit;
}
-$attId = $_GET["attachment"] ?? throw new Exception(__("Missing attachment id"));
+$attId = $_GET["attachment"] ?? call_user_func(function() {
+ http_response_code(400);
+ msg_error(__("Missing attachment id"));
+ exit;
+});
$attachment = new Attachment();
$attachment->id = $attId;
if (!$db->fetch($attachment)) {
diff --git a/src/application/actions/lookupuser/get.php b/src/application/actions/lookupuser/get.php
index 74143f4..a7ed215 100644
--- a/src/application/actions/lookupuser/get.php
+++ b/src/application/actions/lookupuser/get.php
@@ -2,7 +2,11 @@
use mystic\forum\orm\User;
-$userHandle = $_GET["handle"] ?? throw new Exception(__("Missing handle"));
+$userHandle = $_GET["handle"] ?? call_user_func(function() {
+ http_response_code(400);
+ msg_error(__("Missing handle"));
+ exit;
+});
$user = new User();
$user->name = $userHandle;
diff --git a/src/application/actions/profilepicture/get.php b/src/application/actions/profilepicture/get.php
index abf9135..94f474a 100644
--- a/src/application/actions/profilepicture/get.php
+++ b/src/application/actions/profilepicture/get.php
@@ -2,7 +2,11 @@
use mystic\forum\orm\User;
-$userId = $_GET["user"] ?? throw new Exception(__("Missing user id"));
+$userId = $_GET["user"] ?? call_user_func(function() {
+ http_response_code(400);
+ msg_error(__("Missing user id"));
+ exit;
+});
$user = new User();
$user->id = $userId;
if (!$db->fetch($user)) {
diff --git a/src/application/actions/thumb/get.php b/src/application/actions/thumb/get.php
index d03e5f9..33f2bc6 100644
--- a/src/application/actions/thumb/get.php
+++ b/src/application/actions/thumb/get.php
@@ -5,7 +5,11 @@ use FFMpeg\FFMpeg;
use FFMpeg\FFProbe;
use mystic\forum\orm\Attachment;
-$attId = $_GET["attachment"] ?? throw new Exception(__("Missing attachment id"));
+$attId = $_GET["attachment"] ?? call_user_func(function() {
+ http_response_code(400);
+ msg_error(__("Missing attachment id"));
+ exit;
+});
$attachment = new Attachment();
$attachment->id = $attId;
if (!$db->fetch($attachment)) {
diff --git a/src/application/actions/verifyemail/get.php b/src/application/actions/verifyemail/get.php
index 2cc2707..f71dbdc 100644
--- a/src/application/actions/verifyemail/get.php
+++ b/src/application/actions/verifyemail/get.php
@@ -6,8 +6,16 @@ use Symfony\Component\Mailer\Transport;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Email;
-$token = $_GET["token"] ?? throw new Exception(__("Missing token"));
-$sig = $_GET["sig"] ?? throw new Exception(__("Missing signature"));
+$token = $_GET["token"] ?? call_user_func(function() {
+ http_response_code(400);
+ msg_error(__("Missing token"));
+ exit;
+});
+$sig = $_GET["sig"] ?? call_user_func(function() {
+ http_response_code(400);
+ msg_error(__("Missing signature"));
+ exit;
+});
$user = new User();
$user->activationToken = $token;
diff --git a/src/application/actions/viewtopic/_common.php b/src/application/actions/viewtopic/_common.php
index b257237..080cd97 100644
--- a/src/application/actions/viewtopic/_common.php
+++ b/src/application/actions/viewtopic/_common.php
@@ -3,7 +3,11 @@
use mystic\forum\orm\Topic;
$formId = "addpost";
-$topicId = $_GET["topic"] ?? throw new Exception(__("Missing topic id"));
+$topicId = $_GET["topic"] ?? call_user_func(function() {
+ http_response_code(400);
+ msg_error(__("Missing topic id"));
+ exit;
+});
$topic = new Topic();
$topic->id = $topicId;
if (!$db->fetch($topic)) {
diff --git a/src/application/actions/viewuser/_common.php b/src/application/actions/viewuser/_common.php
index 52d0d05..96556c8 100644
--- a/src/application/actions/viewuser/_common.php
+++ b/src/application/actions/viewuser/_common.php
@@ -2,7 +2,11 @@
use mystic\forum\orm\User;
-$userId = $_GET["user"] ?? throw new Exception(__("Missing user id"));
+$userId = $_GET["user"] ?? call_user_func(function() {
+ http_response_code(400);
+ msg_error(__("Missing user id"));
+ exit;
+});
$user = new User();
$user->id = $userId;
if (!$db->fetch($user)) {