From c2bceb9fc5a96debab81f8d177be42e5e088475d Mon Sep 17 00:00:00 2001 From: "dimka3210@gmail.com" Date: Thu, 14 Aug 2014 20:39:42 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20retracker.local=20=D1=87=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=B7=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- upload/admin/admin_bt_tracker_cfg.php | 1 + upload/config.php | 2 ++ upload/download.php | 17 ++--------------- upload/includes/functions_torrent.php | 12 ++++++++++-- upload/language/en/main.php | 1 + upload/language/ru/main.php | 1 + upload/language/ua/main.php | 2 +- upload/templates/admin/admin_bt_tracker_cfg.tpl | 9 ++++++++- 8 files changed, 26 insertions(+), 19 deletions(-) diff --git a/upload/admin/admin_bt_tracker_cfg.php b/upload/admin/admin_bt_tracker_cfg.php index 15aa17714..e1ea09395 100644 --- a/upload/admin/admin_bt_tracker_cfg.php +++ b/upload/admin/admin_bt_tracker_cfg.php @@ -27,6 +27,7 @@ $default_cfg_bool = array( 'update_dlstat' => 1, 'limit_active_tor' => 0, 'limit_concurrent_ips' => 0, + 'retracker_local' => 0 ); $default_cfg_num = array( diff --git a/upload/config.php b/upload/config.php index 35571b489..9acacc759 100644 --- a/upload/config.php +++ b/upload/config.php @@ -188,6 +188,8 @@ $tr_cfg = array( 'limit_leech_ips' => 0, 'tor_topic_up' => true, 'gold_silver_enabled' => true, + 'retracker_local' => false, + 'retracker_local_host' => 'http://retracker.local', ); $bb_cfg['show_dl_status_in_search'] = true; diff --git a/upload/download.php b/upload/download.php index aeb524e18..4596bed24 100644 --- a/upload/download.php +++ b/upload/download.php @@ -32,19 +32,6 @@ function send_file_to_browser($attachment, $upload_dir) $gotit = true; } - // - // Determine the Browser the User is using, because of some nasty incompatibilities. - // Most of the methods used in this function are from phpMyAdmin. :) - // - if (!empty($_SERVER['HTTP_USER_AGENT'])) - { - $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT']; - } - elseif (!isset($HTTP_USER_AGENT)) - { - $HTTP_USER_AGENT = ''; - } - // Correct the mime type - we force application/octet-stream for all files, except images // Please do not change this, it is a security precaution if (!strstr($attachment['mimetype'], 'image')) @@ -62,8 +49,8 @@ function send_file_to_browser($attachment, $upload_dir) // Now the tricky part... let's dance header('Pragma: public'); $real_filename = clean_filename(basename($attachment['real_filename'])); - $mimetype = "{$attachment['mimetype']};"; - $charset = (@$lang['CONTENT_ENCODING']) ? "charset={$lang['CONTENT_ENCODING']};" : ''; + $mimetype = $attachment['mimetype'].';'; + $charset = (isset($lang['CONTENT_ENCODING'])) ? "charset={$lang['CONTENT_ENCODING']};" : ''; // Send out the Headers header("Content-Type: $mimetype $charset name=\"$real_filename\""); diff --git a/upload/includes/functions_torrent.php b/upload/includes/functions_torrent.php index cf3c516ab..7abdf44f3 100644 --- a/upload/includes/functions_torrent.php +++ b/upload/includes/functions_torrent.php @@ -354,7 +354,7 @@ function tracker_register ($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVE function send_torrent_with_passkey ($filename) { - global $attachment, $auth_pages, $userdata, $bb_cfg, $lang; + global $attachment, $auth_pages, $userdata, $bb_cfg, $tr_cfg, $lang; if (!$bb_cfg['bt_add_auth_key'] || $attachment['extension'] !== TORRENT_EXT || !$size = @filesize($filename)) { @@ -456,11 +456,19 @@ function send_torrent_with_passkey ($filename) { unset($tor['announce-list']); } - elseif (@$tor['announce-list']) + elseif (isset($tor['announce-list'])) { $tor['announce-list'] = array_merge($tor['announce-list'], array(array($announce))); } + // Add retracker.local + if (isset($tr_cfg['retracker_local']) && $tr_cfg['retracker_local']) { + if (!isset($tor['announce-list'])) { + $tor['announce-list'] = array(); + } + $tor['announce-list'][] = array($tr_cfg['retracker_local_host']); + } + // Add publisher & topic url $publisher_name = $bb_cfg['server_name']; $publisher_url = make_url(TOPIC_URL . $topic_id); diff --git a/upload/language/en/main.php b/upload/language/en/main.php index 345f8e734..15d076349 100644 --- a/upload/language/en/main.php +++ b/upload/language/en/main.php @@ -2555,6 +2555,7 @@ $lang['USE_AUTH_KEY_EXPL'] = 'enable check for passkey'; $lang['AUTH_KEY_NAME'] = 'Passkey name'; $lang['AUTH_KEY_NAME_EXPL'] = 'passkey key name in GET request'; $lang['ALLOW_GUEST_DL'] = 'Allow guest access to tracker'; +$lang['RETRACKER_LOCAL'] = 'Add retracker.local'; // // Forum config diff --git a/upload/language/ru/main.php b/upload/language/ru/main.php index 8d482a76f..d307a8914 100644 --- a/upload/language/ru/main.php +++ b/upload/language/ru/main.php @@ -2555,6 +2555,7 @@ $lang['USE_AUTH_KEY_EXPL'] = 'включить авторизацию по passk $lang['AUTH_KEY_NAME'] = 'Имя ключа passkey'; $lang['AUTH_KEY_NAME_EXPL'] = 'имя ключа, который будет добавляться в GET запросе к announce url для идентификации юзера'; $lang['ALLOW_GUEST_DL'] = 'Разрешить "гостям" (неавторизованным юзерам) доступ к трекеру'; +$lang['RETRACKER_LOCAL'] = 'Добавлять retracker.local'; // // Forum config diff --git a/upload/language/ua/main.php b/upload/language/ua/main.php index 0544aca1f..13858a895 100644 --- a/upload/language/ua/main.php +++ b/upload/language/ua/main.php @@ -2555,7 +2555,7 @@ $lang['USE_AUTH_KEY_EXPL'] = 'включити авторизацію по passk $lang['AUTH_KEY_NAME'] = "Ім'я ключа passkey"; $lang['AUTH_KEY_NAME_EXPL'] = "ім'я ключа, який буде додаватися до GET запиті до announce url для ідентифікації користувача"; $lang['ALLOW_GUEST_DL'] = "Дозволити 'гостям' (неавторизованим юзерам) доступ до трекера"; - +$lang['RETRACKER_LOCAL'] = 'Додавати retracker.local'; // // Forum config // diff --git a/upload/templates/admin/admin_bt_tracker_cfg.tpl b/upload/templates/admin/admin_bt_tracker_cfg.tpl index f14150ae0..a494fb254 100644 --- a/upload/templates/admin/admin_bt_tracker_cfg.tpl +++ b/upload/templates/admin/admin_bt_tracker_cfg.tpl @@ -51,7 +51,14 @@

{L_ALLOW_GUEST_DL}

{L_ALLOW_GUEST_DL_EXPL}
  {L_NO}{L_YES} - + +

{L_RETRACKER_LOCAL}

+ + + + + {L_LIMIT_ACTIVE_TOR_HEAD}