Имена скачиваемых торрент-файлов с доменом сайта (по аналогии с рутрекером). Начало ликвидации поддержки устаревшего PHP4. Косяки с отладкой. Немного визуального мусора. git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@527 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
glix08 2013-07-31 22:07:07 +00:00
commit 58089edbfe
9 changed files with 184 additions and 256 deletions

View file

@ -2,7 +2,3 @@ AddDefaultCharset UTF-8
#order allow deny
#deny from all
#allow from 127.0.0.1
<FilesMatch "xs_config.php">
allow from all
</FilesMatch>

View file

@ -151,7 +151,7 @@ $template->assign_vars(array(
'BT_SHOW_PEERS_MODE_FULL_SEL' => ($cfg['bt_show_peers_mode'] == SHOW_PEERS_FULL) ? HTML_CHECKED : '',
'S_HIDDEN_FIELDS' => '',
'S_CONFIG_ACTION' => "admin_bt_forum_cfg.php",
'S_CONFIG_ACTION' => 'admin_bt_forum_cfg.php',
));
print_page('admin_bt_forum_cfg.tpl', 'admin');

View file

@ -3,8 +3,10 @@
// ACP Header - START
if (!empty($setmodules))
{
if(IS_SUPER_ADMIN){
$module['TorrentPier']['Cron'] = basename(__FILE__) . '?mode=list';}
if (IS_SUPER_ADMIN)
{
$module['TorrentPier']['Cron'] = basename(__FILE__) . '?mode=list';
}
return;
}
@ -22,7 +24,6 @@ if ($mode == 'run' && !$job_id)
redirect('admin/'.basename(__FILE__) . '?mode=list');
}
else require('./pagestart.php');
// ACP Header - END
if (!IS_SUPER_ADMIN) bb_die($lang['NOT_ADMIN']);
@ -31,7 +32,6 @@ require(LANG_DIR .'lang_admin_cron.php');
require(INC_DIR .'functions_admin_torrent.php');
require(INC_DIR .'functions_admin_cron.php');
$sql = DB()->fetch_rowset("SELECT * FROM ". BB_CONFIG ." WHERE config_name = 'cron_enabled' OR config_name = 'cron_check_interval'");
foreach ($sql as $row)
@ -48,7 +48,6 @@ foreach($sql as $row)
}
}
$template->assign_vars(array(
'CRON_ENABLED' => ($new['cron_enabled']) ? true : false,
'CRON_CHECK_INTERVAL' => $new['cron_check_interval'],
@ -77,7 +76,7 @@ switch($mode)
$template->assign_vars(array(
'TPL_CRON_LIST' => true,
'S_CRON_ACTION' => "admin_cron.php",
'S_CRON_ACTION' => 'admin_cron.php',
'S_MODE' => 'list',
));
@ -142,7 +141,7 @@ switch($mode)
$template->assign_vars(array(
'TPL_CRON_EDIT' => true,
'S_CRON_ACTION' => "admin_cron.php",
'S_CRON_ACTION' => 'admin_cron.php',
'S_MODE' => 'edit',
'SCHEDULE' => build_select('schedule', $schedule, $row['schedule']),
'RUN_DAY' => build_select('run_day', $run_day, $row['run_day']),
@ -165,7 +164,7 @@ switch($mode)
$template->assign_vars(array(
'TPL_CRON_EDIT' => true,
'S_CRON_ACTION' => "admin_cron.php",
'S_CRON_ACTION' => 'admin_cron.php',
'S_MODE' => 'add',
'SCHEDULE' => build_select('schedule', $schedule, 'select', null, null),
'RUN_DAY' => build_select('run_day', $run_day, 0, null, null),
@ -189,7 +188,6 @@ switch($mode)
case 'delete':
delete_jobs($job_id);
$message = $lang['JOB_REMOVED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_JOBS'], '<a href="admin_cron.php?mode=list">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
message_die(GENERAL_MESSAGE, $message);
break;

View file

@ -86,6 +86,11 @@ if ($tor_auth_reg || $tor_auth_del)
$tracker_link = ($tor_reged) ? $unreg_tor_url : $reg_tor_url;
}
if ($bb_cfg['torrent_style'])
{
$display_name = '['.$domain_name.'].t' . $bt_topic_id . '.torrent';
}
if (!$tor_reged)
{
$template->assign_block_vars('postrow.attach.tor_not_reged', array(

View file

@ -56,8 +56,8 @@ $domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $do
// Increase number of revision after update
$bb_cfg['tp_version'] = '2.5 (unstable)';
$bb_cfg['tp_release_date'] = '31-07-2013';
$bb_cfg['tp_release_state'] = 'R526';
$bb_cfg['tp_release_date'] = '01-08-2013';
$bb_cfg['tp_release_state'] = 'R527';
// Database
$charset = 'utf8';
@ -178,6 +178,7 @@ $bb_cfg['allow_dl_list_names_mode'] = true;
// Torrents
$bb_cfg['torrent_sign'] = ''; // e.g. "[yoursite.com]"
$bb_cfg['torrent_style'] = true;
$bb_cfg['tor_help_links'] = '';
// Сколько дней сохранять торрент зарегистрированным / Days to keep torrent registered, if:

View file

@ -2,7 +2,7 @@
function get_sql_log ()
{
global $bb_cfg, $DBS, $CACHES, $sphinx, $datastore;
global $DBS, $CACHES, $sphinx, $datastore;
$log = '';
@ -10,6 +10,7 @@ function get_sql_log ()
{
$log .= !empty($db_obj) ? get_sql_log_html($db_obj, "$srv_name [MySQL]") : '';
}
foreach ($CACHES->obj as $cache_name => $cache_obj)
{
if (!empty($cache_obj->db))
@ -23,6 +24,7 @@ function get_sql_log ()
}
$log .= !empty($sphinx) ? get_sql_log_html($sphinx, '$sphinx') : '';
if (!empty($datastore->db->dbg))
{
$log .= get_sql_log_html($datastore->db, '$datastore ['.$datastore->engine.']');

View file

@ -562,8 +562,7 @@ function delete_post($mode, $post_data, &$message, &$meta, $forum_id, $topic_id,
//
function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$post_id, &$notify_user)
{
global $bb_cfg, $lang;
global $userdata;
global $bb_cfg, $lang, $userdata;
if (!$bb_cfg['topic_notify_enabled'])
{
@ -621,23 +620,6 @@ function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topi
}
while ($row = DB()->sql_fetchrow($result));
//
// Let's do some checking to make sure that mass mail functions
// are working in win32 versions of php.
//
if (preg_match('/[c-z]:\\\.*/i', getenv('PATH')) && !$bb_cfg['smtp_delivery'])
{
$ini_val = (@phpversion() >= '4.0.0') ? 'ini_get' : 'get_cfg_var';
// We are running on windows, force delivery to use our smtp functions
// since php's are broken by default
if (!@$ini_val('sendmail_path'))
{
$bb_cfg['smtp_delivery'] = 1;
$bb_cfg['smtp_host'] = @$ini_val('SMTP');
}
}
if (sizeof($bcc_list_ary))
{
include(INC_DIR .'emailer.class.php');
@ -685,7 +667,6 @@ function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topi
'SITENAME' => $bb_cfg['sitename'],
'USERNAME' => $userdata['username'],
'EMAIL_SIG' => (!empty($bb_cfg['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $bb_cfg['board_email_sig']) : '',
'U_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_POST_URL . "=$post_id#$post_id",
'U_STOP_WATCHING_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_TOPIC_URL . "=$topic_id&unwatch=topic")
);

View file

@ -1,30 +1,9 @@
<?php
/***************************************************************************
* function_selects.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id: functions_selects.php,v 1.3.2.5 2005/05/06 20:50:11 acydburn Exp $
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
***************************************************************************/
if (!defined('BB_ROOT')) die(basename(__FILE__));
//
// Pick a language, any language ...
// Pick a language, any language
//
function language_select($default, $select_name = "language", $dirname="language")
{

View file

@ -87,9 +87,7 @@ function tracker_unregister ($attach_id, $mode = '')
if (!$topic_id)
{
$sql = "SELECT topic_id
FROM ". BB_BT_TORRENTS ."
WHERE attach_id = $attach_id";
$sql = "SELECT topic_id FROM ". BB_BT_TORRENTS ." WHERE attach_id = $attach_id";
if (!$result = DB()->sql_query($sql))
{
@ -104,10 +102,7 @@ function tracker_unregister ($attach_id, $mode = '')
// Unset DL-Type for topic
if ($bb_cfg['bt_unset_dltype_on_tor_unreg'] && $topic_id)
{
$sql = "UPDATE ". BB_TOPICS ." SET
topic_dl_type = ". TOPIC_DL_TYPE_NORMAL ."
WHERE topic_id = $topic_id
LIMIT 1";
$sql = "UPDATE ". BB_TOPICS ." SET topic_dl_type = ". TOPIC_DL_TYPE_NORMAL ." WHERE topic_id = $topic_id LIMIT 1";
if (!$result = DB()->sql_query($sql))
{
@ -128,11 +123,9 @@ function tracker_unregister ($attach_id, $mode = '')
message_die(GENERAL_ERROR, 'Could not delete torrent from torrents table', '', __LINE__, __FILE__, $sql);
}
}
// XBTT end.
// Remove peers from tracker
$sql = "DELETE FROM ". BB_BT_TRACKER ."
WHERE topic_id = $topic_id";
$sql = "DELETE FROM ". BB_BT_TRACKER ." WHERE topic_id = $topic_id";
if (!DB()->sql_query($sql))
{
@ -140,8 +133,7 @@ function tracker_unregister ($attach_id, $mode = '')
}
// Delete torrent
$sql = "DELETE FROM ". BB_BT_TORRENTS ."
WHERE attach_id = $attach_id";
$sql = "DELETE FROM ". BB_BT_TORRENTS ." WHERE attach_id = $attach_id";
if (!DB()->sql_query($sql))
{
@ -149,10 +141,7 @@ function tracker_unregister ($attach_id, $mode = '')
}
// Update tracker_status
$sql = "UPDATE ". BB_ATTACHMENTS_DESC ." SET
tracker_status = 0
WHERE attach_id = $attach_id
LIMIT 1";
$sql = "UPDATE ". BB_ATTACHMENTS_DESC ." SET tracker_status = 0 WHERE attach_id = $attach_id LIMIT 1";
if (!DB()->sql_query($sql))
{
@ -315,8 +304,6 @@ function tracker_register ($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVE
if ($bb_cfg['bt_disable_dht'])
{
$tor['info']['private'] = (int) 1;
//$tor['info']['source'] = (string) make_url('index.php');
$fp = fopen($filename, 'w+');
fwrite ($fp, bencode($tor));
fclose ($fp);
@ -400,10 +387,7 @@ function tracker_register ($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVE
}
// update tracker status for this attachment
$sql = 'UPDATE '. BB_ATTACHMENTS_DESC ." SET
tracker_status = 1
WHERE attach_id = $attach_id
LIMIT 1";
$sql = 'UPDATE '. BB_ATTACHMENTS_DESC ." SET tracker_status = 1 WHERE attach_id = $attach_id LIMIT 1";
if (!DB()->sql_query($sql))
{
@ -413,10 +397,7 @@ function tracker_register ($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVE
// 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";
$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))
{
@ -604,9 +585,7 @@ function send_torrent_with_passkey ($filename)
// Add comment
$comment = '';
$orig_com = (@$tor['comment']) ? $tor['comment'] : '';
if ($bb_cfg['bt_add_comment'])
{
$comment = $bb_cfg['bt_add_comment'];
@ -631,20 +610,16 @@ function send_torrent_with_passkey ($filename)
$mimetype = 'application/x-bittorrent;';
$charset = (strpos(USER_AGENT, 'pera') && @$lang['CONTENT_ENCODING']) ? "charset={$lang['CONTENT_ENCODING']};" : '';
# header("Content-length: ". strlen($output));
header("Content-Type: $mimetype $charset name=\"$filename\"");
header("Content-Disposition: attachment; filename=\"$filename\"");
##### LOG #####
global $log_ip_resp;
if (isset($log_ip_resp[USER_IP]) || isset($log_ip_resp[CLIENT_IP]))
if ($bb_cfg['torrent_style'])
{
$str = date('H:i:s') . LOG_SEPR . str_compact(ob_get_contents()) . LOG_LF;
$file = 'sessions/'. date('m-d') .'_{'. USER_IP .'}_'. CLIENT_IP .'_resp';
bb_log($str, $file);
$header_file_name = 'Content-Disposition: attachment; filename="['.$domain_name.'].t' . $topic_id . '.torrent"';
header($header_file_name);
}
else
{
header("Content-Disposition: attachment; filename=\"$filename\"");
}
### LOG END ###
bb_exit($output);
}
@ -658,10 +633,7 @@ function generate_passkey ($user_id, $force_generate = false)
// Check if user can change passkey
if (!$force_generate)
{
$sql = "SELECT user_opt
FROM ". BB_USERS ."
WHERE user_id = $user_id
LIMIT 1";
$sql = "SELECT user_opt FROM ". BB_USERS ." WHERE user_id = $user_id LIMIT 1";
if (!$result = DB()->sql_query($sql))
{
@ -688,10 +660,7 @@ function generate_passkey ($user_id, $force_generate = false)
return $passkey_val;
}
// Update
$sql = "UPDATE IGNORE ". BB_BT_USERS ." SET
auth_key = '$passkey_val'
WHERE user_id = $user_id
LIMIT 1";
$sql = "UPDATE IGNORE ". BB_BT_USERS ." SET auth_key = '$passkey_val' WHERE user_id = $user_id LIMIT 1";
if (DB()->sql_query($sql) && DB()->affected_rows() == 1)
{
@ -715,10 +684,7 @@ 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";
$sql = "SELECT topic_id FROM ". BB_BT_TORRENTS ." WHERE $field = $id LIMIT 1";
if (!$result = DB()->sql_query($sql))
{