From 98b177185081a6eebc7cc79f95c82064cb3daef5 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Mon, 8 Jul 2024 17:14:45 +0200 Subject: [PATCH] Config/Locales * flag locales as 'required' * allow bitmasks to be empty unless required * skip empty check in javascript --- includes/config.class.php | 2 +- setup/db_structure.sql | 4 ++-- setup/updates/1720451578_01.sql | 1 + template/pages/admin/siteconfig.tpl.php | 6 ------ 4 files changed, 4 insertions(+), 9 deletions(-) create mode 100644 setup/updates/1720451578_01.sql diff --git a/includes/config.class.php b/includes/config.class.php index 52e65d1b..1f4be319 100644 --- a/includes/config.class.php +++ b/includes/config.class.php @@ -342,7 +342,7 @@ class Cfg foreach (explode(', ', $info) as $option) $mask |= (1 << explode(':', $option)[0]); - if (!($value &= $mask)) + if (!($value &= $mask) && ($flags & self::FLAG_REQUIRED)) return 'value not in range'; } diff --git a/setup/db_structure.sql b/setup/db_structure.sql index 5a6dbbfb..1707cc02 100644 --- a/setup/db_structure.sql +++ b/setup/db_structure.sql @@ -3216,7 +3216,7 @@ UNLOCK TABLES; LOCK TABLES `aowow_config` WRITE; /*!40000 ALTER TABLE `aowow_config` DISABLE KEYS */; -INSERT INTO `aowow_config` VALUES ('sql_limit_search','500','500',1,129,'max results for search'),('sql_limit_default','300','300',1,129,'max results for listviews'),('sql_limit_quicksearch','10','10',1,129,'max results for suggestions'),('sql_limit_none','0','0',1,129,'unlimited results (i wouldn\'t change that mate)'),('ttl_rss','60','60',1,129,'time to live for RSS (in seconds)'),('name','Aowow Database Viewer (ADV)',NULL,1,136,'website title'),('name_short','Aowow',NULL,1,136,'feed title'),('board_url','http://www.wowhead.com/forums?board=',NULL,1,136,'another halfbaked javascript thing..'),('contact_email','feedback@aowow.org',NULL,1,136,'displayed sender for auth-mails, ect'),('battlegroup','Pure Pwnage',NULL,1,136,'pretend, we belong to a battlegroup to satisfy profiler-related javascripts'),('debug','0','0',1,145,'disable cache, enable error_reporting - 0:None, 1:Error, 2:Warning, 3:Info'),('maintenance','1','0',1,132,'display brb gnomes and block access for non-staff'),('user_max_votes','50','50',1,129,'vote limit per day'),('force_ssl','0','0',1,132,'enforce SSL, if auto-detect fails'),('locales','349','0x15D',1,1185,'allowed locales - 0:English, 2:French, 3:German, 4:Chinese, 6:Spanish, 8:Russian'),('screenshot_min_size','200','200',1,129,'minimum dimensions of uploaded screenshots in px (yes, it\'s square)'),('site_host','',NULL,1,904,'points js to executable files'),('static_host','',NULL,1,904,'points js to images & scripts'),('cache_decay','25200','60 * 60 * 7',2,129,'time to keep cache in seconds'),('cache_mode','1','1',2,161,'set cache method - 0:filecache, 1:memcached'),('cache_dir','','cache/template',2,136,'generated pages are saved here (requires CACHE_MODE: filecache)'),('acc_failed_auth_block','900','15 * 60',3,129,'how long an account is closed after exceeding FAILED_AUTH_COUNT (in seconds)'),('acc_failed_auth_count','5','5',3,129,'how often invalid passwords are tolerated'),('acc_allow_register','1','1',3,132,'allow/disallow account creation (requires AUTH_MODE: aowow)'),('acc_auth_mode','0','0',3,1425,'source to auth against - 0:AoWoW, 1:TC auth-table, 2:External script (config/extAuth.php)'),('acc_create_save_decay','604800','604800',3,129,'time in wich an unconfirmed account cannot be overwritten by new registrations'),('acc_recovery_decay','300','300',3,129,'time to recover your account and new recovery requests are blocked'),('acc_ext_create_url','',NULL,3,136,'if auth mode is not self; link to external account creation'),('acc_ext_recover_url','',NULL,3,136,'if auth mode is not self; link to external account recovery'),('session_timeout_delay','3600','60 * 60',4,129,'non-permanent session times out in time() + X'),('session.gc_maxlifetime','604800','7 * 24 * 60 * 60',4,200,'lifetime of session data'),('session.gc_probability','1','0',4,200,'probability to remove session data on garbage collection'),('session.gc_divisor','100','100',4,200,'probability to remove session data on garbage collection'),('session_cache_dir','',NULL,4,136,'php sessions are saved here. Leave empty to use php default directory.'),('rep_req_upvote','125','125',5,129,'required reputation to upvote comments'),('rep_req_downvote','250','250',5,129,'required reputation to downvote comments'),('rep_req_comment','75','75',5,129,'required reputation to write a comment'),('rep_req_reply','75','75',5,129,'required reputation to write a reply'),('rep_req_supervote','2500','2500',5,129,'required reputation for double vote effect'),('rep_req_votemore_base','2000','2000',5,129,'gains more votes past this threshold'),('rep_reward_register','100','100',5,129,'activated an account'),('rep_reward_upvoted','5','5',5,129,'comment received upvote'),('rep_reward_downvoted','0','0',5,129,'comment received downvote'),('rep_reward_good_report','10','10',5,129,'filed an accepted report'),('rep_reward_bad_report','0','0',5,129,'filed a rejected report'),('rep_reward_dailyvisit','5','5',5,129,'daily visit'),('rep_reward_user_warned','-50','-50',5,129,'moderator imposed a warning'),('rep_reward_comment','1','1',5,129,'created a comment (not a reply)'),('rep_req_premium','25000','25000',5,129,'required reputation for premium status through reputation'),('rep_reward_upload','10','10',5,129,'suggested / uploaded video / screenshot was approved'),('rep_reward_article','100','100',5,129,'submitted an approved article/guide'),('rep_reward_user_suspended','-200','-200',5,129,'moderator revoked rights'),('rep_req_votemore_add','250','250',5,129,'required reputation per additional vote past threshold'),('serialize_precision','5',NULL,0,65,'some derelict code, probably unused'),('memory_limit','1500M','1500M',0,200,'parsing spell.dbc is quite intense'),('default_charset','UTF-8','UTF-8',0,72,'default: UTF-8'),('analytics_user','',NULL,6,136,'enter your GA-user here to track site stats'),('profiler_enable','0','0',7,1412,'enable/disable profiler feature'),('profiler_queue_delay','3000','3000',7,129,'min. delay between queue cycles (in ms)'),('profiler_resync_ping','5000','5000',7,129,'how often the javascript asks for for updates, when queued (in ms)'),('profiler_resync_delay','3600','1 * 60 * 60',7,129,'how often a character can be refreshed (in sec)'),('rep_req_border_unco','5000','5000',5,129,'required reputation for uncommon quality avatar border'),('rep_req_border_rare','10000','10000',5,129,'required reputation for rare quality avatar border'),('rep_req_border_epic','15000','15000',5,129,'required reputation for epic quality avatar border'),('rep_req_border_lege','25000','25000',5,129,'required reputation for legendary quality avatar border'); +INSERT INTO `aowow_config` VALUES ('sql_limit_search','500','500',1,129,'max results for search'),('sql_limit_default','300','300',1,129,'max results for listviews'),('sql_limit_quicksearch','10','10',1,129,'max results for suggestions'),('sql_limit_none','0','0',1,129,'unlimited results (i wouldn\'t change that mate)'),('ttl_rss','60','60',1,129,'time to live for RSS (in seconds)'),('name','Aowow Database Viewer (ADV)',NULL,1,136,'website title'),('name_short','Aowow',NULL,1,136,'feed title'),('board_url','http://www.wowhead.com/forums?board=',NULL,1,136,'another halfbaked javascript thing..'),('contact_email','feedback@aowow.org',NULL,1,136,'displayed sender for auth-mails, ect'),('battlegroup','Pure Pwnage',NULL,1,136,'pretend, we belong to a battlegroup to satisfy profiler-related javascripts'),('debug','0','0',1,145,'disable cache, enable error_reporting - 0:None, 1:Error, 2:Warning, 3:Info'),('maintenance','1','0',1,132,'display brb gnomes and block access for non-staff'),('user_max_votes','50','50',1,129,'vote limit per day'),('force_ssl','0','0',1,132,'enforce SSL, if auto-detect fails'),('locales','349','0x15D',1,1441,'allowed locales - 0:English, 2:French, 3:German, 4:Chinese, 6:Spanish, 8:Russian'),('screenshot_min_size','200','200',1,129,'minimum dimensions of uploaded screenshots in px (yes, it\'s square)'),('site_host','',NULL,1,904,'points js to executable files'),('static_host','',NULL,1,904,'points js to images & scripts'),('cache_decay','25200','60 * 60 * 7',2,129,'time to keep cache in seconds'),('cache_mode','1','1',2,161,'set cache method - 0:filecache, 1:memcached'),('cache_dir','','cache/template',2,136,'generated pages are saved here (requires CACHE_MODE: filecache)'),('acc_failed_auth_block','900','15 * 60',3,129,'how long an account is closed after exceeding FAILED_AUTH_COUNT (in seconds)'),('acc_failed_auth_count','5','5',3,129,'how often invalid passwords are tolerated'),('acc_allow_register','1','1',3,132,'allow/disallow account creation (requires AUTH_MODE: aowow)'),('acc_auth_mode','0','0',3,1425,'source to auth against - 0:AoWoW, 1:TC auth-table, 2:External script (config/extAuth.php)'),('acc_create_save_decay','604800','604800',3,129,'time in wich an unconfirmed account cannot be overwritten by new registrations'),('acc_recovery_decay','300','300',3,129,'time to recover your account and new recovery requests are blocked'),('acc_ext_create_url','',NULL,3,136,'if auth mode is not self; link to external account creation'),('acc_ext_recover_url','',NULL,3,136,'if auth mode is not self; link to external account recovery'),('session_timeout_delay','3600','60 * 60',4,129,'non-permanent session times out in time() + X'),('session.gc_maxlifetime','604800','7 * 24 * 60 * 60',4,200,'lifetime of session data'),('session.gc_probability','1','0',4,200,'probability to remove session data on garbage collection'),('session.gc_divisor','100','100',4,200,'probability to remove session data on garbage collection'),('session_cache_dir','',NULL,4,136,'php sessions are saved here. Leave empty to use php default directory.'),('rep_req_upvote','125','125',5,129,'required reputation to upvote comments'),('rep_req_downvote','250','250',5,129,'required reputation to downvote comments'),('rep_req_comment','75','75',5,129,'required reputation to write a comment'),('rep_req_reply','75','75',5,129,'required reputation to write a reply'),('rep_req_supervote','2500','2500',5,129,'required reputation for double vote effect'),('rep_req_votemore_base','2000','2000',5,129,'gains more votes past this threshold'),('rep_reward_register','100','100',5,129,'activated an account'),('rep_reward_upvoted','5','5',5,129,'comment received upvote'),('rep_reward_downvoted','0','0',5,129,'comment received downvote'),('rep_reward_good_report','10','10',5,129,'filed an accepted report'),('rep_reward_bad_report','0','0',5,129,'filed a rejected report'),('rep_reward_dailyvisit','5','5',5,129,'daily visit'),('rep_reward_user_warned','-50','-50',5,129,'moderator imposed a warning'),('rep_reward_comment','1','1',5,129,'created a comment (not a reply)'),('rep_req_premium','25000','25000',5,129,'required reputation for premium status through reputation'),('rep_reward_upload','10','10',5,129,'suggested / uploaded video / screenshot was approved'),('rep_reward_article','100','100',5,129,'submitted an approved article/guide'),('rep_reward_user_suspended','-200','-200',5,129,'moderator revoked rights'),('rep_req_votemore_add','250','250',5,129,'required reputation per additional vote past threshold'),('serialize_precision','5',NULL,0,65,'some derelict code, probably unused'),('memory_limit','1500M','1500M',0,200,'parsing spell.dbc is quite intense'),('default_charset','UTF-8','UTF-8',0,72,'default: UTF-8'),('analytics_user','',NULL,6,136,'enter your GA-user here to track site stats'),('profiler_enable','0','0',7,1412,'enable/disable profiler feature'),('profiler_queue_delay','3000','3000',7,129,'min. delay between queue cycles (in ms)'),('profiler_resync_ping','5000','5000',7,129,'how often the javascript asks for for updates, when queued (in ms)'),('profiler_resync_delay','3600','1 * 60 * 60',7,129,'how often a character can be refreshed (in sec)'),('rep_req_border_unco','5000','5000',5,129,'required reputation for uncommon quality avatar border'),('rep_req_border_rare','10000','10000',5,129,'required reputation for rare quality avatar border'),('rep_req_border_epic','15000','15000',5,129,'required reputation for epic quality avatar border'),('rep_req_border_lege','25000','25000',5,129,'required reputation for legendary quality avatar border'); /*!40000 ALTER TABLE `aowow_config` ENABLE KEYS */; UNLOCK TABLES; @@ -3226,7 +3226,7 @@ UNLOCK TABLES; LOCK TABLES `aowow_dbversion` WRITE; /*!40000 ALTER TABLE `aowow_dbversion` DISABLE KEYS */; -INSERT INTO `aowow_dbversion` VALUES (1720448854,0,NULL,NULL); +INSERT INTO `aowow_dbversion` VALUES (1720451579,0,NULL,NULL); /*!40000 ALTER TABLE `aowow_dbversion` ENABLE KEYS */; UNLOCK TABLES; diff --git a/setup/updates/1720451578_01.sql b/setup/updates/1720451578_01.sql new file mode 100644 index 00000000..05728e9c --- /dev/null +++ b/setup/updates/1720451578_01.sql @@ -0,0 +1 @@ +UPDATE `aowow_config` SET `flags` = 1441 WHERE `key` = 'locales'; diff --git a/template/pages/admin/siteconfig.tpl.php b/template/pages/admin/siteconfig.tpl.php index cdfb067d..d5e1f1cd 100644 --- a/template/pages/admin/siteconfig.tpl.php +++ b/template/pages/admin/siteconfig.tpl.php @@ -193,12 +193,6 @@ value = value.toString().trim(); - if (!value.length && (node.tagName != 'INPUT' || node.type != 'text')) - { - $WH.ae(_status, createStatusIcon('value is empty')); - return; - } - $(_status).append(CreateAjaxLoader()); new Ajax('?admin=siteconfig&action=update&key=' + id + '&val=' + escape(value), {