]>
jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blob - inc/connection.php
f66d7507b7d65d3bf7f1ffaefe2560d610cc73b9
6 function connect_to_ircd()
11 $server = get_active_rpc_server();
14 Message
::Fail("No RPC server configured. Go to Settings - RPC Servers.");
17 $host = $config["unrealircd"][$server]["host"];
18 $port = $config["unrealircd"][$server]["port"];
19 $rpc_user = $config["unrealircd"][$server]["rpc_user"];
20 $rpc_password = $config["unrealircd"][$server]["rpc_password"];
21 if (str_starts_with($rpc_password, "secret:"))
22 $rpc_password = secret_decrypt($rpc_password);
23 $tls_verify = $config["unrealircd"][$server]["tls_verify_cert"];
25 if (!$host || !$port || !$rpc_user)
26 die("RPC Server is missing credentials");
28 if ($rpc_password === null)
30 Message
::Fail("Your RPC password in the DB was encrypted with a different key than config/config.php contains.<br>\n".
31 "Either restore your previous config/config.php or start with a fresh database.<br>\n");
37 $rpc = new UnrealIRCd\Connection
40 "$rpc_user:$rpc_password",
41 ["tls_verify" => $tls_verify]
46 Message
::Fail("Unable to connect to UnrealIRCd: ".$e->getMessage() . "<br>".
47 "Verify your connection details in config.php (rpc user, rpc password, host) and ".
48 "verify your UnrealIRCd configuration (listen block with listen::options::rpc and ".
49 "an rpc-user block with the correct IP allowed and the correct username and password).");
53 $user = unreal_get_current_user();
56 /* Set issuer for all the RPC commands */
57 $rpc->rpc()->set_issuer($user->username
);