From 681ba504aa080c1949a4705012e2a31aaa052e75 Mon Sep 17 00:00:00 2001 From: Yasen Pramatarov Date: Thu, 31 Oct 2024 11:45:59 +0200 Subject: [PATCH] fixes error reporting --- app/pages/config.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/pages/config.php b/app/pages/config.php index 3a59e0f..fb7a60a 100644 --- a/app/pages/config.php +++ b/app/pages/config.php @@ -57,7 +57,12 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { 'jitsi_url' => $_POST['jitsi_url'], 'jilo_database' => $_POST['jilo_database'], ]; - $platformObject->addPlatform($newPlatform); + $result = $platformObject->addPlatform($newPlatform); + if ($result === true) { + $_SESSION['notice'] = "New Jitsi platform added."; + } else { + $_SESSION['error'] = "Adding the platform failed. Error: $result"; + } // deleting a host } elseif (isset($_POST['delete']) && isset($_POST['host']) && $_POST['delete'] === 'true') { @@ -80,7 +85,12 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { // deleting a platform } elseif (isset($_POST['delete']) && $_POST['delete'] === 'true') { $platform = $_POST['platform']; - $platformObject->deletePlatform($platform); + $result = $platformObject->deletePlatform($platform); + if ($result === true) { + $_SESSION['notice'] = "Platform \"{$platformObject['name']}\" added."; + } else { + $_SESSION['error'] = "Adding the platform failed. Error: $result"; + } // an update to an existing host } elseif (isset($_POST['host'])) {