diff --git a/admin/admin_bt_forum_cfg.php b/admin/admin_bt_forum_cfg.php
index 89f3b3b15..64b996204 100644
--- a/admin/admin_bt_forum_cfg.php
+++ b/admin/admin_bt_forum_cfg.php
@@ -25,14 +25,12 @@ $default_cfg_str = array(
$default_cfg_bool = array(
'bt_disable_dht' => 1,
'bt_show_peers' => 1,
- 'bt_add_auth_key' => 1,
'bt_show_dl_list' => 0,
'bt_dl_list_only_1st_page' => 1,
'bt_dl_list_only_count' => 1,
'bt_replace_ann_url' => 1,
'bt_show_ip_only_moder' => 1,
'bt_show_port_only_moder' => 1,
- 'bt_check_announce_url' => 0,
'bt_show_dl_list_buttons' => 1,
'bt_show_dl_but_will' => 1,
'bt_show_dl_but_down' => 0,
diff --git a/install/sql/mysql.sql b/install/sql/mysql.sql
index 327fe14e3..0db6636fc 100644
--- a/install/sql/mysql.sql
+++ b/install/sql/mysql.sql
@@ -140,7 +140,6 @@ CREATE TABLE IF NOT EXISTS `bb_bt_torhelp` (
DROP TABLE IF EXISTS `bb_bt_torrents`;
CREATE TABLE IF NOT EXISTS `bb_bt_torrents` (
`info_hash` varbinary(20) NOT NULL DEFAULT '',
- `post_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
`poster_id` mediumint(9) NOT NULL DEFAULT '0',
`topic_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
`forum_id` smallint(5) unsigned NOT NULL DEFAULT '0',
@@ -156,7 +155,6 @@ CREATE TABLE IF NOT EXISTS `bb_bt_torrents` (
`speed_up` int(11) NOT NULL DEFAULT '0',
`speed_down` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`info_hash`),
- UNIQUE KEY `post_id` (`post_id`),
UNIQUE KEY `topic_id` (`topic_id`),
KEY `reg_time` (`reg_time`),
KEY `forum_id` (`forum_id`),
@@ -341,11 +339,9 @@ INSERT INTO `bb_config` VALUES ('birthday_enabled', '1');
INSERT INTO `bb_config` VALUES ('birthday_max_age', '99');
INSERT INTO `bb_config` VALUES ('birthday_min_age', '10');
INSERT INTO `bb_config` VALUES ('birthday_check_day', '7');
-INSERT INTO `bb_config` VALUES ('bt_add_auth_key', '1');
INSERT INTO `bb_config` VALUES ('bt_allow_spmode_change', '1');
INSERT INTO `bb_config` VALUES ('bt_announce_url', 'https://demo.torrentpier.me/bt/announce.php');
INSERT INTO `bb_config` VALUES ('bt_disable_dht', '0');
-INSERT INTO `bb_config` VALUES ('bt_check_announce_url', '0');
INSERT INTO `bb_config` VALUES ('bt_del_addit_ann_urls', '1');
INSERT INTO `bb_config` VALUES ('bt_dl_list_only_1st_page', '1');
INSERT INTO `bb_config` VALUES ('bt_dl_list_only_count', '1');
@@ -476,75 +472,6 @@ CREATE TABLE IF NOT EXISTS `bb_disallow` (
-- Records of bb_disallow
-- ----------------------------
--- ----------------------------
--- Table structure for `bb_extensions`
--- ----------------------------
-DROP TABLE IF EXISTS `bb_extensions`;
-CREATE TABLE IF NOT EXISTS `bb_extensions` (
- `ext_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
- `group_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
- `extension` varchar(100) NOT NULL DEFAULT '',
- `comment` varchar(100) NOT NULL DEFAULT '',
- PRIMARY KEY (`ext_id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
--- ----------------------------
--- Records of bb_extensions
--- ----------------------------
-INSERT INTO `bb_extensions` VALUES ('', '1', 'gif', '');
-INSERT INTO `bb_extensions` VALUES ('', '1', 'png', '');
-INSERT INTO `bb_extensions` VALUES ('', '1', 'jpeg', '');
-INSERT INTO `bb_extensions` VALUES ('', '1', 'jpg', '');
-INSERT INTO `bb_extensions` VALUES ('', '1', 'tif', '');
-INSERT INTO `bb_extensions` VALUES ('', '1', 'tga', '');
-INSERT INTO `bb_extensions` VALUES ('', '2', 'gtar', '');
-INSERT INTO `bb_extensions` VALUES ('', '2', 'gz', '');
-INSERT INTO `bb_extensions` VALUES ('', '2', 'tar', '');
-INSERT INTO `bb_extensions` VALUES ('', '2', 'zip', '');
-INSERT INTO `bb_extensions` VALUES ('', '2', 'rar', '');
-INSERT INTO `bb_extensions` VALUES ('', '2', 'ace', '');
-INSERT INTO `bb_extensions` VALUES ('', '3', 'txt', '');
-INSERT INTO `bb_extensions` VALUES ('', '3', 'c', '');
-INSERT INTO `bb_extensions` VALUES ('', '3', 'h', '');
-INSERT INTO `bb_extensions` VALUES ('', '3', 'cpp', '');
-INSERT INTO `bb_extensions` VALUES ('', '3', 'hpp', '');
-INSERT INTO `bb_extensions` VALUES ('', '3', 'diz', '');
-INSERT INTO `bb_extensions` VALUES ('', '4', 'xls', '');
-INSERT INTO `bb_extensions` VALUES ('', '4', 'doc', '');
-INSERT INTO `bb_extensions` VALUES ('', '4', 'dot', '');
-INSERT INTO `bb_extensions` VALUES ('', '4', 'pdf', '');
-INSERT INTO `bb_extensions` VALUES ('', '4', 'ai', '');
-INSERT INTO `bb_extensions` VALUES ('', '4', 'ps', '');
-INSERT INTO `bb_extensions` VALUES ('', '4', 'ppt', '');
-INSERT INTO `bb_extensions` VALUES ('', '5', 'rm', '');
-INSERT INTO `bb_extensions` VALUES ('', '6', 'torrent', '');
-
--- ----------------------------
--- Table structure for `bb_extension_groups`
--- ----------------------------
-DROP TABLE IF EXISTS `bb_extension_groups`;
-CREATE TABLE IF NOT EXISTS `bb_extension_groups` (
- `group_id` mediumint(8) NOT NULL AUTO_INCREMENT,
- `group_name` varchar(20) NOT NULL DEFAULT '',
- `cat_id` tinyint(2) NOT NULL DEFAULT '0',
- `allow_group` tinyint(1) NOT NULL DEFAULT '0',
- `download_mode` tinyint(1) unsigned NOT NULL DEFAULT '1',
- `upload_icon` varchar(100) NOT NULL DEFAULT '',
- `max_filesize` int(20) NOT NULL DEFAULT '0',
- `forum_permissions` text NOT NULL,
- PRIMARY KEY (`group_id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
--- ----------------------------
--- Records of bb_extension_groups
--- ----------------------------
-INSERT INTO `bb_extension_groups` VALUES ('', 'Images', '1', '1', '1', '', '262144', '');
-INSERT INTO `bb_extension_groups` VALUES ('', 'Archives', '0', '1', '1', '', '262144', '');
-INSERT INTO `bb_extension_groups` VALUES ('', 'Plain text', '0', '0', '1', '', '262144', '');
-INSERT INTO `bb_extension_groups` VALUES ('', 'Documents', '0', '0', '1', '', '262144', '');
-INSERT INTO `bb_extension_groups` VALUES ('', 'Real media', '0', '0', '2', '', '262144', '');
-INSERT INTO `bb_extension_groups` VALUES ('', 'Torrent', '0', '1', '1', '', '122880', '');
-
-- ----------------------------
-- Table structure for `bb_forums`
-- ----------------------------
@@ -559,6 +486,7 @@ CREATE TABLE IF NOT EXISTS `bb_forums` (
`forum_posts` mediumint(8) unsigned NOT NULL DEFAULT '0',
`forum_topics` mediumint(8) unsigned NOT NULL DEFAULT '0',
`forum_last_post_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
+ `forum_last_topic_time` INT NOT NULL,
`forum_tpl_id` smallint(6) NOT NULL DEFAULT '0',
`prune_days` smallint(5) unsigned NOT NULL DEFAULT '0',
`auth_view` tinyint(2) NOT NULL DEFAULT '0',
@@ -590,7 +518,7 @@ CREATE TABLE IF NOT EXISTS `bb_forums` (
-- ----------------------------
-- Records of bb_forums
-- ----------------------------
-INSERT INTO `bb_forums` VALUES ('1', '1', 'Ваш первый форум', 'Описание вашего первого форума.', '0', '10', '1', '1', '1', '0', '0', '0', '0', '1', '1', '1', '1', '3', '3', '1', '1', '1', '1', '0', '0', '0', '0', '1', '0', '0');
+INSERT INTO `bb_forums` VALUES ('1', '1', 'Ваш первый форум', 'Описание вашего первого форума.', '0', '10', '1', '1', '1', '0', '0', '0', '0', '0', '1', '1', '1', '1', '3', '3', '1', '1', '1', '1', '0', '0', '0', '0', '1', '0', '0');
-- ----------------------------
-- Table structure for `bb_groups`
diff --git a/install/upgrade/changes.txt b/install/upgrade/changes.txt
index 1b1487545..ca9d22374 100644
--- a/install/upgrade/changes.txt
+++ b/install/upgrade/changes.txt
@@ -64,4 +64,14 @@ DROP TABLE IF EXISTS `bb_quota_limits`;
ALTER TABLE `bb_topics` ADD `attach_ext_id` TINYINT(4) NOT NULL DEFAULT '0' AFTER `topic_dl_type`;
ALTER TABLE `bb_topics` ADD `filesize` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `attach_ext_id`;
DELETE FROM `bb_config` WHERE `config_name` = 'new_tpls';
-ALTER TABLE `bb_log` DROP COLUMN `log_username`;
\ No newline at end of file
+ALTER TABLE `bb_log` DROP COLUMN `log_username`;
+ALTER TABLE `bb_topics` CHANGE `topic_dl_type` `tracker_status` TINYINT(1) NOT NULL DEFAULT '0';
+ALTER TABLE `bb_topics` ADD `tracker_id` TINYINT(4) NOT NULL DEFAULT '0' AFTER `topic_moved_id`;
+ALTER TABLE `bb_bt_torrents` DROP `post_id`;
+DELETE FROM `bb_config` WHERE `config_name` = 'bt_add_auth_key';
+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'); - удалить при апгрейде
\ No newline at end of file
diff --git a/library/ajax/change_tor_status.php b/library/ajax/change_tor_status.php
index fe7698c1c..37faae0a4 100644
--- a/library/ajax/change_tor_status.php
+++ b/library/ajax/change_tor_status.php
@@ -4,10 +4,10 @@ if (!defined('IN_AJAX')) die(basename(__FILE__));
global $userdata, $bb_cfg, $lang;
-if (!isset($this->request['attach_id'])) $this->ajax_die($lang['EMPTY_ATTACH_ID']);
+if (!isset($this->request['topic_id'])) $this->ajax_die('Invalid topic_id');
-$attach_id = (int) $this->request['attach_id'];
-$mode = (string) $this->request['mode'];
+$topic_id = (int) $this->request['topic_id'];
+$mode = (string) $this->request['mode'];
if ($bb_cfg['tor_comment'])
{
@@ -16,11 +16,11 @@ if ($bb_cfg['tor_comment'])
$tor = DB()->fetch_row("
SELECT
- tor.poster_id, tor.forum_id, tor.topic_id, tor.tor_status, tor.checked_time, tor.checked_user_id, f.cat_id, t.topic_title
+ tor.poster_id, tor.forum_id, tor.tor_status, tor.checked_time, tor.checked_user_id, f.cat_id, t.topic_title
FROM ". BB_BT_TORRENTS ." tor
INNER JOIN ". BB_FORUMS ." f ON(f.forum_id = tor.forum_id)
INNER JOIN ". BB_TOPICS ." t ON(t.topic_id = tor.topic_id)
- WHERE tor.attach_id = $attach_id
+ WHERE tor.topic_id = $topic_id
LIMIT 1
");
@@ -71,7 +71,7 @@ switch ($mode)
}
}
- change_tor_status($attach_id, $new_status);
+ change_tor_status($topic_id, $new_status);
$this->response['status'] = $bb_cfg['tor_icons'][$new_status] .' '. $lang['TOR_STATUS_NAME'][$new_status]. ' · '. profile_url($userdata) .' · '. delta_time(TIMENOW) . $lang['TOR_BACK']. '';
@@ -103,4 +103,4 @@ switch ($mode)
break;
}
-$this->response['attach_id'] = $attach_id;
\ No newline at end of file
+$this->response['topic_id'] = $topic_id;
\ No newline at end of file
diff --git a/library/ajax/change_torrent.php b/library/ajax/change_torrent.php
index 6d1445a66..8ab3bd125 100644
--- a/library/ajax/change_torrent.php
+++ b/library/ajax/change_torrent.php
@@ -2,59 +2,26 @@
if (!defined('IN_AJAX')) die(basename(__FILE__));
-global $userdata, $bb_cfg, $lang;
+global $lang;
-if (!isset($this->request['attach_id']))
+if (!isset($this->request['t']))
{
- $this->ajax_die($lang['EMPTY_ATTACH_ID']);
+ $this->ajax_die('Invalid AJAX topic');
+}
+if (!isset($this->request['u']))
+{
+ //$this->ajax_die('Invalid AJAX user');
}
if (!isset($this->request['type']))
{
- $this->ajax_die('type');
+ $this->ajax_die('Invalid AJAX type');
}
-$attach_id = (int) $this->request['attach_id'];
+
+$topic_id = (int) $this->request['t'];
+//$req_uid = (int) $this->request['u'];
$type = (string) $this->request['type'];
-
-$torrent = DB()->fetch_row("
- SELECT
- a.post_id, d.physical_filename, d.extension, d.tracker_status,
- t.topic_first_post_id,
- p.poster_id, p.topic_id, p.forum_id,
- f.allow_reg_tracker
- FROM
- ". BB_ATTACHMENTS ." a,
- ". BB_ATTACHMENTS_DESC ." d,
- ". BB_POSTS ." p,
- ". BB_TOPICS ." t,
- ". BB_FORUMS ." f
- WHERE
- a.attach_id = $attach_id
- AND d.attach_id = $attach_id
- AND p.post_id = a.post_id
- AND t.topic_id = p.topic_id
- AND f.forum_id = p.forum_id
- LIMIT 1
- ");
-
-if (!$torrent) $this->ajax_die($lang['INVALID_ATTACH_ID']);
-
-if ($torrent['poster_id'] == $userdata['user_id'] && !IS_AM)
-{
- if ($type == 'del_torrent' || $type == 'reg' || $type == 'unreg')
- {
- true;
- }
- else
- {
- $this->ajax_die($lang['ONLY_FOR_MOD']);
- }
-}
-elseif (!IS_AM)
-{
- $this->ajax_die($lang['ONLY_FOR_MOD']);
-}
-
$title = $url = '';
+
switch ($type)
{
case 'set_gold';
@@ -72,31 +39,31 @@ switch ($type)
{
$tor_type = 0;
}
- change_tor_type($attach_id, $tor_type);
+ change_tor_type($topic_id, $tor_type);
+ $url = make_url(TOPIC_URL . $topic_id);
$title = $lang['CHANGE_TOR_TYPE'];
- $url = make_url(TOPIC_URL . $torrent['topic_id']);
break;
case 'reg';
- tracker_register($attach_id);
- $url = (TOPIC_URL . $torrent['topic_id']);
+ tracker_register($topic_id);
+ $url = (TOPIC_URL . $topic_id);
break;
case 'unreg';
- tracker_unregister($attach_id);
- $url = (TOPIC_URL . $torrent['topic_id']);
+ tracker_unregister($topic_id);
+ $url = (TOPIC_URL . $topic_id);
break;
case 'del_torrent';
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['DEL_TORRENT']);
- delete_torrent($attach_id);
- $url = make_url(TOPIC_URL . $torrent['topic_id']);
+ delete_torrent($topic_id);
+ $url = make_url(TOPIC_URL . $topic_id);
break;
case 'del_torrent_move_topic';
if (empty($this->request['confirmed'])) $this->prompt_for_confirm($lang['DEL_MOVE_TORRENT']);
- delete_torrent($attach_id);
- $url = make_url("modcp.php?t={$torrent['topic_id']}&mode=move&sid={$userdata['session_id']}");
+ delete_torrent($topic_id);
+ $url = make_url("modcp.php?t=$topic_id&mode=move");
break;
}
diff --git a/library/ajax/posts.php b/library/ajax/posts.php
index ccfe534a5..6d5b480a9 100644
--- a/library/ajax/posts.php
+++ b/library/ajax/posts.php
@@ -125,7 +125,7 @@ switch($this->request['type'])
{
$this->ajax_die($lang['EDIT_OWN_POSTS']);
}
- if ((mb_strlen($post['post_text'], 'UTF-8') > 1000) || $post['post_attachment'] || ($post['topic_first_post_id'] == $post_id))
+ if ((mb_strlen($post['post_text'], 'UTF-8') > 1000) || $post['attach_ext_id'] || ($post['topic_first_post_id'] == $post_id))
{
$this->response['redirect'] = make_url(POSTING_URL.'?mode=editpost&p='. $post_id);
}
diff --git a/library/ajax/view_torrent.php b/library/ajax/view_torrent.php
index af2327b8e..7931eb625 100644
--- a/library/ajax/view_torrent.php
+++ b/library/ajax/view_torrent.php
@@ -13,9 +13,9 @@ $attach_id = (int) $this->request['attach_id'];
global $bnc_error;
$bnc_error = 0;
-$torrent = DB()->fetch_row("SELECT at.attach_id, at.physical_filename FROM ". BB_ATTACHMENTS_DESC ." at WHERE at.attach_id = $attach_id LIMIT 1");
+//$torrent = DB()->fetch_row("SELECT at.attach_id, at.physical_filename FROM ". BB_ATTACHMENTS_DESC ." at WHERE at.attach_id = $attach_id LIMIT 1");
if (!$torrent) $this->ajax_die($lang['EMPTY_ATTACH_ID']);
-$filename = get_attachments_dir() .'/'. $torrent['physical_filename'];
+//$filename = get_attachments_dir() .'/'. $torrent['physical_filename'];
if (($file_contents = @file_get_contents($filename)) === false)
{
diff --git a/library/config.php b/library/config.php
index 51bc9ee30..d722b72d4 100644
--- a/library/config.php
+++ b/library/config.php
@@ -71,8 +71,8 @@ $domain_name = 'torrentpier.me'; // enter here your primary domain name of your
$domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $domain_name;
// Version info
-$bb_cfg['tp_version'] = '2.1.6';
-$bb_cfg['tp_release_date'] = '**-03-2015';
+$bb_cfg['tp_version'] = '2.2.0';
+$bb_cfg['tp_release_date'] = '1/06/2015';
$bb_cfg['tp_release_state'] = 'ALPHA';
// Database
@@ -192,7 +192,6 @@ $tr_cfg = array(
'limit_concurrent_ips' => false,
'limit_seed_ips' => 0,
'limit_leech_ips' => 0,
- 'tor_topic_up' => true,
'gold_silver_enabled' => true,
'retracker' => true,
'retracker_host' => 'http://retracker.local/announce',
@@ -268,6 +267,7 @@ define('TEMPLATES_DIR', BB_PATH .'/styles/templates/' );
// URL's
$bb_cfg['ajax_url'] = 'ajax.php'; # "http://{$_SERVER['SERVER_NAME']}/ajax.php"
+$bb_cfg['dl_url'] = 'dl.php?t='; # "http://{$domain_name}/dl.php"
$bb_cfg['login_url'] = 'login.php'; # "http://{$domain_name}/login.php"
$bb_cfg['posting_url'] = 'posting.php'; # "http://{$domain_name}/posting.php"
$bb_cfg['pm_url'] = 'privmsg.php'; # "http://{$domain_name}/privmsg.php"
diff --git a/library/includes/bbcode.php b/library/includes/bbcode.php
index 6e5cfe97e..46e94b1e3 100644
--- a/library/includes/bbcode.php
+++ b/library/includes/bbcode.php
@@ -96,17 +96,12 @@ function prepare_message ($message)
// Either in a window or inline
function generate_smilies($mode)
{
- global $bb_cfg, $template, $lang, $user, $datastore;
+ global $bb_cfg, $template, $lang, $datastore;
$inline_columns = 4;
$inline_rows = 7;
$window_columns = 8;
- if ($mode == 'window')
- {
- $user->session_start();
- }
-
$data = $datastore->get('smile_replacements');
if ($sql = $data['smile'])
@@ -184,8 +179,6 @@ function generate_smilies($mode)
}
}
-// some functions from vB
-// #############################################################################
/**
* Strips away [quote] tags and their contents from the specified string
*
@@ -288,7 +281,6 @@ function strip_quotes ($text)
return $newtext;
}
-// #############################################################################
/**
* Strips away bbcode from a given string, leaving plain text
*
diff --git a/library/includes/cron/jobs/tr_maintenance.php b/library/includes/cron/jobs/tr_maintenance.php
index b51fa8359..05644fe81 100644
--- a/library/includes/cron/jobs/tr_maintenance.php
+++ b/library/includes/cron/jobs/tr_maintenance.php
@@ -11,9 +11,9 @@ $last_seen_time = TIMENOW - 86400*$bb_cfg['seeder_last_seen_days_keep'];
$never_seen_time = TIMENOW - 86400*$bb_cfg['seeder_never_seen_days_keep'];
$limit_sql = 3000;
-$topics_sql = $attach_sql = array();
+$topics_sql = [];
-$sql = "SELECT topic_id, attach_id
+$sql = "SELECT topic_id
FROM ". BB_BT_TORRENTS ."
WHERE reg_time < $never_seen_time
AND seeder_last_seen < $last_seen_time
@@ -22,12 +22,10 @@ $sql = "SELECT topic_id, attach_id
foreach (DB()->fetch_rowset($sql) as $row)
{
$topics_sql[] = $row['topic_id'];
- $attach_sql[] = $row['attach_id'];
}
$dead_tor_sql = join(',', $topics_sql);
-$attach_sql = join(',', $attach_sql);
-if ($dead_tor_sql && $attach_sql)
+if ($dead_tor_sql)
{
// Delete torstat
DB()->query("
@@ -35,19 +33,6 @@ if ($dead_tor_sql && $attach_sql)
WHERE topic_id IN($dead_tor_sql)
");
- // Update attach
- DB()->query("
- UPDATE
- ". BB_ATTACHMENTS_DESC ." a,
- ". BB_BT_TORRENTS ." tor
- SET
- a.tracker_status = 0,
- a.download_count = tor.complete_count
- WHERE
- a.attach_id = tor.attach_id
- AND tor.attach_id IN($attach_sql)
- ");
-
// Remove torrents
DB()->query("
DELETE FROM ". BB_BT_TORRENTS ."
diff --git a/library/includes/datastore/build_stats.php b/library/includes/datastore/build_stats.php
index e5e7a69c5..4750aaa04 100644
--- a/library/includes/datastore/build_stats.php
+++ b/library/includes/datastore/build_stats.php
@@ -8,7 +8,7 @@ $data = array();
// usercount
$row = DB()->fetch_row("SELECT COUNT(*) AS usercount FROM ". BB_USERS ." WHERE user_id NOT IN(". EXCLUDED_USERS .")");
-$data['usercount'] = number_format($row['usercount']);
+$data['usercount'] = commify($row['usercount']);
// newestuser
$row = DB()->fetch_row("SELECT user_id, username, user_rank FROM ". BB_USERS ." WHERE user_active = 1 ORDER BY user_id DESC LIMIT 1");
@@ -16,22 +16,22 @@ $data['newestuser'] = $row;
// post/topic count
$row = DB()->fetch_row("SELECT SUM(forum_topics) AS topiccount, SUM(forum_posts) AS postcount FROM ". BB_FORUMS);
-$data['postcount'] = number_format($row['postcount']);
-$data['topiccount'] = number_format($row['topiccount']);
+$data['postcount'] = commify($row['postcount']);
+$data['topiccount'] = commify($row['topiccount']);
// Tracker stats
if ($bb_cfg['tor_stats'])
{
// torrents stat
$row = DB()->fetch_row("SELECT COUNT(topic_id) AS torrentcount, SUM(size) AS size FROM ". BB_BT_TORRENTS);
- $data['torrentcount'] = number_format($row['torrentcount']);
+ $data['torrentcount'] = commify($row['torrentcount']);
$data['size'] = $row['size'];
// peers stat
$row = DB()->fetch_row("SELECT SUM(seeders) AS seeders, SUM(leechers) AS leechers, ((SUM(speed_up) + SUM(speed_down))/2) AS speed FROM ". BB_BT_TRACKER_SNAP);
- $data['seeders'] = number_format($row['seeders']);
- $data['leechers'] = number_format($row['leechers']);
- $data['peers'] = number_format($row['seeders'] + $row['leechers']);
+ $data['seeders'] = commify($row['seeders']);
+ $data['leechers'] = commify($row['leechers']);
+ $data['peers'] = commify($row['seeders'] + $row['leechers']);
$data['speed'] = $row['speed'];
}
diff --git a/library/includes/functions.php b/library/includes/functions.php
index 5a5c51c48..26b3cabff 100644
--- a/library/includes/functions.php
+++ b/library/includes/functions.php
@@ -31,7 +31,7 @@ function delete_avatar ($user_id, $avatar_ext_id)
function get_tracks ($type)
{
- static $pattern = '#^a:\d+:{[i:;\d]+}$#';
+ $c_name = '';
switch ($type)
{
@@ -87,7 +87,7 @@ function set_tracks ($cookie_name, &$tracking_ary, $tracks = null, $val = TIMENO
if ($overflow > 0)
{
arsort($tracking_ary);
- for ($i=0; $i < $overflow; $i++)
+ for ($i = 0; $i < $overflow; $i++)
{
array_pop($tracking_ary);
}
@@ -1999,7 +1999,7 @@ function get_topic_icon ($topic, $is_unread = null)
$folder = $images['folder_locked'];
$folder_new = $images['folder_locked_new'];
}
- else if ($topic['topic_dl_type'] == TOPIC_DL_TYPE_DL)
+ else if ($topic['tracker_status'])
{
$folder = ($t_hot) ? $images['folder_dl_hot'] : $images['folder_dl'];
$folder_new = ($t_hot) ? $images['folder_dl_hot_new'] : $images['folder_dl_new'];
diff --git a/library/includes/functions_admin.php b/library/includes/functions_admin.php
index 82c76d003..4107915e7 100644
--- a/library/includes/functions_admin.php
+++ b/library/includes/functions_admin.php
@@ -25,10 +25,11 @@ function sync ($type, $id)
DB()->query("
CREATE TEMPORARY TABLE $tmp_sync_forums (
- forum_id SMALLINT UNSIGNED NOT NULL DEFAULT '0',
- forum_last_post_id INT UNSIGNED NOT NULL DEFAULT '0',
- forum_posts MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
- forum_topics MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
+ forum_id SMALLINT UNSIGNED NOT NULL DEFAULT '0',
+ forum_last_post_id INT UNSIGNED NOT NULL DEFAULT '0',
+ forum_last_topic_time INT UNSIGNED NOT NULL DEFAULT '0',
+ forum_posts MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
+ forum_topics MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (forum_id)
) ENGINE = MEMORY
");
@@ -40,10 +41,11 @@ function sync ($type, $id)
DB()->query("
REPLACE INTO $tmp_sync_forums
- (forum_id, forum_last_post_id, forum_posts, forum_topics)
+ (forum_id, forum_last_post_id, forum_last_topic_time, forum_posts, forum_topics)
SELECT
forum_id,
MAX(topic_last_post_id),
+ MAX(topic_time),
SUM(topic_replies) + COUNT(topic_id),
COUNT(topic_id)
FROM ". BB_TOPICS ."
@@ -55,9 +57,10 @@ function sync ($type, $id)
UPDATE
$tmp_sync_forums tmp, ". BB_FORUMS ." f
SET
- f.forum_last_post_id = tmp.forum_last_post_id,
- f.forum_posts = tmp.forum_posts,
- f.forum_topics = tmp.forum_topics
+ f.forum_last_post_id = tmp.forum_last_post_id,
+ f.forum_last_topic_time = tmp.forum_last_topic_time,
+ f.forum_posts = tmp.forum_posts,
+ f.forum_topics = tmp.forum_topics
WHERE
f.forum_id = tmp.forum_id
");
@@ -87,7 +90,6 @@ function sync ($type, $id)
topic_first_post_id INT UNSIGNED NOT NULL DEFAULT '0',
topic_last_post_id INT UNSIGNED NOT NULL DEFAULT '0',
topic_last_post_time INT UNSIGNED NOT NULL DEFAULT '0',
- topic_attachment INT UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (topic_id)
) ENGINE = MEMORY
");
@@ -102,11 +104,9 @@ function sync ($type, $id)
COUNT(p.post_id) AS total_posts,
MIN(p.post_id) AS topic_first_post_id,
MAX(p.post_id) AS topic_last_post_id,
- MAX(p.post_time) AS topic_last_post_time,
- IF(MAX(a.attach_id), 1, 0) AS topic_attachment
- FROM ". BB_TOPICS ." t
- LEFT JOIN ". BB_POSTS ." p ON(p.topic_id = t.topic_id)
- LEFT JOIN ". BB_ATTACHMENTS ." a ON(a.post_id = p.post_id)
+ MAX(p.post_time) AS topic_last_post_time
+ FROM ". BB_TOPICS ." t
+ LEFT JOIN ". BB_POSTS ." p ON(p.topic_id = t.topic_id)
WHERE t.topic_status != ". TOPIC_MOVED ."
$where_sql
GROUP BY t.topic_id
@@ -119,8 +119,7 @@ function sync ($type, $id)
t.topic_replies = tmp.total_posts - 1,
t.topic_first_post_id = tmp.topic_first_post_id,
t.topic_last_post_id = tmp.topic_last_post_id,
- t.topic_last_post_time = tmp.topic_last_post_time,
- t.topic_attachment = tmp.topic_attachment
+ t.topic_last_post_time = tmp.topic_last_post_time
WHERE
t.topic_id = tmp.topic_id
");
@@ -306,13 +305,11 @@ function topic_delete ($mode_or_topic_id, $forum_id = null, $prune_time = 0, $pr
// Delete posts, posts_text, attachments (from DB)
DB()->query("
DELETE p, pt, ps, a, d, ph
- FROM ". $tmp_delete_topics ." del
- LEFT JOIN ". BB_POSTS ." p ON(p.topic_id = del.topic_id)
- LEFT JOIN ". BB_POSTS_TEXT ." pt ON(pt.post_id = p.post_id)
- LEFT JOIN ". BB_POSTS_HTML ." ph ON(ph.post_id = p.post_id)
- LEFT JOIN ". BB_POSTS_SEARCH ." ps ON(ps.post_id = p.post_id)
- LEFT JOIN ". BB_ATTACHMENTS ." a ON(a.post_id = p.post_id)
- LEFT JOIN ". BB_ATTACHMENTS_DESC ." d ON(d.attach_id = a.attach_id)
+ FROM ". $tmp_delete_topics ." del
+ LEFT JOIN ". BB_POSTS ." p ON(p.topic_id = del.topic_id)
+ LEFT JOIN ". BB_POSTS_TEXT ." pt ON(pt.post_id = p.post_id)
+ LEFT JOIN ". BB_POSTS_HTML ." ph ON(ph.post_id = p.post_id)
+ LEFT JOIN ". BB_POSTS_SEARCH ." ps ON(ps.post_id = p.post_id)
");
// Delete topics, topics watch
@@ -477,6 +474,85 @@ function topic_move ($topic_id, $to_forum_id, $from_forum_id = null, $leave_shad
return true;
}
+function topic_lock_unlock ($topic_id, $mode, $forum_id = null)
+{
+ global $log_action;
+
+ if (!$topic_csv = get_id_csv($topic_id))
+ {
+ return false;
+ }
+ $new_topic_status = ($mode == 'lock') ? TOPIC_LOCKED : TOPIC_UNLOCKED;
+ $forum_sql = ($forum_id) ? " AND forum_id = ". (int) $forum_id : '';
+
+ $sql = "
+ SELECT topic_id, topic_title
+ FROM ". BB_TOPICS ."
+ WHERE topic_id IN($topic_csv)
+ AND topic_status != ". TOPIC_MOVED ."
+ AND topic_status != $new_topic_status
+ $forum_sql
+ ";
+
+ $topic_ary = array();
+
+ foreach (DB()->fetch_rowset($sql) as $row)
+ {
+ $topic_ary[] = $row['topic_id'];
+ $log_topics[$row['topic_id']] = $row['topic_title'];
+ }
+
+ if (!$topic_csv = get_id_csv($topic_ary))
+ {
+ return false;
+ }
+
+ DB()->query("UPDATE ". BB_TOPICS ." SET topic_status = $new_topic_status WHERE topic_id IN($topic_csv)");
+
+ // Log action
+ $type = ($mode == 'lock') ? 'mod_topic_lock' : 'mod_topic_unlock';
+
+ foreach ($log_topics as $topic_id => $topic_title)
+ {
+ $log_action->mod($type, array(
+ 'forum_id' => $forum_id,
+ 'topic_id' => $topic_id,
+ 'topic_title' => $topic_title,
+ ));
+ }
+
+ return true;
+}
+
+function topic_stick_unstick ($topic_id, $mode, $forum_id = null)
+{
+ if (!$topic_csv = get_id_csv($topic_id))
+ {
+ return false;
+ }
+ $new_topic_type = ($mode == 'stick') ? POST_STICKY : POST_NORMAL;
+ $forum_sql = ($forum_id) ? " AND forum_id = ". (int) $forum_id : '';
+
+ $sql = "
+ SELECT topic_id
+ FROM ". BB_TOPICS ."
+ WHERE topic_id IN($topic_csv)
+ AND topic_status != ". TOPIC_MOVED ."
+ AND topic_type != $new_topic_type
+ $forum_sql
+ ";
+ $topic_ary = DB()->fetch_rowset($sql, 'topic_id');
+
+ if (!$topic_csv = get_id_csv($topic_ary))
+ {
+ return false;
+ }
+
+ DB()->query("UPDATE ". BB_TOPICS ." SET topic_type = $new_topic_type WHERE topic_id IN($topic_csv)");
+
+ return ( DB()->affected_rows() > 0 );
+}
+
// $exclude_first - в режиме удаления сообщений по списку исключать первое сообщение в теме
function post_delete ($mode_or_post_id, $user_id = null, $exclude_first = true)
{
@@ -587,17 +663,15 @@ function post_delete ($mode_or_post_id, $user_id = null, $exclude_first = true)
return 0;
}
- // Delete posts, posts_text, attachments (from DB)
+ // Delete posts, posts_text
DB()->query("
- DELETE p, pt, ps, tor, a, d, ph
- FROM ". $tmp_delete_posts ." del
- LEFT JOIN ". BB_POSTS ." p ON(p.post_id = del.post_id)
- LEFT JOIN ". BB_POSTS_TEXT ." pt ON(pt.post_id = del.post_id)
- LEFT JOIN ". BB_POSTS_HTML ." ph ON(ph.post_id = del.post_id)
- LEFT JOIN ". BB_POSTS_SEARCH ." ps ON(ps.post_id = del.post_id)
- LEFT JOIN ". BB_BT_TORRENTS ." tor ON(tor.post_id = del.post_id)
- LEFT JOIN ". BB_ATTACHMENTS ." a ON(a.post_id = del.post_id)
- LEFT JOIN ". BB_ATTACHMENTS_DESC ." d ON(d.attach_id = a.attach_id)
+ DELETE p, pt, ps, tor, ph
+ FROM ". $tmp_delete_posts ." del
+ LEFT JOIN ". BB_POSTS ." p ON(p.post_id = del.post_id)
+ LEFT JOIN ". BB_POSTS_TEXT ." pt ON(pt.post_id = del.post_id)
+ LEFT JOIN ". BB_POSTS_HTML ." ph ON(ph.post_id = del.post_id)
+ LEFT JOIN ". BB_POSTS_SEARCH ." ps ON(ps.post_id = del.post_id)
+ LEFT JOIN ". BB_BT_TORRENTS ." tor ON(tor.topic_id = del.topic_id)
");
// Log action
diff --git a/library/includes/functions_post.php b/library/includes/functions_post.php
index 17cbf0ad0..3d6af1f22 100644
--- a/library/includes/functions_post.php
+++ b/library/includes/functions_post.php
@@ -121,11 +121,11 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
if ($mode == 'newtopic' || ($mode == 'editpost' && $post_data['first_post']))
{
- $topic_dl_type = (isset($_POST['topic_dl_type']) && ($post_info['allow_reg_tracker'] || $is_auth['auth_mod'])) ? TOPIC_DL_TYPE_DL : TOPIC_DL_TYPE_NORMAL;
+ $topic_dl_type = (isset($_POST['tracker_status']) && ($post_info['allow_reg_tracker'] || $is_auth['auth_mod'])) ? 1 : 0;
$sql_insert = "
INSERT INTO
- " . BB_TOPICS . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_dl_type)
+ " . BB_TOPICS . " (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, tracker_status)
VALUES
('$post_subject', " . $userdata['user_id'] . ", $current_time, $forum_id, " . TOPIC_UNLOCKED . ", $topic_type, $topic_dl_type)
";
@@ -136,7 +136,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
SET
topic_title = '$post_subject',
topic_type = $topic_type,
- topic_dl_type = $topic_dl_type
+ tracker_status = $topic_dl_type
WHERE
topic_id = $topic_id
";
diff --git a/library/includes/functions_torrent.php b/library/includes/functions_torrent.php
index a5247b5a6..0e4c09fd5 100644
--- a/library/includes/functions_torrent.php
+++ b/library/includes/functions_torrent.php
@@ -306,9 +306,8 @@ function tracker_register ($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVE
if ($row = DB()->fetch_row("SELECT topic_id FROM ". BB_BT_TORRENTS ." WHERE info_hash = '$info_hash_sql' LIMIT 1"))
{
- $msg = sprintf($lang['BT_REG_FAIL_SAME_HASH'], TOPIC_URL . $row['topic_id']);
- bb_die($msg);
set_die_append_msg($forum_id, $topic_id);
+ bb_die(sprintf($lang['BT_REG_FAIL_SAME_HASH'], TOPIC_URL . $row['topic_id']));
}
$totallen = 0;
@@ -331,8 +330,8 @@ function tracker_register ($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVE
$size = sprintf('%.0f', (float) $totallen);
- $columns = ' info_hash, post_id, poster_id, topic_id, forum_id, attach_id, size, reg_time, tor_status';
- $values = "'$info_hash_sql', $post_id, $poster_id, $topic_id, $forum_id, $attach_id, '$size', $reg_time, $tor_status";
+ $columns = ' info_hash, poster_id, topic_id, forum_id, size, reg_time, tor_status';
+ $values = "'$info_hash_sql', $poster_id, $topic_id, $forum_id, '$size', $reg_time, $tor_status";
$sql = "INSERT INTO ". BB_BT_TORRENTS ." ($columns) VALUES ($values)";
@@ -347,88 +346,98 @@ function tracker_register ($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVE
bb_die('Could not register torrent on tracker');
}
- // update tracker status for this attachment
- $sql = 'UPDATE '. BB_ATTACHMENTS_DESC ." SET tracker_status = 1 WHERE attach_id = $attach_id LIMIT 1";
+ // Set topic status
+ DB()->query("UPDATE ". BB_TOPICS ." SET tracker_status = 1 WHERE topic_id = $topic_id LIMIT 1");
- if (!DB()->sql_query($sql))
- {
- bb_die('Could not update torrent status #2');
- }
-
- // set DL-Type for topic
- if ($bb_cfg['bt_set_dltype_on_tor_reg'])
- {
- $sql = 'UPDATE '. BB_TOPICS .' SET topic_dl_type = '. TOPIC_DL_TYPE_DL ." WHERE topic_id = $topic_id LIMIT 1";
-
- if (!$result = DB()->sql_query($sql))
- {
- bb_die('Could not update topics table #2');
- }
- }
-
- if ($tr_cfg['tor_topic_up'])
- {
- DB()->query("UPDATE ". BB_TOPICS ." SET topic_last_post_time = GREATEST(topic_last_post_time, ". (TIMENOW - 3*86400) .") WHERE topic_id = $topic_id LIMIT 1");
- }
+ // Clean all peers for that torrent
+ tracker_rm_torrent($topic_id);
if ($reg_mode == 'request' || $reg_mode == 'newtopic')
{
set_die_append_msg($forum_id, $topic_id);
- $mess = sprintf($lang['BT_REGISTERED'], DOWNLOAD_URL . $attach_id);
- bb_die($mess);
+ bb_die(sprintf($lang['BT_REGISTERED'], DOWNLOAD_URL . $topic_id));
+ }
+ else if ($reg_mode == 'mcp_tor_register')
+ {
+ return 'OK';
}
return true;
}
-function send_torrent_with_passkey ($filename)
+function delete_torrent ($topic_id)
{
- global $attachment, $auth_pages, $userdata, $bb_cfg, $tr_cfg, $lang;
+ tracker_unregister($topic_id);
+ delete_attach($topic_id, 8);
- if (!$bb_cfg['bt_add_auth_key'] || $attachment['extension'] !== TORRENT_EXT || !$size = @filesize($filename))
+ return true;
+}
+
+function change_tor_status ($topic_id, $tor_status)
+{
+ global $topic_id, $userdata;
+
+ $tor_status = (int) $tor_status;
+
+ $tor = DB()->fetch_row("SELECT forum_id, poster_id FROM ". BB_BT_TORRENTS ." WHERE topic_id = ". intval($topic_id) ." LIMIT 1");
+
+ torrent_auth_check($tor['forum_id'], $tor['poster_id']);
+
+ DB()->query("
+ UPDATE ". BB_BT_TORRENTS ." SET
+ tor_status = $tor_status,
+ checked_user_id = {$userdata['user_id']},
+ checked_time = '". TIMENOW ."'
+ WHERE topic_id = $topic_id
+ LIMIT 1
+ ");
+}
+
+// Set gold / silver type for torrent
+function change_tor_type ($topic_id, $tor_status_gold)
+{
+ global $lang, $bb_cfg;
+
+ if (!IS_AM) bb_die($lang['ONLY_FOR_MOD']);
+
+ $tor_status_gold = intval($tor_status_gold);
+ $info_hash = null;
+
+ DB()->query("UPDATE ". BB_BT_TORRENTS ." SET tor_type = $tor_status_gold WHERE topic_id = $topic_id LIMIT 1");
+
+ // Ocelot
+ if ($bb_cfg['ocelot']['enabled'])
{
- return;
- }
-
- $post_id = $poster_id = $passkey_val = '';
- $user_id = $userdata['user_id'];
- $attach_id = $attachment['attach_id'];
-
- if (!$passkey_key = $bb_cfg['passkey_key'])
- {
- bb_die('Could not add passkey (wrong config $bb_cfg[\'passkey_key\'])');
- }
-
- // Get $post_id & $poster_id
- foreach ($auth_pages as $rid => $row)
- {
- if ($row['attach_id'] == $attach_id)
+ if ($row = DB()->fetch_row("SELECT info_hash FROM ". BB_BT_TORRENTS ." WHERE topic_id = $topic_id LIMIT 1"))
{
- $post_id = $row['post_id'];
- $poster_id = $row['user_id_1'];
- break;
+ $info_hash = $row['info_hash'];
}
+ ocelot_update_tracker('update_torrent', array('info_hash' => rawurlencode($info_hash), 'freetorrent' => $tor_status_gold));
}
+}
- // Get $topic_id
- $topic_id_sql = 'SELECT topic_id FROM ' . BB_POSTS . ' WHERE post_id = ' . (int) $post_id;
- if (!($topic_id_result = DB()->sql_query($topic_id_sql)))
- {
- bb_die('Could not query post information');
- }
- $topic_id_row = DB()->sql_fetchrow($topic_id_result);
- $topic_id = $topic_id_row['topic_id'];
+function send_torrent_with_passkey ($t_data)
+{
+ global $userdata, $bb_cfg, $tr_cfg, $lang;
- if (!$attachment['tracker_status'])
+ $topic_id = $t_data['topic_id'];
+ $poster_id = $t_data['topic_poster'];
+ $user_id = $t_data['user_id'];
+
+ // Запрет на скачивание закрытого или незарегистрированного торрента
+ $row = DB()->fetch_row("SELECT tor_status FROM ". BB_BT_TORRENTS ." WHERE topic_id = $topic_id LIMIT 1");
+
+ if (!isset($row['tor_status']))
{
bb_die($lang['PASSKEY_ERR_TOR_NOT_REG']);
}
-
- if (bf($userdata['user_opt'], 'user_opt', 'dis_passkey') && !IS_GUEST)
+ else if (isset($bb_cfg['tor_frozen'][$row['tor_status']]))
{
- bb_die('Could not add passkey');
+ if (!$t_data['is_am']) bb_die("Раздача имеет статус: {$lang['tor_status'][$row['tor_status']]}
Скачивание запрещено");
}
+ $passkey_val = '';
+
if ($bt_userdata = get_bt_userdata($user_id))
{
$passkey_val = $bt_userdata['auth_key'];
@@ -446,19 +455,16 @@ function send_torrent_with_passkey ($filename)
}
}
- // Ratio limits
+ // Ratio limit for torrents dl
+ $user_ratio = get_bt_ratio($bt_userdata);
$min_ratio = $bb_cfg['bt_min_ratio_allow_dl_tor'];
- if ($min_ratio && $user_id != $poster_id && ($user_ratio = get_bt_ratio($bt_userdata)) !== null)
+ if ($min_ratio && $user_id != $poster_id && !is_null($user_ratio))
{
- if ($user_ratio < $min_ratio && $post_id)
+ if ($user_ratio < $min_ratio)
{
$dl = DB()->fetch_row("
- SELECT dl.user_status
- FROM ". BB_POSTS ." p
- LEFT JOIN ". BB_BT_DLSTATUS ." dl ON dl.topic_id = p.topic_id AND dl.user_id = $user_id
- WHERE p.post_id = $post_id
- LIMIT 1
+ SELECT user_status FROM ". BB_BT_DLSTATUS ." WHERE topic_id = $topic_id AND user_id = $user_id LIMIT 1
");
if (!isset($dl['user_status']) || $dl['user_status'] != DL_STATUS_COMPLETE)
@@ -468,15 +474,67 @@ function send_torrent_with_passkey ($filename)
}
}
- // Announce URL
- $ann_url = $bb_cfg['bt_announce_url'];
+ /*
+ // лимит количества скачиваний торрент-файлов в день
+ if ($user_id != $poster_id && !$t_data['is_am'])
+ {
+ // лимит
+ $daily_dls_limit = 50;
+ if (!is_null($user_ratio) && $user_ratio >= 1 && $bt_userdata['u_up_total'] >= 107374182400 )// 100 GB
+ {
+ $daily_dls_limit = 100;
+ }
+
+ // число скачиваний
+ $daily_dls_cnt = (int) DB('dls')->fetch_row("SELECT dls_cnt FROM ". BB_USER_DLS_DAILY ." WHERE user_id = $user_id LIMIT 1", 'dls_cnt');
+
+ if ($daily_dls_cnt >= $daily_dls_limit)
+ {
+ // повторное скачивание
+ $can_redownload = DB('dls')->fetch_row("SELECT 1 FROM ". BB_BT_DLS_COUNT ." WHERE topic_id = $topic_id AND user_id = $user_id LIMIT 1");
+
+ if (!$can_redownload)
+ {
+ bb_log(join("\t", array(date('H:i:s'), $user->ip, $user->id, $topic_id))."\n", 'dls/'.date('m-d') .'-limit');
+ set_die_append_msg(null, $topic_id);
+ bb_die("Вы уже исчерпали суточный лимит скачиваний торрент-файлов
Ваш текущий лимит: $daily_dls_limit в день");
+ }
+ else
+ {
+ bb_log(join("\t", array(date('H:i:s'), $user->ip, $user->id, $topic_id))."\n", 'dls/'.date('m-d') .'-redown');
+ }
+ }
+
+ // счетчик количества скачиваний торрент-файла (для `complete_count` в BB_BT_TORRENTS)
+ DB('dls')->query("INSERT IGNORE INTO ". BB_BT_DLS_COUNT ." (topic_id, user_id) VALUES ($topic_id, $user_id)");
+
+ // если файл еще не был скачан этим юзером, увеличиваем счетчик скачиваний
+ if (DB('dls')->affected_rows() > 0)
+ {
+ DB('dls')->query("
+ INSERT IGNORE INTO ". BB_USER_DLS_DAILY ." (user_id, dls_cnt) VALUES ($user_id, 1) ON DUPLICATE KEY UPDATE dls_cnt = dls_cnt + 1
+ ");
+ }
+ }
+ */
+
+ $filename = get_attach_path($topic_id, 8);
+ if (!file_exists($filename))
+ {
+ bb_simple_die('File not found');
+ }
if (!$tor = bdecode_file($filename))
{
- bb_die('This is not a bencoded file');
+ bb_simple_die('This is not a bencoded file');
}
- $announce = $bb_cfg['ocelot']['enabled'] ? strval($bb_cfg['ocelot']['url'] .$passkey_val. "/announce") : strval($ann_url . "?$passkey_key=$passkey_val");
+ // tor cleanup
+ unset($tor['codepage']);
+ unset($tor['nodes']);
+
+ // Announce URL
+ $announce = $bb_cfg['ocelot']['enabled'] ? strval($bb_cfg['ocelot']['url'] .$passkey_val. "/announce") : strval($bb_cfg['bt_announce_url'] . "?{$bb_cfg['passkey_key']}=$passkey_val");
// Replace original announce url with tracker default
if ($bb_cfg['bt_replace_ann_url'] || !isset($tor['announce']))
@@ -491,7 +549,7 @@ function send_torrent_with_passkey ($filename)
}
elseif (isset($tor['announce-list']))
{
- $tor['announce-list'] = array_merge($tor['announce-list'], array(array($announce)));
+ $tor['announce-list'] = array_merge($tor['announce-list'], [[$announce]]);
}
// Add retracker
@@ -501,14 +559,14 @@ function send_torrent_with_passkey ($filename)
{
if (!isset($tor['announce-list']))
{
- $tor['announce-list'] = array(
- array($announce),
- array($tr_cfg['retracker_host'])
- );
+ $tor['announce-list'] = [
+ [$announce],
+ [$tr_cfg['retracker_host']]
+ ];
}
else
{
- $tor['announce-list'] = array_merge($tor['announce-list'], array(array($tr_cfg['retracker_host'])));
+ $tor['announce-list'] = array_merge($tor['announce-list'], [[$tr_cfg['retracker_host']]]);
}
}
}
@@ -546,7 +604,7 @@ function send_torrent_with_passkey ($filename)
function generate_passkey ($user_id, $force_generate = false)
{
- global $bb_cfg, $lang, $sql;
+ global $bb_cfg, $lang;
$user_id = (int) $user_id;
@@ -568,6 +626,9 @@ function generate_passkey ($user_id, $force_generate = false)
}
}
+ // Delete all active user records in tracker
+ tracker_rm_user($user_id);
+
for ($i=0; $i < 20; $i++)
{
$passkey_val = make_rand_str(BT_AUTH_KEY_LENGTH);
@@ -601,41 +662,15 @@ function generate_passkey ($user_id, $force_generate = false)
return false;
}
-function tracker_rm_torrent ($topic_id)
-{
- return DB()->sql_query("DELETE FROM ". BB_BT_TRACKER ." WHERE topic_id = ". (int) $topic_id);
-}
-
-function tracker_rm_user ($user_id)
-{
- return DB()->sql_query("DELETE FROM ". BB_BT_TRACKER ." WHERE user_id = ". (int) $user_id);
-}
-
-function get_registered_torrents ($id, $mode)
-{
- $field = ($mode == 'topic') ? 'topic_id' : 'post_id';
-
- $sql = "SELECT topic_id FROM ". BB_BT_TORRENTS ." WHERE $field = $id LIMIT 1";
-
- if (!$result = DB()->sql_query($sql))
- {
- bb_die('Could not query torrent id');
- }
-
- if ($rowset = @DB()->sql_fetchrowset($result))
- {
- return $rowset;
- }
- else
- {
- return false;
- }
-}
-
function torrent_error_exit ($message)
{
global $reg_mode, $return_message, $lang;
+ if (isset($reg_mode) && $reg_mode == 'mcp_tor_register')
+ {
+ return $message;
+ }
+
$msg = '';
if (isset($reg_mode) && ($reg_mode == 'request' || $reg_mode == 'newtopic'))
@@ -650,6 +685,16 @@ function torrent_error_exit ($message)
bb_die($msg . $message);
}
+function tracker_rm_torrent ($topic_id)
+{
+ return DB()->sql_query("DELETE FROM ". BB_BT_TRACKER ." WHERE topic_id = ". (int) $topic_id);
+}
+
+function tracker_rm_user ($user_id)
+{
+ return DB()->sql_query("DELETE FROM ". BB_BT_TRACKER ." WHERE user_id = ". (int) $user_id);
+}
+
function ocelot_update_tracker ($action, $updates)
{
global $bb_cfg;
diff --git a/library/includes/init_bb.php b/library/includes/init_bb.php
index b78ae5a1f..439211d07 100644
--- a/library/includes/init_bb.php
+++ b/library/includes/init_bb.php
@@ -234,9 +234,6 @@ $bb_cfg['tor_no_tor_act'] = array(
// Table names
define('BUF_TOPIC_VIEW', 'buf_topic_view');
define('BUF_LAST_SEEDER', 'buf_last_seeder');
-define('BB_ATTACH_CONFIG', 'bb_attachments_config');
-define('BB_ATTACHMENTS_DESC', 'bb_attachments_desc');
-define('BB_ATTACHMENTS', 'bb_attachments');
define('BB_AUTH_ACCESS_SNAP', 'bb_auth_access_snap');
define('BB_AUTH_ACCESS', 'bb_auth_access');
define('BB_BANLIST', 'bb_banlist');
@@ -250,8 +247,6 @@ define('BB_CATEGORIES', 'bb_categories');
define('BB_CONFIG', 'bb_config');
define('BB_CRON', 'bb_cron');
define('BB_DISALLOW', 'bb_disallow');
-define('BB_EXTENSION_GROUPS', 'bb_extension_groups');
-define('BB_EXTENSIONS', 'bb_extensions');
define('BB_FORUMS', 'bb_forums');
define('BB_GROUPS', 'bb_groups');
define('BB_LOG', 'bb_log');
@@ -275,11 +270,6 @@ define('BB_USER_GROUP', 'bb_user_group');
define('BB_USERS', 'bb_users');
define('BB_WORDS', 'bb_words');
-define('TORRENT_EXT', 'torrent');
-
-define('TOPIC_DL_TYPE_NORMAL', 0);
-define('TOPIC_DL_TYPE_DL', 1);
-
define('SHOW_PEERS_COUNT', 1);
define('SHOW_PEERS_NAMES', 2);
define('SHOW_PEERS_FULL', 3);
diff --git a/library/includes/torrent_announce_urls.php b/library/includes/torrent_announce_urls.php
deleted file mode 100644
index dd8dfeca0..000000000
--- a/library/includes/torrent_announce_urls.php
+++ /dev/null
@@ -1,11 +0,0 @@
-assign_vars(array('DL_BUTTONS' => false));
$count_mode = ($bb_cfg['bt_dl_list_only_count'] && !(@$_GET['dl'] === 'names'));
-$dl_topic = ($t_data['topic_dl_type'] == TOPIC_DL_TYPE_DL && !($bb_cfg['bt_dl_list_only_1st_page'] && $start));
+$dl_topic = ($t_data['tracker_status'] && !($bb_cfg['bt_dl_list_only_1st_page'] && $start));
$show_dl_list = ($dl_topic && ($bb_cfg['bt_show_dl_list'] || ($bb_cfg['allow_dl_list_names_mode'] && @$_GET['dl'] === 'names')));
$show_dl_buttons = ($dl_topic && $bb_cfg['bt_show_dl_list_buttons']);
// link to clear DL-List
$template->assign_vars(array('S_DL_DELETE' => false));
-if (($is_auth['auth_mod']) && ($t_data['topic_dl_type'] == TOPIC_DL_TYPE_DL))
+if ($is_auth['auth_mod'] && $t_data['tracker_status'])
{
$s_dl_delete = "'. $lang['DL_LIST_DEL'] .'';
$template->assign_vars(array('S_DL_DELETE' => $s_dl_delete));
diff --git a/library/includes/viewtopic_torrent.php b/library/includes/viewtopic_torrent.php
index c99254e03..061a474cb 100644
--- a/library/includes/viewtopic_torrent.php
+++ b/library/includes/viewtopic_torrent.php
@@ -146,11 +146,27 @@ if ($tor_auth)
}
}
-if ($tor_reged && $tor_info)
+if (!$tor_reged)
{
- $tor_size = ($tor_info['size']) ? $tor_info['size'] : 0;
- $tor_id = $tor_info['topic_id'];
- $tor_type = $tor_info['tor_type'];
+ $template->assign_vars(array(
+ 'SHOW_TOR_NOT_REGGED' => true,
+ 'TRACKER_REG_LINK' => $tr_reg_link,
+ ));
+}
+else
+{
+ $tor_info = DB()->fetch_row("SELECT * FROM ". BB_BT_TORRENTS ." WHERE topic_id = $topic_id LIMIT 1");
+}
+
+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');
+}
+
+if ($tor_reged)
+{
+ $tor_size = (int) $tor_info['size'];
// Magnet link
$passkey = DB()->fetch_row("SELECT auth_key FROM ". BB_BT_USERS ." WHERE user_id = ". (int) $bt_user_id ." LIMIT 1");
@@ -175,7 +191,7 @@ if ($tor_reged && $tor_info)
$sql = "SELECT user_status
FROM ". BB_BT_DLSTATUS ."
WHERE user_id = $bt_user_id
- AND topic_id = $bt_topic_id
+ AND topic_id = $topic_id
LIMIT 1";
}
@@ -201,7 +217,6 @@ if ($tor_reged && $tor_info)
if (!$dl_allowed)
{
- $template->assign_block_vars('postrow.attach.tor_reged', array());
$template->assign_vars(array(
'TOR_BLOCKED' => true,
'TOR_BLOCKED_MSG' => sprintf($lang['BT_LOW_RATIO_FOR_DL'], round($user_ratio, 2), "search.php?dlu=$bt_user_id&dlc=1"),
@@ -209,47 +224,31 @@ if ($tor_reged && $tor_info)
}
else
{
- $template->assign_block_vars('postrow.attach.tor_reged', array(
- 'DOWNLOAD_NAME' => $display_name,
- 'TRACKER_LINK' => $tracker_link,
- 'ATTACH_ID' => $attach_id,
- 'TOR_SILVER_GOLD' => $tor_type,
+ $template->assign_vars(array(
+ 'DOWNLOAD_NAME' => '['.$bb_cfg['server_name'].'].t' . $topic_id . '.torrent',
+ 'TOR_SILVER_GOLD' => $tor_info['tor_type'],
- // torrent status mod
'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']) ? (' · '. profile_url($tor_info) .' · '. delta_time($tor_info['checked_time']) . $lang['TOR_BACK'] .'') : '',
'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,
- //end torrent status mod
- 'S_UPLOAD_IMAGE' => $upload_image,
- 'U_DOWNLOAD_LINK' => $download_link,
'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'], $download_count),
+ 'DOWNLOAD_COUNT' => sprintf($lang['DOWNLOAD_NUMBER'], 666/*$download_count*/),
'REGED_TIME' => bb_date($tor_info['reg_time']),
'REGED_DELTA' => delta_time($tor_info['reg_time']),
'TORRENT_SIZE' => humn_size($tor_size),
'COMPLETED' => sprintf($lang['DOWNLOAD_NUMBER'], $tor_info['complete_count']),
- ));
-
- if ($comment)
- {
- $template->assign_block_vars('postrow.attach.tor_reged.comment', array('COMMENT' => $comment));
- }
- }
-
- if ($bb_cfg['show_tor_info_in_dl_list'])
- {
- $template->assign_vars(array(
- 'SHOW_DL_LIST' => true,
- 'SHOW_DL_LIST_TOR_INFO' => true,
+ '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'),
@@ -257,7 +256,20 @@ if ($tor_reged && $tor_info)
}
// Show peers
- if ($show_peers)
+ if ($tor_info['tor_status'] == TOR_CLOSED_CPHOLD)
+ {
+ $closed_by_cphold = true;
+
+ $template->assign_vars(array(
+ 'TOR_CLOSED_BY_CPHOLD' => true,
+ 'TOR_CONTROLS' => false,
+ 'DL_BUTTONS' => false,
+ 'CPHOLD_UID' => $tor_info['tor_status_uid'],
+ 'CPHOLD_NAME' => $tor_status_username,
+ 'CAN_OPEN_CH_RELEASE' => ($is_auth['auth_mod'] || IS_CP_HOLDER),
+ ));
+ }
+ else
{
// Sorting order in full mode
if ($s_mode == 'full')
@@ -303,14 +315,14 @@ if ($tor_reged && $tor_info)
{
$sql = "SELECT seeders, leechers, speed_up, speed_down
FROM ". BB_BT_TRACKER_SNAP ."
- WHERE topic_id = $tor_id
+ WHERE topic_id = $topic_id
LIMIT 1";
}
else if ($s_mode == 'names')
{
$sql = "SELECT tr.user_id, tr.ip, tr.port, tr.remain, tr.seeder, u.username, u.user_rank
FROM ". BB_BT_TRACKER ." tr, ". BB_USERS ." u
- WHERE tr.topic_id = $tor_id
+ WHERE tr.topic_id = $topic_id
AND u.user_id = tr.user_id
GROUP BY tr.ip, tr.user_id, tr.port, tr.seeder
ORDER BY u.username
@@ -324,7 +336,7 @@ if ($tor_reged && $tor_info)
tr.complete_percent, u.username, u.user_rank
FROM ". BB_BT_TRACKER ." tr
LEFT JOIN ". BB_USERS ." u ON u.user_id = tr.user_id
- WHERE tr.topic_id = $tor_id
+ WHERE tr.topic_id = $topic_id
GROUP BY tr.ip, tr.user_id, tr.port, tr.seeder
ORDER BY $full_mode_order $full_mode_sort_dir
LIMIT $show_peers_limit";
@@ -489,10 +501,6 @@ if ($tor_reged && $tor_info)
$sp_up = ($peer['speed_up']) ? humn_size($peer['speed_up'], 0, 'KB') .'/s' : '-';
$sp_down = ($peer['speed_down']) ? humn_size($peer['speed_down'], 0, 'KB') .'/s' : '-';
- $bgr_class = (!($tr[$x] % 2)) ? $bgr_class_1 : $bgr_class_2;
- $row_bgr = ($change_peers_bgr_over) ? " class=\"$bgr_class\" onmouseover=\"this.className='$bgr_class_over';\" onmouseout=\"this.className='$bgr_class';\"" : '';
- $tr[$x]++;
-
$template->assign_block_vars("$x_full.$x_row", array(
'ROW_BGR' => $row_bgr,
'NAME' => ($peer['update_time']) ? $name : "$name",
@@ -569,7 +577,7 @@ if ($tor_reged && $tor_info)
}
}
- $template->assign_block_vars('tor_title', array('U_DOWNLOAD_LINK' => $download_link));
+ //$template->assign_block_vars('tor_title', array('U_DOWNLOAD_LINK' => $download_link));
if ($peers_cnt > $max_peers_before_overflow && $s_mode == 'full')
{
@@ -586,15 +594,14 @@ if ($bb_cfg['bt_allow_spmode_change'] && $s_mode != 'full')
{
$template->assign_vars(array(
'PEERS_FULL_LINK' => true,
- 'SPMODE_FULL_HREF' => "viewtopic.php?". POST_TOPIC_URL ."=$bt_topic_id&spmode=full#seeders",
+ 'SPMODE_FULL_HREF' => "viewtopic.php?". POST_TOPIC_URL ."=$topic_id&spmode=full#seeders",
));
}
$template->assign_vars(array(
- 'SHOW_DL_LIST_LINK' => (($bb_cfg['bt_show_dl_list'] || $bb_cfg['allow_dl_list_names_mode']) && $t_data['topic_dl_type'] == TOPIC_DL_TYPE_DL),
+ '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)),
'S_MODE_COUNT' => ($s_mode == 'count'),
- 'S_MODE_NAMES' => ($s_mode == 'names'),
'S_MODE_FULL' => ($s_mode == 'full'),
'PEER_EXIST' => ($seeders || $leechers || defined('SEEDER_EXIST') || defined('LEECHER_EXIST')),
'SEED_EXIST' => ($seeders || defined('SEEDER_EXIST')),
diff --git a/library/language/en/main.php b/library/language/en/main.php
index 7fb83dd7a..22b1bd1b6 100644
--- a/library/language/en/main.php
+++ b/library/language/en/main.php
@@ -2229,8 +2229,6 @@ $lang['BT_ANNOUNCE_URL'] = 'Announce url';
$lang['BT_ANNOUNCE_URL_EXPL'] = 'you can define additional allowed urls in "includes/torrent_announce_urls.php"';
$lang['BT_DISABLE_DHT'] = 'Disable DHT network';
$lang['BT_DISABLE_DHT_EXPL'] = 'Disable Peer Exchange and DHT (recommended for private networks, only url announce)';
-$lang['BT_CHECK_ANNOUNCE_URL'] = 'Verify announce url';
-$lang['BT_CHECK_ANNOUNCE_URL_EXPL'] = 'register on tracker only allowed urls';
$lang['BT_REPLACE_ANN_URL'] = 'Replace announce url';
$lang['BT_REPLACE_ANN_URL_EXPL'] = 'replace original announce url with your default in .torrent files';
$lang['BT_DEL_ADDIT_ANN_URLS'] = 'Remove all additional announce urls';
@@ -2258,9 +2256,6 @@ $lang['BT_SHOW_DL_BUT_DOWN'] = $lang['DLDOWN'];
$lang['BT_SHOW_DL_BUT_COMPL'] = $lang['DLCOMPLETE'];
$lang['BT_SHOW_DL_BUT_CANCEL'] = $lang['DLCANCEL'];
-$lang['BT_ADD_AUTH_KEY_HEAD'] = 'Passkey';
-$lang['BT_ADD_AUTH_KEY'] = 'Enable adding passkey to the torrent-files before downloading';
-
$lang['BT_TOR_BROWSE_ONLY_REG_HEAD'] = 'Torrent browser (tracker)';
$lang['BT_TOR_BROWSE_ONLY_REG'] = 'Torrent browser (tracker.php) accessible only for logged in users';
$lang['BT_SEARCH_BOOL_MODE'] = 'Allow boolean full-text searches';
diff --git a/library/language/ru/main.php b/library/language/ru/main.php
index 274a7894e..f271eaac0 100644
--- a/library/language/ru/main.php
+++ b/library/language/ru/main.php
@@ -2229,8 +2229,6 @@ $lang['BT_ANNOUNCE_URL'] = 'Announce url';
$lang['BT_ANNOUNCE_URL_EXPL'] = 'дополнительные разрешенные адреса можно задать в "includes/torrent_announce_urls.php"';
$lang['BT_DISABLE_DHT'] = 'Запретить DHT сети';
$lang['BT_DISABLE_DHT_EXPL'] = 'Запретить обмен пирами и DHT (рекомендовано для приватных сетей, только url announce)';
-$lang['BT_CHECK_ANNOUNCE_URL'] = 'Проверять announce url';
-$lang['BT_CHECK_ANNOUNCE_URL_EXPL'] = 'разрешить регистрацию на трекере только если announce url входит в список разрешенных';
$lang['BT_REPLACE_ANN_URL'] = 'Заменять announce url';
$lang['BT_REPLACE_ANN_URL_EXPL'] = 'заменять оригинальный announce url в .torrent файлах на ваш';
$lang['BT_DEL_ADDIT_ANN_URLS'] = 'Удалять все дополнительные announce urls';
@@ -2258,9 +2256,6 @@ $lang['BT_SHOW_DL_BUT_DOWN'] = $lang['DLDOWN'];
$lang['BT_SHOW_DL_BUT_COMPL'] = $lang['DLCOMPLETE'];
$lang['BT_SHOW_DL_BUT_CANCEL'] = $lang['DLCANCEL'];
-$lang['BT_ADD_AUTH_KEY_HEAD'] = 'Passkey';
-$lang['BT_ADD_AUTH_KEY'] = 'Aвтодобавление passkey к торрент-файлам перед их скачиванием';
-
$lang['BT_TOR_BROWSE_ONLY_REG_HEAD'] = 'Torrent browser (трекер)';
$lang['BT_TOR_BROWSE_ONLY_REG'] = 'Torrent browser (tracker.php) не доступен для гостей';
$lang['BT_SEARCH_BOOL_MODE'] = 'Разрешить полнотекстовый поиск в логическом режиме';
diff --git a/library/language/uk/main.php b/library/language/uk/main.php
index d4d6a2e65..75c1e619f 100644
--- a/library/language/uk/main.php
+++ b/library/language/uk/main.php
@@ -2229,8 +2229,6 @@ $lang['BT_ANNOUNCE_URL'] = 'Announce url';
$lang['BT_ANNOUNCE_URL_EXPL'] = 'додаткові дозволені адреси можна задати в "includes/torrent_announce_urls.php"';
$lang['BT_DISABLE_DHT'] = 'Заборонити DHT мережі';
$lang['BT_DISABLE_DHT_EXPL'] = 'Заборонити обмін пiрами та DHT (рекомендовано для приватних мереж, тільки url announce)';
-$lang['BT_CHECK_ANNOUNCE_URL'] = 'Перевіряти announce url';
-$lang['BT_CHECK_ANNOUNCE_URL_EXPL'] = 'дозволити реєстрацію на трекері тільки якщо announce url входить до списка дозволених';
$lang['BT_REPLACE_ANN_URL'] = 'Заміняти announce url';
$lang['BT_REPLACE_ANN_URL_EXPL'] = 'заміняти оригінальний announce url у .torrent файлах на ваш';
$lang['BT_DEL_ADDIT_ANN_URLS'] = 'Видалити всі додаткові announce urls';
@@ -2258,9 +2256,6 @@ $lang['BT_SHOW_DL_BUT_DOWN'] = $lang['DLDOWN'];
$lang['BT_SHOW_DL_BUT_COMPL'] = $lang['DLCOMPLETE'];
$lang['BT_SHOW_DL_BUT_CANCEL'] = $lang['DLCANCEL'];
-$lang['BT_ADD_AUTH_KEY_HEAD'] = 'Passkey';
-$lang['BT_ADD_AUTH_KEY'] = 'Автододавання passkey до торрент-файлів перед їх скачуванням';
-
$lang['BT_TOR_BROWSE_ONLY_REG_HEAD'] = 'Torrent browser (трекер)';
$lang['BT_TOR_BROWSE_ONLY_REG'] = 'Torrent browser (tracker.php) не доступний для гостей';
$lang['BT_SEARCH_BOOL_MODE'] = 'Дозволити повнотекстовий пошук в логічному режимі';
diff --git a/modcp.php b/modcp.php
index 4a2b9a70e..8ca09ec5a 100644
--- a/modcp.php
+++ b/modcp.php
@@ -399,11 +399,11 @@ switch ($mode)
case 'set_download':
case 'unset_download':
$set_download = ($mode == 'set_download');
- $new_dl_type = ($set_download) ? TOPIC_DL_TYPE_DL : TOPIC_DL_TYPE_NORMAL;
+ $new_dl_type = ($set_download) ? 1 : 0;
DB()->query("
UPDATE ". BB_TOPICS ." SET
- topic_dl_type = $new_dl_type
+ tracker_status = $new_dl_type
WHERE topic_id IN($topic_csv)
AND forum_id = $forum_id
AND topic_moved_id = 0
diff --git a/posting.php b/posting.php
index fb693f640..00fe513f0 100644
--- a/posting.php
+++ b/posting.php
@@ -9,7 +9,7 @@ require(INC_DIR .'functions_post.php');
// Start session management
$user->session_start();
-$page_cfg['load_tpl_vars'] = array('post_icons');
+$page_cfg['load_tpl_vars'] = ['post_icons'];
$submit = (bool) @$_REQUEST['post'];
$preview = (bool) @$_REQUEST['preview'];
@@ -23,15 +23,13 @@ $mode = (string) @$_REQUEST['mode'];
$confirm = isset($_POST['confirm']);
-$orig_word = $replacement_word = array();
+$orig_word = $replacement_word = [];
// Set topic type
$topic_type = (@$_POST['topictype']) ? (int) $_POST['topictype'] : POST_NORMAL;
-$topic_type = in_array($topic_type, array(POST_NORMAL, POST_STICKY, POST_ANNOUNCE)) ? $topic_type : POST_NORMAL;
+$topic_type = in_array($topic_type, [POST_NORMAL, POST_STICKY, POST_ANNOUNCE]) ? $topic_type : POST_NORMAL;
-$selected_rg = 0;
-$switch_rg_sig = 0;
-$switch_poster_rg_sig = 0;
+$selected_rg = $switch_rg_sig = $switch_poster_rg_sig = 0;
if ($mode == 'smilies')
{
@@ -384,7 +382,7 @@ 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);
+ //$attachment_mod['posting']->insert_attachment($post_id);
if (!$error_msg)
{
@@ -396,7 +394,42 @@ elseif ( ($submit || $confirm) && !$topic_has_new_posts )
set_tracks(COOKIE_TOPIC, $tracking_topics, $topic_id);
}
- if (defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg)
+ // новая тема или редактирование 1-го сообщения и нет уже прикрепленного файла
+ $can_attach_file = (($mode == 'newtopic' || ($post_data['first_post'] && $mode == 'editpost')) && empty($post_info['attach_ext_id']));
+
+ if ($can_attach_file && !empty($_FILES['attach']['name']))
+ {
+ $upload = new Upload();
+
+ if ($upload->init($bb_cfg['attach'], $_FILES['attach']) AND $upload->store('attach', array('topic_id' => $topic_id)))
+ {
+ DB()->query("
+ UPDATE ". BB_TOPICS ." SET
+ attach_ext_id = ". (int) $upload->file_ext_id .",
+ filesize = ". (int) $upload->file_size ."
+ WHERE topic_id = $topic_id
+ LIMIT 1
+ ");
+ if ($upload->file_ext_id == 8)
+ {
+ require_once(INC_DIR .'functions_torrent.php');
+ tracker_register($topic_id, 'newtopic', TOR_NOT_APPROVED); # --> exit
+ }
+ }
+ else
+ {
+ $return_to_edit_link = 'Вернуться к редактированию сообщения';
+ $return_message = '
+ '. join('
', $upload->errors) ."
+
+ $return_to_edit_link
+
-
- {L_ADD_ATTACHMENT_EXPLAIN} - |
- {RULES} | -
{TOR_BLOCKED_MSG} |
{$bb_cfg['bt_ratio_warning_msg']} |
{$bb_cfg['tor_help_links_top']} | +||
Торрент: | +Зарегистрирован{TRACKER_REG_LINK} [ {REGED_TIME} ] | +
+
+ Скачать .torrent + + + + +{FILESIZE} + + |
+
Статус: | +style="padding: 6px 4px;"> + {TOR_STATUS_ICON} {TOR_STATUS_TEXT} + + · {TOR_STATUS_USERNAME} · {TOR_STATUS_TIME} назад + + + + + Изменить на: + [ Изменить ] + + + + | +|
.torrent скачан: | +{TOR_COMPLETED} | +|
Размер: | +{TOR_SIZE} | +|
+ + + + {$bb_cfg['tor_help_links_bottom']} + + + + | +
Статистика раздачи | +||||||||||||||||||||||||||||||||||||
+ Ссылка закрыта по просьбе правообладателяЗакрыто по просьбе правообладателя {CPHOLD_MANE}
+
+ [ Открыть ]
+
+ |
+ ||||||||||||||||||||||||||||||||||||
+ Размер: {TOR_SIZE} | Зарегистрирован: {TOR_LONGEVITY} | .torrent скачан: {TOR_COMPLETED} + | +||||||||||||||||||||||||||||||||||||
+
+
+ {SEEDER_LAST_SEEN} + + + +
+
+ Сиды: {SEED_COUNT} [ {TOR_SPEED_UP} ]
+
+
+
+ Личи: {LEECH_COUNT} [ {TOR_SPEED_DOWN} ]
+
+
+
+ Подробная статистика пиров
+
+
+
+
+ |
+ ||||||||||||||||||||||||||||||||||||
+
+
+
+
+
+
+
+
+
+
+ {SEEDER_LAST_SEEN} +
+
+
+
+
+
+
+
+
показаны данные только за текущую сессию
+
+ |
+ ||||||||||||||||||||||||||||||||||||
+ + Добавить в «Будущие закачки» + · + Удалить из списка закачек + | +