[WIP] More work on settings

Move more config to settings (mainly mail_* + some other)
Remove mail_admin, wasnt used anywhere
Add return type to some functions
Add Twig settings(key) function
Possibility to save setting to db
This commit is contained in:
slawkens
2023-05-15 23:14:13 +02:00
parent 449fc2c1cf
commit 7929967ddc
29 changed files with 403 additions and 218 deletions

View File

@@ -69,7 +69,7 @@ else
$account_logged->logAction('Account password changed.');
$message = '';
if($config['mail_enabled'] && $config['send_mail_when_change_password']) {
if(setting('core.mail_enabled') && $config['send_mail_when_change_password']) {
$mailBody = $twig->render('mail.password_changed.html.twig', array(
'new_password' => $org_pass,
'ip' => get_browser_real_ip(),

View File

@@ -219,7 +219,7 @@ if($save)
$tmp_account = (USE_ACCOUNT_NAME ? $account_name : $account_id);
}
if($config['mail_enabled'] && $config['account_mail_verify'])
if(setting('core.mail_enabled') && $config['account_mail_verify'])
{
$hash = md5(generateRandomString(16, true, true) . $email);
$new_account->setCustomField('email_hash', $hash);
@@ -294,7 +294,7 @@ if($save)
'custom_buttons' => config('account_create_character_create') ? '' : null
));
if($config['mail_enabled'] && $config['account_welcome_mail'])
if(setting('core.mail_enabled') && $config['account_welcome_mail'])
{
$mailBody = $twig->render('account.welcome_mail.html.twig', array(
'account' => $tmp_account
@@ -313,7 +313,7 @@ if($save)
}
$country_recognized = null;
if($config['account_country_recognize']) {
if(setting('core.account_country_recognize')) {
$country_session = getSession('country');
if($country_session !== false) { // get from session
$country_recognized = $country_session;

View File

@@ -11,7 +11,7 @@
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Lost Account Interface';
if(!$config['mail_enabled'])
if(!setting('core.mail_enabled'))
{
echo '<b>Account maker is not configured to send e-mails, you can\'t use Lost Account Interface. Contact with admin to get help.</b>';
return;

View File

@@ -35,7 +35,7 @@ if(empty($recovery_key))
$account_registered = '<b><span style="color: red">No</span></b>';
else
{
if($config['generate_new_reckey'] && $config['mail_enabled'])
if($config['generate_new_reckey'] && setting('core.mail_enabled'))
$account_registered = '<b><span style="color: green">Yes ( <a href="' . getLink('account/register/new') . '"> Buy new Recovery Key </a> )</span></b>';
else
$account_registered = '<b><span style="color: green">Yes</span></b>';

View File

@@ -31,7 +31,7 @@ if(isset($_POST['registeraccountsave']) && $_POST['registeraccountsave'] == "1")
$account_logged->logAction('Generated recovery key.');
$message = '';
if($config['mail_enabled'] && $config['send_mail_when_generate_reckey'])
if(setting('core.mail_enabled') && $config['send_mail_when_generate_reckey'])
{
$mailBody = $twig->render('mail.account.register.html.twig', array(
'recovery_key' => $new_rec_key

View File

@@ -21,7 +21,7 @@ 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'] || !$config['mail_enabled']) || empty($reckey)) {
if((!$config['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));
}