X-Git-Url: https://jfr.im/git/irc/unrealircd/unrealircd-webpanel.git/blobdiff_plain/3b2bc9f117fc6d804f56a2c099f37279651add08..7cc3b4a0dee9eb5b44d33d9d0a4fa5e8b93eb1ef:/settings/install.php
diff --git a/settings/install.php b/settings/install.php
index d366977..c98e2f5 100644
--- a/settings/install.php
+++ b/settings/install.php
@@ -100,69 +100,51 @@ $writable = (is_writable("../config/")) ? true: false;
return;
}
- /* Assume we have a example config available and copy from that so we leave all the comments n things in there
- * If we're setting up it's unlikely anyone would have swooped in already and deleted the example config.
- * Throw an error if not
- */
- if (!file_exists("../config/config.php.sample"))
+ $config["base_url"] = BASE_URL;
+ $config["plugins"] = Array("$auth_method");
+ if ($auth_method == "sql_auth")
{
- Message::Fail("Could not get sample configuration. We need it to work with.");
- return;
+ $config["mysql"] = [
+ "host" => $opts->sql_host,
+ "database" => $opts->sql_db,
+ "username" => $opts->sql_user,
+ "password" => $opts->sql_password,
+ ];
}
- else {
- $conf = file_get_contents("../config/config.php.sample");
- $conf = str_replace('$config["base_url"] = \'/unrealircd-webpanel/\'', '$config["base_url"] = \''.BASE_URL.'\'', $conf);
- $conf = str_replace('$config["unrealircd"]["rpc_user"] = \'adminpanel\'', '$config["unrealircd"]["rpc_user"] = \''.$opts->rpc_user.'\'', $conf);
- $conf = str_replace('$config["unrealircd"]["rpc_password"] = \'securepassword\'', '$config["unrealircd"]["rpc_password"] = \''.$opts->rpc_password.'\'', $conf);
- $conf = str_replace('$config["unrealircd"]["host"] = \'127.0.0.1\'', '$config["unrealircd"]["host"] = \''.$opts->rpc_iphost.'\'', $conf);
- $conf = str_replace('$config["unrealircd"]["port"] = \'8600\'', '$config["unrealircd"]["port"] = \''.$opts->rpc_port.'\'', $conf);
- if (isset($opts->rpc_ssl))
- $conf = str_replace('$config["unrealircd"]["tls_verify_cert"] = false', '$config["unrealircd"]["tls_verify_cert"] = true', $conf);
-
- $conf = str_replace("//\"$auth_method\"", "\"$auth_method\"", $conf); // enable our auth method
-
- if ($auth_method == "sql_auth")
- {
- $conf = str_replace('//$config["mysql"]["host"] = "127.0.0.1"', '$config["mysql"]["host"] = "'.$opts->sql_host.'"', $conf);
- $conf = str_replace('//$config["mysql"]["database"] = "unrealircdwebpanel"', '$config["mysql"]["database"] = "'.$opts->sql_db.'"', $conf);
- $conf = str_replace('//$config["mysql"]["username"] = "unrealircdwebpanel"', '$config["mysql"]["username"] = "'.$opts->sql_user.'"', $conf);
- $conf = str_replace('//$config["mysql"]["password"] = "replace_this_with_your_sql_password"', '$config["mysql"]["password"] = "'.$opts->sql_password.'"', $conf);
- }
- $file = fopen("../config/config.php", 'x+'); // only create it if it doesn't already exist even though we checked earlier
- if ($file)
- {
- fwrite($file, $conf);
- }
- require_once("../config/config.php");
-
- if ($auth_method == "sql_auth")
- if (!sql_auth::create_tables())
- Message::Fail("Could not create SQL tables");
-
- $user = [
- "user_name" => $opts->account_user,
- "user_pass" => $opts->account_password,
- "fname" => $opts->account_fname,
- "lname" => $opts->account_lname,
- "user_bio" => $opts->account_bio,
- "email" => $opts->account_email
- ];
-
- create_new_user($user);
- $lkup = new PanelUser($opts->account_user);
- if (!$lkup->id)
- {
- Message::Fail("Could not create user");
- return;
- }
- $lkup->add_permission(PERMISSION_MANAGE_USERS);
- ?>
-
- Great! Everything has been completely set up for you, and you can now log in.
- Let's go!
- $opts->account_user,
+ "user_pass" => $opts->account_password,
+ "fname" => $opts->account_fname,
+ "lname" => $opts->account_lname,
+ "user_bio" => $opts->account_bio,
+ "email" => $opts->account_email
+ ];
+
+ create_new_user($user);
+ $lkup = new PanelUser($opts->account_user);
+ if (!$lkup->id)
+ {
+ Message::Fail("Could not create user");
return;
}
+ $lkup->add_permission(PERMISSION_MANAGE_USERS);
+
+ /* Now, write all the config (config.php + settings in DB) */
+ write_config();
+ ?>
+
+ The configuration file has been written. Now, log in to the panel to proceed with the rest of the installation.
+ Let's go!
+
@@ -171,75 +153,24 @@ $writable = (is_writable("../config/")) ? true: false;
font-style: italic;
}
+
config
directory called config.php
- sudo chown -R