Merged default.
--HG-- branch : dfighter-tools
This commit is contained in:
commit
46e3242557
39 changed files with 3156 additions and 428 deletions
|
@ -250,3 +250,10 @@ code/nel/tools/build_gamedata/processes/rbank/build_rbank.cfg
|
||||||
code/nel/tools/build_gamedata/processes/zone/debug_zone_dependencies.cfg
|
code/nel/tools/build_gamedata/processes/zone/debug_zone_dependencies.cfg
|
||||||
code/web/public_php/config.php
|
code/web/public_php/config.php
|
||||||
code/web/public_php/is_installed
|
code/web/public_php/is_installed
|
||||||
|
code/web/public_php/ams/files
|
||||||
|
code/web/public_php/db_version_lib
|
||||||
|
code/web/public_php/db_version_shard
|
||||||
|
code/web/public_php/db_version_tool
|
||||||
|
code/web/public_php/db_version_web
|
||||||
|
code/web/public_php/role_service
|
||||||
|
code/web/public_php/role_support
|
||||||
|
|
|
@ -147,7 +147,6 @@ namespace NLMISC
|
||||||
bool DebugNeedAssert;
|
bool DebugNeedAssert;
|
||||||
bool NoAssert;
|
bool NoAssert;
|
||||||
bool AlreadyCreateSharedAmongThreads;
|
bool AlreadyCreateSharedAmongThreads;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** This class implements the context interface for the a library module.
|
/** This class implements the context interface for the a library module.
|
||||||
|
@ -184,6 +183,7 @@ namespace NLMISC
|
||||||
virtual void setNoAssert(bool noAssert);
|
virtual void setNoAssert(bool noAssert);
|
||||||
virtual bool getAlreadyCreateSharedAmongThreads();
|
virtual bool getAlreadyCreateSharedAmongThreads();
|
||||||
virtual void setAlreadyCreateSharedAmongThreads(bool b);
|
virtual void setAlreadyCreateSharedAmongThreads(bool b);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Pointer to the application context.
|
/// Pointer to the application context.
|
||||||
INelContext *_ApplicationContext;
|
INelContext *_ApplicationContext;
|
||||||
|
|
|
@ -543,14 +543,17 @@ ColorPickerPopup::ColorPickerPopup(int width, bool withColorDialog,
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
cols = width;
|
cols = width;
|
||||||
|
|
||||||
if (withColorDialog) {
|
if (withColorDialog)
|
||||||
moreButton = new ColorPickerButton(this);
|
{
|
||||||
moreButton->setFixedWidth(24);
|
moreButton = new ColorPickerButton(this);
|
||||||
moreButton->setFixedHeight(21);
|
moreButton->setFixedWidth(24);
|
||||||
moreButton->setFrameRect(QRect(2, 2, 20, 17));
|
moreButton->setFixedHeight(21);
|
||||||
connect(moreButton, SIGNAL(clicked()), SLOT(getColorFromDialog()));
|
moreButton->setFrameRect(QRect(2, 2, 20, 17));
|
||||||
} else {
|
connect(moreButton, SIGNAL(clicked()), SLOT(getColorFromDialog()));
|
||||||
moreButton = 0;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
moreButton = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
eventLoop = 0;
|
eventLoop = 0;
|
||||||
|
@ -1059,15 +1062,20 @@ void ColorPickerButton::mouseReleaseEvent(QMouseEvent *)
|
||||||
void ColorPickerButton::keyPressEvent(QKeyEvent *e)
|
void ColorPickerButton::keyPressEvent(QKeyEvent *e)
|
||||||
{
|
{
|
||||||
if (e->key() == Qt::Key_Up
|
if (e->key() == Qt::Key_Up
|
||||||
|| e->key() == Qt::Key_Down
|
|| e->key() == Qt::Key_Down
|
||||||
|| e->key() == Qt::Key_Left
|
|| e->key() == Qt::Key_Left
|
||||||
|| e->key() == Qt::Key_Right) {
|
|| e->key() == Qt::Key_Right)
|
||||||
qApp->sendEvent(parent(), e);
|
{
|
||||||
} else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Space || e->key() == Qt::Key_Return) {
|
qApp->sendEvent(parent(), e);
|
||||||
setFrameShadow(Sunken);
|
}
|
||||||
update();
|
else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Space || e->key() == Qt::Key_Return)
|
||||||
} else {
|
{
|
||||||
QFrame::keyPressEvent(e);
|
setFrameShadow(Sunken);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QFrame::keyPressEvent(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1077,16 +1085,21 @@ void ColorPickerButton::keyPressEvent(QKeyEvent *e)
|
||||||
void ColorPickerButton::keyReleaseEvent(QKeyEvent *e)
|
void ColorPickerButton::keyReleaseEvent(QKeyEvent *e)
|
||||||
{
|
{
|
||||||
if (e->key() == Qt::Key_Up
|
if (e->key() == Qt::Key_Up
|
||||||
|| e->key() == Qt::Key_Down
|
|| e->key() == Qt::Key_Down
|
||||||
|| e->key() == Qt::Key_Left
|
|| e->key() == Qt::Key_Left
|
||||||
|| e->key() == Qt::Key_Right) {
|
|| e->key() == Qt::Key_Right)
|
||||||
qApp->sendEvent(parent(), e);
|
{
|
||||||
} else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Space || e->key() == Qt::Key_Return) {
|
qApp->sendEvent(parent(), e);
|
||||||
setFrameShadow(Raised);
|
}
|
||||||
repaint();
|
else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Space || e->key() == Qt::Key_Return)
|
||||||
emit clicked();
|
{
|
||||||
} else {
|
setFrameShadow(Raised);
|
||||||
QFrame::keyReleaseEvent(e);
|
repaint();
|
||||||
|
emit clicked();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QFrame::keyReleaseEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1511,8 +1511,6 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// _D3D->CreateDevice (adapter, _Rasterizer, _HWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, ¶meters, &_DeviceInterface);
|
// _D3D->CreateDevice (adapter, _Rasterizer, _HWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, ¶meters, &_DeviceInterface);
|
||||||
|
|
||||||
// Check some caps
|
// Check some caps
|
||||||
|
@ -2661,7 +2659,8 @@ bool CDriverD3D::reset (const GfxMode& mode)
|
||||||
#ifndef NL_NO_ASM
|
#ifndef NL_NO_ASM
|
||||||
CFpuRestorer fpuRestorer; // fpu control word is changed by "Reset"
|
CFpuRestorer fpuRestorer; // fpu control word is changed by "Reset"
|
||||||
#endif
|
#endif
|
||||||
if (_Rasterizer!=D3DDEVTYPE_REF) {
|
if (_Rasterizer!=D3DDEVTYPE_REF)
|
||||||
|
{
|
||||||
HRESULT hr = _DeviceInterface->Reset (¶meters);
|
HRESULT hr = _DeviceInterface->Reset (¶meters);
|
||||||
if (hr != D3D_OK)
|
if (hr != D3D_OK)
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,7 +75,7 @@ INelContext::~INelContext()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void INelContext::contextReady()
|
void INelContext::contextReady()
|
||||||
{
|
{
|
||||||
// Register the NeL Context
|
// Register the NeL Context
|
||||||
// This assert doesn't work for Linux due to ELF symbol relocation
|
// This assert doesn't work for Linux due to ELF symbol relocation
|
||||||
|
|
|
@ -613,6 +613,7 @@ void CGeorgesFormModel::appendArray( QModelIndex idx )
|
||||||
|
|
||||||
NLGEORGES::CFormDfn *cdfn = const_cast< NLGEORGES::CFormDfn* >( nodeDfn );
|
NLGEORGES::CFormDfn *cdfn = const_cast< NLGEORGES::CFormDfn* >( nodeDfn );
|
||||||
addItem( item, node, cdfn, name.c_str(), s, formName.c_str() );
|
addItem( item, node, cdfn, name.c_str(), s, formName.c_str() );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGeorgesFormModel::deleteArrayEntry( QModelIndex idx )
|
void CGeorgesFormModel::deleteArrayEntry( QModelIndex idx )
|
||||||
|
@ -657,8 +658,6 @@ void CGeorgesFormModel::deleteArrayEntry( QModelIndex idx )
|
||||||
NLGEORGES::UFormDfn *udfn = e.Element->getStructDfn();
|
NLGEORGES::UFormDfn *udfn = e.Element->getStructDfn();
|
||||||
NLGEORGES::CFormDfn *cdfn = static_cast< NLGEORGES::CFormDfn* >( udfn );
|
NLGEORGES::CFormDfn *cdfn = static_cast< NLGEORGES::CFormDfn* >( udfn );
|
||||||
addItem( item, e.Element, cdfn, n.toUtf8().constData(), i, formName.toUtf8().constData() );
|
addItem( item, e.Element, cdfn, n.toUtf8().constData(), i, formName.toUtf8().constData() );
|
||||||
//NLGEORGES::CFormElmStruct *st = static_cast< NLGEORGES::CFormElmStruct* >( e.Element );
|
|
||||||
//addStruct( item, st, st->FormDfn, n.toUtf8().constData(), i, formName.toUtf8().constData(), 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EMIT endResetModel();
|
Q_EMIT endResetModel();
|
||||||
|
|
|
@ -201,6 +201,7 @@ class DBLayer {
|
||||||
$field_option_values = ltrim($field_option_values, ',');
|
$field_option_values = ltrim($field_option_values, ',');
|
||||||
try {
|
try {
|
||||||
$sth = $this->PDO->prepare("UPDATE $tb_name SET $field_option_values WHERE $where ");
|
$sth = $this->PDO->prepare("UPDATE $tb_name SET $field_option_values WHERE $where ");
|
||||||
|
error_log("UPDATE $tb_name SET $field_option_values WHERE $where ");
|
||||||
|
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
$sth->bindValue(":$key", $value);
|
$sth->bindValue(":$key", $value);
|
||||||
|
|
|
@ -22,19 +22,20 @@ class Helpers {
|
||||||
global $SITEBASE;
|
global $SITEBASE;
|
||||||
global $AMS_TRANS;
|
global $AMS_TRANS;
|
||||||
global $INGAME_LAYOUT;
|
global $INGAME_LAYOUT;
|
||||||
|
global $AMS_CACHEDIR;
|
||||||
// define('SMARTY_SPL_AUTOLOAD',1);
|
// define('SMARTY_SPL_AUTOLOAD',1);
|
||||||
require_once $AMS_LIB . '/smarty/libs/Smarty.class.php';
|
require_once $AMS_LIB . '/smarty/libs/Smarty.class.php';
|
||||||
spl_autoload_register( '__autoload' );
|
spl_autoload_register( '__autoload' );
|
||||||
|
|
||||||
$smarty = new Smarty;
|
$smarty = new Smarty;
|
||||||
$smarty -> setCompileDir( $SITEBASE . '/templates_c/' );
|
$smarty -> setCompileDir( $SITEBASE . '/templates_c/' );
|
||||||
$smarty -> setCacheDir( $SITEBASE . '/cache/' );
|
$smarty -> setCacheDir( $AMS_CACHEDIR );
|
||||||
$smarty -> setConfigDir( $SITEBASE . '/configs/' );
|
$smarty -> setConfigDir( $SITEBASE . '/configs/' );
|
||||||
// turn smarty debugging on/off
|
// turn smarty debugging on/off
|
||||||
$smarty -> debugging = false;
|
$smarty -> debugging = false;
|
||||||
// caching must be disabled for multi-language support
|
// caching must be disabled for multi-language support
|
||||||
$smarty -> caching = false;
|
$smarty -> caching = false;
|
||||||
$smarty -> cache_lifetime = 5;
|
$smarty -> cache_lifetime = 300;
|
||||||
|
|
||||||
if (function_exists('apc_cache_info')) {
|
if (function_exists('apc_cache_info')) {
|
||||||
// production
|
// production
|
||||||
|
@ -80,6 +81,9 @@ class Helpers {
|
||||||
$smarty -> assign( $key, $value);
|
$smarty -> assign( $key, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$id = session_id();
|
||||||
|
$smarty -> assign( "sessionid", $id );
|
||||||
|
|
||||||
// smarty inheritance for loading the matching wrapper layout (with the matching menu bar)
|
// smarty inheritance for loading the matching wrapper layout (with the matching menu bar)
|
||||||
if ( isset( $vars['permission'] ) && $vars['permission'] == 3 ) {
|
if ( isset( $vars['permission'] ) && $vars['permission'] == 3 ) {
|
||||||
$inherited = "extends:layout_admin.tpl|";
|
$inherited = "extends:layout_admin.tpl|";
|
||||||
|
|
|
@ -13,19 +13,20 @@ class Sync{
|
||||||
* This is done because the shard could have been offline and we want changes made on the website (which is still online) to eventually hit the shard.
|
* This is done because the shard could have been offline and we want changes made on the website (which is still online) to eventually hit the shard.
|
||||||
* These changes are: createPermissions, createUser, change_pass, change_mail
|
* These changes are: createPermissions, createUser, change_pass, change_mail
|
||||||
*/
|
*/
|
||||||
static public function syncdata ($display = true) {
|
static public function syncdata ($display = false) {
|
||||||
|
|
||||||
if (function_exists('pcntl_fork')) {
|
if (function_exists('pcntl_fork')) {
|
||||||
$pid = pcntl_fork();
|
$pid = pcntl_fork();
|
||||||
}
|
}
|
||||||
$pidfile = '/tmp/ams_cron_pid';
|
global $AMS_TMPDIR;
|
||||||
|
$pidfile = $AMS_TMPDIR.'/ams_cron_pid';
|
||||||
|
|
||||||
if(isset($pid)) {
|
if(isset($pid) and function_exists('pcntl_fork') ) {
|
||||||
// We're the main process.
|
// We're the main process.
|
||||||
} else {
|
} else {
|
||||||
if(!file_exists($pidfile)) {
|
if(!file_exists($pidfile)) {
|
||||||
$pid = getmypid();
|
$pid = getmypid();
|
||||||
$file = fopen($pidfile, 'w');
|
$file = fopen($pidfile, 'w+');
|
||||||
|
|
||||||
fwrite($file, $pid);
|
fwrite($file, $pid);
|
||||||
fclose($file);
|
fclose($file);
|
||||||
|
@ -57,13 +58,13 @@ class Sync{
|
||||||
$decode = json_decode($record['query']);
|
$decode = json_decode($record['query']);
|
||||||
$values = array('Password' => $decode[1]);
|
$values = array('Password' => $decode[1]);
|
||||||
//make connection with and put into shard db & delete from the lib
|
//make connection with and put into shard db & delete from the lib
|
||||||
$db->update("user", $values, "Login = $decode[0]");
|
$db->update("user", $values, "Login = '$decode[0]'");
|
||||||
break;
|
break;
|
||||||
case 'change_mail':
|
case 'change_mail':
|
||||||
$decode = json_decode($record['query']);
|
$decode = json_decode($record['query']);
|
||||||
$values = array('Email' => $decode[1]);
|
$values = array('Email' => $decode[1]);
|
||||||
//make connection with and put into shard db & delete from the lib
|
//make connection with and put into shard db & delete from the lib
|
||||||
$db->update("user", $values, "Login = $decode[0]");
|
$db->update("user", $values, "Login = '$decode[0]'");
|
||||||
break;
|
break;
|
||||||
case 'createUser':
|
case 'createUser':
|
||||||
$decode = json_decode($record['query']);
|
$decode = json_decode($record['query']);
|
||||||
|
|
|
@ -203,6 +203,35 @@ class Ticket{
|
||||||
return $reply;
|
return $reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return the attachments list
|
||||||
|
* @param $ticket_id the id of the ticket.
|
||||||
|
* @return a ticket_reply object.
|
||||||
|
*/
|
||||||
|
public static function getAttachments( $ticket_id) {
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$statement = $dbl->select("`ticket_attachments`",array('ticket_TId' => $ticket_id), "`ticket_TId` =:ticket_TId ORDER BY Timestamp DESC");
|
||||||
|
$fetchall = $statement->fetchall();
|
||||||
|
$base = 0;
|
||||||
|
foreach ($fetchall as &$value) {
|
||||||
|
$webUser = new WebUsers($value['Uploader']);
|
||||||
|
$fetchall[$base]['Username'] = $webUser->getUsername();
|
||||||
|
|
||||||
|
$bytes = $fetchall[$base]['Filesize'];
|
||||||
|
$precision = 2;
|
||||||
|
$units = array('B', 'KB', 'MB', 'GB', 'TB');
|
||||||
|
|
||||||
|
$bytes = max($bytes, 0);
|
||||||
|
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
|
||||||
|
$pow = min($pow, count($units) - 1);
|
||||||
|
|
||||||
|
$bytes /= pow(1024, $pow);
|
||||||
|
|
||||||
|
$fetchall[$base]['Filesize'] = round($bytes, $precision) . ' ' . $units[$pow];;
|
||||||
|
$base++;
|
||||||
|
}
|
||||||
|
return $fetchall;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create a new reply for a ticket.
|
* create a new reply for a ticket.
|
||||||
|
@ -571,4 +600,33 @@ class Ticket{
|
||||||
$this->priority = $p;
|
$this->priority = $p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function that creates a ticket Attachment.
|
||||||
|
*/
|
||||||
|
public static function add_Attachment($TId,$filename,$author,$tempFile){
|
||||||
|
|
||||||
|
global $FILE_STORAGE_PATH;
|
||||||
|
$length = 20;
|
||||||
|
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_';
|
||||||
|
$randomString = '';
|
||||||
|
for ($i = 0; $i < $length; $i++) {
|
||||||
|
$randomString .= $characters[rand(0, strlen($characters) - 1)];
|
||||||
|
}
|
||||||
|
$targetFile = $FILE_STORAGE_PATH . $randomString . "/" . $filename;
|
||||||
|
|
||||||
|
$ticket = new Ticket();
|
||||||
|
$ticket->load_With_TId($TId);
|
||||||
|
|
||||||
|
//create the attachment!
|
||||||
|
$dbl = new DBLayer("lib");
|
||||||
|
$dbl->insert("`ticket_attachments`", Array('ticket_TId' => $TId, 'Filename' => $filename, 'Filesize' => filesize($tempFile), 'Uploader' => $author, 'Path' => $randomString . "/" . $filename));
|
||||||
|
mkdir($FILE_STORAGE_PATH . $randomString);
|
||||||
|
move_uploaded_file($tempFile,$targetFile);
|
||||||
|
|
||||||
|
//write a log entry
|
||||||
|
Ticket_Log::createLogEntry( $TId, $author, 10);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
* -# assigned to the ticket
|
* -# assigned to the ticket
|
||||||
* -# forwarded ticket to support group arg
|
* -# forwarded ticket to support group arg
|
||||||
* -# unassigned to the ticket
|
* -# unassigned to the ticket
|
||||||
|
* -# added attachment to the ticket
|
||||||
*
|
*
|
||||||
* @author Daan Janssens, mentored by Matthew Lagoe
|
* @author Daan Janssens, mentored by Matthew Lagoe
|
||||||
*/
|
*/
|
||||||
|
@ -36,6 +37,7 @@ class Ticket_Log{
|
||||||
* 7: assigned to the ticket
|
* 7: assigned to the ticket
|
||||||
* 8: Forwarded ticket to support group arg
|
* 8: Forwarded ticket to support group arg
|
||||||
* 9: unassigned to the ticket
|
* 9: unassigned to the ticket
|
||||||
|
*10: added attachment to the ticket
|
||||||
*
|
*
|
||||||
****************************************/
|
****************************************/
|
||||||
|
|
||||||
|
|
|
@ -436,7 +436,7 @@ class Users{
|
||||||
try {
|
try {
|
||||||
//make connection with and put into shard db
|
//make connection with and put into shard db
|
||||||
$dbs = new DBLayer("shard");
|
$dbs = new DBLayer("shard");
|
||||||
$dbs->update("user", $values, "Login = $user");
|
$dbs->update("user", $values, "Login = '$user'");
|
||||||
return "ok";
|
return "ok";
|
||||||
}
|
}
|
||||||
catch (PDOException $e) {
|
catch (PDOException $e) {
|
||||||
|
|
0
code/web/private_php/ams/tmp/placeholder
Normal file
0
code/web/private_php/ams/tmp/placeholder
Normal file
|
@ -154,6 +154,7 @@ group_size_error = "The name has to be between 4-20 chars and the tag between 2-
|
||||||
7 = "assigned to the ticket"
|
7 = "assigned to the ticket"
|
||||||
8 = "forwarded the ticket to the support group: "
|
8 = "forwarded the ticket to the support group: "
|
||||||
9 = "unassigned from the ticket"
|
9 = "unassigned from the ticket"
|
||||||
|
10= "added attachment"
|
||||||
|
|
||||||
[error]
|
[error]
|
||||||
title404 = "Not<br/>Found!"
|
title404 = "Not<br/>Found!"
|
||||||
|
|
|
@ -4,40 +4,40 @@
|
||||||
* @author Daan Janssens, mentored by Matthew Lagoe
|
* @author Daan Janssens, mentored by Matthew Lagoe
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Variables for database access to the www/CMS database
|
// Variables for database access to the www/CMS database (only if support role)
|
||||||
$cfg['db']['web']['host'] = '%sqlHostname%';
|
$cfg['db']['web']['host'] = '%amsSqlHostname%';
|
||||||
$cfg['db']['web']['port'] = '3306';
|
$cfg['db']['web']['port'] = '3306';
|
||||||
$cfg['db']['web']['name'] = '%amsDatabase%';
|
$cfg['db']['web']['name'] = '%amsDatabase%';
|
||||||
$cfg['db']['web']['user'] = '%sqlUsername%';
|
$cfg['db']['web']['user'] = '%amsSqlUsername%';
|
||||||
$cfg['db']['web']['pass'] = '%sqlPassword%';
|
$cfg['db']['web']['pass'] = '%amsSqlPassword%';
|
||||||
|
|
||||||
// Variables for database access to the lib database
|
// Variables for database access to the lib database (only if support role)
|
||||||
$cfg['db']['lib']['host'] = '%sqlHostname%';
|
$cfg['db']['lib']['host'] = '%amsSqlHostname%';
|
||||||
$cfg['db']['lib']['port'] = '3306';
|
$cfg['db']['lib']['port'] = '3306';
|
||||||
$cfg['db']['lib']['name'] = '%amsLibDatabase%';
|
$cfg['db']['lib']['name'] = '%amsLibDatabase%';
|
||||||
$cfg['db']['lib']['user'] = '%sqlUsername%';
|
$cfg['db']['lib']['user'] = '%amsSqlUsername%';
|
||||||
$cfg['db']['lib']['pass'] = '%sqlPassword%';
|
$cfg['db']['lib']['pass'] = '%amsSqlPassword%';
|
||||||
|
|
||||||
// Variables for database access to the shard database
|
// Variables for database access to the shard database
|
||||||
$cfg['db']['shard']['host'] = '%sqlHostname%';
|
$cfg['db']['shard']['host'] = '%nelSqlHostname%';
|
||||||
$cfg['db']['shard']['port'] = '3306';
|
$cfg['db']['shard']['port'] = '3306';
|
||||||
$cfg['db']['shard']['name'] = '%nelDatabase%';
|
$cfg['db']['shard']['name'] = '%nelDatabase%';
|
||||||
$cfg['db']['shard']['user'] = '%sqlUsername%';
|
$cfg['db']['shard']['user'] = '%nelSqlUsername%';
|
||||||
$cfg['db']['shard']['pass'] = '%sqlPassword%';
|
$cfg['db']['shard']['pass'] = '%nelSqlPassword%';
|
||||||
|
|
||||||
// Variables for database access to the ring_open database
|
// Variables for database access to the ring_open database (only if domain role)
|
||||||
// $cfg['db']['ring']['host'] = '%sqlHostname%';
|
// $cfg['db']['ring']['host'] = '%nelSqlHostname%';
|
||||||
// $cfg['db']['ring']['port'] = '3306';
|
// $cfg['db']['ring']['port'] = '3306';
|
||||||
// $cfg['db']['ring']['name'] = '%domainDatabase%';
|
// $cfg['db']['ring']['name'] = '%domainDatabase%';
|
||||||
// $cfg['db']['ring']['user'] = '%sqlUsername%';
|
// $cfg['db']['ring']['user'] = '%nelSqlUsername%';
|
||||||
// $cfg['db']['ring']['pass'] = '%sqlPassword%';
|
// $cfg['db']['ring']['pass'] = '%nelSqlPassword%';
|
||||||
|
|
||||||
// Variables for database access to the nel_tool database
|
// Variables for database access to the nel_tool database (only if service role)
|
||||||
$cfg['db']['tool']['host'] = '%sqlHostname%';
|
$cfg['db']['tool']['host'] = '%nelSqlHostname%';
|
||||||
$cfg['db']['tool']['port'] = '3306';
|
$cfg['db']['tool']['port'] = '3306';
|
||||||
$cfg['db']['tool']['name'] = '%toolDatabase%';
|
$cfg['db']['tool']['name'] = '%toolDatabase%';
|
||||||
$cfg['db']['tool']['user'] = '%sqlUsername%';
|
$cfg['db']['tool']['user'] = '%nelSqlUsername%';
|
||||||
$cfg['db']['tool']['pass'] = '%sqlPassword%';
|
$cfg['db']['tool']['pass'] = '%nelSqlPassword%';
|
||||||
|
|
||||||
// To connect to an IMAP server running on port 143 on the local machine,
|
// To connect to an IMAP server running on port 143 on the local machine,
|
||||||
// do the following: $mbox = imap_open("{localhost:143}INBOX", "user_id", "password");
|
// do the following: $mbox = imap_open("{localhost:143}INBOX", "user_id", "password");
|
||||||
|
@ -121,3 +121,12 @@ $INGAME_LAYOUT = "basic";
|
||||||
//forces to load the ingame templates if set to true
|
//forces to load the ingame templates if set to true
|
||||||
$FORCE_INGAME = false;
|
$FORCE_INGAME = false;
|
||||||
|
|
||||||
|
//file storage path (must be a publicly accessible url for
|
||||||
|
$FILE_STORAGE_PATH = $PUBLIC_PHP_PATH . '/ams/files/';
|
||||||
|
$FILE_WEB_PATH = $BASE_WEBPATH . 'files/';
|
||||||
|
|
||||||
|
// Setup password
|
||||||
|
$NEL_SETUP_PASSWORD = '%nelSetupPassword%';
|
||||||
|
|
||||||
|
// Name of current domain (only if domain role)
|
||||||
|
$NEL_DOMAIN_NAME = '%nelDomainName%';
|
||||||
|
|
71
code/web/private_php/setup/sql/nel_ams_lib_00002.sql
Normal file
71
code/web/private_php/setup/sql/nel_ams_lib_00002.sql
Normal file
|
@ -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 */;
|
|
@ -234,11 +234,11 @@ class WebUsers extends Users{
|
||||||
|
|
||||||
$hashpass = crypt($pass, WebUsers::generateSALT());
|
$hashpass = crypt($pass, WebUsers::generateSALT());
|
||||||
$reply = WebUsers::setAmsPassword($user, $hashpass);
|
$reply = WebUsers::setAmsPassword($user, $hashpass);
|
||||||
$values = Array('pass' => $hashpass);
|
$values = Array('Password' => $hashpass);
|
||||||
try {
|
try {
|
||||||
//make connection with and put into shard db
|
//make connection with and put into shard db
|
||||||
$dbw = new DBLayer("web");
|
$dbw = new DBLayer("web");
|
||||||
$dbw->update("ams_user", $values,"Login = $user");
|
$dbw->update("ams_user", $values,"Login = '$user'");
|
||||||
}
|
}
|
||||||
catch (PDOException $e) {
|
catch (PDOException $e) {
|
||||||
//ERROR: the web DB is offline
|
//ERROR: the web DB is offline
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
* @author Daan Janssens, mentored by Matthew Lagoe
|
* @author Daan Janssens, mentored by Matthew Lagoe
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require( '../libinclude.php' );
|
require( '../../config.php' );
|
||||||
require( '../../www/config.php' );
|
require_once( $AMS_LIB . '/libinclude.php' );;
|
||||||
|
|
||||||
$mail_handler = new Mail_Handler();
|
$mail_handler = new Mail_Handler();
|
||||||
$mail_handler->cron();
|
$mail_handler->cron();
|
|
@ -4,8 +4,6 @@
|
||||||
* This small piece of php code calls the syncdata() function of Sync class.
|
* This small piece of php code calls the syncdata() function of Sync class.
|
||||||
* @author Daan Janssens, mentored by Matthew Lagoe
|
* @author Daan Janssens, mentored by Matthew Lagoe
|
||||||
*/
|
*/
|
||||||
|
require( '../../config.php' );
|
||||||
require( '../libinclude.php' );
|
require_once( $AMS_LIB . '/libinclude.php' );
|
||||||
require( '../../www/config.php' );
|
|
||||||
|
|
||||||
Sync::syncdata();
|
Sync::syncdata();
|
0
code/web/public_php/ams/files/index.html
Normal file
0
code/web/public_php/ams/files/index.html
Normal file
40
code/web/public_php/ams/func/upload.php
Normal file
40
code/web/public_php/ams/func/upload.php
Normal file
|
@ -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!";
|
||||||
|
?>
|
|
@ -64,6 +64,10 @@ function show_ticket(){
|
||||||
$result['ticket_assignedTo'] = Assigned::getUserAssignedToTicket($result['ticket_tId']);
|
$result['ticket_assignedTo'] = Assigned::getUserAssignedToTicket($result['ticket_tId']);
|
||||||
$result['ticket_replies'] = Gui_Elements::make_table($entire_ticket['reply_array'], Array("getTReplyId","getContent()->getContent","getTimestamp","getAuthor()->getExternId","getAuthor()->getPermission","getHidden"), Array("tReplyId","replyContent","timestamp","authorExtern","permission","hidden"));
|
$result['ticket_replies'] = Gui_Elements::make_table($entire_ticket['reply_array'], Array("getTReplyId","getContent()->getContent","getTimestamp","getAuthor()->getExternId","getAuthor()->getPermission","getHidden"), Array("tReplyId","replyContent","timestamp","authorExtern","permission","hidden"));
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
global $FILE_WEB_PATH;
|
||||||
|
$result['FILE_WEB_PATH'] = $FILE_WEB_PATH;
|
||||||
|
global $BASE_WEBPATH;
|
||||||
|
$result['BASE_WEBPATH'] = $BASE_WEBPATH;
|
||||||
foreach( $result['ticket_replies'] as $reply){
|
foreach( $result['ticket_replies'] as $reply){
|
||||||
$webReplyUser = new WebUsers($reply['authorExtern']);
|
$webReplyUser = new WebUsers($reply['authorExtern']);
|
||||||
$result['ticket_replies'][$i]['author'] = $webReplyUser->getUsername();
|
$result['ticket_replies'][$i]['author'] = $webReplyUser->getUsername();
|
||||||
|
@ -77,6 +81,8 @@ function show_ticket(){
|
||||||
$result['hasInfo'] = $target_ticket->hasInfo();
|
$result['hasInfo'] = $target_ticket->hasInfo();
|
||||||
global $INGAME_WEBPATH;
|
global $INGAME_WEBPATH;
|
||||||
$result['ingame_webpath'] = $INGAME_WEBPATH;
|
$result['ingame_webpath'] = $INGAME_WEBPATH;
|
||||||
|
//get attachments
|
||||||
|
$result['ticket_attachments'] = Ticket::getAttachments($result['ticket_id']);
|
||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -18,7 +18,7 @@ ini_set( 'display_errors', 'on' );
|
||||||
class SystemExit extends Exception {}
|
class SystemExit extends Exception {}
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (!file_exists( '../is_installed')) {
|
if (!file_exists('../role_support')) {
|
||||||
header("Cache-Control: max-age=1");
|
header("Cache-Control: max-age=1");
|
||||||
header('Location: ../setup', true, 303);
|
header('Location: ../setup', true, 303);
|
||||||
throw new SystemExit();
|
throw new SystemExit();
|
||||||
|
@ -28,6 +28,7 @@ require( '../config.php' );
|
||||||
require_once( $AMS_LIB . '/libinclude.php' );
|
require_once( $AMS_LIB . '/libinclude.php' );
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
|
|
||||||
// Running Cron
|
// Running Cron
|
||||||
if ( isset( $_GET["cron"] ) ) {
|
if ( isset( $_GET["cron"] ) ) {
|
||||||
if ( $_GET["cron"] == "true" ) {
|
if ( $_GET["cron"] == "true" ) {
|
||||||
|
|
13
code/web/public_php/ams/js/custom.js
Normal file
13
code/web/public_php/ams/js/custom.js
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
$(document).ready(function () {
|
||||||
|
//other things to do on document ready, separated for ajax calls
|
||||||
|
docReady();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function docReady() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
6
code/web/public_php/ams/js/jquery.min.js
vendored
Normal file
6
code/web/public_php/ams/js/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1971
code/web/public_php/ams/js/jquery.uploadify-3.1.js
Normal file
1971
code/web/public_php/ams/js/jquery.uploadify-3.1.js
Normal file
File diff suppressed because it is too large
Load diff
|
@ -15,10 +15,10 @@
|
||||||
<span class="notification red">{$nrToDo}</span>
|
<span class="notification red">{$nrToDo}</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a data-original-title="By {$newestTicketAuthor}" data-rel="tooltip" class="well span3 top-block" href="index.php?page=show_ticket&id={$newestTicketId}">
|
<a data-original-title="By {$newestTicketAuthor}" data-rel="tooltip" class="well span3 top-block" {if $newestTicketId != null}href="index.php?page=show_ticket&id={$newestTicketId}"{/if}>
|
||||||
<span class="glyphicon glyphicon-flag lg-icon green"></span>
|
<span class="glyphicon glyphicon-flag lg-icon green"></span>
|
||||||
<div>Newest Ticket</div>
|
<div>Newest Ticket</div>
|
||||||
<span class="notification blue">{$newestTicketTitle}</span>
|
<span class="notification blue">{if $newestTicketId != null}{$newestTicketTitle}{else}No Tickets!{/if}</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a data-original-title="{$nrTotalTickets} tickets in total" data-rel="tooltip" class="well span3 top-block" href="index.php?page=show_queue&get=all">
|
<a data-original-title="{$nrTotalTickets} tickets in total" data-rel="tooltip" class="well span3 top-block" href="index.php?page=show_queue&get=all">
|
||||||
|
|
|
@ -22,12 +22,6 @@
|
||||||
<link id="bs-css" href="css/bootstrap-cerulean.min.css" rel="stylesheet">
|
<link id="bs-css" href="css/bootstrap-cerulean.min.css" rel="stylesheet">
|
||||||
|
|
||||||
<link href="css/charisma-app.css" rel="stylesheet">
|
<link href="css/charisma-app.css" rel="stylesheet">
|
||||||
<link href='bower_components/fullcalendar/dist/fullcalendar.css' rel='stylesheet'>
|
|
||||||
<link href='bower_components/fullcalendar/dist/fullcalendar.print.css' rel='stylesheet' media='print'>
|
|
||||||
<link href='bower_components/chosen/chosen.min.css' rel='stylesheet'>
|
|
||||||
<link href='bower_components/colorbox/example3/colorbox.css' rel='stylesheet'>
|
|
||||||
<link href='bower_components/responsive-tables/responsive-tables.css' rel='stylesheet'>
|
|
||||||
<link href='bower_components/bootstrap-tour/build/css/bootstrap-tour.min.css' rel='stylesheet'>
|
|
||||||
<link href='css/jquery.noty.css' rel='stylesheet'>
|
<link href='css/jquery.noty.css' rel='stylesheet'>
|
||||||
<link href='css/noty_theme_default.css' rel='stylesheet'>
|
<link href='css/noty_theme_default.css' rel='stylesheet'>
|
||||||
<link href='css/elfinder.min.css' rel='stylesheet'>
|
<link href='css/elfinder.min.css' rel='stylesheet'>
|
||||||
|
@ -36,6 +30,9 @@
|
||||||
<link href='css/uploadify.css' rel='stylesheet'>
|
<link href='css/uploadify.css' rel='stylesheet'>
|
||||||
<link href='css/animate.min.css' rel='stylesheet'>
|
<link href='css/animate.min.css' rel='stylesheet'>
|
||||||
|
|
||||||
|
<!-- jQuery -->
|
||||||
|
<script src="js/jquery.min.js"></script>
|
||||||
|
|
||||||
<!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
|
<!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
@ -161,12 +158,12 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<p class="pull-right">Powered by: <a href="http://usman.it/free-responsive-admin-template">Charisma</a></p>
|
{if $permission > 1}<p class="pull-right">AMS 0.9.0 Powered by: <a href="http://usman.it/free-responsive-admin-template">Charisma</a></p>{/if}
|
||||||
</footer>
|
</footer>
|
||||||
{/if}
|
{/if}
|
||||||
</div><!--/.fluid-container-->
|
</div><!--/.fluid-container-->
|
||||||
|
</div>
|
||||||
<!-- external javascript
|
<!-- external javascript
|
||||||
================================================== -->
|
================================================== -->
|
||||||
<!-- Placed at the end of the document so the pages load faster -->
|
<!-- Placed at the end of the document so the pages load faster -->
|
||||||
<script>
|
<script>
|
||||||
|
@ -304,7 +301,8 @@
|
||||||
<!-- <script src="js/charisma.js"></script> -->
|
<!-- <script src="js/charisma.js"></script> -->
|
||||||
<!-- help script for page help -->
|
<!-- help script for page help -->
|
||||||
<script src="js/help.js"></script>
|
<script src="js/help.js"></script>
|
||||||
|
<!-- application script for Charisma demo -->
|
||||||
|
<script src="js/custom.js"></script>
|
||||||
|
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -30,11 +30,27 @@
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table class="table table-bordered table-condensed ">
|
||||||
<tr>
|
<tr>
|
||||||
<td><strong>Assigned To: </strong>{if $ticket_assignedTo neq ""} <a href="index.php?page=show_user&id={$ticket_assignedTo}">{$ticket_assignedToText}</a> {else}<i> {$not_assigned}</i> {/if}</td>
|
<td><strong>Filename: </strong></td>
|
||||||
<td></td>
|
<td><strong>Uploaded: </strong></td>
|
||||||
<td></td>
|
<td><strong>Filesize: </strong></td>
|
||||||
|
<td><strong>Uploaded by: </strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{foreach from=$ticket_attachments item=array}
|
||||||
|
<tr>
|
||||||
|
<td><a href="{$FILE_WEB_PATH}{$array['Path']}">{$array['Filename']}</a></td>
|
||||||
|
<td>{$array['Timestamp']}</td>
|
||||||
|
<td>{$array['Filesize']}</td>
|
||||||
|
<td>{if $permission > 1}
|
||||||
|
<a href="{$BASE_WEBPATH}index.php?page=show_user&id={$array['Uploader']}">{$array['Username']}</a>
|
||||||
|
{else}
|
||||||
|
{$array['Username']}
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/foreach}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
@ -112,6 +128,27 @@
|
||||||
{/if}
|
{/if}
|
||||||
<input type="hidden" name="function" value="reply_on_ticket">
|
<input type="hidden" name="function" value="reply_on_ticket">
|
||||||
<input type="hidden" name="ticket_id" value="{$ticket_id}">
|
<input type="hidden" name="ticket_id" value="{$ticket_id}">
|
||||||
|
|
||||||
|
<h3>Upload Attachment</h3>
|
||||||
|
<input data-no-uniform="true" type="file" name="file_upload" id="file_upload">
|
||||||
|
{literal}
|
||||||
|
<script language='JavaScript'>
|
||||||
|
$(document).ready( function () {
|
||||||
|
|
||||||
|
$('#file_upload').uploadify({
|
||||||
|
'formData' : {'PHPSESSID': '{/literal}{nocache}{$sessionid}{/nocache}{literal}'},
|
||||||
|
'auto' : true,
|
||||||
|
'multi' : true,
|
||||||
|
'method' : 'post',
|
||||||
|
'swf': 'misc/uploadify.swf',
|
||||||
|
'displayData': 'percentage',
|
||||||
|
'uploader': 'func/upload.php?id='+{/literal}{$ticket_id}{literal},
|
||||||
|
'removeCompleted' : false
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{/literal}
|
||||||
|
<div id="filesUploaded"></div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label"></label>
|
<label class="control-label"></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<script>
|
<script>
|
||||||
function sync(){
|
function sync(){
|
||||||
xmlhttp=new XMLHttpRequest();
|
xmlhttp=new XMLHttpRequest();
|
||||||
xmlhttp.open("POST","../../../ams_lib/cron/sync_cron.php",true);
|
xmlhttp.open("POST","cron/sync_cron.php",true);
|
||||||
xmlhttp.send();
|
xmlhttp.send();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
6
code/web/public_php/index.php
Normal file
6
code/web/public_php/index.php
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
header("Cache-Control: max-age=1");
|
||||||
|
header('Location: ams/', true, 301);
|
||||||
|
|
||||||
|
?>
|
62
code/web/public_php/setup/auth.php
Normal file
62
code/web/public_php/setup/auth.php
Normal file
|
@ -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 */ }
|
||||||
|
|
||||||
|
?>
|
117
code/web/public_php/setup/database.php
Normal file
117
code/web/public_php/setup/database.php
Normal file
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
12
code/web/public_php/setup/footer.php
Normal file
12
code/web/public_php/setup/footer.php
Normal file
|
@ -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>
|
123
code/web/public_php/setup/header.php
Normal file
123
code/web/public_php/setup/header.php
Normal file
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- --------------------------------------------------------------- -->
|
BIN
code/web/public_php/setup/img/agplv3-88x31.png
Normal file
BIN
code/web/public_php/setup/img/agplv3-88x31.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
|
@ -1,350 +1,47 @@
|
||||||
<!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 | Setup</title>
|
|
||||||
<link href="css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<?php
|
<?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)) {
|
error_reporting(E_ALL);
|
||||||
if (!($f = @fopen($path, 'r+'))) {
|
ini_set('display_errors', 'on');
|
||||||
return false;
|
|
||||||
}
|
class SystemExit extends Exception {}
|
||||||
fclose($f);
|
try {
|
||||||
return true;
|
|
||||||
}
|
$pageTitle = "Setup";
|
||||||
|
include('header.php');
|
||||||
|
|
||||||
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 class="panel panel-default" style="margin-left: auto; margin-right: auto; max-width: 256px;">
|
||||||
<div style="margin-left: auto; margin-right: auto; padding-left: 24px; padding-right: 24px; padding-bottom: 24px; max-width: 1024px;">
|
<div class="panel-body">
|
||||||
<div class="page-header">
|
|
||||||
<h1>Ryzom Core <small>Setup</small></h1>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if (file_exists( '../is_installed')) { ?>
|
<p>
|
||||||
|
<a class="btn btn-default" style="width: 100%;" href="upgrade.php"><span class="glyphicon glyphicon-wrench"></span> Upgrade</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
<div class="alert alert-info" role="alert">
|
<?php if (file_exists('role_domain')) { ?>
|
||||||
Already installed. Upgrading not available yet.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php } else if ($_POST) { ?>
|
<!--<p>
|
||||||
|
<a class="btn btn-default" style="width: 100%;" href="domain.php"><span class="glyphicon glyphicon-globe"></span> Add Domain</a>
|
||||||
|
</p>-->
|
||||||
|
|
||||||
<div class="alert alert-info" role="alert">
|
<p>
|
||||||
<?php var_dump($_POST); ?>
|
<a class="btn btn-default" style="width: 100%;" href="upgrade.php"><span class="glyphicon glyphicon-tower"></span> Add Shard</a>
|
||||||
</div>
|
</p>
|
||||||
|
|
||||||
<?php
|
|
||||||
$continue = true;
|
|
||||||
|
|
||||||
// Change to root directory
|
|
||||||
if (!chdir("../")) {
|
|
||||||
printalert("Cannot change to public PHP root directory");
|
|
||||||
$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) {
|
|
||||||
$continue = validate_writable($continue, "login/logs/");
|
|
||||||
$continue = validate_writable($continue, "admin/graphs_output/");
|
|
||||||
$continue = validate_writable($continue, "admin/templates/default_c/");
|
|
||||||
$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) {
|
|
||||||
$con = mysqli_connect($_POST["sqlHostname"], $_POST["sqlUsername"], $_POST["sqlPassword"]);
|
|
||||||
if (mysqli_connect_errno()) {
|
|
||||||
printalert("danger", "Failed to connect to SQL: " . mysqli_connect_error());
|
|
||||||
$continue = false;
|
|
||||||
$con = null;
|
|
||||||
} else {
|
|
||||||
printalert("success", "Connected to the SQL server");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create NeL database
|
|
||||||
$continue = create_use_database($continue, $con, $_POST["nelDatabase"]);
|
|
||||||
$continue = update_database_structure($continue, $con, "nel_00001.sql");
|
|
||||||
|
|
||||||
// Create NeL Tools database
|
|
||||||
$continue = create_use_database($continue, $con, $_POST["toolDatabase"]);
|
|
||||||
$continue = update_database_structure($continue, $con, "nel_tool_00001.sql");
|
|
||||||
|
|
||||||
// Create AMS database
|
|
||||||
$continue = create_use_database($continue, $con, $_POST["amsDatabase"]);
|
|
||||||
$continue = update_database_structure($continue, $con, "nel_ams_00001.sql");
|
|
||||||
|
|
||||||
// Create AMS Library database
|
|
||||||
$continue = create_use_database($continue, $con, $_POST["amsLibDatabase"]);
|
|
||||||
$continue = update_database_structure($continue, $con, "nel_ams_lib_00001.sql");
|
|
||||||
|
|
||||||
// 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("%sqlHostname%", addslashes($_POST["sqlHostname"]), $config);
|
|
||||||
$config = str_replace("%sqlUsername%", addslashes($_POST["sqlUsername"]), $config);
|
|
||||||
$config = str_replace("%sqlPassword%", addslashes($_POST["sqlPassword"]), $config);
|
|
||||||
$config = str_replace("%nelDatabase%", addslashes($_POST["nelDatabase"]), $config);
|
|
||||||
$config = str_replace("%toolDatabase%", addslashes($_POST["toolDatabase"]), $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);
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 ($continue) {
|
|
||||||
if (file_put_contents("is_installed", "1")) {
|
|
||||||
printalert("success", "Success!");
|
|
||||||
} else {
|
|
||||||
printalert("danger", "Failed to flag installation success");
|
|
||||||
$continue = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($con) {
|
|
||||||
mysqli_close($con);
|
|
||||||
printalert("info", "Disconnected from the SQL server");
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php } /* ENDOF: if (isset($_POST)) { */ else { /* TODO: Refill form on failure */ ?>
|
|
||||||
|
|
||||||
<form class="form-horizontal" role="form" method="POST" action=".">
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<h2 class="panel-title">Basics</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="sqlHostname" class="col-sm-3 control-label">SQL Hostname</label>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<input type="text" class="form-control" id="sqlHostname" name="sqlHostname" value="localhost">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="sqlUsername" class="col-sm-3 control-label">SQL Username</label>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<input type="text" class="form-control" id="sqlUsername" name="sqlUsername" value="root">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="sqlPassword" class="col-sm-3 control-label">SQL Password</label>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<input type="password" class="form-control" id="sqlPassword" name="sqlPassword" value="">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<h2 class="panel-title">Core</h2>
|
|
||||||
</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<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 class="panel panel-default">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<h2 class="panel-title">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>
|
|
||||||
<!-- TODO: Initial admin user -->
|
|
||||||
</div>
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<h2 class="panel-title">AMS</h2>
|
|
||||||
</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="amsDatabase" class="col-sm-3 control-label">AMS 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">AMS 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">AMS 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">AMS Admin Password</label>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<input type="password" class="form-control" id="amsAdminPassword" name="amsAdminPassword" value="admin">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- TODO: Initial admin user -->
|
|
||||||
</div>
|
|
||||||
<button type="submit" class="btn btn-primary">Configure</button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</div>
|
<!--<p>-->
|
||||||
|
<a class="btn btn-default" style="width: 100%;" href="status.php"><span class="glyphicon glyphicon-info-sign"></span> Status</a>
|
||||||
|
<!--</p>-->
|
||||||
|
|
||||||
<script src="js/bootstrap.min.js"></script>
|
</div>
|
||||||
</body>
|
</div>
|
||||||
</html>
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
include('footer.php');
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (SystemExit $e) { /* do nothing */ }
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
476
code/web/public_php/setup/install.php
Normal file
476
code/web/public_php/setup/install.php
Normal file
|
@ -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 a new issue