Merge pull request #41 from warezzz/master

Исправления в поддержке Ocelot.
This commit is contained in:
Exile 2015-01-22 01:28:49 +03:00
commit 0e23f4702e
2 changed files with 29 additions and 17 deletions

View file

@ -93,21 +93,25 @@ if ($tr_cfg['update_dlstat'])
");
// Update TOTAL user's dlstat
DB()->query("
UPDATE
". BB_BT_USERS ." u,
". NEW_BB_BT_LAST_USERSTAT ." ub
SET
u.u_up_total = u.u_up_total + ub.up_add,
u.u_down_total = u.u_down_total + ub.down_add,
u.u_up_release = u.u_up_release + ub.release_add,
u.u_up_bonus = u.u_up_bonus + ub.bonus_add,
u.up_today = u.up_today + ub.up_add,
u.down_today = u.down_today + ub.down_add,
u.up_release_today = u.up_release_today + ub.release_add,
u.up_bonus_today = u.up_bonus_today + ub.bonus_add
WHERE u.user_id = ub.user_id
");
// This is not needed if Ocelot enabled. It's important.
if (!$bb_cfg['ocelot']['enabled'])
{
DB()->query("
UPDATE
". BB_BT_USERS ." u,
". NEW_BB_BT_LAST_USERSTAT ." ub
SET
u.u_up_total = u.u_up_total + ub.up_add,
u.u_down_total = u.u_down_total + ub.down_add,
u.u_up_release = u.u_up_release + ub.release_add,
u.u_up_bonus = u.u_up_bonus + ub.bonus_add,
u.up_today = u.up_today + ub.up_add,
u.down_today = u.down_today + ub.down_add,
u.up_release_today = u.up_release_today + ub.release_add,
u.up_bonus_today = u.up_bonus_today + ub.bonus_add
WHERE u.user_id = ub.user_id
");
}
// Delete from dl_list what exists in BUF but not exsits in NEW
DB()->query("

View file

@ -2341,10 +2341,18 @@ function pad_with_space ($str)
function create_magnet ($infohash, $auth_key, $logged_in)
{
global $bb_cfg, $_GET, $userdata, $images;
global $bb_cfg, $_GET, $images;
$passkey_url = ((!$logged_in || isset($_GET['no_passkey'])) && $bb_cfg['bt_tor_browse_only_reg']) ? '' : "?{$bb_cfg['passkey_key']}=$auth_key";
return '<a href="magnet:?xt=urn:btih:'. bin2hex($infohash) .'&tr='. urlencode($bb_cfg['bt_announce_url'] . $passkey_url) .'"><img src="'. $images['icon_magnet'] .'" width="12" height="12" border="0" /></a>';
if ($bb_cfg['ocelot']['enabled'])
{
return '<a href="magnet:?xt=urn:btih:'. bin2hex($infohash) .'&tr='. urlencode($bb_cfg['ocelot']['url'] .$auth_key. "/announce") .'"><img src="'. $images['icon_magnet'] .'" width="12" height="12" border="0" /></a>';
}
else
{
return '<a href="magnet:?xt=urn:btih:'. bin2hex($infohash) .'&tr='. urlencode($bb_cfg['bt_announce_url'] . $passkey_url) .'"><img src="'. $images['icon_magnet'] .'" width="12" height="12" border="0" /></a>';
}
}
function set_die_append_msg ($forum_id = null, $topic_id = null, $group_id = null)