From 33554e8942144f3410873adce194aba63bf8e775 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Mon, 20 Mar 2017 00:58:44 +0100 Subject: [PATCH] User/Contribs * added reputation threshold for replys to config * check canComment and canReply separately * disable contrib-tabs if the user is banned --- includes/user.class.php | 28 +++++- pages/more.php | 2 +- setup/db_structure.sql | 4 +- setup/updates/1489964225_01.sql | 2 + static/js/locale_enus.js | 2 +- template/localized/contrib_0.tpl.php | 115 ++++++++++--------------- template/localized/contrib_2.tpl.php | 119 ++++++++++---------------- template/localized/contrib_3.tpl.php | 123 ++++++++++----------------- template/localized/contrib_6.tpl.php | 117 ++++++++++--------------- template/localized/contrib_8.tpl.php | 115 ++++++++++--------------- 10 files changed, 252 insertions(+), 375 deletions(-) create mode 100644 setup/updates/1489964225_01.sql diff --git a/includes/user.class.php b/includes/user.class.php index 2f627585..48455d4c 100644 --- a/includes/user.class.php +++ b/includes/user.class.php @@ -451,6 +451,14 @@ class User return self::$perms || self::$reputation >= CFG_REP_REQ_COMMENT; } + public static function canReply() + { + if (!self::$id || self::$banStatus & (ACC_BAN_COMMENT | ACC_BAN_PERM | ACC_BAN_TEMP)) + return false; + + return self::$perms || self::$reputation >= CFG_REP_REQ_REPLY; + } + public static function canUpvote() { if (!self::$id || self::$banStatus & (ACC_BAN_COMMENT | ACC_BAN_PERM | ACC_BAN_TEMP)) @@ -475,6 +483,22 @@ class User return self::$reputation >= CFG_REP_REQ_SUPERVOTE; } + public static function canUploadScreenshot() + { + if (!self::$id || self::$banStatus & (ACC_BAN_SCREENSHOT | ACC_BAN_PERM | ACC_BAN_TEMP)) + return false; + + return true; + } + + public static function canSuggestVideo() + { + if (!self::$id || self::$banStatus & (ACC_BAN_VIDEO | ACC_BAN_PERM | ACC_BAN_TEMP)) + return false; + + return true; + } + public static function isPremium() { return self::isInGroup(U_GROUP_PREMIUM) || self::$reputation >= CFG_REP_REQ_PREMIUM; @@ -521,10 +545,10 @@ class User if (!self::$id || self::$banStatus & (ACC_BAN_TEMP | ACC_BAN_PERM)) return $gUser; - $gUser['commentban'] = (bool)(self::$banStatus & ACC_BAN_COMMENT); + $gUser['commentban'] = !self::canComment(); $gUser['canUpvote'] = self::canUpvote(); $gUser['canDownvote'] = self::canDownvote(); - $gUser['canPostReplies'] = self::canComment(); + $gUser['canPostReplies'] = self::canReply(); $gUser['superCommentVotes'] = self::canSupervote(); $gUser['downvoteRep'] = CFG_REP_REQ_DOWNVOTE; $gUser['upvoteRep'] = CFG_REP_REQ_UPVOTE; diff --git a/pages/more.php b/pages/more.php index eaa8c93e..7be133c1 100644 --- a/pages/more.php +++ b/pages/more.php @@ -129,7 +129,7 @@ class MorePage extends GenericPage 9 => CFG_REP_REQ_VOTEMORE_BASE, // more votes per day 10 => CFG_REP_REQ_UPVOTE, // can upvote 11 => CFG_REP_REQ_DOWNVOTE, // can downvote - 12 => CFG_REP_REQ_COMMENT, // can reply [NYI: grouped with canComment] + 12 => CFG_REP_REQ_REPLY, // can reply // 13 => CFG_REP_REQ_XXX, // avatar border [NYI: checked by js, avatars not in use] // 14 => CFG_REP_REQ_XXX, // avatar border [NYI: checked by js, avatars not in use] // 15 => CFG_REP_REQ_XXX, // avatar border [NYI: checked by js, avatars not in use] diff --git a/setup/db_structure.sql b/setup/db_structure.sql index 2d99a035..02bac809 100644 --- a/setup/db_structure.sql +++ b/setup/db_structure.sql @@ -2646,7 +2646,7 @@ UNLOCK TABLES; LOCK TABLES `aowow_config` WRITE; /*!40000 ALTER TABLE `aowow_config` DISABLE KEYS */; -INSERT INTO `aowow_config` VALUES ('sql_limit_search','500',1,129,'default: 500 - max results for search'),('sql_limit_default','300',1,129,'default: 300 - max results for listviews'),('sql_limit_quicksearch','10',1,129,'default: 10 - max results for suggestions'),('sql_limit_none','0',1,129,'default: 0 - unlimited results (i wouldn\'t change that mate)'),('ttl_rss','60',1,129,'default: 60 - time to live for RSS (in seconds)'),('name','Aowow Database Viewer (ADV)',1,136,' - website title'),('name_short','Aowow',1,136,' - feed title'),('board_url','http://www.wowhead.com/forums?board=',1,136,' - another halfbaked javascript thing..'),('contact_email','feedback@aowow.org',1,136,' - displayed sender for auth-mails, ect'),('battlegroup','Pure Pwnage',1,136,' - pretend, we belong to a battlegroup to satisfy profiler-related Jscripts'),('debug','0',1,132,'default: 0 - disable cache, enable sql-errors, enable error_reporting'),('maintenance','1',1,132,'default: 0 - display brb gnomes and block access for non-staff'),('user_max_votes','50',1,129,'default: 50 - vote limit per day'),('force_ssl','0',1,132,'default: 0 - enforce SSL, if the server is behind a load balancer'),('locales','333',1,161,'default: 0x14D - allowed locales - 0:English, 2:French, 3:German, 6:Spanish, 8:Russian'),('screenshot_min_size','200',1,129,'default: 200 - minimum dimensions of uploaded screenshots in px (yes, it\'s square)'),('site_host','',1,136,' - points js to executable files'),('static_host','',1,136,' - points js to images & scripts'),('cache_decay','25200',2,129,'default: 60 * 60 * 7 - time to keep cache in seconds'),('cache_mode','1',2,161,'default: 1 - set cache method - 0:filecache, 1:memcached'),('cache_dir','',2,136,'default: cache/template - generated pages are saved here (requires CACHE_MODE: filecache)'),('acc_failed_auth_block','900',3,129,'default: 15 * 60 - how long an account is closed after exceeding FAILED_AUTH_COUNT (in seconds)'),('acc_failed_auth_count','5',3,129,'default: 5 - how often invalid passwords are tolerated'),('acc_allow_register','1',3,132,'default: 1 - allow/disallow account creation (requires AUTH_MODE: aowow)'),('acc_auth_mode','0',3,145,'default: 0 - source to auth against - 0:aowow, 1:TC auth-table, 2:external script'),('acc_create_save_decay','604800',3,129,'default: 604800 - time in wich an unconfirmed account cannot be overwritten by new registrations'),('acc_recovery_decay','300',3,129,'default: 300 - time to recover your account and new recovery requests are blocked'),('session_timeout_delay','3600',4,129,'default: 60 * 60 - non-permanent session times out in time() + X'),('session.gc_maxlifetime','604800',4,200,'default: 7*24*60*60 - lifetime of session data'),('session.gc_probability','1',4,200,'default: 0 - probability to remove session data on garbage collection'),('session.gc_divisor',100,4,200,'default: 100 - probability to remove session data on garbage collection'),('session_cache_dir','',4,136,'default: - php sessions are saved here. Leave empty to use php default directory.'),('rep_req_upvote','125',5,129,'default: 125 - required reputation to upvote comments'),('rep_req_downvote','250',5,129,'default: 250 - required reputation to downvote comments'),('rep_req_comment','75',5,129,'default: 75 - required reputation to write a comment / reply'),('rep_req_supervote','2500',5,129,'default: 2500 - required reputation for double vote effect'),('rep_req_votemore_base','2000',5,129,'default: 2000 - gains more votes past this threshold'),('rep_reward_register','100',5,129,'default: 100 - activated an account'),('rep_reward_upvoted','5',5,129,'default: 5 - comment received upvote'),('rep_reward_downvoted','0',5,129,'default: 0 - comment received downvote'),('rep_reward_good_report','10',5,129,'default: 10 - filed an accepted report'),('rep_reward_bad_report','0',5,129,'default: 0 - filed a rejected report'),('rep_reward_dailyvisit','5',5,129,'default: 5 - daily visit'),('rep_reward_user_warned','-50',5,129,'default: -50 - moderator imposed a warning'),('rep_reward_comment','1',5,129,'default: 1 - created a comment (not a reply) '),('rep_req_premium','25000',5,129,'default: 25000 - required reputation for premium status through reputation'),('rep_reward_upload','10',5,129,'default: 10 - suggested / uploaded video / screenshot was approved'),('rep_reward_article','100',5,129,'default: 100 - submitted an approved article/guide'),('rep_reward_user_suspended','-200',5,129,'default: -200 - moderator revoked rights'),('rep_req_votemore_add','250',5,129,'default: 250 - required reputation per additional vote past threshold'),('serialize_precision','5',0,65,' - some derelict code, probably unused'),('memory_limit','4096M',0,200,'default: 4096M - parsing spell.dbc is quite intense'),('default_charset','UTF-8',0,72,'default: UTF-8'),('analytics_user','',6,136,'default: - enter your GA-user here to track site stats'); +INSERT INTO `aowow_config` VALUES ('sql_limit_search','500',1,129,'default: 500 - max results for search'),('sql_limit_default','300',1,129,'default: 300 - max results for listviews'),('sql_limit_quicksearch','10',1,129,'default: 10 - max results for suggestions'),('sql_limit_none','0',1,129,'default: 0 - unlimited results (i wouldn\'t change that mate)'),('ttl_rss','60',1,129,'default: 60 - time to live for RSS (in seconds)'),('name','Aowow Database Viewer (ADV)',1,136,' - website title'),('name_short','Aowow',1,136,' - feed title'),('board_url','http://www.wowhead.com/forums?board=',1,136,' - another halfbaked javascript thing..'),('contact_email','feedback@aowow.org',1,136,' - displayed sender for auth-mails, ect'),('battlegroup','Pure Pwnage',1,136,' - pretend, we belong to a battlegroup to satisfy profiler-related Jscripts'),('debug','0',1,132,'default: 0 - disable cache, enable sql-errors, enable error_reporting'),('maintenance','1',1,132,'default: 0 - display brb gnomes and block access for non-staff'),('user_max_votes','50',1,129,'default: 50 - vote limit per day'),('force_ssl','0',1,132,'default: 0 - enforce SSL, if the server is behind a load balancer'),('locales','333',1,161,'default: 0x14D - allowed locales - 0:English, 2:French, 3:German, 6:Spanish, 8:Russian'),('screenshot_min_size','200',1,129,'default: 200 - minimum dimensions of uploaded screenshots in px (yes, it\'s square)'),('site_host','',1,136,' - points js to executable files'),('static_host','',1,136,' - points js to images & scripts'),('cache_decay','25200',2,129,'default: 60 * 60 * 7 - time to keep cache in seconds'),('cache_mode','1',2,161,'default: 1 - set cache method - 0:filecache, 1:memcached'),('cache_dir','',2,136,'default: cache/template - generated pages are saved here (requires CACHE_MODE: filecache)'),('acc_failed_auth_block','900',3,129,'default: 15 * 60 - how long an account is closed after exceeding FAILED_AUTH_COUNT (in seconds)'),('acc_failed_auth_count','5',3,129,'default: 5 - how often invalid passwords are tolerated'),('acc_allow_register','1',3,132,'default: 1 - allow/disallow account creation (requires AUTH_MODE: aowow)'),('acc_auth_mode','0',3,145,'default: 0 - source to auth against - 0:aowow, 1:TC auth-table, 2:external script'),('acc_create_save_decay','604800',3,129,'default: 604800 - time in wich an unconfirmed account cannot be overwritten by new registrations'),('acc_recovery_decay','300',3,129,'default: 300 - time to recover your account and new recovery requests are blocked'),('session_timeout_delay','3600',4,129,'default: 60 * 60 - non-permanent session times out in time() + X'),('session.gc_maxlifetime','604800',4,200,'default: 7*24*60*60 - lifetime of session data'),('session.gc_probability','1',4,200,'default: 0 - probability to remove session data on garbage collection'),('session.gc_divisor',100,4,200,'default: 100 - probability to remove session data on garbage collection'),('session_cache_dir','',4,136,'default: - php sessions are saved here. Leave empty to use php default directory.'),('rep_req_upvote','125',5,129,'default: 125 - required reputation to upvote comments'),('rep_req_downvote','250',5,129,'default: 250 - required reputation to downvote comments'),('rep_req_comment','75',5,129,'default: 75 - required reputation to write a comment'),('rep_req_reply','75',5,129,'default: 75 - required reputation to write a reply'),('rep_req_supervote','2500',5,129,'default: 2500 - required reputation for double vote effect'),('rep_req_votemore_base','2000',5,129,'default: 2000 - gains more votes past this threshold'),('rep_reward_register','100',5,129,'default: 100 - activated an account'),('rep_reward_upvoted','5',5,129,'default: 5 - comment received upvote'),('rep_reward_downvoted','0',5,129,'default: 0 - comment received downvote'),('rep_reward_good_report','10',5,129,'default: 10 - filed an accepted report'),('rep_reward_bad_report','0',5,129,'default: 0 - filed a rejected report'),('rep_reward_dailyvisit','5',5,129,'default: 5 - daily visit'),('rep_reward_user_warned','-50',5,129,'default: -50 - moderator imposed a warning'),('rep_reward_comment','1',5,129,'default: 1 - created a comment (not a reply) '),('rep_req_premium','25000',5,129,'default: 25000 - required reputation for premium status through reputation'),('rep_reward_upload','10',5,129,'default: 10 - suggested / uploaded video / screenshot was approved'),('rep_reward_article','100',5,129,'default: 100 - submitted an approved article/guide'),('rep_reward_user_suspended','-200',5,129,'default: -200 - moderator revoked rights'),('rep_req_votemore_add','250',5,129,'default: 250 - required reputation per additional vote past threshold'),('serialize_precision','5',0,65,' - some derelict code, probably unused'),('memory_limit','4096M',0,200,'default: 4096M - parsing spell.dbc is quite intense'),('default_charset','UTF-8',0,72,'default: UTF-8'),('analytics_user','',6,136,'default: - enter your GA-user here to track site stats'); /*!40000 ALTER TABLE `aowow_config` ENABLE KEYS */; UNLOCK TABLES; @@ -2656,7 +2656,7 @@ UNLOCK TABLES; LOCK TABLES `aowow_dbversion` WRITE; /*!40000 ALTER TABLE `aowow_dbversion` DISABLE KEYS */; -INSERT INTO `aowow_dbversion` VALUES (1489942887,0,NULL,NULL); +INSERT INTO `aowow_dbversion` VALUES (1489964226,0,NULL,NULL); /*!40000 ALTER TABLE `aowow_dbversion` ENABLE KEYS */; UNLOCK TABLES; diff --git a/setup/updates/1489964225_01.sql b/setup/updates/1489964225_01.sql new file mode 100644 index 00000000..e8f897a0 --- /dev/null +++ b/setup/updates/1489964225_01.sql @@ -0,0 +1,2 @@ +UPDATE `aowow_config` SET `comment` = 'default: 75 - required reputation to write a comment' WHERE `key` = 'rep_req_comment'; +REPLACE INTO `aowow_config` (`key`, `value`, `cat`, `flags`, `comment`) VALUES ('rep_req_reply', '75', 5, 129, 'default: 75 - required reputation to write a reply'); diff --git a/static/js/locale_enus.js b/static/js/locale_enus.js index 6f5a1fad..c0b9f2f2 100644 --- a/static/js/locale_enus.js +++ b/static/js/locale_enus.js @@ -984,7 +984,7 @@ var mn_reputation = [ // [14, "Border: Rare", "?privilege=14"], // [15, "Border: Epic", "?privilege=15"], // [16, "Border: Legendary", "?privilege=16"], - [17, "Wowhead Premium", "?privilege=17"] + [17, "AoWoW Premium", "?privilege=17"] ]; var mn_community = [ [3,"Forum","http://forums.battle.net",null,{tinyIcon: g_staticUrl + "/images/icons/forum.png"}], diff --git a/template/localized/contrib_0.tpl.php b/template/localized/contrib_0.tpl.php index 3216d5df..45e05530 100644 --- a/template/localized/contrib_0.tpl.php +++ b/template/localized/contrib_0.tpl.php @@ -1,120 +1,91 @@ - 0): -?> - - - + You are not signed in. Please sign in to submit a video. + + + diff --git a/template/localized/contrib_2.tpl.php b/template/localized/contrib_2.tpl.php index 0bb8593a..632daf71 100644 --- a/template/localized/contrib_2.tpl.php +++ b/template/localized/contrib_2.tpl.php @@ -1,120 +1,91 @@ - 0): -?> - - - + Vous n'êtes pas connecté(e). Veuillez vous connecter pour envoyer une vidéo. + + + diff --git a/template/localized/contrib_3.tpl.php b/template/localized/contrib_3.tpl.php index 93ac0d93..fcff50d8 100644 --- a/template/localized/contrib_3.tpl.php +++ b/template/localized/contrib_3.tpl.php @@ -1,124 +1,91 @@ - 0): -?> - - - +
+ Ihr seid nicht angemeldet. Bitte meldet Euch an, um ein Video vorzuschlagen. + + + diff --git a/template/localized/contrib_6.tpl.php b/template/localized/contrib_6.tpl.php index 9c84a6c9..313bba38 100644 --- a/template/localized/contrib_6.tpl.php +++ b/template/localized/contrib_6.tpl.php @@ -1,120 +1,91 @@ - 0): -?> - diff --git a/template/localized/contrib_8.tpl.php b/template/localized/contrib_8.tpl.php index ebf79bc7..ae9e0ef4 100644 --- a/template/localized/contrib_8.tpl.php +++ b/template/localized/contrib_8.tpl.php @@ -1,120 +1,91 @@ - 0): -?> - - - + Вы не вошли на сайт. Пожалуйста войдите, чтобы отправить видео. + + +