mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 14:23:57 -07:00
r527
Имена скачиваемых торрент-файлов с доменом сайта (по аналогии с рутрекером). Начало ликвидации поддержки устаревшего PHP4. Косяки с отладкой. Немного визуального мусора. git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@527 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
parent
98282252b4
commit
58089edbfe
9 changed files with 184 additions and 256 deletions
|
@ -1,8 +1,4 @@
|
|||
AddDefaultCharset UTF-8
|
||||
#order allow deny
|
||||
#deny from all
|
||||
#allow from 127.0.0.1
|
||||
|
||||
<FilesMatch "xs_config.php">
|
||||
allow from all
|
||||
</FilesMatch>
|
||||
#allow from 127.0.0.1
|
|
@ -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');
|
||||
print_page('admin_bt_forum_cfg.tpl', 'admin');
|
|
@ -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,21 +24,19 @@ 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']);
|
||||
if (!IS_SUPER_ADMIN) bb_die($lang['NOT_ADMIN']);
|
||||
|
||||
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)
|
||||
foreach ($sql as $row)
|
||||
{
|
||||
$config_name = $row['config_name'];
|
||||
$config_name = $row['config_name'];
|
||||
$config_value = $row['config_value'];
|
||||
$default_config[$config_name] = $config_value;
|
||||
|
||||
|
@ -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'],
|
||||
|
@ -56,143 +55,142 @@ $template->assign_vars(array(
|
|||
|
||||
switch($mode)
|
||||
{
|
||||
case 'list':
|
||||
$sql = DB()->fetch_rowset("SELECT * FROM ". BB_CRON ." ORDER BY cron_id");
|
||||
case 'list':
|
||||
$sql = DB()->fetch_rowset("SELECT * FROM ". BB_CRON ." ORDER BY cron_id");
|
||||
|
||||
foreach($sql as $i => $row)
|
||||
{
|
||||
$template->assign_block_vars('list', array(
|
||||
'ROW_CLASS' => !($i % 2) ? 'row2' : 'row1',
|
||||
'CRON_ID' => $row['cron_id'],
|
||||
'CRON_ACTIVE' => $row['cron_active'] ? '<img src="../images/icon_run.gif" alt="'. $lang['YES'] .'" />' : '<img src="../images/icon_delete.gif" alt="'. $lang['NO'] .'" />',
|
||||
'CRON_TITLE' => $row['cron_title'],
|
||||
'CRON_SCRIPT' => $row['cron_script'],
|
||||
'SCHEDULE' => $row['schedule'] ? $lang['SCHEDULE'][$row['schedule']] : '<b class="leech">'. $lang['NOSELECT'] .'</b>',
|
||||
'RUN_DAY' => $row['run_day'],
|
||||
'LAST_RUN' => $row['last_run'],
|
||||
'NEXT_RUN' => $row['next_run'],
|
||||
'RUN_COUNT' => $row['run_counter'],
|
||||
));
|
||||
}
|
||||
foreach ($sql as $i => $row)
|
||||
{
|
||||
$template->assign_block_vars('list', array(
|
||||
'ROW_CLASS' => !($i % 2) ? 'row2' : 'row1',
|
||||
'CRON_ID' => $row['cron_id'],
|
||||
'CRON_ACTIVE' => $row['cron_active'] ? '<img src="../images/icon_run.gif" alt="'. $lang['YES'] .'" />' : '<img src="../images/icon_delete.gif" alt="'. $lang['NO'] .'" />',
|
||||
'CRON_TITLE' => $row['cron_title'],
|
||||
'CRON_SCRIPT' => $row['cron_script'],
|
||||
'SCHEDULE' => $row['schedule'] ? $lang['SCHEDULE'][$row['schedule']] : '<b class="leech">'. $lang['NOSELECT'] .'</b>',
|
||||
'RUN_DAY' => $row['run_day'],
|
||||
'LAST_RUN' => $row['last_run'],
|
||||
'NEXT_RUN' => $row['next_run'],
|
||||
'RUN_COUNT' => $row['run_counter'],
|
||||
));
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'TPL_CRON_LIST' => true,
|
||||
'S_CRON_ACTION' => "admin_cron.php",
|
||||
'S_MODE' => 'list',
|
||||
));
|
||||
$template->assign_vars(array(
|
||||
'TPL_CRON_LIST' => true,
|
||||
'S_CRON_ACTION' => 'admin_cron.php',
|
||||
'S_MODE' => 'list',
|
||||
));
|
||||
|
||||
//detect cron status
|
||||
if (@file_exists('../triggers/cron_running'))
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'CRON_RUNNING' => true,
|
||||
));
|
||||
}
|
||||
break;
|
||||
//detect cron status
|
||||
if (@file_exists('../triggers/cron_running'))
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'CRON_RUNNING' => true,
|
||||
));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'repair':
|
||||
if (@file_exists('../triggers/cron_running'))
|
||||
{
|
||||
rename("../triggers/cron_running", "../triggers/cron_allowed");
|
||||
}
|
||||
redirect('admin/'.basename(__FILE__) . '?mode=list');
|
||||
break;
|
||||
if (@file_exists('../triggers/cron_running'))
|
||||
{
|
||||
rename("../triggers/cron_running", "../triggers/cron_allowed");
|
||||
}
|
||||
redirect('admin/'.basename(__FILE__) . '?mode=list');
|
||||
break;
|
||||
|
||||
case 'run':
|
||||
run_jobs($job_id);
|
||||
redirect('admin/'.basename(__FILE__) . '?mode=list');
|
||||
break;
|
||||
run_jobs($job_id);
|
||||
redirect('admin/'.basename(__FILE__) . '?mode=list');
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
$sql = DB()->fetch_rowset("SELECT * FROM ". BB_CRON ." WHERE cron_id = $job_id");
|
||||
$sql = DB()->fetch_rowset("SELECT * FROM ". BB_CRON ." WHERE cron_id = $job_id");
|
||||
|
||||
foreach($sql as $row)
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'CRON_ID' => $row['cron_id'],
|
||||
'CRON_ACTIVE' => $row['cron_active'],
|
||||
'CRON_TITLE' => $row['cron_title'],
|
||||
'CRON_SCRIPT' => $row['cron_script'],
|
||||
foreach ($sql as $row)
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'CRON_ID' => $row['cron_id'],
|
||||
'CRON_ACTIVE' => $row['cron_active'],
|
||||
'CRON_TITLE' => $row['cron_title'],
|
||||
'CRON_SCRIPT' => $row['cron_script'],
|
||||
'SCHEDULE' => $row['schedule'] ? $lang['SCHEDULE'][$row['schedule']] : '',
|
||||
'RUN_DAY' => $row['run_day'],
|
||||
'RUN_TIME' => $row['run_time'],
|
||||
'RUN_ORDER' => $row['run_order'],
|
||||
'LAST_RUN' => $row['last_run'],
|
||||
'NEXT_RUN' => $row['next_run'],
|
||||
'RUN_INTERVAL' => $row['run_interval'],
|
||||
'LOG_ENABLED' => $row['log_enabled'],
|
||||
'LOG_FILE' => $row['log_file'],
|
||||
'LOG_SQL_QUERIES' => $row['log_sql_queries'],
|
||||
'DISABLE_BOARD' => $row['disable_board'],
|
||||
'RUN_COUNTER' => $row['run_counter'],
|
||||
));
|
||||
}
|
||||
'RUN_DAY' => $row['run_day'],
|
||||
'RUN_TIME' => $row['run_time'],
|
||||
'RUN_ORDER' => $row['run_order'],
|
||||
'LAST_RUN' => $row['last_run'],
|
||||
'NEXT_RUN' => $row['next_run'],
|
||||
'RUN_INTERVAL' => $row['run_interval'],
|
||||
'LOG_ENABLED' => $row['log_enabled'],
|
||||
'LOG_FILE' => $row['log_file'],
|
||||
'LOG_SQL_QUERIES' => $row['log_sql_queries'],
|
||||
'DISABLE_BOARD' => $row['disable_board'],
|
||||
'RUN_COUNTER' => $row['run_counter'],
|
||||
));
|
||||
}
|
||||
|
||||
$run_day = array($lang['DELTA_TIME']['INTERVALS']['mday'][0] => 0);
|
||||
for($i=1; $i<=28; $i++)
|
||||
{
|
||||
$run_day[$i] = $i;
|
||||
}
|
||||
$run_day = array($lang['DELTA_TIME']['INTERVALS']['mday'][0] => 0);
|
||||
for ($i = 1; $i <= 28; $i++)
|
||||
{
|
||||
$run_day[$i] = $i;
|
||||
}
|
||||
|
||||
$schedule = array($lang['SCHEDULE']['select'] => 0);
|
||||
foreach ($lang['SCHEDULE'] as $type => $key)
|
||||
{
|
||||
$schedule[$key] = $type;
|
||||
}
|
||||
$schedule = array($lang['SCHEDULE']['select'] => 0);
|
||||
foreach ($lang['SCHEDULE'] as $type => $key)
|
||||
{
|
||||
$schedule[$key] = $type;
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'TPL_CRON_EDIT' => true,
|
||||
'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']),
|
||||
'L_CRON_EDIT_HEAD' => $lang['CRON_EDIT_HEAD_EDIT'],
|
||||
));
|
||||
break;
|
||||
$template->assign_vars(array(
|
||||
'TPL_CRON_EDIT' => true,
|
||||
'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']),
|
||||
'L_CRON_EDIT_HEAD' => $lang['CRON_EDIT_HEAD_EDIT'],
|
||||
));
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
$run_day = array($lang['DELTA_TIME']['INTERVALS']['mday'][0] => 0);
|
||||
for($i=1; $i<=28; $i++)
|
||||
{
|
||||
$run_day[$i] = $i;
|
||||
}
|
||||
$run_day = array($lang['DELTA_TIME']['INTERVALS']['mday'][0] => 0);
|
||||
for ($i = 1; $i <= 28; $i++)
|
||||
{
|
||||
$run_day[$i] = $i;
|
||||
}
|
||||
|
||||
$schedule = array();
|
||||
foreach ($lang['SCHEDULE'] as $type => $key)
|
||||
{
|
||||
$schedule[$key] = $type;
|
||||
}
|
||||
$schedule = array();
|
||||
foreach ($lang['SCHEDULE'] as $type => $key)
|
||||
{
|
||||
$schedule[$key] = $type;
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'TPL_CRON_EDIT' => true,
|
||||
'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),
|
||||
'L_CRON_EDIT_HEAD' => $lang['CRON_EDIT_HEAD_ADD'],
|
||||
$template->assign_vars(array(
|
||||
'TPL_CRON_EDIT' => true,
|
||||
'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),
|
||||
'L_CRON_EDIT_HEAD' => $lang['CRON_EDIT_HEAD_ADD'],
|
||||
'CRON_ID' => 'none',
|
||||
'CRON_ACTIVE' => 1,
|
||||
'CRON_TITLE' => '',
|
||||
'CRON_SCRIPT' => '',
|
||||
'RUN_TIME' => '',
|
||||
'RUN_ORDER' => 255,
|
||||
'LAST_RUN' => '0000-00-00 00:00:00',
|
||||
'NEXT_RUN' => '0000-00-00 00:00:00',
|
||||
'RUN_INTERVAL' => '',
|
||||
'LOG_ENABLED' => 0,
|
||||
'LOG_FILE' => '',
|
||||
'LOG_SQL_QUERIES' => 0,
|
||||
'DISABLE_BOARD' => 0,
|
||||
'RUN_COUNTER' => 0,
|
||||
));
|
||||
break;
|
||||
'CRON_ACTIVE' => 1,
|
||||
'CRON_TITLE' => '',
|
||||
'CRON_SCRIPT' => '',
|
||||
'RUN_TIME' => '',
|
||||
'RUN_ORDER' => 255,
|
||||
'LAST_RUN' => '0000-00-00 00:00:00',
|
||||
'NEXT_RUN' => '0000-00-00 00:00:00',
|
||||
'RUN_INTERVAL' => '',
|
||||
'LOG_ENABLED' => 0,
|
||||
'LOG_FILE' => '',
|
||||
'LOG_SQL_QUERIES' => 0,
|
||||
'DISABLE_BOARD' => 0,
|
||||
'RUN_COUNTER' => 0,
|
||||
));
|
||||
break;
|
||||
|
||||
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;
|
||||
message_die(GENERAL_MESSAGE, $message);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($submit)
|
||||
|
@ -234,4 +232,4 @@ if ($submit)
|
|||
}
|
||||
}
|
||||
|
||||
print_page('admin_cron.tpl', 'admin');
|
||||
print_page('admin_cron.tpl', 'admin');
|
|
@ -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(
|
||||
|
|
|
@ -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';
|
||||
|
@ -177,7 +177,8 @@ $bb_cfg['show_tor_info_in_dl_list'] = true;
|
|||
$bb_cfg['allow_dl_list_names_mode'] = true;
|
||||
|
||||
// Torrents
|
||||
$bb_cfg['torrent_sign'] = ''; // e.g. "[yoursite.com]"
|
||||
$bb_cfg['torrent_sign'] = ''; // e.g. "[yoursite.com]"
|
||||
$bb_cfg['torrent_style'] = true;
|
||||
$bb_cfg['tor_help_links'] = '';
|
||||
|
||||
// Сколько дней сохранять торрент зарегистрированным / Days to keep torrent registered, if:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
function get_sql_log ()
|
||||
{
|
||||
global $bb_cfg, $DBS, $CACHES, $sphinx, $datastore;
|
||||
global $DBS, $CACHES, $sphinx, $datastore;
|
||||
|
||||
$log = '';
|
||||
|
||||
|
@ -10,20 +10,22 @@ 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))
|
||||
if (!empty($cache_obj->db))
|
||||
{
|
||||
$log .= get_sql_log_html($cache_obj->db, "cache: $cache_name [{$cache_obj->db->engine}]");
|
||||
}
|
||||
elseif(!empty($cache_obj->engine))
|
||||
{
|
||||
$log .= get_sql_log_html($cache_obj, "cache: $cache_name [{$cache_obj->engine}]");
|
||||
}
|
||||
}
|
||||
elseif (!empty($cache_obj->engine))
|
||||
{
|
||||
$log .= get_sql_log_html($cache_obj, "cache: $cache_name [{$cache_obj->engine}]");
|
||||
}
|
||||
}
|
||||
|
||||
$log .= !empty($sphinx) ? get_sql_log_html($sphinx, '$sphinx') : '';
|
||||
if(!empty($datastore->db->dbg))
|
||||
|
||||
if (!empty($datastore->db->dbg))
|
||||
{
|
||||
$log .= get_sql_log_html($datastore->db, '$datastore ['.$datastore->engine.']');
|
||||
}
|
||||
|
@ -32,7 +34,7 @@ function get_sql_log ()
|
|||
$log .= get_sql_log_html($datastore, '$datastore ['.$datastore->engine.']');
|
||||
}
|
||||
|
||||
return $log;
|
||||
return $log;
|
||||
}
|
||||
|
||||
function get_sql_log_html ($db_obj, $log_name)
|
||||
|
@ -64,4 +66,4 @@ function get_sql_log_html ($db_obj, $log_name)
|
|||
<div class="sqlLogTitle">'. $log_name .'</div>
|
||||
'. $log .'
|
||||
';
|
||||
}
|
||||
}
|
|
@ -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');
|
||||
|
@ -656,10 +638,10 @@ function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topi
|
|||
$emailer->from($bb_cfg['board_email']);
|
||||
$emailer->replyto($bb_cfg['board_email']);
|
||||
|
||||
if(count($orig_word))
|
||||
if (count($orig_word))
|
||||
{
|
||||
$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
|
||||
}
|
||||
}
|
||||
|
||||
@reset($bcc_list_ary);
|
||||
while (list($user_lang, $bcc_list) = each($bcc_list_ary))
|
||||
|
@ -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")
|
||||
);
|
||||
|
|
|
@ -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")
|
||||
{
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
@ -115,9 +110,9 @@ function tracker_unregister ($attach_id, $mode = '')
|
|||
}
|
||||
}
|
||||
|
||||
// XBTT
|
||||
if($bb_cfg['announce_type'] == 'xbt')
|
||||
{
|
||||
// XBTT
|
||||
if ($bb_cfg['announce_type'] == 'xbt')
|
||||
{
|
||||
$sql = "INSERT INTO ". BB_BT_TORRENTS ."_del(topic_id, info_hash)
|
||||
SELECT topic_id, info_hash
|
||||
FROM ". BB_BT_TORRENTS ."
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -236,9 +225,9 @@ function change_tor_type ($attach_id, $tor_status_gold)
|
|||
$tor_status_gold = intval($tor_status_gold);
|
||||
DB()->query("UPDATE ". BB_BT_TORRENTS ." SET tor_type = $tor_status_gold WHERE topic_id = $topic_id LIMIT 1");
|
||||
|
||||
// XBTT
|
||||
if($bb_cfg['announce_type'] == 'xbt')
|
||||
{
|
||||
// XBTT
|
||||
if ($bb_cfg['announce_type'] == 'xbt')
|
||||
{
|
||||
$sql = "SELECT CASE tor_type WHEN 1 THEN 0 WHEN 2 THEN 50 ELSE 100 END AS dl_percent, topic_id, info_hash FROM ". BB_BT_TORRENTS ." WHERE topic_id = $topic_id";
|
||||
$result = DB()->query($sql);
|
||||
$row = DB()->sql_fetchrow($result);
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -424,7 +405,7 @@ function tracker_register ($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVE
|
|||
}
|
||||
}
|
||||
|
||||
if($tr_cfg['tor_topic_up'])
|
||||
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");
|
||||
}
|
||||
|
@ -559,16 +540,16 @@ function send_torrent_with_passkey ($filename)
|
|||
}
|
||||
|
||||
// XBTT unique passkey
|
||||
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 = $bb_cfg['announce_xbt'] .'/'. $passkey .'/announce';
|
||||
}
|
||||
else
|
||||
{
|
||||
$announce = strval($ann_url . "?$passkey_key=$passkey_val");
|
||||
}
|
||||
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 = $bb_cfg['announce_xbt'] .'/'. $passkey .'/announce';
|
||||
}
|
||||
else
|
||||
{
|
||||
$announce = strval($ann_url . "?$passkey_key=$passkey_val");
|
||||
}
|
||||
|
||||
// Replace original announce url with tracker default
|
||||
if ($bb_cfg['bt_replace_ann_url'] || !@$tor['announce'])
|
||||
|
@ -581,7 +562,7 @@ function send_torrent_with_passkey ($filename)
|
|||
{
|
||||
unset($tor['announce-list']);
|
||||
}
|
||||
elseif(@$tor['announce-list'])
|
||||
elseif (@$tor['announce-list'])
|
||||
{
|
||||
$tor['announce-list'] = array_merge($tor['announce-list'], array(array($announce)));
|
||||
}
|
||||
|
@ -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))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue