]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/commitdiff
Nicer error dialog in connect_to_ircd()
authorBram Matthys <redacted>
Wed, 26 Apr 2023 07:02:19 +0000 (09:02 +0200)
committerBram Matthys <redacted>
Wed, 26 Apr 2023 07:02:19 +0000 (09:02 +0200)
channels/index.php
inc/connection.php

index 111bf225e26160c492b8b0050541881efec281b2..70b922a97aced1d2fdf8edc8ebff181d882495dd 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 require_once "../inc/common.php";
-require_once "../inc/connection.php";
 require_once "../inc/header.php";
+require_once "../inc/connection.php";
 
 if (!empty($_POST))
 {
index 4be8b4a11eccdd0a02c2f98a4db1fcc1aa3b46d3..f66d7507b7d65d3bf7f1ffaefe2560d610cc73b9 100644 (file)
@@ -10,7 +10,10 @@ function connect_to_ircd()
 
        $server = get_active_rpc_server();
        if (!$server)
-               die("No RPC server configured as primary");
+       {
+               Message::Fail("No RPC server configured. Go to Settings - RPC Servers.");
+               die;
+       }
        $host = $config["unrealircd"][$server]["host"];
        $port = $config["unrealircd"][$server]["port"];
        $rpc_user = $config["unrealircd"][$server]["rpc_user"];
@@ -24,8 +27,9 @@ function connect_to_ircd()
 
        if ($rpc_password === null)
        {
-               die("Your RPC password in the DB was encrypted with a different key than config/config.php contains.<br>\n".
-                   "Either restore your previous config/config.php or start with a fresh database.<br>\n");
+               Message::Fail("Your RPC password in the DB was encrypted with a different key than config/config.php contains.<br>\n".
+                             "Either restore your previous config/config.php or start with a fresh database.<br>\n");
+               die;
        }
 
        /* Connect now */
@@ -39,10 +43,10 @@ function connect_to_ircd()
        }
        catch (Exception $e)
        {
-               echo "Unable to connect to UnrealIRCd: ".$e->getMessage() . "<br><br>";
-               echo "Verify your connection details in config.php (rpc user, rpc password, host) and ".
-                    "verify your UnrealIRCd configuration (listen block with listen::options::rpc and ".
-                    "an rpc-user block with the correct IP allowed and the correct username and password).";
+               Message::Fail("Unable to connect to UnrealIRCd: ".$e->getMessage() . "<br>".
+                             "Verify your connection details in config.php (rpc user, rpc password, host) and ".
+                             "verify your UnrealIRCd configuration (listen block with listen::options::rpc and ".
+                             "an rpc-user block with the correct IP allowed and the correct username and password).");
                throw $e;
        }