+
+/**
+ @brief Base class for the config tool's settings page widgets.
+*/
+class CWidgetBase : public QWidget
+{
+ Q_OBJECT
+
+public:
+ CWidgetBase( QWidget *parent = NULL ) : QWidget( parent ) {}
+ ~CWidgetBase() {}
+
+ /**
+ @brief Tells the widget to load it's values from the config.
+ */
+ virtual void load() = 0;
+
+ /**
+ @brief Tells the widget to save it's values into the config.
+ */
+ virtual void save() = 0;
+
+signals:
+ /**
+ @brief Emitted when the user changes a setting.
+ */
+ void changed();
+
+
+private slots:
+ /**
+ @brief Triggered when something changes in the widget, emits the Changed() signal.
+ */
+ void onSomethingChanged()
+ {
+ emit changed();
+ }
+};
+
+
+#endif
diff --git a/code/ryzom/tools/server/admin/common.php b/code/ryzom/tools/server/admin/common.php
index de49cfe4a..644ebba32 100644
--- a/code/ryzom/tools/server/admin/common.php
+++ b/code/ryzom/tools/server/admin/common.php
@@ -69,7 +69,7 @@
{
$nel_user = null;
nt_auth_stop_session();
- nt_common_redirect('index.php');
+ nt_common_redirect('');
exit();
}
elseif (isset($NELTOOL['SESSION_VARS']['nelid']) && !empty($NELTOOL['SESSION_VARS']['nelid']))
@@ -138,9 +138,12 @@
if (isset($nel_user['new_login']))
{
$default_user_application_id = 0;
- if ($nel_user['user_default_application_id'] > 0) $default_user_application_id = $nel_user['user_default_application_id'];
- elseif ($nel_user['group_default_application_id'] > 0) $default_user_application_id = $nel_user['group_default_application_id'];
-
+ if (isset( $nel_user['user_default_application_id']) &&($nel_user['user_default_application_id'] > 0)) {
+ $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/ryzom/tools/server/admin/config.php b/code/ryzom/tools/server/admin/config.php
index 4d4c223a4..530adcb43 100644
--- a/code/ryzom/tools/server/admin/config.php
+++ b/code/ryzom/tools/server/admin/config.php
@@ -9,8 +9,8 @@
define('NELTOOL_DBNAME','nel_tool');
// site paths definitions
- define('NELTOOL_SITEBASE','http://open.ryzom.com/');
- define('NELTOOL_SYSTEMBASE','/home/nevrax/hg/code/ryzom/tools/server/admin/');
+ define('NELTOOL_SITEBASE',$_SERVER['PHP_SELF']);
+ define('NELTOOL_SYSTEMBASE',dirname( dirname(__FILE__) ) . '/admin/');
define('NELTOOL_LOGBASE', NELTOOL_SYSTEMBASE .'/logs/');
define('NELTOOL_IMGBASE', NELTOOL_SYSTEMBASE .'/imgs/');
diff --git a/code/ryzom/tools/server/admin/functions_mysql.php b/code/ryzom/tools/server/admin/functions_mysql.php
index 9ce5ec3de..6778bbeff 100644
--- a/code/ryzom/tools/server/admin/functions_mysql.php
+++ b/code/ryzom/tools/server/admin/functions_mysql.php
@@ -114,7 +114,7 @@ class sql_db
}
else
{
- return ( $transaction == END_TRANSACTION ) ? true : false;
+ return ( $transaction == 'END_TRANSACTION' ) ? true : false;
}
}
diff --git a/code/ryzom/tools/server/admin/functions_tool_main.php b/code/ryzom/tools/server/admin/functions_tool_main.php
index 9ab2a5b9e..cb541a83e 100644
--- a/code/ryzom/tools/server/admin/functions_tool_main.php
+++ b/code/ryzom/tools/server/admin/functions_tool_main.php
@@ -1,12 +1,12 @@
'Every 5 secs',
'secs' => 5,
),
array('desc' => 'Every 30 secs',
'secs' => 30,
- ),*/
+ ),
array('desc' => 'Every 1 min.',
'secs' => 60,
),
diff --git a/code/ryzom/tools/server/admin/tool_preferences.php b/code/ryzom/tools/server/admin/tool_preferences.php
index 88e8d289c..045034067 100644
--- a/code/ryzom/tools/server/admin/tool_preferences.php
+++ b/code/ryzom/tools/server/admin/tool_preferences.php
@@ -9,7 +9,7 @@
$tpl->assign("tool_v_login", $nel_user['user_name']);
$tpl->assign("tool_v_user_id", $nel_user['user_id']);
$tpl->assign("tool_v_menu", $nel_user['user_menu_style']);
- $tpl->assign("tool_v_application", $nel_user['user_default_application_id']);
+ $tpl->assign("tool_v_application", isset($nel_user['user_default_application_id']) ? $nel_user['user_default_application_id']:'') ;
if (isset($NELTOOL['POST_VARS']['tool_form_user_id']))
{
diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php
new file mode 100644
index 000000000..2596d5c26
--- /dev/null
+++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php
@@ -0,0 +1,20 @@
+ 12) {
+ return "Username must be no more than 12 characters.";
+ } elseif (strlen($username) < 5) {
+ return "Username must be 5 or more characters.";
+ } elseif (!preg_match('/^[a-z0-9\.]*$/', $username)) {
+ return "Username can only contain numbers and letters.";
+ } elseif (sql::db_query("SELECT COUNT(*) FROM {users} WHERE name = :name", array(
+ ':name' => $username
+ ))->fetchField()) {
+ return "Username " . $username . " is in use.";
+ } else {
+ return "success";
+ }
+ } else {
+ return "success";
+ }
+ return "fail";
+}
+/**
+ *
+ * Function checkPassword
+ *
+ * @takes $pass
+ * @return string
+ *
+ * Info: Returns a string based on if the password is valid, if valid then "success" is returned
+ *
+ */
+public function checkPassword($pass)
+{
+ if (isset($pass)) {
+ if (strlen($pass) > 20) {
+ return "Password must be no more than 20 characters.";
+ } elseif (strlen($pass) < 5) {
+ return "Password must be more than 5 characters.";
+ } else {
+ return "success";
+ }
+ }
+ return "fail";
+}
+/**
+ *
+ * Function confirmPassword
+ *
+ * @takes $pass
+ * @return string
+ *
+ * Info: Verify's $_POST["Password"] is the same as $_POST["ConfirmPass"]
+ *
+ */
+public function confirmPassword()
+{
+ if (($_POST["Password"]) != ($_POST["ConfirmPass"])) {
+ return "Passwords do not match.";
+ } else {
+ return "success";
+ }
+ return "fail";
+}
+/**
+ *
+ * Function checkEmail
+ *
+ * @takes $email
+ * @return
+ *
+ *
+ *
+ */
+public function checkEmail($email)
+{
+ if (isset($email)) {
+ if (!validEmail($email)) {
+ return "Email address is not valid.";
+ } elseif (db_query("SELECT COUNT(*) FROM {users} WHERE mail = :mail", array(
+ ':mail' => $email
+ ))->fetchField()) {
+ return "Email is in use.";
+ } else {
+ return "success";
+ }
+ } else {
+ return "success";
+ }
+ return "fail";
+}
+public function validEmail($email)
+{
+ $isValid = true;
+ $atIndex = strrpos($email, "@");
+ if (is_bool($atIndex) && !$atIndex) {
+ $isValid = false;
+ } else {
+ $domain = substr($email, $atIndex + 1);
+ $local = substr($email, 0, $atIndex);
+ $localLen = strlen($local);
+ $domainLen = strlen($domain);
+ if ($localLen < 1 || $localLen > 64) {
+ // local part length exceeded
+ $isValid = false;
+ } else if ($domainLen < 1 || $domainLen > 255) {
+ // domain part length exceeded
+ $isValid = false;
+ } else if ($local[0] == '.' || $local[$localLen - 1] == '.') {
+ // local part starts or ends with '.'
+ $isValid = false;
+ } else if (preg_match('/\\.\\./', $local)) {
+ // local part has two consecutive dots
+ $isValid = false;
+ } else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)) {
+ // character not valid in domain part
+ $isValid = false;
+ } else if (preg_match('/\\.\\./', $domain)) {
+ // domain part has two consecutive dots
+ $isValid = false;
+ } else if (!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/', str_replace("\\\\", "", $local))) {
+ // character not valid in local part unless
+ // local part is quoted
+ if (!preg_match('/^"(\\\\"|[^"])+"$/', str_replace("\\\\", "", $local))) {
+ $isValid = false;
+ }
+ }
+ if ($isValid && !(checkdnsrr($domain, "MX") || checkdnsrr($domain, "A"))) {
+ // domain not found in DNS
+ $isValid = false;
+ }
+ }
+ return $isValid;
+}
+public function generateSALT($length = 2)
+{
+ // start with a blank salt
+ $salt = "";
+ // define possible characters - any character in this string can be
+ // picked for use in the salt, so if you want to put vowels back in
+ // or add special characters such as exclamation marks, this is where
+ // you should do it
+ $possible = "2346789bcdfghjkmnpqrtvwxyzBCDFGHJKLMNPQRTVWXYZ";
+ // we refer to the length of $possible a few times, so let's grab it now
+ $maxlength = strlen($possible);
+ // check for length overflow and truncate if necessary
+ if ($length > $maxlength) {
+ $length = $maxlength;
+ }
+ // set up a counter for how many characters are in the salt so far
+ $i = 0;
+ // add random characters to $salt until $length is reached
+ while ($i < $length) {
+ // pick a random character from the possible ones
+ $char = substr($possible, mt_rand(0, $maxlength - 1), 1);
+ // have we already used this character in $salt?
+ if (!strstr($salt, $char)) {
+ // no, so it's OK to add it onto the end of whatever we've already got...
+ $salt .= $char;
+ // ... and increase the counter by one
+ $i++;
+ }
+ }
+ // done!
+ return $salt;
+}
+}
+
diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/register.phtml b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/register.phtml
new file mode 100644
index 000000000..ebaf1f795
--- /dev/null
+++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/register.phtml
@@ -0,0 +1,117 @@
+
+ aRYZOM CORE INGAME REGISTRATION
+
+
+
+
+
+
+
+
+
+
+
+ 5-12 lower-case characters and numbers. The login (username) you create here will be
+ your login name. The name of your game characters will be chosen later on.
+
+
+
+ 5-20 characters.
+
+
+
+ Retype your Password
+
+
+
+ Please verify that the e-mail address you enter here is valid and will remain valid
+ in the future. It will be used to manage your account.
+
+
+
\ No newline at end of file
diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/libinclude.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/libinclude.php
new file mode 100644
index 000000000..14939735f
--- /dev/null
+++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/libinclude.php
@@ -0,0 +1,8 @@
+ $_POST["Username"],
+ 'pass' => $_POST["Password"],
+ 'mail' => $_POST["Email"],
+ 'init' => $_POST["Email"],
+ 'unhashpass' => $_POST["Password"],
+ 'status' => 1,
+ 'access' => REQUEST_TIME
+ );
+ user_save( NULL, $edit );
+ header( 'Location: email_sent.php' );
+ exit;
+ }else{
+ $pageElements = array(
+ 'GAME_NAME' => $GAME_NAME,
+ 'WELCOME_MESSAGE' => $WELCOME_MESSAGE,
+ 'USERNAME' => $user,
+ 'PASSWORD' => $pass,
+ 'CPASSWORD' => $cpass,
+ 'EMAIL' => $email
+ );
+ if ( $user != "success" ){
+ $pageElements['USERNAME_ERROR'] = 'TRUE';
+ }else{
+ $pageElements['USERNAME_ERROR'] = 'FALSE';
+ }
+
+ if ( $pass != "success" ){
+ $pageElements['PASSWORD_ERROR'] = 'TRUE';
+ }else{
+ $pageElements['PASSWORD_ERROR'] = 'FALSE';
+ }
+ if ( $cpass != "success" ){
+ $pageElements['CPASSWORD_ERROR'] = 'TRUE';
+ }else{
+ $pageElements['CPASSWORD_ERROR'] = 'FALSE';
+ }
+ if ( $email != "success" ){
+ $pageElements['EMAIL_ERROR'] = 'TRUE';
+ }else{
+ $pageElements['EMAIL_ERROR'] = 'FALSE';
+ }
+ if ( isset( $_POST["TaC"] ) ){
+ $pageElements['TAC_ERROR'] = 'FALSE';
+ }else{
+ $pageElements['TAC_ERROR'] = 'TRUE';
+ }
+ if ( helpers :: check_if_game_client() ){
+ helpers :: loadtemplate( '../../ams_lib/ingame_templates/register.phtml', $pageElements );
+ }else{
+ helpers :: loadtemplate( 'templates/register.phtml', $pageElements );
+ }
+ }
diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/add_user.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/add_user.php
new file mode 100644
index 000000000..9b3441006
--- /dev/null
+++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/add_user.php
@@ -0,0 +1,9 @@
+
+This is a footer
+