commit
46e3242557
@ -0,0 +1,71 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 4.2.8
|
||||
-- http://www.phpmyadmin.net
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generation Time: Sep 04, 2014 at 09:28 PM
|
||||
-- Server version: 5.6.17
|
||||
-- PHP Version: 5.5.12
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
|
||||
--
|
||||
-- Database: `nel_ams_lib`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `ticket_attachments`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `ticket_attachments` (
|
||||
`idticket_attachments` int(10) unsigned NOT NULL,
|
||||
`ticket_TId` int(10) unsigned NOT NULL,
|
||||
`Filename` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`Filesize` int(10) NOT NULL,
|
||||
`Uploader` int(10) unsigned NOT NULL,
|
||||
`Path` VARCHAR(128) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
--
|
||||
-- Indexes for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Indexes for table `ticket_attachments`
|
||||
--
|
||||
ALTER TABLE `ticket_attachments`
|
||||
ADD PRIMARY KEY (`idticket_attachments`), ADD UNIQUE KEY `idticket_attachments_UNIQUE` (`idticket_attachments`), ADD KEY `fk_ticket_attachments_ticket1_idx` (`ticket_TId`), ADD KEY `fk_ticket_attachments_ticket_user1_idx` (`Uploader`);
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `ticket_attachments`
|
||||
--
|
||||
ALTER TABLE `ticket_attachments`
|
||||
MODIFY `idticket_attachments` int(10) unsigned NOT NULL AUTO_INCREMENT;
|
||||
--
|
||||
-- Constraints for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Constraints for table `ticket_attachments`
|
||||
--
|
||||
ALTER TABLE `ticket_attachments`
|
||||
ADD CONSTRAINT `fk_ticket_attachments_ticket1` FOREIGN KEY (`ticket_TId`) REFERENCES `ticket` (`TId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||
ADD CONSTRAINT `fk_ticket_attachments_ticket_user1` FOREIGN KEY (`Uploader`) REFERENCES `ticket_user` (`TUserId`) ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
require( '../../config.php' );
|
||||
require_once( $AMS_LIB . '/libinclude.php' );
|
||||
$id = $_POST['PHPSESSID'];
|
||||
session_id($id);
|
||||
session_start();
|
||||
|
||||
// Set permission
|
||||
if ( isset( $_SESSION['ticket_user'] ) ) {
|
||||
$return['permission'] = unserialize( $_SESSION['ticket_user'] ) -> getPermission();
|
||||
} else {
|
||||
// default permission
|
||||
$return['permission'] = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(WebUsers::isLoggedIn() && isset($_GET['id'])){
|
||||
|
||||
$ticket_id = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT);
|
||||
$target_ticket = new Ticket();
|
||||
$target_ticket->load_With_TId($ticket_id);
|
||||
if(($target_ticket->getAuthor() == unserialize($_SESSION['ticket_user'])->getTUserId()) || Ticket_User::isMod(unserialize($_SESSION['ticket_user'])) ){
|
||||
|
||||
if (!empty($_FILES)) {
|
||||
$tempFile = $_FILES['Filedata']['tmp_name'];
|
||||
|
||||
$fileParts = pathinfo($_FILES['Filedata']['name']);
|
||||
Ticket::add_Attachment($_GET['id'],$_FILES['Filedata']['name'],$_SESSION['id'],$tempFile);
|
||||
echo "Uploaded :".$_FILES['Filedata']['name'];
|
||||
} else {
|
||||
echo "Upload Failed!";
|
||||
}
|
||||
echo "Upload Failed!";
|
||||
}
|
||||
echo "Upload Failed!";
|
||||
}
|
||||
echo "Upload Failed!";
|
||||
?>
|
@ -0,0 +1,13 @@
|
||||
$(document).ready(function () {
|
||||
//other things to do on document ready, separated for ajax calls
|
||||
docReady();
|
||||
});
|
||||
|
||||
|
||||
function docReady() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
header("Cache-Control: max-age=1");
|
||||
header('Location: ams/', true, 301);
|
||||
|
||||
?>
|
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 'on');
|
||||
|
||||
class SystemExit extends Exception {}
|
||||
try {
|
||||
|
||||
$pageTitle = "Authenticate";
|
||||
include('header.php');
|
||||
|
||||
require_once('config.php');
|
||||
|
||||
?>
|
||||
<div style="margin-left: auto; margin-right: auto; max-width: 512px;">
|
||||
|
||||
<?php /*var_dump($_POST);*/ $showForm = true; if ($_POST) { ?>
|
||||
|
||||
<?php if ($_POST['nelSetupPassword'] == $NEL_SETUP_PASSWORD) { ?>
|
||||
|
||||
<?php
|
||||
|
||||
$_SESSION['nelSetupAuthenticated'] = 1;
|
||||
|
||||
printalert("success", "You are now authenticated");
|
||||
$showForm = false;
|
||||
|
||||
?>
|
||||
<p>
|
||||
<a class="btn btn-primary" href="index.php">Continue</a>
|
||||
</p>
|
||||
|
||||
<?php } else {
|
||||
|
||||
printalert("danger", "Invalid password");
|
||||
|
||||
} ?>
|
||||
|
||||
<?php } if ($showForm) { ?>
|
||||
|
||||
<form class="form" role="form" method="POST" action="" enctype="application/x-www-form-urlencoded">
|
||||
<div class="input-group">
|
||||
<label for="nelSetupPassword" class="sr-only">NeL Setup Password</label>
|
||||
<input type="password" class="form-control" id="nelSetupPassword" name="nelSetupPassword" placeholder="Password">
|
||||
<span class="input-group-btn">
|
||||
<input name="submit" type="submit" value="Authenticate" class="btn btn-primary">
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
include('footer.php');
|
||||
|
||||
}
|
||||
catch (SystemExit $e) { /* do nothing */ }
|
||||
|
||||
?>
|
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
function set_db_version($continue_r, $name, $version) {
|
||||
$continue = $continue_r;
|
||||
|
||||
if (file_put_contents("db_version_" . $name, (string)$version)) {
|
||||
} else {
|
||||
printalert("danger", "Failed to set database version");
|
||||
$continue = false;
|
||||
}
|
||||
|
||||
return $continue;
|
||||
}
|
||||
|
||||
function get_db_version($name) {
|
||||
if (!file_exists("db_version_" . $name)) {
|
||||
return 0;
|
||||
}
|
||||
return (int)file_get_contents("db_version_" . $name);
|
||||
}
|
||||
|
||||
function connect_database($continue, $name) {
|
||||
$con = null;
|
||||
|
||||
global $cfg;
|
||||
if ($continue) {
|
||||
$con = mysqli_connect(
|
||||
$cfg['db'][$name]['host'],
|
||||
$cfg['db'][$name]['user'],
|
||||
$cfg['db'][$name]['pass'],
|
||||
$cfg['db'][$name]['name']);
|
||||
if (mysqli_connect_errno()) {
|
||||
printalert("danger", "Failed to connect to the <em>" . $name . "</em> SQL server: " . mysqli_connect_error());
|
||||
$con = null;
|
||||
} else {
|
||||
printalert("success", "Connected to the <em>" . $name . "</em> SQL server");
|
||||
}
|
||||
}
|
||||
|
||||
return $con;
|
||||
}
|
||||
|
||||
function disconnect_database($con, $name) {
|
||||
if ($con) {
|
||||
mysqli_close($con);
|
||||
printalert("info", "Disconnected from the <em>" . $name . "</em> SQL server");
|
||||
}
|
||||
}
|
||||
|
||||
function upgrade_service_databases($continue_r) {
|
||||
$continue = $continue_r;
|
||||
|
||||
$con = null;
|
||||
$con = connect_database($continue, "shard");
|
||||
$continue = ($con != null);
|
||||
if ($continue && get_db_version("shard") < 1) {
|
||||
$continue = update_database_structure($continue, $con, "nel_00001.sql");
|
||||
$continue = set_db_version($continue, "shard", 1);
|
||||
}
|
||||
disconnect_database($con, "shard");
|
||||
|
||||
$con = null;
|
||||
$con = connect_database($continue, "tool");
|
||||
$continue = ($con != null);
|
||||
if ($continue && get_db_version("tool") < 1) {
|
||||
$continue = update_database_structure($continue, $con, "nel_tool_00001.sql");
|
||||
$continue = set_db_version($continue, "tool", 1);
|
||||
}
|
||||
disconnect_database($con, "tool");
|
||||
|
||||
return $continue;
|
||||
}
|
||||
|
||||
function upgrade_support_databases($continue_r) {
|
||||
$continue = $continue_r;
|
||||
|
||||
$con = null;
|
||||
$con = connect_database($continue, "web");
|
||||
$continue = ($con != null);
|
||||
if ($continue && get_db_version("web") < 1) {
|
||||
$continue = update_database_structure($continue, $con, "nel_ams_00001.sql");
|
||||
$continue = set_db_version($continue, "web", 1);
|
||||
}
|
||||
disconnect_database($con, "web");
|
||||
|
||||
$con = null;
|
||||
$con = connect_database($continue, "lib");
|
||||
$continue = ($con != null);
|
||||
if ($continue && get_db_version("lib") < 1) {
|
||||
$continue = update_database_structure($continue, $con, "nel_ams_lib_00001.sql");
|
||||
$continue = set_db_version($continue, "lib", 1);
|
||||
}
|
||||
if ($continue && get_db_version("lib") < 2) {
|
||||
$continue = update_database_structure($continue, $con, "nel_ams_lib_00002.sql");
|
||||
$continue = set_db_version($continue, "lib", 2);
|
||||
}
|
||||
disconnect_database($con, "lib");
|
||||
|
||||
return $continue;
|
||||
}
|
||||
|
||||
function upgrade_domain_databases($continue_r) {
|
||||
$continue = $continue_r;
|
||||
|
||||
$con = null;
|
||||
$con = connect_database($continue, "ring");
|
||||
$continue = ($con != null);
|
||||
if ($continue && get_db_version("ring") < 1) {
|
||||
$continue = update_database_structure($continue, $con, "ring_domain_00001.sql");
|
||||
$continue = set_db_version($continue, "ring", 1);
|
||||
}
|
||||
disconnect_database($con, "ring");
|
||||
|
||||
return $continue;
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,12 @@
|
||||
|
||||
<!-- --------------------------------------------------------------- -->
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="pull-right" style="margin-bottom: 32px;"><a href="http://www.gnu.org/licenses/agpl-3.0.txt"><img src="img/agplv3-88x31.png" alt="AGPLv3"></a></div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
if (file_exists( '../config.php')) {
|
||||
session_start();
|
||||
if ((!isset($_SESSION['nelSetupAuthenticated'])) || $_SESSION['nelSetupAuthenticated'] != 1) {
|
||||
if (basename($_SERVER["SCRIPT_NAME"]) != "auth.php") {
|
||||
header("Cache-Control: max-age=1");
|
||||
header('Location: auth.php', true, 303);
|
||||
throw new SystemExit();
|
||||
}
|
||||
}
|
||||
} else if (basename($_SERVER["SCRIPT_NAME"]) != "install.php") {
|
||||
header("Cache-Control: max-age=1");
|
||||
header('Location: install.php', true, 303);
|
||||
throw new SystemExit();
|
||||
}
|
||||
|
||||
?><!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Ryzom Core | <?php print(htmlentities($pageTitle)); ?></title>
|
||||
<link href="css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<?php
|
||||
function printalert($type, $message) {
|
||||
print '<div class="alert alert-' . $type . '" role="alert">';
|
||||
print $message;
|
||||
print '</div>';
|
||||
}
|
||||
function is__writable($path) {
|
||||
if ($path{strlen($path) - 1} == '/') {
|
||||
return is__writable($path.uniqid(mt_rand()).'.tmp');
|
||||
}
|
||||
|
||||
if (file_exists($path)) {
|
||||
if (!($f = @fopen($path, 'r+'))) {
|
||||
return false;
|
||||
}
|
||||
fclose($f);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!($f = @fopen($path, 'w'))) {
|
||||
return false;
|
||||
}
|
||||
fclose($f);
|
||||
unlink($path);
|
||||
return true;
|
||||
}
|
||||
function validate_writable($continue, $path) {
|
||||
if (!is__writable($path)) {
|
||||
printalert("danger", "Failed to get write permissions on " . htmlentities($path));
|
||||
return false;
|
||||
}
|
||||
return $continue;
|
||||
}
|
||||
function create_use_database($continue_r, $con, $database) {
|
||||
$continue = $continue_r;
|
||||
if ($continue) {
|
||||
$sql = "CREATE DATABASE `" . mysqli_real_escape_string($con, $database) . "` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;";
|
||||
if (mysqli_query($con, $sql)) {
|
||||
printalert("success", "Database <em>" . $database . "</em> created");
|
||||
} else {
|
||||
printalert("danger", "Error creating <em>" . $database . "</em> database: " . mysqli_error($con));
|
||||
$continue = false;
|
||||
}
|
||||
}
|
||||
if ($continue) {
|
||||
$sql = "USE `" . mysqli_real_escape_string($con, $database) . "`;";
|
||||
if (mysqli_query($con, $sql)) {
|
||||
printalert("success", "Database <em>" . $database . "</em> selected");
|
||||
} else {
|
||||
printalert("danger", "Error selecting <em>" . $database . "</em> database: " . mysqli_error($con));
|
||||
$continue = false;
|
||||
}
|
||||
}
|
||||
return $continue;
|
||||
}
|
||||
function update_database_structure($continue_r, $con, $file) {
|
||||
$continue = $continue_r;
|
||||
if ($continue) {
|
||||
$sql = file_get_contents($_POST["privatePhpDirectory"] . "/setup/sql/" . $file);
|
||||
if (!$sql) {
|
||||
printalert("danger", "Cannot read <em>" . $file . "</em>");
|
||||
$continue = false;
|
||||
} else {
|
||||
if (mysqli_multi_query($con, $sql)) {
|
||||
printalert("success", "Database structure updated using <em>" . $file . "</em>");
|
||||
while (mysqli_more_results($con) && mysqli_next_result($con)) {
|
||||
// no-op
|
||||
}
|
||||
} else {
|
||||
printalert("danger", "Error updating database using <em>" . $file . "</em>: " . mysqli_error($con));
|
||||
$continue = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $continue;
|
||||
}
|
||||
?>
|
||||
|
||||
<body>
|
||||
<div style="margin-left: auto; margin-right: auto; padding-left: 24px; padding-right: 24px; padding-bottom: 24px; max-width: 1024px;">
|
||||
|
||||
<div class="page-header">
|
||||
<h1>Ryzom Core <small><?php print(htmlentities($pageTitle)); ?></small></h1>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
// Change to root directory
|
||||
if (!chdir("../")) {
|
||||
printalert("danger", "Cannot change to public PHP root directory");
|
||||
$continue = false;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!-- --------------------------------------------------------------- -->
|
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
@ -0,0 +1,476 @@
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 'on');
|
||||
|
||||
class SystemExit extends Exception {}
|
||||
try {
|
||||
|
||||
$pageTitle = "Install";
|
||||
include('header.php');
|
||||
|
||||
?>
|
||||
|
||||
<?php if (file_exists('config.php')) { ?>
|
||||
|
||||
<div class="alert alert-danger" role="alert">
|
||||
Already installed.
|
||||
</div>
|
||||
|
||||
<?php } else if ($_POST) { ?>
|
||||
|
||||
<div class="alert alert-info" role="alert">
|
||||
<?php var_dump($_POST); ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$continue = true;
|
||||
|
||||
$roleService = isset($_POST["roleService"]) && $_POST["roleService"] == "on";
|
||||
$roleSupport = isset($_POST["roleSupport"]) && $_POST["roleSupport"] == "on";
|
||||
$roleDomain = isset($_POST["roleDomain"]) && $_POST["roleDomain"] == "on";
|
||||
|
||||
if (!$roleService && !$roleSupport && !$roleDomain) {
|
||||
printalert("danger", "No server roles selected");
|
||||
$continue = false;
|
||||
}
|
||||
|
||||
// Validate basics
|
||||
if ($continue) {
|
||||
if (file_exists($_POST["privatePhpDirectory"])) {
|
||||
printalert("success", "Private PHP Directory found");
|
||||
} else {
|
||||
printalert("danger", "Private PHP Directory not found (NOTE: This directory is relative to the root of the public PHP directory)");
|
||||
$continue = false;
|
||||
}
|
||||
}
|
||||
if ($continue) {
|
||||
if ($roleService) {
|
||||
$continue = validate_writable($continue, "login/logs/");
|
||||
$continue = validate_writable($continue, "admin/graphs_output/");
|
||||
$continue = validate_writable($continue, "admin/templates/default_c/");
|
||||
}
|
||||
if ($roleSupport) {
|
||||
$continue = validate_writable($continue, "ams/cache/");
|
||||
$continue = validate_writable($continue, "ams/templates_c/");
|
||||
}
|
||||
$continue = validate_writable($continue, "./");
|
||||
if ($continue) {
|
||||
printalert("success", "Paths are writable");
|
||||
}
|
||||
}
|
||||
|
||||
$con = null;
|
||||
if ($continue) { // NOTE: Also test if this is reachable when not Service role
|
||||
$con = mysqli_connect($_POST["nelSqlHostname"], $_POST["nelSqlUsername"], $_POST["nelSqlPassword"]);
|
||||
if (mysqli_connect_errno()) {
|
||||
printalert("danger", "Failed to connect to Service SQL: " . mysqli_connect_error());
|
||||
$continue = false;
|
||||
$con = null;
|
||||
} else {
|
||||
printalert("success", "Connected to the Service SQL server");
|
||||
}
|
||||
}
|
||||
|
||||
if ($roleService) {
|
||||
// Create NeL database
|
||||
$continue = create_use_database($continue, $con, $_POST["nelDatabase"]);
|
||||
|
||||
// Create NeL Tools database
|
||||
$continue = create_use_database($continue, $con, $_POST["toolDatabase"]);
|
||||
}
|
||||
|
||||
if ($roleDomain) {
|
||||
// Create Ring database
|
||||
$continue = create_use_database($continue, $con, $_POST["domainDatabase"]);
|
||||
}
|
||||
|
||||
if ($con) {
|
||||
mysqli_close($con);
|
||||
printalert("info", "Disconnected from the Service SQL server");
|
||||
}
|
||||
|
||||
if ($roleSupport) {
|
||||
if ($continue) {
|
||||
$con = mysqli_connect($_POST["amsSqlHostname"], $_POST["amsSqlUsername"], $_POST["amsSqlPassword"]);
|
||||
if (mysqli_connect_errno()) {
|
||||
printalert("danger", "Failed to connect to Support SQL: " . mysqli_connect_error());
|
||||
$continue = false;
|
||||
$con = null;
|
||||
} else {
|
||||
printalert("success", "Connected to the Support SQL server");
|
||||
}
|
||||
}
|
||||
|
||||
// Create AMS database
|
||||
$continue = create_use_database($continue, $con, $_POST["amsDatabase"]);
|
||||
|
||||
// Create AMS Library database
|
||||
$continue = create_use_database($continue, $con, $_POST["amsLibDatabase"]);
|
||||
|
||||
if ($con) {
|
||||
mysqli_close($con);
|
||||
printalert("info", "Disconnected from the Support SQL server");
|
||||
}
|
||||
}
|
||||
|
||||
// Write config.php
|
||||
if ($continue) {
|
||||
$config = file_get_contents($_POST["privatePhpDirectory"] . "/setup/config/config.php");
|
||||
if (!$config) {
|
||||
printalert("danger", "Cannot read <em>config.php</em>");
|
||||
$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 <em>config.php</em>");
|
||||
} else {
|
||||
printalert("danger", "Cannot write to <em>config.php</em>");
|
||||
$continue = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load config
|
||||
if ($continue) {
|
||||
try {
|
||||
require_once('config.php');
|
||||
} catch (Exception $e) {
|
||||
printalert("danger", "Failed to include <em>config.php</em>");
|
||||
$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 <em>libinclude.php</em>");
|
||||
$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 <em>" . htmlentities($_POST["amsAdminUsername"]) . "</em> 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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<p>
|
||||
<a class="btn btn-primary" href="index.php">Continue</a>
|
||||
</p>
|
||||
|
||||
<?php } /* ENDOF: if (isset($_POST)) { */ else { /* TODO: Refill form on failure */ ?>
|
||||
|
||||
<script>
|
||||
|
||||
var visiblePanelClass = "panel panel-default";
|
||||
var hiddenPanelClass = "panel panel-default hide";
|
||||
|
||||
function checkService() {
|
||||
var panelClass = document.getElementById('roleService').checked
|
||||
? visiblePanelClass
|
||||
: hiddenPanelClass;
|
||||
document.getElementById("panelAdmin").className = panelClass;
|
||||
}
|
||||
|
||||
function checkSupport() {
|
||||
var panelClass = document.getElementById('roleSupport').checked
|
||||
? visiblePanelClass
|
||||
: hiddenPanelClass;
|
||||
document.getElementById("panelAMS").className = panelClass;
|
||||
}
|
||||
|
||||
function checkDomain() {
|
||||
var panelClass = document.getElementById('roleDomain').checked
|
||||
? visiblePanelClass
|
||||
: hiddenPanelClass;
|
||||
document.getElementById("panelDomain").className = panelClass;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<form class="form-horizontal" role="form" method="POST" action="" enctype="application/x-www-form-urlencoded">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Roles</h2>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-3 col-sm-8">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input id="roleService" name="roleService" type="checkbox" onclick="checkService();" checked> Service <small>(NeL Login, Shard Admin, Domain Database, ...)</small>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-3 col-sm-8">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input id="roleSupport" name="roleSupport" type="checkbox" onclick="checkSupport();" checked> Support <small>(AMS, ...)</small>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-3 col-sm-8">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input id="roleDomain" name="roleDomain" type="checkbox" onclick="checkDomain();" disabled> Domain <small>(Ring Database, ...) <em>TODO</em></small>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Basics <small>(Paths relative to the public root directory)</small></h2>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label for="privatePhpDirectory" class="col-sm-3 control-label">Private PHP Directory</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" id="privatePhpDirectory" name="privatePhpDirectory" value="../private_php/">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nelSetupPassword" class="col-sm-3 control-label">Setup Password</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="password" class="form-control" id="nelSetupPassword" name="nelSetupPassword" value="admin">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Service Database <small>(Used for NeL login, admin tools and domain databases)</small></h2>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label for="nelSqlHostname" class="col-sm-3 control-label">SQL Hostname</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" id="nelSqlHostname" name="nelSqlHostname" value="localhost">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nelSqlUsername" class="col-sm-3 control-label">SQL Username</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" id="nelSqlUsername" name="nelSqlUsername" value="root">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nelSqlPassword" class="col-sm-3 control-label">SQL Password</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="password" class="form-control" id="nelSqlPassword" name="nelSqlPassword" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nelDatabase" class="col-sm-3 control-label">NeL Database</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" id="nelDatabase" name="nelDatabase" value="nel">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="panelAdmin" class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Shard Admin</h2>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label for="toolDatabase" class="col-sm-3 control-label">NeL Tools Database</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" id="toolDatabase" name="toolDatabase" value="nel_tool">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="toolsAdminUsername" class="col-sm-3 control-label">Admin Username</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" id="toolsAdminUsername" name="toolsAdminUsername" value="admin">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="toolsAdminPassword" class="col-sm-3 control-label">Admin Password</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="password" class="form-control" id="toolsAdminPassword" name="toolsAdminPassword" value="admin">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="panelAMS" class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">AMS <small>(Account Management System)</small></h2>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label for="amsSqlHostname" class="col-sm-3 control-label">SQL Hostname</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" id="amsSqlHostname" name="amsSqlHostname" value="localhost">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="amsSqlUsername" class="col-sm-3 control-label">SQL Username</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" id="amsSqlUsername" name="amsSqlUsername" value="root">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="amsSqlPassword" class="col-sm-3 control-label">SQL Password</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="password" class="form-control" id="amsSqlPassword" name="amsSqlPassword" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="amsDatabase" class="col-sm-3 control-label">CMS Database</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" id="amsDatabase" name="amsDatabase" value="nel_ams">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="amsLibDatabase" class="col-sm-3 control-label">Library Database</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" id="amsLibDatabase" name="amsLibDatabase" value="nel_ams_lib">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="amsAdminUsername" class="col-sm-3 control-label">Admin Username</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" id="amsAdminUsername" name="amsAdminUsername" value="admin">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="amsAdminPassword" class="col-sm-3 control-label">Admin Password</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="password" class="form-control" id="amsAdminPassword" name="amsAdminPassword" value="admin">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="panelDomain" class="panel panel-default hide">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">Domain <small>(Multiple domains require separate installations, as they may run different versions)</small></h2>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label for="nelDomainName" class="col-sm-3 control-label">Name</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" id="nelDomainName" name="nelDomainName" value="mini01">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="domainDatabase" class="col-sm-3 control-label">Database</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" id="domainDatabase" name="domainDatabase" value="ring_mini01">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input name="submit" type="submit" value="Configure" class="btn btn-primary">
|
||||
</form>
|
||||
|
||||
<script>
|
||||
|
||||
checkService();
|
||||
checkSupport();
|
||||
checkDomain();
|
||||
|
||||
</script>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
|
||||
include('footer.php');
|
||||
|
||||
}
|
||||
catch (SystemExit $e) { /* do nothing */ }
|
||||
|
||||
?>
|
Loading…
Reference in New Issue