diff --git a/system/compat/config.php b/system/compat/config.php
index 4b9bedf0..ef329afa 100644
--- a/system/compat/config.php
+++ b/system/compat/config.php
@@ -51,7 +51,11 @@ $deprecatedConfig = [
'status_port',
'mail_enabled',
'account_mail_verify',
- 'account_create_character_create'
+ 'account_create_character_create',
+ 'account_change_character_name',
+ 'account_change_character_name_points' => 'account_change_character_name_price',
+ 'account_change_character_sex',
+ 'account_change_character_sex_points' => 'account_change_character_name_price',
];
foreach ($deprecatedConfig as $key => $value) {
diff --git a/system/config.php b/system/config.php
index 92b7c678..5fba18f4 100644
--- a/system/config.php
+++ b/system/config.php
@@ -20,16 +20,8 @@
// this file will be deleted, once all migrated to settings
$config = array(
'account_mail_block_plus_sign' => true, // block email with '+' signs like test+box@gmail.com (help protect against spamming accounts)
- 'account_change_character_name' => false, // can user change their character name for premium points?
- 'account_change_character_name_points' => 30, // cost of name change
- 'account_change_character_sex' => false, // can user change their character sex for premium points?
- 'account_change_character_sex_points' => 30, // cost of sex change
'characters_per_account' => 10, // max. number of characters per account
- //
- 'generate_new_reckey' => true, // let player generate new recovery key, he will receive e-mail with new rec key (not display on page, hacker can't generate rec key)
- 'generate_new_reckey_price' => 20, // price for new recovery key
-
// new character config
'character_samples' => array( // vocations, format: ID_of_vocation => 'Name of Character to copy'
//0 => 'Rook Sample',
diff --git a/system/pages/account/change_name.php b/system/pages/account/change_name.php
index f6053733..ef82b9ad 100644
--- a/system/pages/account/change_name.php
+++ b/system/pages/account/change_name.php
@@ -19,14 +19,14 @@ if(!$logged) {
$player_id = isset($_POST['player_id']) ? (int)$_POST['player_id'] : NULL;
$name = isset($_POST['name']) ? stripslashes(ucwords(strtolower($_POST['name']))) : NULL;
-if((!$config['account_change_character_name']))
+if((!setting('core.account_change_character_name')))
echo 'Changing character name for premium points is disabled on this server.';
else
{
- $points = $account_logged->getCustomField('premium_points');
+ $points = $account_logged->getCustomField(setting('core.donate_column'));
if(isset($_POST['changenamesave']) && $_POST['changenamesave'] == 1) {
- if($points < $config['account_change_character_name_points'])
- $errors[] = 'You need ' . $config['account_change_character_name_points'] . ' premium points to change name. You have '.$points.' premium points.';
+ if($points < setting('core.account_change_character_name_price'))
+ $errors[] = 'You need ' . setting('core.account_change_character_name_price') . ' premium points to change name. You have '.$points.' premium points.';
$minLength = setting('core.create_character_name_min_length');
$maxLength = setting('core.create_character_name_max_length');
@@ -86,7 +86,7 @@ else
}
}
- $account_logged->setCustomField("premium_points", $points - $config['account_change_character_name_points']);
+ $account_logged->setCustomField(setting('core.donate_column'), $points - setting('core.account_change_character_name_price'));
$account_logged->logAction('Changed name from ' . $old_name . ' to ' . $player->getName() . '.');
$twig->display('success.html.twig', array(
'title' => 'Character Name Changed',
diff --git a/system/pages/account/change_sex.php b/system/pages/account/change_sex.php
index 2f944564..7e43b6ff 100644
--- a/system/pages/account/change_sex.php
+++ b/system/pages/account/change_sex.php
@@ -20,14 +20,14 @@ if(!$logged) {
$sex_changed = false;
$player_id = isset($_POST['player_id']) ? (int)$_POST['player_id'] : NULL;
$new_sex = isset($_POST['new_sex']) ? (int)$_POST['new_sex'] : NULL;
-if((!$config['account_change_character_sex']))
+if((!setting('core.account_change_character_sex')))
echo 'You cant change your character sex';
else
{
- $points = $account_logged->getCustomField('premium_points');
+ $points = $account_logged->getCustomField(setting('core.donate_column'));
if(isset($_POST['changesexsave']) && $_POST['changesexsave'] == 1) {
- if($points < $config['account_change_character_sex_points'])
- $errors[] = 'You need ' . $config['account_change_character_sex_points'] . ' premium points to change sex. You have '.$points.' premium points.';
+ if($points < setting('core.account_change_character_sex_price'))
+ $errors[] = 'You need ' . setting('core.account_change_character_sex_price') . ' premium points to change sex. You have '.$points.' premium points.';
if(empty($errors) && !isset($config['genders'][$new_sex])) {
$errors[] = 'This sex is invalid.';
@@ -66,7 +66,7 @@ else
$new_sex_str = $config['genders'][$new_sex];
$player->save();
- $account_logged->setCustomField("premium_points", $points - $config['account_change_character_name_points']);
+ $account_logged->setCustomField(setting('core.donate_column'), $points - setting('core.account_change_character_name_price'));
$account_logged->logAction('Changed sex on character ' . $player->getName() . ' from ' . $old_sex_str . ' to ' . $new_sex_str . '.');
$twig->display('success.html.twig', array(
'title' => 'Character Sex Changed',
diff --git a/system/pages/account/manage.php b/system/pages/account/manage.php
index 038bb15e..c4a8402a 100644
--- a/system/pages/account/manage.php
+++ b/system/pages/account/manage.php
@@ -35,7 +35,7 @@ if(empty($recovery_key))
$account_registered = 'No';
else
{
- if($config['generate_new_reckey'] && setting('core.mail_enabled'))
+ if(setting('core.account_generate_new_reckey') && setting('core.mail_enabled'))
$account_registered = 'Yes ( Buy new Recovery Key )';
else
$account_registered = 'Yes';
diff --git a/system/pages/account/register_new.php b/system/pages/account/register_new.php
index 7a5b43dc..04e8bf33 100644
--- a/system/pages/account/register_new.php
+++ b/system/pages/account/register_new.php
@@ -21,18 +21,18 @@ if(isset($_POST['reg_password']))
$reg_password = encrypt((USE_ACCOUNT_SALT ? $account_logged->getCustomField('salt') : '') . $_POST['reg_password']);
$reckey = $account_logged->getCustomField('key');
-if((!$config['generate_new_reckey'] || !setting('core.mail_enabled')) || empty($reckey)) {
+if((!setting('core.account_generate_new_reckey') || !setting('core.mail_enabled')) || empty($reckey)) {
$errors[] = 'You cant get new recovery key.';
$twig->display('error_box.html.twig', array('errors' => $errors));
}
else
{
- $points = $account_logged->getCustomField('premium_points');
+ $points = $account_logged->getCustomField(setting('core.donate_column'));
if(isset($_POST['registeraccountsave']) && $_POST['registeraccountsave'] == '1')
{
if($reg_password == $account_logged->getPassword())
{
- if($points >= $config['generate_new_reckey_price'])
+ if($points >= setting('core.account_generate_new_reckey_price'))
{
$show_form = false;
$new_rec_key = generateRandomString(10, false, true, true);
@@ -43,10 +43,10 @@ else
if(_mail($account_logged->getEMail(), $config['lua']['serverName']." - new recovery key", $mailBody))
{
- $account_logged->setCustomField("key", $new_rec_key);
- $account_logged->setCustomField("premium_points", $account_logged->getCustomField("premium_points") - $config['generate_new_reckey_price']);
- $account_logged->logAction('Generated new recovery key for ' . $config['generate_new_reckey_price'] . ' premium points.');
- $message = '
Your recovery key were send on email address '.$account_logged->getEMail().' for '.$config['generate_new_reckey_price'].' premium points.';
+ $account_logged->setCustomField('key', $new_rec_key);
+ $account_logged->setCustomField(setting('core.donate_column'), $account_logged->getCustomField(setting('core.donate_column')) - setting('core.account_generate_new_reckey_price'));
+ $account_logged->logAction('Generated new recovery key for ' . setting('core.account_generate_new_reckey_price') . ' premium points.');
+ $message = '
Your recovery key were send on email address '.$account_logged->getEMail().' for '.setting('core.account_generate_new_reckey_price').' premium points.';
}
else
$message = '
An error occurred while sending email ( '.$account_logged->getEMail().' ) with recovery key! Recovery key not changed. Try again later. For Admin: More info can be found in system/logs/mailer-error.log
'; @@ -57,7 +57,7 @@ else )); } else - $errors[] = 'You need '.$config['generate_new_reckey_price'].' premium points to generate new recovery key. You have '.$points.' premium points.'; + $errors[] = 'You need ' . setting('core.account_generate_new_reckey_price') . ' premium points to generate new recovery key. You have '.$points.' premium points.'; } else $errors[] = 'Wrong password to account.'; diff --git a/system/settings.php b/system/settings.php index 96904363..04cea71f 100644 --- a/system/settings.php +++ b/system/settings.php @@ -1295,6 +1295,61 @@ Sent by MyAAC,