Merge pull request #421 from Exile37/feature/new-config

Transfer to the new config subsystem
This commit is contained in:
Yuriy Pikhtarev 2017-06-28 10:46:38 +03:00 committed by GitHub
commit 2ea69b2086
117 changed files with 1355 additions and 1363 deletions

View file

@ -68,44 +68,44 @@ $order_by = '';
if ($view === 'username') {
switch ($mode) {
case 'username':
$order_by = 'ORDER BY u.username ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
$order_by = 'ORDER BY u.username ' . $sort_order . ' LIMIT ' . $start . ', ' . config('tp.topics_per_page');
break;
case 'attachments':
$order_by = 'ORDER BY total_attachments ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
$order_by = 'ORDER BY total_attachments ' . $sort_order . ' LIMIT ' . $start . ', ' . config('tp.topics_per_page');
break;
case 'filesize':
$order_by = 'ORDER BY total_size ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
$order_by = 'ORDER BY total_size ' . $sort_order . ' LIMIT ' . $start . ', ' . config('tp.topics_per_page');
break;
default:
$mode = 'attachments';
$sort_order = 'DESC';
$order_by = 'ORDER BY total_attachments ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
$order_by = 'ORDER BY total_attachments ' . $sort_order . ' LIMIT ' . $start . ', ' . config('tp.topics_per_page');
break;
}
} elseif ($view === 'attachments') {
switch ($mode) {
case 'filename':
$order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
$order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . config('tp.topics_per_page');
break;
case 'comment':
$order_by = 'ORDER BY a.comment ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
$order_by = 'ORDER BY a.comment ' . $sort_order . ' LIMIT ' . $start . ', ' . config('tp.topics_per_page');
break;
case 'extension':
$order_by = 'ORDER BY a.extension ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
$order_by = 'ORDER BY a.extension ' . $sort_order . ' LIMIT ' . $start . ', ' . config('tp.topics_per_page');
break;
case 'filesize':
$order_by = 'ORDER BY a.filesize ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
$order_by = 'ORDER BY a.filesize ' . $sort_order . ' LIMIT ' . $start . ', ' . config('tp.topics_per_page');
break;
case 'downloads':
$order_by = 'ORDER BY a.download_count ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
$order_by = 'ORDER BY a.download_count ' . $sort_order . ' LIMIT ' . $start . ', ' . config('tp.topics_per_page');
break;
case 'post_time':
$order_by = 'ORDER BY a.filetime ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
$order_by = 'ORDER BY a.filetime ' . $sort_order . ' LIMIT ' . $start . ', ' . config('tp.topics_per_page');
break;
default:
$mode = 'a.real_filename';
$sort_order = 'ASC';
$order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
$order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . config('tp.topics_per_page');
break;
}
}
@ -472,8 +472,8 @@ if ($view === 'attachments') {
}
// Generate Pagination
if ($do_pagination && $total_rows > $bb_cfg['topics_per_page']) {
generate_pagination('admin_attach_cp.php?view=' . $view . '&mode=' . $mode . '&order=' . $sort_order . '&uid=' . $uid, $total_rows, $bb_cfg['topics_per_page'], $start);
if ($do_pagination && $total_rows > config('tp.topics_per_page')) {
generate_pagination('admin_attach_cp.php?view=' . $view . '&mode=' . $mode . '&order=' . $sort_order . '&uid=' . $uid, $total_rows, config('tp.topics_per_page'), $start);
}
print_page('admin_attach_cp.tpl', 'admin');

View file

@ -55,20 +55,20 @@ $default_cfg_num = array(
/**
* Set template vars
*/
set_tpl_vars($default_cfg_str, $bb_cfg['tracker']);
set_tpl_vars($default_cfg_str, config('tracker'));
set_tpl_vars_lang($default_cfg_str);
set_tpl_vars_bool($default_cfg_bool, $bb_cfg['tracker']);
set_tpl_vars_bool($default_cfg_bool, config('tracker'));
set_tpl_vars_lang($default_cfg_bool);
set_tpl_vars($default_cfg_num, $bb_cfg['tracker']);
set_tpl_vars($default_cfg_num, config('tracker'));
set_tpl_vars_lang($default_cfg_num);
$template->assign_vars(array(
'IGNORE_REPORTED_IP' => $bb_cfg['ignore_reported_ip'],
'ANNOUNCE_INTERVAL' => $bb_cfg['announce_interval'],
'PASSKEY_KEY' => $bb_cfg['passkey_key'],
'GOLD_SILVER_ENABLED' => $bb_cfg['tracker']['gold_silver_enabled'],
'IGNORE_REPORTED_IP' => config('tp.ignore_reported_ip'),
'ANNOUNCE_INTERVAL' => config('tp.announce_interval'),
'PASSKEY_KEY' => config('tp.passkey_key'),
'GOLD_SILVER_ENABLED' => config('tracker.gold_silver_enabled'),
'DISABLE_SUBMIT' => true,
'S_HIDDEN_FIELDS' => '',

View file

@ -151,7 +151,7 @@ if ($var =& $_REQUEST[$daysback_key] && $var != $def_days) {
$url = url_arg($url, $daysback_key, $daysback_val);
}
if ($var =& $_REQUEST[$datetime_key] && $var != $def_datetime) {
$tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
$tz = TIMENOW + (3600 * config('tp.board_timezone'));
if (($tmp_timestamp = strtotime($var, $tz)) > 0) {
$datetime_val = $tmp_timestamp;
$url = url_arg($url, $datetime_key, date($dt_format, $datetime_val));

View file

@ -64,7 +64,7 @@ if (isset($_POST['submit'])) {
/** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\Emailer();
$emailer->set_from([$bb_cfg['board_email'] => $bb_cfg['sitename']]);
$emailer->set_from([config('tp.board_email') => config('tp.sitename')]);
$emailer->set_to([$row['user_email'] => $row['username']]);
$emailer->set_subject($subject);

View file

@ -39,7 +39,7 @@ if (!$result = OLD_DB()->sql_query($sql)) {
}
}
$s_mess = $lang['SITEMAP_CREATED'] . ': <b>' . bb_date($new['sitemap_time'], $bb_cfg['post_date_format']) . '</b> ' . $lang['SITEMAP_AVAILABLE'] . ': <a href="' . make_url('sitemap/sitemap.xml') . '" target="_blank">' . make_url('sitemap/sitemap.xml') . '</a>';
$s_mess = $lang['SITEMAP_CREATED'] . ': <b>' . bb_date($new['sitemap_time'], config('tp.post_date_format')) . '</b> ' . $lang['SITEMAP_AVAILABLE'] . ': <a href="' . make_url('sitemap/sitemap.xml') . '" target="_blank">' . make_url('sitemap/sitemap.xml') . '</a>';
$message = file_exists(SITEMAP_DIR . '/sitemap.xml') ? $s_mess : $lang['SITEMAP_NOT_CREATED'];
$template->assign_vars(array(

View file

@ -27,11 +27,11 @@ $s_hidden_fields = '';
$smiley_paks = [];
// Read a listing of uploaded smilies for use in the add or edit smliey code
$dir = opendir(BB_ROOT . $bb_cfg['smilies_path']);
$dir = opendir(BB_ROOT . config('tp.smilies_path'));
while ($file = @readdir($dir)) {
if (!is_dir(bb_realpath(BB_ROOT . $bb_cfg['smilies_path'] . '/' . $file))) {
$img_size = getimagesize(BB_ROOT . $bb_cfg['smilies_path'] . '/' . $file);
if (!is_dir(bb_realpath(BB_ROOT . config('tp.smilies_path') . '/' . $file))) {
$img_size = getimagesize(BB_ROOT . config('tp.smilies_path') . '/' . $file);
if ($img_size[0] && $img_size[1]) {
$smiley_images[] = $file;
@ -71,7 +71,7 @@ if (isset($_GET['import_pack']) || isset($_POST['import_pack'])) {
}
}
$fcontents = file(BB_ROOT . $bb_cfg['smilies_path'] . '/' . $smile_pak);
$fcontents = file(BB_ROOT . config('tp.smilies_path') . '/' . $smile_pak);
if (empty($fcontents)) {
bb_die('Could not read smiley pak file');
@ -167,11 +167,11 @@ if (isset($_GET['import_pack']) || isset($_POST['import_pack'])) {
$template->assign_vars(array(
'TPL_SMILE_EDIT' => true,
'SMILEY_IMG' => BB_ROOT . $bb_cfg['smilies_path'] . '/' . $smiley_images[0],
'SMILEY_IMG' => BB_ROOT . config('tp.smilies_path') . '/' . $smiley_images[0],
'S_SMILEY_ACTION' => 'admin_smilies.php',
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_FILENAME_OPTIONS' => $filename_list,
'S_SMILEY_BASEDIR' => BB_ROOT . $bb_cfg['smilies_path']
'S_SMILEY_BASEDIR' => BB_ROOT . config('tp.smilies_path')
));
} elseif ($mode != '') {
switch ($mode) {
@ -217,11 +217,11 @@ if (isset($_GET['import_pack']) || isset($_POST['import_pack'])) {
'TPL_SMILE_EDIT' => true,
'SMILEY_CODE' => $smile_data['code'],
'SMILEY_EMOTICON' => $smile_data['emoticon'],
'SMILEY_IMG' => BB_ROOT . $bb_cfg['smilies_path'] . '/' . $smiley_edit_img,
'SMILEY_IMG' => BB_ROOT . config('tp.smilies_path') . '/' . $smiley_edit_img,
'S_SMILEY_ACTION' => 'admin_smilies.php',
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_FILENAME_OPTIONS' => $filename_list,
'S_SMILEY_BASEDIR' => BB_ROOT . $bb_cfg['smilies_path'],
'S_SMILEY_BASEDIR' => BB_ROOT . config('tp.smilies_path'),
));
break;
@ -310,7 +310,7 @@ if (isset($_GET['import_pack']) || isset($_POST['import_pack'])) {
$template->assign_block_vars('smiles', array(
'ROW_CLASS' => $row_class,
'SMILEY_IMG' => BB_ROOT . $bb_cfg['smilies_path'] . '/' . $smilies[$i]['smile_url'],
'SMILEY_IMG' => BB_ROOT . config('tp.smilies_path') . '/' . $smilies[$i]['smile_url'],
'CODE' => $smilies[$i]['code'],
'EMOT' => $smilies[$i]['emoticon'],

View file

@ -14,15 +14,15 @@ if (!empty($setmodules)) {
require __DIR__ . '/pagestart.php';
require INC_DIR . '/bbcode.php';
if (isset($_POST['post']) && $bb_cfg['terms'] != $_POST['message']) {
if (isset($_POST['post']) && config('tp.terms') != $_POST['message']) {
bb_update_config(array('terms' => $_POST['message']));
bb_die($lang['CONFIG_UPDATED']);
}
$template->assign_vars(array(
'S_ACTION' => 'admin_terms.php',
'EXT_LINK_NW' => $bb_cfg['ext_link_new_win'],
'MESSAGE' => $bb_cfg['terms'] ?: '',
'EXT_LINK_NW' => config('tp.ext_link_new_win'),
'MESSAGE' => config('tp.terms') ?: '',
'PREVIEW_HTML' => isset($_REQUEST['preview']) ? bbcode2html($_POST['message']) : '',
));

View file

@ -845,10 +845,10 @@ if (!isset($_REQUEST['dosearch'])) {
if ($page == 1) {
$offset = 0;
} else {
$offset = (($page - 1) * $bb_cfg['topics_per_page']);
$offset = (($page - 1) * config('tp.topics_per_page'));
}
$limit = "LIMIT $offset, " . $bb_cfg['topics_per_page'];
$limit = "LIMIT $offset, " . config('tp.topics_per_page');
$select_sql .= " $limit";
@ -863,7 +863,7 @@ if (!isset($_REQUEST['dosearch'])) {
bb_die($lang['SEARCH_NO_RESULTS']);
}
}
$num_pages = ceil($total_pages['total'] / $bb_cfg['topics_per_page']);
$num_pages = ceil($total_pages['total'] / config('tp.topics_per_page'));
$pagination = '';

View file

@ -14,8 +14,8 @@ if (!empty($setmodules)) {
require __DIR__ . '/pagestart.php';
if (!$bb_cfg['use_word_censor']) {
bb_die('Word censor disabled <br /><br /> ($bb_cfg[\'use_word_censor\'] in config.php)');
if (!config('tp.use_word_censor')) {
bb_die('Word censor disabled <br /><br /> ($cfg[\'use_word_censor\'] in config/tp.php)');
}
$mode = request_var('mode', '');

View file

@ -59,7 +59,7 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
} elseif (isset($_GET['pane']) && $_GET['pane'] == 'right') {
$template->assign_vars(array(
'TPL_ADMIN_MAIN' => true,
'ADMIN_LOCK' => $bb_cfg['board_disable'] ? true : false,
'ADMIN_LOCK' => config('tp.board_disable') ? true : false,
'ADMIN_LOCK_CRON' => file_exists(BB_DISABLED) ? true : false,
));
@ -67,8 +67,8 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$total_topics = get_db_stat('topiccount');
$start_date = bb_date($bb_cfg['board_startdate']);
$boarddays = (TIMENOW - $bb_cfg['board_startdate']) / 86400;
$start_date = bb_date(config('tp.board_startdate'));
$boarddays = (TIMENOW - config('tp.board_startdate')) / 86400;
$posts_per_day = sprintf('%.2f', $total_posts / $boarddays);
$topics_per_day = sprintf('%.2f', $total_topics / $boarddays);
@ -76,10 +76,10 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
$avatar_dir_size = 0;
if ($avatar_dir = opendir($bb_cfg['avatars']['upload_path'])) {
if ($avatar_dir = opendir(config('tp.avatars.upload_path'))) {
while ($file = readdir($avatar_dir)) {
if ($file != '.' && $file != '..') {
$avatar_dir_size += @filesize(BB_ROOT . $bb_cfg['avatar_path'] . '/' . $file);
$avatar_dir_size += @filesize(BB_ROOT . config('tp.avatar_path') . '/' . $file);
}
}
closedir($avatar_dir);
@ -169,7 +169,7 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
'STARTED' => bb_date($onlinerow_reg[$i]['session_start'], 'H:i', false),
'LASTUPDATE' => bb_date($onlinerow_reg[$i]['user_session_time'], 'H:i', false),
'IP_ADDRESS' => $reg_ip,
'U_WHOIS_IP' => $bb_cfg['whois_info'] . $reg_ip,
'U_WHOIS_IP' => config('tp.whois_info') . $reg_ip,
));
}
}
@ -192,7 +192,7 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
'STARTED' => bb_date($onlinerow_guest[$i]['session_start'], 'H:i', false),
'LASTUPDATE' => bb_date($onlinerow_guest[$i]['session_time'], 'H:i', false),
'IP_ADDRESS' => $guest_ip,
'U_WHOIS_IP' => $bb_cfg['whois_info'] . $guest_ip,
'U_WHOIS_IP' => config('tp.whois_info') . $guest_ip,
));
}
}

View file

@ -20,7 +20,7 @@ if (!IS_ADMIN) {
$peers_in_last_minutes = [30, 15, 5, 1];
$peers_in_last_sec_limit = 300;
$announce_interval = (int)$bb_cfg['announce_interval'];
$announce_interval = (int)config('tp.announce_interval');
$stat = array();
define('TMP_TRACKER_TABLE', 'tmp_tracker');

View file

@ -21,7 +21,7 @@ $user->session_start();
// Exit if board is disabled via ON/OFF trigger or by admin
if ($ajax->action != 'manage_admin') {
if ($bb_cfg['board_disable']) {
if (config('tp.board_disable')) {
$ajax->ajax_die($lang['BOARD_DISABLE']);
} elseif (file_exists(BB_DISABLED)) {
$ajax->ajax_die($lang['BOARD_DISABLE_CRON']);

View file

@ -7,6 +7,8 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
use Dotenv\Dotenv;
use Dotenv\Exception\InvalidPathException;
use Illuminate\Cache\CacheManager;
use Illuminate\Config\Repository;
use Illuminate\Container\Container;
@ -16,6 +18,12 @@ use Illuminate\Events\Dispatcher;
use Illuminate\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
try {
(new Dotenv(__DIR__))->load();
} catch (InvalidPathException $e) {
throw $e;
}
/**
* Service Container
* @var Container $container
@ -30,18 +38,17 @@ $container->instance('events', new Dispatcher);
/**
* Database
* @var array $bb_cfg
*/
$container->singleton('db', function ($container) use ($bb_cfg) {
$container->singleton('db', function ($container) {
/** @var Manager $capsule */
$capsule = new Manager;
$capsule->addConnection([
'driver' => 'mysql',
'host' => $bb_cfg['database']['host'],
'database' => $bb_cfg['database']['database'],
'username' => $bb_cfg['database']['username'],
'password' => $bb_cfg['database']['password'],
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'torrentpier'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'pass'),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
@ -82,9 +89,7 @@ $container->singleton('config', function () {
/** @var Repository $config */
$config = new Repository;
$files = [
'tp' => __DIR__ . '/library/config.php',
];
$files = [];
$configPath = __DIR__ . '/config';
@ -97,12 +102,12 @@ $container->singleton('config', function () {
foreach ($files as $key => $path) {
if ($key === 'tp') {
if (!$cfg = OLD_CACHE('bb_config')->get('config_bb_config')) {
// if (!$cfg = OLD_CACHE('bb_config')->get('config_bb_config')) {
$cfg = [];
foreach (DB::table('bb_config')->get()->toArray() as $row) {
$cfg[$row['config_name']] = $row['config_value'];
}
}
// }
/** @noinspection PhpIncludeInspection */
$config->set($key, array_merge(require $path, $cfg));
} else {

View file

@ -11,8 +11,6 @@ define('IN_TRACKER', true);
define('BB_ROOT', './../');
require dirname(__DIR__) . '/common.php';
global $bb_cfg;
if (empty($_SERVER['HTTP_USER_AGENT'])) {
header('Location: http://127.0.0.1', true, 301);
die;
@ -26,8 +24,8 @@ if (isset($_GET['event']) && $_GET['event'] === 'completed') {
dummy_exit(random_int(600, 1200));
}
$announce_interval = $bb_cfg['announce_interval'];
$passkey_key = $bb_cfg['passkey_key'];
$announce_interval = config('tp.announce_interval');
$passkey_key = config('tp.passkey_key');
$max_left_val = 536870912000; // 500 GB
$max_up_down_val = 5497558138880; // 5 TB
$max_up_add_val = 85899345920; // 80 GB
@ -103,13 +101,13 @@ if (!verify_id($passkey, BT_AUTH_KEY_LENGTH)) {
// IP
$ip = $_SERVER['REMOTE_ADDR'];
if (!$bb_cfg['ignore_reported_ip'] && isset($_GET['ip']) && $ip !== $_GET['ip']) {
if (!$bb_cfg['verify_reported_ip']) {
if (!config('tp.ignore_reported_ip') && isset($_GET['ip']) && $ip !== $_GET['ip']) {
if (!config('tp.verify_reported_ip')) {
$ip = $_GET['ip'];
} elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && preg_match_all('#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#', $_SERVER['HTTP_X_FORWARDED_FOR'], $matches)) {
foreach ($matches[0] as $x_ip) {
if ($x_ip === $_GET['ip']) {
if (!$bb_cfg['allow_internal_ip'] && preg_match("#^(10|172\.16|192\.168)\.#", $x_ip)) {
if (!config('tp.allow_internal_ip') && preg_match("#^(10|172\.16|192\.168)\.#", $x_ip)) {
break;
}
$ip = $x_ip;
@ -131,7 +129,7 @@ $peer_hash = md5(
);
// Get cached peer info from previous announce (last peer info)
$lp_info = OLD_CACHE('tr_cache')->get(PEER_HASH_PREFIX . $peer_hash);
$lp_info = OLD_CACHE('tr_cache')->get('peer_' . $peer_hash);
if (DBG_LOG) {
dbg_log(' ', '$lp_info-get_from-CACHE-' . ($lp_info ? 'hit' : 'miss'));
@ -179,7 +177,7 @@ $stopped = ($event === 'stopped');
// Stopped event
if ($stopped) {
OLD_CACHE('tr_cache')->rm(PEER_HASH_PREFIX . $peer_hash);
OLD_CACHE('tr_cache')->rm('peer_' . $peer_hash);
if (DBG_LOG) {
dbg_log(' ', 'stopped');
}
@ -233,15 +231,15 @@ if ($lp_info) {
$tor_type = $row['tor_type'];
// Ratio limits
if ((TR_RATING_LIMITS || $bb_cfg['tracker']['limit_concurrent_ips']) && !$stopped) {
if ((TR_RATING_LIMITS || config('tracker.limit_concurrent_ips')) && !$stopped) {
$user_ratio = ($row['u_down_total'] && $row['u_down_total'] > MIN_DL_FOR_RATIO) ? ($row['u_up_total'] + $row['u_up_release'] + $row['u_up_bonus']) / $row['u_down_total'] : 1;
$rating_msg = '';
if (!$seeder) {
foreach ($bb_cfg['rating'] as $ratio => $limit) {
foreach (config('tp.rating') as $ratio => $limit) {
if ($user_ratio < $ratio) {
$bb_cfg['tracker']['limit_active_tor'] = 1;
$bb_cfg['tracker']['limit_leech_count'] = $limit;
config(['tracker.limit_active_tor' => 1]);
config(['tracker.limit_leech_count' => $limit]);
$rating_msg = " (ratio < $ratio)";
break;
}
@ -249,29 +247,29 @@ if ($lp_info) {
}
// Limit active torrents
if (!isset($bb_cfg['unlimited_users'][$user_id]) && $bb_cfg['tracker']['limit_active_tor'] && (($bb_cfg['tracker']['limit_seed_count'] && $seeder) || ($bb_cfg['tracker']['limit_leech_count'] && !$seeder))) {
if (null === config('tp.unlimited_users.' . $user_id) && config('tracker.limit_active_tor') && ((config('tracker.limit_seed_count') && $seeder) || (config('tracker.limit_leech_count') && !$seeder))) {
$sql = "SELECT COUNT(DISTINCT topic_id) AS active_torrents
FROM " . BB_BT_TRACKER . "
WHERE user_id = $user_id
AND seeder = $seeder
AND topic_id != $topic_id";
if (!$seeder && $bb_cfg['tracker']['leech_expire_factor'] && $user_ratio < 0.5) {
$sql .= " AND update_time > " . (TIMENOW - 60 * $bb_cfg['tracker']['leech_expire_factor']);
if (!$seeder && config('tracker.leech_expire_factor') && $user_ratio < 0.5) {
$sql .= " AND update_time > " . (TIMENOW - 60 * config('tracker.leech_expire_factor'));
}
$sql .= " GROUP BY user_id";
if ($row = OLD_DB()->fetch_row($sql)) {
if ($seeder && $bb_cfg['tracker']['limit_seed_count'] && $row['active_torrents'] >= $bb_cfg['tracker']['limit_seed_count']) {
msg_die('Only ' . $bb_cfg['tracker']['limit_seed_count'] . ' torrent(s) allowed for seeding');
} elseif (!$seeder && $bb_cfg['tracker']['limit_leech_count'] && $row['active_torrents'] >= $bb_cfg['tracker']['limit_leech_count']) {
msg_die('Only ' . $bb_cfg['tracker']['limit_leech_count'] . ' torrent(s) allowed for leeching' . $rating_msg);
if ($seeder && config('tracker.limit_seed_count') && $row['active_torrents'] >= config('tracker.limit_seed_count')) {
msg_die('Only ' . config('tracker.limit_seed_count') . ' torrent(s) allowed for seeding');
} elseif (!$seeder && config('tracker.limit_leech_count') && $row['active_torrents'] >= config('tracker.limit_leech_count')) {
msg_die('Only ' . config('tracker.limit_leech_count') . ' torrent(s) allowed for leeching' . $rating_msg);
}
}
}
// Limit concurrent IPs
if ($bb_cfg['tracker']['limit_concurrent_ips'] && (($bb_cfg['tracker']['limit_seed_ips'] && $seeder) || ($bb_cfg['tracker']['limit_leech_ips'] && !$seeder))) {
if (config('tracker.limit_concurrent_ips') && ((config('tracker.limit_seed_ips') && $seeder) || (config('tracker.limit_leech_ips') && !$seeder))) {
$sql = "SELECT COUNT(DISTINCT ip) AS ips
FROM " . BB_BT_TRACKER . "
WHERE topic_id = $topic_id
@ -279,16 +277,16 @@ if ($lp_info) {
AND seeder = $seeder
AND ip != '$ip_sql'";
if (!$seeder && $bb_cfg['tracker']['leech_expire_factor']) {
$sql .= " AND update_time > " . (TIMENOW - 60 * $bb_cfg['tracker']['leech_expire_factor']);
if (!$seeder && config('tracker.leech_expire_factor')) {
$sql .= " AND update_time > " . (TIMENOW - 60 * config('tracker.leech_expire_factor'));
}
$sql .= " GROUP BY topic_id";
if ($row = OLD_DB()->fetch_row($sql)) {
if ($seeder && $bb_cfg['tracker']['limit_seed_ips'] && $row['ips'] >= $bb_cfg['tracker']['limit_seed_ips']) {
msg_die('You can seed only from ' . $bb_cfg['tracker']['limit_seed_ips'] . " IP's");
} elseif (!$seeder && $bb_cfg['tracker']['limit_leech_ips'] && $row['ips'] >= $bb_cfg['tracker']['limit_leech_ips']) {
msg_die('You can leech only from ' . $bb_cfg['tracker']['limit_leech_ips'] . " IP's");
if ($seeder && config('tracker.limit_seed_ips') && $row['ips'] >= config('tracker.limit_seed_ips')) {
msg_die('You can seed only from ' . config('tracker.limit_seed_ips') . " IP's");
} elseif (!$seeder && config('tracker.limit_leech_ips') && $row['ips'] >= config('tracker.limit_leech_ips')) {
msg_die('You can leech only from ' . config('tracker.limit_leech_ips') . " IP's");
}
}
}
@ -312,7 +310,7 @@ $up_add = ($lp_info && $uploaded > $lp_info['uploaded']) ? $uploaded - $lp_info[
$down_add = ($lp_info && $downloaded > $lp_info['downloaded']) ? $downloaded - $lp_info['downloaded'] : 0;
// Gold/Silver releases
if ($bb_cfg['tracker']['gold_silver_enabled'] && $down_add) {
if (config('tracker.gold_silver_enabled') && $down_add) {
if ($tor_type == TOR_TYPE_GOLD) {
$down_add = 0;
} // Silver releases
@ -322,7 +320,7 @@ if ($bb_cfg['tracker']['gold_silver_enabled'] && $down_add) {
}
// Freeleech
if ($bb_cfg['tracker']['freeleech'] && $down_add) {
if (config('tracker.freeleech') && $down_add) {
$down_add = 0;
}
@ -388,14 +386,14 @@ $lp_info = array(
'tor_type' => (int)$tor_type,
);
$lp_info_cached = OLD_CACHE('tr_cache')->set(PEER_HASH_PREFIX . $peer_hash, $lp_info, PEER_HASH_EXPIRE);
$lp_info_cached = OLD_CACHE('tr_cache')->set('peer_' . $peer_hash, $lp_info, round(config('tp.announce_interval') * (0.85 * config('tracker.expire_factor'))));
if (DBG_LOG && !$lp_info_cached) {
dbg_log(' ', '$lp_info-caching-FAIL');
}
// Get cached output
$output = OLD_CACHE('tr_cache')->get(PEERS_LIST_PREFIX . $topic_id);
$output = OLD_CACHE('tr_cache')->get('peers_list_' . $topic_id);
if (DBG_LOG) {
dbg_log(' ', '$output-get_from-CACHE-' . ($output !== false ? 'hit' : 'miss'));
@ -403,8 +401,8 @@ if (DBG_LOG) {
if (!$output) {
// Retrieve peers
$numwant = (int)$bb_cfg['tracker']['numwant'];
$compact_mode = ($bb_cfg['tracker']['compact_mode'] || !empty($compact));
$numwant = (int)config('tracker.numwant');
$compact_mode = (config('tracker.compact_mode') || !empty($compact));
$rowset = OLD_DB()->fetch_rowset("
SELECT ip, port
@ -434,7 +432,7 @@ if (!$output) {
$seeders = 0;
$leechers = 0;
if ($bb_cfg['tracker']['scrape']) {
if (config('tracker.scrape')) {
$row = OLD_DB()->fetch_row("
SELECT seeders, leechers
FROM " . BB_BT_TRACKER_SNAP . "
@ -454,7 +452,7 @@ if (!$output) {
'incomplete' => (int)$leechers,
);
$peers_list_cached = OLD_CACHE('tr_cache')->set(PEERS_LIST_PREFIX . $topic_id, $output, PEERS_LIST_EXPIRE);
$peers_list_cached = OLD_CACHE('tr_cache')->set('peers_list_' . $topic_id, $output, round(config('tp.announce_interval') * 0.7));
if (DBG_LOG && !$peers_list_cached) {
dbg_log(' ', '$output-caching-FAIL');

View file

@ -11,11 +11,9 @@ if (!defined('IN_TRACKER')) {
die(basename(__FILE__));
}
global $bb_cfg;
// Exit if tracker is disabled
if ($bb_cfg['tracker']['off']) {
msg_die($bb_cfg['tracker']['off_reason']);
if (config('tracker.off')) {
msg_die(config('tracker.off_reason'));
}
//

View file

@ -11,9 +11,7 @@ define('IN_TRACKER', true);
define('BB_ROOT', './../');
require dirname(__DIR__) . '/common.php';
global $bb_cfg;
if (!$bb_cfg['tracker']['scrape']) {
if (!config('tracker.scrape')) {
msg_die('Please disable SCRAPE!');
}

View file

@ -50,25 +50,19 @@ if (!file_exists(__DIR__ . '/vendor/autoload.php')) {
}
require_once __DIR__ . '/vendor/autoload.php';
// Legacy config
use Dotenv\Dotenv;
use Dotenv\Exception\InvalidPathException;
/**
* Container
*/
require_once __DIR__ . '/bootstrap.php';
try {
(new Dotenv(__DIR__))->load();
} catch (InvalidPathException $e) {
throw $e;
}
require_once __DIR__ . '/library/config.php';
$server_protocol = $bb_cfg['cookie_secure'] ? 'https://' : 'http://';
$server_port = in_array((int)$bb_cfg['server_port'], array(80, 443), true) ? '' : ':' . $bb_cfg['server_port'];
define('FORUM_PATH', $bb_cfg['script_path']);
define('FULL_URL', $server_protocol . $bb_cfg['server_name'] . $server_port . $bb_cfg['script_path']);
$server_protocol = config('tp.cookie_secure') ? 'https://' : 'http://';
$server_port = in_array((int)config('tp.server_port'), array(80, 443), true) ? '' : ':' . config('tp.server_port');
define('FORUM_PATH', config('tp.script_path'));
define('FULL_URL', $server_protocol . config('tp.server_name') . $server_port . config('tp.script_path'));
unset($server_protocol, $server_port);
// Debug options
define('DBG_USER', (isset($_COOKIE[COOKIE_DBG])));
define('DBG_USER', isset($_COOKIE[COOKIE_DBG]));
// Board / tracker shared constants and functions
define('BB_BT_TORRENTS', 'bb_bt_torrents');
@ -78,11 +72,6 @@ define('BB_BT_USERS', 'bb_bt_users');
define('BT_AUTH_KEY_LENGTH', 10);
define('PEER_HASH_PREFIX', 'peer_');
define('PEERS_LIST_PREFIX', 'peers_list_');
define('PEER_HASH_EXPIRE', round($bb_cfg['announce_interval'] * (0.85 * $bb_cfg['tracker']['expire_factor']))); // sec
define('PEERS_LIST_EXPIRE', round($bb_cfg['announce_interval'] * 0.7)); // sec
define('DL_STATUS_RELEASER', -1);
define('DL_STATUS_DOWN', 0);
define('DL_STATUS_COMPLETE', 1);
@ -98,10 +87,10 @@ define('BOT_UID', -746);
/**
* Progressive error reporting
*/
if ($bb_cfg['bugsnag']['enabled']) {
if (config('tp.bugsnag.enabled')) {
if (env('APP_ENV', 'production') !== 'local') {
/** @var Bugsnag\Handler $bugsnag */
$bugsnag = Bugsnag\Client::make($bb_cfg['bugsnag']['api_key']);
$bugsnag = Bugsnag\Client::make(config('tp.bugsnag.api_key'));
Bugsnag\Handler::register($bugsnag);
}
} else {
@ -116,7 +105,7 @@ if ($bb_cfg['bugsnag']['enabled']) {
/**
* Database
*/
$DBS = new TorrentPier\Legacy\Dbs($bb_cfg);
$DBS = new TorrentPier\Legacy\Dbs(config('tp'));
function OLD_DB($db_alias = 'db')
{
@ -127,7 +116,7 @@ function OLD_DB($db_alias = 'db')
/**
* Cache
*/
$CACHES = new TorrentPier\Legacy\Caches($bb_cfg);
$CACHES = new TorrentPier\Legacy\Caches(config('tp'));
function OLD_CACHE($cache_name)
{
@ -138,42 +127,37 @@ function OLD_CACHE($cache_name)
/**
* Datastore
*/
switch ($bb_cfg['datastore_type']) {
switch (config('tp.datastore_type')) {
case 'memcache':
$datastore = new TorrentPier\Legacy\Datastore\Memcache($bb_cfg['cache']['memcache'], $bb_cfg['cache']['prefix']);
$datastore = new TorrentPier\Legacy\Datastore\Memcache(config('tp.cache.memcache'), config('tp.cache.prefix'));
break;
case 'sqlite':
$default_cfg = array(
'db_file_path' => $bb_cfg['cache']['db_dir'] . 'datastore.sqlite.db',
'db_file_path' => config('tp.cache.db_dir') . 'datastore.sqlite.db',
'pconnect' => true,
'con_required' => true,
);
$datastore = new TorrentPier\Legacy\Datastore\Sqlite($default_cfg, $bb_cfg['cache']['prefix']);
$datastore = new TorrentPier\Legacy\Datastore\Sqlite($default_cfg, config('tp.cache.prefix'));
break;
case 'redis':
$datastore = new TorrentPier\Legacy\Datastore\Redis($bb_cfg['cache']['redis'], $bb_cfg['cache']['prefix']);
$datastore = new TorrentPier\Legacy\Datastore\Redis(config('tp.cache.redis'), config('tp.cache.prefix'));
break;
case 'apc':
$datastore = new TorrentPier\Legacy\Datastore\Apc($bb_cfg['cache']['prefix']);
$datastore = new TorrentPier\Legacy\Datastore\Apc(config('tp.cache.prefix'));
break;
case 'xcache':
$datastore = new TorrentPier\Legacy\Datastore\Xcache($bb_cfg['cache']['prefix']);
$datastore = new TorrentPier\Legacy\Datastore\Xcache(config('tp.cache.prefix'));
break;
case 'filecache':
default:
$datastore = new TorrentPier\Legacy\Datastore\File($bb_cfg['cache']['db_dir'] . 'datastore/', $bb_cfg['cache']['prefix']);
$datastore = new TorrentPier\Legacy\Datastore\File(config('tp.cache.db_dir') . 'datastore/', config('tp.cache.prefix'));
}
/**
* Container
*/
require_once __DIR__ . '/bootstrap.php';
function sql_dbg_enabled()
{
return (SQL_DEBUG && DBG_USER && !empty($_COOKIE['sql_log']));

View file

@ -7,6 +7,554 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
return [
$domain_name = env('APP_DOMAIN', 'torrentpier.com');
return [
/**
* Increase number after changing js or css
*/
'js_ver' => 1,
'css_ver' => 1,
/**
* Version info
*/
'tp_version' => '2.3.0',
'tp_release_date' => '01-12-2017',
'tp_release_codename' => 'Bison',
/**
* Old database
*/
'db' => [
'db' => [
env('DB_HOST', 'localhost'),
env('DB_DATABASE', 'torrentpier'),
env('DB_USERNAME', 'root'),
env('DB_PASSWORD', 'pass'),
'utf8',
false
],
],
'db_alias' => [
'log' => 'db', // BB_LOG
'search' => 'db', // BB_TOPIC_SEARCH
'sres' => 'db', // BB_BT_USER_SETTINGS, BB_SEARCH_RESULTS
'u_ses' => 'db', // BB_USER_SES, BB_USER_LASTVISIT
'dls' => 'db', // BB_BT_DLS_*
'ip' => 'db', // BB_POSTS_IP
'ut' => 'db', // BB_TOPICS_USER_POSTED
'pm' => 'db', // BB_PRIVMSGS, BB_PRIVMSGS_TEXT
'pt' => 'db', // BB_POSTS_TEXT
],
/**
* Database
*/
'database' => [
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'torrentpier'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'pass'),
],
/**
* Cache
* Available cache types: memcache, sqlite, redis, apc, xcache (default of filecache)
*/
'cache' => [
'pconnect' => true,
'db_dir' => realpath(BB_ROOT) . '/internal_data/cache/filecache/',
'prefix' => 'tp_',
'memcache' => [
'host' => '127.0.0.1',
'port' => 11211,
'pconnect' => true,
'con_required' => true,
],
'redis' => [
'host' => '127.0.0.1',
'port' => 6379,
'con_required' => true,
],
'engines' => [
'bb_cache' => ['filecache', []],
'bb_config' => ['filecache', []],
'tr_cache' => ['filecache', []],
'session_cache' => ['filecache', []],
'bb_cap_sid' => ['filecache', []],
'bb_login_err' => ['filecache', []],
'bb_poll_data' => ['filecache', []],
],
],
/**
* Datastore
* Available datastore types: memcache, sqlite, redis, apc, xcache (default filecache)
*/
'datastore_type' => 'filecache',
/**
* Server
*/
'server_name' => $domain_name, // the domain name from which this board runs
'server_port' => (!empty($_SERVER['SERVER_PORT'])) ? $_SERVER['SERVER_PORT'] : 80, // the port your server is running on
'script_path' => '/', // the path where FORUM is located relative to the domain name
'gzip_compress' => false, // compress output
/**
* Tracker
*/
'announce_interval' => 2400, // announce interval (default: 1800)
'passkey_key' => 'uk', // passkey key name in GET request
'ignore_reported_ip' => false, // ignore IP reported by client
'verify_reported_ip' => true, // verify IP reported by client against $_SERVER['HTTP_X_FORWARDED_FOR']
'allow_internal_ip' => false, // allow internal IP (10.xx.. etc.)
/**
* Ocelot
*/
'ocelot' => [
'enabled' => false,
'host' => $domain_name,
'port' => 34000,
'url' => "http://$domain_name:34000/", // with '/'
'secret' => 'some_10_chars', // 10 chars
'stats' => 'some_10_chars', // 10 chars
],
/**
* FAQ url help link
*/
'how_to_download_url_help' => 'viewtopic.php?t=1', // Как скачивать?
'what_is_torrent_url_help' => 'viewtopic.php?t=2', // Что такое торрент?
'ratio_url_help' => 'viewtopic.php?t=3', // Рейтинг и ограничения
'search_help_url' => 'viewtopic.php?t=4', // Помощь по поиску
/**
* Torrents
*/
'bt_min_ratio_allow_dl_tor' => 0.3, // 0 - disable
'bt_min_ratio_warning' => 0.6, // 0 - disable
'show_dl_status_in_search' => true,
'show_dl_status_in_forum' => true,
'show_tor_info_in_dl_list' => true,
'allow_dl_list_names_mode' => true,
/**
* Days to keep torrent registered
*/
'seeder_last_seen_days_keep' => 0, // сколько дней назад был сид последний раз
'seeder_never_seen_days_keep' => 0, // сколько дней имеется статус "Сида не было никогда"
/**
* DL status (days to keep user's dl status records)
*/
'dl_will_days_keep' => 360,
'dl_down_days_keep' => 180,
'dl_complete_days_keep' => 180,
'dl_cancel_days_keep' => 30,
/**
* Tor-Stats
*/
'torstat_days_keep' => 60, // days to keep user's per-torrent stats
/**
* Tor-Help
*/
'torhelp_enabled' => false, // find dead torrents (without seeder) that user might help seeding
/**
* URL's
*/
'ajax_url' => 'ajax.php',
'login_url' => 'login.php',
'posting_url' => 'posting.php',
'pm_url' => 'privmsg.php',
/**
* Templates
*/
'templates' => [
'default' => 'Стандартный',
],
'tpl_name' => 'default',
'stylesheet' => 'main.css',
'show_sidebar1_on_every_page' => false,
'show_sidebar2_on_every_page' => false,
/**
* Cookie
*/
'cookie_domain' => in_array($domain_name, [getenv('SERVER_ADDR'), 'localhost'], true) ? '' : ".$domain_name",
'cookie_secure' => !empty($_SERVER['HTTPS']) ? 1 : 0,
'cookie_prefix' => 'bb_', // 'bb_'
/**
* Sessions
*/
'session_update_intrv' => 180, // sec
'user_session_duration' => 1800, // sec
'admin_session_duration' => 6 * 3600, // sec
'user_session_gc_ttl' => 1800, // number of seconds that a staled session entry may remain in sessions table
'session_cache_gc_ttl' => 1200, // sec
'max_last_visit_days' => 14, // days
'last_visit_update_intrv' => 3600, // sec
/**
* Registration
*/
'invalid_logins' => 5, // Количество неверных попыток ввода пароля, перед выводом проверки капчей
'new_user_reg_disabled' => false, // Запретить регистрацию новых учетных записей
'unique_ip' => false, // Запретить регистрацию нескольких учетных записей с одного ip
'new_user_reg_restricted' => false, // Ограничить регистрацию новых пользователей по времени с 01:00 до 17:00
'reg_email_activation' => true, // Требовать активацию учетной записи по email
/**
* Email
*/
'board_email' => "noreply@$domain_name", // admin email address
'board_email_form' => false, // can users send email to each other via board
'board_email_sig' => '', // this text will be attached to all emails the board sends
'board_email_sitename' => $domain_name, // sitename used in all emails header
'topic_notify_enabled' => true,
'pm_notify_enabled' => true,
'group_send_email' => true,
'email_change_disabled' => false, // disable changing email by user
'bounce_email' => "bounce@$domain_name", // bounce email address
'tech_admin_email' => "admin@$domain_name", // email for sending error reports
'abuse_email' => "abuse@$domain_name",
'adv_email' => "adv@$domain_name",
/**
* Bugsnag error reporting
*/
'bugsnag' => [
'enabled' => false,
'api_key' => 'ee1adc9739cfceb01ce4a450ae1e52bf',
],
/**
* Special users
*/
'dbg_users' => [
2 => 'admin',
],
'unlimited_users' => [
2 => 'admin',
],
'super_admins' => [
2 => 'admin',
],
/**
* Date format
*/
'date_format' => 'Y-m-d',
/**
* Subforums
*/
'sf_on_first_page_only' => true,
/**
* Forums
*/
'allowed_topics_per_page' => [50, 100, 150, 200, 250, 300],
/**
* Topics
*/
'show_quick_reply' => true,
'show_rank_text' => false,
'show_rank_image' => true,
'show_poster_joined' => true,
'show_poster_posts' => true,
'show_poster_from' => true,
'show_bot_nick' => false,
'parse_ed2k_links' => true, // make ed2k links clickable
'post_date_format' => 'd-M-Y H:i',
'ext_link_new_win' => true, // open external links in new window
'topic_moved_days_keep' => 7, // remove topic moved links after xx days (or FALSE to disable)
'allowed_posts_per_page' => [15, 30, 50, 100],
'user_signature_start' => '<div class="signature"><br />_________________<br />',
'user_signature_end' => '</div>', // Это позволит использовать html теги, которые требуют закрытия. Например <table> или <font color>
/**
* Posts
*/
'use_posts_cache' => true,
'posts_cache_days_keep' => 14,
'max_post_length' => 120000,
'use_ajax_posts' => true,
/**
* Search
*/
'search_engine_type' => 'mysql', // none, mysql, sphinx
'sphinx_topic_titles_host' => '127.0.0.1',
'sphinx_topic_titles_port' => 3312,
'sphinx_config_path' => BB_ROOT . 'install/sphinx/sphinx.conf',
'disable_ft_search_in_posts' => false, // disable searching in post bodies
'disable_search_for_guest' => true,
'allow_search_in_bool_mode' => true,
'max_search_words_per_post' => 200,
'search_min_word_len' => 3,
'search_max_word_len' => 35,
'limit_max_search_results' => false,
'spam_filter_file_path' => '', // BB_PATH .'/misc/spam_filter_words.txt',
/**
* Posting
*/
'prevent_multiposting' => true, // replace "reply" with "edit last msg" if user (not admin or mod) is last topic poster
'max_smilies' => 10, // Максимальное число смайлов в посте (0 - без ограничения)
/**
* PM
*/
'privmsg_disable' => false, // отключить систему личных сообщений на форуме
'max_outgoing_pm_cnt' => 10, // ограничение на кол. одновременных исходящих лс (для замедления рассылки спама)
'max_inbox_privmsgs' => 500, // максимальное число сообщений в папке входящие
'max_savebox_privmsgs' => 500, // максимальное число сообщений в папке сохраненные
'max_sentbox_privmsgs' => 500, // максимальное число сообщений в папке отправленные
'pm_days_keep' => 180, // время хранения ЛС
/**
* Actions log
*/
'log_days_keep' => 90,
/**
* Users
*/
'color_nick' => true, // Окраска ников пользователей по user_rank
'user_not_activated_days_keep' => 7, // "not activated" == "not finished registration"
'user_not_active_days_keep' => 180, // inactive users but only with no posts
/**
* Groups
*/
'group_members_per_page' => 50,
/**
* Tidy
*/
'tidy_post' => (!in_array('tidy', get_loaded_extensions(), true)) ? false : true,
/**
* Misc
*/
'mem_on_start' => MEM_USAGE ? memory_get_usage() : 0,
'translate_dates' => true, // in displaying time
'use_word_censor' => true,
'last_visit_date_format' => 'd-M H:i',
'last_post_date_format' => 'd-M-y H:i',
'poll_max_days' => 180, // сколько дней с момента создания темы опрос будет активным
'allow_change' => [
'language' => true,
'dateformat' => true,
],
'trash_forum_id' => 0, // (int) 7
'first_logon_redirect_url' => 'index.php',
'terms_and_conditions_url' => 'terms.php',
'tor_help_links' => 'terms.php',
'user_agreement_url' => 'info.php?show=user_agreement',
'copyright_holders_url' => 'info.php?show=copyright_holders',
'advert_url' => 'info.php?show=advert',
'default_lang_dir' => LANG_ROOT_DIR . '/en/',
/**
* Extensions
*/
'file_id_ext' => [
1 => 'gif',
2 => 'gz',
3 => 'jpg',
4 => 'png',
5 => 'rar',
6 => 'tar',
7 => 'tiff',
8 => 'torrent',
9 => 'zip',
],
/**
* Attachments
*/
'attach' => [
'upload_path' => DATA_DIR . '/torrent_files', // путь к директории с torrent файлами
'max_size' => 5 * 1024 * 1024, // максимальный размер файла в байтах
],
'tor_forums_allowed_ext' => ['torrent', 'zip', 'rar'], // для разделов с раздачами
'gen_forums_allowed_ext' => ['zip', 'rar'], // для обычных разделов
/**
* Avatars
*/
'avatars' => [
'allowed_ext' => ['gif', 'jpg', 'jpeg', 'png'], // разрешенные форматы файлов
'bot_avatar' => '/gallery/bot.gif', // аватара бота
'max_size' => 100 * 1024, // размер аватары в байтах
'max_height' => 100, // высота аватара в px
'max_width' => 100, // ширина аватара в px
'no_avatar' => '/gallery/noavatar.png', // дефолтная аватара
'display_path' => '/data/avatars', // путь к директории с аватарами
'upload_path' => BB_PATH . '/data/avatars/', // путь к директории с аватарами
'up_allowed' => true, // разрешить загрузку аватар
],
/**
* Group avatars
*/
'group_avatars' => [
'allowed_ext' => ['gif', 'jpg', 'jpeg', 'png'], // разрешенные форматы файлов
'max_size' => 300 * 1024, // размер аватары в байтах
'max_height' => 300, // высота аватара в px
'max_width' => 300, // ширина аватара в px
'no_avatar' => '/gallery/noavatar.png', // дефолтная аватара
'display_path' => '/data/avatars', // путь к директории с аватарами
'upload_path' => BB_PATH . '/data/avatars/', // путь к директории с аватарами
'up_allowed' => true, // разрешить загрузку аватар
],
/**
* Captcha
* Get a Google reCAPTCHA API Key: https://www.google.com/recaptcha/admin
*/
'captcha' => [
'disabled' => false,
'public_key' => '', // your public key
'secret_key' => '', // your secret key
'theme' => 'light', // light or dark
],
/**
* Atom feed
*/
'atom' => [
'path' => INT_DATA_DIR . '/atom', // without ending slash
'url' => './internal_data/atom', // without ending slash
],
/**
* Nofollow
*/
'nofollow' => [
'disabled' => false,
'allowed_url' => [$domain_name], // 'allowed.site', 'www.allowed.site'
],
/**
* Ratio settings
* Don't change the order of ratios (from 0 to 1):
* < 0.4 -- allow only 1 torrent for leeching
* < 0.5 -- only 2
* rating < 0.6 -- only 3
* rating > 0.6 -- depend on your tracker config limits
*/
'rating' => [
'0.4' => 1,
'0.5' => 2,
'0.6' => 3,
],
/**
* Иконки статусов раздач
*/
'tor_icons' => [
TOR_NOT_APPROVED => '<span class="tor-icon tor-not-approved">*</span>',
TOR_CLOSED => '<span class="tor-icon tor-closed">x</span>',
TOR_APPROVED => '<span class="tor-icon tor-approved">&radic;</span>',
TOR_NEED_EDIT => '<span class="tor-icon tor-need-edit">?</span>',
TOR_NO_DESC => '<span class="tor-icon tor-no-desc">!</span>',
TOR_DUP => '<span class="tor-icon tor-dup">D</span>',
TOR_CLOSED_CPHOLD => '<span class="tor-icon tor-closed-cp">&copy;</span>',
TOR_CONSUMED => '<span class="tor-icon tor-consumed">&sum;</span>',
TOR_DOUBTFUL => '<span class="tor-icon tor-approved">#</span>',
TOR_CHECKING => '<span class="tor-icon tor-checking">%</span>',
TOR_TMP => '<span class="tor-icon tor-dup">T</span>',
TOR_PREMOD => '<span class="tor-icon tor-dup">&#8719;</span>',
TOR_REPLENISH => '<span class="tor-icon tor-dup">R</span>',
],
/**
* Запрет на скачивание
*/
'tor_frozen' => [
TOR_CHECKING => true,
TOR_CLOSED => true,
TOR_CLOSED_CPHOLD => true,
TOR_CONSUMED => true,
TOR_DUP => true,
TOR_NO_DESC => true,
TOR_PREMOD => true,
],
/**
* Разрешение на скачку автором, если закрыто на скачивание
*/
'tor_frozen_author_download' => [
TOR_CHECKING => true,
TOR_NO_DESC => true,
TOR_PREMOD => true,
],
/**
* Запрет на редактирование головного сообщения
*/
'tor_cannot_edit' => [
TOR_CHECKING => true,
TOR_CLOSED => true,
TOR_CONSUMED => true,
TOR_DUP => true,
],
/**
* Запрет на создание новых раздач если стоит статус недооформлено/неоформлено/сомнительно
*/
'tor_cannot_new' => [TOR_NEED_EDIT, TOR_NO_DESC, TOR_DOUBTFUL],
/**
* Разрешение на ответ релизера, если раздача исправлена
*/
'tor_reply' => [TOR_NEED_EDIT, TOR_NO_DESC, TOR_DOUBTFUL],
/**
* Если такой статус у релиза, то статистика раздачи будет скрыта
*/
'tor_no_tor_act' => [
TOR_CLOSED => true,
TOR_DUP => true,
TOR_CLOSED_CPHOLD => true,
TOR_CONSUMED => true,
],
/**
* Vote graphic length defines the maximum length of a vote result graphic
*/
'vote_graphic_length' => 205,
'privmsg_graphic_length' => 175,
'topic_left_column_witdh' => 150,
/**
* Images auto-resize
*/
'post_img_width_decr' => 52,
'attach_img_width_decr' => 130,
];

2
dl.php
View file

@ -24,7 +24,7 @@ $thumbnail = request_var('thumb', 0);
// Send file to browser
function send_file_to_browser($attachment, $upload_dir)
{
global $bb_cfg, $lang, $userdata;
global $lang, $userdata;
$filename = ($upload_dir == '') ? $attachment['physical_filename'] : $upload_dir . '/' . $attachment['physical_filename'];

View file

@ -33,12 +33,12 @@ if ($mode == 'get_feed_url' && ($type == 'f' || $type == 'u') && $id >= 0) {
bb_simple_die($lang['ATOM_ERROR'] . ' #1');
}
}
if (file_exists($bb_cfg['atom']['path'] . '/f/' . $id . '.atom') && filemtime($bb_cfg['atom']['path'] . '/f/' . $id . '.atom') > $timecheck) {
redirectToUrl($bb_cfg['atom']['url'] . '/f/' . $id . '.atom');
if (file_exists(config('tp.atom.path') . '/f/' . $id . '.atom') && filemtime(config('tp.atom.path') . '/f/' . $id . '.atom') > $timecheck) {
redirectToUrl(config('tp.atom.url') . '/f/' . $id . '.atom');
} else {
require_once INC_DIR . '/functions_atom.php';
if (update_forum_feed($id, $forum_data)) {
redirectToUrl($bb_cfg['atom']['url'] . '/f/' . $id . '.atom');
redirectToUrl(config('tp.atom.url') . '/f/' . $id . '.atom');
} else {
bb_simple_die($lang['ATOM_NO_FORUM']);
}
@ -52,12 +52,12 @@ if ($mode == 'get_feed_url' && ($type == 'f' || $type == 'u') && $id >= 0) {
if (!$username = get_username($id)) {
bb_simple_die($lang['ATOM_ERROR'] . ' #3');
}
if (file_exists($bb_cfg['atom']['path'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom') && filemtime($bb_cfg['atom']['path'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom') > $timecheck) {
redirectToUrl($bb_cfg['atom']['url'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
if (file_exists(config('tp.atom.path') . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom') && filemtime(config('tp.atom.path') . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom') > $timecheck) {
redirectToUrl(config('tp.atom.url') . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
} else {
require_once INC_DIR . '/functions_atom.php';
if (update_user_feed($id, $username)) {
redirectToUrl($bb_cfg['atom']['url'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
redirectToUrl(config('tp.atom.url') . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
} else {
bb_simple_die($lang['ATOM_NO_USER']);
}

View file

@ -20,7 +20,7 @@ $select_sort_mode = $select_sort_order = '';
function generate_user_info(&$row, $date_format, $group_mod, &$from, &$posts, &$joined, &$pm, &$email, &$www, &$user_time, &$avatar)
{
global $lang, $images, $bb_cfg;
global $lang, $images;
$from = (!empty($row['user_from'])) ? $row['user_from'] : '';
$joined = bb_date($row['user_regdate']);
@ -30,7 +30,7 @@ function generate_user_info(&$row, $date_format, $group_mod, &$from, &$posts, &$
$avatar = get_avatar($row['user_id'], $row['avatar_ext_id'], !bf($row['user_opt'], 'user_opt', 'dis_avatar'), '', 50, 50);
if (bf($row['user_opt'], 'user_opt', 'user_viewemail') || $group_mod) {
$email_uri = ($bb_cfg['board_email_form']) ? ("profile.php?mode=email&amp;" . POST_USERS_URL . "=" . $row['user_id']) : 'mailto:' . $row['user_email'];
$email_uri = config('tp.board_email_form') ? ("profile.php?mode=email&amp;" . POST_USERS_URL . "=" . $row['user_id']) : 'mailto:' . $row['user_email'];
$email = '<a class="editable" href="' . $email_uri . '">' . $row['user_email'] . '</a>';
} else {
$email = '';
@ -51,7 +51,7 @@ set_die_append_msg();
$group_id = isset($_REQUEST[POST_GROUPS_URL]) ? (int)$_REQUEST[POST_GROUPS_URL] : null;
$start = isset($_REQUEST['start']) ? abs((int)$_REQUEST['start']) : 0;
$per_page = $bb_cfg['group_members_per_page'];
$per_page = config('tp.group_members_per_page');
$view_mode = isset($_REQUEST['view']) ? (string)$_REQUEST['view'] : null;
$rel_limit = 50;
@ -195,18 +195,18 @@ if (!$group_id) {
add_user_into_group($group_id, $userdata['user_id'], 1, TIMENOW);
if ($bb_cfg['group_send_email']) {
if (config('tp.group_send_email')) {
/** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\Emailer();
$emailer->set_from([$bb_cfg['board_email'] => $bb_cfg['sitename']]);
$emailer->set_from([config('tp.board_email') => config('tp.sitename')]);
$emailer->set_to([$moderator['user_email'] => $moderator['username']]);
$emailer->set_subject($lang['EMAILER_SUBJECT']['GROUP_REQUEST']);
$emailer->set_template('group_request', $moderator['user_lang']);
$emailer->assign_vars(array(
'USER' => $userdata['username'],
'SITENAME' => $bb_cfg['sitename'],
'SITENAME' => config('tp.sitename'),
'GROUP_MODERATOR' => $moderator['username'],
'U_GROUP' => make_url(GROUP_URL . $group_id),
));
@ -237,17 +237,17 @@ if (!$group_id) {
add_user_into_group($group_id, $row['user_id']);
if ($bb_cfg['group_send_email']) {
if (config('tp.group_send_email')) {
/** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\Emailer();
$emailer->set_from([$bb_cfg['board_email'] => $bb_cfg['sitename']]);
$emailer->set_from([config('tp.board_email') => config('tp.sitename')]);
$emailer->set_to([$row['user_email'] => $row['username']]);
$emailer->set_subject($lang['EMAILER_SUBJECT']['GROUP_ADDED']);
$emailer->set_template('group_added', $row['user_lang']);
$emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'],
'SITENAME' => config('tp.sitename'),
'GROUP_NAME' => $group_info['group_name'],
'U_GROUP' => make_url(GROUP_URL . $group_id),
));
@ -287,7 +287,7 @@ if (!$group_id) {
}
}
// Email users when they are approved
if (!empty($_POST['approve']) && $bb_cfg['group_send_email']) {
if (!empty($_POST['approve']) && config('tp.group_send_email')) {
$sql_select = "SELECT username, user_email, user_lang
FROM " . BB_USERS . "
WHERE user_id IN($sql_in)";
@ -300,13 +300,13 @@ if (!$group_id) {
/** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\Emailer();
$emailer->set_from([$bb_cfg['board_email'] => $bb_cfg['sitename']]);
$emailer->set_from([config('tp.board_email') => config('tp.sitename')]);
$emailer->set_to([$row['user_email'] => $row['username']]);
$emailer->set_subject($lang['EMAILER_SUBJECT']['GROUP_APPROVED']);
$emailer->set_template('group_approved', $row['user_lang']);
$emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'],
'SITENAME' => config('tp.sitename'),
'GROUP_NAME' => $group_info['group_name'],
'U_GROUP' => make_url(GROUP_URL . $group_id),
));
@ -375,7 +375,7 @@ if (!$group_id) {
$username = $group_moderator['username'];
$user_id = $group_moderator['user_id'];
generate_user_info($group_moderator, $bb_cfg['default_dateformat'], $is_moderator, $from, $posts, $joined, $pm, $email, $www, $user_time, $avatar);
generate_user_info($group_moderator, config('tp.default_dateformat'), $is_moderator, $from, $posts, $joined, $pm, $email, $www, $user_time, $avatar);
$group_type = '';
if ($group_info['group_type'] == GROUP_OPEN) {
@ -524,7 +524,7 @@ if (!$group_id) {
foreach ($group_members as $i => $member) {
$user_id = $member['user_id'];
generate_user_info($member, $bb_cfg['default_dateformat'], $is_moderator, $from, $posts, $joined, $pm, $email, $www, $user_time, $avatar);
generate_user_info($member, config('tp.default_dateformat'), $is_moderator, $from, $posts, $joined, $pm, $email, $www, $user_time, $avatar);
if ($group_info['group_type'] != GROUP_HIDDEN || $is_group_member || $is_moderator) {
$row_class = !($i % 2) ? 'row1' : 'row2';
@ -578,7 +578,7 @@ if (!$group_id) {
foreach ($modgroup_pending_list as $i => $member) {
$user_id = $member['user_id'];
generate_user_info($member, $bb_cfg['default_dateformat'], $is_moderator, $from, $posts, $joined, $pm, $email, $www, $user_time, $avatar);
generate_user_info($member, config('tp.default_dateformat'), $is_moderator, $from, $posts, $joined, $pm, $email, $www, $user_time, $avatar);
$row_class = !($i % 2) ? 'row1' : 'row2';

View file

@ -36,10 +36,10 @@ if ($group_id) {
if ($is_moderator) {
// Avatar
if ($submit) {
if (!empty($_FILES['avatar']['name']) && $bb_cfg['group_avatars']['up_allowed']) {
if (!empty($_FILES['avatar']['name']) && config('tp.group_avatars.up_allowed')) {
$upload = new TorrentPier\Legacy\Common\Upload();
if ($upload->init($bb_cfg['group_avatars'], $_FILES['avatar']) and $upload->store('avatar', array("user_id" => GROUP_AVATAR_MASK . $group_id, "avatar_ext_id" => $group_info['avatar_ext_id']))) {
if ($upload->init(config('tp.group_avatars'), $_FILES['avatar']) and $upload->store('avatar', array("user_id" => GROUP_AVATAR_MASK . $group_id, "avatar_ext_id" => $group_info['avatar_ext_id']))) {
$avatar_ext_id = (int)$upload->file_ext_id;
} else {
bb_die(implode($upload->errors));
@ -78,7 +78,7 @@ if ($is_moderator) {
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_GROUP_CONFIG_ACTION' => "group_edit.php?" . POST_GROUPS_URL . "=$group_id",
'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], $bb_cfg['group_avatars']['max_width'], $bb_cfg['group_avatars']['max_height'], (round($bb_cfg['group_avatars']['max_size'] / 1024))),
'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], config('tp.group_avatars.max_width'), config('tp.group_avatars.max_height'), round(config('tp.group_avatars.max_size') / 1024)),
'AVATAR_IMG' => get_avatar(GROUP_AVATAR_MASK . $group_id, $group_info['avatar_ext_id']),
));

View file

@ -25,10 +25,10 @@ $datastore->enqueue(array(
'moderators',
'cat_forums',
));
if ($bb_cfg['show_latest_news']) {
if (config('tp.show_latest_news')) {
$datastore->enqueue('latest_news');
}
if ($bb_cfg['show_network_news']) {
if (config('tp.show_network_news')) {
$datastore->enqueue('network_news');
}
@ -44,7 +44,7 @@ $req_page = 'index_page';
$req_page .= ($viewcat) ? "_c{$viewcat}" : '';
define('REQUESTED_PAGE', $req_page);
caching_output(IS_GUEST, 'send', REQUESTED_PAGE . '_guest_' . $bb_cfg['default_lang']);
caching_output(IS_GUEST, 'send', REQUESTED_PAGE . '_guest_' . config('tp.default_lang'));
$hide_cat_opt = isset($user->opt_js['h_cat']) ? (string)$user->opt_js['h_cat'] : 0;
$hide_cat_user = array_flip(explode('-', $hide_cat_opt));
@ -248,7 +248,7 @@ foreach ($cat_forums as $cid => $c) {
'LAST_TOPIC_ID' => $f['last_topic_id'],
'LAST_TOPIC_TIP' => $f['last_topic_title'],
'LAST_TOPIC_TITLE' => wbr(str_short($f['last_topic_title'], $last_topic_max_len)),
'LAST_POST_TIME' => bb_date($f['last_post_time'], $bb_cfg['last_post_date_format']),
'LAST_POST_TIME' => bb_date($f['last_post_time'], config('tp.last_post_date_format')),
'LAST_POST_USER' => profile_url(array('username' => str_short($f['last_post_username'], 15), 'user_id' => $f['last_post_user_id'], 'user_rank' => $f['last_post_user_rank'])),
));
}
@ -264,7 +264,7 @@ $template->assign_vars(array(
'TOTAL_TOPICS' => sprintf($lang['POSTED_TOPICS_TOTAL'], $stats['topiccount']),
'TOTAL_POSTS' => sprintf($lang['POSTED_ARTICLES_TOTAL'], $stats['postcount']),
'TOTAL_USERS' => sprintf($lang['REGISTERED_USERS_TOTAL'], $stats['usercount']),
'TOTAL_GENDER' => $bb_cfg['gender'] ? sprintf(
'TOTAL_GENDER' => config('tp.gender') ? sprintf(
$lang['USERS_TOTAL_GENDER'],
$stats['male'],
$stats['female'],
@ -273,22 +273,22 @@ $template->assign_vars(array(
'NEWEST_USER' => sprintf($lang['NEWEST_USER'], profile_url($stats['newestuser'])),
// Tracker stats
'TORRENTS_STAT' => $bb_cfg['tor_stats'] ? sprintf(
'TORRENTS_STAT' => config('tp.tor_stats') ? sprintf(
$lang['TORRENTS_STAT'],
$stats['torrentcount'],
humn_size($stats['size'])
) : '',
'PEERS_STAT' => $bb_cfg['tor_stats'] ? sprintf(
'PEERS_STAT' => config('tp.tor_stats') ? sprintf(
$lang['PEERS_STAT'],
$stats['peers'],
$stats['seeders'],
$stats['leechers']
) : '',
'SPEED_STAT' => $bb_cfg['tor_stats'] ? sprintf(
'SPEED_STAT' => config('tp.tor_stats') ? sprintf(
$lang['SPEED_STAT'],
humn_size($stats['speed']) . '/s'
) : '',
'SHOW_MOD_INDEX' => $bb_cfg['show_mod_index'],
'SHOW_MOD_INDEX' => config('tp.show_mod_index'),
'FORUM_IMG' => $images['forum'],
'FORUM_NEW_IMG' => $images['forum_new'],
'FORUM_LOCKED_IMG' => $images['forum_locked'],
@ -306,12 +306,12 @@ $template->assign_vars(array(
));
// Set tpl vars for bt_userdata
if ($bb_cfg['bt_show_dl_stat_on_index'] && !IS_GUEST) {
if (config('tp.bt_show_dl_stat_on_index') && !IS_GUEST) {
show_bt_userdata($userdata['user_id']);
}
// Latest news
if ($bb_cfg['show_latest_news']) {
if (config('tp.show_latest_news')) {
if (!$latest_news = $datastore->get('latest_news')) {
$datastore->update('latest_news');
$latest_news = $datastore->get('latest_news');
@ -324,7 +324,7 @@ if ($bb_cfg['show_latest_news']) {
foreach ($latest_news as $news) {
$template->assign_block_vars('news', array(
'NEWS_TOPIC_ID' => $news['topic_id'],
'NEWS_TITLE' => str_short($news['topic_title'], $bb_cfg['max_news_title']),
'NEWS_TITLE' => str_short($news['topic_title'], config('tp.max_news_title')),
'NEWS_TIME' => bb_date($news['topic_time'], 'd-M', false),
'NEWS_IS_NEW' => is_unread($news['topic_time'], $news['topic_id'], $news['forum_id']),
));
@ -332,7 +332,7 @@ if ($bb_cfg['show_latest_news']) {
}
// Network news
if ($bb_cfg['show_network_news']) {
if (config('tp.show_network_news')) {
if (!$network_news = $datastore->get('network_news')) {
$datastore->update('network_news');
$network_news = $datastore->get('network_news');
@ -345,14 +345,14 @@ if ($bb_cfg['show_network_news']) {
foreach ($network_news as $net) {
$template->assign_block_vars('net', array(
'NEWS_TOPIC_ID' => $net['topic_id'],
'NEWS_TITLE' => str_short($net['topic_title'], $bb_cfg['max_net_title']),
'NEWS_TITLE' => str_short($net['topic_title'], config('tp.max_net_title')),
'NEWS_TIME' => bb_date($net['topic_time'], 'd-M', false),
'NEWS_IS_NEW' => is_unread($net['topic_time'], $net['topic_id'], $net['forum_id']),
));
}
}
if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
if (config('tp.birthday_check_day') && config('tp.birthday_enabled')) {
$week_list = $today_list = array();
$week_all = $today_all = false;
@ -366,9 +366,9 @@ if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
$week_list[] = profile_url($week) . ' <span class="small">(' . birthday_age($week['user_birthday'] - 1) . ')</span>';
}
$week_all = ($week_all) ? '&nbsp;<a class="txtb" href="#" onclick="ajax.exec({action: \'index_data\', mode: \'birthday_week\'}); return false;" title="' . $lang['ALL'] . '">...</a>' : '';
$week_list = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], implode(', ', $week_list)) . $week_all;
$week_list = sprintf($lang['BIRTHDAY_WEEK'], config('tp.birthday_check_day'), implode(', ', $week_list)) . $week_all;
} else {
$week_list = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']);
$week_list = sprintf($lang['NOBIRTHDAY_WEEK'], config('tp.birthday_check_day'));
}
if (!empty($stats['birthday_today_list'])) {

View file

@ -133,8 +133,6 @@ class BBCode
*/
public function bbcode2html($text)
{
global $bb_cfg;
$text = " $text ";
$text = static::clean_up($text);
$text = $this->spam_filter($text);
@ -169,7 +167,7 @@ class BBCode
$text = $this->new_line2html($text);
$text = trim($text);
if ($bb_cfg['tidy_post']) {
if (config('tp.tidy_post')) {
$text = $this->tidy($text);
}
@ -199,7 +197,6 @@ class BBCode
*/
private function spam_filter($text)
{
global $bb_cfg;
static $spam_words = null;
static $spam_replace = ' СПАМ';
@ -208,11 +205,11 @@ class BBCode
}
// set $spam_words and $spam_replace
if (!$bb_cfg['spam_filter_file_path']) {
if (!config('tp.spam_filter_file_path')) {
return $text;
}
if (null === $spam_words) {
$spam_words = file_get_contents($bb_cfg['spam_filter_file_path']);
$spam_words = file_get_contents(config('tp.spam_filter_file_path'));
$spam_words = strtolower($spam_words);
$spam_words = explode("\n", $spam_words);
}
@ -272,8 +269,6 @@ class BBCode
*/
public function url_callback($m)
{
global $bb_cfg;
$url = trim($m[1]);
$url_name = isset($m[2]) ? trim($m[2]) : $url;
@ -281,7 +276,7 @@ class BBCode
$url = 'http://' . $url;
}
if (in_array(parse_url($url, PHP_URL_HOST), $bb_cfg['nofollow']['allowed_url']) || $bb_cfg['nofollow']['disabled']) {
if (in_array(parse_url($url, PHP_URL_HOST), config('tp.nofollow.allowed_url')) || config('tp.nofollow.disabled')) {
$link = "<a href=\"$url\" class=\"postLink\">$url_name</a>";
} else {
$link = "<a href=\"$url\" class=\"postLink\" rel=\"nofollow\">$url_name</a>";
@ -346,13 +341,11 @@ class BBCode
*/
public function make_url_clickable_callback($m)
{
global $bb_cfg;
$max_len = 70;
$href = $m[1];
$name = (mb_strlen($href, 'UTF-8') > $max_len) ? mb_substr($href, 0, $max_len - 19) . '...' . mb_substr($href, -16) : $href;
if (in_array(parse_url($href, PHP_URL_HOST), $bb_cfg['nofollow']['allowed_url']) || $bb_cfg['nofollow']['disabled']) {
if (in_array(parse_url($href, PHP_URL_HOST), config('tp.nofollow.allowed_url')) || config('tp.nofollow.disabled')) {
$link = "<a href=\"$href\" class=\"postLink\">$name</a>";
} else {
$link = "<a href=\"$href\" class=\"postLink\" rel=\"nofollow\">$name</a>";

View file

@ -30,11 +30,11 @@ class Upload
'error' => UPLOAD_ERR_NO_FILE,
];
public $orig_name = '';
public $file_path = ''; // Stored file path
public $file_path = '';
public $file_ext = '';
public $file_ext_id = '';
public $file_size = '';
public $ext_ids = []; // array_flip($bb_cfg['file_id_ext'])
public $ext_ids = [];
public $errors = [];
public $img_types = [
1 => 'gif',
@ -53,7 +53,7 @@ class Upload
*/
public function init(array $cfg = [], array $post_params = [], $uploaded_only = true)
{
global $bb_cfg, $lang;
global $lang;
$this->cfg = array_merge($this->cfg, $cfg);
$this->file = $post_params;
@ -85,7 +85,7 @@ class Upload
return false;
}
// get ext
$this->ext_ids = array_flip($bb_cfg['file_id_ext']);
$this->ext_ids = array_flip(config('tp.file_id_ext'));
$file_name_ary = explode('.', $this->file['name']);
$this->file_ext = strtolower(end($file_name_ary));

View file

@ -101,8 +101,6 @@ class User
*/
public function session_start(array $cfg = [])
{
global $bb_cfg;
$update_sessions_table = false;
$this->cfg = array_merge($this->cfg, $cfg);
@ -120,7 +118,7 @@ class User
if ($session_id) {
$SQL['WHERE'][] = "s.session_id = '$session_id'";
if ($bb_cfg['torhelp_enabled']) {
if (config('tp.torhelp_enabled')) {
$SQL['SELECT'][] = "th.topic_id_csv AS torhelp";
$SQL['LEFT JOIN'][] = BB_BT_TORHELP . " th ON(u.user_id = th.user_id)";
}
@ -136,7 +134,7 @@ class User
if (!$this->data = cache_get_userdata($userdata_cache_id)) {
$this->data = OLD_DB()->fetch_row($SQL);
if ($this->data && (TIMENOW - $this->data['session_time']) > $bb_cfg['session_update_intrv']) {
if ($this->data && (TIMENOW - $this->data['session_time']) > config('tp.session_update_intrv')) {
$this->data['session_time'] = TIMENOW;
$update_sessions_table = true;
}
@ -177,7 +175,7 @@ class User
// using the cookie user_id if available to pull basic user prefs.
if (!$this->data) {
$login = false;
$user_id = ($bb_cfg['allow_autologin'] && $this->sessiondata['uk'] && $this->sessiondata['uid']) ? $this->sessiondata['uid'] : GUEST_UID;
$user_id = (config('tp.allow_autologin') && $this->sessiondata['uk'] && $this->sessiondata['uid']) ? $this->sessiondata['uid'] : GUEST_UID;
if ($userdata = get_userdata((int)$user_id, false, true)) {
if ($userdata['user_id'] != GUEST_UID && $userdata['user_active']) {
@ -198,7 +196,7 @@ class User
define('IS_MOD', !IS_GUEST && (int)$this->data['user_level'] === MOD);
define('IS_GROUP_MEMBER', !IS_GUEST && (int)$this->data['user_level'] === GROUP_MEMBER);
define('IS_USER', !IS_GUEST && (int)$this->data['user_level'] === USER);
define('IS_SUPER_ADMIN', IS_ADMIN && isset($bb_cfg['super_admins'][$this->data['user_id']]));
define('IS_SUPER_ADMIN', IS_ADMIN && null !== config('tp.super_admins.' . $this->data['user_id']));
define('IS_AM', IS_ADMIN || IS_MOD);
$this->set_shortcuts();
@ -223,8 +221,6 @@ class User
*/
public function session_create($userdata, $auto_created = false)
{
global $bb_cfg;
$this->data = $userdata;
$session_id = $this->sessiondata['sid'];
@ -274,8 +270,8 @@ class User
if (!$session_time = $this->data['user_session_time']) {
$last_visit = TIMENOW;
define('FIRST_LOGON', true);
} elseif ($session_time < (TIMENOW - $bb_cfg['last_visit_update_intrv'])) {
$last_visit = max($session_time, (TIMENOW - 86400 * $bb_cfg['max_last_visit_days']));
} elseif ($session_time < (TIMENOW - config('tp.last_visit_update_intrv'))) {
$last_visit = max($session_time, TIMENOW - 86400 * config('tp.max_last_visit_days'));
}
if ($last_visit != $this->data['user_lastvisit']) {
@ -294,7 +290,7 @@ class User
$this->data['user_lastvisit'] = $last_visit;
}
if (!empty($_POST['autologin']) && $bb_cfg['allow_autologin']) {
if (!empty($_POST['autologin']) && config('tp.allow_autologin')) {
if (!$auto_created) {
$this->verify_autologin_id($this->data, true, true);
}
@ -455,8 +451,6 @@ class User
*/
public function set_session_cookies($user_id)
{
global $bb_cfg;
if ($user_id == GUEST_UID) {
$delete_cookies = [
COOKIE_DATA,
@ -479,7 +473,7 @@ class User
if ($c_sdata_curr !== $c_sdata_resv) {
bb_setcookie(COOKIE_DATA, $c_sdata_curr, COOKIE_PERSIST, true);
}
if (isset($bb_cfg['dbg_users'][$this->data['user_id']]) && !isset($_COOKIE[COOKIE_DBG])) {
if (null !== config('tp.dbg_users.' . $this->data['user_id']) && !isset($_COOKIE[COOKIE_DBG])) {
bb_setcookie(COOKIE_DBG, 1, COOKIE_SESSION);
}
}
@ -496,8 +490,6 @@ class User
*/
public function verify_autologin_id($userdata, $expire_check = false, $create_new = true)
{
global $bb_cfg;
$autologin_id = $userdata['autologin_id'];
if ($expire_check) {
@ -505,8 +497,8 @@ class User
return $this->create_autologin_id($userdata);
}
if ($autologin_id && $userdata['user_session_time'] && $bb_cfg['max_autologin_time']) {
if (TIMENOW - $userdata['user_session_time'] > $bb_cfg['max_autologin_time'] * 86400) {
if ($autologin_id && $userdata['user_session_time'] && config('tp.max_autologin_time')) {
if (TIMENOW - $userdata['user_session_time'] > config('tp.max_autologin_time') * 86400) {
return $this->create_autologin_id($userdata, $create_new);
}
}
@ -557,28 +549,28 @@ class User
*/
public function init_userprefs()
{
global $bb_cfg, $theme, $source_lang, $DeltaTime;
global $theme, $source_lang, $DeltaTime;
if (defined('LANG_DIR')) {
return;
} // prevent multiple calling
define('DEFAULT_LANG_DIR', LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'] . '/');
define('DEFAULT_LANG_DIR', LANG_ROOT_DIR . '/' . config('tp.default_lang') . '/');
define('SOURCE_LANG_DIR', LANG_ROOT_DIR . '/source/');
if ($this->data['user_id'] != GUEST_UID) {
if ($this->data['user_lang'] && $this->data['user_lang'] != $bb_cfg['default_lang']) {
$bb_cfg['default_lang'] = basename($this->data['user_lang']);
define('LANG_DIR', LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'] . '/');
if ($this->data['user_lang'] && $this->data['user_lang'] != config('tp.default_lang')) {
config(['tp.default_lang' => basename($this->data['user_lang'])]);
define('LANG_DIR', LANG_ROOT_DIR . '/' . config('tp.default_lang') . '/');
}
if (isset($this->data['user_timezone'])) {
$bb_cfg['board_timezone'] = $this->data['user_timezone'];
config(['tp.board_timezone' => $this->data['user_timezone']]);
}
}
$this->data['user_lang'] = $bb_cfg['default_lang'];
$this->data['user_timezone'] = $bb_cfg['board_timezone'];
$this->data['user_lang'] = config('tp.default_lang');
$this->data['user_timezone'] = config('tp.board_timezone');
if (!defined('LANG_DIR')) {
define('LANG_DIR', DEFAULT_LANG_DIR);

View file

@ -62,9 +62,7 @@ class Emailer
public function __construct()
{
global $bb_cfg;
$this->reply = $bb_cfg['board_email'];
$this->reply = config('tp.board_email');
}
/**
@ -125,17 +123,15 @@ class Emailer
*/
public function set_template($template_file, $template_lang = '')
{
global $bb_cfg;
if (!$template_lang) {
$template_lang = $bb_cfg['default_lang'];
$template_lang = config('tp.default_lang');
}
if (empty($this->tpl_msg[$template_lang . $template_file])) {
$tpl_file = LANG_ROOT_DIR . '/' . $template_lang . '/email/' . $template_file . '.html';
if (!file_exists($tpl_file)) {
$tpl_file = LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'] . '/email/' . $template_file . '.html';
$tpl_file = LANG_ROOT_DIR . '/' . config('tp.default_lang') . '/email/' . $template_file . '.html';
/** @noinspection NotOptimalIfConditionsInspection */
if (!file_exists($tpl_file)) {
@ -162,7 +158,7 @@ class Emailer
*/
public function send($email_format = self::FORMAT_TEXT)
{
global $bb_cfg, $lang, $userdata;
global $lang;
if (!config('email.enabled')) {
return false;
@ -215,7 +211,7 @@ class Emailer
/** @var Swift_Message $message */
$message = (new Swift_Message())
->setSubject($this->subject)
->setReturnPath($bb_cfg['bounce_email'])
->setReturnPath(config('tp.bounce_email'))
->setFrom($this->from)
->setTo($this->to)
->setReplyTo($this->reply)
@ -250,12 +246,10 @@ class Emailer
*/
public function set_default_vars()
{
global $bb_cfg;
$this->vars = [
'BOARD_EMAIL' => $bb_cfg['board_email'],
'SITENAME' => $bb_cfg['board_email_sitename'],
'EMAIL_SIG' => !empty($bb_cfg['board_email_sig']) ? "-- \n{$bb_cfg['board_email_sig']}" : '',
'BOARD_EMAIL' => config('tp.board_email'),
'SITENAME' => config('tp.board_email_sitename'),
'EMAIL_SIG' => !empty(config('tp.board_email_sig')) ? "-- \n" . config('tp.board_email_sig') : '',
];
}
}

View file

@ -31,7 +31,7 @@ class LogAction
public function init()
{
global $lang, $bb_cfg;
global $lang;
foreach ($lang['LOG_ACTION']['LOG_TYPE'] as $log_type => $log_desc) {
$this->log_type_select[strip_tags($log_desc)] = $this->log_type[$log_type];

View file

@ -21,8 +21,7 @@ class Poll
public function __construct()
{
global $bb_cfg;
$this->max_votes = $bb_cfg['max_poll_options'];
$this->max_votes = config('tp.max_poll_options');
}
/**

View file

@ -86,13 +86,11 @@ class Sitemap
*/
private function getStaticUrls()
{
global $bb_cfg;
$staticUrls = [];
if (isset($bb_cfg['static_sitemap'])) {
if (!empty(config('tp.static_sitemap'))) {
/** @var array $urls разбиваем строку по переносам */
$urls = explode("\n", $bb_cfg['static_sitemap']);
$urls = explode("\n", config('tp.static_sitemap'));
foreach ($urls as $url) {
/** @var string $url проверяем что адрес валиден и с указанными протоколом */
if (filter_var(trim($url), FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED)) {

View file

@ -99,7 +99,7 @@ class Template
*/
public function __construct($root = '.')
{
global $bb_cfg, $lang;
global $lang;
// setting pointer "vars"
$this->vars = &$this->_tpldata['.'][0];
@ -108,7 +108,7 @@ class Template
$this->root = $root;
$this->tpl = basename($root);
$this->lang =& $lang;
$this->use_cache = $bb_cfg['xs_use_cache'];
$this->use_cache = config('tp.xs_use_cache');
}
/**
@ -223,7 +223,7 @@ class Template
{
$this->cur_tpl = $filename;
global $lang, $source_lang, $bb_cfg, $user;
global $lang, $source_lang, $user;
$L =& $lang;
$V =& $this->vars;
@ -979,11 +979,9 @@ class Template
public function xs_startup()
{
global $bb_cfg;
// adding language variable (eg: "english" or "german")
// can be used to make truly multi-lingual templates
$this->vars['LANG'] = $this->vars['LANG'] ?? $bb_cfg['default_lang'];
$this->vars['LANG'] = $this->vars['LANG'] ?? config('tp.default_lang');
// adding current template
$tpl = $this->root . '/';
if (substr($tpl, 0, 2) === './') {

View file

@ -122,11 +122,11 @@ class TorrentFileList
*/
private function build_file_item($name, $length)
{
global $bb_cfg, $images, $lang;
global $images, $lang;
$magnet_name = $magnet_ext = '';
if ($bb_cfg['magnet_links_enabled']) {
if (config('tp.magnet_links_enabled')) {
$magnet_name = '<a title="' . $lang['DC_MAGNET'] . '" href="dchub:magnet:?kt=' . $name . '&xl=' . $length . '"><img src="' . $images['icon_dc_magnet'] . '" width="10" height="10" border="0" /></a>';
$magnet_ext = '<a title="' . $lang['DC_MAGNET_EXT'] . '" href="dchub:magnet:?kt=.' . substr(strrchr($name, '.'), 1) . '&xl=' . $length . '"><img src="' . $images['icon_dc_magnet_ext'] . '" width="10" height="10" border="0" /></a>';
}

View file

@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
global $bb_cfg, $lang, $user;
global $lang, $user;
$mode = (string)$this->request['mode'];
$user_id = (int)$this->request['user_id'];
@ -28,7 +28,7 @@ switch ($mode) {
case 'delete':
delete_avatar($user_id, $u_data['avatar_ext_id']);
$new_ext_id = 0;
$response = '<img src="' . $bb_cfg['avatars']['upload_path'] . $bb_cfg['avatars']['no_avatar'] . '" alt="' . $user_id . '" />';
$response = '<img src="' . config('tp.avatars.upload_path') . config('tp.avatars.no_avatar') . '" alt="' . $user_id . '" />';
break;
default:
$this->ajax_die('Invalid mode');

View file

@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
global $userdata, $bb_cfg, $lang;
global $userdata, $lang;
if (!isset($this->request['attach_id'])) {
$this->ajax_die($lang['EMPTY_ATTACH_ID']);
@ -20,7 +20,7 @@ if (!isset($this->request['attach_id'])) {
$attach_id = (int)$this->request['attach_id'];
$mode = (string)$this->request['mode'];
if ($bb_cfg['tor_comment']) {
if (config('tp.tor_comment')) {
$comment = (string)$this->request['comment'];
}
@ -85,12 +85,12 @@ switch ($mode) {
change_tor_status($attach_id, $new_status);
$this->response['status'] = $bb_cfg['tor_icons'][$new_status] . ' <b> ' . $lang['TOR_STATUS_NAME'][$new_status] . '</b> &middot; ' . profile_url($userdata) . ' &middot; <i>' . delta_time(TIMENOW) . $lang['TOR_BACK'] . '</i>';
$this->response['status'] = config('tp.tor_icons.' . $new_status) . ' <b> ' . $lang['TOR_STATUS_NAME'][$new_status] . '</b> &middot; ' . profile_url($userdata) . ' &middot; <i>' . delta_time(TIMENOW) . $lang['TOR_BACK'] . '</i>';
if ($bb_cfg['tor_comment'] && (($comment && $comment != $lang['COMMENT']) || in_array($new_status, $bb_cfg['tor_reply']))) {
if (config('tp.tor_comment') && (($comment && $comment != $lang['COMMENT']) || in_array($new_status, config('tp.tor_reply')))) {
if ($tor['poster_id'] > 0) {
$subject = sprintf($lang['TOR_MOD_TITLE'], $tor['topic_title']);
$message = sprintf($lang['TOR_MOD_MSG'], get_username($tor['poster_id']), make_url(TOPIC_URL . $tor['topic_id']), $bb_cfg['tor_icons'][$new_status] . ' ' . $lang['TOR_STATUS_NAME'][$new_status]);
$message = sprintf($lang['TOR_MOD_MSG'], get_username($tor['poster_id']), make_url(TOPIC_URL . $tor['topic_id']), config('tp.tor_icons.' . $new_status) . ' ' . $lang['TOR_STATUS_NAME'][$new_status]);
if ($comment && $comment != $lang['COMMENT']) {
$message .= "\n\n[b]" . $lang['COMMENT'] . '[/b]: ' . $comment;
@ -103,7 +103,7 @@ switch ($mode) {
break;
case 'status_reply':
if (!$bb_cfg['tor_comment']) {
if (!config('tp.tor_comment')) {
$this->ajax_die($lang['MODULE_OFF']);
}

View file

@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
global $userdata, $bb_cfg, $lang;
global $userdata, $lang;
if (!isset($this->request['attach_id'])) {
$this->ajax_die($lang['EMPTY_ATTACH_ID']);

View file

@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
global $bb_cfg, $userdata, $lang;
global $userdata, $lang;
if (!$group_id = (int)$this->request['group_id'] or !$group_info = get_group_data($group_id)) {
$this->ajax_die($lang['NO_GROUP_ID_SPECIFIED']);

View file

@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
global $bb_cfg, $lang;
global $lang;
if (!$user_id = (int)$this->request['user_id'] or !$profiledata = get_userdata($user_id)) {
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
@ -51,7 +51,7 @@ switch ($field) {
break;
case 'user_gender':
if (!$bb_cfg['gender']) {
if (!config('tp.gender')) {
$this->ajax_die($lang['MODULE_OFF']);
}
if (!isset($lang['GENDER_SELECT'][$value])) {
@ -62,7 +62,7 @@ switch ($field) {
break;
case 'user_birthday':
if (!$bb_cfg['birthday_enabled']) {
if (!config('tp.birthday_enabled')) {
$this->ajax_die($lang['MODULE_OFF']);
}
$birthday_date = date_parse($value);
@ -70,10 +70,10 @@ switch ($field) {
if (!empty($birthday_date['year'])) {
if (strtotime($value) >= TIMENOW) {
$this->ajax_die($lang['WRONG_BIRTHDAY_FORMAT']);
} elseif (bb_date(TIMENOW, 'Y', 'false') - $birthday_date['year'] > $bb_cfg['birthday_max_age']) {
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_HIGH'], $bb_cfg['birthday_max_age']));
} elseif (bb_date(TIMENOW, 'Y', 'false') - $birthday_date['year'] < $bb_cfg['birthday_min_age']) {
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_LOW'], $bb_cfg['birthday_min_age']));
} elseif (bb_date(TIMENOW, 'Y', 'false') - $birthday_date['year'] > config('tp.birthday_max_age')) {
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_HIGH'], config('tp.birthday_max_age')));
} elseif (bb_date(TIMENOW, 'Y', 'false') - $birthday_date['year'] < config('tp.birthday_min_age')) {
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_LOW'], config('tp.birthday_min_age')));
}
}
@ -110,8 +110,8 @@ switch ($field) {
case 'user_regdate':
case 'user_lastvisit':
$tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
if (($value = strtotime($value, $tz)) < $bb_cfg['board_startdate'] or $value > TIMENOW) {
$tz = TIMENOW + (3600 * config('tp.board_timezone'));
if (($value = strtotime($value, $tz)) < config('tp.board_startdate') || $value > TIMENOW) {
$this->ajax_die($lang['INVALID_DATE'] . $this->request['value']);
}
$this->response['new_value'] = bb_date($value, 'Y-m-d H:i', false);

View file

@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
global $bb_cfg, $lang, $userdata, $datastore;
global $lang, $userdata, $datastore;
$mode = (string)$this->request['mode'];
$html = '';
@ -27,9 +27,9 @@ switch ($mode) {
foreach ($stats['birthday_week_list'] as $week) {
$html[] = profile_url($week) . ' <span class="small">(' . birthday_age($week['user_birthday']) . ')</span>';
}
$html = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], implode(', ', $html));
$html = sprintf($lang['BIRTHDAY_WEEK'], config('tp.birthday_check_day'), implode(', ', $html));
} else {
$html = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']);
$html = sprintf($lang['NOBIRTHDAY_WEEK'], config('tp.birthday_check_day'));
}
break;
@ -86,10 +86,10 @@ switch ($mode) {
if ($tz > 13) {
$tz = 13;
}
if ($tz != $bb_cfg['board_timezone']) {
if ($tz != config('tp.board_timezone')) {
// Set current user timezone
OLD_DB()->query("UPDATE " . BB_USERS . " SET user_timezone = $tz WHERE user_id = " . $userdata['user_id']);
$bb_cfg['board_timezone'] = $tz;
config(['tp.board_timezone' => $tz]);
cache_rm_user_sessions($userdata['user_id']);
}
break;
@ -110,7 +110,7 @@ switch ($mode) {
<th>' . $lang['UPLOADED'] . '</th>
<th>' . $lang['RELEASED'] . '</th>
<th>' . $lang['BONUS'] . '</th>';
$html .= ($bb_cfg['seed_bonus_enabled']) ? '<th>' . $lang['SEED_BONUS'] . '</th>' : '';
$html .= config('tp.seed_bonus_enabled') ? '<th>' . $lang['SEED_BONUS'] . '</th>' : '';
$html .= '</tr>
<tr class="row1">
<td>' . $lang['TOTAL_TRAF'] . '</td>
@ -118,17 +118,17 @@ switch ($mode) {
<td id="u_up_total"><span class="editable bold seedmed">' . humn_size($btu['u_up_total']) . '</span></td>
<td id="u_up_release"><span class="editable bold seedmed">' . humn_size($btu['u_up_release']) . '</span></td>
<td id="u_up_bonus"><span class="editable bold seedmed">' . humn_size($btu['u_up_bonus']) . '</span></td>';
$html .= ($bb_cfg['seed_bonus_enabled']) ? '<td id="user_points"><span class="editable bold points">' . $profiledata['user_points'] . '</b></td>' : '';
$html .= config('tp.seed_bonus_enabled') ? '<td id="user_points"><span class="editable bold points">' . $profiledata['user_points'] . '</b></td>' : '';
$html .= '</tr>
<tr class="row5">
<td colspan="1">' . $lang['MAX_SPEED'] . '</td>
<td colspan="2">' . $lang['DL_DL_SPEED'] . ': ' . $speed_down . '</span></td>
<td colspan="2">' . $lang['DL_UL_SPEED'] . ': ' . $speed_up . '</span></td>';
$html .= ($bb_cfg['seed_bonus_enabled']) ? '<td colspan="1"></td>' : '';
$html .= config('tp.seed_bonus_enabled') ? '<td colspan="1"></td>' : '';
$html .= '</tr>';
$this->response['user_ratio'] = '
<th><a href="' . $bb_cfg['ratio_url_help'] . '" class="bold">' . $lang['USER_RATIO'] . '</a>:</th>
<th><a href="' . config('tp.ratio_url_help') . '" class="bold">' . $lang['USER_RATIO'] . '</a>:</th>
<td>' . $user_ratio . '</td>
';
break;

View file

@ -11,14 +11,14 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
global $userdata, $lang, $bb_cfg;
global $userdata, $lang;
$mode = (string)$this->request['mode'];
switch ($mode) {
case 'clear_cache':
foreach ($bb_cfg['cache']['engines'] as $cache_name => $cache_val) {
foreach (config('tp.cache.engines') as $cache_name => $cache_val) {
if (!in_array('db_sqlite', $cache_val)) {
OLD_CACHE($cache_name)->rm();
}
@ -59,20 +59,20 @@ switch ($mode) {
case 'indexer':
exec("indexer --config {$bb_cfg['sphinx_config_path']} --all --rotate", $result);
exec('indexer --config ' . config('tp.sphinx_config_path') . ' --all --rotate', $result);
if (!is_file($bb_cfg['sphinx_config_path'] . ".log")) {
file_put_contents($bb_cfg['sphinx_config_path'] . ".log", "####Logger from dimka3210.####" . date("H:i:s", TIMENOW) . "##############################\r\n\r\n\r\n\r\n", FILE_APPEND);
if (!is_file(config('tp.sphinx_config_path') . '.log')) {
file_put_contents(config('tp.sphinx_config_path') . '.log', date('H:i:s', TIMENOW) . "##############################\r\n\r\n\r\n\r\n", FILE_APPEND);
}
file_put_contents($bb_cfg['sphinx_config_path'] . ".log", "##############################" . date("H:i:s", TIMENOW) . "##############################\r\n", FILE_APPEND);
file_put_contents(config('tp.sphinx_config_path') . '.log', '##############################' . date('H:i:s', TIMENOW) . "##############################\r\n", FILE_APPEND);
foreach ($result as $row) {
file_put_contents($bb_cfg['sphinx_config_path'] . ".log", $row . "\r\n", FILE_APPEND);
file_put_contents(config('tp.sphinx_config_path') . '.log', $row . "\r\n", FILE_APPEND);
}
file_put_contents($bb_cfg['sphinx_config_path'] . ".log", "\r\n", FILE_APPEND);
file_put_contents($bb_cfg['sphinx_config_path'] . ".log", "\r\n", FILE_APPEND);
file_put_contents(config('tp.sphinx_config_path') . '.log', "\r\n", FILE_APPEND);
file_put_contents(config('tp.sphinx_config_path') . '.log', "\r\n", FILE_APPEND);
$this->response['indexer_html'] = '<span class="seed bold">' . $lang['INDEXER'] . '</span>';

View file

@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
global $userdata, $lang, $bb_cfg;
global $userdata, $lang;
$mode = (string)$this->request['mode'];
$user_id = $this->request['user_id'];

View file

@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
global $userdata, $bb_cfg, $lang, $datastore;
global $userdata, $lang, $datastore;
$mode = (string)$this->request['mode'];
@ -30,7 +30,7 @@ switch ($mode) {
foreach ($topic_ids as $attach_id) {
change_tor_status($attach_id, $status);
}
$this->response['status'] = $bb_cfg['tor_icons'][$status];
$this->response['status'] = config('tp.tor_icons.' . $status);
$this->response['topics'] = explode(',', $topics);
break;
@ -56,14 +56,14 @@ switch ($mode) {
OLD_DB()->query("UPDATE " . BB_TOPICS . " SET topic_title = '$topic_title_sql' WHERE topic_id = $topic_id");
// Обновление кеша новостей на главной
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
if (isset($news_forums[$t_data['forum_id']]) && $bb_cfg['show_latest_news']) {
$news_forums = array_flip(explode(',', config('tp.latest_news_forum_id')));
if (isset($news_forums[$t_data['forum_id']]) && config('tp.show_latest_news')) {
$datastore->enqueue('latest_news');
$datastore->update('latest_news');
}
$net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
if (isset($net_forums[$t_data['forum_id']]) && $bb_cfg['show_network_news']) {
$net_forums = array_flip(explode(',', config('tp.network_news_forum_id')));
if (isset($net_forums[$t_data['forum_id']]) && config('tp.show_network_news')) {
$datastore->enqueue('network_news');
$datastore->update('network_news');
}
@ -114,8 +114,8 @@ switch ($mode) {
} else {
$user_reg_ip = decode_ip($profiledata['user_reg_ip']);
$user_last_ip = decode_ip($profiledata['user_last_ip']);
$reg_ip = '<a href="' . $bb_cfg['whois_info'] . $user_reg_ip . '" class="gen" target="_blank">' . $user_reg_ip . '</a>';
$last_ip = '<a href="' . $bb_cfg['whois_info'] . $user_last_ip . '" class="gen" target="_blank">' . $user_last_ip . '</a>';
$reg_ip = '<a href="' . config('tp.whois_info') . $user_reg_ip . '" class="gen" target="_blank">' . $user_reg_ip . '</a>';
$last_ip = '<a href="' . config('tp.whois_info') . $user_last_ip . '" class="gen" target="_blank">' . $user_last_ip . '</a>';
}
$this->response['ip_list_html'] = '

View file

@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
global $lang, $bb_cfg, $userdata;
global $lang, $userdata;
if (!isset($this->request['type'])) {
$this->ajax_die('empty type');
@ -129,10 +129,10 @@ switch ($this->request['type']) {
if (mb_strlen($text) > 2) {
if ($text != $post['post_text']) {
if ($bb_cfg['max_smilies']) {
$count_smilies = substr_count(bbcode2html($text), '<img class="smile" src="' . $bb_cfg['smilies_path']);
if ($count_smilies > $bb_cfg['max_smilies']) {
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies']));
if (config('tp.max_smilies')) {
$count_smilies = substr_count(bbcode2html($text), '<img class="smile" src="' . config('tp.smilies_path'));
if ($count_smilies > config('tp.max_smilies')) {
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], config('tp.max_smilies')));
}
}
OLD_DB()->query("UPDATE " . BB_POSTS_TEXT . " SET post_text = '" . OLD_DB()->escape($text) . "' WHERE post_id = $post_id");
@ -234,7 +234,7 @@ switch ($this->request['type']) {
$sql = "SELECT MAX(p.post_time) AS last_post_time FROM " . BB_POSTS . " p WHERE $where_sql";
if ($row = OLD_DB()->fetch_row($sql) and $row['last_post_time']) {
if ($userdata['user_level'] == USER) {
if (TIMENOW - $row['last_post_time'] < $bb_cfg['flood_interval']) {
if (TIMENOW - $row['last_post_time'] < config('tp.flood_interval')) {
$this->ajax_die($lang['FLOOD_ERROR']);
}
}
@ -260,10 +260,10 @@ switch ($this->request['type']) {
}
}
if ($bb_cfg['max_smilies']) {
$count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="' . $bb_cfg['smilies_path']);
if ($count_smilies > $bb_cfg['max_smilies']) {
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies']));
if (config('tp.max_smilies')) {
$count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="' . config('tp.smilies_path'));
if ($count_smilies > config('tp.max_smilies')) {
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], config('tp.max_smilies')));
}
}
@ -281,7 +281,7 @@ switch ($this->request['type']) {
'post_text' => $message,
));
if ($bb_cfg['topic_notify_enabled']) {
if (config('tp.topic_notify_enabled')) {
$notify = !empty($this->request['notify']);
user_notification('reply', $post, $post['topic_title'], $post['forum_id'], $topic_id, $notify);
}

View file

@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
global $bb_cfg, $lang;
global $lang;
$mode = (string)$this->request['mode'];
$map = new TorrentPier\Legacy\Sitemap();
@ -21,7 +21,7 @@ switch ($mode) {
case 'create':
$map->createSitemap();
if (file_exists(SITEMAP_DIR . '/sitemap.xml')) {
$html .= $lang['SITEMAP_CREATED'] . ': <b>' . bb_date(TIMENOW, $bb_cfg['post_date_format']) . '</b> ' . $lang['SITEMAP_AVAILABLE'] . ': <a href="' . make_url('sitemap/sitemap.xml') . '" target="_blank">' . make_url('sitemap/sitemap.xml') . '</a>';
$html .= $lang['SITEMAP_CREATED'] . ': <b>' . bb_date(TIMENOW, config('tp.post_date_format')) . '</b> ' . $lang['SITEMAP_AVAILABLE'] . ': <a href="' . make_url('sitemap/sitemap.xml') . '" target="_blank">' . make_url('sitemap/sitemap.xml') . '</a>';
} else {
$html .= $lang['SITEMAP_NOT_CREATED'];
}

View file

@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
global $bb_cfg, $lang, $userdata;
global $lang, $userdata;
$mode = (string)$this->request['mode'];

View file

@ -26,11 +26,11 @@ if (defined('ATTACH_INSTALL')) {
*/
function attach_mod_get_lang($language_file)
{
global $attach_config, $bb_cfg;
global $attach_config;
$file = LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'] . '/' . $language_file . '.php';
$file = LANG_ROOT_DIR . '/' . config('tp.default_lang') . '/' . $language_file . '.php';
if (file_exists($file)) {
return $bb_cfg['default_lang'];
return config('tp.default_lang');
}
$file = LANG_ROOT_DIR . '/' . $attach_config['board_lang'] . '/' . $language_file . '.php';
@ -46,8 +46,6 @@ function attach_mod_get_lang($language_file)
*/
function get_config()
{
global $bb_cfg;
$attach_config = array();
$sql = 'SELECT * FROM ' . BB_ATTACH_CONFIG;
@ -61,7 +59,7 @@ function get_config()
}
// We assign the original default board language here, because it gets overwritten later with the users default language
$attach_config['board_lang'] = trim($bb_cfg['default_lang']);
$attach_config['board_lang'] = trim(config('tp.default_lang'));
return $attach_config;
}

View file

@ -11,7 +11,7 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
global $bb_cfg, $t_data, $poster_id, $is_auth, $dl_link_css, $dl_status_css, $lang, $images;
global $t_data, $poster_id, $is_auth, $dl_link_css, $dl_status_css, $lang, $images;
$change_peers_bgr_over = true;
$bgr_class_1 = 'row1';
@ -39,7 +39,7 @@ $template->assign_vars(array(
));
// Define show peers mode (count only || user names with complete % || full details)
$cfg_sp_mode = $bb_cfg['bt_show_peers_mode'];
$cfg_sp_mode = config('tp.bt_show_peers_mode');
$get_sp_mode = $_GET['spmode'] ?? '';
$s_mode = 'count';
@ -50,7 +50,7 @@ if ($cfg_sp_mode == SHOW_PEERS_NAMES) {
$s_mode = 'full';
}
if ($bb_cfg['bt_allow_spmode_change']) {
if (config('tp.bt_allow_spmode_change')) {
if ($get_sp_mode == 'names') {
$s_mode = 'names';
} elseif ($get_sp_mode == 'full') {
@ -67,7 +67,7 @@ $tor_file_size = humn_size($attachments['_' . $post_id][$i]['filesize']);
$tor_file_time = bb_date($attachments['_' . $post_id][$i]['filetime']);
$tor_reged = (bool)$tracker_status;
$show_peers = (bool)$bb_cfg['bt_show_peers'];
$show_peers = (bool)config('tp.bt_show_peers');
$locked = ($t_data['forum_status'] == FORUM_LOCKED || $t_data['topic_status'] == TOPIC_LOCKED);
$tor_auth = ($bt_user_id != GUEST_UID && (($bt_user_id == $poster_id && !$locked) || $is_auth['auth_mod']));
@ -87,7 +87,7 @@ if ($tor_auth_reg || $tor_auth_del) {
$tracker_link = ($tor_reged) ? $unreg_tor_url : $reg_tor_url;
}
$display_name = '[' . $bb_cfg['server_name'] . '].t' . $bt_topic_id . '.torrent';
$display_name = '[' . config('tp.server_name') . '].t' . $bt_topic_id . '.torrent';
if (!$tor_reged) {
$template->assign_block_vars('postrow.attach.tor_not_reged', array(
@ -146,8 +146,8 @@ if ($tor_reged && $tor_info) {
$tor_magnet = create_magnet($tor_info['info_hash'], $passkey['auth_key'], $userdata['session_logged_in']);
// ratio limits
$min_ratio_dl = $bb_cfg['bt_min_ratio_allow_dl_tor'];
$min_ratio_warn = $bb_cfg['bt_min_ratio_warning'];
$min_ratio_dl = config('tp.bt_min_ratio_allow_dl_tor');
$min_ratio_warn = config('tp.bt_min_ratio_warning');
$dl_allowed = true;
$user_ratio = 0;
@ -177,7 +177,7 @@ if ($tor_reged && $tor_info) {
if ((isset($user_ratio) && isset($min_ratio_warn) && $user_ratio < $min_ratio_warn && TR_RATING_LIMITS) || ($bt_userdata['u_down_total'] < MIN_DL_FOR_RATIO)) {
$template->assign_vars(array(
'SHOW_RATIO_WARN' => true,
'RATIO_WARN_MSG' => sprintf($lang['BT_RATIO_WARNING_MSG'], $min_ratio_dl, $bb_cfg['ratio_url_help']),
'RATIO_WARN_MSG' => sprintf($lang['BT_RATIO_WARNING_MSG'], $min_ratio_dl, config('tp.ratio_url_help')),
));
}
}
@ -196,12 +196,12 @@ if ($tor_reged && $tor_info) {
'TOR_SILVER_GOLD' => $tor_type,
// torrent status mod
'TOR_FROZEN' => (!IS_AM) ? (isset($bb_cfg['tor_frozen'][$tor_info['tor_status']]) && !(isset($bb_cfg['tor_frozen_author_download'][$tor_info['tor_status']]) && $userdata['user_id'] == $tor_info['poster_id'])) ? true : '' : '',
'TOR_FROZEN' => (!IS_AM) ? (null !== config('tp.tor_frozen.' . $tor_info['tor_status'])) && !(null !== config('tp.tor_frozen_author_download.' . $tor_info['tor_status']) && $userdata['user_id'] == $tor_info['poster_id']) ? true : '' : '',
'TOR_STATUS_TEXT' => $lang['TOR_STATUS_NAME'][$tor_info['tor_status']],
'TOR_STATUS_ICON' => $bb_cfg['tor_icons'][$tor_info['tor_status']],
'TOR_STATUS_ICON' => config('tp.tor_icons.' . $tor_info['tor_status']),
'TOR_STATUS_BY' => ($tor_info['checked_user_id'] && $is_auth['auth_mod']) ? ('<span title="' . bb_date($tor_info['checked_time']) . '"> &middot; ' . profile_url($tor_info) . ' &middot; <i>' . delta_time($tor_info['checked_time']) . $lang['TOR_BACK'] . '</i></span>') : '',
'TOR_STATUS_SELECT' => build_select('sel_status', array_flip($lang['TOR_STATUS_NAME']), TOR_APPROVED),
'TOR_STATUS_REPLY' => $bb_cfg['tor_comment'] && !IS_GUEST && in_array($tor_info['tor_status'], $bb_cfg['tor_reply']) && $userdata['user_id'] == $tor_info['poster_id'] && $t_data['topic_status'] != TOPIC_LOCKED,
'TOR_STATUS_REPLY' => config('tp.tor_comment') && !IS_GUEST && in_array($tor_info['tor_status'], config('tp.tor_reply')) && $userdata['user_id'] == $tor_info['poster_id'] && $t_data['topic_status'] != TOPIC_LOCKED,
//end torrent status mod
'S_UPLOAD_IMAGE' => $upload_image,
@ -223,7 +223,7 @@ if ($tor_reged && $tor_info) {
}
}
if ($bb_cfg['show_tor_info_in_dl_list']) {
if (config('tp.show_tor_info_in_dl_list')) {
$template->assign_vars(array(
'SHOW_DL_LIST' => true,
'SHOW_DL_LIST_TOR_INFO' => true,
@ -511,7 +511,7 @@ if ($tor_reged && $tor_info) {
}
}
if ($bb_cfg['bt_allow_spmode_change'] && $s_mode != 'full') {
if (config('tp.bt_allow_spmode_change') && $s_mode != 'full') {
$template->assign_vars(array(
'PEERS_FULL_LINK' => true,
'SPMODE_FULL_HREF' => "viewtopic.php?" . POST_TOPIC_URL . "=$bt_topic_id&amp;spmode=full#seeders",
@ -519,14 +519,14 @@ if ($bb_cfg['bt_allow_spmode_change'] && $s_mode != 'full') {
}
$template->assign_vars(array(
'SHOW_DL_LIST_LINK' => (($bb_cfg['bt_show_dl_list'] || $bb_cfg['allow_dl_list_names_mode']) && $t_data['topic_dl_type'] == TOPIC_DL_TYPE_DL),
'SHOW_TOR_ACT' => ($tor_reged && $show_peers && (!isset($bb_cfg['tor_no_tor_act'][$tor_info['tor_status']]) || IS_AM)),
'S_MODE_COUNT' => ($s_mode == 'count'),
'S_MODE_NAMES' => ($s_mode == 'names'),
'S_MODE_FULL' => ($s_mode == 'full'),
'PEER_EXIST' => ($seeders || $leechers || defined('SEEDER_EXIST') || defined('LEECHER_EXIST')),
'SEED_EXIST' => ($seeders || defined('SEEDER_EXIST')),
'LEECH_EXIST' => ($leechers || defined('LEECHER_EXIST')),
'TOR_HELP_LINKS' => $bb_cfg['tor_help_links'],
'CALL_SEED' => ($bb_cfg['callseed'] && $tor_reged && !isset($bb_cfg['tor_no_tor_act'][$tor_info['tor_status']]) && $seed_count < 3 && $tor_info['call_seed_time'] < (TIMENOW - 86400)),
'SHOW_DL_LIST_LINK' => (config('tp.bt_show_dl_list') || config('tp.allow_dl_list_names_mode')) && $t_data['topic_dl_type'] == TOPIC_DL_TYPE_DL,
'SHOW_TOR_ACT' => $tor_reged && $show_peers && (null === config('tp.tor_no_tor_act.' . $tor_info['tor_status']) || IS_AM),
'S_MODE_COUNT' => $s_mode == 'count',
'S_MODE_NAMES' => $s_mode == 'names',
'S_MODE_FULL' => $s_mode == 'full',
'PEER_EXIST' => $seeders || $leechers || defined('SEEDER_EXIST') || defined('LEECHER_EXIST'),
'SEED_EXIST' => $seeders || defined('SEEDER_EXIST'),
'LEECH_EXIST' => $leechers || defined('LEECHER_EXIST'),
'TOR_HELP_LINKS' => config('tp.tor_help_links'),
'CALL_SEED' => config('tp.callseed') && $tor_reged && null === config('tp.tor_no_tor_act.' . $tor_info['tor_status']) && $seed_count < 3 && $tor_info['call_seed_time'] < (TIMENOW - 86400),
));

View file

@ -1,496 +0,0 @@
<?php
/**
* TorrentPier Bull-powered BitTorrent tracker engine
*
* @copyright Copyright (c) 2005-2017 TorrentPier (https://torrentpier.com)
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
$domain_name = env('APP_DOMAIN', 'torrentpier.com');
$bb_cfg = [];
// Increase number after changing js or css
$bb_cfg['js_ver'] = $bb_cfg['css_ver'] = 1;
// Version info
$bb_cfg['tp_version'] = '2.3.0';
$bb_cfg['tp_release_date'] = '01-12-2017';
$bb_cfg['tp_release_codename'] = 'Bison';
// Database
// Настройка баз данных ['db']['srv_name'] => (array) srv_cfg;
// порядок параметров srv_cfg (хост, название базы, пользователь, пароль, charset, pconnect);
$bb_cfg['db'] = [
'db' => [
env('DB_HOST', 'localhost'),
env('DB_DATABASE', 'torrentpier'),
env('DB_USERNAME', 'root'),
env('DB_PASSWORD', 'pass'),
'utf8',
false
],
];
$bb_cfg['database'] = [
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'torrentpier'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'pass'),
];
$bb_cfg['db_alias'] = [
'log' => 'db', // BB_LOG
'search' => 'db', // BB_TOPIC_SEARCH
'sres' => 'db', // BB_BT_USER_SETTINGS, BB_SEARCH_RESULTS
'u_ses' => 'db', // BB_USER_SES, BB_USER_LASTVISIT
'dls' => 'db', // BB_BT_DLS_*
'ip' => 'db', // BB_POSTS_IP
'ut' => 'db', // BB_TOPICS_USER_POSTED
'pm' => 'db', // BB_PRIVMSGS, BB_PRIVMSGS_TEXT
'pt' => 'db', // BB_POSTS_TEXT
];
// Cache
$bb_cfg['cache'] = [
'pconnect' => true,
'db_dir' => realpath(BB_ROOT) . '/internal_data/cache/filecache/',
'prefix' => 'tp_', // Префикс кеша ('tp_')
'memcache' => [
'host' => '127.0.0.1',
'port' => 11211,
'pconnect' => true,
'con_required' => true,
],
'redis' => [
'host' => '127.0.0.1',
'port' => 6379,
'con_required' => true,
],
// Available cache types: memcache, sqlite, redis, apc, xcache (default of filecache)
'engines' => [
'bb_cache' => ['filecache', []],
'bb_config' => ['filecache', []],
'tr_cache' => ['filecache', []],
'session_cache' => ['filecache', []],
'bb_cap_sid' => ['filecache', []],
'bb_login_err' => ['filecache', []],
'bb_poll_data' => ['filecache', []],
],
];
// Datastore
// Available datastore types: memcache, sqlite, redis, apc, xcache (default filecache)
$bb_cfg['datastore_type'] = 'filecache';
// Server
$bb_cfg['server_name'] = $domain_name; // 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
// GZip
$bb_cfg['gzip_compress'] = false; // compress output
// Tracker
$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
$bb_cfg['verify_reported_ip'] = true; // Verify IP reported by client against $_SERVER['HTTP_X_FORWARDED_FOR']
$bb_cfg['allow_internal_ip'] = false; // Allow internal IP (10.xx.. etc.)
// Ocelot
$bb_cfg['ocelot'] = [
'enabled' => false,
'host' => $domain_name,
'port' => 34000,
'url' => "http://$domain_name:34000/", // with '/'
'secret' => 'some_10_chars', // 10 chars
'stats' => 'some_10_chars', // 10 chars
];
// FAQ url help link
$bb_cfg['how_to_download_url_help'] = 'viewtopic.php?t=1'; // Как скачивать?
$bb_cfg['what_is_torrent_url_help'] = 'viewtopic.php?t=2'; // Что такое торрент?
$bb_cfg['ratio_url_help'] = 'viewtopic.php?t=3'; // Рейтинг и ограничения
$bb_cfg['search_help_url'] = 'viewtopic.php?t=4'; // Помощь по поиску
// Torrents
$bb_cfg['bt_min_ratio_allow_dl_tor'] = 0.3; // 0 - disable
$bb_cfg['bt_min_ratio_warning'] = 0.6; // 0 - disable
$bb_cfg['show_dl_status_in_search'] = true;
$bb_cfg['show_dl_status_in_forum'] = true;
$bb_cfg['show_tor_info_in_dl_list'] = true;
$bb_cfg['allow_dl_list_names_mode'] = true;
// Days to keep torrent registered
$bb_cfg['seeder_last_seen_days_keep'] = 0; // сколько дней назад был сид последний раз
$bb_cfg['seeder_never_seen_days_keep'] = 0; // сколько дней имеется статус "Сида не было никогда"
// DL-Status (days to keep user's dlstatus records)
$bb_cfg['dl_will_days_keep'] = 360;
$bb_cfg['dl_down_days_keep'] = 180;
$bb_cfg['dl_complete_days_keep'] = 180;
$bb_cfg['dl_cancel_days_keep'] = 30;
// Tor-Stats
$bb_cfg['torstat_days_keep'] = 60; // days to keep user's per-torrent stats
// Tor-Help
$bb_cfg['torhelp_enabled'] = false; // find dead torrents (without seeder) that user might help seeding
// URL's
$bb_cfg['ajax_url'] = 'ajax.php'; # "http://{$_SERVER['SERVER_NAME']}/ajax.php"
$bb_cfg['login_url'] = 'login.php'; # "http://{$domain_name}/login.php"
$bb_cfg['posting_url'] = 'posting.php'; # "http://{$domain_name}/posting.php"
$bb_cfg['pm_url'] = 'privmsg.php'; # "http://{$domain_name}/privmsg.php"
// Templates
$bb_cfg['templates'] = [
'default' => 'Стандартный',
];
$bb_cfg['tpl_name'] = 'default';
$bb_cfg['stylesheet'] = 'main.css';
$bb_cfg['show_sidebar1_on_every_page'] = false;
$bb_cfg['show_sidebar2_on_every_page'] = false;
// Cookie
$bb_cfg['cookie_domain'] = in_array($domain_name, [getenv('SERVER_ADDR'), 'localhost'], true) ? '' : ".$domain_name";
$bb_cfg['cookie_secure'] = !empty($_SERVER['HTTPS']) ? 1 : 0;
$bb_cfg['cookie_prefix'] = 'bb_'; // 'bb_'
// Sessions
$bb_cfg['session_update_intrv'] = 180; // sec
$bb_cfg['user_session_duration'] = 1800; // sec
$bb_cfg['admin_session_duration'] = 6 * 3600; // sec
$bb_cfg['user_session_gc_ttl'] = 1800; // number of seconds that a staled session entry may remain in sessions table
$bb_cfg['session_cache_gc_ttl'] = 1200; // sec
$bb_cfg['max_last_visit_days'] = 14; // days
$bb_cfg['last_visit_update_intrv'] = 3600; // sec
// Registration
$bb_cfg['invalid_logins'] = 5; // Количество неверных попыток ввода пароля, перед выводом проверки капчей
$bb_cfg['new_user_reg_disabled'] = false; // Запретить регистрацию новых учетных записей
$bb_cfg['unique_ip'] = false; // Запретить регистрацию нескольких учетных записей с одного ip
$bb_cfg['new_user_reg_restricted'] = false; // Ограничить регистрацию новых пользователей по времени с 01:00 до 17:00
$bb_cfg['reg_email_activation'] = true; // Требовать активацию учетной записи по email
// Email
$bb_cfg['board_email'] = "noreply@$domain_name"; // admin email address
$bb_cfg['board_email_form'] = false; // can users send email to each other via board
$bb_cfg['board_email_sig'] = ''; // this text will be attached to all emails the board sends
$bb_cfg['board_email_sitename'] = $domain_name; // sitename used in all emails header
$bb_cfg['topic_notify_enabled'] = true;
$bb_cfg['pm_notify_enabled'] = true;
$bb_cfg['group_send_email'] = true;
$bb_cfg['email_change_disabled'] = false; // disable changing email by user
$bb_cfg['bounce_email'] = "bounce@$domain_name"; // bounce email address
$bb_cfg['tech_admin_email'] = "admin@$domain_name"; // email for sending error reports
$bb_cfg['abuse_email'] = "abuse@$domain_name";
$bb_cfg['adv_email'] = "adv@$domain_name";
// Bugsnag error reporting
$bb_cfg['bugsnag'] = [
'enabled' => false,
'api_key' => 'ee1adc9739cfceb01ce4a450ae1e52bf',
];
// Special users
$bb_cfg['dbg_users'] = [
# user_id => 'name',
2 => 'admin',
];
$bb_cfg['unlimited_users'] = [
# user_id => 'name',
2 => 'admin',
];
$bb_cfg['super_admins'] = [
# user_id => 'name',
2 => 'admin',
];
// Date format
$bb_cfg['date_format'] = 'Y-m-d';
// Subforums
$bb_cfg['sf_on_first_page_only'] = true;
// Forums
$bb_cfg['allowed_topics_per_page'] = [50, 100, 150, 200, 250, 300];
// Topics
$bb_cfg['show_quick_reply'] = true;
$bb_cfg['show_rank_text'] = false;
$bb_cfg['show_rank_image'] = true;
$bb_cfg['show_poster_joined'] = true;
$bb_cfg['show_poster_posts'] = true;
$bb_cfg['show_poster_from'] = true;
$bb_cfg['show_bot_nick'] = false;
$bb_cfg['parse_ed2k_links'] = true; // make ed2k links clickable
$bb_cfg['post_date_format'] = 'd-M-Y H:i';
$bb_cfg['ext_link_new_win'] = true; // open external links in new window
$bb_cfg['topic_moved_days_keep'] = 7; // remove topic moved links after xx days (or FALSE to disable)
$bb_cfg['allowed_posts_per_page'] = [15, 30, 50, 100];
$bb_cfg['user_signature_start'] = '<div class="signature"><br />_________________<br />';
$bb_cfg['user_signature_end'] = '</div>'; // Это позволит использовать html теги, которые требуют закрытия. Например <table> или <font color>
// Posts
$bb_cfg['use_posts_cache'] = true;
$bb_cfg['posts_cache_days_keep'] = 14;
$bb_cfg['max_post_length'] = 120000;
$bb_cfg['use_ajax_posts'] = true;
// Search
$bb_cfg['search_engine_type'] = 'mysql'; // none, mysql, sphinx
$bb_cfg['sphinx_topic_titles_host'] = '127.0.0.1';
$bb_cfg['sphinx_topic_titles_port'] = 3312;
$bb_cfg['sphinx_config_path'] = realpath("../install/sphinx/sphinx.conf");
$bb_cfg['disable_ft_search_in_posts'] = false; // disable searching in post bodies
$bb_cfg['disable_search_for_guest'] = true;
$bb_cfg['allow_search_in_bool_mode'] = true;
$bb_cfg['max_search_words_per_post'] = 200;
$bb_cfg['search_min_word_len'] = 3;
$bb_cfg['search_max_word_len'] = 35;
$bb_cfg['limit_max_search_results'] = false;
$bb_cfg['spam_filter_file_path'] = ''; // BB_PATH .'/misc/spam_filter_words.txt';
// Posting
$bb_cfg['prevent_multiposting'] = true; // replace "reply" with "edit last msg" if user (not admin or mod) is last topic poster
$bb_cfg['max_smilies'] = 10; // Максимальное число смайлов в посте (0 - без ограничения)
// PM
$bb_cfg['privmsg_disable'] = false; // отключить систему личных сообщений на форуме
$bb_cfg['max_outgoing_pm_cnt'] = 10; // ограничение на кол. одновременных исходящих лс (для замедления рассылки спама)
$bb_cfg['max_inbox_privmsgs'] = 500; // максимальное число сообщений в папке входящие
$bb_cfg['max_savebox_privmsgs'] = 500; // максимальное число сообщений в папке сохраненные
$bb_cfg['max_sentbox_privmsgs'] = 500; // максимальное число сообщений в папке отправленные
$bb_cfg['pm_days_keep'] = 180; // время хранения ЛС
// Actions log
$bb_cfg['log_days_keep'] = 90;
// Users
$bb_cfg['color_nick'] = true; // Окраска ников пользователей по user_rank
$bb_cfg['user_not_activated_days_keep'] = 7; // "not activated" == "not finished registration"
$bb_cfg['user_not_active_days_keep'] = 180; // inactive users but only with no posts
// Groups
$bb_cfg['group_members_per_page'] = 50;
// Tidy
$bb_cfg['tidy_post'] = (!in_array('tidy', get_loaded_extensions(), true)) ? false : true;
// Misc
$bb_cfg['mem_on_start'] = MEM_USAGE ? memory_get_usage() : 0;
$bb_cfg['translate_dates'] = true; // in displaying time
$bb_cfg['use_word_censor'] = true;
$bb_cfg['last_visit_date_format'] = 'd-M H:i';
$bb_cfg['last_post_date_format'] = 'd-M-y H:i';
$bb_cfg['poll_max_days'] = 180; // сколько дней с момента создания темы опрос будет активным
$bb_cfg['allow_change'] = [
'language' => true,
'dateformat' => true,
];
$bb_cfg['trash_forum_id'] = 0; // (int) 7
$bb_cfg['first_logon_redirect_url'] = 'index.php';
$bb_cfg['terms_and_conditions_url'] = 'terms.php';
$bb_cfg['tor_help_links'] = 'terms.php';
$bb_cfg['user_agreement_url'] = 'info.php?show=user_agreement';
$bb_cfg['copyright_holders_url'] = 'info.php?show=copyright_holders';
$bb_cfg['advert_url'] = 'info.php?show=advert';
// Extensions
$bb_cfg['file_id_ext'] = [
1 => 'gif',
2 => 'gz',
3 => 'jpg',
4 => 'png',
5 => 'rar',
6 => 'tar',
7 => 'tiff',
8 => 'torrent',
9 => 'zip',
];
// Attachments
$bb_cfg['attach'] = [
'upload_path' => DATA_DIR . '/torrent_files', // путь к директории с torrent файлами
'max_size' => 5 * 1024 * 1024, // максимальный размер файла в байтах
];
$bb_cfg['tor_forums_allowed_ext'] = ['torrent', 'zip', 'rar']; // для разделов с раздачами
$bb_cfg['gen_forums_allowed_ext'] = ['zip', 'rar']; // для обычных разделов
// Avatars
$bb_cfg['avatars'] = [
'allowed_ext' => ['gif', 'jpg', 'jpeg', 'png'], // разрешенные форматы файлов
'bot_avatar' => '/gallery/bot.gif', // аватара бота
'max_size' => 100 * 1024, // размер аватары в байтах
'max_height' => 100, // высота аватара в px
'max_width' => 100, // ширина аватара в px
'no_avatar' => '/gallery/noavatar.png', // дефолтная аватара
'display_path' => '/data/avatars', // путь к директории с аватарами
'upload_path' => BB_PATH . '/data/avatars/', // путь к директории с аватарами
'up_allowed' => true, // разрешить загрузку аватар
];
// Group avatars
$bb_cfg['group_avatars'] = [
'allowed_ext' => ['gif', 'jpg', 'jpeg', 'png'], // разрешенные форматы файлов
'max_size' => 300 * 1024, // размер аватары в байтах
'max_height' => 300, // высота аватара в px
'max_width' => 300, // ширина аватара в px
'no_avatar' => '/gallery/noavatar.png', // дефолтная аватара
'display_path' => '/data/avatars', // путь к директории с аватарами
'upload_path' => BB_PATH . '/data/avatars/', // путь к директории с аватарами
'up_allowed' => true, // разрешить загрузку аватар
];
// Captcha
// Get a Google reCAPTCHA API Key: https://www.google.com/recaptcha/admin
$bb_cfg['captcha'] = [
'disabled' => false,
'public_key' => '', // your public key
'secret_key' => '', // your secret key
'theme' => 'light', // light or dark
];
// Atom feed
$bb_cfg['atom'] = [
'path' => INT_DATA_DIR . '/atom', // without ending slash
'url' => './internal_data/atom', // without ending slash
];
// Nofollow
$bb_cfg['nofollow'] = [
'disabled' => false,
'allowed_url' => [$domain_name], // 'allowed.site', 'www.allowed.site'
];
// Tracker settings
$bb_cfg['tracker'] = [
'autoclean' => true,
'off' => false,
'off_reason' => 'temporarily disabled',
'numwant' => 50,
'update_dlstat' => true,
'expire_factor' => 2.5,
'compact_mode' => true,
'upd_user_up_down_stat' => true,
'browser_redirect_url' => '',
'scrape' => true,
'limit_active_tor' => true,
'limit_seed_count' => 0,
'limit_leech_count' => 8,
'leech_expire_factor' => 60,
'limit_concurrent_ips' => false,
'limit_seed_ips' => 0,
'limit_leech_ips' => 0,
'tor_topic_up' => true,
'gold_silver_enabled' => true,
'retracker' => true,
'retracker_host' => 'http://retracker.local/announce',
'freeleech' => false,
'guest_tracker' => true,
];
// Ratio settings
// Don't change the order of ratios (from 0 to 1)
// rating < 0.4 -- allow only 1 torrent for leeching
// rating < 0.5 -- only 2
// rating < 0.6 -- only 3
// rating > 0.6 -- depend on your tracker config limits (in "ACP - Tracker Config - Limits")
$bb_cfg['rating'] = [
'0.4' => 1,
'0.5' => 2,
'0.6' => 3,
];
// Иконки статусов раздач
$bb_cfg['tor_icons'] = [
TOR_NOT_APPROVED => '<span class="tor-icon tor-not-approved">*</span>',
TOR_CLOSED => '<span class="tor-icon tor-closed">x</span>',
TOR_APPROVED => '<span class="tor-icon tor-approved">&radic;</span>',
TOR_NEED_EDIT => '<span class="tor-icon tor-need-edit">?</span>',
TOR_NO_DESC => '<span class="tor-icon tor-no-desc">!</span>',
TOR_DUP => '<span class="tor-icon tor-dup">D</span>',
TOR_CLOSED_CPHOLD => '<span class="tor-icon tor-closed-cp">&copy;</span>',
TOR_CONSUMED => '<span class="tor-icon tor-consumed">&sum;</span>',
TOR_DOUBTFUL => '<span class="tor-icon tor-approved">#</span>',
TOR_CHECKING => '<span class="tor-icon tor-checking">%</span>',
TOR_TMP => '<span class="tor-icon tor-dup">T</span>',
TOR_PREMOD => '<span class="tor-icon tor-dup">&#8719;</span>',
TOR_REPLENISH => '<span class="tor-icon tor-dup">R</span>',
];
// Запрет на скачивание
$bb_cfg['tor_frozen'] = [
TOR_CHECKING => true,
TOR_CLOSED => true,
TOR_CLOSED_CPHOLD => true,
TOR_CONSUMED => true,
TOR_DUP => true,
TOR_NO_DESC => true,
TOR_PREMOD => true,
];
// Разрешение на скачку автором, если закрыто на скачивание.
$bb_cfg['tor_frozen_author_download'] = [
TOR_CHECKING => true,
TOR_NO_DESC => true,
TOR_PREMOD => true,
];
// Запрет на редактирование головного сообщения
$bb_cfg['tor_cannot_edit'] = [
TOR_CHECKING => true,
TOR_CLOSED => true,
TOR_CONSUMED => true,
TOR_DUP => true,
];
// Запрет на создание новых раздач если стоит статус недооформлено/неоформлено/сомнительно
$bb_cfg['tor_cannot_new'] = [TOR_NEED_EDIT, TOR_NO_DESC, TOR_DOUBTFUL];
// Разрешение на ответ релизера, если раздача исправлена.
$bb_cfg['tor_reply'] = [TOR_NEED_EDIT, TOR_NO_DESC, TOR_DOUBTFUL];
// Если такой статус у релиза, то статистика раздачи будет скрыта
$bb_cfg['tor_no_tor_act'] = [
TOR_CLOSED => true,
TOR_DUP => true,
TOR_CLOSED_CPHOLD => true,
TOR_CONSUMED => true,
];
// Vote graphic length defines the maximum length of a vote result graphic, ie. 100% = this length
$bb_cfg['vote_graphic_length'] = 205;
$bb_cfg['privmsg_graphic_length'] = 175;
$bb_cfg['topic_left_column_witdh'] = 150;
// Images auto-resize
$bb_cfg['post_img_width_decr'] = 52;
$bb_cfg['attach_img_width_decr'] = 130;
if (isset($bb_cfg['default_lang']) && file_exists(LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'])) {
$bb_cfg['default_lang_dir'] = LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'] . '/';
} else {
$bb_cfg['default_lang_dir'] = LANG_ROOT_DIR . '/en/';
}
return $bb_cfg;

View file

@ -106,7 +106,7 @@ function prepare_message($message)
// Either in a window or inline
function generate_smilies($mode)
{
global $bb_cfg, $template, $lang, $user, $datastore;
global $template, $lang, $user, $datastore;
$inline_columns = 4;
$inline_rows = 7;
@ -144,7 +144,7 @@ function generate_smilies($mode)
$template->assign_block_vars('smilies_row.smilies_col', array(
'SMILEY_CODE' => $data['code'],
'SMILEY_IMG' => $bb_cfg['smilies_path'] . '/' . $smile_url,
'SMILEY_IMG' => config('tp.smilies_path') . '/' . $smile_url,
'SMILEY_DESC' => $data['emoticon'],
));
@ -325,11 +325,9 @@ function strip_bbcode($message, $stripquotes = true, $fast_and_dirty = false, $s
function extract_search_words($text)
{
global $bb_cfg;
$max_words_count = $bb_cfg['max_search_words_per_post'];
$min_word_len = max(2, $bb_cfg['search_min_word_len'] - 1);
$max_word_len = $bb_cfg['search_max_word_len'];
$max_words_count = config('tp.max_search_words_per_post');
$min_word_len = max(2, config('tp.search_min_word_len') - 1);
$max_word_len = config('tp.search_max_word_len');
$text = ' ' . str_compact(strip_tags(mb_strtolower($text))) . ' ';
$text = str_replace(array('&#91;', '&#93;'), array('[', ']'), $text);
@ -372,12 +370,10 @@ function extract_search_words($text)
function add_search_words($post_id, $post_message, $topic_title = '', $only_return_words = false)
{
global $bb_cfg;
$text = $topic_title . ' ' . $post_message;
$words = ($text) ? extract_search_words($text) : array();
if ($only_return_words || $bb_cfg['search_engine_type'] == 'sphinx') {
if ($only_return_words || config('tp.search_engine_type') == 'sphinx') {
return implode("\n", $words);
}
@ -421,22 +417,19 @@ function get_words_rate($text)
function hide_passkey($str)
{
global $bb_cfg;
return preg_replace("#\?{$bb_cfg['passkey_key']}=[a-zA-Z0-9]{" . BT_AUTH_KEY_LENGTH . "}#", "?{$bb_cfg['passkey_key']}=passkey", $str);
return preg_replace("#\?" . config('tp.passkey_key') . "=[a-zA-Z0-9]{" . BT_AUTH_KEY_LENGTH . "}#", "?" . config('tp.passkey_key') . "=passkey", $str);
}
function get_parsed_post($postrow, $mode = 'full', $return_chars = 600)
{
global $bb_cfg;
if ($bb_cfg['use_posts_cache'] && !empty($postrow['post_html'])) {
if (config('tp.use_posts_cache') && !empty($postrow['post_html'])) {
return $postrow['post_html'];
}
$message = bbcode2html($postrow['post_text']);
// Posts cache
if ($bb_cfg['use_posts_cache']) {
if (config('tp.use_posts_cache')) {
OLD_DB()->shutdown['post_html'][] = array(
'post_id' => (int)$postrow['post_id'],
'post_html' => (string)$message,

View file

@ -19,7 +19,7 @@ sync('user_posts', 'all');
sync_all_forums();
// Чистка bb_poll_users
if ($poll_max_days = (int)$bb_cfg['poll_max_days']) {
if ($poll_max_days = (int)config('tp.poll_max_days')) {
$per_cycle = 20000;
$row = OLD_DB()->fetch_row("SELECT MIN(topic_id) AS start_id, MAX(topic_id) AS finish_id FROM " . BB_POLL_USERS);
$start_id = (int)$row['start_id'];
@ -47,6 +47,6 @@ if ($poll_max_days = (int)$bb_cfg['poll_max_days']) {
OLD_DB()->query("UPDATE " . BB_USERS . " SET user_newpasswd = '' WHERE user_lastvisit < " . (TIMENOW - 7 * 86400));
// Чистка кеша постов
if ($posts_days = (int)$bb_cfg['posts_cache_days_keep']) {
if ($posts_days = (int)config('tp.posts_cache_days_keep')) {
OLD_DB()->query("DELETE FROM " . BB_POSTS_HTML . " WHERE post_html_time < DATE_SUB(NOW(), INTERVAL $posts_days DAY)");
}

View file

@ -13,7 +13,7 @@ if (!defined('BB_ROOT')) {
global $cron_runtime_log;
foreach ($bb_cfg['cache']['engines'] as $cache_name => $cache_val) {
foreach (config('tp.cache.engines') as $cache_name => $cache_val) {
if (method_exists(OLD_CACHE($cache_name), 'gc')) {
$changes = OLD_CACHE($cache_name)->gc();
$cron_runtime_log = date('Y-m-d H:i:s') . " -- " . str_pad("$cache_name ", 25, '-', STR_PAD_RIGHT) . " del: $changes\n";

View file

@ -13,10 +13,10 @@ if (!defined('BB_ROOT')) {
// Delete staled dl-status records
$keeping_dlstat = array(
DL_STATUS_WILL => (int)$bb_cfg['dl_will_days_keep'],
DL_STATUS_DOWN => (int)$bb_cfg['dl_down_days_keep'],
DL_STATUS_COMPLETE => (int)$bb_cfg['dl_complete_days_keep'],
DL_STATUS_CANCEL => (int)$bb_cfg['dl_cancel_days_keep'],
DL_STATUS_WILL => (int)config('tp.dl_will_days_keep'),
DL_STATUS_DOWN => (int)config('tp.dl_down_days_keep'),
DL_STATUS_COMPLETE => (int)config('tp.dl_complete_days_keep'),
DL_STATUS_CANCEL => (int)config('tp.dl_cancel_days_keep'),
);
$delete_dlstat_sql = array();
@ -51,7 +51,7 @@ OLD_DB()->query("
");
// Tor-Stats cleanup
if ($torstat_days_keep = (int)$bb_cfg['torstat_days_keep']) {
if ($torstat_days_keep = (int)config('tp.torstat_days_keep')) {
OLD_DB()->query("DELETE QUICK FROM " . BB_BT_TORSTAT . " WHERE last_modified_torstat < DATE_SUB(NOW(), INTERVAL $torstat_days_keep DAY)");
}

View file

@ -11,7 +11,7 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
$log_days_keep = (int)$bb_cfg['log_days_keep'];
$log_days_keep = (int)config('tp.log_days_keep');
OLD_DB()->query("
DELETE FROM " . BB_LOG . "

View file

@ -13,7 +13,7 @@ if (!defined('BB_ROOT')) {
require_once INC_DIR . '/functions_admin.php';
if ($bb_cfg['prune_enable']) {
if (config('tp.prune_enable')) {
$sql = "SELECT forum_id, prune_days FROM " . BB_FORUMS . " WHERE prune_days != 0";
foreach (OLD_DB()->fetch_rowset($sql) as $row) {

View file

@ -20,7 +20,7 @@ while (true) {
$prune_users = $not_activated_users = $not_active_users = array();
if ($not_activated_days = (int)$bb_cfg['user_not_activated_days_keep']) {
if ($not_activated_days = (int)config('tp.user_not_activated_days_keep')) {
$sql = OLD_DB()->fetch_rowset("SELECT user_id FROM " . BB_USERS . "
WHERE user_level = 0
AND user_lastvisit = 0
@ -34,7 +34,7 @@ while (true) {
}
}
if ($not_active_days = (int)$bb_cfg['user_not_active_days_keep']) {
if ($not_active_days = (int)config('tp.user_not_active_days_keep')) {
$sql = OLD_DB()->fetch_rowset("SELECT user_id FROM " . BB_USERS . "
WHERE user_level = 0
AND user_posts = 0

View file

@ -11,8 +11,8 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
if ($bb_cfg['topic_moved_days_keep']) {
$prune_time = TIMENOW - 86400 * $bb_cfg['topic_moved_days_keep'];
if (config('tp.topic_moved_days_keep')) {
$prune_time = TIMENOW - 86400 * config('tp.topic_moved_days_keep');
OLD_DB()->query("
DELETE FROM " . BB_TOPICS . "

View file

@ -11,10 +11,10 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
$user_session_expire_time = TIMENOW - (int)$bb_cfg['user_session_duration'];
$admin_session_expire_time = TIMENOW - (int)$bb_cfg['admin_session_duration'];
$user_session_expire_time = TIMENOW - (int)config('tp.user_session_duration');
$admin_session_expire_time = TIMENOW - (int)config('tp.admin_session_duration');
$user_session_gc_time = $user_session_expire_time - (int)$bb_cfg['user_session_gc_ttl'];
$user_session_gc_time = $user_session_expire_time - (int)config('tp.user_session_gc_ttl');
$admin_session_gc_time = $admin_session_expire_time;
// ############################ Tables LOCKED ################################

View file

@ -27,7 +27,7 @@ OLD_DB()->query("CREATE TABLE " . NEW_BB_BT_LAST_USERSTAT . " LIKE " . BB_BT_LAS
OLD_DB()->expect_slow_query(600);
// Update dlstat (part 1)
if ($bb_cfg['tracker']['update_dlstat']) {
if (config('tracker.update_dlstat')) {
// ############################ Tables LOCKED ################################
OLD_DB()->lock(array(
BB_BT_TRACKER,
@ -64,16 +64,16 @@ OLD_DB()->query("
");
// Clean peers table
if ($bb_cfg['tracker']['autoclean']) {
$announce_interval = max((int)$bb_cfg['announce_interval'], 60);
$expire_factor = max((float)$bb_cfg['tracker']['expire_factor'], 1);
if (config('tracker.autoclean')) {
$announce_interval = max((int)config('tp.announce_interval'), 60);
$expire_factor = max((float)config('tracker.expire_factor'), 1);
$peer_expire_time = TIMENOW - floor($announce_interval * $expire_factor);
OLD_DB()->query("DELETE FROM " . BB_BT_TRACKER . " WHERE update_time < $peer_expire_time");
}
// Update dlstat (part 2)
if ($bb_cfg['tracker']['update_dlstat']) {
if (config('tracker.update_dlstat')) {
// Set "only 1 seeder" bonus
OLD_DB()->query("
UPDATE

View file

@ -11,9 +11,7 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
global $bb_cfg;
if ($bb_cfg['ocelot']['enabled']) {
if (config('tp.ocelot.enabled')) {
// Update TORRENT "completed" counters
OLD_DB()->query("
UPDATE

View file

@ -11,12 +11,12 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
if (empty($bb_cfg['seeder_last_seen_days_keep']) || empty($bb_cfg['seeder_never_seen_days_keep'])) {
if (empty(config('tp.seeder_last_seen_days_keep')) || empty(config('tp.seeder_never_seen_days_keep'))) {
return;
}
$last_seen_time = TIMENOW - 86400 * $bb_cfg['seeder_last_seen_days_keep'];
$never_seen_time = TIMENOW - 86400 * $bb_cfg['seeder_never_seen_days_keep'];
$last_seen_time = TIMENOW - 86400 * config('tp.seeder_last_seen_days_keep');
$never_seen_time = TIMENOW - 86400 * config('tp.seeder_never_seen_days_keep');
$limit_sql = 3000;
$topics_sql = $attach_sql = array();

View file

@ -11,14 +11,12 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
global $bb_cfg;
OLD_DB()->expect_slow_query(600);
//
// Make tracker snapshot
//
if (!$bb_cfg['ocelot']['enabled']) {
if (!config('tp.ocelot.enabled')) {
define('NEW_BB_BT_TRACKER_SNAP', 'new_tracker_snap');
define('OLD_BB_BT_TRACKER_SNAP', 'old_tracker_snap');
@ -37,7 +35,7 @@ while (true) {
$val = array();
if (!$bb_cfg['ocelot']['enabled']) {
if (!config('tp.ocelot.enabled')) {
$sql = "
SELECT
topic_id, SUM(seeder) AS seeders, (COUNT(*) - SUM(seeder)) AS leechers,
@ -61,7 +59,7 @@ while (true) {
}
if ($val) {
if (!$bb_cfg['ocelot']['enabled']) {
if (!config('tp.ocelot.enabled')) {
OLD_DB()->query("
REPLACE INTO " . NEW_BB_BT_TRACKER_SNAP . "
(topic_id, seeders, leechers, speed_up, speed_down)
@ -84,7 +82,7 @@ while (true) {
$start_id += $per_cycle;
}
if (!$bb_cfg['ocelot']['enabled']) {
if (!config('tp.ocelot.enabled')) {
OLD_DB()->query("
RENAME TABLE
" . BB_BT_TRACKER_SNAP . " TO " . OLD_BB_BT_TRACKER_SNAP . ",
@ -104,7 +102,7 @@ OLD_DB()->query("DROP TABLE IF EXISTS " . NEW_BB_BT_DLSTATUS_SNAP . ", " . OLD_B
OLD_DB()->query("CREATE TABLE " . NEW_BB_BT_DLSTATUS_SNAP . " LIKE " . BB_BT_DLSTATUS_SNAP);
if ($bb_cfg['bt_show_dl_list'] && $bb_cfg['bt_dl_list_only_count']) {
if (config('tp.bt_show_dl_list') && config('tp.bt_dl_list_only_count')) {
OLD_DB()->query("
INSERT INTO " . NEW_BB_BT_DLSTATUS_SNAP . "
(topic_id, dl_status, users_count)
@ -127,7 +125,7 @@ OLD_DB()->query("DROP TABLE IF EXISTS " . NEW_BB_BT_DLSTATUS_SNAP . ", " . OLD_B
//
// TORHELP
//
if ($bb_cfg['torhelp_enabled']) {
if (config('tp.torhelp_enabled')) {
$tor_min_seeders = 0; // "<="
$tor_min_leechers = 2; // ">="
$tor_min_completed = 10; // ">="
@ -170,7 +168,7 @@ if ($bb_cfg['torhelp_enabled']) {
WHERE
trsn.seeders <= $tor_min_seeders
AND trsn.leechers >= $tor_min_leechers
AND tor.forum_id != " . (int)$bb_cfg['trash_forum_id'] . "
AND tor.forum_id != " . (int)config('tp.trash_forum_id') . "
AND tor.complete_count >= $tor_min_completed
AND tor.seeder_last_seen <= (UNIX_TIMESTAMP() - $tor_seed_last_seen_days*86400)
AND dl.user_id IN($online_users_csv)

View file

@ -13,7 +13,7 @@ if (!defined('BB_ROOT')) {
OLD_DB()->expect_slow_query(600);
if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['seed_bonus_release']) {
if (config('tp.seed_bonus_enabled') && config('tp.seed_bonus_points') && config('tp.seed_bonus_release')) {
OLD_DB()->query("
CREATE TEMPORARY TABLE tmp_bonus (
user_id INT UNSIGNED NOT NULL DEFAULT '0',
@ -21,7 +21,7 @@ if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['se
) ENGINE = MEMORY
");
$tor_size = ($bb_cfg['seed_bonus_tor_size'] * 1073741824);
$tor_size = (config('tp.seed_bonus_tor_size') * 1073741824);
OLD_DB()->query("INSERT INTO tmp_bonus
SELECT bt.user_id, count(bt.seeder) AS release_count
@ -32,8 +32,8 @@ if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['se
GROUP BY user_id
");
$seed_bonus = unserialize($bb_cfg['seed_bonus_points']);
$seed_release = unserialize($bb_cfg['seed_bonus_release']);
$seed_bonus = unserialize(config('tp.seed_bonus_points'));
$seed_release = unserialize(config('tp.seed_bonus_release'));
foreach ($seed_bonus as $i => $points) {
if (!$points || !$seed_release[$i]) {
@ -42,7 +42,7 @@ if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['se
$user_points = ((float)$points / 4);
$release = (int)$seed_release[$i];
$user_regdate = (TIMENOW - $bb_cfg['seed_bonus_user_regdate'] * 86400);
$user_regdate = (TIMENOW - config('tp.seed_bonus_user_regdate') * 86400);
OLD_DB()->query("
UPDATE " . BB_USERS . " u, " . BB_BT_USERS . " bu, tmp_bonus b

View file

@ -11,15 +11,13 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
global $bb_cfg;
require_once INC_DIR . '/functions_atom.php';
$timecheck = TIMENOW - 600;
$forums_data = OLD_DB()->fetch_rowset("SELECT forum_id, allow_reg_tracker, forum_name FROM " . BB_FORUMS);
if (file_exists($bb_cfg['atom']['path'] . '/f/0.atom')) {
if (filemtime($bb_cfg['atom']['path'] . '/f/0.atom') <= $timecheck) {
if (file_exists(config('tp.atom.path') . '/f/0.atom')) {
if (filemtime(config('tp.atom.path') . '/f/0.atom') <= $timecheck) {
update_forum_feed(0, $forums_data);
}
} else {
@ -27,8 +25,8 @@ if (file_exists($bb_cfg['atom']['path'] . '/f/0.atom')) {
}
foreach ($forums_data as $forum_data) {
if (file_exists($bb_cfg['atom']['path'] . '/f/' . $forum_data['forum_id'] . '.atom')) {
if (filemtime($bb_cfg['atom']['path'] . '/f/' . $forum_data['forum_id'] . '.atom') <= $timecheck) {
if (file_exists(config('tp.atom.path') . '/f/' . $forum_data['forum_id'] . '.atom')) {
if (filemtime(config('tp.atom.path') . '/f/' . $forum_data['forum_id'] . '.atom') <= $timecheck) {
update_forum_feed($forum_data['forum_id'], $forum_data);
}
} else {

View file

@ -11,7 +11,7 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
global $bf, $bb_cfg;
global $bf;
//
// cat_forums
@ -128,8 +128,8 @@ $this->store('viewtopic_forum_select', $data);
//
// latest_news
//
if ($bb_cfg['show_latest_news'] and $news_forum_ids = $bb_cfg['latest_news_forum_id']) {
$news_count = max($bb_cfg['latest_news_count'], 1);
if (config('tp.show_latest_news') && $news_forum_ids = config('tp.latest_news_forum_id')) {
$news_count = max(config('tp.latest_news_count'), 1);
$data = OLD_DB()->fetch_rowset("
SELECT topic_id, topic_time, topic_title, forum_id
@ -146,8 +146,8 @@ if ($bb_cfg['show_latest_news'] and $news_forum_ids = $bb_cfg['latest_news_forum
//
// Network_news
//
if ($bb_cfg['show_network_news'] and $net_forum_ids = $bb_cfg['network_news_forum_id']) {
$net_count = max($bb_cfg['network_news_count'], 1);
if (config('tp.show_network_news') && $net_forum_ids = config('tp.network_news_forum_id')) {
$net_count = max(config('tp.network_news_count'), 1);
$data = OLD_DB()->fetch_rowset("
SELECT topic_id, topic_time, topic_title, forum_id

View file

@ -11,16 +11,14 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
global $bb_cfg;
$smilies = array();
$smilies = [];
$rowset = OLD_DB()->fetch_rowset("SELECT * FROM " . BB_SMILIES);
sort($rowset);
foreach ($rowset as $smile) {
$smilies['orig'][] = '#(?<=^|\W)' . preg_quote($smile['code'], '#') . '(?=$|\W)#';
$smilies['repl'][] = ' <img class="smile" src="' . $bb_cfg['smilies_path'] . '/' . $smile['smile_url'] . '" alt="' . $smile['emoticon'] . '" align="absmiddle" border="0" />';
$smilies['repl'][] = ' <img class="smile" src="' . config('tp.smilies_path') . '/' . $smile['smile_url'] . '" alt="' . $smile['emoticon'] . '" align="absmiddle" border="0" />';
$smilies['smile'][] = $smile;
}

View file

@ -11,9 +11,7 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
global $bb_cfg;
$data = array();
$data = [];
// usercount
$row = OLD_DB()->fetch_row("SELECT COUNT(*) AS usercount FROM " . BB_USERS . " WHERE user_id NOT IN(" . EXCLUDED_USERS . ")");
@ -29,7 +27,7 @@ $data['postcount'] = number_format($row['postcount']);
$data['topiccount'] = number_format($row['topiccount']);
// Tracker stats
if ($bb_cfg['tor_stats']) {
if (config('tp.tor_stats')) {
// torrents stat
$row = OLD_DB()->fetch_row("SELECT COUNT(topic_id) AS torrentcount, SUM(size) AS size FROM " . BB_BT_TORRENTS);
$data['torrentcount'] = number_format($row['torrentcount']);
@ -44,7 +42,7 @@ if ($bb_cfg['tor_stats']) {
}
// gender stat
if ($bb_cfg['gender']) {
if (config('tp.gender')) {
$male = OLD_DB()->fetch_row("SELECT COUNT(user_id) AS male FROM " . BB_USERS . " WHERE user_gender = " . MALE . " AND user_id NOT IN(" . EXCLUDED_USERS . ")");
$female = OLD_DB()->fetch_row("SELECT COUNT(user_id) AS female FROM " . BB_USERS . " WHERE user_gender = " . FEMALE . " AND user_id NOT IN(" . EXCLUDED_USERS . ")");
$unselect = OLD_DB()->fetch_row("SELECT COUNT(user_id) AS unselect FROM " . BB_USERS . " WHERE user_gender = 0 AND user_id NOT IN(" . EXCLUDED_USERS . ")");
@ -55,7 +53,7 @@ if ($bb_cfg['gender']) {
}
// birthday stat
if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
if (config('tp.birthday_check_day') && config('tp.birthday_enabled')) {
$sql = OLD_DB()->fetch_rowset("SELECT user_id, username, user_rank , user_birthday
FROM " . BB_USERS . "
WHERE user_id NOT IN(" . EXCLUDED_USERS . ")
@ -65,7 +63,7 @@ if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
");
$date_today = bb_date(TIMENOW, 'md', false);
$date_forward = bb_date(TIMENOW + ($bb_cfg['birthday_check_day'] * 86400), 'md', false);
$date_forward = bb_date(TIMENOW + (config('tp.birthday_check_day') * 86400), 'md', false);
$birthday_today_list = $birthday_week_list = array();

View file

@ -13,22 +13,19 @@ if (!defined('BB_ROOT')) {
function get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div)
{
global $bb_cfg;
$ext = $bb_cfg['file_id_ext'][$ext_id] ?? '';
$ext = config('tp.file_id_ext.' . $ext_id) ?? '';
return ($base_path ? "$base_path/" : '') . floor($id / $first_div) . '/' . ($id % $sec_div) . '/' . $id . ($ext ? ".$ext" : '');
}
function get_avatar_path($id, $ext_id, $base_path = null, $first_div = 10000, $sec_div = 100)
{
global $bb_cfg;
$base_path = $base_path ?? $bb_cfg['avatars']['upload_path'];
$base_path = $base_path ?? config('tp.avatars.upload_path');
return get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div);
}
function get_attach_path($id, $ext_id = '', $base_path = null, $first_div = 10000, $sec_div = 100)
{
global $bb_cfg;
$base_path = $base_path ?? $bb_cfg['attach']['upload_path'];
$base_path = $base_path ?? config('tp.attach.upload_path');
return get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div);
}
@ -581,26 +578,22 @@ function humn_size($size, $rounder = null, $min = null, $space = '&nbsp;')
function bt_show_ip($ip, $port = '')
{
global $bb_cfg;
if (IS_AM) {
$ip = decode_ip($ip);
$ip .= ($port) ? ":$port" : '';
return $ip;
}
return ($bb_cfg['bt_show_ip_only_moder']) ? false : decode_ip_xx($ip);
return config('tp.bt_show_ip_only_moder') ? false : decode_ip_xx($ip);
}
function bt_show_port($port)
{
global $bb_cfg;
if (IS_AM) {
return $port;
}
return ($bb_cfg['bt_show_port_only_moder']) ? false : $port;
return config('tp.bt_show_port_only_moder') ? false : $port;
}
function decode_ip_xx($ip)
@ -855,7 +848,7 @@ function bb_get_config($table, $from_db = false, $update_cache = true)
{
if ($from_db or !$cfg = OLD_CACHE('bb_config')->get("config_{$table}")) {
$cfg = array();
foreach (OLD_DB()->fetch_rowset("SELECT * FROM $table") as $row) {
foreach (DB::table($table)->get()->toArray() as $row) {
$cfg[$row['config_name']] = $row['config_value'];
}
if ($update_cache) {
@ -1075,14 +1068,14 @@ function get_forum_select($mode = 'guest', $name = POST_FORUM_URL, $selected = n
function setup_style()
{
global $bb_cfg, $template, $userdata;
global $template, $userdata;
// AdminCP works only with default template
$tpl_dir_name = defined('IN_ADMIN') ? 'default' : basename($bb_cfg['tpl_name']);
$stylesheet = defined('IN_ADMIN') ? 'main.css' : basename($bb_cfg['stylesheet']);
$tpl_dir_name = defined('IN_ADMIN') ? 'default' : basename(config('tp.tpl_name'));
$stylesheet = defined('IN_ADMIN') ? 'main.css' : basename(config('tp.stylesheet'));
if (!IS_GUEST && !empty($userdata['tpl_name'])) {
foreach ($bb_cfg['templates'] as $folder => $name) {
foreach (config('tp.templates') as $folder => $name) {
if ($userdata['tpl_name'] == $folder) {
$tpl_dir_name = basename($userdata['tpl_name']);
}
@ -1096,7 +1089,7 @@ function setup_style()
'BB_ROOT' => BB_ROOT,
'SPACER' => make_url('styles/images/spacer.gif'),
'STYLESHEET' => make_url($css_dir . $stylesheet),
'EXT_LINK_NEW_WIN' => $bb_cfg['ext_link_new_win'],
'EXT_LINK_NEW_WIN' => config('tp.ext_link_new_win'),
'TPL_DIR' => make_url($css_dir),
'SITE_URL' => make_url('/'),
));
@ -1109,19 +1102,19 @@ function setup_style()
// Create date / time with format and friendly date
function bb_date($gmepoch, $format = false, $friendly_date = true)
{
global $bb_cfg, $lang, $userdata;
global $lang, $userdata;
$gmepoch = (int)$gmepoch;
if (!$format) {
$format = $bb_cfg['default_dateformat'];
$format = config('tp.default_dateformat');
}
if (empty($lang)) {
require_once($bb_cfg['default_lang_dir'] . 'main.php');
require_once(config('tp.default_lang_dir') . 'main.php');
}
if (empty($userdata['session_logged_in'])) {
$tz = $bb_cfg['board_timezone'];
$tz = config('tp.board_timezone');
} else {
$tz = $userdata['user_timezone'];
}
@ -1156,17 +1149,16 @@ function bb_date($gmepoch, $format = false, $friendly_date = true)
}
}
return ($bb_cfg['translate_dates']) ? strtr(strtoupper($date), $lang['DATETIME']) : $date;
return config('tp.translate_dates') ? strtr(strtoupper($date), $lang['DATETIME']) : $date;
}
function birthday_age($date)
{
global $bb_cfg;
if (!$date) {
return;
}
$tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
$tz = TIMENOW + (3600 * config('tp.board_timezone'));
return delta_time(strtotime($date, $tz));
}
@ -1290,9 +1282,7 @@ function bb_preg_quote($str, $delimiter)
//
function obtain_word_list(&$orig_word, &$replacement_word)
{
global $bb_cfg;
if (!$bb_cfg['use_word_censor']) {
if (!config('tp.use_word_censor')) {
return;
}
@ -1315,7 +1305,7 @@ function obtain_word_list(&$orig_word, &$replacement_word)
function bb_die($msg_text)
{
global $ajax, $bb_cfg, $lang, $template, $theme, $userdata;
global $ajax, $lang, $template, $theme, $userdata;
if (defined('IN_AJAX')) {
$ajax->ajax_die($msg_text);
@ -1330,7 +1320,7 @@ function bb_die($msg_text)
// If empty lang
if (empty($lang)) {
require($bb_cfg['default_lang_dir'] . 'main.php');
require(config('tp.default_lang_dir') . 'main.php');
}
// If empty session
@ -1341,7 +1331,7 @@ function bb_die($msg_text)
// If the header hasn't been output then do it
if (!defined('PAGE_HEADER_SENT')) {
if (empty($template)) {
$template = new TorrentPier\Legacy\Template(BB_ROOT . "templates/{$bb_cfg['tpl_name']}");
$template = new TorrentPier\Legacy\Template(BB_ROOT . 'templates/' . config('tp.tpl_name'));
}
if (empty($theme)) {
$theme = setup_style();
@ -1369,8 +1359,6 @@ function bb_die($msg_text)
function bb_simple_die($txt)
{
global $bb_cfg;
if (!empty($_COOKIE['explain'])) {
bb_die("bb_simple_die:<br /><br />$txt");
}
@ -1386,7 +1374,7 @@ function bb_realpath($path)
function redirectToLogin($url = '')
{
redirectToUrl(LOGIN_URL . '?redirect=' . (($url) ?: ($_SERVER['REQUEST_URI'] ?? '/')));
redirectToUrl(LOGIN_URL . '?redirect=' . ($url ?: ($_SERVER['REQUEST_URI'] ?? '/')));
}
function meta_refresh($url, $time = 5)
@ -1398,8 +1386,6 @@ function meta_refresh($url, $time = 5)
function redirectToUrl($url)
{
global $bb_cfg;
if (headers_sent($filename, $linenum)) {
trigger_error("Headers already sent in $filename($linenum)", E_USER_ERROR);
}
@ -1409,11 +1395,11 @@ function redirectToUrl($url)
}
$url = trim($url);
$server_protocol = ($bb_cfg['cookie_secure']) ? 'https://' : 'http://';
$server_protocol = config('tp.cookie_secure') ? 'https://' : 'http://';
$server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($bb_cfg['server_name']));
$server_port = ($bb_cfg['server_port'] <> 80) ? ':' . trim($bb_cfg['server_port']) : '';
$script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($bb_cfg['script_path']));
$server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim(config('tp.server_name')));
$server_port = (config('tp.server_port') <> 80) ? ':' . trim(config('tp.server_port')) : '';
$script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim(config('tp.script_path')));
if ($script_name) {
$script_name = "/$script_name";
@ -1609,9 +1595,9 @@ function cat_exists($cat_id)
function get_topic_icon($topic, $is_unread = null)
{
global $bb_cfg, $images;
global $images;
$t_hot = ($topic['topic_replies'] >= $bb_cfg['hot_threshold']);
$t_hot = ($topic['topic_replies'] >= config('tp.hot_threshold'));
$is_unread = $is_unread ?? is_unread($topic['topic_last_post_time'], $topic['topic_id'], $topic['forum_id']);
if ($topic['topic_status'] == TOPIC_MOVED) {
@ -1699,8 +1685,7 @@ function get_poll_data_items_js($topic_id)
function poll_is_active($t_data)
{
global $bb_cfg;
return ($t_data['topic_vote'] == 1 && $t_data['topic_time'] > TIMENOW - $bb_cfg['poll_max_days'] * 86400);
return ($t_data['topic_vote'] == 1 && $t_data['topic_time'] > TIMENOW - config('tp.poll_max_days') * 86400);
}
function print_confirmation($tpl_vars)
@ -1778,7 +1763,7 @@ function clean_title($str, $replace_underscore = false)
function clean_text_match($text, $ltrim_star = true, $die_if_empty = false)
{
global $bb_cfg, $lang;
global $lang;
$text = str_compact($text);
$ltrim_chars = ($ltrim_star) ? ' *-!' : ' ';
@ -1786,7 +1771,7 @@ function clean_text_match($text, $ltrim_star = true, $die_if_empty = false)
$text = ' ' . str_compact(ltrim($text, $ltrim_chars)) . ' ';
if ($bb_cfg['search_engine_type'] == 'sphinx') {
if (config('tp.search_engine_type') == 'sphinx') {
$text = preg_replace('#(?<=\S)\-#u', ' ', $text); // "1-2-3" -> "1 2 3"
$text = preg_replace('#[^0-9a-zA-Zа-яА-ЯёЁ\-_*|]#u', ' ', $text); // допустимые символы (кроме " которые отдельно)
$text = str_replace('-', ' -', $text); // - только в начале слова
@ -1837,7 +1822,7 @@ function log_sphinx_error($err_type, $err_msg, $query = '')
function get_title_match_topics($title_match_sql, array $forum_ids = array())
{
global $bb_cfg, $sphinx, $userdata, $title_match, $lang;
global $sphinx, $userdata, $title_match, $lang;
$where_ids = [];
if ($forum_ids) {
@ -1845,12 +1830,12 @@ function get_title_match_topics($title_match_sql, array $forum_ids = array())
}
$title_match_sql = encode_text_match($title_match_sql);
if ($bb_cfg['search_engine_type'] == 'sphinx') {
if (config('tp.search_engine_type') == 'sphinx') {
$sphinx = init_sphinx();
$where = $title_match ? 'topics' : 'posts';
$sphinx->setServer($bb_cfg['sphinx_topic_titles_host'], $bb_cfg['sphinx_topic_titles_port']);
$sphinx->setServer(config('tp.sphinx_topic_titles_host'), config('tp.sphinx_topic_titles_port'));
if ($forum_ids) {
$sphinx->setFilter('forum_id', $forum_ids, false);
}
@ -1870,9 +1855,9 @@ function get_title_match_topics($title_match_sql, array $forum_ids = array())
if ($warning = $sphinx->getLastWarning()) {
log_sphinx_error('wrn', $warning, $title_match_sql);
}
} elseif ($bb_cfg['search_engine_type'] == 'mysql') {
} elseif (config('tp.search_engine_type') == 'mysql') {
$where_forum = ($forum_ids) ? "AND forum_id IN(" . implode(',', $forum_ids) . ")" : '';
$search_bool_mode = ($bb_cfg['allow_search_in_bool_mode']) ? ' IN BOOLEAN MODE' : '';
$search_bool_mode = config('tp.allow_search_in_bool_mode') ? ' IN BOOLEAN MODE' : '';
if ($title_match) {
$where_id = 'topic_id';
@ -1915,10 +1900,10 @@ function pad_with_space($str)
function create_magnet($infohash, $auth_key, $logged_in)
{
global $bb_cfg, $_GET, $images;
global $_GET, $images;
$passkey_url = ((!$logged_in || isset($_GET['no_passkey'])) && $bb_cfg['bt_tor_browse_only_reg']) ? '' : "?{$bb_cfg['passkey_key']}=$auth_key";
return '<a href="magnet:?xt=urn:btih:' . bin2hex($infohash) . '&tr=' . urlencode($bb_cfg['bt_announce_url'] . $passkey_url) . '"><img src="' . $images['icon_magnet'] . '" width="12" height="12" border="0" /></a>';
$passkey_url = ((!$logged_in || isset($_GET['no_passkey'])) && config('tp.bt_tor_browse_only_reg')) ? '' : '?' . config('tp.passkey_key') . "=$auth_key";
return '<a href="magnet:?xt=urn:btih:' . bin2hex($infohash) . '&tr=' . urlencode(config('tp.bt_announce_url') . $passkey_url) . '"><img src="' . $images['icon_magnet'] . '" width="12" height="12" border="0" /></a>';
}
function set_die_append_msg($forum_id = null, $topic_id = null, $group_id = null)
@ -1971,7 +1956,7 @@ function send_pm($user_id, $subject, $message, $poster_id = BOT_UID)
function profile_url($data)
{
global $bb_cfg, $lang, $datastore;
global $lang, $datastore;
if (!$ranks = $datastore->get('ranks')) {
$datastore->update('ranks');
@ -1991,7 +1976,7 @@ function profile_url($data)
$style = 'colorUser';
}
if (!$bb_cfg['color_nick']) {
if (!config('tp.color_nick')) {
$style = '';
}
@ -2009,22 +1994,16 @@ function profile_url($data)
function get_avatar($user_id, $ext_id, $allow_avatar = true, $size = true, $height = '', $width = '')
{
global $bb_cfg;
if ($size) {
// TODO размеры: s, m, l + кеширование
}
$height = !$height ? 'height="' . $height . '"' : '';
$width = !$width ? 'width="' . $width . '"' : '';
$user_avatar = '<img src="' . make_url($bb_cfg['avatars']['display_path'] . $bb_cfg['avatars']['no_avatar']) . '" alt="' . $user_id . '" ' . $height . ' ' . $width . ' />';
$user_avatar = '<img src="' . make_url(config('tp.avatars.display_path') . config('tp.avatars.no_avatar')) . '" alt="' . $user_id . '" ' . $height . ' ' . $width . ' />';
if ($user_id == BOT_UID && $bb_cfg['avatars']['bot_avatar']) {
$user_avatar = '<img src="' . make_url($bb_cfg['avatars']['display_path'] . $bb_cfg['avatars']['bot_avatar']) . '" alt="' . $user_id . '" ' . $height . ' ' . $width . ' />';
if ($user_id == BOT_UID && config('tp.avatars.bot_avatar')) {
$user_avatar = '<img src="' . make_url(config('tp.avatars.display_path') . config('tp.avatars.bot_avatar')) . '" alt="' . $user_id . '" ' . $height . ' ' . $width . ' />';
} elseif ($allow_avatar && $ext_id) {
if (file_exists(get_avatar_path($user_id, $ext_id))) {
$user_avatar = '<img src="' . make_url(get_avatar_path($user_id, $ext_id, $bb_cfg['avatars']['display_path'])) . '" alt="' . $user_id . '" ' . $height . ' ' . $width . ' />';
$user_avatar = '<img src="' . make_url(get_avatar_path($user_id, $ext_id, config('tp.avatars.display_path'))) . '" alt="' . $user_id . '" ' . $height . ' ' . $width . ' />';
}
}
@ -2033,9 +2012,9 @@ function get_avatar($user_id, $ext_id, $allow_avatar = true, $size = true, $heig
function gender_image($gender)
{
global $bb_cfg, $lang, $images;
global $lang, $images;
if (!$bb_cfg['gender']) {
if (!config('tp.gender')) {
$user_gender = '';
return $user_gender;
}
@ -2057,9 +2036,9 @@ function gender_image($gender)
function is_gold($type)
{
global $lang, $bb_cfg;
global $lang;
if (!$bb_cfg['tracker']['gold_silver_enabled']) {
if (!config('tracker.gold_silver_enabled')) {
$is_gold = '';
return $is_gold;
}
@ -2124,11 +2103,11 @@ function hash_search($hash)
*/
function bb_captcha($mode, $callback = '')
{
global $bb_cfg, $lang;
global $lang;
$secret = $bb_cfg['captcha']['secret_key'];
$public = $bb_cfg['captcha']['public_key'];
$cp_theme = $bb_cfg['captcha']['theme'];
$secret = config('tp.captcha.secret_key');
$public = config('tp.captcha.public_key');
$cp_theme = config('tp.captcha.theme');
if (!$public && !$secret) {
bb_die($lang['CAPTCHA_SETTINGS']);

View file

@ -646,7 +646,7 @@ function post_delete($mode_or_post_id, $user_id = null, $exclude_first = true)
function user_delete($user_id, $delete_posts = false)
{
global $bb_cfg, $log_action;
global $log_action;
if (!$user_csv = get_id_csv($user_id)) {
return false;
@ -728,7 +728,7 @@ function user_delete($user_id, $delete_posts = false)
// Delete user feed
foreach (explode(',', $user_csv) as $user_id) {
$file_path = $bb_cfg['atom']['path'] . '/u/' . floor($user_id / 5000) . '/' . ($user_id % 100) . '/' . $user_id . '.atom';
$file_path = config('tp.atom.path') . '/u/' . floor($user_id / 5000) . '/' . ($user_id % 100) . '/' . $user_id . '.atom';
@unlink($file_path);
}
}

View file

@ -9,7 +9,7 @@
function run_jobs($jobs)
{
global $bb_cfg, $datastore;
global $datastore;
define('IN_CRON', true);

View file

@ -16,8 +16,7 @@ if (!defined('BB_ROOT')) {
function update_forum_feed($forum_id, $forum_data)
{
global $bb_cfg;
$file_path = $bb_cfg['atom']['path'] . '/f/' . $forum_id . '.atom';
$file_path = config('tp.atom.path') . '/f/' . $forum_id . '.atom';
$select_tor_sql = $join_tor_sql = '';
if ($forum_id == 0) {
$forum_data['forum_name'] = 'Общая по всем разделам';
@ -69,7 +68,7 @@ function update_forum_feed($forum_id, $forum_data)
}
}
if (isset($topic['tor_status'])) {
if (isset($bb_cfg['tor_frozen'][$topic['tor_status']])) {
if (null !== config('tp.tor_frozen.' . $topic['tor_status'])) {
continue;
}
}
@ -88,8 +87,7 @@ function update_forum_feed($forum_id, $forum_data)
function update_user_feed($user_id, $username)
{
global $bb_cfg;
$file_path = $bb_cfg['atom']['path'] . '/u/' . floor($user_id / 5000) . '/' . ($user_id % 100) . '/' . $user_id . '.atom';
$file_path = config('tp.atom.path') . '/u/' . floor($user_id / 5000) . '/' . ($user_id % 100) . '/' . $user_id . '.atom';
$sql = "
SELECT
t.topic_id, t.topic_title, t.topic_status,
@ -115,7 +113,7 @@ function update_user_feed($user_id, $username)
}
}
if (isset($topic['tor_status'])) {
if (isset($bb_cfg['tor_frozen'][$topic['tor_status']])) {
if (null !== config('tp.tor_frozen.' . $topic['tor_status'])) {
continue;
}
}
@ -134,7 +132,6 @@ function update_user_feed($user_id, $username)
function create_atom($file_path, $mode, $id, $title, $topics)
{
global $bb_cfg;
$dir = dirname($file_path);
if (!file_exists($dir)) {
if (!bb_mkdir($dir)) {
@ -152,11 +149,11 @@ function create_atom($file_path, $mode, $id, $title, $topics)
}
$atom = "";
$atom .= "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
$atom .= "<feed xmlns=\"http://www.w3.org/2005/Atom\" xml:base=\"http://" . $bb_cfg['server_name'] . $bb_cfg['script_path'] . "\">\n";
$atom .= "<feed xmlns=\"http://www.w3.org/2005/Atom\" xml:base=\"http://" . config('tp.server_name') . config('tp.script_path') . "\">\n";
$atom .= "<title>$title</title>\n";
$atom .= "<updated>" . $date . "T$time+00:00</updated>\n";
$atom .= "<id>tag:rto.feed,2000:/$mode/$id</id>\n";
$atom .= "<link href=\"http://" . $bb_cfg['server_name'] . $bb_cfg['script_path'] . "\" />\n";
$atom .= "<link href=\"http://" . config('tp.server_name') . config('tp.script_path') . "\" />\n";
foreach ($topics as $topic) {
$topic_id = $topic['topic_id'];
$tor_size = '';

View file

@ -16,7 +16,7 @@ if (!defined('BB_ROOT')) {
//
function prepare_post(&$mode, &$post_data, &$error_msg, &$username, &$subject, &$message)
{
global $bb_cfg, $user, $userdata, $lang;
global $user, $userdata, $lang;
// Check username
if (!empty($username)) {
@ -47,10 +47,10 @@ function prepare_post(&$mode, &$post_data, &$error_msg, &$username, &$subject, &
}
// Check smilies limit
if ($bb_cfg['max_smilies']) {
$count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="' . $bb_cfg['smilies_path']);
if ($count_smilies > $bb_cfg['max_smilies']) {
$to_many_smilies = sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies']);
if (config('tp.max_smilies')) {
$count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="' . config('tp.smilies_path'));
if ($count_smilies > config('tp.max_smilies')) {
$to_many_smilies = sprintf($lang['MAX_SMILIES_PER_POST'], config('tp.max_smilies'));
$error_msg .= (!empty($error_msg)) ? '<br />' . $to_many_smilies : $to_many_smilies;
}
}
@ -65,7 +65,7 @@ function prepare_post(&$mode, &$post_data, &$error_msg, &$username, &$subject, &
//
function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$topic_type, $post_username, $post_subject, $post_message, $update_post_time, $poster_rg_id, $attach_rg_sig)
{
global $userdata, $post_info, $is_auth, $bb_cfg, $lang, $datastore;
global $userdata, $post_info, $is_auth, $lang, $datastore;
$current_time = TIMENOW;
@ -78,7 +78,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
if ($row = OLD_DB()->fetch_row($sql) && $row['last_post_time']) {
if ($userdata['user_level'] == USER) {
if (TIMENOW - $row['last_post_time'] < $bb_cfg['flood_interval']) {
if (TIMENOW - $row['last_post_time'] < config('tp.flood_interval')) {
bb_die($lang['FLOOD_ERROR']);
}
}
@ -172,17 +172,17 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
));
//Обновление кеша новостей на главной
if ($bb_cfg['show_latest_news']) {
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
if (isset($news_forums[$forum_id]) && $bb_cfg['show_latest_news'] && $mode == 'newtopic') {
if (config('tp.show_latest_news')) {
$news_forums = array_flip(explode(',', config('tp.latest_news_forum_id')));
if (isset($news_forums[$forum_id]) && config('tp.show_latest_news') && $mode == 'newtopic') {
$datastore->enqueue('latest_news');
$datastore->update('latest_news');
}
}
if ($bb_cfg['show_network_news']) {
$net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
if (isset($net_forums[$forum_id]) && $bb_cfg['show_network_news'] && $mode == 'newtopic') {
if (config('tp.show_network_news')) {
$net_forums = array_flip(explode(',', config('tp.network_news_forum_id')));
if (isset($net_forums[$forum_id]) && config('tp.show_network_news') && $mode == 'newtopic') {
$datastore->enqueue('network_news');
$datastore->update('network_news');
}
@ -287,9 +287,9 @@ function delete_post($mode, $post_data, &$message, &$meta, $forum_id, $topic_id,
//
function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$notify_user)
{
global $bb_cfg, $lang, $userdata;
global $lang, $userdata;
if (!$bb_cfg['topic_notify_enabled']) {
if (!config('tp.topic_notify_enabled')) {
return;
}
@ -329,14 +329,14 @@ function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topi
/** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\Emailer();
$emailer->set_from([$bb_cfg['board_email'] => $bb_cfg['sitename']]);
$emailer->set_from([config('tp.board_email') => config('tp.sitename')]);
$emailer->set_to([$row['user_email'] => $row['username']]);
$emailer->set_subject(sprintf($lang['EMAILER_SUBJECT']['TOPIC_NOTIFY'], $topic_title));
$emailer->set_template('topic_notify', $row['user_lang']);
$emailer->assign_vars(array(
'TOPIC_TITLE' => html_entity_decode($topic_title),
'SITENAME' => $bb_cfg['sitename'],
'SITENAME' => config('tp.sitename'),
'USERNAME' => $row['username'],
'U_TOPIC' => $u_topic,
'U_STOP_WATCHING_TOPIC' => $unwatch_topic,
@ -445,7 +445,7 @@ function insert_post($mode, $topic_id, $forum_id = '', $old_forum_id = '', $new_
function topic_review($topic_id)
{
global $bb_cfg, $template;
global $template;
// Fetch posts data
$review_posts = OLD_DB()->fetch_rowset("
@ -458,7 +458,7 @@ function topic_review($topic_id)
LEFT JOIN " . BB_POSTS_HTML . " h ON(h.post_id = p.post_id)
WHERE p.topic_id = " . (int)$topic_id . "
ORDER BY p.post_time DESC
LIMIT " . $bb_cfg['posts_per_page'] . "
LIMIT " . config('tp.posts_per_page') . "
");
// Topic posts block
@ -467,7 +467,7 @@ function topic_review($topic_id)
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
'POSTER' => profile_url($post),
'POSTER_NAME_JS' => addslashes($post['username']),
'POST_DATE' => bb_date($post['post_time'], $bb_cfg['post_date_format']),
'POST_DATE' => bb_date($post['post_time'], config('tp.post_date_format')),
'MESSAGE' => get_parsed_post($post),
));
}

View file

@ -57,11 +57,9 @@ function tz_select($default, $select_name = 'timezone')
//
function templates_select($default_style, $select_name = 'tpl_name')
{
global $bb_cfg;
$templates_select = '<select name="' . $select_name . '">';
$x = 0;
foreach ($bb_cfg['templates'] as $folder => $name) {
foreach (config('tp.templates') as $folder => $name) {
$selected = '';
if ($folder == $default_style) {
$selected = ' selected="selected"';
@ -70,5 +68,6 @@ function templates_select($default_style, $select_name = 'tpl_name')
$x++;
}
$templates_select .= '</select>';
return ($x > 1) ? $templates_select : reset($bb_cfg['templates']);
$templates = config('tp.templates');
return ($x > 1) ? $templates_select : reset($templates);
}

View file

@ -65,7 +65,7 @@ function torrent_auth_check($forum_id, $poster_id)
function tracker_unregister($attach_id, $mode = '')
{
global $lang, $bb_cfg;
global $lang;
$attach_id = (int)$attach_id;
$post_id = $topic_id = $forum_id = $info_hash = null;
@ -99,7 +99,7 @@ function tracker_unregister($attach_id, $mode = '')
}
// Unset DL-Type for topic
if ($bb_cfg['bt_unset_dltype_on_tor_unreg'] && $topic_id) {
if (config('tp.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";
if (!$result = OLD_DB()->sql_query($sql)) {
@ -115,7 +115,7 @@ function tracker_unregister($attach_id, $mode = '')
}
// Ocelot
if ($bb_cfg['ocelot']['enabled']) {
if (config('tp.ocelot.enabled')) {
if ($row = OLD_DB()->fetch_row("SELECT info_hash FROM " . BB_BT_TORRENTS . " WHERE attach_id = $attach_id LIMIT 1")) {
$info_hash = $row['info_hash'];
}
@ -196,7 +196,7 @@ function change_tor_status($attach_id, $new_tor_status)
// Set gold/silver type for torrent
function change_tor_type($attach_id, $tor_status_gold)
{
global $topic_id, $lang, $bb_cfg;
global $topic_id, $lang;
if (!$torrent = get_torrent_info($attach_id)) {
bb_die($lang['TOR_NOT_FOUND']);
@ -213,7 +213,7 @@ function change_tor_type($attach_id, $tor_status_gold)
OLD_DB()->query("UPDATE " . BB_BT_TORRENTS . " SET tor_type = $tor_status_gold WHERE topic_id = $topic_id");
// Ocelot
if ($bb_cfg['ocelot']['enabled']) {
if (config('tp.ocelot.enabled')) {
if ($row = OLD_DB()->fetch_row("SELECT info_hash FROM " . BB_BT_TORRENTS . " WHERE topic_id = $topic_id LIMIT 1")) {
$info_hash = $row['info_hash'];
}
@ -223,7 +223,7 @@ function change_tor_type($attach_id, $tor_status_gold)
function tracker_register($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVED, $reg_time = TIMENOW)
{
global $bb_cfg, $lang, $reg_mode;
global $lang, $reg_mode;
$attach_id = (int)$attach_id;
$reg_mode = $mode;
@ -269,18 +269,18 @@ function tracker_register($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVED
return torrent_error_exit('This is not a bencoded file');
}
if ($bb_cfg['bt_disable_dht']) {
if (config('tp.bt_disable_dht')) {
$tor['info']['private'] = (int)1;
$fp = fopen($filename, 'wb+');
fwrite($fp, \Rych\Bencode\Bencode::encode($tor));
fclose($fp);
}
if ($bb_cfg['bt_check_announce_url']) {
if (config('tp.bt_check_announce_url')) {
include INC_DIR . '/torrent_announce_urls.php';
$ann = (@$tor['announce']) ? $tor['announce'] : '';
$announce_urls['main_url'] = $bb_cfg['bt_announce_url'];
$announce_urls['main_url'] = config('tp.bt_announce_url');
if (!$ann || !in_array($ann, $announce_urls)) {
$msg = sprintf($lang['INVALID_ANN_URL'], htmlspecialchars($ann), $announce_urls['main_url']);
@ -299,7 +299,7 @@ function tracker_register($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVED
$info_hash_md5 = md5($info_hash);
// Ocelot
if ($bb_cfg['ocelot']['enabled']) {
if (config('tp.ocelot.enabled')) {
ocelot_update_tracker('add_torrent', array('info_hash' => rawurlencode($info_hash), 'id' => $topic_id, 'freetorrent' => 0));
}
@ -347,7 +347,7 @@ function tracker_register($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVED
}
// set DL-Type for topic
if ($bb_cfg['bt_set_dltype_on_tor_reg']) {
if (config('tp.bt_set_dltype_on_tor_reg')) {
$sql = 'UPDATE ' . BB_TOPICS . ' SET topic_dl_type = ' . TOPIC_DL_TYPE_DL . " WHERE topic_id = $topic_id";
if (!$result = OLD_DB()->sql_query($sql)) {
@ -355,7 +355,7 @@ function tracker_register($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVED
}
}
if ($bb_cfg['tracker']['tor_topic_up']) {
if (config('tracker.tor_topic_up')) {
OLD_DB()->query("UPDATE " . BB_TOPICS . " SET topic_last_post_time = GREATEST(topic_last_post_time, " . (TIMENOW - 3 * 86400) . ") WHERE topic_id = $topic_id");
}
@ -370,9 +370,9 @@ function tracker_register($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVED
function send_torrent_with_passkey($filename)
{
global $attachment, $auth_pages, $userdata, $bb_cfg, $lang;
global $attachment, $auth_pages, $userdata, $lang;
if (!$bb_cfg['bt_add_auth_key'] || $attachment['extension'] !== TORRENT_EXT || !$size = @filesize($filename)) {
if (!config('tp.bt_add_auth_key') || $attachment['extension'] !== TORRENT_EXT || !$size = @filesize($filename)) {
return;
}
@ -380,8 +380,8 @@ function send_torrent_with_passkey($filename)
$user_id = $userdata['user_id'];
$attach_id = $attachment['attach_id'];
if (!$passkey_key = $bb_cfg['passkey_key']) {
bb_die('Could not add passkey (wrong config $bb_cfg[\'passkey_key\'])');
if (!$passkey_key = config('tp.passkey_key')) {
bb_die('Could not add passkey (wrong config $cfg[\'passkey_key\'])');
}
// Get $post_id & $poster_id
@ -416,13 +416,13 @@ function send_torrent_with_passkey($filename)
if (!$passkey_val) {
if (!$passkey_val = generate_passkey($user_id)) {
bb_simple_die('Could not generate passkey');
} elseif ($bb_cfg['ocelot']['enabled']) {
} elseif (config('tp.ocelot.enabled')) {
ocelot_update_tracker('add_user', array('id' => $user_id, 'passkey' => $passkey_val));
}
}
// Ratio limits
$min_ratio = $bb_cfg['bt_min_ratio_allow_dl_tor'];
$min_ratio = config('tp.bt_min_ratio_allow_dl_tor');
if ($min_ratio && $user_id != $poster_id && ($user_ratio = get_bt_ratio($bt_userdata)) !== null) {
if ($user_ratio < $min_ratio && $post_id) {
@ -441,43 +441,46 @@ function send_torrent_with_passkey($filename)
}
// Announce URL
$ann_url = $bb_cfg['bt_announce_url'];
$ann_url = config('tp.bt_announce_url');
$file_contents = file_get_contents($filename);
if (!$tor = \Rych\Bencode\Bencode::decode($file_contents)) {
bb_die('This is not a bencoded file');
}
$announce = $bb_cfg['ocelot']['enabled'] ? (string)($bb_cfg['ocelot']['url'] . $passkey_val . "/announce") : (string)($ann_url . "?$passkey_key=$passkey_val");
$announce = config('tp.ocelot.enabled') ? (string)(config('tp.ocelot.url') . $passkey_val . "/announce") : (string)($ann_url . "?$passkey_key=$passkey_val");
// Replace original announce url with tracker default
if ($bb_cfg['bt_replace_ann_url'] || !isset($tor['announce'])) {
if (config('tp.bt_replace_ann_url') || !isset($tor['announce'])) {
$tor['announce'] = $announce;
}
// Delete all additional urls
if ($bb_cfg['bt_del_addit_ann_urls'] || $bb_cfg['bt_disable_dht']) {
if (config('tp.bt_del_addit_ann_urls') || config('tp.bt_disable_dht')) {
unset($tor['announce-list']);
} elseif (isset($tor['announce-list'])) {
$tor['announce-list'] = array_merge($tor['announce-list'], array(array($announce)));
}
// Add retracker
if (isset($bb_cfg['tracker']['retracker']) && $bb_cfg['tracker']['retracker']) {
if (config('tracker.retracker')) {
if (bf($userdata['user_opt'], 'user_opt', 'user_retracker') || IS_GUEST) {
if (!isset($tor['announce-list'])) {
$tor['announce-list'] = array(
array($announce),
array($bb_cfg['tracker']['retracker_host'])
);
$tor['announce-list'] = [
[$announce],
[config('tracker.retracker_host')]
];
} else {
$tor['announce-list'] = array_merge($tor['announce-list'], array(array($bb_cfg['tracker']['retracker_host'])));
$tor['announce-list'] = array_merge(
$tor['announce-list'],
[[config('tracker.retracker_host')]]
);
}
}
}
// Add publisher & topic url
$publisher_name = $bb_cfg['server_name'];
$publisher_name = config('tp.server_name');
$publisher_url = make_url(TOPIC_URL . $topic_id);
$tor['publisher'] = (string)$publisher_name;
@ -491,7 +494,7 @@ function send_torrent_with_passkey($filename)
// Send torrent
$output = \Rych\Bencode\Bencode::encode($tor);
$dl_fname = '[' . $bb_cfg['server_name'] . '].t' . $topic_id . '.torrent';
$dl_fname = '[' . config('tp.server_name') . '].t' . $topic_id . '.torrent';
if (!empty($_COOKIE['explain'])) {
$out = "attach path: $filename<br /><br />";
@ -508,7 +511,7 @@ function send_torrent_with_passkey($filename)
function generate_passkey($user_id, $force_generate = false)
{
global $bb_cfg, $lang, $sql;
global $lang, $sql;
$user_id = (int)$user_id;
@ -545,7 +548,7 @@ function generate_passkey($user_id, $force_generate = false)
if (OLD_DB()->affected_rows() == 1) {
// Ocelot
if ($bb_cfg['ocelot']['enabled']) {
if (config('tp.ocelot.enabled')) {
ocelot_update_tracker('change_passkey', array('oldpasskey' => $old_passkey, 'newpasskey' => $passkey_val));
}
return $passkey_val;
@ -599,9 +602,7 @@ function torrent_error_exit($message)
function ocelot_update_tracker($action, $updates)
{
global $bb_cfg;
$get = $bb_cfg['ocelot']['secret'] . "/update?action=$action";
$get = config('tp.ocelot.secret') . "/update?action=$action";
foreach ($updates as $key => $value) {
$get .= "&$key=$value";
@ -615,8 +616,6 @@ function ocelot_update_tracker($action, $updates)
function ocelot_send_request($get, $max_attempts = 1, &$err = false)
{
global $bb_cfg;
$header = "GET /$get HTTP/1.1\r\nConnection: Close\r\n\r\n";
$attempts = $success = $response = 0;
$start_time = microtime(true);
@ -624,7 +623,7 @@ function ocelot_send_request($get, $max_attempts = 1, &$err = false)
while (!$success && $attempts++ < $max_attempts) {
// Send request
$file = fsockopen($bb_cfg['ocelot']['host'], $bb_cfg['ocelot']['port'], $error_num, $error_string);
$file = fsockopen(config('tp.ocelot.host'), config('tp.ocelot.port'), $error_num, $error_string);
if ($file) {
if (fwrite($file, $header) === false) {
$err = "Failed to fwrite()";

View file

@ -47,9 +47,7 @@ function send_page($contents)
*/
function compress_output($contents)
{
global $bb_cfg;
if ($bb_cfg['gzip_compress'] && GZIP_OUTPUT_ALLOWED && !defined('NO_GZIP')) {
if (config('tp.gzip_compress') && GZIP_OUTPUT_ALLOWED && !defined('NO_GZIP')) {
if (UA_GZIP_SUPPORTED && strlen($contents) > 2000) {
header('Content-Encoding: gzip');
$contents = gzencode($contents, 1);
@ -67,7 +65,7 @@ if (!defined('IN_AJAX')) {
}
// Cookie params
$c = $bb_cfg['cookie_prefix'];
$c = config('tp.cookie_prefix');
define('COOKIE_DATA', $c . 'data');
define('COOKIE_FORUM', $c . 'f');
define('COOKIE_MARK', $c . 'mark_read');
@ -90,8 +88,7 @@ define('COOKIE_MAX_TRACKS', 90);
*/
function bb_setcookie($name, $val, $lifetime = COOKIE_PERSIST, $httponly = false)
{
global $bb_cfg;
return setcookie($name, $val, $lifetime, $bb_cfg['script_path'], $bb_cfg['cookie_domain'], $bb_cfg['cookie_secure'], $httponly);
return setcookie($name, $val, $lifetime, config('tp.script_path'), config('tp.cookie_domain'), config('tp.cookie_secure'), $httponly);
}
/**
@ -285,11 +282,11 @@ define('CAT_URL', 'index.php?c=');
define('DOWNLOAD_URL', 'dl.php?id=');
define('FORUM_URL', 'viewforum.php?f=');
define('GROUP_URL', 'group.php?g=');
define('LOGIN_URL', $bb_cfg['login_url']);
define('LOGIN_URL', config('tp.login_url'));
define('MODCP_URL', 'modcp.php?f=');
define('PM_URL', $bb_cfg['pm_url']);
define('PM_URL', config('tp.pm_url'));
define('POST_URL', 'viewtopic.php?p=');
define('POSTING_URL', $bb_cfg['posting_url']);
define('POSTING_URL', config('tp.posting_url'));
define('PROFILE_URL', 'profile.php?mode=viewprofile&amp;u=');
define('BONUS_URL', 'profile.php?mode=bonus');
define('TOPIC_URL', 'viewtopic.php?t=');
@ -396,8 +393,6 @@ if (DBG_USER) {
require INC_DIR . '/functions_dev.php';
}
$bb_cfg = array_merge(bb_get_config(BB_CONFIG), $bb_cfg);
$log_action = new TorrentPier\Legacy\LogAction();
$html = new TorrentPier\Legacy\Common\Html();
$user = new TorrentPier\Legacy\Common\User();
@ -407,8 +402,8 @@ $userdata =& $user->data;
/**
* Cron
*/
if ((empty($_POST) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !file_exists(CRON_RUNNING) && ($bb_cfg['cron_enabled'] || defined('START_CRON'))) || defined('FORCE_CRON')) {
if (TIMENOW - $bb_cfg['cron_last_check'] > $bb_cfg['cron_check_interval']) {
if ((empty($_POST) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !file_exists(CRON_RUNNING) && (config('tp.cron_enabled') || defined('START_CRON'))) || defined('FORCE_CRON')) {
if (TIMENOW - config('tp.cron_last_check') > config('tp.cron_check_interval')) {
/** Update cron_last_check */
bb_update_config(['cron_last_check' => TIMENOW + 10]);
@ -448,9 +443,9 @@ if ((empty($_POST) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !file_exist
/**
* Exit if board is disabled via trigger
*/
if (($bb_cfg['board_disable'] || file_exists(BB_DISABLED)) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !defined('IN_LOGIN')) {
if ((config('tp.board_disable') || file_exists(BB_DISABLED)) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !defined('IN_LOGIN')) {
header('HTTP/1.0 503 Service Unavailable');
if ($bb_cfg['board_disable']) {
if (config('tp.board_disable')) {
// admin lock
send_no_cache_headers();
bb_die('BOARD_DISABLE');

View file

@ -116,7 +116,7 @@ if (!$online['userlist']) {
$total_online = $logged_online + $guests_online;
if ($total_online > $bb_cfg['record_online_users']) {
if ($total_online > config('tp.record_online_users')) {
bb_update_config(array(
'record_online_users' => $total_online,
'record_online_date' => TIMENOW,

View file

@ -11,7 +11,7 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
global $bb_cfg, $userdata, $template, $DBS, $lang;
global $userdata, $template, $DBS, $lang;
if (!empty($template)) {
$template->assign_vars(array(
@ -27,15 +27,15 @@ if (!empty($template)) {
$show_dbg_info = (DBG_USER && IS_ADMIN && !(isset($_GET['pane']) && $_GET['pane'] == 'left'));
if (!$bb_cfg['gzip_compress']) {
if (!config('tp.gzip_compress')) {
flush();
}
if ($show_dbg_info) {
$gen_time = utime() - TIMESTART;
$gen_time_txt = sprintf('%.3f', $gen_time);
$gzip_text = (UA_GZIP_SUPPORTED) ? 'GZIP ' : '<s>GZIP</s> ';
$gzip_text .= ($bb_cfg['gzip_compress']) ? $lang['ON'] : $lang['OFF'];
$gzip_text = UA_GZIP_SUPPORTED ? 'GZIP ' : '<s>GZIP</s> ';
$gzip_text .= config('tp.gzip_compress') ? $lang['ON'] : $lang['OFF'];
$stat = '[&nbsp; ' . $lang['EXECUTION_TIME'] . " $gen_time_txt " . $lang['SEC'];
@ -49,7 +49,7 @@ if ($show_dbg_info) {
$stat .= " &nbsp;|&nbsp; $gzip_text";
$stat .= ' &nbsp;|&nbsp; ' . $lang['MEMORY'];
$stat .= humn_size($bb_cfg['mem_on_start'], 2) . ' / ';
$stat .= humn_size(config('tp.mem_on_start'), 2) . ' / ';
$stat .= humn_size(sys('mem_peak'), 2) . ' / ';
$stat .= humn_size(sys('mem'), 2);
@ -87,7 +87,7 @@ echo '
if (defined('REQUESTED_PAGE') && !defined('DISABLE_CACHING_OUTPUT')) {
if (IS_GUEST === true) {
caching_output(true, 'store', REQUESTED_PAGE . '_guest_' . $bb_cfg['default_lang']);
caching_output(true, 'store', REQUESTED_PAGE . '_guest_' . config('tp.default_lang'));
}
}

View file

@ -16,7 +16,7 @@ if (defined('PAGE_HEADER_SENT')) {
// Parse and show the overall page header
global $page_cfg, $userdata, $user, $ads, $bb_cfg, $template, $lang, $images;
global $page_cfg, $userdata, $user, $ads, $template, $lang, $images;
$logged_in = (int)!empty($userdata['session_logged_in']);
@ -50,7 +50,7 @@ if (defined('SHOW_ONLINE') && SHOW_ONLINE) {
'TOTAL_USERS_ONLINE' => ${$online_list}['stat'],
'LOGGED_IN_USER_LIST' => ${$online_list}['userlist'],
'USERS_ONLINE_COUNTS' => ${$online_list}['cnt'],
'RECORD_USERS' => sprintf($lang['RECORD_ONLINE_USERS'], $bb_cfg['record_online_users'], bb_date($bb_cfg['record_online_date'])),
'RECORD_USERS' => sprintf($lang['RECORD_ONLINE_USERS'], config('tp.record_online_users'), bb_date(config('tp.record_online_date'))),
));
}
@ -121,9 +121,9 @@ $template->assign_vars(array(
'USE_TABLESORTER' => !empty($page_cfg['use_tablesorter']),
'SITENAME' => $bb_cfg['sitename'],
'SITENAME' => config('tp.sitename'),
'U_INDEX' => BB_ROOT . "index.php",
'T_INDEX' => sprintf($lang['FORUM_INDEX'], $bb_cfg['sitename']),
'T_INDEX' => sprintf($lang['FORUM_INDEX'], config('tp.sitename')),
'IS_GUEST' => IS_GUEST,
'IS_USER' => IS_USER,
@ -134,9 +134,9 @@ $template->assign_vars(array(
'FORUM_PATH' => FORUM_PATH,
'FULL_URL' => FULL_URL,
'CURRENT_TIME' => sprintf($lang['CURRENT_TIME'], bb_date(TIMENOW, $bb_cfg['last_visit_date_format'], false)),
'S_TIMEZONE' => preg_replace('/\(.*?\)/', '', sprintf($lang['ALL_TIMES'], $lang['TZ'][str_replace(',', '.', (float)$bb_cfg['board_timezone'])])),
'BOARD_TIMEZONE' => $bb_cfg['board_timezone'],
'CURRENT_TIME' => sprintf($lang['CURRENT_TIME'], bb_date(TIMENOW, config('tp.last_visit_date_format'), false)),
'S_TIMEZONE' => preg_replace('/\(.*?\)/', '', sprintf($lang['ALL_TIMES'], $lang['TZ'][str_replace(',', '.', (float)config('tp.board_timezone'))])),
'BOARD_TIMEZONE' => config('tp.board_timezone'),
'PM_INFO' => $pm_info,
'PRIVMSG_IMG' => $icon_pm,
@ -147,7 +147,7 @@ $template->assign_vars(array(
'THIS_USER' => profile_url($userdata),
'THIS_AVATAR' => get_avatar($userdata['user_id'], $userdata['avatar_ext_id'], !bf($userdata['user_opt'], 'user_opt', 'dis_avatar')),
'SHOW_LOGIN_LINK' => !defined('IN_LOGIN'),
'AUTOLOGIN_DISABLED' => !$bb_cfg['allow_autologin'],
'AUTOLOGIN_DISABLED' => !config('tp.allow_autologin'),
'S_LOGIN_ACTION' => LOGIN_URL,
'U_CUR_DOWNLOADS' => PROFILE_URL . $userdata['user_id'],
@ -163,11 +163,11 @@ $template->assign_vars(array(
'U_REGISTER' => "profile.php?mode=register",
'U_SEARCH' => "search.php",
'U_SEND_PASSWORD' => "profile.php?mode=sendpassword",
'U_TERMS' => $bb_cfg['terms_and_conditions_url'],
'U_TERMS' => config('tp.terms_and_conditions_url'),
'U_TRACKER' => "tracker.php",
'SHOW_SIDEBAR1' => !empty(config('page.show_sidebar1.' . BB_SCRIPT)) || $bb_cfg['show_sidebar1_on_every_page'],
'SHOW_SIDEBAR2' => !empty(config('page.show_sidebar2.' . BB_SCRIPT)) || $bb_cfg['show_sidebar2_on_every_page'],
'SHOW_SIDEBAR1' => !empty(config('page.show_sidebar1.' . BB_SCRIPT)) || config('tp.show_sidebar1_on_every_page'),
'SHOW_SIDEBAR2' => !empty(config('page.show_sidebar2.' . BB_SCRIPT)) || config('tp.show_sidebar2_on_every_page'),
'HTML_AGREEMENT' => LANG_DIR . 'html/user_agreement.html',
'HTML_COPYRIGHT' => LANG_DIR . 'html/copyright_holders.html',
@ -181,11 +181,11 @@ $template->assign_vars(array(
'DOWNLOAD_URL' => BB_ROOT . DOWNLOAD_URL,
'FORUM_URL' => BB_ROOT . FORUM_URL,
'GROUP_URL' => BB_ROOT . GROUP_URL,
'LOGIN_URL' => $bb_cfg['login_url'],
'LOGIN_URL' => config('tp.login_url'),
'NEWEST_URL' => '&amp;view=newest#newest',
'PM_URL' => $bb_cfg['pm_url'],
'PM_URL' => config('tp.pm_url'),
'POST_URL' => BB_ROOT . POST_URL,
'POSTING_URL' => $bb_cfg['posting_url'],
'POSTING_URL' => config('tp.posting_url'),
'PROFILE_URL' => BB_ROOT . PROFILE_URL,
'TOPIC_URL' => BB_ROOT . TOPIC_URL,
@ -206,7 +206,45 @@ $template->assign_vars(array(
'SELECTED' => HTML_SELECTED,
'U_SEARCH_SELF_BY_LAST' => "search.php?uid={$userdata['user_id']}&amp;o=5",
'U_WATCHED_TOPICS' => "profile.php?mode=watch",
'U_WATCHED_TOPICS' => 'profile.php?mode=watch',
/** TODO: конфигурация используемая в шаблонах, избавиться */
'CFG_GS_ENABLED' => config('tracker.gold_silver_enabled'),
'CFG_UAU' => config('tp.user_agreement_url'),
'CFG_CHU' => config('tp.copyright_holders_url'),
'CFG_SHU' => config('tp.search_help_url'),
'CFG_AU' => config('tp.advert_url'),
'CFG_SB_E' => config('tp.seed_bonus_enabled'),
'CFG_USE_AP' => config('tp.use_ajax_posts'),
'CFG_JS_VER' => config('tp.js_ver'),
'CFG_CSS_VER' => config('tp.css_ver'),
'CFG_SCRIPT_PATH' => config('tp.script_path'),
'CFG_COOKIE_DOMAIN' => config('tp.cookie_domain'),
'CFG_COOKIE_PREFIX' => config('tp.cookie_prefix'),
'CFG_COOKIE_SECURE' => config('tp.cookie_secure'),
'CFG_TOR_COMMENT' => config('tp.tor_comment'),
'CFG_AV_MS' => config('tp.avatars.max_size'),
'CFG_AV_UA' => config('tp.avatars.up_allowed'),
'CFG_GA_MS' => config('tp.group_avatars.max_size'),
'CFG_GA_UA' => config('tp.group_avatars.up_allowed'),
'CFG_PM_NE' => config('tp.pm_notify_enabled'),
'CFG_AC_LANG' => config('tp.allow_change.language'),
'CFG_BIRTH_E' => config('tp.birthday_enabled'),
'CFG_GENDER' => config('tp.gender'),
'CFG_EMAIL_E' => config('tp.email.enabled'),
'CFG_REQ_EA' => config('tp.reg_email_activation'),
'CFG_TOR_STATS' => config('tp.tor_stats'),
'CFG_SEARCH_ET' => config('tp.search_engine_type'),
'CFG_TB_ONLY_REG' => config('tp.bt_tor_browse_only_reg'),
'CFG_RTU_HELP' => config('tp.ratio_url_help'),
'CFG_WIT_HELP' => config('tp.what_is_torrent_url_help'),
'CFG_HTD_HELP' => config('tp.how_to_download_url_help'),
'CFG_MAX_PO' => config('tp.max_poll_options'),
'CFG_LOG_DK' => config('tp.log_days_keep'),
'CFG_AJAX_URL' => config('tp.ajax_url'),
'CFG_TP_RD' => config('tp.tp_release_date'),
'CFG_TP_CN' => config('tp.tp_release_codename'),
'CFG_TP_VER' => config('tp.tp_version'),
));
if (!empty(config('page.show_torhelp.' . BB_SCRIPT)) && !empty($userdata['torhelp'])) {
@ -250,6 +288,6 @@ $template->pparse('page_header');
define('PAGE_HEADER_SENT', true);
if (!$bb_cfg['gzip_compress']) {
if (!config('tp.gzip_compress')) {
flush();
}

View file

@ -39,14 +39,12 @@ function cache_get_userdata($id)
function cache_set_userdata($userdata, $force = false)
{
global $bb_cfg;
if (!$userdata || (ignore_cached_userdata() && !$force)) {
return false;
}
$id = ($userdata['user_id'] == GUEST_UID) ? $userdata['session_ip'] : $userdata['session_id'];
return OLD_CACHE('session_cache')->set($id, $userdata, $bb_cfg['session_update_intrv']);
return OLD_CACHE('session_cache')->set($id, $userdata, config('tp.session_update_intrv'));
}
function cache_rm_userdata($userdata)

View file

@ -21,11 +21,11 @@ $dl_users_div_style_overflow = "padding: 6px; height: $dl_users_overflow_div_hei
$template->assign_vars(array('DL_BUTTONS' => false));
$count_mode = ($bb_cfg['bt_dl_list_only_count'] && !(@$_GET['dl'] === 'names'));
$count_mode = (config('tp.bt_dl_list_only_count') && !(@$_GET['dl'] === 'names'));
$dl_topic = ($t_data['topic_dl_type'] == TOPIC_DL_TYPE_DL && !($bb_cfg['bt_dl_list_only_1st_page'] && $start));
$show_dl_list = ($dl_topic && ($bb_cfg['bt_show_dl_list'] || ($bb_cfg['allow_dl_list_names_mode'] && @$_GET['dl'] === 'names')));
$show_dl_buttons = ($dl_topic && $bb_cfg['bt_show_dl_list_buttons']);
$dl_topic = ($t_data['topic_dl_type'] == TOPIC_DL_TYPE_DL && !(config('tp.bt_dl_list_only_1st_page') && $start));
$show_dl_list = ($dl_topic && (config('tp.bt_show_dl_list') || (config('tp.allow_dl_list_names_mode') && @$_GET['dl'] === 'names')));
$show_dl_buttons = ($dl_topic && config('tp.bt_show_dl_list_buttons'));
// link to clear DL-List
$template->assign_vars(array('S_DL_DELETE' => false));
@ -106,10 +106,10 @@ if ($show_dl_list) {
if ($show_dl_buttons) {
$template->assign_vars(array(
'DL_BUTTONS' => true,
'DL_BUT_WILL' => $bb_cfg['bt_show_dl_but_will'],
'DL_BUT_DOWN' => $bb_cfg['bt_show_dl_but_down'],
'DL_BUT_COMPL' => $bb_cfg['bt_show_dl_but_compl'],
'DL_BUT_CANCEL' => $bb_cfg['bt_show_dl_but_cancel'],
'DL_BUT_WILL' => config('tp.bt_show_dl_but_will'),
'DL_BUT_DOWN' => config('tp.bt_show_dl_but_down'),
'DL_BUT_COMPL' => config('tp.bt_show_dl_but_compl'),
'DL_BUT_CANCEL' => config('tp.bt_show_dl_but_cancel'),
));
$dl_hidden_fields = '

View file

@ -14,9 +14,9 @@ if (!defined('BB_ROOT')) {
$user_id = $userdata['user_id'];
$user_points = $userdata['user_points'];
if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['bonus_upload'] && $bb_cfg['bonus_upload_price']) {
$upload_row = unserialize($bb_cfg['bonus_upload']);
$price_row = unserialize($bb_cfg['bonus_upload_price']);
if (config('tp.seed_bonus_enabled') && config('tp.bonus_upload') && config('tp.bonus_upload_price')) {
$upload_row = unserialize(config('tp.bonus_upload'));
$price_row = unserialize(config('tp.bonus_upload_price'));
} else {
bb_die($lang['EXCHANGE_NOT']);
}

View file

@ -12,8 +12,8 @@ if (!defined('BB_ROOT')) {
}
// Is send through board enabled? No, return to index
if (!$bb_cfg['board_email_form']) {
redirectToUrl("index.php");
if (!config('tp.board_email_form')) {
redirectToUrl('index.php');
}
set_die_append_msg();
@ -62,7 +62,7 @@ if ($row = OLD_DB()->fetch_row($sql)) {
$emailer->set_template('profile_send_email', $user_lang);
$emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'],
'SITENAME' => config('tp.sitename'),
'FROM_USERNAME' => $userdata['username'],
'TO_USERNAME' => $username,
'MESSAGE' => $message,

View file

@ -16,7 +16,7 @@ array_deep($_POST, 'trim');
set_die_append_msg();
if (IS_ADMIN) {
$bb_cfg['reg_email_activation'] = false;
config(['tp.reg_email_activation' => false]);
$new_user = (int)request_var('admin', '');
if ($new_user) {
@ -54,16 +54,16 @@ switch ($mode) {
if (!IS_ADMIN) {
// Ограничение по ip
if ($bb_cfg['unique_ip']) {
if (config('tp.unique_ip')) {
if ($users = OLD_DB()->fetch_row("SELECT user_id, username FROM " . BB_USERS . " WHERE user_reg_ip = '" . USER_IP . "' LIMIT 1")) {
bb_die(sprintf($lang['ALREADY_REG_IP'], '<a href="' . PROFILE_URL . $users['user_id'] . '"><b>' . $users['username'] . '</b></a>', $bb_cfg['tech_admin_email']));
bb_die(sprintf($lang['ALREADY_REG_IP'], '<a href="' . PROFILE_URL . $users['user_id'] . '"><b>' . $users['username'] . '</b></a>', config('tp.tech_admin_email')));
}
}
// Отключение регистрации
if ($bb_cfg['new_user_reg_disabled'] || ($bb_cfg['reg_email_activation'] && !config('email.enabled'))) {
if (config('tp.new_user_reg_disabled') || (config('tp.reg_email_activation') && !config('email.enabled'))) {
bb_die($lang['NEW_USER_REG_DISABLED']);
} // Ограничение по времени
elseif ($bb_cfg['new_user_reg_restricted']) {
elseif (config('tp.new_user_reg_restricted')) {
if (in_array(date('G'), array(0, /*1,2,3,4,5,6,7,8,11,12,13,14,15,16,*/
17, 18, 19, 20, 21, 22, 23))) {
bb_die($lang['REGISTERED_IN_TIME']);
@ -86,8 +86,8 @@ switch ($mode) {
'username' => '',
'user_password' => '',
'user_email' => '',
'user_timezone' => $bb_cfg['board_timezone'],
'user_lang' => $bb_cfg['default_lang'],
'user_timezone' => config('tp.board_timezone'),
'user_lang' => config('tp.default_lang'),
'user_opt' => 0,
'avatar_ext_id' => 0,
);
@ -104,7 +104,7 @@ switch ($mode) {
// field => can_edit
$profile_fields = array(
'user_active' => IS_ADMIN,
'username' => (IS_ADMIN || $bb_cfg['allow_namechange']),
'username' => (IS_ADMIN || config('tp.allow_namechange')),
'user_password' => true,
'user_email' => true, // должен быть после user_password
'user_lang' => true,
@ -152,7 +152,7 @@ switch ($mode) {
}
// Captcha
$need_captcha = ($mode == 'register' && !IS_ADMIN && !$bb_cfg['captcha']['disabled']);
$need_captcha = ($mode == 'register' && !IS_ADMIN && !config('tp.captcha.disabled'));
if ($submit) {
if ($need_captcha && !bb_captcha('check')) {
@ -255,7 +255,7 @@ foreach ($profile_fields as $field => $can_edit) {
if (!$errors and $err = validate_email($email)) {
$errors[] = $err;
}
if ($bb_cfg['reg_email_activation']) {
if (config('tp.reg_email_activation')) {
$pr_data['user_active'] = 0;
$db_data['user_active'] = 0;
}
@ -313,10 +313,10 @@ foreach ($profile_fields as $field => $can_edit) {
if (!empty($birthday_date['year'])) {
if (strtotime($user_birthday) >= TIMENOW) {
$errors[] = $lang['WRONG_BIRTHDAY_FORMAT'];
} elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] > $bb_cfg['birthday_max_age']) {
$errors[] = sprintf($lang['BIRTHDAY_TO_HIGH'], $bb_cfg['birthday_max_age']);
} elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] < $bb_cfg['birthday_min_age']) {
$errors[] = sprintf($lang['BIRTHDAY_TO_LOW'], $bb_cfg['birthday_min_age']);
} elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] > config('tp.birthday_max_age')) {
$errors[] = sprintf($lang['BIRTHDAY_TO_HIGH'], config('tp.birthday_max_age'));
} elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] < config('tp.birthday_min_age')) {
$errors[] = sprintf($lang['BIRTHDAY_TO_LOW'], config('tp.birthday_min_age'));
}
}
@ -367,10 +367,10 @@ foreach ($profile_fields as $field => $can_edit) {
delete_avatar($pr_data['user_id'], $pr_data['avatar_ext_id']);
$pr_data['avatar_ext_id'] = 0;
$db_data['avatar_ext_id'] = 0;
} elseif (!empty($_FILES['avatar']['name']) && $bb_cfg['avatars']['up_allowed']) {
} elseif (!empty($_FILES['avatar']['name']) && config('tp.avatars.up_allowed')) {
$upload = new TorrentPier\Legacy\Common\Upload();
if ($upload->init($bb_cfg['avatars'], $_FILES['avatar']) and $upload->store('avatar', $pr_data)) {
if ($upload->init(config('tp.avatars'), $_FILES['avatar']) and $upload->store('avatar', $pr_data)) {
$pr_data['avatar_ext_id'] = $upload->file_ext_id;
$db_data['avatar_ext_id'] = (int)$upload->file_ext_id;
} else {
@ -378,7 +378,7 @@ foreach ($profile_fields as $field => $can_edit) {
}
}
}
$tp_data['AVATARS_MAX_SIZE'] = humn_size($bb_cfg['avatars']['max_size']);
$tp_data['AVATARS_MAX_SIZE'] = humn_size(config('tp.avatars.max_size'));
break;
/**
@ -437,7 +437,7 @@ foreach ($profile_fields as $field => $can_edit) {
if ($submit && $sig != $pr_data['user_sig']) {
$sig = prepare_message($sig);
if (mb_strlen($sig, 'UTF-8') > $bb_cfg['max_sig_chars']) {
if (mb_strlen($sig, 'UTF-8') > config('tp.max_sig_chars')) {
$errors[] = $lang['SIGNATURE_TOO_LONG'];
} elseif (preg_match('#<(a|b|i|u|table|tr|td|img) #i', $sig) || preg_match('#(href|src|target|title)=#i', $sig)) {
$errors[] = $lang['SIGNATURE_ERROR_HTML'];
@ -512,9 +512,9 @@ foreach ($profile_fields as $field => $can_edit) {
$templates = isset($_POST['tpl_name']) ? (string)$_POST['tpl_name'] : $pr_data['tpl_name'];
$templates = htmlCHR($templates);
if ($submit && $templates != $pr_data['tpl_name']) {
$pr_data['tpl_name'] = $bb_cfg['tpl_name'];
$db_data['tpl_name'] = (string)$bb_cfg['tpl_name'];
foreach ($bb_cfg['templates'] as $folder => $name) {
$pr_data['tpl_name'] = config('tp.tpl_name');
$db_data['tpl_name'] = (string)config('tp.tpl_name');
foreach (config('tp.templates') as $folder => $name) {
if ($templates == $folder) {
$pr_data['tpl_name'] = $templates;
$db_data['tpl_name'] = (string)$templates;
@ -538,7 +538,7 @@ if ($submit && !$errors) {
* Создание нового профиля
*/
if ($mode == 'register') {
if ($bb_cfg['reg_email_activation']) {
if (config('tp.reg_email_activation')) {
$user_actkey = make_rand_str(12);
$db_data['user_active'] = 0;
$db_data['user_actkey'] = $user_actkey;
@ -553,7 +553,7 @@ if ($submit && !$errors) {
}
if (!isset($db_data['tpl_name'])) {
$db_data['tpl_name'] = (string)$bb_cfg['tpl_name'];
$db_data['tpl_name'] = (string)config('tp.tpl_name');
}
$sql_args = OLD_DB()->build_array('INSERT', $db_data);
@ -565,27 +565,27 @@ if ($submit && !$errors) {
set_pr_die_append_msg($new_user_id);
$message = $lang['ACCOUNT_ADDED'];
} else {
if ($bb_cfg['reg_email_activation']) {
if (config('tp.reg_email_activation')) {
$message = $lang['ACCOUNT_INACTIVE'];
$email_subject = sprintf($lang['EMAILER_SUBJECT']['USER_WELCOME_INACTIVE'], $bb_cfg['sitename']);
$email_subject = sprintf($lang['EMAILER_SUBJECT']['USER_WELCOME_INACTIVE'], config('tp.sitename'));
$email_template = 'user_welcome_inactive';
} else {
$message = $lang['ACCOUNT_ADDED'];
$email_subject = sprintf($lang['EMAILER_SUBJECT']['USER_WELCOME'], $bb_cfg['sitename']);
$email_subject = sprintf($lang['EMAILER_SUBJECT']['USER_WELCOME'], config('tp.sitename'));
$email_template = 'user_welcome';
}
/** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\Emailer();
$emailer->set_from([$bb_cfg['board_email'] => $bb_cfg['sitename']]);
$emailer->set_from([config('tp.board_email') => config('tp.sitename')]);
$emailer->set_to([$email => $username]);
$emailer->set_subject($email_subject);
$emailer->set_template($email_template, $user_lang);
$emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'],
'WELCOME_MSG' => sprintf($lang['WELCOME_SUBJECT'], $bb_cfg['sitename']),
'SITENAME' => config('tp.sitename'),
'WELCOME_MSG' => sprintf($lang['WELCOME_SUBJECT'], config('tp.sitename')),
'USERNAME' => html_entity_decode($username),
'PASSWORD' => $new_pass,
'U_ACTIVATE' => make_url('profile.php?mode=activate&' . POST_USERS_URL . '=' . $new_user_id . '&act_key=' . $db_data['user_actkey'])
@ -611,14 +611,14 @@ if ($submit && !$errors) {
/** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\Emailer();
$emailer->set_from([$bb_cfg['board_email'] => $bb_cfg['sitename']]);
$emailer->set_from([config('tp.board_email') => config('tp.sitename')]);
$emailer->set_to([$email => $username]);
$emailer->set_subject($subject);
$emailer->set_subject($lang['EMAILER_SUBJECT']['USER_ACTIVATE']);
$emailer->set_template('user_activate', $pr_data['user_lang']);
$emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'],
'SITENAME' => config('tp.sitename'),
'USERNAME' => html_entity_decode($username),
'U_ACTIVATE' => make_url("profile.php?mode=activate&u={$pr_data['user_id']}&act_key=$user_actkey"),
));
@ -674,12 +674,12 @@ $template->assign_vars(array(
'TIMEZONE_SELECT' => tz_select($pr_data['user_timezone'], 'user_timezone'),
'USER_TIMEZONE' => $pr_data['user_timezone'],
'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], $bb_cfg['avatars']['max_width'], $bb_cfg['avatars']['max_height'], (round($bb_cfg['avatars']['max_size'] / 1024))),
'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], config('tp.avatars.max_width'), config('tp.avatars.max_height'), (round(config('tp.avatars.max_size') / 1024))),
'AVATAR_DISALLOWED' => bf($pr_data['user_opt'], 'user_opt', 'dis_avatar'),
'AVATAR_DIS_EXPLAIN' => sprintf($lang['AVATAR_DISABLE'], $bb_cfg['terms_and_conditions_url']),
'AVATAR_DIS_EXPLAIN' => sprintf($lang['AVATAR_DISABLE'], config('tp.terms_and_conditions_url')),
'AVATAR_IMG' => get_avatar($pr_data['user_id'], $pr_data['avatar_ext_id'], !bf($pr_data['user_opt'], 'user_opt', 'dis_avatar')),
'SIGNATURE_EXPLAIN' => sprintf($lang['SIGNATURE_EXPLAIN'], $bb_cfg['max_sig_chars']),
'SIGNATURE_EXPLAIN' => sprintf($lang['SIGNATURE_EXPLAIN'], config('tp.max_sig_chars')),
'SIG_DISALLOWED' => bf($pr_data['user_opt'], 'user_opt', 'dis_sig'),
'PR_USER_ID' => $pr_data['user_id'],

View file

@ -17,7 +17,7 @@ if (!config('email.enabled')) {
bb_die($lang['EMAILER_DISABLED']);
}
$need_captcha = ($_GET['mode'] == 'sendpassword' && !IS_ADMIN && !$bb_cfg['captcha']['disabled']);
$need_captcha = ($_GET['mode'] == 'sendpassword' && !IS_ADMIN && !config('tp.captcha.disabled'));
if (isset($_POST['submit'])) {
if ($need_captcha && !bb_captcha('check')) {
@ -50,13 +50,13 @@ if (isset($_POST['submit'])) {
/** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\Emailer();
$emailer->set_from([$bb_cfg['board_email'] => $bb_cfg['sitename']]);
$emailer->set_from([config('tp.board_email') => config('tp.sitename')]);
$emailer->set_to([$row['user_email'] => $username]);
$emailer->set_subject($lang['EMAILER_SUBJECT']['USER_ACTIVATE_PASSWD']);
$emailer->set_template('user_activate_passwd', $row['user_lang']);
$emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'],
'SITENAME' => config('tp.sitename'),
'USERNAME' => $username,
'PASSWORD' => $user_password,
'U_ACTIVATE' => make_url('profile.php?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)

View file

@ -7,7 +7,7 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
if (empty($bb_cfg['topic_notify_enabled'])) {
if (empty(config('tp.topic_notify_enabled'))) {
bb_die($lang['DISABLED']);
}
@ -17,7 +17,7 @@ $tracking_topics = get_tracks('topic');
$user_id = $userdata['user_id'];
$start = isset($_GET['start']) ? abs((int)$_GET['start']) : 0;
$per_page = $bb_cfg['topics_per_page'];
$per_page = config('tp.topics_per_page');
if (isset($_POST['topic_id_list'])) {
$topic_ids = implode(",", $_POST['topic_id_list']);
@ -76,7 +76,7 @@ if ($watch_count > 0) {
'LAST_POST_ID' => $watch[$i]['topic_last_post_id'],
'IS_UNREAD' => $is_unread,
'TOPIC_ICON' => get_topic_icon($watch[$i], $is_unread),
'PAGINATION' => ($watch[$i]['topic_status'] == TOPIC_MOVED) ? '' : build_topic_pagination(TOPIC_URL . $watch[$i]['topic_id'], $watch[$i]['topic_replies'], $bb_cfg['posts_per_page']),
'PAGINATION' => ($watch[$i]['topic_status'] == TOPIC_MOVED) ? '' : build_topic_pagination(TOPIC_URL . $watch[$i]['topic_id'], $watch[$i]['topic_replies'], config('tp.posts_per_page')),
));
}

View file

@ -49,7 +49,7 @@ if (IS_ADMIN) {
}
if (bf($profiledata['user_opt'], 'user_opt', 'user_viewemail') || $profiledata['user_id'] == $userdata['user_id'] || IS_AM) {
$email_uri = ($bb_cfg['board_email_form']) ? 'profile.php?mode=email&amp;' . POST_USERS_URL . '=' . $profiledata['user_id'] : 'mailto:' . $profiledata['user_email'];
$email_uri = config('tp.board_email_form') ? 'profile.php?mode=email&amp;' . POST_USERS_URL . '=' . $profiledata['user_id'] : 'mailto:' . $profiledata['user_email'];
$email = '<a class="editable" href="' . $email_uri . '">' . $profiledata['user_email'] . '</a>';
} else {
$email = '';
@ -61,7 +61,7 @@ if (bf($profiledata['user_opt'], 'user_opt', 'user_viewemail') || $profiledata['
$profile_user_id = ($profiledata['user_id'] == $userdata['user_id']);
$signature = ($bb_cfg['allow_sig'] && $profiledata['user_sig']) ? $profiledata['user_sig'] : '';
$signature = (config('tp.allow_sig') && $profiledata['user_sig']) ? $profiledata['user_sig'] : '';
if (bf($profiledata['user_opt'], 'user_opt', 'dis_sig')) {
if ($profile_user_id) {
@ -97,9 +97,9 @@ $template->assign_vars(array(
'SKYPE' => $profiledata['user_skype'],
'TWITTER' => $profiledata['user_twitter'],
'USER_POINTS' => $profiledata['user_points'],
'GENDER' => ($bb_cfg['gender']) ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '',
'BIRTHDAY' => ($bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00') ? $profiledata['user_birthday'] : '',
'AGE' => ($bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00') ? birthday_age($profiledata['user_birthday']) : '',
'GENDER' => config('tp.gender') ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '',
'BIRTHDAY' => (config('tp.birthday_enabled') && $profiledata['user_birthday'] != '0000-00-00') ? $profiledata['user_birthday'] : '',
'AGE' => (config('tp.birthday_enabled') && $profiledata['user_birthday'] != '0000-00-00') ? birthday_age($profiledata['user_birthday']) : '',
'L_VIEWING_PROFILE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),
'L_MY_PROFILE' => sprintf($lang['VIEWING_MY_PROFILE'], 'profile.php?mode=editprofile'),

View file

@ -1,4 +1,4 @@
<div id="infobox-body">
<h2 class="bold">Advertising on our site</h2>
<p>For advertising please contact: <strong><a href="mailto:<?= $bb_cfg['adv_email']; ?>" class="gen"><?= $bb_cfg['adv_email']; ?></a></strong></p>
<p>For advertising please contact: <strong><a href="mailto:<?= config('tp.adv_email'); ?>" class="gen"><?= config('tp.adv_email'); ?></a></strong></p>
</div><!--/infobox-body-->

View file

@ -22,11 +22,11 @@ which indicated to us the following information:</p>
<p>After that in 48 hours, we will remove interesting you links from the site.</p>
<p class="bold">Our email: <strong><a href="mailto:<?= $bb_cfg['abuse_email']; ?>" class="gen"><?= $bb_cfg['abuse_email']; ?></a></strong></p>
<p class="bold">Our email: <strong><a href="mailto:<?= config('tp.abuse_email'); ?>" class="gen"><?= config('tp.abuse_email'); ?></a></strong></p>
<p>WARNING!</p>
<p>a) We reserve the right to publish on the site of any information sent to us by mail <strong><a href="mailto:<?= $bb_cfg['abuse_email']; ?>" class="gen"><?= $bb_cfg['abuse_email']; ?></a></strong></p>
<p>a) We reserve the right to publish on the site of any information sent to us by mail <strong><a href="mailto:<?= config('tp.abuse_email'); ?>" class="gen"><?= config('tp.abuse_email'); ?></a></strong></p>
<p>b) We have no control over the actions of users who may be re-post links to information, which is the object of your copyright. Any information the forum, place automatically, without any control from any quarter whatsoever, which corresponds to the generally accepted international practice of placing information on the Internet. However, in any case, we consider all your queries regarding the reference to the information that violates your rights.</p>

View file

@ -2276,7 +2276,7 @@ $lang['TRACKER_CFG_TITLE'] = 'Tracker';
$lang['FORUM_CFG_TITLE'] = 'Forum settings';
$lang['TRACKER_SETTINGS'] = 'Tracker settings';
$lang['CHANGES_DISABLED'] = 'Changes disabled (see <b>$bb_cfg[\'tracker\']</b> in config.php)';
$lang['CHANGES_DISABLED'] = 'Changes disabled (see <b>config/tracker.php</b>)';
$lang['OFF_TRACKER'] = 'Disable tracker';
$lang['OFF_REASON'] = 'Disable reason';

View file

@ -1,4 +1,4 @@
<div id="infobox-body">
<h2 class="bold">Advertising on our site</h2>
<p>For advertising please contact: <strong><a href="mailto:<?= $bb_cfg['adv_email']; ?>" class="gen"><?= $bb_cfg['adv_email']; ?></a></strong></p>
<p>For advertising please contact: <strong><a href="mailto:<?= config('tp.adv_email'); ?>" class="gen"><?= config('tp.adv_email'); ?></a></strong></p>
</div><!--/infobox-body-->

View file

@ -22,11 +22,11 @@ which indicated to us the following information:</p>
<p>After that in 48 hours, we will remove interesting you links from the site.</p>
<p class="bold">Our email: <strong><a href="mailto:<?= $bb_cfg['abuse_email']; ?>" class="gen"><?= $bb_cfg['abuse_email']; ?></a></strong></p>
<p class="bold">Our email: <strong><a href="mailto:<?= config('tp.abuse_email'); ?>" class="gen"><?= config('tp.abuse_email'); ?></a></strong></p>
<p>WARNING!</p>
<p>a) We reserve the right to publish on the site of any information sent to us by mail <strong><a href="mailto:<?= $bb_cfg['abuse_email']; ?>" class="gen"><?= $bb_cfg['abuse_email']; ?></a></strong></p>
<p>a) We reserve the right to publish on the site of any information sent to us by mail <strong><a href="mailto:<?= config('tp.abuse_email'); ?>" class="gen"><?= config('tp.abuse_email'); ?></a></strong></p>
<p>b) We have no control over the actions of users who may be re-post links to information, which is the object of your copyright. Any information the forum, place automatically, without any control from any quarter whatsoever, which corresponds to the generally accepted international practice of placing information on the Internet. However, in any case, we consider all your queries regarding the reference to the information that violates your rights.</p>

View file

@ -2260,7 +2260,7 @@ $lang['TRACKER_CFG_TITLE'] = 'Tracker';
$lang['FORUM_CFG_TITLE'] = 'Forum settings';
$lang['TRACKER_SETTINGS'] = 'Tracker settings';
$lang['CHANGES_DISABLED'] = 'Changes disabled (see <b>$bb_cfg[\'tracker\']</b> in config.php)';
$lang['CHANGES_DISABLED'] = 'Changes disabled (see <b>config/tracker.php</b>)';
$lang['OFF_TRACKER'] = 'Disable tracker';
$lang['OFF_REASON'] = 'Disable reason';

View file

@ -63,7 +63,7 @@ $login_password = $_POST['login_password'] ?? '';
$need_captcha = false;
if (!$mod_admin_login) {
$need_captcha = OLD_CACHE('bb_login_err')->get('l_err_' . USER_IP);
if ($need_captcha < $bb_cfg['invalid_logins']) {
if ($need_captcha < config('tp.invalid_logins')) {
$need_captcha = false;
}
}
@ -80,13 +80,13 @@ if (isset($_POST['login'])) {
}
// Captcha
if ($need_captcha && !bb_captcha('check') && !$bb_cfg['captcha']['disabled']) {
if ($need_captcha && !bb_captcha('check') && !config('tp.captcha.disabled')) {
$login_errors[] = $lang['CAPTCHA_WRONG'];
}
if (!$login_errors) {
if ($user->login($_POST, $mod_admin_login)) {
$redirect_url = (defined('FIRST_LOGON')) ? $bb_cfg['first_logon_redirect_url'] : $redirect_url;
$redirect_url = defined('FIRST_LOGON') ? config('tp.first_logon_redirect_url') : $redirect_url;
// Обнуление при введении правильно комбинации логин/пароль
OLD_CACHE('bb_login_err')->set('l_err_' . USER_IP, 0, 3600);
@ -100,7 +100,7 @@ if (isset($_POST['login'])) {
if (!$mod_admin_login) {
$login_err = OLD_CACHE('bb_login_err')->get('l_err_' . USER_IP);
if ($login_err > $bb_cfg['invalid_logins']) {
if ($login_err > config('tp.invalid_logins')) {
$need_captcha = true;
}
OLD_CACHE('bb_login_err')->set('l_err_' . USER_IP, ($login_err + 1), 3600);
@ -118,7 +118,7 @@ if (IS_GUEST || $mod_admin_login) {
'ERROR_MESSAGE' => implode('<br />', $login_errors),
'ADMIN_LOGIN' => $mod_admin_login,
'REDIRECT_URL' => htmlCHR($redirect_url),
'CAPTCHA_HTML' => ($need_captcha && !$bb_cfg['captcha']['disabled']) ? bb_captcha('get') : '',
'CAPTCHA_HTML' => ($need_captcha && !config('tp.captcha.disabled')) ? bb_captcha('get') : '',
'PAGE_TITLE' => $lang['LOGIN'],
'S_LOGIN_ACTION' => LOGIN_URL,
));

View file

@ -75,28 +75,28 @@ $template->assign_vars(array(
switch ($mode) {
case 'joined':
$order_by = "user_id $sort_order LIMIT $start, " . $bb_cfg['topics_per_page'];
$order_by = "user_id $sort_order LIMIT $start, " . config('tp.topics_per_page');
break;
case 'username':
$order_by = "username $sort_order LIMIT $start, " . $bb_cfg['topics_per_page'];
$order_by = "username $sort_order LIMIT $start, " . config('tp.topics_per_page');
break;
case 'location':
$order_by = "user_from $sort_order LIMIT $start, " . $bb_cfg['topics_per_page'];
$order_by = "user_from $sort_order LIMIT $start, " . config('tp.topics_per_page');
break;
case 'posts':
$order_by = "user_posts $sort_order LIMIT $start, " . $bb_cfg['topics_per_page'];
$order_by = "user_posts $sort_order LIMIT $start, " . config('tp.topics_per_page');
break;
case 'email':
$order_by = "user_email $sort_order LIMIT $start, " . $bb_cfg['topics_per_page'];
$order_by = "user_email $sort_order LIMIT $start, " . config('tp.topics_per_page');
break;
case 'website':
$order_by = "user_website $sort_order LIMIT $start, " . $bb_cfg['topics_per_page'];
$order_by = "user_website $sort_order LIMIT $start, " . config('tp.topics_per_page');
break;
case 'topten':
$order_by = "user_posts $sort_order LIMIT 10";
break;
default:
$order_by = "user_regdate $sort_order LIMIT $start, " . $bb_cfg['topics_per_page'];
$order_by = "user_regdate $sort_order LIMIT $start, " . config('tp.topics_per_page');
$mode = 'joined';
break;
}
@ -157,12 +157,12 @@ if ($result = OLD_DB()->fetch_rowset($sql)) {
foreach ($result as $i => $row) {
$user_id = $row['user_id'];
$from = $row['user_from'];
$joined = bb_date($row['user_regdate'], $bb_cfg['date_format']);
$joined = bb_date($row['user_regdate'], config('tp.date_format'));
$posts = $row['user_posts'];
$pm = '<a class="txtb" href="' . (PM_URL . "?mode=post&amp;" . POST_USERS_URL . "=$user_id") . '">' . $lang['SEND_PM_TXTB'] . '</a>';
if (bf($row['user_opt'], 'user_opt', 'user_viewemail') || IS_ADMIN) {
$email_uri = $bb_cfg['board_email_form'] ? ("profile.php?mode=email&amp;" . POST_USERS_URL . "=$user_id") : 'mailto:' . $row['user_email'];
$email_uri = config('tp.board_email_form') ? ('profile.php?mode=email&amp;' . POST_USERS_URL . "=$user_id") : 'mailto:' . $row['user_email'];
$email = '<a class="editable" href="' . $email_uri . '">' . $row['user_email'] . '</a>';
} else {
$email = '';
@ -199,7 +199,7 @@ $paginationurl = "memberlist.php?mode=$mode&amp;order=$sort_order&amp;letter=$by
if ($paginationusername) {
$paginationurl .= "&amp;username=$paginationusername";
}
if ($mode != 'topten' || $bb_cfg['topics_per_page'] < 10) {
if ($mode != 'topten' || config('tp.topics_per_page') < 10) {
$sql = "SELECT COUNT(*) AS total FROM " . BB_USERS;
$sql .= ($letter_sql) ? " WHERE $letter_sql" : " WHERE user_id NOT IN(". EXCLUDED_USERS .")";
if (!$result = OLD_DB()->sql_query($sql)) {
@ -207,7 +207,7 @@ if ($mode != 'topten' || $bb_cfg['topics_per_page'] < 10) {
}
if ($total = OLD_DB()->sql_fetchrow($result)) {
$total_members = $total['total'];
generate_pagination($paginationurl, $total_members, $bb_cfg['topics_per_page'], $start);
generate_pagination($paginationurl, $total_members, config('tp.topics_per_page'), $start);
}
OLD_DB()->sql_freeresult($result);
}

View file

@ -225,14 +225,14 @@ switch ($mode) {
$result = topic_delete($req_topics, $forum_id);
//Обновление кеша новостей на главной
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
if (isset($news_forums[$forum_id]) && $bb_cfg['show_latest_news'] && $result) {
$news_forums = array_flip(explode(',', config('tp.latest_news_forum_id')));
if (isset($news_forums[$forum_id]) && config('tp.show_latest_news') && $result) {
$datastore->enqueue('latest_news');
$datastore->update('latest_news');
}
$net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
if (isset($net_forums[$forum_id]) && $bb_cfg['show_network_news'] && $result) {
$net_forums = array_flip(explode(',', config('tp.network_news_forum_id')));
if (isset($net_forums[$forum_id]) && config('tp.show_network_news') && $result) {
$datastore->enqueue('network_news');
$datastore->update('network_news');
}
@ -256,14 +256,14 @@ switch ($mode) {
$result = topic_move($req_topics, $new_forum_id, $forum_id, isset($_POST['move_leave_shadow']), isset($_POST['insert_bot_msg']));
//Обновление кеша новостей на главной
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
if ((isset($news_forums[$forum_id]) || isset($news_forums[$new_forum_id])) && $bb_cfg['show_latest_news'] && $result) {
$news_forums = array_flip(explode(',', config('tp.latest_news_forum_id')));
if ((isset($news_forums[$forum_id]) || isset($news_forums[$new_forum_id])) && config('tp.show_latest_news') && $result) {
$datastore->enqueue('latest_news');
$datastore->update('latest_news');
}
$net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
if ((isset($net_forums[$forum_id]) || isset($net_forums[$new_forum_id])) && $bb_cfg['show_network_news'] && $result) {
$net_forums = array_flip(explode(',', config('tp.network_news_forum_id')));
if ((isset($net_forums[$forum_id]) || isset($net_forums[$new_forum_id])) && config('tp.show_network_news') && $result) {
$datastore->enqueue('network_news');
$datastore->update('network_news');
}

View file

@ -43,8 +43,8 @@ if ($mode != 'poll_vote') {
// проверка на возможность вносить изменения
if ($mode == 'poll_delete') {
if ($t_data['topic_time'] < TIMENOW - $bb_cfg['poll_max_days'] * 86400) {
bb_die(sprintf($lang['NEW_POLL_DAYS'], $bb_cfg['poll_max_days']));
if ($t_data['topic_time'] < TIMENOW - config('tp.poll_max_days') * 86400) {
bb_die(sprintf($lang['NEW_POLL_DAYS'], config('tp.poll_max_days')));
}
if (!IS_ADMIN && ($t_data['topic_vote'] != POLL_FINISHED)) {
bb_die($lang['CANNOT_DELETE_POLL']);

View file

@ -225,7 +225,7 @@ if (!$is_auth[$is_auth_type]) {
}
if ($mode == 'new_rel') {
if ($tor_status = implode(',', $bb_cfg['tor_cannot_new'])) {
if ($tor_status = implode(',', config('tp.tor_cannot_new'))) {
$sql = OLD_DB()->fetch_rowset("SELECT t.topic_title, t.topic_id, tor.tor_status
FROM " . BB_BT_TORRENTS . " tor, " . BB_TOPICS . " t
WHERE poster_id = {$userdata['user_id']}
@ -236,7 +236,7 @@ if ($mode == 'new_rel') {
$topics = '';
foreach ($sql as $row) {
$topics .= $bb_cfg['tor_icons'][$row['tor_status']] . '<a href="' . TOPIC_URL . $row['topic_id'] . '">' . $row['topic_title'] . '</a><div class="spacer_12"></div>';
$topics .= config('tp.tor_icons.' . $row['tor_status']) . '<a href="' . TOPIC_URL . $row['topic_id'] . '">' . $row['topic_title'] . '</a><div class="spacer_12"></div>';
}
if ($topics) {
bb_die($topics . $lang['UNEXECUTED_RELEASE']);
@ -273,7 +273,7 @@ if (!IS_GUEST && $mode != 'newtopic' && ($submit || $preview || $mode == 'quote'
AND pt.post_id = p.post_id
AND p.post_time > $topic_last_read
ORDER BY p.post_time
LIMIT " . $bb_cfg['posts_per_page'];
LIMIT " . config('tp.posts_per_page');
if ($rowset = OLD_DB()->fetch_rowset($sql)) {
$topic_has_new_posts = true;
@ -283,7 +283,7 @@ if (!IS_GUEST && $mode != 'newtopic' && ($submit || $preview || $mode == 'quote'
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
'POSTER' => profile_url($row),
'POSTER_NAME_JS' => addslashes($row['username']),
'POST_DATE' => bb_date($row['post_time'], $bb_cfg['post_date_format']),
'POST_DATE' => bb_date($row['post_time'], config('tp.post_date_format')),
'MESSAGE' => get_parsed_post($row),
));
}
@ -365,10 +365,10 @@ if (($delete || $mode == 'delete') && !$confirm) {
set_tracks(COOKIE_TOPIC, $tracking_topics, $topic_id);
}
if (defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg) {
if (defined('TORRENT_ATTACH_ID') && config('tp.bt_newtopic_auto_reg') && !$error_msg) {
include INC_DIR . '/functions_torrent.php';
if (!OLD_DB()->fetch_row("SELECT attach_id FROM " . BB_BT_TORRENTS . " WHERE attach_id = " . TORRENT_ATTACH_ID)) {
if ($bb_cfg['premod']) {
if (config('tp.premod')) {
// Получение списка id форумов начиная с parent
$forum_parent = $forum_id;
if ($post_info['forum_parent']) {

View file

@ -24,7 +24,7 @@ $page_cfg['load_tpl_vars'] = array(
//
// Is PM disabled?
//
if ($bb_cfg['privmsg_disable']) {
if (config('tp.privmsg_disable')) {
bb_die('PM_DISABLED');
}
@ -32,14 +32,14 @@ if ($bb_cfg['privmsg_disable']) {
// Parameters
//
$submit = (bool)request_var('post', false);
$submit_search = (isset($_POST['usersubmit'])) ? true : 0;
$submit_msgdays = (isset($_POST['submit_msgdays'])) ? true : 0;
$cancel = (isset($_POST['cancel'])) ? true : 0;
$preview = (isset($_POST['preview'])) ? true : 0;
$confirmed = (isset($_POST['confirm'])) ? true : 0;
$delete = (isset($_POST['delete'])) ? true : 0;
$delete_all = (isset($_POST['deleteall'])) ? true : 0;
$save = (isset($_POST['save'])) ? true : 0;
$submit_search = isset($_POST['usersubmit']) ? true : 0;
$submit_msgdays = isset($_POST['submit_msgdays']) ? true : 0;
$cancel = isset($_POST['cancel']) ? true : 0;
$preview = isset($_POST['preview']) ? true : 0;
$confirmed = isset($_POST['confirm']) ? true : 0;
$delete = isset($_POST['delete']) ? true : 0;
$delete_all = isset($_POST['deleteall']) ? true : 0;
$save = isset($_POST['save']) ? true : 0;
$mode = isset($_REQUEST['mode']) ? (string)$_REQUEST['mode'] : '';
$refresh = $preview || $submit_search;
@ -59,7 +59,7 @@ $user->session_start(array('req_login' => true));
$template->assign_vars(array(
'IN_PM' => true,
'QUICK_REPLY' => $bb_cfg['show_quick_reply'] && $folder == 'inbox' && $mode == 'read',
'QUICK_REPLY' => config('tp.show_quick_reply') && $folder == 'inbox' && $mode == 'read',
));
//
@ -200,7 +200,7 @@ if ($mode == 'read') {
}
if ($sent_info = OLD_DB()->sql_fetchrow($result)) {
if ($bb_cfg['max_sentbox_privmsgs'] && $sent_info['sent_items'] >= $bb_cfg['max_sentbox_privmsgs']) {
if (config('tp.max_sentbox_privmsgs') && $sent_info['sent_items'] >= config('tp.max_sentbox_privmsgs')) {
$sql = "SELECT privmsgs_id FROM " . BB_PRIVMSGS . "
WHERE privmsgs_type = " . PRIVMSGS_SENT_MAIL . "
AND privmsgs_date = " . $sent_info['oldest_post_time'] . "
@ -609,7 +609,7 @@ if ($mode == 'read') {
}
if ($saved_info = OLD_DB()->sql_fetchrow($result)) {
if ($bb_cfg['max_savebox_privmsgs'] && $saved_info['savebox_items'] >= $bb_cfg['max_savebox_privmsgs']) {
if (config('tp.max_savebox_privmsgs') && $saved_info['savebox_items'] >= config('tp.max_savebox_privmsgs')) {
$sql = "SELECT privmsgs_id FROM " . BB_PRIVMSGS . "
WHERE ( ( privmsgs_to_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " )
@ -754,7 +754,7 @@ if ($mode == 'read') {
$last_post_time = $db_row['last_post_time'];
$current_time = TIMENOW;
if (($current_time - $last_post_time) < $bb_cfg['flood_interval']) {
if (($current_time - $last_post_time) < config('tp.flood_interval')) {
bb_die($lang['FLOOD_ERROR']);
}
}
@ -832,7 +832,7 @@ if ($mode == 'read') {
}
if ($inbox_info = OLD_DB()->sql_fetchrow($result)) {
if ($bb_cfg['max_inbox_privmsgs'] && $inbox_info['inbox_items'] >= $bb_cfg['max_inbox_privmsgs']) {
if (config('tp.max_inbox_privmsgs') && $inbox_info['inbox_items'] >= config('tp.max_inbox_privmsgs')) {
$sql = "SELECT privmsgs_id FROM " . BB_PRIVMSGS . "
WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
OR privmsgs_type = " . PRIVMSGS_READ_MAIL . "
@ -900,11 +900,11 @@ if ($mode == 'read') {
cache_rm_user_sessions($to_userdata['user_id']);
if (bf($to_userdata['user_opt'], 'user_opt', 'user_notify_pm') && $to_userdata['user_active'] && $bb_cfg['pm_notify_enabled']) {
if (bf($to_userdata['user_opt'], 'user_opt', 'user_notify_pm') && $to_userdata['user_active'] && config('tp.pm_notify_enabled')) {
/** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\Emailer();
$emailer->set_from([$bb_cfg['board_email'] => $bb_cfg['sitename']]);
$emailer->set_from([config('tp.board_email') => config('tp.sitename')]);
$emailer->set_to([$to_userdata['user_email'] => $to_userdata['username']]);
$emailer->set_subject($lang['EMAILER_SUBJECT']['PRIVMSG_NOTIFY']);
@ -913,7 +913,7 @@ if ($mode == 'read') {
'USERNAME' => html_entity_decode($to_username),
'NAME_FROM' => $userdata['username'],
'MSG_SUBJECT' => html_entity_decode($privmsg_subject),
'SITENAME' => $bb_cfg['sitename'],
'SITENAME' => config('tp.sitename'),
'U_INBOX' => make_url(PM_URL . "?folder=inbox&mode=read&p=$privmsg_sent_id"),
));
@ -1262,7 +1262,7 @@ if ($mode == 'read') {
$msg_days = 0;
}
$sql .= $limit_msg_time . " ORDER BY pm.privmsgs_date DESC LIMIT $start, " . $bb_cfg['topics_per_page'];
$sql .= $limit_msg_time . " ORDER BY pm.privmsgs_date DESC LIMIT $start, " . config('tp.topics_per_page');
$sql_all_tot = $sql_tot;
$sql_tot .= $limit_msg_time_total;
@ -1318,11 +1318,11 @@ if ($mode == 'read') {
// Output data for inbox status
//
$box_limit_img_length = $box_limit_percent = $l_box_size_status = '';
$max_pm = ($folder != 'outbox') ? $bb_cfg["max_{$folder}_privmsgs"] : null;
$max_pm = ($folder != 'outbox') ? config('tp.max_' . $folder . '_privmsgs') : null;
if ($max_pm) {
$box_limit_percent = min(round(($pm_all_total / $max_pm) * 100), 100);
$box_limit_img_length = min(round(($pm_all_total / $max_pm) * $bb_cfg['privmsg_graphic_length']), $bb_cfg['privmsg_graphic_length']);
$box_limit_img_length = min(round(($pm_all_total / $max_pm) * config('tp.privmsg_graphic_length')), config('tp.privmsg_graphic_length'));
$box_limit_remain = max(($max_pm - $pm_all_total), 0);
$template->assign_var('PM_BOX_SIZE_INFO');
@ -1427,7 +1427,7 @@ if ($mode == 'read') {
));
} while ($row = OLD_DB()->sql_fetchrow($result));
generate_pagination(PM_URL . "?folder=$folder", $pm_total, $bb_cfg['topics_per_page'], $start);
generate_pagination(PM_URL . "?folder=$folder", $pm_total, config('tp.topics_per_page'), $start);
} else {
$template->assign_block_vars("switch_no_messages", array());
}

View file

@ -19,7 +19,7 @@ $page_cfg['load_tpl_vars'] = array(
'topic_icons',
);
$user->session_start(array('req_login' => $bb_cfg['disable_search_for_guest']));
$user->session_start(array('req_login' => config('tp.disable_search_for_guest')));
set_die_append_msg();
@ -294,7 +294,7 @@ if (empty($_GET) && empty($_POST)) {
'MY_TOPICS_ID' => 'my_topics',
'MY_TOPICS_CHBOX' => build_checkbox($my_topics_key, $lang['SEARCH_MY_TOPICS'], $my_topics_val, true, null, 'my_topics'),
'TITLE_ONLY_CHBOX' => build_checkbox($title_only_key, $lang['SEARCH_TITLES_ONLY'], true, $bb_cfg['disable_ft_search_in_posts']),
'TITLE_ONLY_CHBOX' => build_checkbox($title_only_key, $lang['SEARCH_TITLES_ONLY'], true, config('tp.disable_ft_search_in_posts')),
'ALL_WORDS_CHBOX' => build_checkbox($all_words_key, $lang['SEARCH_ALL_WORDS'], true),
'DL_CANCEL_CHBOX' => build_checkbox($dl_cancel_key, $lang['SEARCH_DL_CANCEL'], $dl_cancel_val, IS_GUEST, 'dlCancel'),
'DL_COMPL_CHBOX' => build_checkbox($dl_compl_key, $lang['SEARCH_DL_COMPLETE'], $dl_compl_val, IS_GUEST, 'dlComplete'),
@ -426,7 +426,7 @@ $prev_days = ($time_val != $search_all);
$new_topics = (!IS_GUEST && ($new_topics_val || isset($_GET['newposts'])));
$my_topics = ($poster_id_val && $my_topics_val);
$my_posts = ($poster_id_val && !$my_topics_val);
$title_match = ($text_match_sql && ($title_only_val || $bb_cfg['disable_ft_search_in_posts']));
$title_match = ($text_match_sql && ($title_only_val || config('tp.disable_ft_search_in_posts')));
// "Display as" mode (posts or topics)
$post_mode = (!$dl_search && ($display_as_val == $as_posts || isset($_GET['search_author'])));
@ -438,7 +438,7 @@ $SQL = OLD_DB()->get_empty_sql_array();
if ($post_mode) {
$order = $order_opt[$order_val]['sql'];
$sort = $sort_opt[$sort_val]['sql'];
$per_page = $bb_cfg['posts_per_page'];
$per_page = config('tp.posts_per_page');
$display_as_val = $as_posts;
// Run initial search for post_ids
@ -601,7 +601,7 @@ if ($post_mode) {
'POSTER_ID' => $post['poster_id'],
'POSTER' => profile_url($post),
'POST_ID' => $post['post_id'],
'POST_DATE' => bb_date($post['post_time'], $bb_cfg['post_date_format']),
'POST_DATE' => bb_date($post['post_time'], config('tp.post_date_format')),
'IS_UNREAD' => is_unread($post['post_time'], $topic_id, $forum_id),
'MESSAGE' => $message,
'POSTED_AFTER' => '',
@ -620,7 +620,7 @@ if ($post_mode) {
else {
$order = $order_opt[$order_val]['sql'];
$sort = $sort_opt[$sort_val]['sql'];
$per_page = $bb_cfg['topics_per_page'];
$per_page = config('tp.topics_per_page');
$display_as_val = $as_topics;
// Run initial search for topic_ids
@ -741,7 +741,7 @@ else {
// Build SQL for displaying topics
$SQL = OLD_DB()->get_empty_sql_array();
$join_dl = ($bb_cfg['show_dl_status_in_search'] && !IS_GUEST);
$join_dl = (config('tp.show_dl_status_in_search') && !IS_GUEST);
$SQL['SELECT'][] = "
t.*, t.topic_poster AS first_user_id, u1.user_rank AS first_user_rank,
@ -798,7 +798,7 @@ else {
'TOPIC_TITLE' => wbr($topic['topic_title']),
'IS_UNREAD' => $is_unread,
'TOPIC_ICON' => get_topic_icon($topic, $is_unread),
'PAGINATION' => ($moved) ? '' : build_topic_pagination(TOPIC_URL . $topic_id, $topic['topic_replies'], $bb_cfg['posts_per_page']),
'PAGINATION' => $moved ? '' : build_topic_pagination(TOPIC_URL . $topic_id, $topic['topic_replies'], config('tp.posts_per_page')),
'REPLIES' => $topic['topic_replies'],
'ATTACH' => $topic['topic_attachment'],
'STATUS' => $topic['topic_status'],
@ -895,16 +895,13 @@ function fetch_search_ids($sql, $search_type = SEARCH_TYPE_POST)
function prevent_huge_searches($SQL)
{
global $bb_cfg;
if ($bb_cfg['limit_max_search_results']) {
if (config('tp.limit_max_search_results')) {
$SQL['select_options'][] = 'SQL_CALC_FOUND_ROWS';
$SQL['ORDER BY'] = array();
$SQL['LIMIT'] = array('0');
if (OLD_DB()->query($SQL) and $row = OLD_DB()->fetch_row("SELECT FOUND_ROWS() AS rows_count")) {
if ($row['rows_count'] > $bb_cfg['limit_max_search_results']) {
# bb_log(str_compact(OLD_DB()->build_sql($SQL)) ." [{$row['rows_count']} rows]". LOG_LF, 'sql_huge_search');
if ($row['rows_count'] > config('tp.limit_max_search_results')) {
bb_die('Too_many_search_results');
}
}

View file

@ -44,12 +44,12 @@
<td>&nbsp; {L_YES}</td>
</tr>
<tr>
<td><h4>{L_AUTH_KEY_NAME}</h4><h5>$bb_cfg['passkey_key']</h5><h6>{L_AUTH_KEY_NAME_EXPL}</h6></td>
<td><h4>{L_AUTH_KEY_NAME}</h4><h5>$cfg['passkey_key']</h5><h6>{L_AUTH_KEY_NAME_EXPL}</h6></td>
<td>&nbsp; <b>{PASSKEY_KEY}</b></td>
</tr>
<tr>
<td><h4>{L_ALLOW_GUEST_DL}</h4><!-- IF L_ALLOW_GUEST_DL_EXPL --><h6>{L_ALLOW_GUEST_DL_EXPL}</h6><!-- ENDIF --></td>
<td>&nbsp; <!-- IF $bb_cfg['bt_tor_browse_only_reg'] -->{L_NO}<!-- ELSE -->{L_YES}<!-- ENDIF --></td>
<td>&nbsp; <!-- IF CFG_TB_ONLY_REG -->{L_NO}<!-- ELSE -->{L_YES}<!-- ENDIF --></td>
</tr>
<tr>
<th colspan="2">{L_LIMIT_ACTIVE_TOR_HEAD}</th>
@ -91,7 +91,7 @@
<th colspan="2">{L_ANNOUNCE_INTERVAL_HEAD}</th>
</tr>
<tr>
<td><h4>{L_ANNOUNCE_INTERVAL}</h4><h5>$bb_cfg['announce_interval']</h5><h6>{L_ANNOUNCE_INTERVAL_EXPL}</h6></td>
<td><h4>{L_ANNOUNCE_INTERVAL}</h4><h5>$cfg['announce_interval']</h5><h6>{L_ANNOUNCE_INTERVAL_EXPL}</h6></td>
<td><span class="med">&nbsp; <b>{ANNOUNCE_INTERVAL}</b></span> <span class="med">seconds</span></td>
</tr>
<tr>
@ -114,7 +114,7 @@
</td>
</tr>
<tr>
<td><h4>{L_IGNORE_GIVEN_IP}</h4><h5>$bb_cfg['ignore_reported_ip']</h5><h6><!-- IF L_IGNOR_GIVEN_IP_EXPL -->{L_IGNOR_GIVEN_IP_EXPL}<!-- ENDIF --></h6></td>
<td><h4>{L_IGNORE_GIVEN_IP}</h4><h5>$cfg['ignore_reported_ip']</h5><h6><!-- IF L_IGNOR_GIVEN_IP_EXPL -->{L_IGNOR_GIVEN_IP_EXPL}<!-- ENDIF --></h6></td>
<td>&nbsp; <!-- IF IGNORE_REPORTED_IP -->{L_YES}<!-- ELSE -->{L_NO}<!-- ENDIF --></td>
</tr>
<tr>

View file

@ -117,7 +117,7 @@
<td><b>{L_UPDATE}:</b></td>
<td>
<a href="#" id="update_user_level" onclick="ajax.manage_admin('update_user_level'); return false;">{L_USER_LEVELS}</a>
<!-- IF $bb_cfg['search_engine_type'] == "sphinx" -->,&nbsp;
<!-- IF CFG_SEARCH_ET == "sphinx" -->,&nbsp;
<a href="#" id="indexer" onclick="ajax.manage_admin('indexer'); return false;">{L_INDEXER}</a>
<!-- ENDIF -->
</td>
@ -151,11 +151,11 @@
</tr>
<tr>
<td class="row1" nowrap="nowrap" width="25%">{L_TP_VERSION}:</td>
<td class="row2"><b>{$bb_cfg['tp_release_codename']} ({$bb_cfg['tp_version']})</b></td>
<td class="row2"><b>{CFG_TP_CN} ({CFG_TP_VER})</b></td>
</tr>
<tr>
<td class="row1" nowrap="nowrap" width="25%">{L_TP_RELEASE_DATE}:</td>
<td class="row2"><b>{$bb_cfg['tp_release_date']}</b></td>
<td class="row2"><b>{CFG_TP_RD}</b></td>
</tr>
</table>
<br/>

View file

@ -76,11 +76,11 @@ function manage_group(mode, value) {
</td>
<td valign="top">
<div id="avatar_explain" class="med">{AVATAR_EXPLAIN}</div>
<!-- IF $bb_cfg['group_avatars']['up_allowed'] -->
<!-- IF CFG_GA_UA -->
<br />
<form action="{S_GROUP_CONFIG_ACTION}" method="post" enctype="multipart/form-data">
{S_HIDDEN_FIELDS}
<input type="hidden" name="MAX_FILE_SIZE" value="{$bb_cfg['group_avatars']['max_size']}" />
<input type="hidden" name="MAX_FILE_SIZE" value="{CFG_GA_MS}" />
<input type="file" name="avatar" />
<input class="mainoption" type="submit" name="submit" value="{L_UPLOAD_AVATAR_FILE}" />
</form>

Some files were not shown because too many files have changed in this diff Show more