mirror of
https://github.com/slawkens/myaac.git
synced 2025-05-02 04:09:21 +02:00
[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:
parent
449fc2c1cf
commit
7929967ddc
@ -361,7 +361,7 @@ else if (isset($_REQUEST['search'])) {
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-12 col-sm-12 col-lg-6">
|
||||
<label for="email">Email:</label><?php echo (config('mail_enabled') ? ' (<a href="' . ADMIN_URL . '?p=mailer&mail_to=' . $account->getEMail() . '">Send Mail</a>)' : ''); ?>
|
||||
<label for="email">Email:</label><?php echo (setting('core.mail_enabled') ? ' (<a href="' . ADMIN_URL . '?p=mailer&mail_to=' . $account->getEMail() . '">Send Mail</a>)' : ''); ?>
|
||||
<input type="text" class="form-control" id="email" name="email" autocomplete="off" value="<?php echo $account->getEMail(); ?>"/>
|
||||
</div>
|
||||
<?php if ($hasCoinsColumn): ?>
|
||||
|
@ -15,7 +15,7 @@ if (!hasFlag(FLAG_CONTENT_MAILER) && !superAdmin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!config('mail_enabled')) {
|
||||
if (!setting('core.mail_enabled')) {
|
||||
echo 'Mail support disabled in config.';
|
||||
return;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ if (isset($_POST['save'])) {
|
||||
|
||||
$title = ($plugin == 'core' ? 'Settings' : 'Plugin Settings - ' . $plugin);
|
||||
|
||||
$settings = Settings::parse($plugin, $settingsFile['settings']);
|
||||
$settings = Settings::display($plugin, $settingsFile['settings']);
|
||||
|
||||
$twig->display('admin.settings.html.twig', [
|
||||
'settings' => $settings,
|
||||
|
@ -16,7 +16,7 @@ use DeviceDetector\Parser\OperatingSystem;
|
||||
$title = 'Visitors';
|
||||
$use_datatable = true;
|
||||
|
||||
if (!$config['visitors_counter']): ?>
|
||||
if (!setting('core.visitors_counter')): ?>
|
||||
Visitors counter is disabled.<br/>
|
||||
You can enable it by editing this configurable in <b>config.local.php</b> file:<br/>
|
||||
<p style="margin-left: 3em;"><b>$config['visitors_counter'] = true;</b></p>
|
||||
@ -25,10 +25,9 @@ if (!$config['visitors_counter']): ?>
|
||||
endif;
|
||||
|
||||
require SYSTEM . 'libs/visitors.php';
|
||||
$visitors = new Visitors($config['visitors_counter_ttl']);
|
||||
$visitors = new Visitors(setting('core.visitors_counter_ttl'));
|
||||
|
||||
function compare($a, $b)
|
||||
{
|
||||
function compare($a, $b): int {
|
||||
return $a['lastvisit'] > $b['lastvisit'] ? -1 : 1;
|
||||
}
|
||||
|
||||
@ -61,7 +60,7 @@ foreach ($tmp as &$visitor) {
|
||||
}
|
||||
|
||||
$twig->display('admin.visitors.html.twig', array(
|
||||
'config_visitors_counter_ttl' => $config['visitors_counter_ttl'],
|
||||
'config_visitors_counter_ttl' => setting('core.visitors_counter_ttl'),
|
||||
'visitors' => $tmp
|
||||
));
|
||||
?>
|
||||
|
@ -17,7 +17,7 @@ return [
|
||||
['name' => 'Add', 'link' => 'changelog&action=new', 'icon' => 'plus', 'order' => 20],
|
||||
],
|
||||
],
|
||||
['name' => 'Mailer', 'icon' => 'envelope', 'order' => 40, 'link' => 'mailer', 'disabled' => !config('mail_enabled')],
|
||||
['name' => 'Mailer', 'icon' => 'envelope', 'order' => 40, 'link' => 'mailer', 'disabled' => !setting('core.mail_enabled')],
|
||||
['name' => 'Pages', 'icon' => 'book', 'order' => 50, 'link' =>
|
||||
[
|
||||
['name' => 'View', 'link' => 'pages', 'icon' => 'list', 'order' => 10],
|
||||
|
22
config.php
22
config.php
@ -61,23 +61,6 @@ $config = array(
|
||||
'account_change_character_sex_points' => 30, // cost of sex change
|
||||
'characters_per_account' => 10, // max. number of characters per account
|
||||
|
||||
// mail
|
||||
'mail_enabled' => false, // is aac maker configured to send e-mails?
|
||||
'mail_address' => 'no-reply@your-server.org', // server e-mail address (from:)
|
||||
'mail_admin' => 'your-address@your-server.org', // admin email address, where mails from contact form will be sent
|
||||
'mail_signature' => array( // signature that will be included at the end of every message sent using _mail function
|
||||
'plain' => ""/*"--\nMy Server,\nhttp://www.myserver.com"*/,
|
||||
'html' => ''/*'<br/>My Server,\n<a href="http://www.myserver.com">myserver.com</a>'*/
|
||||
),
|
||||
'smtp_enabled' => false, // send by smtp or mail function (set false if use mail function, set to true if you use GMail or Microsoft Outlook)
|
||||
'smtp_host' => '', // mail host. smtp.gmail.com for GMail / smtp-mail.outlook.com for Microsoft Outlook
|
||||
'smtp_port' => 25, // 25 (default) / 465 (ssl, GMail) / 587 (tls, Microsoft Outlook)
|
||||
'smtp_auth' => true, // need authorization?
|
||||
'smtp_user' => 'admin@example.org', // here your email username
|
||||
'smtp_pass' => '',
|
||||
'smtp_secure' => '', // What kind of encryption to use on the SMTP connection. Options: '', 'ssl' (GMail) or 'tls' (Microsoft Outlook)
|
||||
'smtp_debug' => false, // set true to debug (you will see more info in error.log)
|
||||
|
||||
//
|
||||
'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
|
||||
@ -217,13 +200,8 @@ $config = array(
|
||||
'admin_panel_modules' => 'statistics,web_status,server_status,lastlogin,created,points,coins,balance', // default - statistics,web_status,server_status,lastlogin,created,points,coins,balance
|
||||
|
||||
// other
|
||||
'anonymous_usage_statistics' => true,
|
||||
'email_lai_sec_interval' => 60, // time in seconds between e-mails to one account from lost account interface, block spam
|
||||
'google_analytics_id' => '', // e.g.: UA-XXXXXXX-X
|
||||
'experiencetable_columns' => 3, // how many columns to display in experience table page. * experiencetable_rows, 5 = 500 (will show up to 500 level)
|
||||
'experiencetable_rows' => 200, // till how many levels in one column
|
||||
'date_timezone' => 'Europe/Berlin', // more info at http://php.net/manual/en/timezones.php
|
||||
'footer_show_load_time' => true, // display load time of the page in the footer
|
||||
|
||||
'npc' => array()
|
||||
);
|
||||
|
11
index.php
11
index.php
@ -104,7 +104,7 @@ $hooks->trigger(HOOK_STARTUP);
|
||||
|
||||
// anonymous usage statistics
|
||||
// sent only when user agrees
|
||||
if(isset($config['anonymous_usage_statistics']) && $config['anonymous_usage_statistics']) {
|
||||
if(setting('core.anonymous_usage_statistics')) {
|
||||
$report_time = 30 * 24 * 60 * 60; // report one time per 30 days
|
||||
$should_report = true;
|
||||
|
||||
@ -137,17 +137,16 @@ if(isset($config['anonymous_usage_statistics']) && $config['anonymous_usage_stat
|
||||
}
|
||||
}
|
||||
|
||||
if($config['views_counter'])
|
||||
if(setting('core.views_counter'))
|
||||
require_once SYSTEM . 'counter.php';
|
||||
|
||||
if($config['visitors_counter'])
|
||||
{
|
||||
if(setting('core.visitors_counter')) {
|
||||
require_once SYSTEM . 'libs/visitors.php';
|
||||
$visitors = new Visitors($config['visitors_counter_ttl']);
|
||||
$visitors = new Visitors(setting('core.visitors_counter_ttl'));
|
||||
}
|
||||
|
||||
// backward support for gesior
|
||||
if($config['backward_support']) {
|
||||
if(setting('core.backward_support')) {
|
||||
define('INITIALIZED', true);
|
||||
$SQL = $db;
|
||||
$layout_header = template_header();
|
||||
|
@ -91,10 +91,6 @@ if($step == 'database') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if($key == 'mail_admin' && !Validator::email($value)) {
|
||||
$errors[] = $locale['step_config_mail_admin_error'];
|
||||
break;
|
||||
}
|
||||
else if($key == 'timezone' && !in_array($value, DateTimeZone::listIdentifiers())) {
|
||||
$errors[] = $locale['step_config_timezone_error'];
|
||||
break;
|
||||
|
@ -79,11 +79,6 @@ if(!$error) {
|
||||
'message' => $locale['loading_spinner']
|
||||
));
|
||||
|
||||
if(!Validator::email($_SESSION['var_mail_admin'])) {
|
||||
error($locale['step_config_mail_admin_error']);
|
||||
$error = true;
|
||||
}
|
||||
|
||||
$content .= '$config[\'session_prefix\'] = \'myaac_' . generateRandomString(8, true, false, true, false) . '_\';';
|
||||
$content .= PHP_EOL;
|
||||
$content .= '$config[\'cache_prefix\'] = \'myaac_' . generateRandomString(8, true, false, true, false) . '_\';';
|
||||
|
@ -30,7 +30,7 @@ foreach ($deprecatedConfig as $value) {
|
||||
config(
|
||||
[
|
||||
$value,
|
||||
$settings['core.'.$value]['value']
|
||||
setting('core.'.$value)
|
||||
]
|
||||
);
|
||||
|
||||
@ -41,7 +41,7 @@ $vocationsParsed = array_map(
|
||||
function(string $value): string {
|
||||
return trim($value);
|
||||
},
|
||||
explode(',', $settings['core.vocations']['value'])
|
||||
explode(',', setting('core.vocations'))
|
||||
);
|
||||
|
||||
config(['vocations', $vocationsParsed]);
|
||||
|
@ -32,52 +32,48 @@ function message($message, $type, $return)
|
||||
return true;
|
||||
}
|
||||
function success($message, $return = false) {
|
||||
return message($message, 'success', $return);
|
||||
return message($message, 'success', $return);
|
||||
}
|
||||
function warning($message, $return = false) {
|
||||
return message($message, 'warning', $return);
|
||||
return message($message, 'warning', $return);
|
||||
}
|
||||
function note($message, $return = false) {
|
||||
return message($message, 'note', $return);
|
||||
return message($message, 'note', $return);
|
||||
}
|
||||
function error($message, $return = false) {
|
||||
return message($message, ((defined('MYAAC_INSTALL') || defined('MYAAC_ADMIN')) ? 'danger' : 'error'), $return);
|
||||
return message($message, ((defined('MYAAC_INSTALL') || defined('MYAAC_ADMIN')) ? 'danger' : 'error'), $return);
|
||||
}
|
||||
|
||||
function longToIp($ip)
|
||||
function longToIp($ip): string
|
||||
{
|
||||
$exp = explode(".", long2ip($ip));
|
||||
return $exp[3].".".$exp[2].".".$exp[1].".".$exp[0];
|
||||
}
|
||||
|
||||
function generateLink($url, $name, $blank = false) {
|
||||
function generateLink($url, $name, $blank = false): string {
|
||||
return '<a href="' . $url . '"' . ($blank ? ' target="_blank"' : '') . '>' . $name . '</a>';
|
||||
}
|
||||
|
||||
function getFullLink($page, $name, $blank = false) {
|
||||
function getFullLink($page, $name, $blank = false): string {
|
||||
return generateLink(getLink($page), $name, $blank);
|
||||
}
|
||||
|
||||
function getLink($page, $action = null)
|
||||
{
|
||||
$settings = Settings::getInstance();
|
||||
return BASE_URL . ($settings['core.friendly_urls']['value'] ? '' : 'index.php/') . $page . ($action ? '/' . $action : '');
|
||||
function getLink($page, $action = null): string {
|
||||
return BASE_URL . (setting('core.friendly_urls') ? '' : 'index.php/') . $page . ($action ? '/' . $action : '');
|
||||
}
|
||||
function internalLayoutLink($page, $action = null) {return getLink($page, $action);}
|
||||
|
||||
function getForumThreadLink($thread_id, $page = NULL)
|
||||
{
|
||||
$settings = Settings::getInstance();
|
||||
return BASE_URL . ($settings['core.friendly_urls']['value'] ? '' : 'index.php/') . 'forum/thread/' . (int)$thread_id . (isset($page) ? '/' . $page : '');
|
||||
function internalLayoutLink($page, $action = null): string {
|
||||
return getLink($page, $action);
|
||||
}
|
||||
|
||||
function getForumBoardLink($board_id, $page = NULL)
|
||||
{
|
||||
$settings = Settings::getInstance();
|
||||
return BASE_URL . ($settings['core.friendly_urls']['value'] ? '' : 'index.php/') . 'forum/board/' . (int)$board_id . (isset($page) ? '/' . $page : '');
|
||||
function getForumThreadLink($thread_id, $page = NULL): string {
|
||||
return BASE_URL . (setting('core.friendly_urls') ? '' : 'index.php/') . 'forum/thread/' . (int)$thread_id . (isset($page) ? '/' . $page : '');
|
||||
}
|
||||
|
||||
function getPlayerLink($name, $generate = true)
|
||||
function getForumBoardLink($board_id, $page = NULL): string {
|
||||
return BASE_URL . (setting('core.friendly_urls') ? '' : 'index.php/') . 'forum/board/' . (int)$board_id . (isset($page) ? '/' . $page : '');
|
||||
}
|
||||
|
||||
function getPlayerLink($name, $generate = true): string
|
||||
{
|
||||
if(is_numeric($name))
|
||||
{
|
||||
@ -87,23 +83,21 @@ function getPlayerLink($name, $generate = true)
|
||||
$name = $player->getName();
|
||||
}
|
||||
|
||||
$settings = Settings::getInstance();
|
||||
$url = BASE_URL . ($settings['core.friendly_urls']['value'] ? '' : 'index.php/') . 'characters/' . urlencode($name);
|
||||
$url = BASE_URL . (setting('core.friendly_urls') ? '' : 'index.php/') . 'characters/' . urlencode($name);
|
||||
|
||||
if(!$generate) return $url;
|
||||
return generateLink($url, $name);
|
||||
}
|
||||
|
||||
function getMonsterLink($name, $generate = true)
|
||||
function getMonsterLink($name, $generate = true): string
|
||||
{
|
||||
$settings = Settings::getInstance();
|
||||
$url = BASE_URL . ($settings['core.friendly_urls']['value'] ? '' : 'index.php/') . 'creatures/' . urlencode($name);
|
||||
$url = BASE_URL . (setting('core.friendly_urls') ? '' : 'index.php/') . 'creatures/' . urlencode($name);
|
||||
|
||||
if(!$generate) return $url;
|
||||
return generateLink($url, $name);
|
||||
}
|
||||
|
||||
function getHouseLink($name, $generate = true)
|
||||
function getHouseLink($name, $generate = true): string
|
||||
{
|
||||
global $db;
|
||||
|
||||
@ -115,17 +109,14 @@ function getHouseLink($name, $generate = true)
|
||||
$name = $house->fetchColumn();
|
||||
}
|
||||
|
||||
$settings = Settings::getInstance();
|
||||
$url = BASE_URL . ($settings['core.friendly_urls']['value'] ? '' : 'index.php/') . 'houses/' . urlencode($name);
|
||||
$url = BASE_URL . (setting('core.friendly_urls') ? '' : 'index.php/') . 'houses/' . urlencode($name);
|
||||
|
||||
if(!$generate) return $url;
|
||||
return generateLink($url, $name);
|
||||
}
|
||||
|
||||
function getGuildLink($name, $generate = true)
|
||||
function getGuildLink($name, $generate = true): string
|
||||
{
|
||||
global $config;
|
||||
|
||||
if(is_numeric($name)) {
|
||||
$name = getGuildNameById($name);
|
||||
if ($name === false) {
|
||||
@ -133,8 +124,7 @@ function getGuildLink($name, $generate = true)
|
||||
}
|
||||
}
|
||||
|
||||
$settings = Settings::getInstance();
|
||||
$url = BASE_URL . ($settings['core.friendly_urls']['value'] ? '' : 'index.php/') . 'guilds/' . urlencode($name);
|
||||
$url = BASE_URL . (setting('core.friendly_urls') ? '' : 'index.php/') . 'guilds/' . urlencode($name);
|
||||
|
||||
if(!$generate) return $url;
|
||||
return generateLink($url, $name);
|
||||
@ -180,7 +170,7 @@ function getItemRarity($chance) {
|
||||
return '';
|
||||
}
|
||||
|
||||
function getFlagImage($country)
|
||||
function getFlagImage($country): string
|
||||
{
|
||||
if(!isset($country[0]))
|
||||
return '';
|
||||
@ -202,7 +192,7 @@ function getFlagImage($country)
|
||||
* @param mixed $v Variable to check.
|
||||
* @return bool Value boolean status.
|
||||
*/
|
||||
function getBoolean($v)
|
||||
function getBoolean($v): bool
|
||||
{
|
||||
if(is_bool($v)) {
|
||||
return $v;
|
||||
@ -225,7 +215,7 @@ function getBoolean($v)
|
||||
* @param bool $special Should special characters by used?
|
||||
* @return string Generated string.
|
||||
*/
|
||||
function generateRandomString($length, $lowCase = true, $upCase = false, $numeric = false, $special = false)
|
||||
function generateRandomString($length, $lowCase = true, $upCase = false, $numeric = false, $special = false): string
|
||||
{
|
||||
$characters = '';
|
||||
if($lowCase)
|
||||
@ -465,7 +455,7 @@ function tickers()
|
||||
* Types: head_start, head_end, body_start, body_end, center_top
|
||||
*
|
||||
*/
|
||||
function template_place_holder($type)
|
||||
function template_place_holder($type): string
|
||||
{
|
||||
global $twig, $template_place_holders;
|
||||
$ret = '';
|
||||
@ -489,7 +479,7 @@ function template_place_holder($type)
|
||||
/**
|
||||
* Returns <head> content to be used by templates.
|
||||
*/
|
||||
function template_header($is_admin = false)
|
||||
function template_header($is_admin = false): string
|
||||
{
|
||||
global $title_full, $config, $twig;
|
||||
$charset = isset($config['charset']) ? $config['charset'] : 'utf-8';
|
||||
@ -506,29 +496,32 @@ function template_header($is_admin = false)
|
||||
/**
|
||||
* Returns footer content to be used by templates.
|
||||
*/
|
||||
function template_footer()
|
||||
function template_footer(): string
|
||||
{
|
||||
global $config, $views_counter;
|
||||
global $views_counter;
|
||||
$ret = '';
|
||||
if(admin())
|
||||
if(admin()) {
|
||||
$ret .= generateLink(ADMIN_URL, 'Admin Panel', true);
|
||||
}
|
||||
|
||||
if($config['visitors_counter'])
|
||||
{
|
||||
if(setting('core.visitors_counter')) {
|
||||
global $visitors;
|
||||
$amount = $visitors->getAmountVisitors();
|
||||
$ret .= '<br/>Currently there ' . ($amount > 1 ? 'are' : 'is') . ' ' . $amount . ' visitor' . ($amount > 1 ? 's' : '') . '.';
|
||||
}
|
||||
|
||||
if($config['views_counter'])
|
||||
if(setting('core.views_counter')) {
|
||||
$ret .= '<br/>Page has been viewed ' . $views_counter . ' times.';
|
||||
}
|
||||
|
||||
if(config('footer_show_load_time')) {
|
||||
if(setting('core.footer_load_time')) {
|
||||
$ret .= '<br/>Load time: ' . round(microtime(true) - START_TIME, 4) . ' seconds.';
|
||||
}
|
||||
|
||||
if(isset($config['footer'][0]))
|
||||
$ret .= '<br/>' . $config['footer'];
|
||||
$settingFooter = setting('core.footer');
|
||||
if(isset($settingFooter[0])) {
|
||||
$ret .= '<br/>' . $settingFooter;
|
||||
}
|
||||
|
||||
// please respect my work and help spreading the word, thanks!
|
||||
return $ret . '<br/>' . base64_decode('UG93ZXJlZCBieSA8YSBocmVmPSJodHRwOi8vbXktYWFjLm9yZyIgdGFyZ2V0PSJfYmxhbmsiPk15QUFDLjwvYT4=');
|
||||
@ -822,7 +815,7 @@ function getWorldName($id)
|
||||
|
||||
/**
|
||||
* Mailing users.
|
||||
* $config['mail_enabled'] have to be enabled.
|
||||
* Mailing has to be enabled in settings (in Admin Panel).
|
||||
*
|
||||
* @param string $to Recipient email address.
|
||||
* @param string $subject Subject of the message.
|
||||
@ -834,8 +827,9 @@ function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true)
|
||||
{
|
||||
global $mailer, $config;
|
||||
|
||||
if (!config('mail_enabled')) {
|
||||
log_append('mailer-error.log', '_mail() function has been used, but config.mail_enabled is disabled.');
|
||||
if (!setting('core.mail_enabled')) {
|
||||
log_append('mailer-error.log', '_mail() function has been used, but Mail Support is disabled.');
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!$mailer)
|
||||
@ -847,47 +841,60 @@ function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true)
|
||||
$mailer->clearAllRecipients();
|
||||
}
|
||||
|
||||
$signature_html = '';
|
||||
if(isset($config['mail_signature']['html']))
|
||||
$signature_html = $config['mail_signature']['html'];
|
||||
|
||||
$signature_html = setting('core.mail_signature_html');
|
||||
if($add_html_tags && isset($body[0]))
|
||||
$tmp_body = '<html><head></head><body>' . $body . '<br/><br/>' . $signature_html . '</body></html>';
|
||||
else
|
||||
$tmp_body = $body . '<br/><br/>' . $signature_html;
|
||||
|
||||
if($config['smtp_enabled'])
|
||||
define('MAIL_MAIL', 0);
|
||||
define('MAIL_SMTP', 1);
|
||||
|
||||
$mailOption = setting('core.mail_option');
|
||||
if($mailOption == MAIL_SMTP)
|
||||
{
|
||||
$mailer->isSMTP();
|
||||
$mailer->Host = $config['smtp_host'];
|
||||
$mailer->Port = (int)$config['smtp_port'];
|
||||
$mailer->SMTPAuth = $config['smtp_auth'];
|
||||
$mailer->Username = $config['smtp_user'];
|
||||
$mailer->Password = $config['smtp_pass'];
|
||||
$mailer->SMTPSecure = isset($config['smtp_secure']) ? $config['smtp_secure'] : '';
|
||||
$mailer->Host = setting('core.smtp_host');
|
||||
$mailer->Port = setting('core.smtp_port');
|
||||
$mailer->SMTPAuth = setting('core.smtp_auth');
|
||||
$mailer->Username = setting('core.smtp_user');
|
||||
$mailer->Password = setting('core.smtp_pass');
|
||||
|
||||
define('SMTP_SECURITY_NONE', 0);
|
||||
define('SMTP_SECURITY_SSL', 1);
|
||||
define('SMTP_SECURITY_TLS', 2);
|
||||
|
||||
$security = setting('core.smtp_security');
|
||||
|
||||
$tmp = '';
|
||||
if ($security === SMTP_SECURITY_SSL) {
|
||||
$tmp = 'ssl';
|
||||
}
|
||||
else if ($security == SMTP_SECURITY_TLS) {
|
||||
$tmp = 'tls';
|
||||
}
|
||||
|
||||
$mailer->SMTPSecure = $tmp;
|
||||
}
|
||||
else {
|
||||
$mailer->isMail();
|
||||
}
|
||||
|
||||
$mailer->isHTML(isset($body[0]) > 0);
|
||||
$mailer->From = $config['mail_address'];
|
||||
$mailer->Sender = $config['mail_address'];
|
||||
$mailer->From = setting('core.mail_address');
|
||||
$mailer->Sender = setting('core.mail_address');
|
||||
$mailer->CharSet = 'utf-8';
|
||||
$mailer->FromName = $config['lua']['serverName'];
|
||||
$mailer->Subject = $subject;
|
||||
$mailer->addAddress($to);
|
||||
$mailer->Body = $tmp_body;
|
||||
|
||||
if(config('smtp_debug')) {
|
||||
if(setting('core.smtp_debug')) {
|
||||
$mailer->SMTPDebug = 2;
|
||||
$mailer->Debugoutput = 'echo';
|
||||
}
|
||||
|
||||
$signature_plain = '';
|
||||
if(isset($config['mail_signature']['plain']))
|
||||
$signature_plain = $config['mail_signature']['plain'];
|
||||
|
||||
$signature_plain = setting('core.mail_signature_plain');
|
||||
if(isset($altBody[0])) {
|
||||
$mailer->AltBody = $altBody . $signature_plain;
|
||||
}
|
||||
@ -1121,7 +1128,16 @@ function configLua($key) {
|
||||
function setting($key)
|
||||
{
|
||||
$settings = Settings::getInstance();
|
||||
return $settings[$key];
|
||||
|
||||
if (is_array($key)) {
|
||||
if (is_null($key[1])) {
|
||||
unset($settings[$key[0]]);
|
||||
}
|
||||
|
||||
return $settings[$key[0]] = $key[1];
|
||||
}
|
||||
|
||||
return $settings[$key]['value'];
|
||||
}
|
||||
|
||||
function clearCache()
|
||||
|
@ -18,7 +18,6 @@ if(!isset($config['installed']) || !$config['installed']) {
|
||||
throw new RuntimeException('MyAAC has not been installed yet or there was error during installation. Please install again.');
|
||||
}
|
||||
|
||||
date_default_timezone_set($config['date_timezone']);
|
||||
// take care of trailing slash at the end
|
||||
if($config['server_path'][strlen($config['server_path']) - 1] !== '/')
|
||||
$config['server_path'] .= '/';
|
||||
@ -120,7 +119,7 @@ if(!isset($config['highscores_ids_hidden']) || count($config['highscores_ids_hid
|
||||
$config['highscores_ids_hidden'] = array(0);
|
||||
}
|
||||
|
||||
$config['account_create_character_create'] = config('account_create_character_create') && (!config('mail_enabled') || !config('account_mail_verify'));
|
||||
$config['account_create_character_create'] = config('account_create_character_create') && (!setting('core.mail_enabled') || !config('account_mail_verify'));
|
||||
|
||||
// POT
|
||||
require_once SYSTEM . 'libs/pot/OTS.php';
|
||||
@ -136,12 +135,13 @@ $settings = Settings::getInstance();
|
||||
$settings->load();
|
||||
|
||||
// deprecated config values
|
||||
require_once __DIR__ . '/compat_config.php';
|
||||
require_once SYSTEM . 'compat/config.php';
|
||||
|
||||
$settingsItemImagesURL = $settings['core.item_images_url'];
|
||||
if($settingsItemImagesURL['value'][strlen($settingsItemImagesURL['value']) - 1] !== '/') {
|
||||
$settingsItemImagesURL['value'] .= '/';
|
||||
$settings['core.item_images_url'] = $settingsItemImagesURL;
|
||||
date_default_timezone_set(setting('core.date_timezone'));
|
||||
|
||||
$settingsItemImagesURL = setting('core.item_images_url');
|
||||
if($settingsItemImagesURL[strlen($settingsItemImagesURL) - 1] !== '/') {
|
||||
setting(['core.item_images_url', $settingsItemImagesURL . '/']);
|
||||
}
|
||||
|
||||
define('USE_ACCOUNT_NAME', $db->hasColumn('accounts', 'name'));
|
||||
|
@ -11,9 +11,10 @@
|
||||
class Settings implements ArrayAccess
|
||||
{
|
||||
static private $instance;
|
||||
private $plugins = [];
|
||||
private $settingsArray = [];
|
||||
private $settings = [];
|
||||
private $cache = [];
|
||||
private $valuesAsked = [];
|
||||
|
||||
/**
|
||||
* @return Settings
|
||||
@ -52,7 +53,25 @@ class Settings implements ArrayAccess
|
||||
}
|
||||
}
|
||||
|
||||
public static function parse($plugin, $settings): string
|
||||
public function updateInDatabase($pluginName, $key, $value)
|
||||
{
|
||||
global $db;
|
||||
$db->update(TABLE_PREFIX . 'settings', ['value' => $value], ['plugin_name' => $pluginName, 'key' => $key]);
|
||||
}
|
||||
|
||||
public function deleteFromDatabase($pluginName, $key = null)
|
||||
{
|
||||
global $db;
|
||||
|
||||
if (!isset($key)) {
|
||||
$db->delete(TABLE_PREFIX . 'settings', ['plugin_name' => $pluginName], -1);
|
||||
}
|
||||
else {
|
||||
$db->delete(TABLE_PREFIX . 'settings', ['plugin_name' => $pluginName, 'key' => $key]);
|
||||
}
|
||||
}
|
||||
|
||||
public static function display($plugin, $settings): string
|
||||
{
|
||||
global $db;
|
||||
|
||||
@ -93,7 +112,7 @@ class Settings implements ArrayAccess
|
||||
$j = 0;
|
||||
foreach($settings as $key => $setting) {
|
||||
if ($setting['type'] === 'category') {
|
||||
if ($j++ !== 0) {
|
||||
if ($j++ !== 0) { // close previous category
|
||||
echo '</tbody></table></div>';
|
||||
}
|
||||
?>
|
||||
@ -103,7 +122,7 @@ class Settings implements ArrayAccess
|
||||
}
|
||||
|
||||
if ($setting['type'] === 'section') {
|
||||
if ($i++ !== 0) {
|
||||
if ($i++ !== 0) { // close previous section
|
||||
echo '</tbody></table>';
|
||||
}
|
||||
?>
|
||||
@ -190,6 +209,14 @@ class Settings implements ArrayAccess
|
||||
|
||||
$setting['options'] = $clients;
|
||||
}
|
||||
else if ($setting['options'] == '$timezones') {
|
||||
$timezones = [];
|
||||
foreach (DateTimeZone::listIdentifiers() as $value) {
|
||||
$timezones[$value] = $value;
|
||||
}
|
||||
|
||||
$setting['options'] = $timezones;
|
||||
}
|
||||
|
||||
else {
|
||||
if (is_string($setting['options'])) {
|
||||
@ -263,47 +290,61 @@ class Settings implements ArrayAccess
|
||||
throw new \RuntimeException("Settings: You cannot set empty offset with value: $value!");
|
||||
}
|
||||
|
||||
$pluginName = $offset;
|
||||
if (strpos($offset, '.')) {
|
||||
$explode = explode('.', $offset, 2);
|
||||
$this->loadPlugin($offset);
|
||||
|
||||
$pluginName = $explode[0];
|
||||
$key = $explode[1];
|
||||
}
|
||||
|
||||
$this->loadPlugin($pluginName);
|
||||
$pluginName = $this->valuesAsked['pluginName'];
|
||||
$key = $this->valuesAsked['key'];
|
||||
|
||||
// remove whole plugin settings
|
||||
if (!isset($key)) {
|
||||
$this->plugins[$pluginName] = [];
|
||||
|
||||
// remove from settings
|
||||
if (isset($this->settings[$pluginName])) {
|
||||
unset($this->settings[$pluginName]);
|
||||
}
|
||||
|
||||
// remove from cache
|
||||
if (isset($this->cache[$pluginName])) {
|
||||
unset($this->cache[$pluginName]);
|
||||
}
|
||||
/*foreach ($this->cache as $_key => $value) {
|
||||
if (strpos($_key, $pluginName) !== false) {
|
||||
unset($this->cache[$_key]);
|
||||
}
|
||||
}*/
|
||||
if (!isset($value)) {
|
||||
$this->offsetUnset($offset);
|
||||
$this->deleteFromDatabase($pluginName, $key);
|
||||
return;
|
||||
}
|
||||
|
||||
$this->settings[$pluginName][$key] = $value['value'];
|
||||
$this->settings[$pluginName][$key] = $value;
|
||||
$this->updateInDatabase($pluginName, $key, $value);
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetExists($offset) {
|
||||
return isset($this->settings[$offset]);
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
$this->loadPlugin($offset);
|
||||
|
||||
$pluginName = $this->valuesAsked['pluginName'];
|
||||
$key = $this->valuesAsked['key'];
|
||||
|
||||
// remove specified plugin settings (all)
|
||||
if(is_null($key)) {
|
||||
return isset($this->settings[$offset]);
|
||||
}
|
||||
|
||||
return isset($this->settings[$pluginName][$key]);
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetUnset($offset) {
|
||||
unset($this->settings[$offset]);
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
$this->loadPlugin($offset);
|
||||
|
||||
$pluginName = $this->valuesAsked['pluginName'];
|
||||
$key = $this->valuesAsked['key'];
|
||||
|
||||
if (isset($this->cache[$offset])) {
|
||||
unset($this->cache[$offset]);
|
||||
}
|
||||
|
||||
// remove specified plugin settings (all)
|
||||
if(!isset($key)) {
|
||||
unset($this->settingsArray[$pluginName]);
|
||||
unset($this->settings[$pluginName]);
|
||||
$this->deleteFromDatabase($pluginName);
|
||||
return;
|
||||
}
|
||||
|
||||
unset($this->settingsArray[$pluginName][$key]);
|
||||
unset($this->settings[$pluginName][$key]);
|
||||
$this->deleteFromDatabase($pluginName, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -322,24 +363,19 @@ class Settings implements ArrayAccess
|
||||
return $this->cache[$offset];
|
||||
}
|
||||
|
||||
$pluginName = $offset;
|
||||
if (strpos($offset, '.')) {
|
||||
$explode = explode('.', $offset, 2);
|
||||
$this->loadPlugin($offset);
|
||||
|
||||
$pluginName = $explode[0];
|
||||
$key = $explode[1];
|
||||
}
|
||||
|
||||
$this->loadPlugin($pluginName);
|
||||
$pluginName = $this->valuesAsked['pluginName'];
|
||||
$key = $this->valuesAsked['key'];
|
||||
|
||||
// return specified plugin settings (all)
|
||||
if(!isset($key)) {
|
||||
return $this->plugins[$pluginName];
|
||||
return $this->settingsArray[$pluginName];
|
||||
}
|
||||
|
||||
$ret = [];
|
||||
if(isset($this->plugins[$pluginName][$key])) {
|
||||
$ret = $this->plugins[$pluginName][$key];
|
||||
if(isset($this->settingsArray[$pluginName][$key])) {
|
||||
$ret = $this->settingsArray[$pluginName][$key];
|
||||
}
|
||||
|
||||
if(isset($this->settings[$pluginName][$key])) {
|
||||
@ -348,7 +384,7 @@ class Settings implements ArrayAccess
|
||||
$ret['value'] = $value;
|
||||
}
|
||||
else {
|
||||
$ret['value'] = $this->plugins[$pluginName][$key]['default'];
|
||||
$ret['value'] = $this->settingsArray[$pluginName][$key]['default'];
|
||||
}
|
||||
|
||||
if(isset($ret['type'])) {
|
||||
@ -370,15 +406,36 @@ class Settings implements ArrayAccess
|
||||
return $ret;
|
||||
}
|
||||
|
||||
private function loadPlugin($pluginName)
|
||||
private function updateValuesAsked($offset)
|
||||
{
|
||||
if (!isset($this->plugins[$pluginName])) {
|
||||
$pluginName = $offset;
|
||||
if (strpos($offset, '.')) {
|
||||
$explode = explode('.', $offset, 2);
|
||||
|
||||
$pluginName = $explode[0];
|
||||
$key = $explode[1];
|
||||
|
||||
$this->valuesAsked = ['pluginName' => $pluginName, 'key' => $key];
|
||||
}
|
||||
else {
|
||||
$this->valuesAsked = ['pluginName' => $pluginName, 'key' => null];
|
||||
}
|
||||
}
|
||||
|
||||
private function loadPlugin($offset)
|
||||
{
|
||||
$this->updateValuesAsked($offset);
|
||||
|
||||
$pluginName = $this->valuesAsked['pluginName'];
|
||||
$key = $this->valuesAsked['key'];
|
||||
|
||||
if (!isset($this->settingsArray[$pluginName])) {
|
||||
if ($pluginName === 'core') {
|
||||
$settingsFilePath = SYSTEM . 'settings.php';
|
||||
} else {
|
||||
$pluginSettings = Plugins::getPluginSettings($pluginName);
|
||||
if (!$pluginSettings) {
|
||||
error('This plugin does not exist or does not have settings defined.');
|
||||
warning("Setting $pluginName does not exist or does not have settings defined.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -390,7 +447,7 @@ class Settings implements ArrayAccess
|
||||
}
|
||||
|
||||
$tmp = require $settingsFilePath;
|
||||
$this->plugins[$pluginName] = $tmp['settings'];
|
||||
$this->settingsArray[$pluginName] = $tmp['settings'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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(),
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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>';
|
||||
|
@ -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
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil
|
||||
// signature
|
||||
$settings = Settings::getInstance();
|
||||
if($config['signature_enabled']) {
|
||||
$signature_url = BASE_URL . ($settings['core.friendly_urls']['value'] ? '' : 'index.php/') . urlencode($player->getName()) . '.png';
|
||||
$signature_url = BASE_URL . (setting('core.friendly_urls') ? '' : 'index.php/') . urlencode($player->getName()) . '.png';
|
||||
}
|
||||
|
||||
$hidden = $player->isHidden();
|
||||
|
@ -11,9 +11,9 @@ defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Experience Table';
|
||||
|
||||
$experience = array();
|
||||
$columns = $config['experiencetable_columns'];
|
||||
$columns = setting('core.experience_table_columns');
|
||||
for($i = 0; $i < $columns; $i++) {
|
||||
for($level = $i * $config['experiencetable_rows'] + 1; $level < $i * $config['experiencetable_rows'] + ($config['experiencetable_rows'] + 1); $level++) {
|
||||
for($level = $i * setting('core.experience_table_rows') + 1; $level < $i * setting('core.experience_table_rows') + (setting('core.experience_table_rows') + 1); $level++) {
|
||||
$experience[$level] = OTS_Toolbox::experienceForLevel($level);
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,17 @@ return [
|
||||
'type' => 'category',
|
||||
'title' => 'General'
|
||||
],
|
||||
[
|
||||
'type' => 'section',
|
||||
'title' => 'General'
|
||||
],
|
||||
'date_timezone' => [
|
||||
'name' => 'Date Timezone',
|
||||
'type' => 'options',
|
||||
'options' => '$timezones',
|
||||
'desc' => 'Timezone of the server, more info at http://php.net/manual/en/timezones.php',
|
||||
'default' => 'Europe/Warsaw',
|
||||
],
|
||||
[
|
||||
'type' => 'section',
|
||||
'title' => 'Template'
|
||||
@ -63,12 +74,18 @@ return [
|
||||
'desc' => 'Text displayed in the footer.<br/>For example: <i>' . escapeHtml('<br/>') . 'Your Server © 2023. All rights reserved.</i>',
|
||||
'default' => '',
|
||||
],
|
||||
// do we really want this?
|
||||
'footer_load_time' => [
|
||||
'name' => 'Load Time',
|
||||
'type' => 'boolean',
|
||||
'desc' => 'Display load time of the page in the footer',
|
||||
'default' => true,
|
||||
],
|
||||
// do we really want this? I'm leaving it for consideration
|
||||
/*
|
||||
'footer_powered_by' => [
|
||||
'name' => 'Display Powered by MyAAC',
|
||||
'type' => 'boolean',
|
||||
'desc' => 'Do you want to show powered by myaac slogan on the footer?',
|
||||
'desc' => 'Do you want to show <i>Powered by MyAAC</i> slogan in the footer?',
|
||||
'default' => true,
|
||||
],
|
||||
*/
|
||||
@ -154,6 +171,108 @@ return [
|
||||
might bring some performance when disabled',
|
||||
'default' => true,
|
||||
],
|
||||
'anonymous_usage_statistics' => [
|
||||
'name' => 'Anonymous Usage Statistics',
|
||||
'type' => 'boolean',
|
||||
'desc' => 'Allow MyAAC to report anonymous usage statistics to developers? The data is sent only once per 30 days and is fully confidential. It won\'t affect the performance of your website',
|
||||
'default' => true,
|
||||
],
|
||||
[
|
||||
'type' => 'category',
|
||||
'title' => 'Mailing',
|
||||
],
|
||||
[
|
||||
'type' => 'section',
|
||||
'title' => 'Mailing'
|
||||
],
|
||||
'mail_enabled' => [
|
||||
'name' => 'Mailing enabled',
|
||||
'type' => 'boolean',
|
||||
'desc' => 'Is AAC configured to send e-mails?',
|
||||
'default' => false,
|
||||
],
|
||||
'mail_address' => [
|
||||
'name' => 'Mail Address',
|
||||
'type' => 'email',
|
||||
'desc' => 'Server e-mail address (from:)',
|
||||
'default' => 'no-reply@your-server.org',
|
||||
],
|
||||
/*'mail_admin' => [
|
||||
'name' => 'Mail Admin Address',
|
||||
'type' => 'email',
|
||||
'desc' => 'Admin email address, where mails from contact form will be sent',
|
||||
'default' => 'your-address@your-server.org',
|
||||
],*/
|
||||
'mail_signature_plain' => [
|
||||
'name' => 'Mail Signature (Plain)',
|
||||
'type' => 'textarea',
|
||||
'desc' => 'Signature that will be included at the end of every message sent.<br/><b>In Normal Format!</b>',
|
||||
'default' => '--
|
||||
Sent by MyAAC,
|
||||
https://my-aac.org',
|
||||
],
|
||||
'mail_signature_html' => [
|
||||
'name' => 'Mail Signature (HTML)',
|
||||
'type' => 'textarea',
|
||||
'desc' => 'Signature that will be included at the end of every message sent.<br/><b>In HTML Format!</b>',
|
||||
'default' => escapeHtml('<br/>
|
||||
Sent by MyAAC,<br/>
|
||||
<a href="https://my-aac.org">my-aac.org</a>'),
|
||||
],
|
||||
[
|
||||
'type' => 'section',
|
||||
'title' => 'SMTP (Mail Server)'
|
||||
],
|
||||
'mail_option' => [
|
||||
'name' => 'Mail Option',
|
||||
'type' => 'options',
|
||||
'options' => [0 => 'Mail (PHP Built-in)', 1 => 'SMTP (Gmail or Microsoft Outlook)'],
|
||||
'desc' => 'Mail sender. Set to SMTP if using Gmail or Microsoft Outlook, or any other provider',
|
||||
'default' => 0,
|
||||
],
|
||||
'smtp_host' => [
|
||||
'name' => 'SMTP Host',
|
||||
'type' => 'text',
|
||||
'desc' => 'SMTP mail host. smtp.gmail.com for GMail / smtp-mail.outlook.com for Microsoft Outlook',
|
||||
'default' => '',
|
||||
],
|
||||
'smtp_port' => [
|
||||
'name' => 'SMTP Host',
|
||||
'type' => 'number',
|
||||
'desc' => '25 (default) / 465 (ssl, GMail) / 587 (tls, Microsoft Outlook)',
|
||||
'default' => 25,
|
||||
],
|
||||
'smtp_auth' => [
|
||||
'name' => 'SMTP Auth',
|
||||
'type' => 'boolean',
|
||||
'desc' => 'Need authorization for Server? In normal situation, almost always Yes.',
|
||||
'default' => true,
|
||||
],
|
||||
'smtp_user' => [
|
||||
'name' => 'SMTP Username',
|
||||
'type' => 'text',
|
||||
'desc' => 'Here your email username to authenticate with SMTP',
|
||||
'default' => 'admin@example.org',
|
||||
],
|
||||
'smtp_pass' => [
|
||||
'name' => 'SMTP Password',
|
||||
'type' => 'password',
|
||||
'desc' => 'Here your email password to authenticate with SMTP',
|
||||
'default' => '',
|
||||
],
|
||||
'smtp_security' => [
|
||||
'name' => 'SMTP Security',
|
||||
'type' => 'options',
|
||||
'options' => ['None', 'SSL', 'TLS'],
|
||||
'desc' => 'What kind of encryption to use on the SMTP connection',
|
||||
'default' => '',
|
||||
],
|
||||
'smtp_debug' => [
|
||||
'name' => 'SMTP Debug',
|
||||
'type' => 'boolean',
|
||||
'desc' => 'Activate to see more logs about mailing errors in error.log',
|
||||
'default' => false,
|
||||
],
|
||||
[
|
||||
'type' => 'category',
|
||||
'title' => 'Accounts',
|
||||
@ -407,25 +526,29 @@ return [
|
||||
'desc' => '',
|
||||
'default' => true,
|
||||
],
|
||||
[
|
||||
'type' => 'section',
|
||||
'title' => 'Experience Table Page'
|
||||
],
|
||||
'experience_table_columns' => [
|
||||
'name' => 'Columns',
|
||||
'type' => 'number',
|
||||
'desc' => 'How many columns to display in experience table page. * experiencetable_rows, 5 = 500 (will show up to 500 level)',
|
||||
'default' => 3,
|
||||
],
|
||||
'experience_table_rows' => [
|
||||
'name' => 'Rows',
|
||||
'type' => 'number',
|
||||
'desc' => 'Till how many levels in one column',
|
||||
'default' => 200,
|
||||
],
|
||||
[
|
||||
'type' => 'category',
|
||||
'title' => 'Images',
|
||||
],
|
||||
[
|
||||
'type' => 'section',
|
||||
'title' => 'Item and Outfit Images'
|
||||
],
|
||||
'outfit_images_url' => [
|
||||
'name' => 'Outfit Images URL',
|
||||
'type' => 'text',
|
||||
'desc' => 'Set to animoutfit.php for animated outfit',
|
||||
'default' => 'http://outfit-images.ots.me/outfit.php',
|
||||
],
|
||||
'outfit_images_wrong_looktypes' => [
|
||||
'name' => 'Outfit Images Wrong Looktypes',
|
||||
'type' => 'text',
|
||||
'desc' => 'This looktypes needs to have different margin-top and margin-left because they are wrong positioned',
|
||||
'default' => '75, 126, 127, 266, 302',
|
||||
'title' => 'Item Images'
|
||||
],
|
||||
'item_images_url' => [
|
||||
'name' => 'Item Images URL',
|
||||
@ -441,7 +564,23 @@ return [
|
||||
],
|
||||
[
|
||||
'type' => 'section',
|
||||
'title' => 'Monsters Images'
|
||||
'title' => 'Outfit Images'
|
||||
],
|
||||
'outfit_images_url' => [
|
||||
'name' => 'Outfit Images URL',
|
||||
'type' => 'text',
|
||||
'desc' => 'Set to animoutfit.php for animated outfit',
|
||||
'default' => 'http://outfit-images.ots.me/outfit.php',
|
||||
],
|
||||
'outfit_images_wrong_looktypes' => [
|
||||
'name' => 'Outfit Images Wrong Looktypes',
|
||||
'type' => 'text',
|
||||
'desc' => 'This looktypes needs to have different margin-top and margin-left because they are wrong positioned',
|
||||
'default' => '75, 126, 127, 266, 302',
|
||||
],
|
||||
[
|
||||
'type' => 'section',
|
||||
'title' => 'Monster Images'
|
||||
],
|
||||
'monsters_images_url' => [
|
||||
'name' => 'Monsters Images URL',
|
||||
@ -456,23 +595,24 @@ return [
|
||||
'default' => '.gif',
|
||||
],
|
||||
'monsters_images_preview' => [
|
||||
'name' => 'Item Images URL',
|
||||
'name' => 'Monsters Images Preview',
|
||||
'type' => 'boolean',
|
||||
'desc' => 'Set to true to allow picture previews for creatures',
|
||||
'default' => false,
|
||||
],
|
||||
'monsters_items_url' => [
|
||||
'name' => 'Creatures Items URL',
|
||||
'name' => 'Monsters Items URL',
|
||||
'type' => 'text',
|
||||
'desc' => 'Set to website which shows details about items',
|
||||
'default' => 'https://tibia.fandom.com/wiki/',
|
||||
],
|
||||
'monsters_loot_percentage' => [
|
||||
'name' => 'Creatures Items URL',
|
||||
'name' => 'Monsters Items URL',
|
||||
'type' => 'boolean',
|
||||
'desc' => 'Set to true to show the loot tooltip percent',
|
||||
'default' => true,
|
||||
],
|
||||
// this is hidden, because no implemented yet
|
||||
'multiworld' => [
|
||||
'hidden' => true,
|
||||
'type' => 'boolean',
|
||||
|
@ -10,8 +10,8 @@
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
// template
|
||||
$template_name = $settings['core.template']['value'];
|
||||
if($settings['core.template_allow_change']['value'])
|
||||
$template_name = setting('core.template');
|
||||
if(setting('core.template_allow_change'))
|
||||
{
|
||||
if(isset($_GET['template']))
|
||||
{
|
||||
|
@ -59,7 +59,7 @@
|
||||
<td></td><td><span id="email_error" class="FormFieldError">{% if errors.email is defined %}{{ errors.email }}{% endif %}</span></td>
|
||||
</tr>
|
||||
|
||||
{% if config.mail_enabled and config.account_mail_verify %}
|
||||
{% if setting('core.mail_enabled') and config.account_mail_verify %}
|
||||
<tr><td></td><td><span><strong>Please use real address!<br/>We will send a link to validate your Email.</strong></span></td></tr>
|
||||
{% endif %}
|
||||
|
||||
@ -119,7 +119,7 @@
|
||||
|
||||
{{ hook('HOOK_ACCOUNT_CREATE_BETWEEN_BOXES_1') }}
|
||||
|
||||
{% if (not config.mail_enabled or not config.account_mail_verify) and config.account_create_character_create %}
|
||||
{% if (not setting('core.mail_enabled') or not config.account_mail_verify) and config.account_create_character_create %}
|
||||
<tr>
|
||||
<td>
|
||||
<div class="TableShadowContainerRightTop">
|
||||
|
@ -6,14 +6,14 @@ Remember you can also check the respective skill bar in your skill window of the
|
||||
<td class="white" colspan="5"><b>Experience Table</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
{% for i in 0..config.experiencetable_columns-1 %}
|
||||
{% for i in 0..setting('core.experience_table_columns')-1 %}
|
||||
<td>
|
||||
<table border="0" cellpadding="2" cellspacing="1" width="100%">
|
||||
<tr bgcolor="{{ config.lightborder }}">
|
||||
<td><b>Level</b></td>
|
||||
<td><b>Experience</b></td>
|
||||
</tr>
|
||||
{% for level in i * config.experiencetable_rows + 1..i * config.experiencetable_rows + (config.experiencetable_rows + 1) - 1 %}
|
||||
{% for level in i * setting('core.experience_table_rows') + 1..i * setting('core.experience_table_rows') + (setting('core.experience_table_rows') + 1) - 1 %}
|
||||
<tr bgcolor="{{ config.lightborder }}">
|
||||
<td>{{ level }}</td>
|
||||
<td>{{ experience[level] }}</td>
|
||||
@ -23,4 +23,4 @@ Remember you can also check the respective skill bar in your skill window of the
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
|
@ -9,7 +9,7 @@
|
||||
<form action="{{ constant('BASE_URL') }}install/" method="post" autocomplete="off">
|
||||
<input type="hidden" name="step" id="step" value="database" />
|
||||
|
||||
{% for value in ['server_path', 'mail_admin'] %}
|
||||
{% for value in ['server_path'] %}
|
||||
<div class="form-group mb-2">
|
||||
<label for="vars_{{ value }}">{{ locale['step_config_' ~ value] }}</label>
|
||||
<input class="form-control" type="text" name="vars[{{ value }}]" id="vars_{{ value }}"{% if session['var_' ~ value] is not null %} value="{{ session['var_' ~ value] }}"{% endif %}/>
|
||||
@ -43,9 +43,9 @@
|
||||
<input type="checkbox" name="vars[usage]" id="vars_usage" value="1"{% if session['var_usage'] is null or session['var_usage'] == 1 %} checked{% endif %}/>
|
||||
<small class="form-text text-muted d-block">{{ locale.step_config_usage_desc }}</small>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="text-center m-3">
|
||||
{{ buttons|raw }}
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</form>
|
||||
|
@ -4,4 +4,4 @@ The request was made on {{ "now"|date("F j, Y, g:i a") }} by a user with the IP:
|
||||
<br/><br/>
|
||||
The new password is: <b>{{ new_password }}</b>
|
||||
<br/><br/>
|
||||
If this was you, please ignore this email. If it was not you, please contact our support department at {{ config.mail_admin }}.
|
||||
If this was you, please ignore this email. If it was not you, please contact our support department.
|
||||
|
@ -106,6 +106,11 @@ $function = new TwigFunction('config', function ($key) {
|
||||
});
|
||||
$twig->addFunction($function);
|
||||
|
||||
$function = new TwigFunction('setting', function ($key) {
|
||||
return setting($key);
|
||||
});
|
||||
$twig->addFunction($function);
|
||||
|
||||
$function = new TwigFunction('getCustomPage', function ($name) {
|
||||
$success = false;
|
||||
return getCustomPage($name, $success);
|
||||
|
@ -289,7 +289,7 @@ if(isset($config['boxes']))
|
||||
<img id="TibiaLogoArtworkTop" src="<?php echo $template_path; ?>/images/header/<?php echo $config['logo_image']; ?>" onClick="window.location = '<?php echo getLink('news')?>';" alt="logoartwork" />
|
||||
<img id="TibiaLogoArtworkBottom" src="<?php echo $template_path; ?>/images/header/tibia-logo-artwork-bottom.gif" alt="logoartwork" />
|
||||
<img id="Statue_2" src="<?php echo $template_path; ?>/images/header/animated-statue.gif" alt="logoartwork" />
|
||||
<img id="LogoLink" src="<?php echo $template_path; ?>/images/header/tibia-logo-artwork-string.gif" onClick="window.location = 'mailto:<?php echo $config['mail_address']; ?>';" alt="logoartwork" />
|
||||
<img id="LogoLink" src="<?php echo $template_path; ?>/images/header/tibia-logo-artwork-string.gif" onClick="window.location = 'mailto:<?php echo setting('core.mail_address'); ?>';" alt="logoartwork" />
|
||||
</div>
|
||||
|
||||
<div id="Loginbox" >
|
||||
|
Loading…
x
Reference in New Issue
Block a user