diff --git a/admin/pages/accounts.php b/admin/pages/accounts.php
index 45a310e6..68dd7081 100644
--- a/admin/pages/accounts.php
+++ b/admin/pages/accounts.php
@@ -37,7 +37,7 @@ if ($config['account_country']) {
$countries[$code] = $c;
}
$web_acc = ACCOUNT_WEB_FLAGS;
-$acc_type = config('account_types');
+$acc_type = setting('core.account_types');
?>
diff --git a/admin/pages/dashboard.php b/admin/pages/dashboard.php
index 53380503..e24b98ad 100644
--- a/admin/pages/dashboard.php
+++ b/admin/pages/dashboard.php
@@ -47,12 +47,11 @@ $tmp = '';
if (fetchDatabaseConfig('site_closed_message', $tmp))
$closed_message = $tmp;
-$configAdminPanelModules = config('admin_panel_modules');
-if (isset($configAdminPanelModules)) {
+$settingAdminPanelModules = setting('core.admin_panel_modules');
+if (count($settingAdminPanelModules) > 0) {
echo '
';
- $configAdminPanelModules = explode(',', $configAdminPanelModules);
$twig_loader->prependPath(__DIR__ . '/modules/templates');
- foreach ($configAdminPanelModules as $box) {
+ foreach ($settingAdminPanelModules as $box) {
$file = __DIR__ . '/modules/' . $box . '.php';
if (file_exists($file)) {
include($file);
diff --git a/admin/pages/pages.php b/admin/pages/pages.php
index 7f030e47..e2b7acf5 100644
--- a/admin/pages/pages.php
+++ b/admin/pages/pages.php
@@ -152,8 +152,8 @@ class Pages
$errors[] = 'Enable PHP is wrong.';
return false;
}
- if ($php == 1 && !getBoolean(config('admin_pages_php_enable'))) {
- $errors[] = 'PHP pages disabled on this server. To enable go to config.php and change admin_pages_php_enable to "yes".';
+ if ($php == 1 && !getBoolean(setting('core.admin_pages_php_enable'))) {
+ $errors[] = 'PHP pages disabled on this server. To enable go to Settings in Admin Panel and enable
Enable PHP Pages.';
return false;
}
if(!isset($enable_tinymce) || ($enable_tinymce != 0 && $enable_tinymce != 1)) {
diff --git a/admin/pages/plugins.php b/admin/pages/plugins.php
index f754edf4..be9df2b0 100644
--- a/admin/pages/plugins.php
+++ b/admin/pages/plugins.php
@@ -13,8 +13,8 @@ $use_datatable = true;
require_once LIBS . 'plugins.php';
-if (!getBoolean(config('admin_plugins_manage_enable'))) {
- warning('Plugin installation and management is disabled in config.
If you wish to enable, go to config.php and change
admin_plugins_manage_enable to "yes".');
+if (!getBoolean(setting('core.admin_plugins_manage_enable'))) {
+ warning('Plugin installation and management is disabled in Settings.
If you wish to enable, go to Settings and enable
Enable Plugins Manage.');
}
else {
$twig->display('admin.plugins.form.html.twig');
diff --git a/config.php b/config.php
index 50c333f1..414234e9 100644
--- a/config.php
+++ b/config.php
@@ -67,24 +67,6 @@ $config = array(
'send_mail_when_change_password' => true, // send e-mail with new password when change password to account
'send_mail_when_generate_reckey' => true, // send e-mail with rec key (key is displayed on page anyway when generate)
- // you may need to adjust this for older tfs versions
- // by removing Community Manager
- 'account_types' => [
- 'None',
- 'Normal',
- 'Tutor',
- 'Senior Tutor',
- 'Gamemaster',
- 'Community Manager',
- 'God',
- ],
-
- // genders (aka sex)
- 'genders' => array(
- 0 => 'Female',
- 1 => 'Male'
- ),
-
// new character config
'character_samples' => array( // vocations, format: ID_of_vocation => 'Name of Character to copy'
//0 => 'Rook Sample',
@@ -118,21 +100,6 @@ $config = array(
1 => 'Sample town'
),
- // bans page
- 'bans_per_page' => 20,
-
- // highscores page
- 'highscores_vocation_box' => true, // show 'Choose a vocation' box on the highscores (allowing peoples to sort highscores by vocation)?
- 'highscores_vocation' => true, // show player vocation under his nickname?
- 'highscores_frags' => false, // show 'Frags' tab (best fraggers on the server)?
- 'highscores_balance' => false, // show 'Balance' tab (richest players on the server)
- 'highscores_outfit' => true, // show player outfit?
- 'highscores_country_box' => false, // doesnt work yet! (not implemented)
- 'highscores_groups_hidden' => 3, // this group id and higher won't be shown on the highscores
- 'highscores_ids_hidden' => array(0), // this ids of players will be hidden on the highscores (should be ids of samples)
- 'highscores_per_page' => 100, // how many records per page on highscores
- 'highscores_cache_ttl' => 15, // how often to update highscores from database in minutes (default 15 minutes)
-
// characters page
'characters' => array( // what things to display on character view page (true/false in each option)
'level' => true,
@@ -169,13 +136,6 @@ $config = array(
// last kills
'last_kills_limit' => 50, // max. number of deaths shown on the last kills page
- // admin panel
- 'admin_plugins_manage_enable' => 'yes', // you can disable possibility to upload and uninstall plugins, for security
- // enable support for plain php pages in admin panel, for security
- // existing pages still will be working, so you need to delete them manually
- 'admin_pages_php_enable' => 'no',
- '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
'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
diff --git a/install/steps/5-database.php b/install/steps/5-database.php
index b97dca4f..3e1922ea 100644
--- a/install/steps/5-database.php
+++ b/install/steps/5-database.php
@@ -21,6 +21,7 @@ if(!$error) {
// user can disable when he wants
$content .= '$config[\'env\'] = \'prod\'; // dev or prod';
$content .= PHP_EOL;
+
foreach($_SESSION as $key => $value)
{
if(strpos($key, 'var_') !== false)
@@ -32,11 +33,7 @@ if(!$error) {
$value .= '/';
}
- if($key === 'var_usage') {
- $content .= '$config[\'anonymous_usage_statistics\'] = ' . ((int)$value == 1 ? 'true' : 'false') . ';';
- $content .= PHP_EOL;
- }
- else if(!in_array($key, array('var_account', 'var_account_id', 'var_password', 'var_step', 'var_email', 'var_player_name'), true)) {
+ if(!in_array($key, ['var_usage', 'var_date_timezone', 'var_client', 'var_account', 'var_account_id', 'var_password', 'var_password_confirm', 'var_step', 'var_email', 'var_player_name'], true)) {
$content .= '$config[\'' . str_replace('var_', '', $key) . '\'] = \'' . $value . '\';';
$content .= PHP_EOL;
}
@@ -79,8 +76,6 @@ if(!$error) {
'message' => $locale['loading_spinner']
));
- $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) . '_\';';
$saved = true;
diff --git a/install/steps/7-finish.php b/install/steps/7-finish.php
index f6e1f6c2..7ab77185 100644
--- a/install/steps/7-finish.php
+++ b/install/steps/7-finish.php
@@ -116,6 +116,23 @@ else {
}
}
+ $settings = Settings::getInstance();
+ foreach($_SESSION as $key => $value) {
+ if (in_array($key, ['var_usage', 'var_date_timezone', 'var_client'])) {
+ if ($key == 'var_usage') {
+ $key = 'anonymous_usage_statistics';
+ $value = ((int)$value == 1 ? 'true' : 'false');
+ } elseif ($key == 'var_date_timezone') {
+ $key = 'date_timezone';
+ } elseif ($key == 'var_client') {
+ $key = 'client';
+ }
+
+ $settings->updateInDatabase('core', $key, $value);
+ }
+ }
+ success('Settings saved.');
+
$twig->display('install.installer.html.twig', array(
'url' => 'tools/7-finish.php',
'message' => $locale['importing_spinner']
diff --git a/install/tools/7-finish.php b/install/tools/7-finish.php
index 3d98b570..23854887 100644
--- a/install/tools/7-finish.php
+++ b/install/tools/7-finish.php
@@ -51,13 +51,6 @@ DataLoader::load();
// update config.highscores_ids_hidden
require_once SYSTEM . 'migrations/20.php';
-$database_migration_20 = true;
-$content = '';
-if(!databaseMigration20($content)) {
- $locale['step_database_error_file'] = str_replace('$FILE$', '
' . BASE . 'config.local.php', $locale['step_database_error_file']);
- warning($locale['step_database_error_file'] . '
-
');
-}
// add z_polls tables
require_once SYSTEM . 'migrations/22.php';
diff --git a/system/compat/config.php b/system/compat/config.php
index 0f0d8457..42f4e49c 100644
--- a/system/compat/config.php
+++ b/system/compat/config.php
@@ -1,6 +1,8 @@
hasTable('players_online');
- $players = $db->query('SELECT `id`, `name`, `level`, `vocation`, `experience`, `looktype`' . ($db->hasColumn('players', 'lookaddons') ? ', `lookaddons`' : '') . ', `lookhead`, `lookbody`, `looklegs`, `lookfeet`' . ($is_tfs10 ? '' : ', `online`') . ' FROM `players` WHERE `group_id` < ' . config('highscores_groups_hidden') . ' AND `id` NOT IN (' . implode(', ', config('highscores_ids_hidden')) . ') AND `' . $deleted . '` = 0 AND `account_id` != 1 ORDER BY `experience` DESC LIMIT ' . (int)$limit)->fetchAll();
+ $players = $db->query('SELECT `id`, `name`, `level`, `vocation`, `experience`, `looktype`' . ($db->hasColumn('players', 'lookaddons') ? ', `lookaddons`' : '') . ', `lookhead`, `lookbody`, `looklegs`, `lookfeet`' . ($is_tfs10 ? '' : ', `online`') . ' FROM `players` WHERE `group_id` < ' . setting('core.highscores_groups_hidden') . ' AND `id` NOT IN (' . implode(', ', setting('core.highscores_ids_hidden')) . ') AND `' . $deleted . '` = 0 AND `account_id` != 1 ORDER BY `experience` DESC LIMIT ' . (int)$limit)->fetchAll();
if($is_tfs10) {
foreach($players as &$player) {
diff --git a/system/init.php b/system/init.php
index 4aa08453..5cc1d70a 100644
--- a/system/init.php
+++ b/system/init.php
@@ -22,7 +22,6 @@ if(config('env') === 'dev') {
require SYSTEM . 'exception.php';
}
-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'] .= '/';
@@ -119,11 +118,6 @@ if(!isset($foundValue)) {
$config['data_path'] = $foundValue;
unset($foundValue);
-// new config values for compatibility
-if(!isset($config['highscores_ids_hidden']) || count($config['highscores_ids_hidden']) == 0) {
- $config['highscores_ids_hidden'] = array(0);
-}
-
$config['account_create_character_create'] = config('account_create_character_create') && (!setting('core.mail_enabled') || !config('account_mail_verify'));
// POT
diff --git a/system/libs/CreateCharacter.php b/system/libs/CreateCharacter.php
index 60909c0f..eb3b0c11 100644
--- a/system/libs/CreateCharacter.php
+++ b/system/libs/CreateCharacter.php
@@ -239,14 +239,14 @@ class CreateCharacter
}
if($db->hasTable('player_skills')) {
- for($i=0; $i<7; $i++) {
+ for($skill = POT::SKILL_FIRST; $skill <= POT::SKILL_LAST; $skill++) {
$value = 10;
if (config('use_character_sample_skills')) {
- $value = $char_to_copy->getSkill($i);
+ $value = $char_to_copy->getSkill($skill);
}
- $skillExists = $db->query('SELECT `skillid` FROM `player_skills` WHERE `player_id` = ' . $player->getId() . ' AND `skillid` = ' . $i);
+ $skillExists = $db->query('SELECT `skillid` FROM `player_skills` WHERE `player_id` = ' . $player->getId() . ' AND `skillid` = ' . $skill);
if($skillExists->rowCount() <= 0) {
- $db->query('INSERT INTO `player_skills` (`player_id`, `skillid`, `value`, `count`) VALUES ('.$player->getId().', '.$i.', ' . $value . ', 0)');
+ $db->query('INSERT INTO `player_skills` (`player_id`, `skillid`, `value`, `count`) VALUES ('.$player->getId().', '.$skill.', ' . $value . ', 0)');
}
}
}
diff --git a/system/migrations/20.php b/system/migrations/20.php
index d0012fde..b0e09471 100644
--- a/system/migrations/20.php
+++ b/system/migrations/20.php
@@ -1,47 +1,15 @@
query("SELECT `id` FROM `players` WHERE (`name` = " . $db->quote("Rook Sample") . " OR `name` = " . $db->quote("Sorcerer Sample") . " OR `name` = " . $db->quote("Druid Sample") . " OR `name` = " . $db->quote("Paladin Sample") . " OR `name` = " . $db->quote("Knight Sample") . " OR `name` = " . $db->quote("Account Manager") . ") ORDER BY `id`;");
+
+$highscores_ignored_ids = array();
+if($query->rowCount() > 0) {
+ foreach($query->fetchAll() as $result)
+ $highscores_ignored_ids[] = $result['id'];
+}
+else {
+ $highscores_ignored_ids[] = 0;
}
-function databaseMigration20(&$content = '') {
- global $db;
-
- $config_file = BASE . 'config.local.php';
- if(!is_writable($config_file)) { // we can't do anything, just ignore
- return false;
- }
-
- $content_of_file = trim(file_get_contents($config_file));
- if(strpos($content_of_file, 'highscores_ids_hidden') !== false) { // already present
- return true;
- }
-
- $query = $db->query("SELECT `id` FROM `players` WHERE (`name` = " . $db->quote("Rook Sample") . " OR `name` = " . $db->quote("Sorcerer Sample") . " OR `name` = " . $db->quote("Druid Sample") . " OR `name` = " . $db->quote("Paladin Sample") . " OR `name` = " . $db->quote("Knight Sample") . " OR `name` = " . $db->quote("Account Manager") . ") ORDER BY `id`;");
-
- $highscores_ignored_ids = array();
- if($query->rowCount() > 0) {
- foreach($query->fetchAll() as $result)
- $highscores_ignored_ids[] = $result['id'];
- }
- else {
- $highscores_ignored_ids[] = 0;
- }
-
- $php_on_end = substr($content_of_file, -2, 2) == '?>';
- $content = PHP_EOL;
- if($php_on_end) {
- $content .= '';
- }
-
- file_put_contents($config_file, $content, FILE_APPEND);
- return true;
-}
+$settings = Settings::getInstance();
+$settings->updateInDatabase('core', 'highscores_ids_hidden', implode(', ', $highscores_ignored_ids));
diff --git a/system/pages/highscores.php b/system/pages/highscores.php
index dd2efa7b..fe8533c7 100644
--- a/system/pages/highscores.php
+++ b/system/pages/highscores.php
@@ -11,8 +11,8 @@
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Highscores';
-$configHighscoresCountryBox = config('highscores_country_box');
-if(config('account_country') && $configHighscoresCountryBox)
+$settingHighscoresCountryBox = setting('core.highscores_country_box');
+if(config('account_country') && $settingHighscoresCountryBox)
require SYSTEM . 'countries.conf.php';
$list = $_GET['list'] ?? 'experience';
@@ -25,11 +25,11 @@ if(!is_numeric($page) || $page < 1 || $page > PHP_INT_MAX) {
$add_sql = '';
-$configHighscoresVocationBox = config('highscores_vocation_box');
+$settingHighscoresVocationBox = setting('core.highscores_vocation_box');
$configVocations = config('vocations');
$configVocationsAmount = config('vocations_amount');
-if($configHighscoresVocationBox && $vocation !== 'all')
+if($settingHighscoresVocationBox && $vocation !== 'all')
{
foreach($configVocations as $id => $name) {
if(strtolower($name) == $vocation) {
@@ -99,12 +99,12 @@ else
break;
case 'frags':
- if(config('highscores_frags'))
+ if(setting('core.highscores_frags'))
$skill = SKILL_FRAGS;
break;
case 'balance':
- if(config('highscores_balance'))
+ if(setting('core.highscores_balance'))
$skill = SKILL_BALANCE;
break;
}
@@ -125,9 +125,9 @@ if($db->hasColumn('players', 'deletion'))
$outfit_addons = false;
$outfit = '';
-$configHighscoresOutfit = config('highscores_outfit');
+$settingHighscoresOutfit = setting('core.highscores_outfit');
-if($configHighscoresOutfit) {
+if($settingHighscoresOutfit) {
$outfit = ', lookbody, lookfeet, lookhead, looklegs, looktype';
if($db->hasColumn('players', 'lookaddons')) {
$outfit .= ', lookaddons';
@@ -135,7 +135,7 @@ if($configHighscoresOutfit) {
}
}
-$configHighscoresPerPage = config('highscores_per_page');
+$configHighscoresPerPage = setting('core.highscores_per_page');
$limit = $configHighscoresPerPage + 1;
$needReCache = true;
@@ -164,15 +164,15 @@ if (!isset($highscores) || empty($highscores)) {
POT::SKILL_FISH => 'skill_fishing',
);
- $highscores = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,vocation' . $promotion . $outfit . ', ' . $skill_ids[$skill] . ' as value FROM accounts,players WHERE players.id NOT IN (' . implode(', ', config('highscores_ids_hidden')) . ') AND players.' . $deleted . ' = 0 AND players.group_id < ' . config('highscores_groups_hidden') . ' ' . $add_sql . ' AND accounts.id = players.account_id ORDER BY ' . $skill_ids[$skill] . ' DESC LIMIT ' . $limit . ' OFFSET ' . $offset)->fetchAll();
+ $highscores = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,vocation' . $promotion . $outfit . ', ' . $skill_ids[$skill] . ' as value FROM accounts,players WHERE players.id NOT IN (' . implode(', ', setting('core.highscores_ids_hidden')) . ') AND players.' . $deleted . ' = 0 AND players.group_id < ' . setting('core.highscores_groups_hidden') . ' ' . $add_sql . ' AND accounts.id = players.account_id ORDER BY ' . $skill_ids[$skill] . ' DESC LIMIT ' . $limit . ' OFFSET ' . $offset)->fetchAll();
} else
- $highscores = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',value,level,vocation' . $promotion . $outfit . ' FROM accounts,players,player_skills WHERE players.id NOT IN (' . implode(', ', config('highscores_ids_hidden')) . ') AND players.' . $deleted . ' = 0 AND players.group_id < ' . config('highscores_groups_hidden') . ' ' . $add_sql . ' AND players.id = player_skills.player_id AND player_skills.skillid = ' . $skill . ' AND accounts.id = players.account_id ORDER BY value DESC, count DESC LIMIT ' . $limit . ' OFFSET ' . $offset)->fetchAll();
+ $highscores = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',value,level,vocation' . $promotion . $outfit . ' FROM accounts,players,player_skills WHERE players.id NOT IN (' . implode(', ', setting('core.highscores_ids_hidden')) . ') AND players.' . $deleted . ' = 0 AND players.group_id < ' . setting('core.highscores_groups_hidden') . ' ' . $add_sql . ' AND players.id = player_skills.player_id AND player_skills.skillid = ' . $skill . ' AND accounts.id = players.account_id ORDER BY value DESC, count DESC LIMIT ' . $limit . ' OFFSET ' . $offset)->fetchAll();
} else if ($skill == SKILL_FRAGS) // frags
{
if ($db->hasTable('player_killers')) {
$highscores = $db->query('SELECT accounts.country, players.id, players.name' . $online . ',level, vocation' . $promotion . $outfit . ', COUNT(`player_killers`.`player_id`) as value' .
' FROM `accounts`, `players`, `player_killers` ' .
- ' WHERE players.id NOT IN (' . implode(', ', config('highscores_ids_hidden')) . ') AND players.' . $deleted . ' = 0 AND players.group_id < ' . config('highscores_groups_hidden') . ' ' . $add_sql . ' AND players.id = player_killers.player_id AND accounts.id = players.account_id' .
+ ' WHERE players.id NOT IN (' . implode(', ', setting('core.highscores_ids_hidden')) . ') AND players.' . $deleted . ' = 0 AND players.group_id < ' . setting('core.highscores_groups_hidden') . ' ' . $add_sql . ' AND players.id = player_killers.player_id AND accounts.id = players.account_id' .
' GROUP BY `player_id`' .
' ORDER BY value DESC' .
' LIMIT ' . $limit . ' OFFSET ' . $offset)->fetchAll();
@@ -183,9 +183,9 @@ if (!isset($highscores) || empty($highscores)) {
FROM `players` p
LEFT JOIN `accounts` a ON `a`.`id` = `p`.`account_id`
LEFT JOIN `player_deaths` pd ON `pd`.`killed_by` = `p`.`name`
- WHERE `p`.id NOT IN (' . implode(', ', config('highscores_ids_hidden')) . ')
+ WHERE `p`.id NOT IN (' . implode(', ', setting('core.highscores_ids_hidden')) . ')
AND `p`.' . $deleted . ' = 0
- AND `p`.group_id < ' . config('highscores_groups_hidden') . ' ' . $add_sql . '
+ AND `p`.group_id < ' . setting('core.highscores_groups_hidden') . ' ' . $add_sql . '
AND `pd`.`unjustified` = 1
GROUP BY `killed_by`
ORDER BY value DESC
@@ -193,19 +193,19 @@ if (!isset($highscores) || empty($highscores)) {
}
} else if ($skill == SKILL_BALANCE) // balance
{
- $highscores = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,balance as value,vocation' . $promotion . $outfit . ' FROM accounts,players WHERE players.id NOT IN (' . implode(', ', config('highscores_ids_hidden')) . ') AND players.' . $deleted . ' = 0 AND players.group_id < ' . config('highscores_groups_hidden') . ' ' . $add_sql . ' AND accounts.id = players.account_id ORDER BY value DESC LIMIT ' . $limit . ' OFFSET ' . $offset)->fetchAll();
+ $highscores = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,balance as value,vocation' . $promotion . $outfit . ' FROM accounts,players WHERE players.id NOT IN (' . implode(', ', setting('core.highscores_ids_hidden')) . ') AND players.' . $deleted . ' = 0 AND players.group_id < ' . setting('core.highscores_groups_hidden') . ' ' . $add_sql . ' AND accounts.id = players.account_id ORDER BY value DESC LIMIT ' . $limit . ' OFFSET ' . $offset)->fetchAll();
} else {
if ($skill == POT::SKILL__MAGLEVEL) {
- $highscores = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',maglevel,level,vocation' . $promotion . $outfit . ' FROM accounts, players WHERE players.id NOT IN (' . implode(', ', config('highscores_ids_hidden')) . ') AND players.' . $deleted . ' = 0 ' . $add_sql . ' AND players.group_id < ' . config('highscores_groups_hidden') . ' AND accounts.id = players.account_id ORDER BY maglevel DESC, manaspent DESC LIMIT ' . $limit . ' OFFSET ' . $offset)->fetchAll();
+ $highscores = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',maglevel,level,vocation' . $promotion . $outfit . ' FROM accounts, players WHERE players.id NOT IN (' . implode(', ', setting('core.highscores_ids_hidden')) . ') AND players.' . $deleted . ' = 0 ' . $add_sql . ' AND players.group_id < ' . setting('core.highscores_groups_hidden') . ' AND accounts.id = players.account_id ORDER BY maglevel DESC, manaspent DESC LIMIT ' . $limit . ' OFFSET ' . $offset)->fetchAll();
} else { // level
- $highscores = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,experience,vocation' . $promotion . $outfit . ' FROM accounts, players WHERE players.id NOT IN (' . implode(', ', config('highscores_ids_hidden')) . ') AND players.' . $deleted . ' = 0 ' . $add_sql . ' AND players.group_id < ' . config('highscores_groups_hidden') . ' AND accounts.id = players.account_id ORDER BY level DESC, experience DESC LIMIT ' . $limit . ' OFFSET ' . $offset)->fetchAll();
+ $highscores = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,experience,vocation' . $promotion . $outfit . ' FROM accounts, players WHERE players.id NOT IN (' . implode(', ', setting('core.highscores_ids_hidden')) . ') AND players.' . $deleted . ' = 0 ' . $add_sql . ' AND players.group_id < ' . setting('core.highscores_groups_hidden') . ' AND accounts.id = players.account_id ORDER BY level DESC, experience DESC LIMIT ' . $limit . ' OFFSET ' . $offset)->fetchAll();
$list = 'experience';
}
}
}
if ($cache->enabled() && $needReCache) {
- $cache->set($cacheKey, serialize($highscores), config('highscores_cache_ttl') * 60);
+ $cache->set($cacheKey, serialize($highscores), setting('core.highscores_cache_ttl') * 60);
}
$online_exist = false;
@@ -227,7 +227,7 @@ if($db->hasTable('players_online') && count($players) > 0) {
$show_link_to_next_page = false;
$i = 0;
-$configHighscoresVocation = config('highscores_vocation');
+$settingHighscoresVocation = setting('core.highscores_vocation');
foreach($highscores as $id => &$player)
{
@@ -248,7 +248,7 @@ foreach($highscores as $id => &$player)
$player['experience'] = number_format($player['experience']);
}
- if($configHighscoresVocation) {
+ if($settingHighscoresVocation) {
if(isset($player['promotion'])) {
if((int)$player['promotion'] > 0) {
$player['vocation'] += ($player['promotion'] * $configVocationsAmount);
@@ -266,7 +266,7 @@ foreach($highscores as $id => &$player)
$player['link'] = getPlayerLink($player['name'], false);
$player['flag'] = getFlagImage($player['country']);
- if($configHighscoresOutfit) {
+ if($settingHighscoresOutfit) {
$player['outfit'] = '
 . '?id=' . $player['looktype'] . ($outfit_addons ? '&addons=' . $player['lookaddons'] : '') . '&head=' . $player['lookhead'] . '&body=' . $player['lookbody'] . '&legs=' . $player['looklegs'] . '&feet=' . $player['lookfeet'] . ')
';
}
$player['rank'] = $offset + $i;
@@ -302,10 +302,10 @@ $types = array(
'fishing' => 'Fishing',
);
-if(config('highscores_frags')) {
+if(setting('core.highscores_frags')) {
$types['frags'] = 'Frags';
}
-if(config('highscores_balance'))
+if(setting('core.highscores_balance'))
$types['balance'] = 'Balance';
/** @var Twig\Environment $twig */
diff --git a/system/settings.php b/system/settings.php
index 13a342f3..67bc8532 100644
--- a/system/settings.php
+++ b/system/settings.php
@@ -25,6 +25,28 @@ return [
'desc' => 'Timezone of the server, more info at http://php.net/manual/en/timezones.php',
'default' => 'Europe/Warsaw',
],
+ 'genders' => [
+ 'name' => 'Genders (aka sex)',
+ 'type' => 'textarea',
+ 'desc' => 'Separated with comma',
+ 'default' => 'Female, Male',
+ 'callbacks' => [
+ 'get' => function ($value) {
+ return array_map('trim', explode(',', $value));
+ },
+ ],
+ ],
+ 'account_types' => [
+ 'name' => 'Account Types',
+ 'type' => 'textarea',
+ 'desc' => 'Separated with comma, you may need to adjust this for older tfs versions by removing Community Manager',
+ 'default' => 'None, Normal, Tutor, Senior Tutor, Gamemaster, Community Manager, God',
+ 'callbacks' => [
+ 'get' => function ($value) {
+ return array_map('trim', explode(',', $value));
+ },
+ ],
+ ],
[
'type' => 'section',
'title' => 'Template'
@@ -605,6 +627,77 @@ Sent by MyAAC,
'forum', '=', 'site',
],
],
+ [
+ 'type' => 'section',
+ 'title' => 'Highscores Page',
+ ],
+ 'highscores_per_page' => [
+ 'name' => 'Highscores per Page',
+ 'type' => 'number',
+ 'min' => 1,
+ 'desc' => 'How many records per page on highscores',
+ 'default' => 100,
+ ],
+ 'highscores_cache_ttl' => [
+ 'name' => 'Highscores Cache TTL (in minutes)',
+ 'type' => 'number',
+ 'min' => 1,
+ 'desc' => 'How often to update highscores from database in minutes (default 15 minutes). Too low may cause lags on website.',
+ 'default' => 15,
+ ],
+ 'highscores_vocation_box' => [
+ 'name' => 'Display Vocation Box',
+ 'type' => 'boolean',
+ 'desc' => 'show "Choose a vocation" box on the highscores (allowing peoples to sort highscores by vocation)?',
+ 'default' => true,
+ ],
+ 'highscores_vocation' => [
+ 'name' => 'Display Vocation',
+ 'type' => 'boolean',
+ 'desc' => 'Show player vocation under his nickname?',
+ 'default' => true,
+ ],
+ 'highscores_frags' => [
+ 'name' => 'Display Top Frags',
+ 'type' => 'boolean',
+ 'desc' => 'Show "Frags" tab (best fraggers on the server)?',
+ 'default' => false,
+ ],
+ 'highscores_balance' => [
+ 'name' => 'Display Balance',
+ 'type' => 'boolean',
+ 'desc' => 'Show "Balance" tab (richest players on the server)?',
+ 'default' => false,
+ ],
+ 'highscores_outfit' => [
+ 'name' => 'Display Player Outfit',
+ 'type' => 'boolean',
+ 'desc' => 'Show player outfit?',
+ 'default' => true,
+ ],
+ 'highscores_country_box' => [ // not implemented yet
+ 'name' => 'Display Country Box',
+ 'type' => 'hidden',
+ 'desc' => 'Show player outfit?',
+ 'default' => false,
+ ],
+ 'highscores_groups_hidden' => [
+ 'name' => 'Hidden Groups',
+ 'type' => 'number',
+ 'desc' => "This group id and higher won't be shown on highscores",
+ 'default' => 3,
+ ],
+ 'highscores_ids_hidden' => [
+ 'name' => 'Hidden IDs of players',
+ 'type' => 'textarea',
+ 'desc' => "this ids of players will be hidden on the highscores (should be ids of samples)",
+ 'default' => '0',
+ 'callbacks' => [
+ 'get' => function ($value) {
+ return array_map('trim', explode(',', $value));
+ },
+ ],
+ ],
[
'type' => 'section',
'title' => 'Online Page'
@@ -685,10 +778,11 @@ Sent by MyAAC,
'title' => 'Bans Page'
],
'bans_per_page' => [
- 'name' => 'Display Players Record',
- 'type' => 'boolean',
+ 'name' => 'Bans per Page',
+ 'type' => 'number',
+ 'min' => 1,
+ 'default' => 20,
'desc' => '',
- 'default' => true,
],
[
'type' => 'section',
@@ -842,5 +936,36 @@ Sent by MyAAC,
'status_enabled', '=', 'true',
]
],
+ [
+ 'type' => 'category',
+ 'title' => 'Admin',
+ ],
+ [
+ 'type' => 'section',
+ 'title' => 'Admin Panel'
+ ],
+ 'admin_plugins_manage_enable' => [
+ 'name' => 'Enable Plugins Manage',
+ 'type' => 'boolean',
+ 'desc' => 'You can disable possibility to upload, enable/disable and uninstall plugins, for security',
+ 'default' => true,
+ ],
+ 'admin_pages_php_enable' => [
+ 'name' => 'Enable PHP Pages',
+ 'type' => 'boolean',
+ 'desc' => 'You can disable support for plain php pages in admin panel, for security.
Existing pages still will be working, so you need to delete them manually',
+ 'default' => false,
+ ],
+ 'admin_panel_modules' => [
+ 'name' => 'Modules Enabled',
+ 'type' => 'textarea',
+ 'desc' => 'What modules will be shown on Admin Panel Dashboard page',
+ 'default' => 'statistics,web_status,server_status,lastlogin,created,points,coins,balance',
+ 'callbacks' => [
+ 'get' => function ($value) {
+ return array_map('trim', explode(',', $value));
+ },
+ ],
+ ],
],
];