mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 21:33:54 -07:00
r390
сид бонусы (продолжение) sql - ALTER TABLE `bb_users` CHANGE `user_points` `user_points` FLOAT( 16, 2 ) NOT NULL DEFAULT '0.00' git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@390 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
parent
e1d119607b
commit
3b7f9034b4
5 changed files with 53 additions and 8 deletions
|
@ -1418,7 +1418,7 @@ CREATE TABLE IF NOT EXISTS `bb_users` (
|
||||||
`ignore_srv_load` tinyint(1) NOT NULL DEFAULT '0',
|
`ignore_srv_load` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
`autologin_id` varchar(12) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
`autologin_id` varchar(12) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||||
`user_newest_pm_id` mediumint(8) NOT NULL DEFAULT '0',
|
`user_newest_pm_id` mediumint(8) NOT NULL DEFAULT '0',
|
||||||
`user_points` int(11) NOT NULL DEFAULT '0',
|
`user_points` float(16,2) NOT NULL DEFAULT '0.00',
|
||||||
PRIMARY KEY (`user_id`),
|
PRIMARY KEY (`user_id`),
|
||||||
KEY `username` (`username`(10)),
|
KEY `username` (`username`(10)),
|
||||||
KEY `user_email` (`user_email`(10)),
|
KEY `user_email` (`user_email`(10)),
|
||||||
|
|
|
@ -52,8 +52,8 @@ $bb_cfg = $tr_cfg = $page_cfg = array();
|
||||||
|
|
||||||
// Increase number of revision after update
|
// Increase number of revision after update
|
||||||
$bb_cfg['tp_version'] = '2.4 (beta)';
|
$bb_cfg['tp_version'] = '2.4 (beta)';
|
||||||
$bb_cfg['tp_release_state'] = 'R389';
|
$bb_cfg['tp_release_state'] = 'R390';
|
||||||
$bb_cfg['tp_release_date'] = '2-04-2012';
|
$bb_cfg['tp_release_date'] = '9-04-2012';
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
$charset = 'utf8';
|
$charset = 'utf8';
|
||||||
|
@ -397,7 +397,6 @@ define('CRON_RUNNING', TRIGGERS_DIR .'cron_running');
|
||||||
|
|
||||||
// Subforums
|
// Subforums
|
||||||
$bb_cfg['sf_on_first_page_only'] = true;
|
$bb_cfg['sf_on_first_page_only'] = true;
|
||||||
$bb_cfg['sf_check_view_permissions'] = false;
|
|
||||||
|
|
||||||
// Forums
|
// Forums
|
||||||
$bb_cfg['allowed_topics_per_page'] = array(50, 100, 150, 200, 250, 300);
|
$bb_cfg['allowed_topics_per_page'] = array(50, 100, 150, 200, 250, 300);
|
||||||
|
|
|
@ -183,3 +183,46 @@ if($bb_cfg['announce_type'] != 'xbt')
|
||||||
|
|
||||||
DB()->expect_slow_query(10);
|
DB()->expect_slow_query(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['seed_bonus_release'])
|
||||||
|
{
|
||||||
|
DB()->query("
|
||||||
|
CREATE TEMPORARY TABLE tmp_bonus (
|
||||||
|
user_id INT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
release_count INT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (user_id)
|
||||||
|
) ENGINE = MEMORY
|
||||||
|
");
|
||||||
|
|
||||||
|
$tor_size = ($bb_cfg['seed_bonus_tor_size'] * 1073741824);
|
||||||
|
|
||||||
|
DB()->query("INSERT INTO tmp_bonus
|
||||||
|
SELECT bt.user_id, count(bt.seeder) AS release_count
|
||||||
|
FROM ". BB_BT_TRACKER ." bt, ". BB_BT_TORRENTS ." tor
|
||||||
|
WHERE tor.topic_id = bt.topic_id
|
||||||
|
AND tor.size > $tor_size
|
||||||
|
GROUP BY user_id
|
||||||
|
");
|
||||||
|
|
||||||
|
$seed_bonus = unserialize($bb_cfg['seed_bonus_points']);
|
||||||
|
$seed_release = unserialize($bb_cfg['seed_bonus_release']);
|
||||||
|
|
||||||
|
foreach($seed_bonus as $i => $points)
|
||||||
|
{
|
||||||
|
if(!$points || !$seed_release[$i]) continue;
|
||||||
|
|
||||||
|
$user_points = ($points / 4);
|
||||||
|
$release = $seed_release[$i];
|
||||||
|
$user_regdate = (TIMENOW - $bb_cfg['seed_bonus_user_regdate'] * 86400);
|
||||||
|
|
||||||
|
DB()->query("
|
||||||
|
UPDATE ". BB_USERS ." u, tmp_bonus b
|
||||||
|
SET u.user_points = u.user_points + $user_points
|
||||||
|
WHERE u.user_id = b.user_id
|
||||||
|
AND b.release_count <= $release
|
||||||
|
AND u.user_regdate < $user_regdate
|
||||||
|
");
|
||||||
|
}
|
||||||
|
|
||||||
|
DB()->query("DROP TEMPORARY TABLE IF EXISTS tmp_bonus");
|
||||||
|
}
|
||||||
|
|
|
@ -31,8 +31,11 @@ else
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auth
|
// Auth
|
||||||
$not_auth_forums_sql = ($f = $user->get_not_auth_forums(AUTH_READ)) ? "AND f.forum_id NOT IN($f)" : '';
|
$excluded_forums_csv = $user->get_excluded_forums(AUTH_VIEW);
|
||||||
$datastore->rm('cat_forums');
|
$not_auth_forums_sql = ($excluded_forums_csv) ? "
|
||||||
|
AND f.forum_id NOT IN($excluded_forums_csv)
|
||||||
|
AND f.forum_parent NOT IN($excluded_forums_csv)
|
||||||
|
" : '';
|
||||||
|
|
||||||
// Get users active torrents
|
// Get users active torrents
|
||||||
$sql = 'SELECT f.forum_id, f.forum_name, t.topic_title, tor.tor_type, tor.size, tr.*
|
$sql = 'SELECT f.forum_id, f.forum_name, t.topic_title, tor.tor_type, tor.size, tr.*
|
||||||
|
|
|
@ -137,7 +137,7 @@ if($forums['forum'][$forum_id]['allow_porno_topic'] && bf($userdata['user_opt'],
|
||||||
|
|
||||||
if (!$forum_data['forum_parent'] && isset($forums['f'][$forum_id]['subforums']) && $show_subforums)
|
if (!$forum_data['forum_parent'] && isset($forums['f'][$forum_id]['subforums']) && $show_subforums)
|
||||||
{
|
{
|
||||||
$not_auth_forums = ($bb_cfg['sf_check_view_permissions']) ? $user->get_not_auth_forums(AUTH_VIEW) : '';
|
$not_auth_forums = $user->get_excluded_forums(AUTH_VIEW);
|
||||||
$ignore_forum_sql = ($not_auth_forums) ? "AND f.forum_id NOT IN($not_auth_forums)" : '';
|
$ignore_forum_sql = ($not_auth_forums) ? "AND f.forum_id NOT IN($not_auth_forums)" : '';
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue