From ed7daf948269cd94ad6f596c773152de54c13033 Mon Sep 17 00:00:00 2001 From: slawkens Date: Thu, 20 Jul 2023 20:52:08 +0200 Subject: [PATCH] Move signature config to settings --- config.php | 11 -------- system/compat/config.php | 4 +++ system/pages/characters.php | 3 +- system/settings.php | 40 +++++++++++++++++++++++++++ system/templates/characters.html.twig | 2 +- tools/signature/index.php | 14 ++++++---- 6 files changed, 54 insertions(+), 20 deletions(-) diff --git a/config.php b/config.php index 414234e9..0aed76a2 100644 --- a/config.php +++ b/config.php @@ -47,13 +47,6 @@ $config = array( 'database_socket' => '', // set if you want to connect to database through socket (example: /var/run/mysqld/mysqld.sock) 'database_persistent' => false, // use database permanent connection (like server), may speed up your site - // multiworld system (only TFS 0.3) - 'multiworld' => false, // use multiworld system? - 'worlds' => array( // list of worlds - //'1' => 'Your World Name', - //'2' => 'Your Second World Name' - ), - 'account_mail_block_plus_sign' => true, // block email with '+' signs like test+box@gmail.com (help protect against spamming accounts) 'account_change_character_name' => false, // can user change their character name for premium points? 'account_change_character_name_points' => 30, // cost of name change @@ -119,10 +112,6 @@ $config = array( //'Some Quest' => 123, //'Some Quest Two' => 456, ), // quests list (displayed in character view), name => storage - 'signature_enabled' => true, - 'signature_type' => 'tibian', // signature engine to use: tibian, mango, gesior - 'signature_cache_time' => 5, // how long to store cached file (in minutes), default 5 minutes - 'signature_browser_cache' => 60, // how long to cache by browser (in minutes), default 1 hour // news page 'news_limit' => 5, // limit of news on the latest news page diff --git a/system/compat/config.php b/system/compat/config.php index 42f4e49c..fe7a2be9 100644 --- a/system/compat/config.php +++ b/system/compat/config.php @@ -37,6 +37,10 @@ $deprecatedConfig = [ 'team_display_lastlogin' => 'team_lastlogin', 'multiworld', 'forum', + 'signature_enabled', + 'signature_type', + 'signature_cache_time', + 'signature_browser_cache', ]; foreach ($deprecatedConfig as $key => $value) { diff --git a/system/pages/characters.php b/system/pages/characters.php index 2e7f84ec..62cb2759 100644 --- a/system/pages/characters.php +++ b/system/pages/characters.php @@ -340,8 +340,7 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil } // signature - $settings = Settings::getInstance(); - if($config['signature_enabled']) { + if(setting('core.signature_enabled')) { $signature_url = BASE_URL . (setting('core.friendly_urls') ? '' : 'index.php/') . urlencode($player->getName()) . '.png'; } diff --git a/system/settings.php b/system/settings.php index 67bc8532..fdacb017 100644 --- a/system/settings.php +++ b/system/settings.php @@ -804,6 +804,46 @@ Sent by MyAAC,
'type' => 'category', 'title' => 'Images', ], + [ + 'type' => 'section', + 'title' => 'Signatures' + ], + 'signature_enabled' => [ + 'name' => 'Enable Signatures', + 'type' => 'boolean', + 'desc' => 'Signature is a small picture with character info and server to paste on forums etc. It can be viewed on characters page, when enabled.', + 'default' => true, + ], + 'signature_type' => [ + 'name' => 'Signature Type', + 'type' => 'options', + 'options' => ['tibian' => 'tibian', 'mango' => 'mango', 'gesior' => 'gesior'], + 'desc' => 'Signature engine to use', + 'default' => 'tibian', + 'show_if' => [ + 'signature_enabled', '=', 'true' + ], + ], + 'signature_cache_time' => [ + 'name' => 'Signature Cache Time', + 'type' => 'number', + 'min' => 1, + 'desc' => 'How long to store cached file (in minutes)', + 'default' => 5, + 'show_if' => [ + 'signature_enabled', '=', 'true', + ], + ], + 'signature_browser_cache' => [ + 'name' => 'Signature Browser Cache Time', + 'type' => 'number', + 'min' => 1, + 'desc' => 'How long to cache by browser (in minutes)', + 'default' => 60, + 'show_if' => [ + 'signature_enabled', '=', 'true', + ], + ], [ 'type' => 'section', 'title' => 'Item Images' diff --git a/system/templates/characters.html.twig b/system/templates/characters.html.twig index 4234f2ab..9553d20c 100644 --- a/system/templates/characters.html.twig +++ b/system/templates/characters.html.twig @@ -284,7 +284,7 @@ {{ hook(constant('HOOK_CHARACTERS_BEFORE_SIGNATURE')) }} - {% if config.signature_enabled %} + {% if setting('core.signature_enabled') %}