mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 22:33:55 -07:00
Продолжение исправлений ошибок после интеграции новой системы вложений. Небольшая чистка таблиц.
This commit is contained in:
parent
242ff4fc4b
commit
7518f87997
10 changed files with 53 additions and 71 deletions
|
@ -46,7 +46,7 @@ $user_list = DB()->fetch_rowset("
|
|||
");
|
||||
|
||||
$subject = sprintf($lang['CALLSEED_SUBJECT'], $t_data['topic_title']);
|
||||
$message = sprintf($lang['CALLSEED_TEXT'], make_url(TOPIC_URL . $topic_id), $t_data['topic_title'], make_url(DOWNLOAD_URL . $t_data['attach_id']));
|
||||
$message = sprintf($lang['CALLSEED_TEXT'], make_url(TOPIC_URL . $topic_id), $t_data['topic_title'], make_url(DOWNLOAD_URL . $topic_id));
|
||||
|
||||
if ($user_list)
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ function topic_info ($topic_id)
|
|||
|
||||
$sql = "
|
||||
SELECT
|
||||
tor.poster_id, tor.forum_id, tor.attach_id, tor.call_seed_time,
|
||||
tor.poster_id, tor.forum_id, tor.call_seed_time,
|
||||
t.topic_title, sn.seeders
|
||||
FROM ". BB_BT_TORRENTS ." tor
|
||||
LEFT JOIN ". BB_TOPICS ." t USING(topic_id)
|
||||
|
|
34
dl.php
34
dl.php
|
@ -33,18 +33,17 @@ if (!$t_data['attach_ext_id'])
|
|||
|
||||
// Auth check
|
||||
$is_auth = auth(AUTH_ALL, $t_data['forum_id'], $userdata, $t_data);
|
||||
$guest_allow = false;
|
||||
if (!IS_GUEST) $guest_allow = true;
|
||||
if (IS_GUEST && $bb_cfg['guest_tracker']) $guest_allow = true;
|
||||
if ($t_data['attach_ext_id'] != 8 && !$is_auth['auth_download']) login_redirect($bb_cfg['dl_url'] . $topic_id);
|
||||
if ($t_data['attach_ext_id'] == 8 && (!$is_auth['auth_download'] || !$guest_allow)) login_redirect($bb_cfg['dl_url'] . $topic_id);
|
||||
if (!IS_GUEST)
|
||||
{
|
||||
if (!$is_auth['auth_download']) login_redirect($bb_cfg['dl_url'] . $topic_id);
|
||||
}
|
||||
elseif (!$bb_cfg['tracker']['guest_tracker'])
|
||||
{
|
||||
login_redirect($bb_cfg['dl_url'] . $topic_id);
|
||||
}
|
||||
|
||||
|
||||
// Проверка рефёрера (не качать с других сайтов)
|
||||
$referer = (!empty($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : '';
|
||||
if (!preg_match("/". $bb_cfg['server_name']."/", $referer)) exit;
|
||||
|
||||
DB()->sql_query('UPDATE ' . BB_TOPICS . ' SET download_count = download_count + 1 WHERE topic_id = ' . (int) $t_data['topic_id']);
|
||||
// Downloads counter
|
||||
DB()->sql_query('UPDATE ' . BB_TOPICS . ' SET attach_dl_cnt = attach_dl_cnt + 1 WHERE topic_id = ' . $topic_id);
|
||||
|
||||
// Captcha for guest
|
||||
if (IS_GUEST && !bb_captcha('check'))
|
||||
|
@ -52,9 +51,9 @@ if (IS_GUEST && !bb_captcha('check'))
|
|||
global $template;
|
||||
|
||||
$redirect_url = isset($_POST['redirect_url']) ? $_POST['redirect_url'] : (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/');
|
||||
$message = '<form action="'. DOWNLOAD_URL . $attachment['attach_id'] .'" method="post">';
|
||||
$message = '<form action="'. DOWNLOAD_URL . $topic_id .'" method="post">'; //!
|
||||
$message .= $lang['CAPTCHA'].':';
|
||||
$message .= '<div class="mrg_10" align="center">'. bb_captcha('get') .'</div>';
|
||||
$message .= '<div class="mrg_10" align="center">'. bb_captcha('get') .'</div>';
|
||||
$message .= '<input type="hidden" name="redirect_url" value="'. $redirect_url .'" />';
|
||||
$message .= '<input type="submit" class="bold" value="'. $lang['SUBMIT'] .'" /> ';
|
||||
$message .= '<input type="button" class="bold" value="'. $lang['GO_BACK'] .'" onclick="document.location.href = \''. $redirect_url .'\';" />';
|
||||
|
@ -71,16 +70,11 @@ if (IS_GUEST && !bb_captcha('check'))
|
|||
$t_data['user_id'] = $userdata['user_id'];
|
||||
$t_data['is_am'] = IS_AM;
|
||||
|
||||
//die(var_dump($t_data));
|
||||
|
||||
// Torrent
|
||||
if ($t_data['attach_ext_id'] == 8)
|
||||
{
|
||||
if (!(isset($_GET['original']) && !IS_USER))
|
||||
{
|
||||
require(INC_DIR .'functions_torrent.php');
|
||||
send_torrent_with_passkey($t_data);
|
||||
}
|
||||
require(INC_DIR .'functions_torrent.php');
|
||||
send_torrent_with_passkey($t_data);
|
||||
}
|
||||
|
||||
// All other
|
||||
|
|
|
@ -181,24 +181,6 @@ CREATE TABLE IF NOT EXISTS `bb_bt_torstat` (
|
|||
-- Records of bb_bt_torstat
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for `bb_bt_tor_dl_stat`
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `bb_bt_tor_dl_stat`;
|
||||
CREATE TABLE IF NOT EXISTS `bb_bt_tor_dl_stat` (
|
||||
`topic_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
|
||||
`user_id` mediumint(9) NOT NULL DEFAULT '0',
|
||||
`attach_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
|
||||
`t_up_total` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
`t_down_total` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
`t_bonus_total` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`topic_id`,`user_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of bb_bt_tor_dl_stat
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for `bb_bt_tracker`
|
||||
-- ----------------------------
|
||||
|
@ -882,6 +864,7 @@ CREATE TABLE IF NOT EXISTS `bb_topics` (
|
|||
`topic_moved_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
|
||||
`topic_dl_type` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`attach_ext_id` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`attach_dl_cnt` mediumint(8) unsigned NOT NULL DEFAULT '0',
|
||||
`filesize` mediumint(8) unsigned NOT NULL DEFAULT '0',
|
||||
`topic_last_post_time` int(11) NOT NULL DEFAULT '0',
|
||||
`topic_show_first_post` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
|
@ -895,7 +878,7 @@ CREATE TABLE IF NOT EXISTS `bb_topics` (
|
|||
-- ----------------------------
|
||||
-- Records of bb_topics
|
||||
-- ----------------------------
|
||||
INSERT INTO `bb_topics` VALUES ('1', '1', 'Добро пожаловать в TorrentPier', '2', UNIX_TIMESTAMP(), '2', '0', '0', '0', '0', '1', '1', '0', '0', '0', '0', UNIX_TIMESTAMP(), '0');
|
||||
INSERT INTO `bb_topics` VALUES ('1', '1', 'Добро пожаловать в TorrentPier', '2', UNIX_TIMESTAMP(), '2', '0', '0', '0', '0', '1', '1', '0', '0', '0', '0', '0', UNIX_TIMESTAMP(), '0');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for `bb_topics_watch`
|
||||
|
|
|
@ -54,7 +54,7 @@ DROP TABLE IF EXISTS `bb_captcha`;
|
|||
DELETE FROM `bb_cron` WHERE `cron_script` = 'captcha_gen_gc.php';
|
||||
INSERT INTO `bb_cron` VALUES ('', '1', 'Accrual seedbonus', 'tr_seed_bonus.php', 'interval', '', '', '25', '', '', '00:15:00', '0', '', '0', '0', '0');
|
||||
|
||||
// 2.1.6
|
||||
// 2.2.0
|
||||
DROP TABLE IF EXISTS `bb_ads`;
|
||||
DELETE FROM `bb_config` WHERE `config_name` = 'active_ads';
|
||||
DELETE FROM `bb_cron` WHERE `cron_script` = 'attach_maintenance.php';
|
||||
|
@ -73,5 +73,8 @@ DELETE FROM `bb_config` WHERE `config_name` = 'bt_check_announce_url';
|
|||
ALTER TABLE `bb_forums` ADD `forum_last_topic_time` INT NOT NULL AFTER `forum_last_post_id`;
|
||||
DROP TABLE IF EXISTS `bb_extensions`;
|
||||
DROP TABLE IF EXISTS `bb_extension_groups`;
|
||||
define('BB_ATTACHMENTS_DESC', 'bb_attachments_desc'); - удалить при апгрейде
|
||||
define('BB_ATTACHMENTS', 'bb_attachments'); - удалить при апгрейде
|
||||
DROP TABLE IF EXISTS `bb_attachments_desc`;
|
||||
DROP TABLE IF EXISTS `bb_attachments`;
|
||||
ALTER TABLE `bb_topics` ADD `tracker_id` TINYINT(4) NOT NULL DEFAULT '0' AFTER `topic_moved_id`;
|
||||
ALTER TABLE `bb_topics` ADD `attach_dl_cnt` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `attach_ext_id`;
|
||||
DROP TABLE IF EXISTS `bb_bt_tor_dl_stat`;
|
|
@ -18,14 +18,15 @@ switch ($mode)
|
|||
$this->ajax_die($lang['STATUS_DOES_EXIST'] . $new_status);
|
||||
}
|
||||
|
||||
$topic_ids = DB()->fetch_rowset("SELECT attach_id FROM ". BB_BT_TORRENTS ." WHERE topic_id IN($topics)", 'attach_id');
|
||||
$topic_ids = explode(',', $topics);
|
||||
|
||||
foreach($topic_ids as $attach_id)
|
||||
foreach($topic_ids as $topic_id)
|
||||
{
|
||||
change_tor_status($attach_id, $status);
|
||||
change_tor_status($topic_id, $status);
|
||||
}
|
||||
|
||||
$this->response['status'] = $bb_cfg['tor_icons'][$status];
|
||||
$this->response['topics'] = explode(',', $topics);
|
||||
$this->response['topics'] = $topic_ids;
|
||||
break;
|
||||
|
||||
case 'edit_topic_title':
|
||||
|
|
|
@ -6,7 +6,7 @@ global $lang;
|
|||
|
||||
if (!isset($this->request['t']))
|
||||
{
|
||||
$this->ajax_die($lang['EMPTY_ATTACH_ID']);
|
||||
$this->ajax_die('empty topic_id'); // TODO: перевести
|
||||
}
|
||||
$topic_id = (int) $this->request['t'];
|
||||
|
||||
|
|
|
@ -477,6 +477,7 @@ $config = [
|
|||
'retracker' => true,
|
||||
'retracker_host' => 'http://retracker.local/announce',
|
||||
'freeleech' => false,
|
||||
'guest_tracker' => false,
|
||||
],
|
||||
|
||||
// Ratio settings
|
||||
|
|
|
@ -140,30 +140,30 @@ if ($tor_reged)
|
|||
else
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'DOWNLOAD_NAME' => '['.$bb_cfg['server_name'].'].t' . $topic_id . '.torrent',
|
||||
'TOR_SILVER_GOLD' => $tor_info['tor_type'],
|
||||
'DOWNLOAD_NAME' => '['.$bb_cfg['server_name'].'].t' . $topic_id . '.torrent',
|
||||
'TOR_SILVER_GOLD' => $tor_info['tor_type'],
|
||||
|
||||
'TOR_FROZEN' => (!IS_AM) ? (isset($bb_cfg['tor_frozen'][$tor_info['tor_status']]) && !(isset($bb_cfg['tor_frozen_author_download'][$tor_info['tor_status']]) && $userdata['user_id'] == $tor_info['poster_id'])) ? true : '' : '',
|
||||
'TOR_STATUS_TEXT' => $lang['TOR_STATUS_NAME'][$tor_info['tor_status']],
|
||||
'TOR_STATUS_ICON' => $bb_cfg['tor_icons'][$tor_info['tor_status']],
|
||||
'TOR_STATUS_BY' => ($tor_info['checked_user_id'] && $is_auth['auth_mod']) ? ('<span title="'. bb_date($tor_info['checked_time']) .'"> · '. profile_url($tor_info) .' · <i>'. delta_time($tor_info['checked_time']) . $lang['TOR_BACK'] .'</i></span>') : '',
|
||||
'TOR_FROZEN' => (!IS_AM) ? (isset($bb_cfg['tor_frozen'][$tor_info['tor_status']]) && !(isset($bb_cfg['tor_frozen_author_download'][$tor_info['tor_status']]) && $userdata['user_id'] == $tor_info['poster_id'])) ? true : '' : '',
|
||||
'TOR_STATUS_TEXT' => $lang['TOR_STATUS_NAME'][$tor_info['tor_status']],
|
||||
'TOR_STATUS_ICON' => $bb_cfg['tor_icons'][$tor_info['tor_status']],
|
||||
'TOR_STATUS_BY' => ($tor_info['checked_user_id'] && $is_auth['auth_mod']) ? ('<span title="'. bb_date($tor_info['checked_time']) .'"> · '. profile_url($tor_info) .' · <i>'. delta_time($tor_info['checked_time']) . $lang['TOR_BACK'] .'</i></span>') : '',
|
||||
'TOR_STATUS_SELECT' => build_select('sel_status', array_flip($lang['TOR_STATUS_NAME']), TOR_APPROVED),
|
||||
'TOR_STATUS_REPLY' => $bb_cfg['tor_comment'] && !IS_GUEST && in_array($tor_info['tor_status'], $bb_cfg['tor_reply']) && $userdata['user_id'] == $tor_info['poster_id'] && $t_data['topic_status'] != TOPIC_LOCKED,
|
||||
'TOR_STATUS_REPLY' => $bb_cfg['tor_comment'] && !IS_GUEST && in_array($tor_info['tor_status'], $bb_cfg['tor_reply']) && $userdata['user_id'] == $tor_info['poster_id'] && $t_data['topic_status'] != TOPIC_LOCKED,
|
||||
|
||||
'DL_LINK_CLASS' => (isset($bt_userdata['user_status'])) ? $dl_link_css[$bt_userdata['user_status']] : 'genmed',
|
||||
'DL_TITLE_CLASS' => (isset($bt_userdata['user_status'])) ? $dl_status_css[$bt_userdata['user_status']] : 'gen',
|
||||
'FILESIZE' => $tor_file_size,
|
||||
'MAGNET' => $tor_magnet,
|
||||
'HASH' => strtoupper(bin2hex($tor_info['info_hash'])),
|
||||
'DOWNLOAD_COUNT' => sprintf($lang['DOWNLOAD_NUMBER'], 666/*$download_count*/), // TODO: подсчет числа скачиваний вложения (?) или удалить
|
||||
'REGED_TIME' => bb_date($tor_info['reg_time']),
|
||||
'DL_LINK_CLASS' => (isset($bt_userdata['user_status'])) ? $dl_link_css[$bt_userdata['user_status']] : 'genmed',
|
||||
'DL_TITLE_CLASS' => (isset($bt_userdata['user_status'])) ? $dl_status_css[$bt_userdata['user_status']] : 'gen',
|
||||
'FILESIZE' => $tor_file_size,
|
||||
'MAGNET' => $tor_magnet,
|
||||
'HASH' => strtoupper(bin2hex($tor_info['info_hash'])),
|
||||
'DOWNLOAD_COUNT' => declension($t_data['attach_dl_cnt'], 'times'),
|
||||
'REGED_TIME' => bb_date($tor_info['reg_time']),
|
||||
|
||||
'SHOW_TOR_REGGED' => true,
|
||||
'TRACKER_REG_LINK' => $tr_reg_link,
|
||||
'AUTH_MOD' => $is_auth['auth_mod'],
|
||||
'TOR_SIZE' => humn_size($tor_size),
|
||||
'TOR_LONGEVITY' => delta_time($tor_info['reg_time']),
|
||||
'TOR_COMPLETED' => declension($tor_info['complete_count'], 'times'),
|
||||
'SHOW_TOR_REGGED' => true,
|
||||
'TRACKER_REG_LINK' => $tr_reg_link,
|
||||
'AUTH_MOD' => $is_auth['auth_mod'],
|
||||
'TOR_SIZE' => humn_size($tor_size),
|
||||
'TOR_LONGEVITY' => delta_time($tor_info['reg_time']),
|
||||
'TOR_COMPLETED' => declension($tor_info['complete_count'], 'times'),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -478,7 +478,7 @@ td.topic_id { cursor: pointer; }
|
|||
<!-- BEGIN tor -->
|
||||
<div title="{L_DL_TORRENT}">
|
||||
<div><span class="seedmed" title="Seeders"><b>{t.tor.SEEDERS}</b></span><span class="med"> | </span><span class="leechmed" title="Leechers"><b>{t.tor.LEECHERS}</b></span></div>
|
||||
<div style="padding-top: 2px" class="small"><!-- IF t.TOR_FROZEN -->{t.tor.TOR_SIZE}<!-- ELSE --><a href="{DOWNLOAD_URL}{t.tor.ATTACH_ID}" class="small" style="text-decoration: none">{t.tor.TOR_SIZE}</a> <!-- IF MAGNET_LINKS -->{t.tor.MAGNET}<!-- ENDIF --><!-- ENDIF --></div>
|
||||
<div style="padding-top: 2px" class="small"><!-- IF t.TOR_FROZEN -->{t.tor.TOR_SIZE}<!-- ELSE --><a href="{DOWNLOAD_URL}{t.TOPIC_ID}" class="small" style="text-decoration: none">{t.tor.TOR_SIZE}</a> <!-- IF MAGNET_LINKS -->{t.tor.MAGNET}<!-- ENDIF --><!-- ENDIF --></div>
|
||||
</div>
|
||||
<!-- END tor -->
|
||||
</td>
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
</tr>
|
||||
<tr class="row1">
|
||||
<td>{L_COMPLETED}:</td>
|
||||
<td><span title="{L_DOWNLOADED}: {DOWNLOAD_COUNT}">{TOR_COMPLETED}</span></td>
|
||||
<td>{DOWNLOAD_COUNT}</td>
|
||||
</tr>
|
||||
<tr class="row1">
|
||||
<td>{L_SIZE}:</td>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue