mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 22:33:55 -07:00
Восстановление регистрации торрент-файлов на трекере
This commit is contained in:
parent
ae7f4a37b2
commit
9df0c8d9d3
3 changed files with 35 additions and 56 deletions
|
@ -128,7 +128,7 @@ function tracker_register ($topic_id, $mode = '', $tor_status = TOR_NOT_APPROVED
|
|||
|
||||
$sql = "
|
||||
SELECT
|
||||
t.forum_id, t.post_id, t.poster_id, t.attach_ext_id, t.tracker_status,
|
||||
t.forum_id, t.topic_poster, t.attach_ext_id, t.tracker_status,
|
||||
f.allow_reg_tracker
|
||||
FROM ". BB_TOPICS ." t, ". BB_FORUMS ." f
|
||||
WHERE t.topic_id = ". intval($topic_id) ."
|
||||
|
@ -139,14 +139,12 @@ function tracker_register ($topic_id, $mode = '', $tor_status = TOR_NOT_APPROVED
|
|||
{
|
||||
return torrent_error_exit('Invalid topic_id');
|
||||
}
|
||||
$post_id = $tor['post_id'];
|
||||
$forum_id = $tor['forum_id'];
|
||||
$poster_id = $tor['poster_id'];
|
||||
$poster_id = $tor['topic_poster'];
|
||||
|
||||
|
||||
if ($tor['attach_ext_id'] != 8) return torrent_error_exit($lang['NOT_TORRENT']);
|
||||
if (!$tor['allow_reg_tracker']) return torrent_error_exit($lang['REG_NOT_ALLOWED_IN_THIS_FORUM']);
|
||||
if ($post_id != $tor['topic_first_post_id']) return torrent_error_exit($lang['ALLOWED_ONLY_1ST_POST_REG']);
|
||||
if ($tor['tracker_status']) return torrent_error_exit($lang['ALREADY_REG']);
|
||||
|
||||
if ($reg_mode != 'mcp_tor_register')
|
||||
|
@ -154,7 +152,7 @@ function tracker_register ($topic_id, $mode = '', $tor_status = TOR_NOT_APPROVED
|
|||
torrent_auth_check($forum_id, $poster_id);
|
||||
}
|
||||
|
||||
$filename = get_attach_path($topic_id);
|
||||
$filename = get_attach_path($topic_id, 8);
|
||||
|
||||
if (!file_exists($filename))
|
||||
{
|
||||
|
|
|
@ -75,8 +75,8 @@ else
|
|||
|
||||
if ($tor_reged && !$tor_info)
|
||||
{
|
||||
//DB()->query("UPDATE ". BB_TOPICS ." SET tracker_status = 0 WHERE topic_id = $topic_id LIMIT 1");
|
||||
//bb_die('Torrent status fixed'); //TODO: восстановить
|
||||
DB()->query("UPDATE ". BB_TOPICS ." SET tracker_status = 0 WHERE topic_id = $topic_id LIMIT 1");
|
||||
bb_die('Torrent status fixed'); //TODO: локализация
|
||||
}
|
||||
|
||||
if ($tor_reged)
|
||||
|
@ -513,7 +513,7 @@ if ($bb_cfg['bt_allow_spmode_change'] && $s_mode != 'full')
|
|||
|
||||
$template->assign_vars(array(
|
||||
'SHOW_DL_LIST_LINK' => (($bb_cfg['bt_show_dl_list'] || $bb_cfg['allow_dl_list_names_mode']) && $t_data['tracker_status']),
|
||||
'SHOW_TOR_ACT' => ($tor_reged && $show_peers && (!isset($bb_cfg['tor_no_tor_act'][$tor_info['tor_status']]) || IS_AM)),
|
||||
'SHOW_TOR_ACT' => ($tor_reged && (!isset($bb_cfg['tor_no_tor_act'][$tor_info['tor_status']]) || IS_AM)),
|
||||
'S_MODE_COUNT' => ($s_mode == 'count'),
|
||||
'S_MODE_FULL' => ($s_mode == 'full'),
|
||||
'PEER_EXIST' => ($seeders || $leechers || defined('SEEDER_EXIST') || defined('LEECHER_EXIST')),
|
||||
|
|
77
posting.php
77
posting.php
|
@ -40,8 +40,6 @@ if ($mode == 'smilies')
|
|||
$tracking_topics = get_tracks('topic');
|
||||
$tracking_forums = get_tracks('forum');
|
||||
|
||||
|
||||
|
||||
set_die_append_msg($forum_id, $topic_id);
|
||||
|
||||
// What auth type do we need to check?
|
||||
|
@ -94,8 +92,7 @@ switch ($mode)
|
|||
break;
|
||||
}
|
||||
|
||||
// Here we do various lookups to find topic_id, forum_id, post_id etc.
|
||||
// Doing it here prevents spoofing (eg. faking forum_id, topic_id or post_id
|
||||
// Various lookups to find topic_id, forum_id, post_id etc
|
||||
$error_msg = '';
|
||||
$post_data = array();
|
||||
switch ($mode)
|
||||
|
@ -382,7 +379,6 @@ elseif ( ($submit || $confirm) && !$topic_has_new_posts )
|
|||
$user_id = ( $mode == 'reply' || $mode == 'newtopic' ) ? $userdata['user_id'] : $post_data['poster_id'];
|
||||
update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id);
|
||||
}
|
||||
//$attachment_mod['posting']->insert_attachment($post_id);
|
||||
|
||||
if (!$error_msg)
|
||||
{
|
||||
|
@ -399,7 +395,8 @@ elseif ( ($submit || $confirm) && !$topic_has_new_posts )
|
|||
|
||||
if ($can_attach_file && !empty($_FILES['attach']['name']))
|
||||
{
|
||||
$upload = new Upload();
|
||||
require(INC_DIR .'functions_upload.php');
|
||||
$upload = new upload_common();
|
||||
|
||||
if ($upload->init($bb_cfg['attach'], $_FILES['attach']) AND $upload->store('attach', array('topic_id' => $topic_id)))
|
||||
{
|
||||
|
@ -413,12 +410,36 @@ elseif ( ($submit || $confirm) && !$topic_has_new_posts )
|
|||
if ($upload->file_ext_id == 8)
|
||||
{
|
||||
require_once(INC_DIR .'functions_torrent.php');
|
||||
tracker_register($topic_id, 'newtopic', TOR_NOT_APPROVED); # --> exit
|
||||
if ($bb_cfg['premod'])
|
||||
{
|
||||
// Получение списка id форумов начиная с parent
|
||||
$forum_parent = $forum_id;
|
||||
if ($post_info['forum_parent']) $forum_parent = $post_info['forum_parent'];
|
||||
$count_rowset = DB()->fetch_rowset("SELECT forum_id FROM ". BB_FORUMS ." WHERE forum_parent = $forum_parent");
|
||||
$sub_forums = array();
|
||||
foreach ($count_rowset as $count_row)
|
||||
{
|
||||
if ($count_row['forum_id'] != $forum_id) $sub_forums[] = $count_row['forum_id'];
|
||||
}
|
||||
$sub_forums[] = $forum_id;
|
||||
$sub_forums = join(',', $sub_forums);
|
||||
// Подсчет проверенных релизов в форумах раздела
|
||||
$count_checked_releases = DB()->fetch_row("SELECT COUNT(*) AS checked_releases FROM ". BB_BT_TORRENTS ." WHERE poster_id = ". $userdata['user_id'] ." AND forum_id IN($sub_forums) AND tor_status IN(". TOR_APPROVED .",". TOR_DOUBTFUL .",". TOR_TMP .") LIMIT 1", 'checked_releases');
|
||||
if ($count_checked_releases || IS_AM)
|
||||
{
|
||||
tracker_register($topic_id, 'newtopic', TOR_NOT_APPROVED);
|
||||
}
|
||||
else
|
||||
{
|
||||
tracker_register($topic_id, 'newtopic', TOR_PREMOD);
|
||||
}
|
||||
}
|
||||
else tracker_register($topic_id, 'newtopic', TOR_NOT_APPROVED);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$return_to_edit_link = '<a href="'. POSTING_URL .'?mode=editpost&p='. $post_id .'">Вернуться к редактированию сообщения</a>';
|
||||
$return_to_edit_link = '<a href="'. POSTING_URL .'?mode=editpost&p='. $post_id .'">Вернуться к редактированию сообщения</a>'; //TODO: локализация
|
||||
$return_message = '
|
||||
<span class="warnColor1">'. join('<br />', $upload->errors) ."</span>
|
||||
<br /><br />
|
||||
|
@ -429,46 +450,6 @@ elseif ( ($submit || $confirm) && !$topic_has_new_posts )
|
|||
}
|
||||
}
|
||||
|
||||
/*if (defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg)
|
||||
{
|
||||
include(INC_DIR .'functions_torrent.php');
|
||||
if (!DB()->fetch_row("SELECT attach_id FROM ". BB_BT_TORRENTS ." WHERE attach_id = ". TORRENT_ATTACH_ID))
|
||||
{
|
||||
if ($bb_cfg['premod'])
|
||||
{
|
||||
// Получение списка id форумов начиная с parent
|
||||
$forum_parent = $forum_id;
|
||||
if ($post_info['forum_parent']) $forum_parent = $post_info['forum_parent'];
|
||||
$count_rowset = DB()->fetch_rowset("SELECT forum_id FROM ". BB_FORUMS ." WHERE forum_parent = $forum_parent");
|
||||
$sub_forums = array();
|
||||
foreach ($count_rowset as $count_row)
|
||||
{
|
||||
if ($count_row['forum_id'] != $forum_id) $sub_forums[] = $count_row['forum_id'];
|
||||
}
|
||||
$sub_forums[] = $forum_id;
|
||||
$sub_forums = join(',', $sub_forums);
|
||||
// Подсчет проверенных релизов в форумах раздела
|
||||
$count_checked_releases = DB()->fetch_row("
|
||||
SELECT COUNT(*) AS checked_releases
|
||||
FROM ". BB_BT_TORRENTS ."
|
||||
WHERE poster_id = ". $userdata['user_id'] ."
|
||||
AND forum_id IN($sub_forums)
|
||||
AND tor_status IN(". TOR_APPROVED .",". TOR_DOUBTFUL .",". TOR_TMP .")
|
||||
LIMIT 1
|
||||
", 'checked_releases');
|
||||
if ($count_checked_releases || IS_AM)
|
||||
{
|
||||
tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_NOT_APPROVED);
|
||||
}
|
||||
else
|
||||
{
|
||||
tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_PREMOD);
|
||||
}
|
||||
}
|
||||
else tracker_register(TORRENT_ATTACH_ID, 'newtopic', TOR_NOT_APPROVED);
|
||||
}
|
||||
}*/
|
||||
|
||||
// Update atom feed
|
||||
update_atom('topic', $topic_id);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue