]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blob - api/installation2.php
Setup major reshuffle: split up in pre-auth: backend & user creation, and
[irc/unrealircd/unrealircd-webpanel.git] / api / installation2.php
1 <?php
2
3 require_once "../common.php";
4
5 /* only let this happen */
6 if (isset($config['unrealircd']) && empty($config['unrealircd']['host']))
7 die(json_encode(["error" => "Already configured."]));
8
9 if (!isset($_GET) || empty($_GET))
10 die(json_encode(["error" => "Incorrect parameters"]));
11
12 foreach($_GET as $key => $str)
13 ${$key} = $str;
14
15 if ($method == "rpc")
16 {
17 if (isset($tls_verify))
18 {
19 if ($tls_verify == "false")
20 $tls_verify = false;
21 elseif ($tls_verify == "true")
22 $tls_verify = true;
23 }
24 try {
25 $rpc = new UnrealIRCd\Connection
26 (
27 "wss://$host:$port",
28 "$user:$password",
29 ["tls_verify" => $tls_verify]
30 );
31 }
32 catch (Exception $e)
33 {
34 die(json_encode(["error" => "Unable to connect to UnrealIRCd: ".$e->getMessage()]));
35 }
36 die(json_encode(["success" => "Successfully connected"]));
37 }