diff --git a/upload/bt/announce.php b/upload/bt/announce.php index 3cda7ff00..2d49235e8 100644 --- a/upload/bt/announce.php +++ b/upload/bt/announce.php @@ -4,6 +4,13 @@ define('IN_TRACKER', true); define('BB_ROOT', './../'); require(BB_ROOT .'common.php'); +if($bb_cfg['announce_type'] == 'xbt') +{ + $url = $bb_cfg['announce_xbt'] . str_replace('/bt/announce.php', '/announce', $_SERVER['REQUEST_URI']); + header("Location: $url"); + exit; +} + if (empty($_SERVER['HTTP_USER_AGENT'])) { header('Location: http://127.0.0.1', true, 301); diff --git a/upload/bt/scrape.php b/upload/bt/scrape.php index f68835768..20643eb4b 100644 --- a/upload/bt/scrape.php +++ b/upload/bt/scrape.php @@ -9,6 +9,13 @@ if (!$tr_cfg['scrape']) msg_die('Please disable SCRAPE!'); } +if($bb_cfg['announce_type'] == 'xbt') +{ + $url = $bb_cfg['announce_xbt'] . str_replace('/bt/scrape.php', '/scrape', $_SERVER['REQUEST_URI']); + header("Location: $url"); + exit; +} + // Recover info_hash if (isset($_GET['?info_hash']) && !isset($_GET['info_hash'])) { diff --git a/upload/common.php b/upload/common.php index 8886f4185..c5ba0ee11 100644 --- a/upload/common.php +++ b/upload/common.php @@ -13,8 +13,6 @@ if (!defined('IN_PHPBB') && !defined('IN_TRACKER')) define('IN_PHPBB', true); require(BB_ROOT .'config.php'); require(BB_ROOT .'config_mods.php'); -if (!defined('DBCHARSET')) define('DBCHARSET', 'utf8'); - $server_protocol = ($bb_cfg['cookie_secure']) ? 'https://' : 'http://'; $server_port = ($bb_cfg['server_port'] != 80) ? ':'. $bb_cfg['server_port'] : ''; define('FORUM_PATH', $bb_cfg['script_path']); diff --git a/upload/config.php b/upload/config.php index d4d2e679f..c148f0fb0 100644 --- a/upload/config.php +++ b/upload/config.php @@ -106,8 +106,26 @@ $bb_cfg['cache']['engines'] = array( // Available datastore types: memcache, sqlite, redis, eaccelerator, apc, xcache (default of mysql) $bb_cfg['datastore_type'] = 'filecache'; +// Server +$bb_cfg['server_name'] = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : 'torrentpier.me'; // The domain name from which this board runs +$bb_cfg['server_port'] = (!empty($_SERVER['SERVER_PORT'])) ? $_SERVER['SERVER_PORT'] : 80; // The port your server is running on +$bb_cfg['script_path'] = '/'; // The path where FORUM is located relative to the domain name +$bb_cfg['sitename'] = 'TorrentPier II - Torrent Tracker (see $bb_cfg[\'sitename\'] in config.php)'; // Name of your site + +// Server load +$bb_cfg['max_srv_load'] = 0; // 0 - disable +$bb_cfg['tr_working_second'] = 0; // 0 - disable + +// Backup +$bb_cfg['db_backup_shell_cmd'] = ''; // '/path/to/db_backup.sh 2>&1' +$bb_cfg['site_backup_shell_cmd'] = ''; + +// GZip +$bb_cfg['gzip_compress'] = true; // compress output + // Tracker $bb_cfg['announce_type'] = 'php'; // Тип анонсера, xbt или php +$bb_cfg['announce_xbt'] = "http://{$bb_cfg['server_name']}:2710"; $bb_cfg['announce_interval'] = 2400; // Announce interval (default: 1800) $bb_cfg['passkey_key'] = 'uk'; // Passkey key name in GET request $bb_cfg['ignore_reported_ip'] = false; // Ignore IP reported by client @@ -248,23 +266,6 @@ $bb_cfg['cookie_prefix'] = 'bb_'; # 'bb_' define('COOKIE_DBG', 'bb_dbg'); // debug cookie name -// Server -$bb_cfg['server_name'] = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : 'torrentpier.me'; // The domain name from which this board runs -$bb_cfg['server_port'] = (!empty($_SERVER['SERVER_PORT'])) ? $_SERVER['SERVER_PORT'] : 80; // The port your server is running on -$bb_cfg['script_path'] = '/'; // The path where FORUM is located relative to the domain name -$bb_cfg['sitename'] = 'TorrentPier II - Torrent Tracker (see $bb_cfg[\'sitename\'] in config.php)'; // Name of your site - -// Server load -$bb_cfg['max_srv_load'] = 0; // 0 - disable -$bb_cfg['tr_working_second'] = 0; // 0 - disable - -// Backup -$bb_cfg['db_backup_shell_cmd'] = ''; // '/path/to/db_backup.sh 2>&1' -$bb_cfg['site_backup_shell_cmd'] = ''; - -// GZip -$bb_cfg['gzip_compress'] = true; // compress output - // Sessions $bb_cfg['session_update_intrv'] = 180; // sec $bb_cfg['user_session_duration'] = 1800; // sec diff --git a/upload/includes/cron/jobs/avatars_cleanup.php b/upload/includes/cron/jobs/avatars_cleanup.php index 7739196dc..a18472cb9 100644 --- a/upload/includes/cron/jobs/avatars_cleanup.php +++ b/upload/includes/cron/jobs/avatars_cleanup.php @@ -16,7 +16,7 @@ DB()->query(" CREATE TEMPORARY TABLE $tmp_tbl ( user_avatar VARCHAR(255) NOT NULL default '', KEY user_avatar (user_avatar(20)) - ) ENGINE = MyISAM DEFAULT CHARSET=".DBCHARSET." + ) ENGINE = MyISAM DEFAULT CHARSET=$dbcharset "); DB()->query("ALTER TABLE ". BB_USERS ." ADD INDEX user_avatar(user_avatar(10))"); diff --git a/upload/includes/cron/jobs/bb_maintenance.php b/upload/includes/cron/jobs/bb_maintenance.php index e53a8dd31..e0e645e19 100644 --- a/upload/includes/cron/jobs/bb_maintenance.php +++ b/upload/includes/cron/jobs/bb_maintenance.php @@ -32,7 +32,7 @@ DB()->query(" CREATE TEMPORARY TABLE $tmp_attach_tbl ( physical_filename VARCHAR(255) NOT NULL default '', KEY physical_filename (physical_filename(20)) - ) ENGINE = MyISAM DEFAULT CHARSET=".DBCHARSET." + ) ENGINE = MyISAM DEFAULT CHARSET=$dbcharset "); // Get attach_mod config diff --git a/upload/includes/functions_admin_cron.php b/upload/includes/functions_admin_cron.php index 26e0833d4..a420cb095 100644 --- a/upload/includes/functions_admin_cron.php +++ b/upload/includes/functions_admin_cron.php @@ -5,7 +5,6 @@ function run_jobs($jobs) { define('IN_CRON', true); - if (!defined('DBCHARSET')) define('DBCHARSET', 'latin1'); $sql = "SELECT cron_script FROM " . BB_CRON ." WHERE cron_id IN ($jobs)"; diff --git a/upload/includes/functions_torrent.php b/upload/includes/functions_torrent.php index 6ddaeeccc..f80654511 100644 --- a/upload/includes/functions_torrent.php +++ b/upload/includes/functions_torrent.php @@ -557,11 +557,11 @@ function send_torrent_with_passkey ($filename) } // XBTT unique passkey - if($bb_cfg['announce_type'] == 'xbt') + if($bb_cfg['announce_type'] != 'xbt') { $info_hash = pack('H*', sha1(bencode($tor['info']))); $passkey = substr('00000000'. dechex($userdata['user_id']), -8) . substr(sha1($bb_cfg['torrent_pass_private_key'] .' '. $passkey_val .' '. $userdata['user_id'] .' '. $info_hash), 0, 24); - $announce = preg_replace('@/a[^/]*$@i', "/$passkey$0", $ann_url); + $announce = $bb_cfg['announce_xbt'] .'/'. $passkey .'/announce'; } else {