fear(vote topic): Improved functionality & implemented caching

This commit is contained in:
Roman Kelesidis 2025-07-29 18:29:58 +03:00
commit 506c428fde
No known key found for this signature in database
GPG key ID: D8157C4D4C4C6DB4
2 changed files with 8 additions and 5 deletions

View file

@ -48,10 +48,13 @@ switch ($mode) {
DB()->query('INSERT IGNORE INTO ' . BB_THX . " ($columns) VALUES ($values)"); DB()->query('INSERT IGNORE INTO ' . BB_THX . " ($columns) VALUES ($values)");
// Limit voters per topic // Limit voters per topic
$tor_thank_limit_per_topic = (int)$bb_cfg['tor_thank_limit_per_topic'];
if ($tor_thank_limit_per_topic > 0) {
$thanks_count = DB()->fetch_row('SELECT COUNT(*) as thx FROM ' . BB_THX . " WHERE topic_id = $topic_id")['thx']; $thanks_count = DB()->fetch_row('SELECT COUNT(*) as thx FROM ' . BB_THX . " WHERE topic_id = $topic_id")['thx'];
if ($thanks_count > (int)$bb_cfg['tor_thank_limit_per_topic']) { if ($thanks_count > $tor_thank_limit_per_topic) {
DB()->query('DELETE FROM ' . BB_THX . " WHERE topic_id = $topic_id ORDER BY time ASC LIMIT 1"); DB()->query('DELETE FROM ' . BB_THX . " WHERE topic_id = $topic_id ORDER BY time ASC LIMIT 1");
} }
}
break; break;
case 'get': case 'get':
if (IS_GUEST && !$bb_cfg['tor_thanks_list_guests']) { if (IS_GUEST && !$bb_cfg['tor_thanks_list_guests']) {

View file

@ -569,7 +569,7 @@ $bb_cfg['limit_max_search_results'] = false; // Limit for number of search resul
// Posting // Posting
$bb_cfg['prevent_multiposting'] = true; // TODO: replace "reply" with "edit last msg" if user (not admin or mod) is last topic poster $bb_cfg['prevent_multiposting'] = true; // TODO: replace "reply" with "edit last msg" if user (not admin or mod) is last topic poster
$bb_cfg['max_smilies'] = 25; //Max number of smilies in a post (0 - unlimited) $bb_cfg['max_smilies'] = 25; // Max number of smilies in a post (0 - unlimited)
$bb_cfg['max_symbols_post'] = 5000; // TODO: Max number of symbols in a post (0 - unlimited) $bb_cfg['max_symbols_post'] = 5000; // TODO: Max number of symbols in a post (0 - unlimited)
// PM // PM
@ -593,7 +593,7 @@ $bb_cfg['user_not_active_days_keep'] = 180; // After how many days should I dele
// Vote for torrents // Vote for torrents
$bb_cfg['tor_thank'] = true; $bb_cfg['tor_thank'] = true;
$bb_cfg['tor_thanks_list_guests'] = true; // Show voters to guests $bb_cfg['tor_thanks_list_guests'] = true; // Show voters to guests
$bb_cfg['tor_thank_limit_per_topic'] = 50; $bb_cfg['tor_thank_limit_per_topic'] = 50; // Set "0" to disable limit
// Groups // Groups
$bb_cfg['group_members_per_page'] = 50; // How many groups will be displayed in a page $bb_cfg['group_members_per_page'] = 50; // How many groups will be displayed in a page