diff --git a/code/ryzom/common/src/game_share/generate_module_interface.xslt b/code/ryzom/common/src/game_share/generate_module_interface.xslt
index 425e699a4..ee87f6ae4 100644
--- a/code/ryzom/common/src/game_share/generate_module_interface.xslt
+++ b/code/ryzom/common/src/game_share/generate_module_interface.xslt
@@ -28,9 +28,7 @@
#ifndef
#define
#include "nel/misc/types_nl.h"
-#ifdef NL_COMP_VC8
- #include <memory>
-#endif
+#include <memory>
#include "nel/misc/hierarchical_timer.h"
#include "nel/misc/string_conversion.h"
#include "nel/net/message.h"
@@ -45,7 +43,7 @@
#include "nel/misc/string_common.h"
-#include "game_share/mysql_wrapper.h"
+#include "server_share/mysql_wrapper.h"
#include "game_share/synchronised_message.h"
diff --git a/code/ryzom/server/src/shard_unifier_service/nel_database_mapping.cpp b/code/ryzom/server/src/shard_unifier_service/nel_database_mapping.cpp
index 25cf56504..9e81798dc 100644
--- a/code/ryzom/server/src/shard_unifier_service/nel_database_mapping.cpp
+++ b/code/ryzom/server/src/shard_unifier_service/nel_database_mapping.cpp
@@ -1,18 +1,3 @@
-// Ryzom - MMORPG Framework
-// 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 .
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
@@ -99,7 +84,7 @@ namespace RSMGR
{
nlwarning("ERROR : someone try to delete this object, but there are still ptr on it !");
CNelUserPtr *ptr = _PtrList;
- do
+ do
{
nlwarning(" Pointer created from '%s', line %u", ptr->_FileName, ptr->_LineNum);
ptr = _PtrList->getNextPtr();
@@ -107,7 +92,7 @@ namespace RSMGR
nlstop;
}
// remove object from cache map
- if (_UserId != NOPE::INVALID_OBJECT_ID
+ if (_UserId != NOPE::INVALID_OBJECT_ID
&& _ObjectState != NOPE::os_removed
&& _ObjectState != NOPE::os_transient)
{
@@ -318,7 +303,7 @@ namespace RSMGR
}
else if (cmd == NOPE::cc_instance_count)
{
- return (uint32)_ObjectCache.size();
+ return _ObjectCache.size();
}
// default return value
@@ -336,7 +321,7 @@ namespace RSMGR
TReleasedObject::iterator first(_ReleasedObject.begin()), last(_ReleasedObject.end());
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);
@@ -424,7 +409,7 @@ namespace RSMGR
if(_ObjectState == NOPE::os_released && state == NOPE::os_removed)
{
// a release object gets removed (e.g. by remove by id)
-
+
// delete the object
delete this;
@@ -578,7 +563,7 @@ namespace RSMGR
{
nlwarning("ERROR : someone try to delete this object, but there are still ptr on it !");
CNelPermissionPtr *ptr = _PtrList;
- do
+ do
{
nlwarning(" Pointer created from '%s', line %u", ptr->_FileName, ptr->_LineNum);
ptr = _PtrList->getNextPtr();
@@ -586,16 +571,16 @@ namespace RSMGR
nlstop;
}
// remove object from cache map
- if (_Prim != NOPE::INVALID_OBJECT_ID
+ if (_PermissionId != NOPE::INVALID_OBJECT_ID
&& _ObjectState != NOPE::os_removed
&& _ObjectState != NOPE::os_transient)
{
- nldebug("NOPE: clearing CNelPermission @%p from cache with id %u", this, static_cast(_Prim));
- nlverify(_ObjectCache.erase(_Prim) == 1);
+ nldebug("NOPE: clearing CNelPermission @%p from cache with id %u", this, static_cast(_PermissionId));
+ nlverify(_ObjectCache.erase(_PermissionId) == 1);
}
else if (_ObjectState != NOPE::os_transient)
{
- nlassert(_ObjectCache.find(_Prim) == _ObjectCache.end());
+ nlassert(_ObjectCache.find(_PermissionId) == _ObjectCache.end());
}
if (_ObjectState == NOPE::os_released)
{
@@ -626,18 +611,18 @@ namespace RSMGR
{
nlassert(getPersistentState() == NOPE::os_transient);
- nlassert(_Prim != 0);
+ nlassert(_PermissionId != 0);
std::string qs;
qs = "INSERT INTO permission (";
- qs += "prim, UId, ClientApplication, ShardId, AccessPrivilege";
+ qs += "PermissionId, UId, DomainId, ShardId, AccessPrivilege";
qs += ") VALUES (";
- qs += "'"+MSW::escapeString(NLMISC::toString(_Prim), connection)+"'";
+ qs += "'"+MSW::escapeString(NLMISC::toString(_PermissionId), connection)+"'";
qs += ", ";
qs += "'"+MSW::escapeString(NLMISC::toString(_UserId), connection)+"'";
qs += ", ";
- qs += "'"+MSW::escapeString(NLMISC::toString(_DomainName), connection)+"'";
+ qs += "'"+MSW::escapeString(NLMISC::toString(_DomainId), connection)+"'";
qs += ", ";
qs += "'"+MSW::escapeString(NLMISC::toString(_ShardId), connection)+"'";
qs += ", ";
@@ -670,17 +655,17 @@ namespace RSMGR
std::string qs;
qs = "UPDATE permission SET ";
- qs += "prim = '"+MSW::escapeString(NLMISC::toString(_Prim), connection)+"'";
+ qs += "PermissionId = '"+MSW::escapeString(NLMISC::toString(_PermissionId), connection)+"'";
qs += ", ";
qs += "UId = '"+MSW::escapeString(NLMISC::toString(_UserId), connection)+"'";
qs += ", ";
- qs += "ClientApplication = '"+MSW::escapeString(NLMISC::toString(_DomainName), connection)+"'";
+ qs += "DomainId = '"+MSW::escapeString(NLMISC::toString(_DomainId), connection)+"'";
qs += ", ";
qs += "ShardId = '"+MSW::escapeString(NLMISC::toString(_ShardId), connection)+"'";
qs += ", ";
qs += "AccessPrivilege = '"+MSW::escapeString(NLMISC::toString(_AccessPriv), connection)+"'";
- qs += " WHERE prim = '"+NLMISC::toString(_Prim)+"'";
+ qs += " WHERE PermissionId = '"+NLMISC::toString(_PermissionId)+"'";
if (connection.query(qs))
@@ -702,7 +687,7 @@ namespace RSMGR
std::string qs;
qs = "DELETE FROM permission ";
- qs += " WHERE prim = '"+NLMISC::toString(_Prim)+"'";
+ qs += " WHERE PermissionId = '"+NLMISC::toString(_PermissionId)+"'";
if (connection.query(qs))
@@ -736,7 +721,7 @@ namespace RSMGR
std::string qs;
qs = "DELETE FROM permission ";
- qs += " WHERE prim = '"+NLMISC::toString(id)+"'";
+ qs += " WHERE PermissionId = '"+NLMISC::toString(id)+"'";
if (connection.query(qs))
@@ -796,7 +781,7 @@ namespace RSMGR
}
else if (cmd == NOPE::cc_instance_count)
{
- return (uint32)_ObjectCache.size();
+ return _ObjectCache.size();
}
// default return value
@@ -814,7 +799,7 @@ namespace RSMGR
TReleasedObject::iterator first(_ReleasedObject.begin()), last(_ReleasedObject.end());
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);
@@ -902,7 +887,7 @@ namespace RSMGR
if(_ObjectState == NOPE::os_released && state == NOPE::os_removed)
{
// a release object gets removed (e.g. by remove by id)
-
+
// delete the object
delete this;
@@ -912,12 +897,12 @@ namespace RSMGR
if (_ObjectState == NOPE::os_transient && state != NOPE::os_transient)
{
- nldebug("NOPE: inserting CNelPermission @%p in cache with id %u", this, static_cast(_Prim));
- nlverify(_ObjectCache.insert(std::make_pair(_Prim, this)).second);
+ nldebug("NOPE: inserting CNelPermission @%p in cache with id %u", this, static_cast(_PermissionId));
+ nlverify(_ObjectCache.insert(std::make_pair(_PermissionId, this)).second);
}
if (_ObjectState != NOPE::os_transient)
- nlassert(_ObjectCache.find(_Prim) != _ObjectCache.end());
+ nlassert(_ObjectCache.find(_PermissionId) != _ObjectCache.end());
_ObjectState = state;
@@ -928,8 +913,8 @@ namespace RSMGR
}
else if (state == NOPE::os_removed)
{
- nldebug("NOPE: erasing CNelPermission @%p in cache with id %u", this, static_cast(_Prim));
- nlverify(_ObjectCache.erase(_Prim) == 1);
+ nldebug("NOPE: erasing CNelPermission @%p in cache with id %u", this, static_cast(_PermissionId));
+ nlverify(_ObjectCache.erase(_PermissionId) == 1);
}
}
@@ -945,11 +930,11 @@ namespace RSMGR
std::string qs;
qs = "SELECT ";
- qs += "prim, UId, ClientApplication, ShardId, AccessPrivilege";
+ qs += "PermissionId, UId, DomainId, ShardId, AccessPrivilege";
qs += " FROM permission";
- qs += " WHERE prim = '"+NLMISC::toString(id)+"'";
+ qs += " WHERE PermissionId = '"+NLMISC::toString(id)+"'";
CNelPermissionPtr ret;
if (!connection.query(qs))
{
@@ -965,9 +950,9 @@ namespace RSMGR
// ok, we have an object
result->fetchRow();
- result->getField(0, ret->_Prim);
+ result->getField(0, ret->_PermissionId);
result->getField(1, ret->_UserId);
- result->getField(2, ret->_DomainName);
+ result->getField(2, ret->_DomainId);
result->getField(3, ret->_ShardId);
result->getField(4, ret->_AccessPriv);
diff --git a/code/ryzom/server/src/shard_unifier_service/nel_database_mapping.h b/code/ryzom/server/src/shard_unifier_service/nel_database_mapping.h
index 7ddd3de74..50ef8e823 100644
--- a/code/ryzom/server/src/shard_unifier_service/nel_database_mapping.h
+++ b/code/ryzom/server/src/shard_unifier_service/nel_database_mapping.h
@@ -1,18 +1,3 @@
-// Ryzom - MMORPG Framework
-// 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 .
/////////////////////////////////////////////////////////////////
// WARNING : this is a generated file, don't change it !
@@ -107,7 +92,7 @@ namespace RSMGR
_PrevPtr(NULL)
{
_Ptr = objectPtr;
-
+
linkPtr();
}
@@ -247,7 +232,7 @@ namespace RSMGR
_PrevPtr(NULL)
{
_Ptr = objectPtr;
-
+
linkPtr();
}
@@ -556,7 +541,7 @@ namespace RSMGR
time_t _ReleaseDate;
/// The linked list of pointer on this object
- CNelUserPtr *_PtrList;
+ CNelUserPtr *_PtrList;
// Try to load the specified object from the memory cache, return NULL if the object is not in the cache
static CNelUser *loadFromCache(uint32 objectId, bool unrelease);
@@ -583,7 +568,7 @@ namespace RSMGR
}
public:
-
+
/** Return the object identifier (witch is unique)
* You can only call this method on a persistent instance.
* (because transient instance can have invalid id)
@@ -632,11 +617,11 @@ namespace RSMGR
{
protected:
//
- uint32 _Prim;
+ uint32 _PermissionId;
//
uint32 _UserId;
//
- std::string _DomainName;
+ uint32 _DomainId;
//
uint32 _ShardId;
//
@@ -662,25 +647,21 @@ namespace RSMGR
}
//
- const std::string &getDomainName() const
+ uint32 getDomainId() const
{
- return _DomainName;
+ return _DomainId;
}
-
-
- void setDomainName(const std::string &value)
+ void setDomainId(uint32 value)
{
- if (_DomainName != value)
+ if (_DomainId != value)
{
if (getPersistentState() != NOPE::os_transient)
setPersistentState(NOPE::os_dirty);
+ _DomainId = value;
- _DomainName = value;
-
-
}
}
@@ -729,9 +710,9 @@ namespace RSMGR
bool operator == (const CNelPermission &other) const
{
- return _Prim == other._Prim
+ return _PermissionId == other._PermissionId
&& _UserId == other._UserId
- && _DomainName == other._DomainName
+ && _DomainId == other._DomainId
&& _ShardId == other._ShardId
&& _AccessPriv == other._AccessPriv;
}
@@ -742,7 +723,7 @@ namespace RSMGR
CNelPermission()
: _PtrList(NULL),
_ObjectState(NOPE::os_transient),
- _Prim(NOPE::INVALID_OBJECT_ID)
+ _PermissionId(NOPE::INVALID_OBJECT_ID)
{
// register the cache for this class (if not already done)
@@ -825,7 +806,7 @@ namespace RSMGR
time_t _ReleaseDate;
/// The linked list of pointer on this object
- CNelPermissionPtr *_PtrList;
+ CNelPermissionPtr *_PtrList;
// Try to load the specified object from the memory cache, return NULL if the object is not in the cache
static CNelPermission *loadFromCache(uint32 objectId, bool unrelease);
@@ -852,7 +833,7 @@ namespace RSMGR
}
public:
-
+
/** Return the object identifier (witch is unique)
* You can only call this method on a persistent instance.
* (because transient instance can have invalid id)
@@ -860,7 +841,7 @@ namespace RSMGR
uint32 getObjectId() const
{
- return _Prim;
+ return _PermissionId;
}
/** Set the object unique ID.
@@ -874,8 +855,8 @@ namespace RSMGR
// can only be set when in transient state
nlassert(getPersistentState() == NOPE::os_transient);
// can only be set once
- nlassert(_Prim == NOPE::INVALID_OBJECT_ID);
- _Prim = objectId;
+ nlassert(_PermissionId == NOPE::INVALID_OBJECT_ID);
+ _PermissionId = objectId;
}
/** Return the current persistent state of the object.*/
diff --git a/code/ryzom/server/src/shard_unifier_service/nel_database_mapping.xml b/code/ryzom/server/src/shard_unifier_service/nel_database_mapping.xml
index 02642eb11..cd85c2fd5 100644
--- a/code/ryzom/server/src/shard_unifier_service/nel_database_mapping.xml
+++ b/code/ryzom/server/src/shard_unifier_service/nel_database_mapping.xml
@@ -17,16 +17,16 @@
-
+
-
+
-
+
diff --git a/code/ryzom/server/src/shard_unifier_service/readme.txt b/code/ryzom/server/src/shard_unifier_service/readme.txt
new file mode 100644
index 000000000..6d45d7556
--- /dev/null
+++ b/code/ryzom/server/src/shard_unifier_service/readme.txt
@@ -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
diff --git a/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp b/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp
index 8d6c2a91f..a2dc72b1c 100644
--- a/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp
+++ b/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp
@@ -58,7 +58,7 @@ CVariable PrivilegeForSessionAccess("su", "PrivilegeForSessionAccess", "
namespace RSMGR
{
- class CRingSessionManager :
+ class CRingSessionManager :
public CEmptyModuleServiceBehav > >,
public CRingSessionManagerSkel,
public CRingSessionManagerWebItf,
@@ -74,10 +74,10 @@ namespace RSMGR
// mysql nel database connection
MSW::CConnection _NelDb;
-
+
struct TSessionServerInfo
{
- /// Shard id
+ /// Shard id
TShardId ShardId;
/// Total number of player in the sessions hosted by this server
uint32 NbTotalPlayingChars;
@@ -97,7 +97,7 @@ namespace RSMGR
TSessionServers _SessionServers;
typedef map TSessionServersIdx;
- // index of sessionId to session server
+ // index of sessionId to session server
TSessionServersIdx _SessionIndex;
struct TWelcomeServiceInfo
@@ -147,7 +147,7 @@ namespace RSMGR
};
typedef map TTemporaryShardAssocs;
- /** A table of session owner and the ring shard on witch they are
+ /** A table of session owner and the ring shard on witch they are
* currently stuck. This allow the RSM to assign edit and anim session
* of a character to the same DSS to use the DSS session ID masquerading
* that allow reuse of the same session for editing and animating without
@@ -184,7 +184,7 @@ namespace RSMGR
struct TPendingJoinSession
{
/// The user ID
- uint32 UserId;
+ uint32 UserId;
/// the session id
TSessionId SessionId;
/// The web connection
@@ -206,7 +206,7 @@ namespace RSMGR
/// Pointer to character sync speaker
ICharacterSync *_CharSync;
public:
- CRingSessionManager()
+ CRingSessionManager()
: _DontUsePerm(false),
_CharSync(NULL)
{
@@ -284,7 +284,7 @@ namespace RSMGR
nlwarning("Missing 'web' param in module init string");
return false;
}
-
+
const TParsedCommandLine *portParam = web->getParam("port");
if (portParam == NULL)
{
@@ -399,7 +399,7 @@ namespace RSMGR
{
nldebug("RSM : receive module down for session server '%s'", proxy->getModuleName().c_str());
- // lock any sessions that belong to this module (because we don't now if
+ // lock any sessions that belong to this module (because we don't now if
// the session server if just unreachable or really dead)
TSessionServerInfo &ssi = it->second;
{
@@ -433,7 +433,7 @@ namespace RSMGR
else
++it;
}
-
+
}
{
@@ -457,7 +457,7 @@ namespace RSMGR
}
}
}
-
+
}
// remove session info
@@ -625,11 +625,11 @@ namespace RSMGR
// query << " WHERE shard.domain_id = domain.domain_id";
// query << " AND domain_name = '" << DomainName << "'";
// query << " AND ShardId = " << shardId;
-//
+//
// BOMB_IF(!_NelDb.query(query), "registerWS : Failed to request into the NeL database", return CNelShardPtr());
// auto_ptr result = auto_ptr(_NelDb.storeResult());
// BOMB_IF(result.get() == NULL, "registerWS : Failed to retrieve request result", return CNelShardPtr());
-//
+//
// if (result->getNumRows() == 0)
// {
// return CNelShardPtr();
@@ -639,7 +639,7 @@ namespace RSMGR
// // load the data
// uint32 prim;
// result->getField(0, prim);
-//
+//
// return CNelShard::load(_NelDb, prim, __FILE__, __LINE__);
// }
@@ -648,8 +648,8 @@ namespace RSMGR
userAccessPriv.clear();
CSString query;
query << "SELECT AccessPrivilege FROM permission";
- query << " WHERE UId = " << userId << " AND permission.ClientApplication = '"<getModuleName().c_str());
if (_SessionServers.find(sender) != _SessionServers.end())
@@ -696,13 +696,13 @@ namespace RSMGR
for (uint i=0; i(rsi.getSessionId()),
+ nlwarning("registerDSS : can't load the session %u hosted by '%s, closing it",
+ static_cast(rsi.getSessionId()),
sender->getModuleName().c_str());
CRingSessionManagerClientProxy smc(sender);
@@ -718,7 +718,7 @@ namespace RSMGR
if (session->getState() != TSessionState::ss_open && session->getState() != TSessionState::ss_locked)
{
nlwarning("registerDSS : The session %u open hosted by '%s' is '%s', asking DSS to close it",
- static_cast(rsi.getSessionId()),
+ static_cast(rsi.getSessionId()),
sender->getModuleName().c_str(),
session->getState().toString().c_str());
@@ -790,7 +790,7 @@ restartLoop:
_TemporaryLockedSession.erase(sessionId);
sessionToClose.pop_front();
}
-
+
}
_SessionServers[sender] = ssi;
@@ -829,7 +829,7 @@ restartLoop:
invokeResult(from, (it3->CharId) >> 4, 5, "Session server failure");
return;
}
-
+
TSessionServerInfo &ssi = it->second;
TSessionServerInfo::THostedSessions::iterator it2(ssi.HostedSessions.find(sessionInfo.getSessionId()));
@@ -875,7 +875,7 @@ restartLoop:
_PendingSessions.erase(it3);
}
-
+
// that all
}
@@ -898,7 +898,7 @@ restartLoop:
sender->getModuleName().c_str());
return;
}
-
+
TSessionServerInfo &ssi = it->second;
TSessionServerInfo::THostedSessions::iterator it2(ssi.HostedSessions.find(sessionId));
@@ -1049,7 +1049,7 @@ restartLoop:
sessionLog->setScenarioPointScored(0);
sessionLog->setTimeTaken(0);
sessionLog->setGuildName("");
-
+
sessionLog->create(_RingDb);
}
@@ -1095,12 +1095,12 @@ restartLoop:
// provides a bunch of data about the session life.
// The DSS report the end of an animation session and
// provides a bunch of data about the session life.
- virtual void scenarioEnded(NLNET::IModuleProxy *sender,
- TSessionId sessionId,
- const R2::TRunningScenarioInfo &scenarioInfo,
- uint32 rrpScored,
- uint32 scenarioPointScored,
- uint32 timeTaken,
+ virtual void scenarioEnded(NLNET::IModuleProxy *sender,
+ TSessionId sessionId,
+ const R2::TRunningScenarioInfo &scenarioInfo,
+ uint32 rrpScored,
+ uint32 scenarioPointScored,
+ uint32 timeTaken,
const std::vector < uint32 > &participants)
{
H_AUTO(SessionManager_scenarioEnded);
@@ -1171,7 +1171,7 @@ restartLoop:
// build the participants string
for (uint i=0; isetObjectId(shardId);
- // new WS are always inserted in restricted mode
+ // new WS are always inserted in restricted mode
wsInfo.ShardInfo->setWSOnline(false);
wsInfo.ShardInfo->setRequiredState(TAccessLevel::ds_restricted);
wsInfo.ShardInfo->setMOTD("Shard up, access restricted");
@@ -1286,7 +1286,7 @@ restartLoop:
if (isOnline && wsInfo.ShardInfo->getRequiredState() != TAccessLevel::ds_close)
{
- // the WS is online, check the previous known state of the
+ // the WS is online, check the previous known state of the
// WS and put it in restricted if it was previously close.
if (!wsInfo.ShardInfo->getWSOnline())
{
@@ -1322,8 +1322,8 @@ restartLoop:
{
TWelcomeServiceInfo &wsi = itw->second;
- if (isOnline
- && wsi.ShardInfo->getRequiredState() != TAccessLevel::ds_close
+ if (isOnline
+ && wsi.ShardInfo->getRequiredState() != TAccessLevel::ds_close
&& !wsi.ShardInfo->getWSOnline())
{
// unclose this shard
@@ -1388,7 +1388,7 @@ restartLoop:
// retrieve the session participant
character->loadSessionParticipants(_RingDb, __FILE__, __LINE__);
TSessionPartStatus status;
-
+
// vector::iterator first(character->getSessionParticipants().begin()), last(character->getSessionParticipants().end());
// for (; first != last; ++first)
uint i;
@@ -1479,7 +1479,7 @@ restartLoop:
joinSessionResult(pjs.From, pjs.UserId, pjs.SessionId, 8, string("Welcome refused entry in shard with error : '")+errorMsg+"'", TSessionPartStatus::invalid_val);
}
-endOfWelcomeUserResult:
+endOfWelcomeUserResult:
if (ok)
{
// update the 'ring_user' table to signal which session we're entering and with which character
@@ -1494,7 +1494,7 @@ endOfWelcomeUserResult:
return;
}
}
-
+
nlwarning("welcomeUserResult : received a result for unexpected userId %u from WS '%s'",
userId,
sender->getModuleName().c_str());
@@ -1559,37 +1559,37 @@ endOfWelcomeUserResult:
}
}
- virtual void on_setSessionStartParams(NLNET::TSockId from,
+ virtual void on_setSessionStartParams(NLNET::TSockId from,
uint32 charId, TSessionId sessionId, const std::string &initialIslandLocation, const std::string &initialEntryPointLocation, const std::string &initialSeason)
{
CSessionPtr session = CSession::load(_RingDb, sessionId.asInt(), __FILE__, __LINE__);
if (session == NULL) { return; }
if (session->getSessionType() == TSessionType::st_mainland) { return;}
-
+
TSessionServersIdx::iterator it(_SessionIndex.find(sessionId));
if (it == _SessionIndex.end()) { return; }
CRingSessionManagerClientProxy ss(it->second);
ss.setSessionStartParams(this, charId, sessionId, initialIslandLocation, initialEntryPointLocation, initialSeason);
-
+
}
- virtual void on_scheduleSession(NLNET::TSockId from,
- uint32 charId,
- const TSessionType &sessionType,
- const std::string &sessionTitle,
- const std::string &sessionDesc,
- const TSessionLevel &sessionLevel,
-// const TAccessType &accessType,
- const TRuleType &ruleType,
- const TEstimatedDuration &estimatedDuration,
- uint32 subscriptionSlot,
+ virtual void on_scheduleSession(NLNET::TSockId from,
+ uint32 charId,
+ const TSessionType &sessionType,
+ const std::string &sessionTitle,
+ const std::string &sessionDesc,
+ const TSessionLevel &sessionLevel,
+// const TAccessType &accessType,
+ const TRuleType &ruleType,
+ const TEstimatedDuration &estimatedDuration,
+ uint32 subscriptionSlot,
const TAnimMode &animMode,
- const TRaceFilter &raceFilter,
- const TReligionFilter &religionFilter,
- const TGuildFilter &guildFilter,
+ const TRaceFilter &raceFilter,
+ const TReligionFilter &religionFilter,
+ const TGuildFilter &guildFilter,
const TShardFilter &shardFilter,
const TLevelFilter &levelFilter,
const std::string &language,
@@ -1636,7 +1636,7 @@ endOfWelcomeUserResult:
CCharacterPtr character = CCharacter::load(_RingDb, charId, __FILE__, __LINE__);
if (character == NULL)
{
- // failed !, invalid character
+ // failed !, invalid character
scheduleSessionResult(from, charId, TSessionId(0), 3, "Invalid character");
return;
}
@@ -1646,13 +1646,13 @@ endOfWelcomeUserResult:
{
CNelUserPtr nelUser = CNelUser::load(_NelDb, userId, __FILE__, __LINE__);
BOMB_IF(nelUser == NULL, "Failed to load nel user "<getExtendedPrivilege().find(":TRIAL:") != string::npos)
{
// this account is free trial, no anim session allowed
- scheduleSessionResult(from, charId, TSessionId(0), 9, "Forbidden for free trial");
+ scheduleSessionResult(from, charId, TSessionId(0), 9, "Forbidden for free trial");
return;
}
*/
@@ -1704,7 +1704,7 @@ endOfWelcomeUserResult:
// store the session
session->create(_RingDb);
-
+
// ok, return the result to web
scheduleSessionResult(from, charId, TSessionId(session->getObjectId()), 0, "");
}
@@ -1730,7 +1730,7 @@ endOfWelcomeUserResult:
}
// ok, return the result to web
- sessionInfoResult(from, charId, TSessionId(session->getObjectId()),
+ sessionInfoResult(from, charId, TSessionId(session->getObjectId()),
session->getRaceFilter(), session->getReligionFilter(), session->getGuildFilter(),
session->getShardFilter(), session->getLevelFilter(), session->getSubscriptionClosed(),
(session->getAccessType()==TAccessType::at_public), session->getLang(), session->getOrientation(), session->getDescription());
@@ -1743,21 +1743,21 @@ endOfWelcomeUserResult:
// 3 : char don't own the session
// 4 : session is closed, no update allowed
// 5 : invalid parameter
- virtual void on_updateSessionInfo(NLNET::TSockId from,
- uint32 charId,
- TSessionId sessionId,
- const std::string &sessionTitle,
- uint32 plannedDate,
- const std::string &sessionDesc,
- const TSessionLevel &sessionLevel,
-// const TAccessType &accessType,
- const TEstimatedDuration &estimatedDuration,
- uint32 subscriptionSlot,
- const TRaceFilter &raceFilter,
- const TReligionFilter &religionFilter,
- const TGuildFilter &guildFilter,
- const TShardFilter &shardFilter,
- const TLevelFilter &levelFilter,
+ virtual void on_updateSessionInfo(NLNET::TSockId from,
+ uint32 charId,
+ TSessionId sessionId,
+ const std::string &sessionTitle,
+ uint32 plannedDate,
+ const std::string &sessionDesc,
+ const TSessionLevel &sessionLevel,
+// const TAccessType &accessType,
+ const TEstimatedDuration &estimatedDuration,
+ uint32 subscriptionSlot,
+ const TRaceFilter &raceFilter,
+ const TReligionFilter &religionFilter,
+ const TGuildFilter &guildFilter,
+ const TShardFilter &shardFilter,
+ const TLevelFilter &levelFilter,
bool subscriptionClosed,
bool autoInvite,
const std::string &language,
@@ -1833,7 +1833,7 @@ endOfWelcomeUserResult:
invokeResult(from, charId>>4, 0, "");
}
-
+
// Cancel a planned session
// Return 'invokeResult' : 0 : ok, session canceled
// 1 : unknown char
@@ -1867,14 +1867,14 @@ endOfWelcomeUserResult:
return;
}
- if (session->getState() != TSessionState::ss_planned
+ if (session->getState() != TSessionState::ss_planned
&& session->getState() != TSessionState::ss_locked)
{
// not planned
invokeResult(from, charId>>4, 4, "Session not in planned state");
return;
}
-
+
// remove the session from database
session->remove(_RingDb);
@@ -1928,7 +1928,7 @@ endOfWelcomeUserResult:
// look for the best server
TSessionServers::iterator best(_SessionServers.end());
-
+
// check if the user has a open edit session, if so, lauch the session on the same shard
if (session->getSessionType() == TSessionType::st_anim)
@@ -1944,7 +1944,7 @@ endOfWelcomeUserResult:
TSessionServersIdx::iterator it(_SessionIndex.find(s->getObjectId()));
if (it != _SessionIndex.end())
best = _SessionServers.find(it->second);
-
+
break;
}
}
@@ -2134,7 +2134,7 @@ endOfWelcomeUserResult:
if (session->getState() != TSessionState::ss_closed
&& session->getState() != TSessionState::ss_planned)
- {
+ {
// ask the session server to close this session
TSessionServersIdx::iterator it(_SessionIndex.find(sessionId));
if (it != _SessionIndex.end())
@@ -2142,7 +2142,7 @@ endOfWelcomeUserResult:
TModuleProxyPtr proxy = it->second;
CRingSessionManagerClientProxy ss(proxy);
-
+
ss.closeSession(this, sessionId);
// ok, we have closed the session
@@ -2162,7 +2162,7 @@ endOfWelcomeUserResult:
// use the first server in the list
TModuleProxyPtr proxy = _SessionServers.begin()->first;
CRingSessionManagerClientProxy ss(proxy);
-
+
ss.stopHibernation(this, TSessionId(sessionId), charId);
}
@@ -2171,7 +2171,7 @@ endOfWelcomeUserResult:
}
// Close a running session
- // Return 'invokeResult' : 0 : ok,
+ // Return 'invokeResult' : 0 : ok,
// 1 : not ok
//:TODO: change the name to Cloase or hibernate previous sessions
virtual void on_hibernateEditSession(NLNET::TSockId from, uint32 charId)
@@ -2186,12 +2186,12 @@ endOfWelcomeUserResult:
CCharacterPtr character = CCharacter::load(_RingDb, charId, __FILE__, __LINE__);
if (character == NULL)
{
- invokeResult(from, charId>>4, 1, "Character not found");
+ invokeResult(from, charId>>4, 1, "Character not found");
return;
}
// Hiberning edit sessions
{
-
+
CSString query;
query << "SELECT session_id FROM sessions";
query << " WHERE owner = "<getNumRows() != 0)
{
-
+
if (result->getNumRows() > 1)
{
@@ -2214,13 +2214,13 @@ endOfWelcomeUserResult:
uint32 sessionNum;
result->getField(0, sessionNum);
TSessionId sessionId(sessionNum);
-
+
CSessionPtr session = CSession::load(_RingDb, sessionId.asInt(), __FILE__, __LINE__);
if (session != NULL)
{
if (session->getState() != TSessionState::ss_closed
&& session->getState() != TSessionState::ss_planned)
- {
+ {
// ask the session server to close this session
TSessionServersIdx::iterator it(_SessionIndex.find(sessionId));
if (it != _SessionIndex.end())
@@ -2228,7 +2228,7 @@ endOfWelcomeUserResult:
TModuleProxyPtr proxy = it->second;
CRingSessionManagerClientProxy ss(proxy);
-
+
ss.hibernateSession(this, sessionId);
}
}
@@ -2238,7 +2238,7 @@ endOfWelcomeUserResult:
// Close anim sessions
{
-
+
CSString query;
query << "SELECT session_id FROM sessions";
query << " WHERE owner = "<getNumRows());
}
-
+
unsigned int firstSession = 0;
unsigned int lastSession = result->getNumRows();
for (;firstSession != lastSession; ++firstSession)
- {
+ {
result->fetchRow();
- // get the session id
-
+ // get the session id
+
uint32 sessionNum;
result->getField(0, sessionNum);
TSessionId sessionId(sessionNum);
-
+
CSessionPtr session = CSession::load(_RingDb, sessionId.asInt(), __FILE__, __LINE__);
if (session != NULL)
{
-
- if ( session->getState() != TSessionState::ss_closed && session->getState() != TSessionState::ss_planned)
- {
+
+ if ( session->getState() != TSessionState::ss_closed && session->getState() != TSessionState::ss_planned)
+ {
// ask the session server to close this session
TSessionServersIdx::iterator it(_SessionIndex.find(sessionId));
if (it == _SessionIndex.end())
@@ -2335,8 +2335,8 @@ endOfWelcomeUserResult:
uint i;
for (i=0; igetKnownUsers().size(); ++i)
{
- const CKnownUserPtr &ku = ru->getKnownUsers()[i];
- if (ku->getTargetCharacter() == friendCharId
+ const CKnownUserPtr &ku = ru->getKnownUsers()[i];
+ if (ku->getTargetCharacter() == friendCharId
&& (ku->getRelation() == TKnownUserRelation::rt_friend || ku->getRelation() == TKnownUserRelation::rt_banned))
break;
}
@@ -2411,7 +2411,7 @@ endOfWelcomeUserResult:
uint i;
for (i=0; igetKnownUsers().size(); ++i)
{
- const CKnownUserPtr &ku = ru->getKnownUsers()[i];
+ const CKnownUserPtr &ku = ru->getKnownUsers()[i];
if (ku->getTargetCharacter() == friendCharId && ku->getRelation() == TKnownUserRelation::rt_friend)
break;
}
@@ -2468,7 +2468,7 @@ endOfWelcomeUserResult:
uint i;
for (i=0; igetKnownUsers().size(); ++i)
{
- const CKnownUserPtr &ku = ru->getKnownUsers()[i];
+ const CKnownUserPtr &ku = ru->getKnownUsers()[i];
if (ku->getTargetCharacter() == bannedCharId && ku->getRelation() == TKnownUserRelation::rt_banned)
break;
}
@@ -2487,14 +2487,14 @@ endOfWelcomeUserResult:
}
else
{
- // the character is already banned
+ // the character is already banned
}
vector removeList;
// remove any friend or DM friend record
for (i=0; igetKnownUsers().size(); ++i)
{
- const CKnownUserPtr &ku = ru->getKnownUsers()[i];
+ const CKnownUserPtr &ku = ru->getKnownUsers()[i];
if (ku->getTargetCharacter() == bannedCharId && ku->getRelation() != TKnownUserRelation::rt_banned)
removeList.push_back(ku);
}
@@ -2545,7 +2545,7 @@ endOfWelcomeUserResult:
uint i;
for (i=0; igetKnownUsers().size(); ++i)
{
- const CKnownUserPtr &ku = ru->getKnownUsers()[i];
+ const CKnownUserPtr &ku = ru->getKnownUsers()[i];
if (ku->getTargetCharacter() == bannedCharId && ku->getRelation() == TKnownUserRelation::rt_banned)
break;
}
@@ -2562,7 +2562,7 @@ endOfWelcomeUserResult:
// invokeResult(from, userId, 3, "character not flagged as banned");
// return;
// }
-
+
// ok, remove the know user record
ku->remove(_RingDb);
@@ -2606,8 +2606,8 @@ endOfWelcomeUserResult:
uint i;
for (i=0; igetKnownUsers().size(); ++i)
{
- const CKnownUserPtr &ku = ru->getKnownUsers()[i];
- if (ku->getTargetCharacter() == friendDMCharId
+ const CKnownUserPtr &ku = ru->getKnownUsers()[i];
+ if (ku->getTargetCharacter() == friendDMCharId
&& (ku->getRelation() == TKnownUserRelation::rt_friend_dm || ku->getRelation() == TKnownUserRelation::rt_banned))
break;
}
@@ -2681,7 +2681,7 @@ endOfWelcomeUserResult:
uint i;
for (i=0; igetKnownUsers().size(); ++i)
{
- const CKnownUserPtr &ku = ru->getKnownUsers()[i];
+ const CKnownUserPtr &ku = ru->getKnownUsers()[i];
if (ku->getTargetCharacter() == friendDMCharId && ku->getRelation() == TKnownUserRelation::rt_friend_dm)
break;
}
@@ -2698,7 +2698,7 @@ endOfWelcomeUserResult:
// invokeResult(from, userId, 3, "character not flagged as friend");
// return;
// }
-
+
// ok, remove the know user record
ku->remove(_RingDb);
@@ -2715,9 +2715,9 @@ endOfWelcomeUserResult:
// 5 : invalid param
virtual void on_setKnownCharacterComments(NLNET::TSockId from, uint32 userId, uint32 charId, const std::string &relation, const std::string &comments)
{
- nldebug("RSM : setKnownCharacterComments set comment '%s' on char %u knowns as '%s' of user %u",
+ nldebug("RSM : setKnownCharacterComments set comment '%s' on char %u knowns as '%s' of user %u",
comments.c_str(),
- charId,
+ charId,
relation.c_str(),
userId);
@@ -2739,7 +2739,7 @@ endOfWelcomeUserResult:
bool foundARelation = false;
for (uint i=0; igetKnownUsers().size(); ++i)
{
- CKnownUserPtr &ku = ru->getKnownUsersByIndex(i);
+ CKnownUserPtr &ku = ru->getKnownUsersByIndex(i);
if (ku->getTargetCharacter() == charId && ku->getRelation() == rel)
{
// we found the relation, update the comment
@@ -2772,7 +2772,7 @@ endOfWelcomeUserResult:
// A user invite a character to help or play in his session
// charRole is from enum TSessionPartStatus
// invokeReturn : 0 : ok, character invited
- // 1 : char not found
+ // 1 : char not found
// 2 : session not found
// 3 : invited char not found
// 4 : char not own the session
@@ -2842,17 +2842,17 @@ endOfWelcomeUserResult:
invokeResult(from, ownerCharId>>4, 13, "scenario not started, can't validate invitation now");
return;
}
-
+
CScenarioPtr scenario = CScenario::load(_RingDb, sessionLog->getScenarioId(), __FILE__, __LINE__);
BOMB_IF(invitedNelUser == NULL, "Failed to load scenario for id "<getScenarioId()<<" for session "<>4, 8, "Can not load scenario associated with session log"); return);
-
- if (invitedNelUser->getExtendedPrivilege().find(":TRIAL:") != string::npos
+
+ if (invitedNelUser->getExtendedPrivilege().find(":TRIAL:") != string::npos
&& !scenario->getAllowFreeTrial())
{
// free trial are not allowed in this scenario
invokeResult(from, ownerCharId>>4, 14, "free trial character are not allowed in user scenario");
return;
-
+
}
// check that the character is not already participating
@@ -2877,18 +2877,18 @@ endOfWelcomeUserResult:
invokeResult(from, ownerCharId>>4, 4, "Animator can't invite other animator (only session owner can)");
return;
}
- else if (session->getOwnerId() != ownerCharId)
+ else if (session->getOwnerId() != ownerCharId)
{
// the character that request the invitation is not the session owner,
// check that he is animator in the session/
BOMB_IF(!ownerChar->loadSessionParticipants(_RingDb, __FILE__, __LINE__), "Failed to load participation for host character "<>4, 8, "Failed to load participation for host character"); return);
-
+
uint i=0;
for (; igetSessionParticipants().size(); ++i)
{
CSessionParticipantPtr sp = ownerChar->getSessionParticipantsByIndex(i);
-
+
if (sp->getSessionId() == sessionId.asInt())
{
// we found it
@@ -2899,12 +2899,12 @@ endOfWelcomeUserResult:
invokeResult(from, ownerCharId>>4, 11, "Invitation requester char is not animator in the session");
return;
}
-
+
// ok, stop the loop
break;
}
}
-
+
if (i == ownerChar->getSessionParticipants().size())
{
// no participation found !
@@ -3059,7 +3059,7 @@ endOfWelcomeUserResult:
{
const CKnownUserPtr &ku = ru->getKnownUsersByIndex(i);
- if (ku->getRelation() == TKnownUserRelation::rt_banned
+ if (ku->getRelation() == TKnownUserRelation::rt_banned
&& ku->getTargetUser() == character->getUserId())
{
// this character is banned !
@@ -3170,7 +3170,7 @@ endOfWelcomeUserResult:
{
BOMB_IF (!loadUserAccessPrivileges(userId, userAccessPriv), "RSM:on_joinSession : failed to load privileges for user "<getOwnerId() != charId
+ if (session->getOwnerId() != charId
&& nelUser->getExtendedPrivilege().find(":TRIAL:") != string::npos)
{
// check that the scenario launched allow free trials players
@@ -3277,7 +3277,7 @@ endOfWelcomeUserResult:
sessionPart->setCharId(charId);
sessionPart->setSessionId(session->getObjectId());
sessionPart->setStatus(TSessionPartStatus::sps_play_invited);
-
+
// store the participation
sessionPart->create(_RingDb);
}
@@ -3344,7 +3344,7 @@ endOfWelcomeUserResult:
// warn the session server that an editor come in
enterAs = WS::TUserRole::ur_editor;
ss.addCharacterInSession(this, sessionId, charId, enterAs, charac->getRingAccess(), charac->getNewcomer());
-
+
// update the participant status
sessionPart->setStatus(TSessionPartStatus::sps_editing);
@@ -3352,8 +3352,8 @@ endOfWelcomeUserResult:
else if ( sessionPart->getStatus() == TSessionPartStatus::sps_anim_invited
|| sessionPart->getStatus() == TSessionPartStatus::sps_animating)
{
- // warn the session server that an animator come in
- enterAs = WS::TUserRole::ur_animator;
+ // warn the session server that an animator come in
+ enterAs = WS::TUserRole::ur_animator;
ss.addCharacterInSession(this, sessionId, charId, enterAs, charac->getRingAccess(), charac->getNewcomer());
// update the participant status
sessionPart->setStatus(TSessionPartStatus::sps_animating);
@@ -3406,7 +3406,7 @@ endOfWelcomeUserResult:
if (wspSwitch == NULL)
{
// can't find a welcome service for this shard
-
+
// try to read a shard status in the database
CShardPtr shard = CShard::load(_RingDb, sessionId.asInt(), __FILE__, __LINE__);
if (shard != NULL)
@@ -3455,13 +3455,13 @@ endOfWelcomeUserResult:
_PendingJoins.push_back(pjs);
// reserve an entry place on the welcome service of the shard and wait for the response
- wsp.welcomeUser(this,
- charId,
- nelUser->getLoginName(),
- cookie,
- nelUser->getPrivilege(),
- nelUser->getExtendedPrivilege(),
- enterAs,
+ wsp.welcomeUser(this,
+ charId,
+ nelUser->getLoginName(),
+ cookie,
+ nelUser->getPrivilege(),
+ nelUser->getExtendedPrivilege(),
+ enterAs,
instanceId);
// the rest of the code is done in 'welcomeUserResult' returned by the WS.
@@ -3566,7 +3566,7 @@ endOfWelcomeUserResult:
uint32 sessionNum;
result->getField(0, sessionNum);
TSessionId sessionId(sessionNum);
-
+
// 2 : check that the character is invited in his session
BOMB_IF(!character->loadSessionParticipants(_RingDb, __FILE__, __LINE__), "on_joinEditSession : failed to load session participants for char "<>4, TSessionId(0), 3, "Error loading partipation", TSessionPartStatus::invalid_val); return);
uint i;
@@ -3612,7 +3612,7 @@ endOfWelcomeUserResult:
// ok, now call the normal join session
_joinSessionCommon(from, charId, sessionId, clientApplication, true);
}
-
+
// Request to have the list of accessible shards with their attributes.
virtual void on_getShards(NLNET::TSockId from, uint32 charId)
{
@@ -3645,7 +3645,7 @@ endOfWelcomeUserResult:
}
}
}
-
+
}
getShardsResult(from, charId>>4, result);
}
@@ -3673,11 +3673,11 @@ endOfWelcomeUserResult:
if (!hasSessionAccessPrivilege(userId))
{
STOP("RSM : on_kickCharacter : char "<>4, 5, "Owner char don't own the session");
+ invokeResult(from, ownerCharId>>4, 5, "Owner char don't own the session");
return;
}
}
-
+
// load the participants
BOMB_IF(!session->loadSessionParticipants(_RingDb, __FILE__, __LINE__), "RSM : on_kickCharacter : failed to load session participants for session "<>4, 4, "Failed to load session participants"); return);
@@ -3733,7 +3733,7 @@ endOfWelcomeUserResult:
if (!hasSessionAccessPrivilege(userId))
{
STOP("RSM : on_unkickCharacter : char "<>4, 5, "Owner char don't own the session");
+ invokeResult(from, ownerCharId>>4, 5, "Owner char don't own the session");
return;
}
}
@@ -3775,7 +3775,7 @@ endOfWelcomeUserResult:
// 5 : char don't own the session
virtual void on_inviteGuild(NLNET::TSockId from, uint32 charId, TSessionId sessionId, uint32 guildId)
{
- nldebug("RSM : onInviteGuild char %u invite guild %u in session %u",
+ nldebug("RSM : onInviteGuild char %u invite guild %u in session %u",
charId,
guildId,
sessionId.asInt());
@@ -3830,10 +3830,10 @@ endOfWelcomeUserResult:
invite->setGuildId(guildId);
invite->setSessionId(sessionId.asInt());
-
+
// store the new invite
invite->create(_RingDb);
-
+
// result ok
invokeResult(from, charId>>4, 0, "");
}
@@ -3847,7 +3847,7 @@ endOfWelcomeUserResult:
// 5 : char don't own the session
virtual void on_removeInvitedGuild(NLNET::TSockId from, uint32 charId, TSessionId sessionId, uint32 guildId)
{
- nldebug("RSM : removeInvitedGuild char %u revoke invitattion for guild %u in session %u",
+ nldebug("RSM : removeInvitedGuild char %u revoke invitattion for guild %u in session %u",
charId,
guildId,
sessionId.asInt());
@@ -3919,13 +3919,13 @@ endOfWelcomeUserResult:
// 2 : user not owner of session
// 3 : user not found
// 4 : session not found
-// virtual void on_setScenarioInfo(NLNET::TSockId from,
-// uint32 userId,
-// TSessionId sessionId,
-// const std::string &title,
-// const std::string &journal,
-// const std::string &credits,
-// uint32 numPlayer,
+// virtual void on_setScenarioInfo(NLNET::TSockId from,
+// uint32 userId,
+// TSessionId sessionId,
+// const std::string &title,
+// const std::string &journal,
+// const std::string &credits,
+// uint32 numPlayer,
// const std::string &playType)
virtual void on_setScenarioInfo(NLNET::TSockId from, uint32 charId, TSessionId sessionId, const std::string &title, uint32 numPlayer, const std::string &playType)
{
@@ -3955,7 +3955,7 @@ endOfWelcomeUserResult:
// invokeResult(from, charId>>4, 2, "Character don't own the session");
// return;
// }
-//
+//
// // load the scenario desc
// CScenarioDescPtr scenario = CScenarioDesc::load(_RingDb, sessionId.asInt(), __FILE__, __LINE__);
// if (scenario == NULL)
@@ -3968,7 +3968,7 @@ endOfWelcomeUserResult:
// scenario->setTitle(title);
// //oups, data do not matchs
// nlstop;
-//
+//
invokeResult(from, charId>>4, 100, "Deprecatted");
};
@@ -3982,10 +3982,10 @@ endOfWelcomeUserResult:
// 5 : user participation not found
// 6 : character not found
// 7 : invalid params
- virtual void on_addJournalEntry(NLNET::TSockId from,
- uint32 charId,
- TSessionId sessionId,
- const std::string &entryType,
+ virtual void on_addJournalEntry(NLNET::TSockId from,
+ uint32 charId,
+ TSessionId sessionId,
+ const std::string &entryType,
const std::string &text)
{
nldebug("RSM : addJournalEntry char %u add an entry in journal of session %u", charId, sessionId.asInt());
@@ -4075,11 +4075,11 @@ endOfWelcomeUserResult:
// 6 : session not found
// 7 : scenario not found
// 8 : internal error
- virtual void on_setPlayerRating(NLNET::TSockId from, uint32 charId, TSessionId sessionId,
- uint32 rateFun,
- uint32 rateDifficulty,
- uint32 rateAccessibility,
- uint32 rateOriginality,
+ virtual void on_setPlayerRating(NLNET::TSockId from, uint32 charId, TSessionId sessionId,
+ uint32 rateFun,
+ uint32 rateDifficulty,
+ uint32 rateAccessibility,
+ uint32 rateOriginality,
uint32 rateDirection)
{
nldebug("Web set player rating from char %u to session %u as %u,%u,%u,%u, %u",
@@ -4106,14 +4106,14 @@ endOfWelcomeUserResult:
if (sp->getKicked() == true)
{
- invokeResult(from, charId>>4, 5, "Char is banned from the session");
+ invokeResult(from, charId>>4, 5, "Char is banned from the session");
return;
}
break;
}
}
- BOMB_IF(i == character->getSessionParticipants().size(),
+ BOMB_IF(i == character->getSessionParticipants().size(),
"No participation found for char "<>4, 3, "No participation found in session"); return);
// retrieve the scenario data
@@ -4216,7 +4216,7 @@ endOfWelcomeUserResult:
}
-
+
NLMISC_COMMAND_HANDLER_TABLE_EXTEND_BEGIN(CRingSessionManager, CModuleBase)
NLMISC_COMMAND_HANDLER_ADD(CRingSessionManager, dump, "dump the session manager internal state", "no param");
NLMISC_COMMAND_HANDLER_ADD(CRingSessionManager, forceSessionCleanup, "force a database synchronisation with current running session", "no param");
@@ -4245,7 +4245,7 @@ endOfWelcomeUserResult:
log.displayNL("failed to load session %u", sessionId);
return true;
}
-
+
// load the participants
if (!session->loadSessionParticipants(_RingDb, __FILE__, __LINE__))
{
@@ -4355,19 +4355,19 @@ endOfWelcomeUserResult:
if (args.size() > 2)
{
shard->setMOTD(args[2]);
- log.displayNL("Shard %u set required state to '%s' with message '%s'",
+ log.displayNL("Shard %u set required state to '%s' with message '%s'",
shardId,
al.toString().c_str(),
args[2].c_str());
}
else
{
- log.displayNL("Shard %u set required state to '%s'",
+ log.displayNL("Shard %u set required state to '%s'",
shardId,
al.toString().c_str());
shard->setMOTD("");
}
-
+
// update WSState if possible
@@ -4376,7 +4376,7 @@ endOfWelcomeUserResult:
return true;
}
-
+
NLMISC_CLASS_COMMAND_DECL(forceSessionCleanup)
{
if (!_RingDb.query(string("SELECT session_id FROM sessions WHERE state = ")+toString(uint32(TSessionState::ss_open))))
@@ -4437,8 +4437,8 @@ endOfWelcomeUserResult:
log.displayNL(" + Welcome service '%s' for shard %u", wsInfo.WSModuleProxy->getModuleName().c_str(), shardId);
if (wsInfo.FixedSessionId.asInt() != 0)
log.displayNL(" Mainland sessionId: %u", wsInfo.FixedSessionId.asInt());
- log.displayNL(" Access State = '%s', online = %s, message = '%s'",
- wsInfo.ShardInfo->getRequiredState().toString().c_str(),
+ log.displayNL(" Access State = '%s', online = %s, message = '%s'",
+ wsInfo.ShardInfo->getRequiredState().toString().c_str(),
wsInfo.ShardInfo->getWSOnline() ? "true" : "false",
wsInfo.ShardInfo->getMOTD().c_str());
log.displayNL(" %u online players", wsInfo.NbOnlinePlayers);
@@ -4455,7 +4455,7 @@ endOfWelcomeUserResult:
{
IModuleProxy *server = first->first;
TSessionServerInfo &ssi = first->second;
-
+
log.displayNL(" + Session server '%s' :", server->getModuleName().c_str());
log.displayNL(" Shard ID = %u", ssi.ShardId);
log.displayNL(" Total player = %u", ssi.NbTotalPlayingChars);
@@ -4479,9 +4479,9 @@ endOfWelcomeUserResult:
return true;
}
-
- };
+
+ };
NLNET_REGISTER_MODULE_FACTORY(CRingSessionManager, RingSessionManagerClassName);
diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/oldmodule/ryzommanage.module b/code/ryzom/tools/server/ryzom_ams/drupal_module/oldmodule/ryzommanage.module
index e5e184556..f09b06a37 100644
--- a/code/ryzom/tools/server/ryzom_ams/drupal_module/oldmodule/ryzommanage.module
+++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/oldmodule/ryzommanage.module
@@ -659,12 +659,12 @@ function createPermissions($values) {
$sth = $dbh->prepare("SELECT UId FROM user WHERE Login='" . $values[0] . "';");
$sth->execute();
$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->execute($values);
$statement = $dbh->prepare("INSERT INTO permission (UId, ClientApplication, AccessPrivilege) VALUES ('" . $UId['UId'] . "', 'ryzom_open', 'OPEN');");
$statement->execute($values);
- }
+ }*///FIXME: GARBAGE
}
catch (PDOException $e) {
watchdog('ryzommanage', $e->getMessage(), NULL, WATCHDOG_ERROR);
diff --git a/code/web/private_php/ams/autoload/dblayer.php b/code/web/private_php/ams/autoload/dblayer.php
index 1f361008b..da3a757a6 100644
--- a/code/web/private_php/ams/autoload/dblayer.php
+++ b/code/web/private_php/ams/autoload/dblayer.php
@@ -48,8 +48,11 @@ class DBLayer {
* @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).
*/
- 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;
// $this->host = $cfg['db'][$db]['host'];
// $this->dbname = $cfg['db'][$db]['name'];
diff --git a/code/web/private_php/ams/autoload/sync.php b/code/web/private_php/ams/autoload/sync.php
index a3bf6fdb2..f989e3e59 100644
--- a/code/web/private_php/ams/autoload/sync.php
+++ b/code/web/private_php/ams/autoload/sync.php
@@ -6,12 +6,12 @@
* @author Daan Janssens, mentored by Matthew Lagoe
*/
class Sync{
-
+
const OS_UNKNOWN = 1;
const OS_WIN = 2;
const OS_LINUX = 3;
const OS_OSX = 4;
-
+
/**
* performs the actions listed in the querycache.
* All entries in the querycache will be read and performed depending on their type.
@@ -19,13 +19,13 @@ class Sync{
* These changes are: createPermissions, createUser, change_pass, change_mail
*/
static public function syncdata ($display = false) {
-
+
if (function_exists('pcntl_fork')) {
$pid = pcntl_fork();
}
global $AMS_TMPDIR;
$pidfile = $AMS_TMPDIR.'/ams_cron_pid';
-
+
if(isset($pid) and function_exists('pcntl_fork') ) {
// We're the main process.
} else {
@@ -43,9 +43,9 @@ class Sync{
try {
$dbl = new DBLayer("lib");
$statement = $dbl->executeWithoutParams("SELECT * FROM ams_querycache");
- $rows = $statement->fetchAll();
+ $rows = $statement->fetchAll();
foreach ($rows as $record) {
-
+
$db = new DBLayer($record['db']);
switch($record['type']) {
case 'createPermissions':
@@ -54,32 +54,32 @@ class Sync{
//make connection with and put into shard db & delete from the lib
$sth=$db->selectWithParameter("UId", "user", $values, "Login= :username" );
$result = $sth->fetchAll();
- foreach ($result as $UId) {
+ /*foreach ($result as $UId) {
$ins_values = array('UId' => $UId['UId']);
$ins_values['ClientApplication'] = "r2";
$ins_values['AccessPrivilege'] = "OPEN";
$db->insert("permission", $ins_values);
$ins_values['ClientApplication'] = 'ryzom_open';
$db->insert("permission",$ins_values);
- }
+ }*/ // FIXME: GARBAGE
break;
case 'change_pass':
$decode = json_decode($record['query']);
$values = array('Password' => $decode[1]);
//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;
case 'change_mail':
$decode = json_decode($record['query']);
$values = array('Email' => $decode[1]);
//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;
- case 'createUser':
+ case 'createUser':
$decode = json_decode($record['query']);
$values = array('Login' => $decode[0], 'Password' => $decode[1], 'Email' => $decode[2] );
//make connection with and put into shard db & delete from the lib
- $db->insert("user", $values);
+ $db->insert("user", $values);
break;
}
$dbl->delete("ams_querycache", array('SID' => $record['SID']), "SID=:SID");
@@ -99,11 +99,11 @@ class Sync{
}
}
-
+
public static function check_pid($pid){
-
+
$OS = Sync::getOS();
-
+
if ($OS == 2) {
$processes = explode( "\n", shell_exec( "tasklist.exe" ));
foreach( $processes as $process )
@@ -117,7 +117,7 @@ class Sync{
}
} else {
return file_exists( "/proc/$pid" );
- }
+ }
}
static public function getOS() {
switch (true) {
diff --git a/code/web/private_php/ams/autoload/users.php b/code/web/private_php/ams/autoload/users.php
index 1754a4f05..cde30cf63 100644
--- a/code/web/private_php/ams/autoload/users.php
+++ b/code/web/private_php/ams/autoload/users.php
@@ -25,7 +25,7 @@ class Users{
$cpass = "";
$email = "";
}
-
+
if ( helpers :: check_if_game_client() or isset($FORCE_INGAME) ) {
if ( isset( $_POST["TaC"] )) {
$tac="success";
@@ -336,12 +336,12 @@ class Users{
$dbs = new DBLayer("shard");
$sth = $dbs->selectWithParameter("UId", "user", $values, "Login= :username");
$result = $sth->fetchAll();
- foreach ($result as $UId) {
+ /*foreach ($result as $UId) {
$ins_values = array('UId' => $UId['UId'], 'clientApplication' => 'r2', 'AccessPrivilege' => 'OPEN');
$dbs->insert("permission", $ins_values);
$ins_values['clientApplication'] = 'ryzom_open';
$dbs->insert("permission", $ins_values);
- }
+ }*/ // FIXME: GARBAGE
}
catch (PDOException $e) {
//oh noooz, the shard is offline! Put it in query queue at ams_lib db!
diff --git a/code/web/private_php/ams/translations/en.ini b/code/web/private_php/ams/translations/en.ini
index ca199831c..41978fe83 100644
--- a/code/web/private_php/ams/translations/en.ini
+++ b/code/web/private_php/ams/translations/en.ini
@@ -1,10 +1,6 @@
; This is a sample configuration file
; Comments start with ';', as in php.ini
-[install]
-login_info = "Please enter your MySQL Username and Password to install the database.
This is being loaded because the is_installed file is missing.
This process will take about 30 seconds."
-login_here = "here"
-
[ams_content]
ams_title="Ryzom Account Mangement System"
@@ -17,19 +13,19 @@ home_info = "Welcome to the Ryzom Core - Account Management System"
[forgot_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_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_doesnt_exist = "That emailaddress doesn't match any user!"
-email_sent = "An email with further instructions has been sent to the emailaddress!"
+email_doesnt_exist = "The email address does not match any user."
+email_sent = "An email with further instructions has been sent to the email address."
register_message ="Register If you don't have an account yet, create one "
here = "here"
login_message = "You can always try to login by clicking "
[reset_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_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_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"
-shard_online = "The shard seems to be online, manually syncing is possible: "
-shard_offline = "The shard seems to be offline, manually syncing is not possible!"
+shard_online = "The shard seems to be online, manually syncing is possible."
+shard_offline = "The shard seems to be offline, manually syncing is not possible."
members = "Members"
id = "ID"
type = "Type"
@@ -58,21 +54,21 @@ action = "Action"
[plugins]
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"
plugin_name = "Name"
plugin_version = "Version"
plugin_description = "Description"
plugin_type = "Type"
-plugin_permission = "Access Permission"
+plugin_permission = "Access
Permission"
plugin_status = "Status"
ip_success = "Plugin added succesfuly."
plugin_actions = "Actions"
-dp_success = "Plugin deleted successfuly"
+dp_success = "Plugin deleted successfully"
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."
-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."
up_success = "Update added successfully. Go to Updates page for installing updates."
up_install_success = "Update installed successfully."
@@ -99,42 +95,42 @@ title = "Title"
t_reply = "Reply on ticket"
t_fill = "Fill in your reply"
t_send = "Send reply"
-invalid_sgroup = "Invalid support group!"
+invalid_sgroup = "Invalid support group."
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"
not_assigned = "None"
-success_assigned = "The ticket was successfully assigned!"
-success_unassigned = "The ticket was successfully unassigned!"
-ticket_not_existing = "That ticket doesn't exist!"
-ticket_already_assigned = "That ticket is already assigned to someone!"
+success_assigned = "The ticket was successfully assigned."
+success_unassigned = "The ticket was successfully unassigned."
+ticket_not_existing = "That ticket doesn't exist."
+ticket_already_assigned = "That ticket is already assigned to someone."
[show_user]
[show_queue]
not_assigned = "Open"
-success_assigned = "The ticket was successfully assigned!"
-success_unassigned = "The ticket was successfully unassigned!"
-ticket_not_existing = "That ticket doesn't exist!"
-ticket_already_assigned = "That ticket is already assigned to someone!"
-ticket_not_assigned = "That ticket isn't assigned to you!"
+success_assigned = "The ticket was successfully assigned."
+success_unassigned = "The ticket was successfully unassigned."
+ticket_not_existing = "That ticket doesn't exist."
+ticket_already_assigned = "That ticket is already assigned to someone."
+ticket_not_assigned = "That ticket isn't assigned to you."
public_sgroup = "Public"
[show_sgroup]
-add_to_group_success = "The user has been added to the group!"
-user_already_added = "The user is already part of the group!"
-group_not_existing = "The group doesn't exist!"
-user_not_existing = "The user doesn't seem to exist"
-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!"
-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!"
+add_to_group_success = "The user has been added to the group."
+user_already_added = "The user is already part of the group."
+group_not_existing = "The group doesn't exist."
+user_not_existing = "The user doesn't seem to exist."
+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."
+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 currently empty."
[sgroup_list]
-group_success = "The group has been created!"
-group_name_taken = "The groupname 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_success = "The group has been created."
+group_name_taken = "The groupname 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."
[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"
[error]
-title404 = "Not
Found!"
-title403 = "Forbidden!"
-error_message404 = "This is not the page you are looking for.."
-error_message403 = "You cannot access this page!"
+title404 = "Not
Found"
+title403 = "Forbidden"
+error_message404 = "This is not the page you are looking for."
+error_message403 = "You cannot access this page."
go_home = "Go Home"
[userlist]
userlist_info = "welcome to the userlist"
[login]
-login_info = "Please login with your Email/Username and Password."
-login_error_message = "The Email/username/password were not correct!"
-login_register_message ="Register If you don't have an account yet, create one"
-login_here = "here"
-login_forgot_password_message = "In case you forgot your password, click"
+login_info = "Please login with your user name (or email) and password."
+login_error_message = "Create a new account"
+login_register_message ="Register"
+login_here = "I forgot my password"
+login_forgot_password_message = ""
[logout]
-logout_message = "You've been logged out successfully!"
+logout_message = "You've been logged out successfully."
login_title = "Login"
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_message = "You've changed the password succesfully!"
+reset_success_message = "You've changed the password succesfully."
reset_success_title = "Login"
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]
@@ -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"
login_title = "Login"
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]
title = "RYZOM CORE INGAME REGISTRATION"
@@ -235,7 +231,7 @@ Reply Content:
"
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
;==========================================================================
@@ -248,7 +244,7 @@ email_body_new_ticket_3 = " ,is newly created
"
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
;==========================================================================
@@ -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
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
;==========================================================================
-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!
This action is notified to the real ticket owner!"
;WARNUNKNOWNENDER
;==========================================================================
-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_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.
This action is notified to the real ticket owner!"
;===========================================================================
diff --git a/code/web/private_php/setup/config/config.php b/code/web/private_php/setup/config/config.php
index 4e2262f41..699b76979 100644
--- a/code/web/private_php/setup/config/config.php
+++ b/code/web/private_php/setup/config/config.php
@@ -4,6 +4,10 @@
* @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)
$cfg['db']['web']['host'] = '%amsSqlHostname%';
$cfg['db']['web']['port'] = '3306';
@@ -19,25 +23,25 @@ $cfg['db']['lib']['user'] = '%amsSqlUsername%';
$cfg['db']['lib']['pass'] = '%amsSqlPassword%';
// Variables for database access to the shard database
-$cfg['db']['shard']['host'] = '%nelSqlHostname%';
-$cfg['db']['shard']['port'] = '3306';
-$cfg['db']['shard']['name'] = '%nelDatabase%';
-$cfg['db']['shard']['user'] = '%nelSqlUsername%';
-$cfg['db']['shard']['pass'] = '%nelSqlPassword%';
+$cfg['db']['shard']['host'] = '%nelSqlHostname%';
+$cfg['db']['shard']['port'] = '3306';
+$cfg['db']['shard']['name'] = '%nelDatabase%';
+$cfg['db']['shard']['user'] = '%nelSqlUsername%';
+$cfg['db']['shard']['pass'] = '%nelSqlPassword%';
// Variables for database access to the ring_open database (only if domain role)
-// $cfg['db']['ring']['host'] = '%nelSqlHostname%';
-// $cfg['db']['ring']['port'] = '3306';
-// $cfg['db']['ring']['name'] = '%domainDatabase%';
-// $cfg['db']['ring']['user'] = '%nelSqlUsername%';
-// $cfg['db']['ring']['pass'] = '%nelSqlPassword%';
+$cfg['db']['ring']['host'] = '%nelSqlHostname%';
+$cfg['db']['ring']['port'] = '3306';
+$cfg['db']['ring']['name'] = '%domainDatabase%';
+$cfg['db']['ring']['user'] = '%nelSqlUsername%';
+$cfg['db']['ring']['pass'] = '%nelSqlPassword%';
// Variables for database access to the nel_tool database (only if service role)
-$cfg['db']['tool']['host'] = '%nelSqlHostname%';
-$cfg['db']['tool']['port'] = '3306';
-$cfg['db']['tool']['name'] = '%toolDatabase%';
-$cfg['db']['tool']['user'] = '%nelSqlUsername%';
-$cfg['db']['tool']['pass'] = '%nelSqlPassword%';
+$cfg['db']['tool']['host'] = '%nelSqlHostname%';
+$cfg['db']['tool']['port'] = '3306';
+$cfg['db']['tool']['name'] = '%toolDatabase%';
+$cfg['db']['tool']['user'] = '%nelSqlUsername%';
+$cfg['db']['tool']['pass'] = '%nelSqlPassword%';
// 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");
@@ -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.
//$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';
-//groupemail is the email that sends the email
-$cfg['mail']['default_groupemail'] = 'example@gmail.com';
-//groupname will be the name displayed as sender
+// 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';
-//the username of the account
-$cfg['mail']['default_username'] = 'example@gmail.com';
-//the matching password
+// 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.com";
+// The host, being used when a mail is sent from a support group: support_groups_name@host
+$cfg['mail']['host'] = "ryzomcore.org";
//Defines mailing related stuff
-$SUPPORT_GROUP_IMAP_CRYPTKEY = "azerty";
+$SUPPORT_GROUP_IMAP_CRYPTKEY = '%cryptKeyIMAP%';
$TICKET_MAILING_SUPPORT = false;
//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";
//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']['hash_method'] = "SHA512";
//-----------------------------------------------------------------------------------------
-// If true= the server will add automatically unknown user in the database
-// (in nel.user= nel.permission= ring.ring_user and ring.characters
-$ALLOW_UNKNOWN = true ;
-// if true= the login service automaticaly create a ring user and a editor character if needed
-$CREATE_RING = true ;
+// If true, the server will add automatically unknown user in the database
+// (in nel.user, nel.permission, ring.ring_user and ring.characters
+$ALLOW_UNKNOWN = false;
+// If true, the login service automaticaly create a ring user and a editor character if needed
+$CREATE_RING = true;
// PHP server paths
$PUBLIC_PHP_PATH = "%publicPhpDirectory%";
@@ -100,29 +104,29 @@ $AMS_TMPDIR = $AMS_LIB . '/tmp';
// Here your inc and func resides
$SITEBASE = $PUBLIC_PHP_PATH . '/ams/' ;
-//the paths to your website url
+// The paths to your website url
$BASE_WEBPATH = '/ams/';
$IMAGELOC_WEBPATH = $BASE_WEBPATH . 'img';
$WEBPATH = $BASE_WEBPATH . 'index.php';
$INGAME_WEBPATH = $BASE_WEBPATH . 'index.php';
$CONFIG_PATH = $PUBLIC_PHP_PATH;
-//defines the default language
+// Defines the default language
$DEFAULT_LANGUAGE = 'en';
-//defines if logging actions should happen or not.
+// Defines if logging actions should happen or not.
$TICKET_LOGGING = true;
-//defines the time format display
+// Defines the time format display
$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";
-//forces to load the ingame templates if set to true
+// Forces to load the ingame templates if set to true
$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_WEB_PATH = $BASE_WEBPATH . 'files/';
@@ -131,3 +135,14 @@ $NEL_SETUP_PASSWORD = '%nelSetupPassword%';
// Name of current domain (only if domain role)
$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 */
diff --git a/code/web/private_php/setup/config/config_user.php b/code/web/private_php/setup/config/config_user.php
new file mode 100644
index 000000000..916adc7c3
--- /dev/null
+++ b/code/web/private_php/setup/config/config_user.php
@@ -0,0 +1,18 @@
+ 0)) {
- $default_user_application_id = $nel_user['user_default_application_id'];
+ $default_user_application_id = $nel_user['user_default_application_id'];
}elseif (isset( $nel_user['group_default_application_id']) &&($nel_user['group_default_application_id'] > 0)) {
$default_user_application_id = $nel_user['group_default_application_id'];
}
-
+
if ($default_user_application_id > 0)
{
nt_common_add_debug("default application : user:". $nel_user['user_default_application_id'] ." group:". $nel_user['group_default_application_id']);
diff --git a/code/web/public_php/admin/functions_auth.php b/code/web/public_php/admin/functions_auth.php
index b56a12064..6f478bbc9 100644
--- a/code/web/public_php/admin/functions_auth.php
+++ b/code/web/public_php/admin/functions_auth.php
@@ -47,7 +47,7 @@
return null;
}
- function nt_auth_check_login($user,$passwd)
+ function nt_auth_check_login($user, $passwd)
{
global $db;
@@ -71,53 +71,65 @@
{
global $tpl;
- $tpl->assign('tool_login_title','Login');
+ $tpl->assign('tool_login_title', 'Login');
$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_cache_limiter('nocache');
session_start();
- header("Expires: Mon, 01 May 2000 06:00:00 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: post-check=0, pre-check=0", false);
- header("Pragma: no-cache");
+ header("Expires: Mon, 01 May 2000 06:00:00 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: post-check=0, pre-check=0", false);
+ 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;
+
+ foreach($NELTOOL['SESSION_VARS'] as $key => $val)
+ {
+ unset($NELTOOL['SESSION_VARS'][$key]);
+ }
+ }
+
+ function nt_auth_set_session_var($name, $value)
{
global $NELTOOL;
- foreach($NELTOOL['SESSION_VARS'] as $key => $val)
- {
- unset($NELTOOL['SESSION_VARS'][$key]);
- }
- }
-
- function nt_auth_set_session_var($name,$value)
- {
- global $NELTOOL;
-
- $NELTOOL['SESSION_VARS'][$name] = $value;
+ $NELTOOL['SESSION_VARS'][$name] = $value;
}
function nt_auth_get_session_var($name)
{
- global $NELTOOL;
+ global $NELTOOL;
- if (isset($NELTOOL['SESSION_VARS'][$name])) return $NELTOOL['SESSION_VARS'][$name];
- return null;
+ if (isset($NELTOOL['SESSION_VARS'][$name])) return $NELTOOL['SESSION_VARS'][$name];
+ 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]);
}
?>
diff --git a/code/web/public_php/login/config.php b/code/web/public_php/login/config.php
new file mode 100644
index 000000000..805252b62
--- /dev/null
+++ b/code/web/public_php/login/config.php
@@ -0,0 +1,32 @@
+
diff --git a/code/web/public_php/login/r2_login.php b/code/web/public_php/login/r2_login.php
index 8e97aafae..a1bccc13a 100644
--- a/code/web/public_php/login/r2_login.php
+++ b/code/web/public_php/login/r2_login.php
@@ -176,7 +176,6 @@
// if we need to create missing ring info
if ($AutoCreateRingInfo)
{
- ////////////// Temporary code alpha 0 only /////////////////////////////////////
// check if the ring user exist, and create it if not
$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));
@@ -190,17 +189,6 @@
$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)));
}
-
-// // 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
@@ -324,7 +312,7 @@
$extended = $row["ExtendedPrivilege"];
// 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)));
$res = false;
@@ -338,40 +326,6 @@
else
{
$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
@@ -385,14 +339,14 @@
// check if the user can use this application
$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)));
if (mysqli_num_rows ($result) == 0)
{
if ($AcceptUnknownUser)
{
// 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)));
$reason = errorMsg(3010);
@@ -416,7 +370,7 @@
if ($AcceptUnknownUser)
{
// 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)));
$reason = errorMsg(3012, $accessPriv);
diff --git a/code/web/public_php/setup/database.php b/code/web/public_php/setup/database.php
index 564e74039..16ab10dcd 100644
--- a/code/web/public_php/setup/database.php
+++ b/code/web/public_php/setup/database.php
@@ -57,6 +57,14 @@ function upgrade_service_databases($continue_r) {
$continue = update_database_structure($continue, $con, "nel_00001.sql");
$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");
$con = null;
diff --git a/code/web/public_php/setup/header.php b/code/web/public_php/setup/header.php
index 317637ef8..b937c6913 100644
--- a/code/web/public_php/setup/header.php
+++ b/code/web/public_php/setup/header.php
@@ -1,5 +1,6 @@
Add Domain
-->
-
+
diff --git a/code/web/public_php/setup/install.php b/code/web/public_php/setup/install.php
index f8dfbdab2..7eb3a7925 100644
--- a/code/web/public_php/setup/install.php
+++ b/code/web/public_php/setup/install.php
@@ -34,6 +34,13 @@ include('header.php');
$continue = false;
}
+ if ($continue) {
+ if (!extension_loaded('mcrypt')) {
+ printalert("danger", "The mcrypt extension is missing. Please check your PHP configuration");
+ $continue = false;
+ }
+ }
+
// Validate basics
if ($continue) {
if (file_exists($_POST["privatePhpDirectory"])) {
@@ -136,6 +143,11 @@ include('header.php');
$config = str_replace("%nelSetupPassword%", addslashes($_POST["nelSetupPassword"]), $config);
$config = str_replace("%domainDatabase%", addslashes($_POST["domainDatabase"]), $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)) {
printalert("success", "Generated config.php");
} 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 config_user.php");
+ $continue = false;
+ } else {
+ if (file_put_contents("config_user.php", $configUser)) {
+ printalert("success", "Copied config_user.php");
+ } else {
+ printalert("danger", "Cannot write to config.php");
+ $continue = false;
+ }
+ }
+ }
+
// Load config
if ($continue) {
try {
diff --git a/code/web/public_php/setup/upgrade.php b/code/web/public_php/setup/upgrade.php
index f8cebb9e2..cc157a997 100644
--- a/code/web/public_php/setup/upgrade.php
+++ b/code/web/public_php/setup/upgrade.php
@@ -10,6 +10,10 @@ $pageTitle = "Upgrade";
include('header.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');
config.php");
} else {
@@ -50,18 +86,24 @@ require_once('config.php');
}
}
- require_once('database.php');
-
- if (file_exists("role_support")) {
- $continue = upgrade_support_databases($continue);
+ // Create config_user.php if it doesn't exist yet
+ if ($continue && !file_exists("config_user.php")) {
+ $configUser = file_get_contents($PRIVATE_PHP_PATH . "/setup/config/config_user.php");
+ if (!$configUser) {
+ printalert("danger", "Cannot read config_user.php");
+ $continue = false;
+ } else {
+ if (file_put_contents("config_user.php", $configUser)) {
+ printalert("success", "Copied config_user.php");
+ } else {
+ printalert("danger", "Cannot write to config.php");
+ $continue = false;
+ }
+ }
}
- if (file_exists("role_service")) {
- $continue = upgrade_service_databases($continue);
- }
-
- if (file_exists("role_domain")) {
- $continue = upgrade_domain_databases($continue);
+ if ($continue) {
+ printalert("success", "Upgrade complete");
}
?>
@@ -70,7 +112,7 @@ require_once('config.php');
Continue
-
+
Backup
diff --git a/code/web/public_php/setup/version.php b/code/web/public_php/setup/version.php
new file mode 100644
index 000000000..67ccd7243
--- /dev/null
+++ b/code/web/public_php/setup/version.php
@@ -0,0 +1,6 @@
+