config.php"); $continue = false; } else { $cwd = getcwd(); $config = str_replace("%privatePhpDirectory%", addslashes(realpath($cwd . "/" . $_POST["privatePhpDirectory"])), $config); $config = str_replace("%publicPhpDirectory%", addslashes(realpath($cwd)), $config); $config = str_replace("%nelSqlHostname%", addslashes($_POST["nelSqlHostname"]), $config); $config = str_replace("%nelSqlUsername%", addslashes($_POST["nelSqlUsername"]), $config); $config = str_replace("%nelSqlPassword%", addslashes($_POST["nelSqlPassword"]), $config); $config = str_replace("%nelDatabase%", addslashes($_POST["nelDatabase"]), $config); $config = str_replace("%toolDatabase%", addslashes($_POST["toolDatabase"]), $config); $config = str_replace("%amsSqlHostname%", addslashes($_POST["amsSqlHostname"]), $config); $config = str_replace("%amsSqlUsername%", addslashes($_POST["amsSqlUsername"]), $config); $config = str_replace("%amsSqlPassword%", addslashes($_POST["amsSqlPassword"]), $config); $config = str_replace("%amsDatabase%", addslashes($_POST["amsDatabase"]), $config); $config = str_replace("%amsLibDatabase%", addslashes($_POST["amsLibDatabase"]), $config); $config = str_replace("%amsAdminUsername%", addslashes($_POST["amsAdminUsername"]), $config); $config = str_replace("%amsAdminPassword%", addslashes($_POST["amsAdminPassword"]), $config); $config = str_replace("%nelSetupPassword%", addslashes($_POST["nelSetupPassword"]), $config); $config = str_replace("%domainDatabase%", addslashes($_POST["domainDatabase"]), $config); $config = str_replace("%nelDomainName%", addslashes($_POST["nelDomainName"]), $config); if (file_put_contents("config.php", $config)) { printalert("success", "Generated config.php"); } else { printalert("danger", "Cannot write to config.php"); $continue = false; } } } // Load config if ($continue) { try { require_once('config.php'); } catch (Exception $e) { printalert("danger", "Failed to include config.php"); $continue = false; } } require_once('database.php'); if ($roleSupport) { $continue = upgrade_support_databases($continue); } if ($roleService) { $continue = upgrade_service_databases($continue); } if ($roleDomain) { $continue = upgrade_domain_databases($continue); } if ($roleService) { // TODO: Create the default admin user } if ($roleSupport) { // Load AMS Library if ($continue) { try { require_once($AMS_LIB . '/libinclude.php'); } catch (Exception $e) { printalert("danger", "Failed to include AMS libinclude.php"); $continue = false; } } // Create AMS Admin user if ($continue) { $hashpass = crypt($_POST["amsAdminPassword"], Users::generateSALT()); $params = array( 'Login' => $_POST["amsAdminUsername"], 'Password' => $hashpass, 'Email' => "localhost@localhost", // TODO ); try { $user_id = WebUsers::createWebuser($params['Login'], $params['Password'],$params['Email']); $result = Webusers::createUser($params, $user_id); Users::createPermissions(array($params['Login'])); $dbl = new DBLayer("lib"); $dbl->execute("UPDATE ticket_user SET Permission = 3 WHERE TUserId = :user_id",array('user_id' => $user_id)); printalert("success", "AMS Admin account " . htmlentities($_POST["amsAdminUsername"]) . " created"); } catch (PDOException $e) { printalert("danger", "Failed to create AMS Admin account"); $continue = false; } } } if ($roleDomain) { // TODO: Register the domain with the nel database etc } if ($continue && $roleService) { if (file_put_contents("role_service", "1")) { printalert("success", "Service role successfully installed"); } else { printalert("danger", "Failed to flag installation success"); $continue = false; } } if ($continue && $roleSupport) { if (file_put_contents("role_support", "1")) { printalert("success", "Support role successfully installed"); } else { printalert("danger", "Failed to flag installation success"); $continue = false; } } if ($continue && $roleDomain) { if (file_put_contents("role_domain", "1")) { printalert("success", "Domain role successfully installed"); } else { printalert("danger", "Failed to flag installation success"); $continue = false; } } ?>

Continue

Roles

Basics (Paths relative to the public root directory)

Service Database (Used for NeL login, admin tools and domain databases)

Shard Admin

AMS (Account Management System)

Domain (Multiple domains require separate installations, as they may run different versions)