X-Git-Url: https://jfr.im/git/irc/unrealircd/unrealircd-webpanel.git/blobdiff_plain/036c24c57620dbf822e7ecae8344cb0aed174fd9..47aad98291fb8ad90cb308ba21fe73c7c7ccd843:/settings/install.php
diff --git a/settings/install.php b/settings/install.php
index 0efcb71..ec05d09 100644
--- a/settings/install.php
+++ b/settings/install.php
@@ -1,6 +1,22 @@
$opts->sql_host,
+ "database" => $opts->sql_db,
+ "username" => $opts->sql_user,
+ "password" => $opts->sql_password,
+ "table_prefix" => $opts->sql_table_prefix,
+ ];
}
- 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"]["port"] = 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;
- }
- ?>
-
- 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_meta('role', 'Super-Admin');
+
+ /* Enable lookups on HIBP by default */
+ $config['hibp'] = true;
+
+ /* 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!
+
@@ -170,88 +181,37 @@ $writable = (is_writable("../config/")) ? true: false;
font-style: italic;
}
+
config
directory called config.php
- sudo chown -R