From 1fa67883101767031b3cf316ea17949622520a91 Mon Sep 17 00:00:00 2001 From: slawkens Date: Mon, 15 May 2023 00:22:27 +0200 Subject: [PATCH] [WIP] Some work on settings Add hidden settings New method: parse, to parse settings from array Move base html to twig template Remove vocation loading from .xml, instead use predefined voc names --- admin/pages/settings.php | 190 +---- system/compat_config.php | 24 +- system/functions.php | 4 +- system/init.php | 30 - system/libs/Settings.php | 217 ++++- system/libs/plugins.php | 3 +- system/pages/creatures.php | 4 +- system/settings.php | 919 +++++++++++----------- system/templates/admin.settings.html.twig | 20 + system/templates/creature.html.twig | 2 +- 10 files changed, 748 insertions(+), 665 deletions(-) create mode 100644 system/templates/admin.settings.html.twig diff --git a/admin/pages/settings.php b/admin/pages/settings.php index e5eae974..c33e76ef 100644 --- a/admin/pages/settings.php +++ b/admin/pages/settings.php @@ -21,11 +21,11 @@ $plugin = $_GET['plugin']; if($plugin != 'core') { $pluginSettings = Plugins::getPluginSettings($plugin); if (!$pluginSettings) { - error('This plugin does not exist or does not have options defined.'); + error('This plugin does not exist or does not have settings defined.'); return; } - $settingsFilePath = PLUGINS . $plugin . '/settings.php'; + $settingsFilePath = BASE . $pluginSettings; } else { $settingsFilePath = SYSTEM . 'settings.php'; @@ -36,13 +36,7 @@ if (!file_exists($settingsFilePath)) { return; } -if($plugin === 'core') { - $settingsFile = require $settingsFilePath; -} -else { - $settingsFile = require $settingsFilePath; -} - +$settingsFile = require $settingsFilePath; if (!is_array($settingsFile)) { return; } @@ -61,182 +55,14 @@ if (isset($_POST['save'])) { if ($cache->enabled()) { $cache->delete('settings'); } + success('Saved at ' . date('H:i')); } $title = ($plugin == 'core' ? 'Settings' : 'Plugin Settings - ' . $plugin); -$query = 'SELECT `key`, `value` FROM `' . TABLE_PREFIX . 'settings` WHERE `plugin_name` = ' . $db->quote($plugin) . ';'; -$query = $db->query($query); +$settings = Settings::parse($plugin, $settingsFile['settings']); -$settingsDb = []; -if($query->rowCount() > 0) { - foreach($query->fetchAll(PDO::FETCH_ASSOC) as $value) { - $settingsDb[$value['key']] = $value['value']; - } -} - -?> - -
-
-
-
-
- -
-
- -
- ' . ($type ? 'Yes' : 'No') . ' '; - }; - - $i = 0; - $j = 0; - foreach($settingsFile as $key => $setting) { - if ($setting['type'] === 'category') { - if ($j++ !== 0) { - echo '
'; - } - ?> -
- '; - } - ?> -

- - - - - - - - - - - - - - - - - -
NameValueDescription
- '; - } - - else if($setting['type'] === 'textarea') { - echo ''; - } - - if ($setting['type'] === 'options') { - if ($setting['options'] === '$templates') { - $templates = []; - foreach (get_templates() as $value) { - $templates[$value] = $value; - } - - $setting['options'] = $templates; - } - - else if($setting['options'] === '$clients') { - $clients = []; - foreach((array)config('clients') as $client) { - - $client_version = (string)($client / 100); - if(strpos($client_version, '.') === false) - $client_version .= '.0'; - - $clients[$client] = $client_version; - } - - $setting['options'] = $clients; - } - - else { - if (is_string($setting['options'])) { - $setting['options'] = explode(',', $setting['options']); - foreach ($setting['options'] as &$option) { - $option = trim($option); - } - } - } - - echo ''; - } - ?> - -
- -
-
-
-
- -
-
- -
+$twig->display('admin.settings.html.twig', [ + 'settings' => $settings, +]); diff --git a/system/compat_config.php b/system/compat_config.php index 3bb926c4..2529442f 100644 --- a/system/compat_config.php +++ b/system/compat_config.php @@ -18,8 +18,30 @@ $deprecatedConfig = [ 'views_counter', 'outfit_images_url', 'item_images_url', + 'account_country', + 'team_display_outfit', + 'team_display_status', + 'team_display_world', + 'team_display_lastlogin', + 'multiworld', ]; foreach ($deprecatedConfig as $value) { - $config[$value] = $settings['core.'.$value]['value']; + config( + [ + $value, + $settings['core.'.$value]['value'] + ] + ); + + //var_dump($settings['core.'.$value]['value']); } + +$vocationsParsed = array_map( + function(string $value): string { + return trim($value); + }, + explode(',', $settings['core.vocations']['value']) +); + +config(['vocations', $vocationsParsed]); diff --git a/system/functions.php b/system/functions.php index e6f7b9d9..475fa174 100644 --- a/system/functions.php +++ b/system/functions.php @@ -1492,8 +1492,8 @@ function right($str, $length) { } function getCreatureImgPath($creature){ - $creature_path = config('creatures_images_url'); - $creature_gfx_name = trim(strtolower($creature)) . config('creatures_images_extension'); + $creature_path = config('monsters_images_url'); + $creature_gfx_name = trim(strtolower($creature)) . config('monsters_images_extension'); if (!file_exists($creature_path . $creature_gfx_name)) { $creature_gfx_name = str_replace(" ", "", $creature_gfx_name); if (file_exists($creature_path . $creature_gfx_name)) { diff --git a/system/init.php b/system/init.php index 057bb7a4..0821d621 100644 --- a/system/init.php +++ b/system/init.php @@ -148,35 +148,5 @@ define('USE_ACCOUNT_NAME', $db->hasColumn('accounts', 'name')); define('USE_ACCOUNT_NUMBER', $db->hasColumn('accounts', 'number')); define('USE_ACCOUNT_SALT', $db->hasColumn('accounts', 'salt')); -// load vocation names -$tmp = ''; -if($cache->enabled() && $cache->fetch('vocations', $tmp)) { - $config['vocations'] = unserialize($tmp); -} -else { - if(!class_exists('DOMDocument')) { - throw new RuntimeException('Please install PHP xml extension. MyAAC will not work without it.'); - } - - $vocations = new DOMDocument(); - $file = $config['data_path'] . 'XML/vocations.xml'; - if(!@file_exists($file)) - $file = $config['data_path'] . 'vocations.xml'; - - if(!$vocations->load($file)) - throw new RuntimeException('ERROR: Cannot load vocations.xml - the file is malformed. Check the file with xml syntax validator.'); - - $config['vocations'] = array(); - foreach($vocations->getElementsByTagName('vocation') as $vocation) { - $id = $vocation->getAttribute('id'); - $config['vocations'][$id] = $vocation->getAttribute('name'); - } - - if($cache->enabled()) { - $cache->set('vocations', serialize($config['vocations']), 120); - } -} -unset($tmp, $id, $vocation); - require LIBS . 'Towns.php'; Towns::load(); diff --git a/system/libs/Settings.php b/system/libs/Settings.php index ca5b2634..ff44aceb 100644 --- a/system/libs/Settings.php +++ b/system/libs/Settings.php @@ -18,7 +18,7 @@ class Settings implements ArrayAccess /** * @return Settings */ - public static function getInstance() + public static function getInstance(): Settings { if (!self::$instance) { self::$instance = new self(); @@ -52,6 +52,210 @@ class Settings implements ArrayAccess } } + public static function parse($plugin, $settings): string + { + global $db; + + $query = 'SELECT `key`, `value` FROM `' . TABLE_PREFIX . 'settings` WHERE `plugin_name` = ' . $db->quote($plugin) . ';'; + $query = $db->query($query); + + $settingsDb = []; + if($query->rowCount() > 0) { + foreach($query->fetchAll(PDO::FETCH_ASSOC) as $value) { + $settingsDb[$value['key']] = $value['value']; + } + } + + ob_start(); + ?> + +
+ ' . ($type ? 'Yes' : 'No') . ' '; + }; + + $i = 0; + $j = 0; + foreach($settings as $key => $setting) { + if ($setting['type'] === 'category') { + if ($j++ !== 0) { + echo '
'; + } + ?> +
+ '; + } + ?> +

+ + + + + + + + + + + + + + + + + +
NameValueDescription
+ '; + } + + else if($setting['type'] === 'textarea') { + echo ''; + } + + else if ($setting['type'] === 'options') { + if ($setting['options'] === '$templates') { + $templates = []; + foreach (get_templates() as $value) { + $templates[$value] = $value; + } + + $setting['options'] = $templates; + } + + else if($setting['options'] === '$clients') { + $clients = []; + foreach((array)config('clients') as $client) { + + $client_version = (string)($client / 100); + if(strpos($client_version, '.') === false) + $client_version .= '.0'; + + $clients[$client] = $client_version; + } + + $setting['options'] = $clients; + } + + else { + if (is_string($setting['options'])) { + $setting['options'] = explode(',', $setting['options']); + foreach ($setting['options'] as &$option) { + $option = trim($option); + } + } + } + + echo ''; + } + + if (!isset($setting['hidden']) || !$setting['hidden']) { + ?> + +
+ '; + echo 'Default: '; + if ($setting['type'] === 'boolean') { + echo ($setting['default'] ? 'Yes' : 'No'); + } + else if (in_array($setting['type'], ['text', 'number', 'email', 'password', 'textarea'])) { + echo $setting['default']; + } + else if ($setting['type'] === 'options') { + echo $setting['options'][$setting['default']]; + } + ?> +
+
+
+ + + plugins[$pluginName] = require $file; + $tmp = require $file; + $this->plugins[$pluginName] = $tmp['settings']; } } } diff --git a/system/libs/plugins.php b/system/libs/plugins.php index d51e39d3..99565f9c 100644 --- a/system/libs/plugins.php +++ b/system/libs/plugins.php @@ -244,7 +244,8 @@ class Plugins { return $plugin_json; } - public static function install($file) { + public static function install($file): bool + { global $db; if(!\class_exists('ZipArchive')) { diff --git a/system/pages/creatures.php b/system/pages/creatures.php index f87b6f28..9e472738 100644 --- a/system/pages/creatures.php +++ b/system/pages/creatures.php @@ -14,7 +14,7 @@ $title = 'Creatures'; if (empty($_REQUEST['name'])) { // display list of monsters - $preview = config('creatures_images_preview'); + $preview = config('monsters_images_preview'); $creatures = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'monsters` WHERE `hidden` != 1 '.(empty($_REQUEST['boss']) ? '': 'AND `rewardboss` = 1').' ORDER BY name asc')->fetchAll(); if ($preview) { @@ -62,7 +62,7 @@ if (isset($creature['name'])) { $item['name'] = getItemNameById($item['id']); $item['rarity_chance'] = round($item['chance'] / 1000, 2); $item['rarity'] = getItemRarity($item['chance']); - $item['tooltip'] = ucfirst($item['name']) . '
Chance: ' . $item['rarity'] . (config('creatures_loot_percentage') ? ' ('. $item['rarity_chance'] .'%)' : '') . '
Max count: ' . $item['count']; + $item['tooltip'] = ucfirst($item['name']) . '
Chance: ' . $item['rarity'] . (config('monsters_loot_percentage') ? ' ('. $item['rarity_chance'] .'%)' : '') . '
Max count: ' . $item['count']; } $creature['loot'] = isset($loot) ? $loot : null; diff --git a/system/settings.php b/system/settings.php index c3ffc3a8..80954cab 100644 --- a/system/settings.php +++ b/system/settings.php @@ -1,449 +1,482 @@ [ - 'type' => 'category', - 'title' => 'General' - ], - 'section_1' => [ - 'type' => 'section', - 'title' => 'Template' - ], - 'template' => [ - 'name' => 'Template Name', - 'type' => 'options', - 'options' => '$templates', - 'desc' => 'Name of the template used by website', - 'default' => 'kathrine', - ], - 'template_allow_change' => [ - 'name' => 'Template Allow Change', - 'type' => 'boolean', - 'desc' => 'Allow changing template of the website by showing a special select in the part of website', - 'default' => true, - ], - 'section_2' => [ - 'type' => 'section', - 'title' => 'Misc' - ], - 'vocations_amount' => [ - 'name' => 'Amount of Vocations', - 'type' => 'number', - 'desc' => 'how much basic vocations your server got (without promotion)', - 'default' => 4, - ], - 'client' => [ - 'name' => 'Client Version', - 'type' => 'options', - 'options' => '$clients', - 'desc' => 'what client version are you using on this OT?
-used for the Downloads page and some templates aswell', - 'default' => 710 - ], - 'session_prefix' => [ - 'name' => 'Session Prefix', - 'type' => 'text', - 'desc' => 'must be unique for every site on your server', - 'default' => 'myaac_', - ], - 'friendly_urls' => [ - 'name' => 'Friendly URLs', - 'type' => 'boolean', - 'desc' => 'mod_rewrite is required for this, it makes links looks more elegant to eye, and also are SEO friendly (example: https://my-aac.org/guilds/Testing instead of https://my-aac.org/?subtopic=guilds&name=Testing).
Remember to rename .htaccess.dist to .htaccess', - 'default' => false, - ], - 'backward_support' => [ - 'name' => 'Gesior Backward Support', - 'type' => 'boolean', - 'desc' => 'gesior backward support (templates & pages)
-allows using gesior templates and pages with myaac
-might bring some performance when disabled', - 'default' => true, - ], - 'section_3' => [ - 'type' => 'section', - 'title' => 'Meta Site Settings' - ], - 'charset' => [ - 'name' => 'Meta Charset', - 'type' => 'text', - 'desc' => 'Charset used in ' . escapeHtml(''), - 'default' => 'utf-8', - ], - 'meta_description' => [ - 'name' => 'Meta Description', - 'type' => 'textarea', - 'desc' => 'description of the site in ' . escapeHtml(''), - 'default' => 'Tibia is a free massive multiplayer online role playing game (MMORPG).', - ], - 'meta_keywords' => [ - 'name' => 'Meta Keywords', - 'type' => 'textarea', - 'desc' => 'keywords list separated by commas', - 'default' => 'free online game, free multiplayer game, ots, open tibia server', - ], - 'footer' => [ - 'name' => 'Footer', - 'type' => 'textarea', - 'desc' => 'For example: "' . escapeHtml('
') . 'Your Server © 2020. All rights reserved."', - 'default' => '', - ], - /*'language' => [ - 'name' => 'Language', - 'type' => 'options', - 'options' => ['en' => 'English'], - 'desc' => 'default language (currently only English available)', - 'default' => 'en', - ],*/ - /*'language_allow_change' => [ - 'name' => 'Language Allow Change', - 'type' => 'boolean', - 'default' => false, - 'desc' => 'default language (currently only English available)' - ],*/ + 'name' => 'MyAAC', + 'settings' => [ - 'type' => 'category', - 'title' => 'Counters', - ], - [ - 'type' => 'section', - 'title' => 'Visitors Counter & Views Counter' - ], - 'visitors_counter' => [ - 'name' => 'Visitors Counter', - 'type' => 'boolean', - 'desc' => 'Enable Visitors Counter? It will show list of online members on the website in Admin Panel', - 'default' => true, - ], - 'visitors_counter_ttl' => [ - 'name' => 'Visitors Counter TTL', - 'type' => 'number', - 'desc' => 'Time To Live for Visitors Counter. In other words - how long user will be marked as online. In Minutes', - 'default' => 10 - ], - 'views_counter' => [ - 'name' => 'Views Counter', - 'type' => 'boolean', - 'desc' => 'Enable Views Counter? It will show how many times the website has been viewed by users', - 'default' => true, - ], - [ - 'type' => 'category', - 'title' => 'Account', - ], - [ - 'type' => 'section', - 'title' => 'Account Settings' - ], - 'account_management' => [ - 'name' => 'Enable Account Management', - 'type' => 'boolean', - 'desc' => "disable if you're using other method to manage users (fe. tfs account manager)", - 'default' => true, - ], - 'account_login_by_email' => [ - 'name' => 'Account Login By E-Mail', - 'type' => 'boolean', - 'desc' => "use email instead of Account Name like in latest Tibia", - 'default' => true, - ], - 'account_login_by_email_fallback' => [ - 'name' => 'Account Login By E-Mail Fallback', - 'type' => 'boolean', - 'desc' => "allow also additionally login by Account Name/Number (for users that might forget their email). Works only if Account Login By E-Mail is also enabled", - 'default' => false, - ], - 'account_create_auto_login' => [ - 'name' => 'Account Create Auto Login', - 'type' => 'boolean', - 'desc' => 'Auto login after creating account?', - 'default' => false, - ], - 'account_create_character_create' => [ - 'name' => 'Account Create Character Create', - 'type' => 'boolean', - 'desc' => 'Allow to create character directly on create account page?', - 'default' => true, - ], - 'account_mail_verify' => [ - 'name' => 'Account Mail Verify', - 'type' => 'boolean', - 'desc' => 'Force users to confirm their email addresses when registering account', - 'default' => false, - ], - 'account_mail_unique' => [ - 'name' => 'Account Mail Unique', - 'type' => 'boolean', - 'desc' => 'Email addresses cannot be duplicated? (one account = one email)', - 'default' => true, - ], - 'account_premium_days' => [ - 'name' => 'Default Account Premium Days', - 'type' => 'number', - 'desc' => 'Default premium days on new account', - 'default' => 0, - ], - 'account_premium_points' => [ - 'name' => 'Default Account Premium Points', - 'type' => 'number', - 'desc' => 'Default premium points on new account', - 'default' => 0, - ], - 'account_welcome_mail' => [ - 'name' => 'Account Welcome Mail', - 'type' => 'boolean', - 'desc' => 'Send welcome email when user registers', - 'default' => true, - ], - 'account_mail_change' => [ - 'name' => 'Account Mail Change Days', - 'type' => 'number', - 'desc' => 'How many days user need to change email to account - block hackers', - 'default' => 2, - ], - 'account_country' => [ - 'name' => 'Account Country', - 'type' => 'boolean', - 'desc' => 'User will be able to set country of origin when registering account, this information will be viewable in others places as well', - 'default' => true, - ], - 'account_country_recognize' => [ - 'name' => 'Auto Recognize Account Country', - 'type' => 'boolean', - 'desc' => 'should country of user be automatically recognized by his IP? This makes an external API call to http://ipinfo.io', - 'default' => true, - ], - [ - 'type' => 'section', - 'title' => 'Reward Users for confirming their E-Mails. Works only with Account Mail Verify enabled' - ], - 'account_mail_confirmed_reward_premium_days' => [ - 'name' => 'Reward Premium Points', - 'type' => 'number', - 'desc' => '0 to disable', - 'default' => 0, - ], - 'account_mail_confirmed_reward_premium_points' => [ - 'name' => 'Reward Premium Points', - 'type' => 'number', - 'desc' => '0 to disable', - 'default' => 0, - ], - 'account_mail_confirmed_reward_coins' => [ - 'name' => 'Reward Premium Points', - 'type' => 'number', - 'desc' => '0 to disable. Works only with servers that supports coins', - 'default' => 0, - ], - [ - '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', - ], - 'item_images_url' => [ - 'name' => 'Item Images URL', - 'type' => 'text', - 'desc' => 'Set to images/items if you host your own items in images folder', - 'default' => 'http://item-images.ots.me/1092/', - ], - 'item_images_extension' => [ - 'name' => 'Item Images File Extension', - 'type' => 'text', - 'desc' => '', - 'default' => '.gif', - ], - [ - 'type' => 'section', - 'title' => 'Monsters images' - ], - 'creatures_images_url' => [ - 'name' => 'Creatures images URL', - 'type' => 'text', - 'desc' => 'Set to images/monsters if you host your own creatures in images folder', - 'default' => 'images/monsters/', - ], - 'creatures_images_extension' => [ - 'name' => 'Creatures Images File Extension', - 'type' => 'text', - 'desc' => '', - 'default' => '.gif', - ], - 'creatures_images_preview' => [ - 'name' => 'Item Images URL', - 'type' => 'boolean', - 'desc' => 'Set to true to allow picture previews for creatures', - 'default' => false, - ], - 'creatures_items_url' => [ - 'name' => 'Creatures Items URL', - 'type' => 'text', - 'desc' => 'Set to website which shows details about items', - 'default' => 'https://tibia.fandom.com/wiki/', - ], - 'creatures_loot_percentage' => [ - 'name' => 'Creatures Items URL', - 'type' => 'boolean', - 'desc' => 'Set to true to show the loot tooltip percent', - 'default' => true, - ], - [ - 'type' => 'category', - 'title' => 'Guilds', - ], - [ - 'type' => 'section', - 'title' => 'Guilds' - ], - 'guild_management' => [ - 'name' => 'Enable Guilds Management', - 'type' => 'boolean', - 'desc' => 'Enable guild management system on the site', - 'default' => true, - ], - 'guild_need_level' => [ - 'name' => 'Guild Need Level', - 'type' => 'number', - 'desc' => 'Min. level to form a guild', - 'default' => 1, - ], - 'guild_need_premium' => [ - 'name' => 'Guild Need Premium', - 'type' => 'boolean', - 'desc' => 'Require premium account to form a guild?', - 'default' => true, - ], - 'guild_image_size_kb' => [ - 'name' => 'Guild Image Size', - 'type' => 'number', - 'desc' => 'Maximum size of the guild logo image in KB (kilobytes)', - 'default' => 80, - ], - 'guild_description_default' => [ - 'name' => 'Default Guild Description', - 'type' => 'text', - 'desc' => 'Default description set on new guild', - 'default' => 'New guild. Leader must edit this text :)', - ], - 'guild_description_chars_limit' => [ - 'name' => 'Guild Description Characters Limit', - 'type' => 'boolean', - 'desc' => 'How many characters can be in guild description', - 'default' => 1000, - ], - 'guild_description_lines_limit' => [ - 'name' => 'Guild Description Lines Limit', - 'type' => 'number', - 'desc' => "Limit of lines, if description has more lines it will be showed as long text, without 'enters'", - 'default' => 6, - ], - 'guild_motd_chars_limit' => [ - 'name' => 'Guild MOTD Characters Limit', - 'type' => 'boolean', - 'desc' => 'Limit of MOTD (message of the day) that is shown later in the game on the guild channel', - 'default' => 150, - ], - [ - 'type' => 'category', - 'title' => 'Pages', - ], - 'section_10' => [ - 'type' => 'section', - 'title' => 'Online Page' - ], - 'online_record' => [ - 'name' => 'Display Players Record', - 'type' => 'boolean', - 'desc' => '', - 'default' => true, - ], - 'online_vocations' => [ - 'name' => 'Display Vocation Statistics', - 'type' => 'boolean', - 'desc' => '', - 'default' => false, - ], - 'online_vocations_images' => [ - 'name' => 'Display Vocation Images', - 'type' => 'boolean', - 'desc' => 'Only if Display Vocation Statistics enabled', - 'default' => true, - ], - 'online_skulls' => [ - 'name' => 'Display skull images', - 'type' => 'boolean', - 'desc' => '', - 'default' => true, - ], - 'online_outfit' => [ - 'name' => 'Display Player Outfit', - 'type' => 'boolean', - 'desc' => '', - 'default' => true, - ], - 'online_afk' => [ - 'name' => 'Display Players AFK', - 'type' => 'boolean', - 'desc' => '', - 'default' => false, - ], - [ - 'type' => 'section', - 'title' => 'Team Page' - ], - 'team_style' => [ - 'name' => 'Style', - 'type' => 'options', - 'desc' => '', - 'options' => ['normal table', 'in boxes, grouped by group id'], - 'default' => 2, - ], - 'team_display_status' => [ - 'name' => 'Display Online Status', - 'type' => 'boolean', - 'desc' => '', - 'default' => true, - ], - 'team_display_lastlogin' => [ - 'name' => 'Display Last Login', - 'type' => 'boolean', - 'desc' => '', - 'default' => true, - ], - 'team_display_world' => [ - 'name' => 'Display World', - 'type' => 'boolean', - 'desc' => '', - 'default' => false, - ], - 'team_display_outfit' => [ - 'name' => 'Display Outfit', - 'type' => 'boolean', - 'desc' => '', - 'default' => true, - ], - [ - 'type' => 'section', - 'title' => 'Bans Page' - ], - 'bans_per_page' => [ - 'name' => 'Display Players Record', - 'type' => 'boolean', - 'desc' => '', - 'default' => true, + [ + 'type' => 'category', + 'title' => 'General' + ], + [ + 'type' => 'section', + 'title' => 'Template' + ], + 'template' => [ + 'name' => 'Template Name', + 'type' => 'options', + 'options' => '$templates', + 'desc' => 'Name of the template used by website', + 'default' => 'kathrine', + ], + 'template_allow_change' => [ + 'name' => 'Template Allow Change', + 'type' => 'boolean', + 'desc' => 'Allow changing template of the website by showing a special select in the part of website', + 'default' => true, + ], + [ + 'type' => 'section', + 'title' => escapeHtml('') . ' - Header' + ], + 'charset' => [ + 'name' => 'Meta Charset', + 'type' => 'text', + 'desc' => 'Charset used in ' . escapeHtml(''), + 'default' => 'utf-8', + ], + 'meta_description' => [ + 'name' => 'Meta Description', + 'type' => 'textarea', + 'desc' => 'description of the site in ' . escapeHtml(''), + 'default' => 'Tibia is a free massive multiplayer online role playing game (MMORPG).', + ], + 'meta_keywords' => [ + 'name' => 'Meta Keywords', + 'type' => 'textarea', + 'desc' => 'keywords list separated by commas', + 'default' => 'free online game, free multiplayer game, ots, open tibia server', + ], + [ + 'type' => 'section', + 'title' => 'Footer' + ], + 'footer' => [ + 'name' => 'Custom Text', + 'type' => 'textarea', + 'desc' => 'Text displayed in the footer.
For example: ' . escapeHtml('
') . 'Your Server © 2023. All rights reserved.
', + 'default' => '', + ], + // do we really want this? + /* + 'footer_powered_by' => [ + 'name' => 'Display Powered by MyAAC', + 'type' => 'boolean', + 'desc' => 'Do you want to show powered by myaac slogan on the footer?', + 'default' => true, + ], + */ + /*'language' => [ + 'name' => 'Language', + 'type' => 'options', + 'options' => ['en' => 'English'], + 'desc' => 'default language (currently only English available)', + 'default' => 'en', + ],*/ + /*'language_allow_change' => [ + 'name' => 'Language Allow Change', + 'type' => 'boolean', + 'default' => false, + 'desc' => 'default language (currently only English available)' + ],*/ + [ + 'type' => 'section', + 'title' => 'Counters' + ], + 'visitors_counter' => [ + 'name' => 'Visitors Counter', + 'type' => 'boolean', + 'desc' => 'Enable Visitors Counter? It will show list of online members on the website in Admin Panel', + 'default' => true, + ], + 'visitors_counter_ttl' => [ + 'name' => 'Visitors Counter TTL', + 'type' => 'number', + 'desc' => 'Time To Live for Visitors Counter. In other words - how long user will be marked as online. In Minutes', + 'default' => 10 + ], + 'views_counter' => [ + 'name' => 'Views Counter', + 'type' => 'boolean', + 'desc' => 'Enable Views Counter? It will show how many times the website has been viewed by users', + 'default' => true, + ], + [ + 'type' => 'section', + 'title' => 'Misc' + ], + 'vocations_amount' => [ + 'name' => 'Vocations Amount', + 'type' => 'number', + 'desc' => 'How much basic vocations your server got (without promotion)', + 'default' => 4, + ], + 'vocations' => [ + 'name' => 'Vocation Names', + 'type' => 'textarea', + 'desc' => 'Separated by comma ,', + 'default' => 'None, Sorcerer, Druid, Paladin, Knight, Master Sorcerer, Elder Druid,Royal Paladin, Elite Knight', + ], + 'client' => [ + 'name' => 'Client Version', + 'type' => 'options', + 'options' => '$clients', + 'desc' => 'what client version are you using on this OT?
used for the Downloads page and some templates aswell', + 'default' => 710 + ], + 'session_prefix' => [ + 'name' => 'Session Prefix', + 'type' => 'text', + 'desc' => 'must be unique for every site on your server', + 'default' => 'myaac_', + ], + 'friendly_urls' => [ + 'name' => 'Friendly URLs', + 'type' => 'boolean', + 'desc' => 'It makes links looks more elegant to eye, and also are SEO friendly

+ yes: http://example.net/guilds/Testing
+ no: http://example.net/?subtopic=guilds&name=Testing

+ apache2: mod_rewrite is required for this + remember to rename .htaccess.dist to .htaccess
+ nginx: check included nginx-sample.conf', + 'default' => false, + ], + 'backward_support' => [ + 'name' => 'Gesior Backward Support', + 'type' => 'boolean', + 'desc' => 'gesior backward support (templates & pages)
+ allows using gesior templates and pages with myaac
+ might bring some performance when disabled', + 'default' => true, + ], + [ + 'type' => 'category', + 'title' => 'Accounts', + ], + [ + 'type' => 'section', + 'title' => 'Accounts Settings' + ], + 'account_management' => [ + 'name' => 'Enable Account Management', + 'type' => 'boolean', + 'desc' => "disable if you're using other method to manage users (fe. tfs account manager)", + 'default' => true, + ], + 'account_login_by_email' => [ + 'name' => 'Account Login By E-Mail', + 'type' => 'boolean', + 'desc' => "use email instead of Account Name like in latest Tibia", + 'default' => true, + ], + 'account_login_by_email_fallback' => [ + 'name' => 'Account Login By E-Mail Fallback', + 'type' => 'boolean', + 'desc' => "allow also additionally login by Account Name/Number (for users that might forget their email). Works only if Account Login By E-Mail is also enabled", + 'default' => false, + ], + 'account_create_auto_login' => [ + 'name' => 'Account Create Auto Login', + 'type' => 'boolean', + 'desc' => 'Auto login after creating account?', + 'default' => false, + ], + 'account_create_character_create' => [ + 'name' => 'Account Create Character Create', + 'type' => 'boolean', + 'desc' => 'Allow to create character directly on create account page?', + 'default' => true, + ], + 'account_mail_verify' => [ + 'name' => 'Account Mail Verify', + 'type' => 'boolean', + 'desc' => 'Force users to confirm their email addresses when registering account', + 'default' => false, + ], + 'account_mail_unique' => [ + 'name' => 'Account Mail Unique', + 'type' => 'boolean', + 'desc' => 'Email addresses cannot be duplicated? (one account = one email)', + 'default' => true, + ], + 'account_premium_days' => [ + 'name' => 'Default Account Premium Days', + 'type' => 'number', + 'desc' => 'Default premium days on new account', + 'default' => 0, + ], + 'account_premium_points' => [ + 'name' => 'Default Account Premium Points', + 'type' => 'number', + 'desc' => 'Default premium points on new account', + 'default' => 0, + ], + 'account_welcome_mail' => [ + 'name' => 'Account Welcome Mail', + 'type' => 'boolean', + 'desc' => 'Send welcome email when user registers', + 'default' => true, + ], + 'account_mail_change' => [ + 'name' => 'Account Mail Change Days', + 'type' => 'number', + 'desc' => 'How many days user need to change email to account - block hackers', + 'default' => 2, + ], + 'account_country' => [ + 'name' => 'Account Country', + 'type' => 'boolean', + 'desc' => 'User will be able to set country of origin when registering account, this information will be viewable in others places as well', + 'default' => true, + ], + 'account_country_recognize' => [ + 'name' => 'Auto Recognize Account Country', + 'type' => 'boolean', + 'desc' => 'should country of user be automatically recognized by his IP? This makes an external API call to http://ipinfo.io', + 'default' => true, + ], + [ + 'type' => 'section', + 'title' => 'Reward Users for confirming their E-Mails. Works only with Account Mail Verify enabled' + ], + 'account_mail_confirmed_reward_premium_days' => [ + 'name' => 'Reward Premium Points', + 'type' => 'number', + 'desc' => '0 to disable', + 'default' => 0, + ], + 'account_mail_confirmed_reward_premium_points' => [ + 'name' => 'Reward Premium Points', + 'type' => 'number', + 'desc' => '0 to disable', + 'default' => 0, + ], + 'account_mail_confirmed_reward_coins' => [ + 'name' => 'Reward Premium Points', + 'type' => 'number', + 'desc' => '0 to disable. Works only with servers that supports coins', + 'default' => 0, + ], + [ + 'type' => 'category', + 'title' => 'Guilds', + ], + [ + 'type' => 'section', + 'title' => 'Guilds' + ], + 'guild_management' => [ + 'name' => 'Enable Guilds Management', + 'type' => 'boolean', + 'desc' => 'Enable guild management system on the site', + 'default' => true, + ], + 'guild_need_level' => [ + 'name' => 'Guild Need Level', + 'type' => 'number', + 'desc' => 'Min. level to form a guild', + 'default' => 1, + ], + 'guild_need_premium' => [ + 'name' => 'Guild Need Premium', + 'type' => 'boolean', + 'desc' => 'Require premium account to form a guild?', + 'default' => true, + ], + 'guild_image_size_kb' => [ + 'name' => 'Guild Image Size', + 'type' => 'number', + 'desc' => 'Maximum size of the guild logo image in KB (kilobytes)', + 'default' => 80, + ], + 'guild_description_default' => [ + 'name' => 'Default Guild Description', + 'type' => 'text', + 'desc' => 'Default description set on new guild', + 'default' => 'New guild. Leader must edit this text :)', + ], + 'guild_description_chars_limit' => [ + 'name' => 'Guild Description Characters Limit', + 'type' => 'number', + 'desc' => 'How many characters can be in guild description', + 'default' => 1000, + ], + 'guild_description_lines_limit' => [ + 'name' => 'Guild Description Lines Limit', + 'type' => 'number', + 'desc' => "Limit of lines, if description has more lines it will be showed as long text, without 'enters'", + 'default' => 6, + ], + 'guild_motd_chars_limit' => [ + 'name' => 'Guild MOTD Characters Limit', + 'type' => 'number', + 'desc' => 'Limit of MOTD (message of the day) that is shown later in the game on the guild channel', + 'default' => 150, + ], + [ + 'type' => 'category', + 'title' => 'Pages', + ], + [ + 'type' => 'section', + 'title' => 'Online Page' + ], + 'online_record' => [ + 'name' => 'Display Players Record', + 'type' => 'boolean', + 'desc' => '', + 'default' => true, + ], + 'online_vocations' => [ + 'name' => 'Display Vocation Statistics', + 'type' => 'boolean', + 'desc' => '', + 'default' => false, + ], + 'online_vocations_images' => [ + 'name' => 'Display Vocation Images', + 'type' => 'boolean', + 'desc' => 'Only if Display Vocation Statistics enabled', + 'default' => true, + ], + 'online_skulls' => [ + 'name' => 'Display Skull Images', + 'type' => 'boolean', + 'desc' => '', + 'default' => true, + ], + 'online_outfit' => [ + 'name' => 'Display Player Outfit', + 'type' => 'boolean', + 'desc' => '', + 'default' => true, + ], + 'online_afk' => [ + 'name' => 'Display AFK Players', + 'type' => 'boolean', + 'desc' => '', + 'default' => false, + ], + [ + 'type' => 'section', + 'title' => 'Team Page' + ], + 'team_style' => [ + 'name' => 'Style', + 'type' => 'options', + 'desc' => '', + 'options' => ['normal table', 'in boxes, grouped by group id'], + 'default' => 1, + ], + 'team_display_status' => [ + 'name' => 'Display Online Status', + 'type' => 'boolean', + 'desc' => '', + 'default' => true, + ], + 'team_display_lastlogin' => [ + 'name' => 'Display Last Login', + 'type' => 'boolean', + 'desc' => '', + 'default' => true, + ], + 'team_display_world' => [ + 'name' => 'Display World', + 'type' => 'boolean', + 'desc' => '', + 'default' => false, + ], + 'team_display_outfit' => [ + 'name' => 'Display Outfit', + 'type' => 'boolean', + 'desc' => '', + 'default' => true, + ], + [ + 'type' => 'section', + 'title' => 'Bans Page' + ], + 'bans_per_page' => [ + 'name' => 'Display Players Record', + 'type' => 'boolean', + 'desc' => '', + 'default' => true, + ], + [ + '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', + ], + 'item_images_url' => [ + 'name' => 'Item Images URL', + 'type' => 'text', + 'desc' => 'Set to images/items if you host your own items in images folder', + 'default' => 'http://item-images.ots.me/1092/', + ], + 'item_images_extension' => [ + 'name' => 'Item Images File Extension', + 'type' => 'text', + 'desc' => '', + 'default' => '.gif', + ], + [ + 'type' => 'section', + 'title' => 'Monsters Images' + ], + 'monsters_images_url' => [ + 'name' => 'Monsters Images URL', + 'type' => 'text', + 'desc' => 'Set to images/monsters/ if you host your own creatures in images folder', + 'default' => 'images/monsters/', + ], + 'monsters_images_extension' => [ + 'name' => 'Monsters Images File Extension', + 'type' => 'text', + 'desc' => '', + 'default' => '.gif', + ], + 'monsters_images_preview' => [ + 'name' => 'Item Images URL', + 'type' => 'boolean', + 'desc' => 'Set to true to allow picture previews for creatures', + 'default' => false, + ], + 'monsters_items_url' => [ + 'name' => 'Creatures 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', + 'type' => 'boolean', + 'desc' => 'Set to true to show the loot tooltip percent', + 'default' => true, + ], + 'multiworld' => [ + 'hidden' => true, + 'type' => 'boolean', + 'default' => false, + ], ], ]; diff --git a/system/templates/admin.settings.html.twig b/system/templates/admin.settings.html.twig new file mode 100644 index 00000000..4e268ffd --- /dev/null +++ b/system/templates/admin.settings.html.twig @@ -0,0 +1,20 @@ +
+
+
Settings
+
+
+
+
+
+
+
+ +
+
+ {{ settings|raw }} +
+
+
+
+
+
diff --git a/system/templates/creature.html.twig b/system/templates/creature.html.twig index 493a4b06..46e2e508 100644 --- a/system/templates/creature.html.twig +++ b/system/templates/creature.html.twig @@ -155,7 +155,7 @@ {% if (item.count > 1) %} {{ item.count }} {% endif %} - + {% endfor %}