This commit is contained in:
botanic 2014-09-07 05:40:29 -07:00
commit b89faeb75b
26 changed files with 578 additions and 511 deletions

View file

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

View file

@ -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 !
@ -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);
@ -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<uint32>(_Prim));
nlverify(_ObjectCache.erase(_Prim) == 1);
nldebug("NOPE: clearing CNelPermission @%p from cache with id %u", this, static_cast<uint32>(_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);
@ -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<uint32>(_Prim));
nlverify(_ObjectCache.insert(std::make_pair(_Prim, this)).second);
nldebug("NOPE: inserting CNelPermission @%p in cache with id %u", this, static_cast<uint32>(_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<uint32>(_Prim));
nlverify(_ObjectCache.erase(_Prim) == 1);
nldebug("NOPE: erasing CNelPermission @%p in cache with id %u", this, static_cast<uint32>(_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);

View file

@ -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 !
@ -632,11 +617,11 @@ namespace RSMGR
{
protected:
//
uint32 _Prim;
uint32 _PermissionId;
//
uint32 _UserId;
//
std::string _DomainName;
uint32 _DomainId;
//
uint32 _ShardId;
//
@ -662,24 +647,20 @@ 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);
_DomainName = value;
_DomainId = 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)
@ -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.*/

View file

@ -24,9 +24,9 @@
<!-- activate database code generation -->
<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="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="std::string" name="AccessPriv" db_col="AccessPrivilege" byref="true"/>

View file

@ -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

View file

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

View file

@ -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);

View file

@ -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'];

View file

@ -54,14 +54,14 @@ 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']);

View file

@ -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!

View file

@ -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.<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_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 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 ="<strong>Register</strong> 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 <strong>online</strong>, manually syncing is possible: "
shard_offline = "The shard seems to be <strong>offline</strong>, manually syncing is not 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."
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</br> Permission"
plugin_permission = "Access<br>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<br/>Found!"
title403 = "Forbidden!"
error_message404 = "This is not the page you are looking for.."
error_message403 = "You cannot access this page!"
title404 = "Not<br/>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 ="<strong>Register</strong> 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 ="<strong>Register</strong>"
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!"
;===========================================================================

View file

@ -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';
@ -26,11 +30,11 @@ $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%';
@ -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,15 +80,15 @@ $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
// 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
@ -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 */

View 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 */

View 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` ;

View file

@ -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` ;

View file

@ -8,6 +8,9 @@
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_auth.php');

View file

@ -77,6 +77,12 @@
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();
@ -90,6 +96,12 @@
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)

View file

@ -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;
?>

View file

@ -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);

View file

@ -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;

View file

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

View file

@ -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>
</p>-->
<p>
<!--<p>
<a class="btn btn-default" style="width: 100%;" href="upgrade.php"><span class="glyphicon glyphicon-tower"></span> Add Shard</a>
</p>
</p>-->
<?php } ?>

View file

@ -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 <em>config.php</em>");
} 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
if ($continue) {
try {

View file

@ -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');
<?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) {
$config = file_get_contents($PRIVATE_PHP_PATH . "/setup/config/config.php");
if (!$config) {
@ -39,8 +68,15 @@ require_once('config.php');
$config = str_replace("%amsDatabase%", addslashes($cfg['db']['web']['name']), $config);
$config = str_replace("%amsLibDatabase%", addslashes($cfg['db']['lib']['name']), $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("%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)) {
printalert("success", "Generated <em>config.php</em>");
} 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 <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;
}
}
}
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');
<a class="btn btn-primary" href="index.php">Continue</a>
</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-heading"><span class="glyphicon glyphicon-hdd"></span> Backup</div>

View file

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

View 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;
?>