]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blobdiff - api/installation.php
Setup major reshuffle: split up in pre-auth: backend & user creation, and
[irc/unrealircd/unrealircd-webpanel.git] / api / installation.php
index 5d7dcf0315552ed7ecef76d25e4ac3bfc1767a2d..e8e8321cda485ae4ff176cf3f3fa9d3453998bf4 100644 (file)
@@ -1,50 +1,28 @@
 <?php
 
+/** For handling installation BEFORE any backend and user is configured */
+
 require_once "../common.php";
 
 /* only let this happen pre-config */
 if (file_exists("../config/config.php"))
-    die(json_encode(["error" => "Configuration file exists."]));
-$method;
+               die(json_encode(["error" => "Configuration file exists."]));
 
 if (!isset($_GET) || empty($_GET))
-    die(json_encode(["error" => "Incorrect parameters"]));
+               die(json_encode(["error" => "Incorrect parameters"]));
 foreach($_GET as $key => $str)
-    ${$key} = $str;
+               ${$key} = $str;
 
-if ($method == "rpc")
-{
-    if (isset($tls_verify))
-    {
-        if ($tls_verify == "false")
-            $tls_verify = false;
-        elseif ($tls_verify == "true")
-            $tls_verify = true;
-    }
-    try {
-        $rpc = new UnrealIRCd\Connection
-        (
-            "wss://$host:$port",
-            "$user:$password",
-            ["tls_verify" => $tls_verify]
-        );
-    }
-    catch (Exception $e)
-    {
-        die(json_encode(["error" => "Unable to connect to UnrealIRCd: ".$e->getMessage()]));
-    }
-    die(json_encode(["success" => "Successfully connected"]));
-}
-elseif ($method == "sql")
+if ($method == "sql")
 {
-    $conn = mysqli_connect($host, $user, $password, $database);
+               $conn = mysqli_connect($host, $user, $password, $database);
 
-    // check connection
-    if (mysqli_connect_errno())
-        die(json_encode(["error" => "Failed to connect to MySQL: " . mysqli_connect_error()]));
+               // check connection
+               if (mysqli_connect_errno())
+                               die(json_encode(["error" => "Failed to connect to MySQL: " . mysqli_connect_error()]));
 
-    // close connection
-    mysqli_close($conn);
-    die(json_encode(["success" => "SQL Connection successful"]));
+               // close connection
+               mysqli_close($conn);
+               die(json_encode(["success" => "SQL Connection successful"]));
 
-}
\ No newline at end of file
+}