хбт аноснер + чистка git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@157 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
nanosimbiot 2011-07-26 18:53:42 +00:00
commit 82081ace8f
8 changed files with 36 additions and 24 deletions

View file

@ -4,6 +4,13 @@ define('IN_TRACKER', true);
define('BB_ROOT', './../'); define('BB_ROOT', './../');
require(BB_ROOT .'common.php'); 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'])) if (empty($_SERVER['HTTP_USER_AGENT']))
{ {
header('Location: http://127.0.0.1', true, 301); header('Location: http://127.0.0.1', true, 301);

View file

@ -9,6 +9,13 @@ if (!$tr_cfg['scrape'])
msg_die('Please disable 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 // Recover info_hash
if (isset($_GET['?info_hash']) && !isset($_GET['info_hash'])) if (isset($_GET['?info_hash']) && !isset($_GET['info_hash']))
{ {

View file

@ -13,8 +13,6 @@ if (!defined('IN_PHPBB') && !defined('IN_TRACKER')) define('IN_PHPBB', true);
require(BB_ROOT .'config.php'); require(BB_ROOT .'config.php');
require(BB_ROOT .'config_mods.php'); require(BB_ROOT .'config_mods.php');
if (!defined('DBCHARSET')) define('DBCHARSET', 'utf8');
$server_protocol = ($bb_cfg['cookie_secure']) ? 'https://' : 'http://'; $server_protocol = ($bb_cfg['cookie_secure']) ? 'https://' : 'http://';
$server_port = ($bb_cfg['server_port'] != 80) ? ':'. $bb_cfg['server_port'] : ''; $server_port = ($bb_cfg['server_port'] != 80) ? ':'. $bb_cfg['server_port'] : '';
define('FORUM_PATH', $bb_cfg['script_path']); define('FORUM_PATH', $bb_cfg['script_path']);

View file

@ -106,8 +106,26 @@ $bb_cfg['cache']['engines'] = array(
// Available datastore types: memcache, sqlite, redis, eaccelerator, apc, xcache (default of mysql) // Available datastore types: memcache, sqlite, redis, eaccelerator, apc, xcache (default of mysql)
$bb_cfg['datastore_type'] = 'filecache'; $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 // Tracker
$bb_cfg['announce_type'] = 'php'; // Тип анонсера, xbt или php $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['announce_interval'] = 2400; // Announce interval (default: 1800)
$bb_cfg['passkey_key'] = 'uk'; // Passkey key name in GET request $bb_cfg['passkey_key'] = 'uk'; // Passkey key name in GET request
$bb_cfg['ignore_reported_ip'] = false; // Ignore IP reported by client $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 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 // Sessions
$bb_cfg['session_update_intrv'] = 180; // sec $bb_cfg['session_update_intrv'] = 180; // sec
$bb_cfg['user_session_duration'] = 1800; // sec $bb_cfg['user_session_duration'] = 1800; // sec

View file

@ -16,7 +16,7 @@ DB()->query("
CREATE TEMPORARY TABLE $tmp_tbl ( CREATE TEMPORARY TABLE $tmp_tbl (
user_avatar VARCHAR(255) NOT NULL default '', user_avatar VARCHAR(255) NOT NULL default '',
KEY user_avatar (user_avatar(20)) 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))"); DB()->query("ALTER TABLE ". BB_USERS ." ADD INDEX user_avatar(user_avatar(10))");

View file

@ -32,7 +32,7 @@ DB()->query("
CREATE TEMPORARY TABLE $tmp_attach_tbl ( CREATE TEMPORARY TABLE $tmp_attach_tbl (
physical_filename VARCHAR(255) NOT NULL default '', physical_filename VARCHAR(255) NOT NULL default '',
KEY physical_filename (physical_filename(20)) KEY physical_filename (physical_filename(20))
) ENGINE = MyISAM DEFAULT CHARSET=".DBCHARSET." ) ENGINE = MyISAM DEFAULT CHARSET=$dbcharset
"); ");
// Get attach_mod config // Get attach_mod config

View file

@ -5,7 +5,6 @@ function run_jobs($jobs) {
define('IN_CRON', true); define('IN_CRON', true);
if (!defined('DBCHARSET')) define('DBCHARSET', 'latin1');
$sql = "SELECT cron_script $sql = "SELECT cron_script
FROM " . BB_CRON ." FROM " . BB_CRON ."
WHERE cron_id IN ($jobs)"; WHERE cron_id IN ($jobs)";

View file

@ -557,11 +557,11 @@ function send_torrent_with_passkey ($filename)
} }
// XBTT unique passkey // XBTT unique passkey
if($bb_cfg['announce_type'] == 'xbt') if($bb_cfg['announce_type'] != 'xbt')
{ {
$info_hash = pack('H*', sha1(bencode($tor['info']))); $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); $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 else
{ {