hg/feature/cdb-packed
botanic 10 years ago
commit b89faeb75b

@ -28,9 +28,7 @@
#ifndef <xsl:value-of select="@header_tag"/> #ifndef <xsl:value-of select="@header_tag"/>
#define <xsl:value-of select="@header_tag"/> #define <xsl:value-of select="@header_tag"/>
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#ifdef NL_COMP_VC8 #include &lt;memory&gt;
#include &lt;memory&gt;
#endif
#include "nel/misc/hierarchical_timer.h" #include "nel/misc/hierarchical_timer.h"
#include "nel/misc/string_conversion.h" #include "nel/misc/string_conversion.h"
#include "nel/net/message.h" #include "nel/net/message.h"
@ -45,7 +43,7 @@
</xsl:if> </xsl:if>
<xsl:if test="//class/database"> <xsl:if test="//class/database">
#include "nel/misc/string_common.h" #include "nel/misc/string_common.h"
#include "game_share/mysql_wrapper.h" #include "server_share/mysql_wrapper.h"
</xsl:if> </xsl:if>
<xsl:if test="//class/message"> <xsl:if test="//class/message">
#include "game_share/synchronised_message.h" #include "game_share/synchronised_message.h"

@ -1,18 +1,3 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it ! // WARNING : this is a generated file, don't change it !
@ -318,7 +303,7 @@ namespace RSMGR
} }
else if (cmd == NOPE::cc_instance_count) else if (cmd == NOPE::cc_instance_count)
{ {
return (uint32)_ObjectCache.size(); return _ObjectCache.size();
} }
// default return value // default return value
@ -336,7 +321,7 @@ namespace RSMGR
TReleasedObject::iterator first(_ReleasedObject.begin()), last(_ReleasedObject.end()); TReleasedObject::iterator first(_ReleasedObject.begin()), last(_ReleasedObject.end());
for (; first != last; ++first) for (; first != last; ++first)
{ {
nbReleased += (uint32)first->second.size(); nbReleased += first->second.size();
} }
nlinfo(" There are %u object instances in cache not referenced (waiting deletion or re-use))", nbReleased); nlinfo(" There are %u object instances in cache not referenced (waiting deletion or re-use))", nbReleased);
@ -586,16 +571,16 @@ namespace RSMGR
nlstop; nlstop;
} }
// remove object from cache map // remove object from cache map
if (_Prim != NOPE::INVALID_OBJECT_ID if (_PermissionId != NOPE::INVALID_OBJECT_ID
&& _ObjectState != NOPE::os_removed && _ObjectState != NOPE::os_removed
&& _ObjectState != NOPE::os_transient) && _ObjectState != NOPE::os_transient)
{ {
nldebug("NOPE: clearing CNelPermission @%p from cache with id %u", this, static_cast<uint32>(_Prim)); nldebug("NOPE: clearing CNelPermission @%p from cache with id %u", this, static_cast<uint32>(_PermissionId));
nlverify(_ObjectCache.erase(_Prim) == 1); nlverify(_ObjectCache.erase(_PermissionId) == 1);
} }
else if (_ObjectState != NOPE::os_transient) else if (_ObjectState != NOPE::os_transient)
{ {
nlassert(_ObjectCache.find(_Prim) == _ObjectCache.end()); nlassert(_ObjectCache.find(_PermissionId) == _ObjectCache.end());
} }
if (_ObjectState == NOPE::os_released) if (_ObjectState == NOPE::os_released)
{ {
@ -626,18 +611,18 @@ namespace RSMGR
{ {
nlassert(getPersistentState() == NOPE::os_transient); nlassert(getPersistentState() == NOPE::os_transient);
nlassert(_Prim != 0); nlassert(_PermissionId != 0);
std::string qs; std::string qs;
qs = "INSERT INTO permission ("; qs = "INSERT INTO permission (";
qs += "prim, UId, ClientApplication, ShardId, AccessPrivilege"; qs += "PermissionId, UId, DomainId, ShardId, AccessPrivilege";
qs += ") VALUES ("; qs += ") VALUES (";
qs += "'"+MSW::escapeString(NLMISC::toString(_Prim), connection)+"'"; qs += "'"+MSW::escapeString(NLMISC::toString(_PermissionId), connection)+"'";
qs += ", "; qs += ", ";
qs += "'"+MSW::escapeString(NLMISC::toString(_UserId), connection)+"'"; qs += "'"+MSW::escapeString(NLMISC::toString(_UserId), connection)+"'";
qs += ", "; qs += ", ";
qs += "'"+MSW::escapeString(NLMISC::toString(_DomainName), connection)+"'"; qs += "'"+MSW::escapeString(NLMISC::toString(_DomainId), connection)+"'";
qs += ", "; qs += ", ";
qs += "'"+MSW::escapeString(NLMISC::toString(_ShardId), connection)+"'"; qs += "'"+MSW::escapeString(NLMISC::toString(_ShardId), connection)+"'";
qs += ", "; qs += ", ";
@ -670,17 +655,17 @@ namespace RSMGR
std::string qs; std::string qs;
qs = "UPDATE permission SET "; qs = "UPDATE permission SET ";
qs += "prim = '"+MSW::escapeString(NLMISC::toString(_Prim), connection)+"'"; qs += "PermissionId = '"+MSW::escapeString(NLMISC::toString(_PermissionId), connection)+"'";
qs += ", "; qs += ", ";
qs += "UId = '"+MSW::escapeString(NLMISC::toString(_UserId), connection)+"'"; qs += "UId = '"+MSW::escapeString(NLMISC::toString(_UserId), connection)+"'";
qs += ", "; qs += ", ";
qs += "ClientApplication = '"+MSW::escapeString(NLMISC::toString(_DomainName), connection)+"'"; qs += "DomainId = '"+MSW::escapeString(NLMISC::toString(_DomainId), connection)+"'";
qs += ", "; qs += ", ";
qs += "ShardId = '"+MSW::escapeString(NLMISC::toString(_ShardId), connection)+"'"; qs += "ShardId = '"+MSW::escapeString(NLMISC::toString(_ShardId), connection)+"'";
qs += ", "; qs += ", ";
qs += "AccessPrivilege = '"+MSW::escapeString(NLMISC::toString(_AccessPriv), connection)+"'"; qs += "AccessPrivilege = '"+MSW::escapeString(NLMISC::toString(_AccessPriv), connection)+"'";
qs += " WHERE prim = '"+NLMISC::toString(_Prim)+"'"; qs += " WHERE PermissionId = '"+NLMISC::toString(_PermissionId)+"'";
if (connection.query(qs)) if (connection.query(qs))
@ -702,7 +687,7 @@ namespace RSMGR
std::string qs; std::string qs;
qs = "DELETE FROM permission "; qs = "DELETE FROM permission ";
qs += " WHERE prim = '"+NLMISC::toString(_Prim)+"'"; qs += " WHERE PermissionId = '"+NLMISC::toString(_PermissionId)+"'";
if (connection.query(qs)) if (connection.query(qs))
@ -736,7 +721,7 @@ namespace RSMGR
std::string qs; std::string qs;
qs = "DELETE FROM permission "; qs = "DELETE FROM permission ";
qs += " WHERE prim = '"+NLMISC::toString(id)+"'"; qs += " WHERE PermissionId = '"+NLMISC::toString(id)+"'";
if (connection.query(qs)) if (connection.query(qs))
@ -796,7 +781,7 @@ namespace RSMGR
} }
else if (cmd == NOPE::cc_instance_count) else if (cmd == NOPE::cc_instance_count)
{ {
return (uint32)_ObjectCache.size(); return _ObjectCache.size();
} }
// default return value // default return value
@ -814,7 +799,7 @@ namespace RSMGR
TReleasedObject::iterator first(_ReleasedObject.begin()), last(_ReleasedObject.end()); TReleasedObject::iterator first(_ReleasedObject.begin()), last(_ReleasedObject.end());
for (; first != last; ++first) for (; first != last; ++first)
{ {
nbReleased += (uint32)first->second.size(); nbReleased += first->second.size();
} }
nlinfo(" There are %u object instances in cache not referenced (waiting deletion or re-use))", nbReleased); nlinfo(" There are %u object instances in cache not referenced (waiting deletion or re-use))", nbReleased);
@ -912,12 +897,12 @@ namespace RSMGR
if (_ObjectState == NOPE::os_transient && state != NOPE::os_transient) if (_ObjectState == NOPE::os_transient && state != NOPE::os_transient)
{ {
nldebug("NOPE: inserting CNelPermission @%p in cache with id %u", this, static_cast<uint32>(_Prim)); nldebug("NOPE: inserting CNelPermission @%p in cache with id %u", this, static_cast<uint32>(_PermissionId));
nlverify(_ObjectCache.insert(std::make_pair(_Prim, this)).second); nlverify(_ObjectCache.insert(std::make_pair(_PermissionId, this)).second);
} }
if (_ObjectState != NOPE::os_transient) if (_ObjectState != NOPE::os_transient)
nlassert(_ObjectCache.find(_Prim) != _ObjectCache.end()); nlassert(_ObjectCache.find(_PermissionId) != _ObjectCache.end());
_ObjectState = state; _ObjectState = state;
@ -928,8 +913,8 @@ namespace RSMGR
} }
else if (state == NOPE::os_removed) else if (state == NOPE::os_removed)
{ {
nldebug("NOPE: erasing CNelPermission @%p in cache with id %u", this, static_cast<uint32>(_Prim)); nldebug("NOPE: erasing CNelPermission @%p in cache with id %u", this, static_cast<uint32>(_PermissionId));
nlverify(_ObjectCache.erase(_Prim) == 1); nlverify(_ObjectCache.erase(_PermissionId) == 1);
} }
} }
@ -945,11 +930,11 @@ namespace RSMGR
std::string qs; std::string qs;
qs = "SELECT "; qs = "SELECT ";
qs += "prim, UId, ClientApplication, ShardId, AccessPrivilege"; qs += "PermissionId, UId, DomainId, ShardId, AccessPrivilege";
qs += " FROM permission"; qs += " FROM permission";
qs += " WHERE prim = '"+NLMISC::toString(id)+"'"; qs += " WHERE PermissionId = '"+NLMISC::toString(id)+"'";
CNelPermissionPtr ret; CNelPermissionPtr ret;
if (!connection.query(qs)) if (!connection.query(qs))
{ {
@ -965,9 +950,9 @@ namespace RSMGR
// ok, we have an object // ok, we have an object
result->fetchRow(); result->fetchRow();
result->getField(0, ret->_Prim); result->getField(0, ret->_PermissionId);
result->getField(1, ret->_UserId); result->getField(1, ret->_UserId);
result->getField(2, ret->_DomainName); result->getField(2, ret->_DomainId);
result->getField(3, ret->_ShardId); result->getField(3, ret->_ShardId);
result->getField(4, ret->_AccessPriv); result->getField(4, ret->_AccessPriv);

@ -1,18 +1,3 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it ! // WARNING : this is a generated file, don't change it !
@ -632,11 +617,11 @@ namespace RSMGR
{ {
protected: protected:
// //
uint32 _Prim; uint32 _PermissionId;
// //
uint32 _UserId; uint32 _UserId;
// //
std::string _DomainName; uint32 _DomainId;
// //
uint32 _ShardId; uint32 _ShardId;
// //
@ -662,24 +647,20 @@ namespace RSMGR
} }
// //
const std::string &getDomainName() const uint32 getDomainId() const
{ {
return _DomainName; return _DomainId;
} }
void setDomainId(uint32 value)
void setDomainName(const std::string &value)
{ {
if (_DomainName != value) if (_DomainId != value)
{ {
if (getPersistentState() != NOPE::os_transient) if (getPersistentState() != NOPE::os_transient)
setPersistentState(NOPE::os_dirty); setPersistentState(NOPE::os_dirty);
_DomainId = value;
_DomainName = value;
} }
@ -729,9 +710,9 @@ namespace RSMGR
bool operator == (const CNelPermission &other) const bool operator == (const CNelPermission &other) const
{ {
return _Prim == other._Prim return _PermissionId == other._PermissionId
&& _UserId == other._UserId && _UserId == other._UserId
&& _DomainName == other._DomainName && _DomainId == other._DomainId
&& _ShardId == other._ShardId && _ShardId == other._ShardId
&& _AccessPriv == other._AccessPriv; && _AccessPriv == other._AccessPriv;
} }
@ -742,7 +723,7 @@ namespace RSMGR
CNelPermission() CNelPermission()
: _PtrList(NULL), : _PtrList(NULL),
_ObjectState(NOPE::os_transient), _ObjectState(NOPE::os_transient),
_Prim(NOPE::INVALID_OBJECT_ID) _PermissionId(NOPE::INVALID_OBJECT_ID)
{ {
// register the cache for this class (if not already done) // register the cache for this class (if not already done)
@ -860,7 +841,7 @@ namespace RSMGR
uint32 getObjectId() const uint32 getObjectId() const
{ {
return _Prim; return _PermissionId;
} }
/** Set the object unique ID. /** Set the object unique ID.
@ -874,8 +855,8 @@ namespace RSMGR
// can only be set when in transient state // can only be set when in transient state
nlassert(getPersistentState() == NOPE::os_transient); nlassert(getPersistentState() == NOPE::os_transient);
// can only be set once // can only be set once
nlassert(_Prim == NOPE::INVALID_OBJECT_ID); nlassert(_PermissionId == NOPE::INVALID_OBJECT_ID);
_Prim = objectId; _PermissionId = objectId;
} }
/** Return the current persistent state of the object.*/ /** Return the current persistent state of the object.*/

@ -24,9 +24,9 @@
<!-- activate database code generation --> <!-- activate database code generation -->
<database table="permission"/> <database table="permission"/>
<property type="uint32" name="Prim" db_col="prim" unique_id="true"/> <property type="uint32" name="PermissionId" db_col="PermissionId" unique_id="true"/>
<property type="uint32" name="UserId" db_col="UId"/> <property type="uint32" name="UserId" db_col="UId"/>
<property type="std::string" name="DomainName" db_col="ClientApplication" byref="true"/> <property type="uint32" name="DomainId" db_col="DomainId"/>
<property type="uint32" name="ShardId" db_col="ShardId"/> <property type="uint32" name="ShardId" db_col="ShardId"/>
<property type="std::string" name="AccessPriv" db_col="AccessPrivilege" byref="true"/> <property type="std::string" name="AccessPriv" db_col="AccessPrivilege" byref="true"/>

@ -0,0 +1,2 @@
xsltproc -o nel_database_mapping.cpp --stringparam output cpp --stringparam filename nel_database_mapping ../../../common/src/game_share/generate_module_interface.xslt nel_database_mapping.xml
xsltproc -o nel_database_mapping.h --stringparam output header --stringparam filename nel_database_mapping ../../../common/src/game_share/generate_module_interface.xslt nel_database_mapping.xml

@ -648,7 +648,7 @@ namespace RSMGR
userAccessPriv.clear(); userAccessPriv.clear();
CSString query; CSString query;
query << "SELECT AccessPrivilege FROM permission"; query << "SELECT AccessPrivilege FROM permission";
query << " WHERE UId = " << userId << " AND permission.ClientApplication = '"<<DomainName<<"'"; query << " WHERE UId = " << userId << " AND DomainId = " << DomainId;
if (!_NelDb.query(query)) if (!_NelDb.query(query))
{ {

@ -659,12 +659,12 @@ function createPermissions($values) {
$sth = $dbh->prepare("SELECT UId FROM user WHERE Login='" . $values[0] . "';"); $sth = $dbh->prepare("SELECT UId FROM user WHERE Login='" . $values[0] . "';");
$sth->execute(); $sth->execute();
$result = $sth->fetchAll(); $result = $sth->fetchAll();
foreach ($result as $UId) { /*foreach ($result as $UId) {
$statement = $dbh->prepare("INSERT INTO permission (UId, ClientApplication, AccessPrivilege) VALUES ('" . $UId['UId'] . "', 'r2', 'OPEN');"); $statement = $dbh->prepare("INSERT INTO permission (UId, ClientApplication, AccessPrivilege) VALUES ('" . $UId['UId'] . "', 'r2', 'OPEN');");
$statement->execute($values); $statement->execute($values);
$statement = $dbh->prepare("INSERT INTO permission (UId, ClientApplication, AccessPrivilege) VALUES ('" . $UId['UId'] . "', 'ryzom_open', 'OPEN');"); $statement = $dbh->prepare("INSERT INTO permission (UId, ClientApplication, AccessPrivilege) VALUES ('" . $UId['UId'] . "', 'ryzom_open', 'OPEN');");
$statement->execute($values); $statement->execute($values);
} }*///FIXME: GARBAGE
} }
catch (PDOException $e) { catch (PDOException $e) {
watchdog('ryzommanage', $e->getMessage(), NULL, WATCHDOG_ERROR); watchdog('ryzommanage', $e->getMessage(), NULL, WATCHDOG_ERROR);

@ -48,8 +48,11 @@ class DBLayer {
* @param $db String, the name of the databases entry in the $cfg global var. * @param $db String, the name of the databases entry in the $cfg global var.
* @param $dbn String, the name of the databases entry in the $cfg global var if $db referenced to an action(install etc). * @param $dbn String, the name of the databases entry in the $cfg global var if $db referenced to an action(install etc).
*/ */
function __construct($db, $dbn = null) function __construct($db, $dbn = null) {
{ if ($db == "ring" && $dbn == null) {
throw new Exception("Domain database access from AMS must have database name specified");
}
global $cfg; global $cfg;
// $this->host = $cfg['db'][$db]['host']; // $this->host = $cfg['db'][$db]['host'];
// $this->dbname = $cfg['db'][$db]['name']; // $this->dbname = $cfg['db'][$db]['name'];

@ -54,14 +54,14 @@ class Sync{
//make connection with and put into shard db & delete from the lib //make connection with and put into shard db & delete from the lib
$sth=$db->selectWithParameter("UId", "user", $values, "Login= :username" ); $sth=$db->selectWithParameter("UId", "user", $values, "Login= :username" );
$result = $sth->fetchAll(); $result = $sth->fetchAll();
foreach ($result as $UId) { /*foreach ($result as $UId) {
$ins_values = array('UId' => $UId['UId']); $ins_values = array('UId' => $UId['UId']);
$ins_values['ClientApplication'] = "r2"; $ins_values['ClientApplication'] = "r2";
$ins_values['AccessPrivilege'] = "OPEN"; $ins_values['AccessPrivilege'] = "OPEN";
$db->insert("permission", $ins_values); $db->insert("permission", $ins_values);
$ins_values['ClientApplication'] = 'ryzom_open'; $ins_values['ClientApplication'] = 'ryzom_open';
$db->insert("permission",$ins_values); $db->insert("permission",$ins_values);
} }*/ // FIXME: GARBAGE
break; break;
case 'change_pass': case 'change_pass':
$decode = json_decode($record['query']); $decode = json_decode($record['query']);

@ -336,12 +336,12 @@ class Users{
$dbs = new DBLayer("shard"); $dbs = new DBLayer("shard");
$sth = $dbs->selectWithParameter("UId", "user", $values, "Login= :username"); $sth = $dbs->selectWithParameter("UId", "user", $values, "Login= :username");
$result = $sth->fetchAll(); $result = $sth->fetchAll();
foreach ($result as $UId) { /*foreach ($result as $UId) {
$ins_values = array('UId' => $UId['UId'], 'clientApplication' => 'r2', 'AccessPrivilege' => 'OPEN'); $ins_values = array('UId' => $UId['UId'], 'clientApplication' => 'r2', 'AccessPrivilege' => 'OPEN');
$dbs->insert("permission", $ins_values); $dbs->insert("permission", $ins_values);
$ins_values['clientApplication'] = 'ryzom_open'; $ins_values['clientApplication'] = 'ryzom_open';
$dbs->insert("permission", $ins_values); $dbs->insert("permission", $ins_values);
} }*/ // FIXME: GARBAGE
} }
catch (PDOException $e) { catch (PDOException $e) {
//oh noooz, the shard is offline! Put it in query queue at ams_lib db! //oh noooz, the shard is offline! Put it in query queue at ams_lib db!

@ -1,10 +1,6 @@
; This is a sample configuration file ; This is a sample configuration file
; Comments start with ';', as in php.ini ; Comments start with ';', as in php.ini
[install]
login_info = "Please enter your MySQL Username and Password to install the database.<br>This is being loaded because the is_installed file is missing.<br>This process will take about 30 seconds."
login_here = "here"
[ams_content] [ams_content]
ams_title="Ryzom Account Mangement System" ams_title="Ryzom Account Mangement System"
@ -17,19 +13,19 @@ home_info = "Welcome to the Ryzom Core - Account Management System"
[forgot_password] [forgot_password]
title = "Forgot your password?" title = "Forgot your password?"
forgot_password_message = "Fill in your account's emailaddress to reset the password!" forgot_password_message = "Fill in your account's email address to reset the password."
email_tag = "Email Address" email_tag = "Email Address"
email_tooltip = "The emailaddress related to the account of which you forgot the password." email_tooltip = "The email address related to the account of which you forgot the password."
email_default = "Email" email_default = "Email"
email_doesnt_exist = "That emailaddress doesn't match any user!" email_doesnt_exist = "The email address does not match any user."
email_sent = "An email with further instructions has been sent to the emailaddress!" email_sent = "An email with further instructions has been sent to the email address."
register_message ="<strong>Register</strong> If you don't have an account yet, create one " register_message ="<strong>Register</strong> If you don't have an account yet, create one "
here = "here" here = "here"
login_message = "You can always try to login by clicking " login_message = "You can always try to login by clicking "
[reset_password] [reset_password]
title = "Reset your password" title = "Reset your password"
reset_password_message = "Fill in your new password!" reset_password_message = "Fill in your new password."
password_tag = "Desired Password" password_tag = "Desired Password"
password_tooltip = "Pick a hard to guess password (it must be 5-20 characters)." password_tooltip = "Pick a hard to guess password (it must be 5-20 characters)."
@ -47,8 +43,8 @@ cpassword_default = "Re-enter Password"
syncing_title = "LibDB-Query List" syncing_title = "LibDB-Query List"
syncing_info = "Here you can see the entire list of elements in the LibDB-Query table. You can easily remove elements and by pressing 'Synchronize' you can start the syncing process manually!" syncing_info = "Here you can see the entire list of elements in the LibDB-Query table. You can easily remove elements and by pressing 'Synchronize' you can start the syncing process manually!"
syncing_sync = "Synchronize" syncing_sync = "Synchronize"
shard_online = "The shard seems to be <strong>online</strong>, manually syncing is possible: " shard_online = "The shard seems to be <strong>online</strong>, manually syncing is possible."
shard_offline = "The shard seems to be <strong>offline</strong>, manually syncing is not possible!" shard_offline = "The shard seems to be <strong>offline</strong>, manually syncing is not possible."
members = "Members" members = "Members"
id = "ID" id = "ID"
type = "Type" type = "Type"
@ -58,21 +54,21 @@ action = "Action"
[plugins] [plugins]
plugin_title = "Plugin List" plugin_title = "Plugin List"
plugin_info = "Here you can see the entire list of plugins . You can easily remove plugins ,activate them and add permissions" plugin_info = "Here you can see the entire list of plugins. You can easily remove plugins, activate them, and add permissions."
plugins = "Plugins" plugins = "Plugins"
plugin_name = "Name" plugin_name = "Name"
plugin_version = "Version" plugin_version = "Version"
plugin_description = "Description" plugin_description = "Description"
plugin_type = "Type" plugin_type = "Type"
plugin_permission = "Access</br> Permission" plugin_permission = "Access<br>Permission"
plugin_status = "Status" plugin_status = "Status"
ip_success = "Plugin added succesfuly." ip_success = "Plugin added succesfuly."
plugin_actions = "Actions" plugin_actions = "Actions"
dp_success = "Plugin deleted successfuly" dp_success = "Plugin deleted successfully"
dp_error = "Error in deleting plugin.Please try again later." dp_error = "Error in deleting plugin.Please try again later."
ac_success = "Plugin Activated successfuly." ac_success = "Plugin Activated successfully."
ac_error = "Plugin facing some error in activating. Please try again later." ac_error = "Plugin facing some error in activating. Please try again later."
dc_success = "Plugin de-Activated successfuly." dc_success = "Plugin de-Activated successfully."
dc_error = "Plugin facing some error in de-activating. Please try again later." dc_error = "Plugin facing some error in de-activating. Please try again later."
up_success = "Update added successfully. Go to Updates page for installing updates." up_success = "Update added successfully. Go to Updates page for installing updates."
up_install_success = "Update installed successfully." up_install_success = "Update installed successfully."
@ -99,42 +95,42 @@ title = "Title"
t_reply = "Reply on ticket" t_reply = "Reply on ticket"
t_fill = "Fill in your reply" t_fill = "Fill in your reply"
t_send = "Send reply" t_send = "Send reply"
invalid_sgroup = "Invalid support group!" invalid_sgroup = "Invalid support group."
ticket_not_existing = "That's an invalid ticket" ticket_not_existing = "That's an invalid ticket"
success_forwarded = "The ticket was forwarded successfully!" success_forwarded = "The ticket was forwarded successfully."
public_sgroup = "Public" public_sgroup = "Public"
not_assigned = "None" not_assigned = "None"
success_assigned = "The ticket was successfully assigned!" success_assigned = "The ticket was successfully assigned."
success_unassigned = "The ticket was successfully unassigned!" success_unassigned = "The ticket was successfully unassigned."
ticket_not_existing = "That ticket doesn't exist!" ticket_not_existing = "That ticket doesn't exist."
ticket_already_assigned = "That ticket is already assigned to someone!" ticket_already_assigned = "That ticket is already assigned to someone."
[show_user] [show_user]
[show_queue] [show_queue]
not_assigned = "Open" not_assigned = "Open"
success_assigned = "The ticket was successfully assigned!" success_assigned = "The ticket was successfully assigned."
success_unassigned = "The ticket was successfully unassigned!" success_unassigned = "The ticket was successfully unassigned."
ticket_not_existing = "That ticket doesn't exist!" ticket_not_existing = "That ticket doesn't exist."
ticket_already_assigned = "That ticket is already assigned to someone!" ticket_already_assigned = "That ticket is already assigned to someone."
ticket_not_assigned = "That ticket isn't assigned to you!" ticket_not_assigned = "That ticket isn't assigned to you."
public_sgroup = "Public" public_sgroup = "Public"
[show_sgroup] [show_sgroup]
add_to_group_success = "The user has been added to the group!" add_to_group_success = "The user has been added to the group."
user_already_added = "The user is already part of the group!" user_already_added = "The user is already part of the group."
group_not_existing = "The group doesn't exist!" group_not_existing = "The group doesn't exist."
user_not_existing = "The user doesn't seem to exist" user_not_existing = "The user doesn't seem to exist."
not_mod_or_admin = "You can only add Moderators or Admins!" not_mod_or_admin = "You can only add Moderators or Admins."
modify_mail_of_group_success = "The Support Group's email settings have been modified!" modify_mail_of_group_success = "The Support Group's email settings have been modified."
email_not_valid = "The group email address is invalid!" email_not_valid = "The group email address is invalid."
no_password_given = "Be aware that there was no password filled in, so the password is empty atm!" no_password_given = "Be aware that there was no password filled in, so the password is currently empty."
[sgroup_list] [sgroup_list]
group_success = "The group has been created!" group_success = "The group has been created."
group_name_taken = "The groupname was already used!" group_name_taken = "The groupname was already used."
group_tag_taken = "The tag was already used!" group_tag_taken = "The tag was already used."
group_size_error = "The name has to be between 4-20 chars and the tag between 2-4!" group_size_error = "The name has to be between 4-20 chars and the tag between 2-4."
[createticket] [createticket]
@ -157,34 +153,34 @@ group_size_error = "The name has to be between 4-20 chars and the tag between 2-
10= "added attachment" 10= "added attachment"
[error] [error]
title404 = "Not<br/>Found!" title404 = "Not<br/>Found"
title403 = "Forbidden!" title403 = "Forbidden"
error_message404 = "This is not the page you are looking for.." error_message404 = "This is not the page you are looking for."
error_message403 = "You cannot access this page!" error_message403 = "You cannot access this page."
go_home = "Go Home" go_home = "Go Home"
[userlist] [userlist]
userlist_info = "welcome to the userlist" userlist_info = "welcome to the userlist"
[login] [login]
login_info = "Please login with your Email/Username and Password." login_info = "Please login with your user name (or email) and password."
login_error_message = "The Email/username/password were not correct!" login_error_message = "Create a new account"
login_register_message ="<strong>Register</strong> If you don't have an account yet, create one" login_register_message ="<strong>Register</strong>"
login_here = "here" login_here = "I forgot my password"
login_forgot_password_message = "In case you forgot your password, click" login_forgot_password_message = ""
[logout] [logout]
logout_message = "You've been logged out successfully!" logout_message = "You've been logged out successfully."
login_title = "Login" login_title = "Login"
login_timer = "You will be redirected to the login page in " login_timer = "You will be redirected to the login page in "
login_text = "Or click here if you don't want to wait!" login_text = "Or click here if you don't want to wait."
[reset_success] [reset_success]
reset_success_message = "You've changed the password succesfully!" reset_success_message = "You've changed the password succesfully."
reset_success_title = "Login" reset_success_title = "Login"
reset_success_timer = "You will be redirected to the login page in " reset_success_timer = "You will be redirected to the login page in "
login_text = "Or click here if you don't want to wait!" login_text = "Or click here if you don't want to wait."
[register_feedback] [register_feedback]
@ -193,7 +189,7 @@ status_shardoffline = "It seems the shard is offline, you can use the web-accoun
status_liboffline = "You can't register an account at this time" status_liboffline = "You can't register an account at this time"
login_title = "Login" login_title = "Login"
login_timer = "You will be redirected to the login page in " login_timer = "You will be redirected to the login page in "
login_text = "Or click here if you don't want to wait!" login_text = "Click here if you do not want to wait."
[register] [register]
title = "RYZOM CORE INGAME REGISTRATION" title = "RYZOM CORE INGAME REGISTRATION"
@ -235,7 +231,7 @@ Reply Content:
" "
email_body_new_reply_4 = " email_body_new_reply_4 = "
-------------------- --------------------
You can reply on this message to answer directly on the ticket!" You can reply on this message to answer directly on the ticket."
;NEWTICKET ;NEWTICKET
;========================================================================== ;==========================================================================
@ -248,7 +244,7 @@ email_body_new_ticket_3 = " ,is newly created
" "
email_body_new_ticket_4 = " email_body_new_ticket_4 = "
---------- ----------
You can reply on this message to answer directly on the ticket!" You can reply on this message to answer directly on the ticket."
;WARNAUTHOR ;WARNAUTHOR
;========================================================================== ;==========================================================================
@ -258,19 +254,19 @@ email_body_warn_author_2 = " by sending an email from "
email_body_warn_author_3 = " ! Please use the email address matching to your account if you want to auto reply email_body_warn_author_3 = " ! Please use the email address matching to your account if you want to auto reply
If " If "
email_body_warn_author_4 = " isn't one of your email addresses, please contact us by replying to this ticket!" email_body_warn_author_4 = " isn't one of your email addresses, please contact us by replying to this ticket."
;WARNSENDER ;WARNSENDER
;========================================================================== ;==========================================================================
email_subject_warn_sender = "You tried to reply to someone elses ticket!" email_subject_warn_sender = "You tried to reply to someone elses ticket."
email_body_warn_sender = "It seems you tried to reply to someone elses ticket, please use the matching email address to that account! email_body_warn_sender = "It seems you tried to reply to someone elses ticket, please use the matching email address to that account!
This action is notified to the real ticket owner!" This action is notified to the real ticket owner!"
;WARNUNKNOWNENDER ;WARNUNKNOWNENDER
;========================================================================== ;==========================================================================
email_subject_warn_unknown_sender = "You tried to reply to someone's ticket!" email_subject_warn_unknown_sender = "You tried to reply to someone's ticket."
email_body_warn_unknown_sender = "It seems you tried to reply to someone's ticket, However this email address isn't linked to any account, please use the matching email address to that account! email_body_warn_unknown_sender = "It seems you tried to reply to someone's ticket, However this email address isn't linked to any account, please use the matching email address to that account.
This action is notified to the real ticket owner!" This action is notified to the real ticket owner!"
;=========================================================================== ;===========================================================================

@ -4,6 +4,10 @@
* @author Daan Janssens, mentored by Matthew Lagoe * @author Daan Janssens, mentored by Matthew Lagoe
*/ */
// WARNING: Do not modify this manually on your web server, it will be
// overwritten by the upgrade process. Instead, add overrides to the
// config_user.php file.
// Variables for database access to the www/CMS database (only if support role) // Variables for database access to the www/CMS database (only if support role)
$cfg['db']['web']['host'] = '%amsSqlHostname%'; $cfg['db']['web']['host'] = '%amsSqlHostname%';
$cfg['db']['web']['port'] = '3306'; $cfg['db']['web']['port'] = '3306';
@ -19,25 +23,25 @@ $cfg['db']['lib']['user'] = '%amsSqlUsername%';
$cfg['db']['lib']['pass'] = '%amsSqlPassword%'; $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'] = '%nelSqlHostname%'; $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'] = '%nelSqlUsername%'; $cfg['db']['shard']['user'] = '%nelSqlUsername%';
$cfg['db']['shard']['pass'] = '%nelSqlPassword%'; $cfg['db']['shard']['pass'] = '%nelSqlPassword%';
// Variables for database access to the ring_open database (only if domain role) // Variables for database access to the ring_open database (only if domain role)
// $cfg['db']['ring']['host'] = '%nelSqlHostname%'; $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'] = '%nelSqlUsername%'; $cfg['db']['ring']['user'] = '%nelSqlUsername%';
// $cfg['db']['ring']['pass'] = '%nelSqlPassword%'; $cfg['db']['ring']['pass'] = '%nelSqlPassword%';
// Variables for database access to the nel_tool database (only if service role) // Variables for database access to the nel_tool database (only if service role)
$cfg['db']['tool']['host'] = '%nelSqlHostname%'; $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'] = '%nelSqlUsername%'; $cfg['db']['tool']['user'] = '%nelSqlUsername%';
$cfg['db']['tool']['pass'] = '%nelSqlPassword%'; $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");
@ -50,21 +54,21 @@ $cfg['db']['tool']['pass'] = '%nelSqlPassword%';
// To connect to a remote server replace "localhost" with the name or the IP address of the server you want to connect to. // To connect to a remote server replace "localhost" with the name or the IP address of the server you want to connect to.
//$cfg['mail']['server'] = '{localhost:110/pop3/novalidate-cert}INBOX'; //$cfg['mail']['server'] = '{localhost:110/pop3/novalidate-cert}INBOX';
//imap connection string as explained above // IMAP connection string as explained above
$cfg['mail']['default_mailserver']= '{imap.gmail.com:993/imap/ssl}INBOX'; $cfg['mail']['default_mailserver']= '{imap.gmail.com:993/imap/ssl}INBOX';
//groupemail is the email that sends the email // The email address that sends the email
$cfg['mail']['default_groupemail'] = 'example@gmail.com'; $cfg['mail']['default_groupemail'] = 'support@ryzomcore.org';
//groupname will be the name displayed as sender // Name displayed as sender
$cfg['mail']['default_groupname'] = 'Ryzom Core Support'; $cfg['mail']['default_groupname'] = 'Ryzom Core Support';
//the username of the account // Username of the account
$cfg['mail']['default_username'] = 'example@gmail.com'; $cfg['mail']['default_username'] = 'support@ryzomcore.org';
//the matching password // Password of the account
$cfg['mail']['default_password'] = 'passw0rd'; $cfg['mail']['default_password'] = 'passw0rd';
//the host, being used when a mail is sent from a support group: support_groups_name@host // The host, being used when a mail is sent from a support group: support_groups_name@host
$cfg['mail']['host'] = "ryzomcore.com"; $cfg['mail']['host'] = "ryzomcore.org";
//Defines mailing related stuff //Defines mailing related stuff
$SUPPORT_GROUP_IMAP_CRYPTKEY = "azerty"; $SUPPORT_GROUP_IMAP_CRYPTKEY = '%cryptKeyIMAP%';
$TICKET_MAILING_SUPPORT = false; $TICKET_MAILING_SUPPORT = false;
//You have to create this dir at first! //You have to create this dir at first!
@ -76,16 +80,16 @@ $MAIL_LOG_PATH = "/home/username/mail/cron_mail.log";
$TOS_URL ="http://www.gnu.org/licenses/agpl-3.0.html"; $TOS_URL ="http://www.gnu.org/licenses/agpl-3.0.html";
//crypt is being used by encrypting & decrypting of the IMAP password of the supportgroups //crypt is being used by encrypting & decrypting of the IMAP password of the supportgroups
$cfg['crypt']['key'] = 'Sup3rS3cr3tStuff'; $cfg['crypt']['key'] = '%cryptKey%';
$cfg['crypt']['enc_method'] = 'AES-256-CBC'; $cfg['crypt']['enc_method'] = 'AES-256-CBC';
$cfg['crypt']['hash_method'] = "SHA512"; $cfg['crypt']['hash_method'] = "SHA512";
//----------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------
// If true= the server will add automatically unknown user in the database // If true, the server will add automatically unknown user in the database
// (in nel.user= nel.permission= ring.ring_user and ring.characters // (in nel.user, nel.permission, ring.ring_user and ring.characters
$ALLOW_UNKNOWN = true ; $ALLOW_UNKNOWN = false;
// if true= the login service automaticaly create a ring user and a editor character if needed // If true, the login service automaticaly create a ring user and a editor character if needed
$CREATE_RING = true ; $CREATE_RING = true;
// PHP server paths // PHP server paths
$PUBLIC_PHP_PATH = "%publicPhpDirectory%"; $PUBLIC_PHP_PATH = "%publicPhpDirectory%";
@ -100,29 +104,29 @@ $AMS_TMPDIR = $AMS_LIB . '/tmp';
// Here your inc and func resides // Here your inc and func resides
$SITEBASE = $PUBLIC_PHP_PATH . '/ams/' ; $SITEBASE = $PUBLIC_PHP_PATH . '/ams/' ;
//the paths to your website url // The paths to your website url
$BASE_WEBPATH = '/ams/'; $BASE_WEBPATH = '/ams/';
$IMAGELOC_WEBPATH = $BASE_WEBPATH . 'img'; $IMAGELOC_WEBPATH = $BASE_WEBPATH . 'img';
$WEBPATH = $BASE_WEBPATH . 'index.php'; $WEBPATH = $BASE_WEBPATH . 'index.php';
$INGAME_WEBPATH = $BASE_WEBPATH . 'index.php'; $INGAME_WEBPATH = $BASE_WEBPATH . 'index.php';
$CONFIG_PATH = $PUBLIC_PHP_PATH; $CONFIG_PATH = $PUBLIC_PHP_PATH;
//defines the default language // Defines the default language
$DEFAULT_LANGUAGE = 'en'; $DEFAULT_LANGUAGE = 'en';
//defines if logging actions should happen or not. // Defines if logging actions should happen or not.
$TICKET_LOGGING = true; $TICKET_LOGGING = true;
//defines the time format display // Defines the time format display
$TIME_FORMAT = "m-d-Y H:i:s"; $TIME_FORMAT = "m-d-Y H:i:s";
//defines which ingame layout template should be used // Defines which ingame layout template should be used
$INGAME_LAYOUT = "basic"; $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 (must be a publicly accessible url)
$FILE_STORAGE_PATH = $PUBLIC_PHP_PATH . '/ams/files/'; $FILE_STORAGE_PATH = $PUBLIC_PHP_PATH . '/ams/files/';
$FILE_WEB_PATH = $BASE_WEBPATH . 'files/'; $FILE_WEB_PATH = $BASE_WEBPATH . 'files/';
@ -131,3 +135,14 @@ $NEL_SETUP_PASSWORD = '%nelSetupPassword%';
// Name of current domain (only if domain role) // Name of current domain (only if domain role)
$NEL_DOMAIN_NAME = '%nelDomainName%'; $NEL_DOMAIN_NAME = '%nelDomainName%';
// Currently configured setup version
$NEL_SETUP_VERSION_CONFIGURED = %nelSetupVersion%;
// Get installed version
require_once('setup/version.php');
// Override user parameters
require_once('config_user.php');
/* end of file */

@ -0,0 +1,18 @@
<?php
// Add overrides for config.php into this file
// IMAP connection string as explained above
//$cfg['mail']['default_mailserver']= '{imap.gmail.com:993/imap/ssl}INBOX';
// The email address that sends the email
//$cfg['mail']['default_groupemail'] = 'support@ryzomcore.org';
// Name displayed as sender
//$cfg['mail']['default_groupname'] = 'Ryzom Core Support';
// Username of the account
//$cfg['mail']['default_username'] = 'support@ryzomcore.org';
// Password of the account
//$cfg['mail']['default_password'] = 'passw0rd';
// The host, being used when a mail is sent from a support group: support_groups_name@host
//$cfg['mail']['host'] = "ryzomcore.org";
/* end of file */

@ -0,0 +1,5 @@
ALTER TABLE `permission` CHANGE `ClientApplication` `ClientApplication` CHAR( 64 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ;
ALTER TABLE `permission` DROP `prim` ;
ALTER TABLE `permission` ADD `PermissionId` INT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST ;
ALTER TABLE `permission` ADD `DomainId` INT NOT NULL DEFAULT '-1' AFTER `UId` ;
ALTER TABLE `permission` DROP `ClientApplication` ;

@ -0,0 +1,6 @@
ALTER TABLE `shard` DROP `prim` ;
ALTER TABLE `shard` ADD PRIMARY KEY ( `ShardId` ) ;
ALTER TABLE `shard` DROP `PatchURL` ;
ALTER TABLE `shard` DROP `DynPatchURL` ;
ALTER TABLE `shard` DROP `ClientApplication` ;

@ -8,6 +8,9 @@
require_once('config.php'); require_once('config.php');
if (isset($NEL_SETUP_SESSION) && ($NEL_SETUP_SESSION))
define('NELTOOL_NO_USER_NEEDED', true);
require_once(NELTOOL_SYSTEMBASE .'functions_common.php'); require_once(NELTOOL_SYSTEMBASE .'functions_common.php');
require_once(NELTOOL_SYSTEMBASE .'functions_auth.php'); require_once(NELTOOL_SYSTEMBASE .'functions_auth.php');

@ -47,7 +47,7 @@
return null; return null;
} }
function nt_auth_check_login($user,$passwd) function nt_auth_check_login($user, $passwd)
{ {
global $db; global $db;
@ -71,53 +71,65 @@
{ {
global $tpl; global $tpl;
$tpl->assign('tool_login_title','Login'); $tpl->assign('tool_login_title', 'Login');
$tpl->display('index_login.tpl'); $tpl->display('index_login.tpl');
} }
function nt_auth_start_session() function nt_auth_start_session()
{ {
global $NEL_SETUP_SESSION;
if (isset($NEL_SETUP_SESSION) && ($NEL_SETUP_SESSION))
{
return;
}
session_name(NELTOOL_SESSIONID); session_name(NELTOOL_SESSIONID);
session_cache_limiter('nocache'); session_cache_limiter('nocache');
session_start(); session_start();
header("Expires: Mon, 01 May 2000 06:00:00 GMT"); header("Expires: Mon, 01 May 2000 06:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Last-Modified: ". gmdate("D, d M Y H:i:s") ." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false); header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); header("Pragma: no-cache");
} }
function nt_auth_stop_session() function nt_auth_stop_session()
{ {
global $NEL_SETUP_SESSION;
if (isset($NEL_SETUP_SESSION) && ($NEL_SETUP_SESSION))
{
return;
}
global $NELTOOL; global $NELTOOL;
foreach($NELTOOL['SESSION_VARS'] as $key => $val) foreach($NELTOOL['SESSION_VARS'] as $key => $val)
{ {
unset($NELTOOL['SESSION_VARS'][$key]); unset($NELTOOL['SESSION_VARS'][$key]);
} }
} }
function nt_auth_set_session_var($name,$value) function nt_auth_set_session_var($name, $value)
{ {
global $NELTOOL; global $NELTOOL;
$NELTOOL['SESSION_VARS'][$name] = $value; $NELTOOL['SESSION_VARS'][$name] = $value;
} }
function nt_auth_get_session_var($name) function nt_auth_get_session_var($name)
{ {
global $NELTOOL; global $NELTOOL;
if (isset($NELTOOL['SESSION_VARS'][$name])) return $NELTOOL['SESSION_VARS'][$name]; if (isset($NELTOOL['SESSION_VARS'][$name])) return $NELTOOL['SESSION_VARS'][$name];
return null; return null;
} }
function nt_auth_unset_session_var($name) function nt_auth_unset_session_var($name)
{ {
global $NELTOOL; global $NELTOOL;
unset($NELTOOL['SESSION_VARS'][$name]); unset($NELTOOL['SESSION_VARS'][$name]);
} }
?> ?>

@ -0,0 +1,32 @@
<?php
// This file contains all variables needed by other php scripts
require_once('../config.php');
$LogRelativePath = 'logs/';
// ----------------------------------------------------------------------------------------
// Variables for nel database access
// ----------------------------------------------------------------------------------------
if ($cfg['db']['shard']['host'] != $cfg['db']['ring']['host'])
throw new Exception("Invalid configuration");
// where we can find the mysql database
$DBHost = $cfg['db']['shard']['host'];
$DBUserName = $cfg['db']['shard']['user'];
$DBPassword = $cfg['db']['shard']['pass'];
$DBName = $cfg['db']['shard']['name'];
$RingDBUserName = $cfg['db']['ring']['user'];
$RingDBPassword = $cfg['db']['ring']['pass'];
$RingDBName = $cfg['db']['ring']['name'];
// If true, the server will add automatically unknown user in the database
// (in nel.user, nel.permission, ring.ring_user and ring.characters
$AcceptUnknownUser = $ALLOW_UNKNOWN;
// If true, the login service automaticaly create a ring user and a editor character if needed
$AutoCreateRingInfo = $CREATE_RING;
?>

@ -176,7 +176,6 @@
// if we need to create missing ring info // if we need to create missing ring info
if ($AutoCreateRingInfo) if ($AutoCreateRingInfo)
{ {
////////////// Temporary code alpha 0 only /////////////////////////////////////
// check if the ring user exist, and create it if not // check if the ring user exist, and create it if not
$ringDb = mysqli_connect($DBHost, $RingDBUserName, $RingDBPassword) or die(errorMsgBlock(3004, 'Ring', $DBHost, $RingDBUserName)); $ringDb = mysqli_connect($DBHost, $RingDBUserName, $RingDBPassword) or die(errorMsgBlock(3004, 'Ring', $DBHost, $RingDBUserName));
mysqli_select_db ($ringDb, $domainInfo['ring_db_name']) or die(errorMsgBlock(3005, 'Ring', $domainInfo['ring_db_name'], $DBHost, $RingDBUserName)); mysqli_select_db ($ringDb, $domainInfo['ring_db_name']) or die(errorMsgBlock(3005, 'Ring', $domainInfo['ring_db_name'], $DBHost, $RingDBUserName));
@ -190,17 +189,6 @@
$query = "INSERT INTO ring_users SET user_id = '$id', user_name = '$login', user_type='ut_pioneer'"; $query = "INSERT INTO ring_users SET user_id = '$id', user_name = '$login', user_type='ut_pioneer'";
$result = mysqli_query ($ringDb, $query) or die(errorMsgBlock(3006, $query, 'Ring', $domainInfo['ring_db_name'], $DBHost, $RingDBUserName, mysqli_error($ringDb))); $result = mysqli_query ($ringDb, $query) or die(errorMsgBlock(3006, $query, 'Ring', $domainInfo['ring_db_name'], $DBHost, $RingDBUserName, mysqli_error($ringDb)));
} }
// // check that there is a character record (deprecated)
// $query = "SELECT user_id FROM characters where user_id = '".$id."'";
// $result = mysqli_query ($ringDb, $query) or die("Query ".$query." failed");
// if (mysqli_num_rows($result) == 0)
// {
// // no characters record, build a default one
// $charId = ($id * 16);
// $query = "INSERT INTO characters SET char_id='".$charId."', char_name='".$_GET["login"]."_default', user_id = '".$id."'";
// $result = mysqli_query ($ringDb, $query) or die("Query ".$query." failed");
// }
} }
// // check domain status // // check domain status
@ -324,7 +312,7 @@
$extended = $row["ExtendedPrivilege"]; $extended = $row["ExtendedPrivilege"];
// add the default permission // add the default permission
$query = "INSERT INTO permission (UId, ClientApplication, AccessPrivilege) VALUES ('$id', 'r2', '$accessPriv')"; $query = "INSERT INTO permission (UId, DomainId, AccessPrivilege) VALUES ('$id', '$domainId', '$accessPriv')";
$result = mysqli_query ($link, $query) or die (errorMsgBlock(3006, $query, 'main', $DBName, $DBHost, $DBUserName, mysqli_error($link))); $result = mysqli_query ($link, $query) or die (errorMsgBlock(3006, $query, 'main', $DBName, $DBHost, $DBUserName, mysqli_error($link)));
$res = false; $res = false;
@ -338,40 +326,6 @@
else else
{ {
$reason = errorMsg(2001, $login, 'checkUserValidity'); $reason = errorMsg(2001, $login, 'checkUserValidity');
// Check if this is not an unconfirmed account
/*
$query = "SELECT GamePassword, Email, Language FROM signup_data WHERE login='$login'";
$result = mysqli_query($link, $query) or die (errorMsgBlock(3006, $query, 'main', $DBName, $DBHost, $DBUserName, mysqli_error($link)));
if (mysqli_num_rows($result) == 0)
{
$reason = errorMsg(2001, $login, 'checkUserValidity');
$res = false;
}
else
{
// Check password to avoid revealing email address to third-party
$passwordMatchedRow = false;
while ($row = mysqli_fetch_assoc($result))
{
$salt = substr($row['GamePassword'],0,2);
if (($cp && $row['GamePassword'] == $password) || (!$cp && $row['GamePassword'] == crypt($password, $salt)))
{
$passwordMatchedRow = $row;
break;
}
}
if ($passwordMatchedRow !== false)
{
if ($lang == 'unknown')
setMsgLanguage($passwordMatchedRow['Language']);
$reason = errorMsg(2002, $passwordMatchedRow['Email']);
}
else
$reason = errorMsg(2004, 'db signup_data');
$res = false;
}
*/
} }
} }
else else
@ -385,14 +339,14 @@
// check if the user can use this application // check if the user can use this application
$clientApplication = mysqli_real_escape_string($link, $clientApplication); $clientApplication = mysqli_real_escape_string($link, $clientApplication);
$query = "SELECT * FROM permission WHERE UId='".$row["UId"]."' AND ClientApplication='$clientApplication'"; $query = "SELECT * FROM permission WHERE UId='".$row["UId"]."' AND DomainId='$domainId'";
$result = mysqli_query ($link, $query) or die (errorMsgBlock(3006, $query, 'main', $DBName, $DBHost, $DBUserName, mysqli_error($link))); $result = mysqli_query ($link, $query) or die (errorMsgBlock(3006, $query, 'main', $DBName, $DBHost, $DBUserName, mysqli_error($link)));
if (mysqli_num_rows ($result) == 0) if (mysqli_num_rows ($result) == 0)
{ {
if ($AcceptUnknownUser) if ($AcceptUnknownUser)
{ {
// add default permission // add default permission
$query = "INSERT INTO permission (UId, ClientApplication, ShardId, AccessPrivilege) VALUES ('".$row["UId"]."', '$clientApplication', -1, '$domainStatus')"; $query = "INSERT INTO permission (UId, DomainId, ShardId, AccessPrivilege) VALUES ('".$row["UId"]."', '$domainId', -1, '$domainStatus')";
$result = mysqli_query ($link, $query) or die (errorMsgBlock(3006, $query, 'main', $DBName, $DBHost, $DBUserName, mysqli_error($link))); $result = mysqli_query ($link, $query) or die (errorMsgBlock(3006, $query, 'main', $DBName, $DBHost, $DBUserName, mysqli_error($link)));
$reason = errorMsg(3010); $reason = errorMsg(3010);
@ -416,7 +370,7 @@
if ($AcceptUnknownUser) if ($AcceptUnknownUser)
{ {
// set an additionnal privilege for this player // set an additionnal privilege for this player
$query = "UPDATE permission set AccessPrivilege='".$permission['AccessPrivilege'].",$accessPriv' WHERE prim=".$permission['prim']; $query = "UPDATE permission set AccessPrivilege='".$permission['AccessPrivilege'].",$accessPriv' WHERE PermissionId=".$permission['PermissionId'];
$result = mysqli_query ($link, $query) or die (errorMsgBlock(3006, $query, 'main', $DBName, $DBHost, $DBUserName, mysqli_error($link))); $result = mysqli_query ($link, $query) or die (errorMsgBlock(3006, $query, 'main', $DBName, $DBHost, $DBUserName, mysqli_error($link)));
$reason = errorMsg(3012, $accessPriv); $reason = errorMsg(3012, $accessPriv);

@ -57,6 +57,14 @@ function upgrade_service_databases($continue_r) {
$continue = update_database_structure($continue, $con, "nel_00001.sql"); $continue = update_database_structure($continue, $con, "nel_00001.sql");
$continue = set_db_version($continue, "shard", 1); $continue = set_db_version($continue, "shard", 1);
} }
if ($continue && get_db_version("shard") < 2) {
$continue = update_database_structure($continue, $con, "nel_00002.sql");
$continue = set_db_version($continue, "shard", 2);
}
if ($continue && get_db_version("shard") < 3) {
$continue = update_database_structure($continue, $con, "nel_00003.sql");
$continue = set_db_version($continue, "shard", 3);
}
disconnect_database($con, "shard"); disconnect_database($con, "shard");
$con = null; $con = null;

@ -1,5 +1,6 @@
<?php <?php
$NEL_SETUP_SESSION = true;
if (file_exists( '../config.php')) { if (file_exists( '../config.php')) {
session_start(); session_start();
if ((!isset($_SESSION['nelSetupAuthenticated'])) || $_SESSION['nelSetupAuthenticated'] != 1) { if ((!isset($_SESSION['nelSetupAuthenticated'])) || $_SESSION['nelSetupAuthenticated'] != 1) {

@ -24,9 +24,9 @@ include('header.php');
<a class="btn btn-default" style="width: 100%;" href="domain.php"><span class="glyphicon glyphicon-globe"></span> Add Domain</a> <a class="btn btn-default" style="width: 100%;" href="domain.php"><span class="glyphicon glyphicon-globe"></span> Add Domain</a>
</p>--> </p>-->
<p> <!--<p>
<a class="btn btn-default" style="width: 100%;" href="upgrade.php"><span class="glyphicon glyphicon-tower"></span> Add Shard</a> <a class="btn btn-default" style="width: 100%;" href="upgrade.php"><span class="glyphicon glyphicon-tower"></span> Add Shard</a>
</p> </p>-->
<?php } ?> <?php } ?>

@ -34,6 +34,13 @@ include('header.php');
$continue = false; $continue = false;
} }
if ($continue) {
if (!extension_loaded('mcrypt')) {
printalert("danger", "The mcrypt extension is missing. Please check your PHP configuration");
$continue = false;
}
}
// Validate basics // Validate basics
if ($continue) { if ($continue) {
if (file_exists($_POST["privatePhpDirectory"])) { if (file_exists($_POST["privatePhpDirectory"])) {
@ -136,6 +143,11 @@ include('header.php');
$config = str_replace("%nelSetupPassword%", addslashes($_POST["nelSetupPassword"]), $config); $config = str_replace("%nelSetupPassword%", addslashes($_POST["nelSetupPassword"]), $config);
$config = str_replace("%domainDatabase%", addslashes($_POST["domainDatabase"]), $config); $config = str_replace("%domainDatabase%", addslashes($_POST["domainDatabase"]), $config);
$config = str_replace("%nelDomainName%", addslashes($_POST["nelDomainName"]), $config); $config = str_replace("%nelDomainName%", addslashes($_POST["nelDomainName"]), $config);
$cryptKeyLength = 16;
$cryptKey = str_replace("=", "", base64_encode(mcrypt_create_iv(ceil(0.75 * $cryptKeyLength), MCRYPT_DEV_URANDOM)));
$cryptKeyIMAP = str_replace("=", "", base64_encode(mcrypt_create_iv(ceil(0.75 * $cryptKeyLength), MCRYPT_DEV_URANDOM)));
$config = str_replace("%cryptKey%", addslashes($cryptKey), $config);
$config = str_replace("%cryptKeyIMAP%", addslashes($cryptKeyIMAP), $config);
if (file_put_contents("config.php", $config)) { if (file_put_contents("config.php", $config)) {
printalert("success", "Generated <em>config.php</em>"); printalert("success", "Generated <em>config.php</em>");
} else { } else {
@ -145,6 +157,21 @@ include('header.php');
} }
} }
if ($continue) {
$configUser = file_get_contents($_POST["privatePhpDirectory"] . "/setup/config/config_user.php");
if (!$configUser) {
printalert("danger", "Cannot read <em>config_user.php</em>");
$continue = false;
} else {
if (file_put_contents("config_user.php", $configUser)) {
printalert("success", "Copied <em>config_user.php</em>");
} else {
printalert("danger", "Cannot write to <em>config.php</em>");
$continue = false;
}
}
}
// Load config // Load config
if ($continue) { if ($continue) {
try { try {

@ -10,6 +10,10 @@ $pageTitle = "Upgrade";
include('header.php'); include('header.php');
require_once('config.php'); require_once('config.php');
require_once('setup/version.php');
if (!isset($NEL_SETUP_VERSION_CONFIGURED)) {
$NEL_SETUP_VERSION_CONFIGURED = 1;
}
?> ?>
@ -19,6 +23,31 @@ require_once('config.php');
<?php <?php
// NOTE: If a config upgrade requires new information, modify the
// upgrade confirmation form at the bottom of this script.
require_once('database.php');
if ($continue) {
if (!extension_loaded('mcrypt')) {
printalert("danger", "The mcrypt extension is missing. Please check your PHP configuration");
$continue = false;
}
}
if (file_exists("role_support")) {
$continue = upgrade_support_databases($continue);
}
if (file_exists("role_service")) {
$continue = upgrade_service_databases($continue);
}
if (file_exists("role_domain")) {
$continue = upgrade_domain_databases($continue);
}
// Rewrite config.php
if ($continue) { if ($continue) {
$config = file_get_contents($PRIVATE_PHP_PATH . "/setup/config/config.php"); $config = file_get_contents($PRIVATE_PHP_PATH . "/setup/config/config.php");
if (!$config) { if (!$config) {
@ -39,8 +68,15 @@ require_once('config.php');
$config = str_replace("%amsDatabase%", addslashes($cfg['db']['web']['name']), $config); $config = str_replace("%amsDatabase%", addslashes($cfg['db']['web']['name']), $config);
$config = str_replace("%amsLibDatabase%", addslashes($cfg['db']['lib']['name']), $config); $config = str_replace("%amsLibDatabase%", addslashes($cfg['db']['lib']['name']), $config);
$config = str_replace("%nelSetupPassword%", addslashes($NEL_SETUP_PASSWORD), $config); $config = str_replace("%nelSetupPassword%", addslashes($NEL_SETUP_PASSWORD), $config);
// $config = str_replace("%domainDatabase%", addslashes($_POST["domainDatabase"]), $config); // TODO
$config = str_replace("%nelDomainName%", addslashes($NEL_DOMAIN_NAME), $config); $config = str_replace("%nelDomainName%", addslashes($NEL_DOMAIN_NAME), $config);
$config = str_replace("%nelSetupVersion%", addslashes($NEL_SETUP_VERSION), $config);
$config = str_replace("%cryptKey%", addslashes($cfg['crypt']['key']), $config);
$config = str_replace("%cryptKeyIMAP%", addslashes($SUPPORT_GROUP_IMAP_CRYPTKEY), $config);
if ($NEL_SETUP_VERSION_CONFIGURED < 2) {
$config = str_replace("%domainDatabase%", "mini01", $config);
} else {
$config = str_replace("%domainDatabase%", addslashes($cfg['db']['ring']['name']), $config);
}
if (file_put_contents("config.php", $config)) { if (file_put_contents("config.php", $config)) {
printalert("success", "Generated <em>config.php</em>"); printalert("success", "Generated <em>config.php</em>");
} else { } else {
@ -50,18 +86,24 @@ require_once('config.php');
} }
} }
require_once('database.php'); // Create config_user.php if it doesn't exist yet
if ($continue && !file_exists("config_user.php")) {
if (file_exists("role_support")) { $configUser = file_get_contents($PRIVATE_PHP_PATH . "/setup/config/config_user.php");
$continue = upgrade_support_databases($continue); if (!$configUser) {
} printalert("danger", "Cannot read <em>config_user.php</em>");
$continue = false;
if (file_exists("role_service")) { } else {
$continue = upgrade_service_databases($continue); if (file_put_contents("config_user.php", $configUser)) {
printalert("success", "Copied <em>config_user.php</em>");
} else {
printalert("danger", "Cannot write to <em>config.php</em>");
$continue = false;
}
}
} }
if (file_exists("role_domain")) { if ($continue) {
$continue = upgrade_domain_databases($continue); printalert("success", "Upgrade complete");
} }
?> ?>
@ -70,7 +112,7 @@ require_once('config.php');
<a class="btn btn-primary" href="index.php">Continue</a> <a class="btn btn-primary" href="index.php">Continue</a>
</p> </p>
<?php } else { ?> <?php } else { // NOTE: This is where you may also ask for new configuration fields ?>
<div class="panel panel-danger"> <div class="panel panel-danger">
<div class="panel-heading"><span class="glyphicon glyphicon-hdd"></span> Backup</div> <div class="panel-heading"><span class="glyphicon glyphicon-hdd"></span> Backup</div>

@ -0,0 +1,6 @@
<?php
// Increment whenever a web upgrade is required.
$NEL_SETUP_VERSION = 2;
/* end of file */

@ -1,27 +0,0 @@
<?php
// This file contains all variables needed by other php scripts
$LogRelativePath = 'logs/';
// ----------------------------------------------------------------------------------------
// Variables for nel database access
// ----------------------------------------------------------------------------------------
// where we can find the mysql database
$DBHost = "localhost";
$DBUserName = "shard";
$DBPassword = "";
$DBName = "nel";
$RingDBUserName = "shard";
$RingDBName = "ring_open";
$RingDBPassword = "";
// If true, the server will add automatically unknown user in the database
// (in nel.user, nel.permission, ring.ring_user and ring.characters
$AcceptUnknownUser = false;
// if true, the login service automaticaly create a ring user and a editor character if needed
$AutoCreateRingInfo = true;
?>
Loading…
Cancel
Save