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') { if ($view === 'username') {
switch ($mode) { switch ($mode) {
case 'username': 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; break;
case 'attachments': 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; break;
case 'filesize': 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; break;
default: default:
$mode = 'attachments'; $mode = 'attachments';
$sort_order = 'DESC'; $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; break;
} }
} elseif ($view === 'attachments') { } elseif ($view === 'attachments') {
switch ($mode) { switch ($mode) {
case 'filename': 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; break;
case 'comment': 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; break;
case 'extension': 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; break;
case 'filesize': 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; break;
case 'downloads': 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; break;
case 'post_time': 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; break;
default: default:
$mode = 'a.real_filename'; $mode = 'a.real_filename';
$sort_order = 'ASC'; $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; break;
} }
} }
@ -472,8 +472,8 @@ if ($view === 'attachments') {
} }
// Generate Pagination // Generate Pagination
if ($do_pagination && $total_rows > $bb_cfg['topics_per_page']) { 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, $bb_cfg['topics_per_page'], $start); 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'); print_page('admin_attach_cp.tpl', 'admin');

View file

@ -55,20 +55,20 @@ $default_cfg_num = array(
/** /**
* Set template vars * 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_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_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); set_tpl_vars_lang($default_cfg_num);
$template->assign_vars(array( $template->assign_vars(array(
'IGNORE_REPORTED_IP' => $bb_cfg['ignore_reported_ip'], 'IGNORE_REPORTED_IP' => config('tp.ignore_reported_ip'),
'ANNOUNCE_INTERVAL' => $bb_cfg['announce_interval'], 'ANNOUNCE_INTERVAL' => config('tp.announce_interval'),
'PASSKEY_KEY' => $bb_cfg['passkey_key'], 'PASSKEY_KEY' => config('tp.passkey_key'),
'GOLD_SILVER_ENABLED' => $bb_cfg['tracker']['gold_silver_enabled'], 'GOLD_SILVER_ENABLED' => config('tracker.gold_silver_enabled'),
'DISABLE_SUBMIT' => true, 'DISABLE_SUBMIT' => true,
'S_HIDDEN_FIELDS' => '', '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); $url = url_arg($url, $daysback_key, $daysback_val);
} }
if ($var =& $_REQUEST[$datetime_key] && $var != $def_datetime) { 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) { if (($tmp_timestamp = strtotime($var, $tz)) > 0) {
$datetime_val = $tmp_timestamp; $datetime_val = $tmp_timestamp;
$url = url_arg($url, $datetime_key, date($dt_format, $datetime_val)); $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 */ /** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\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_to([$row['user_email'] => $row['username']]);
$emailer->set_subject($subject); $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']; $message = file_exists(SITEMAP_DIR . '/sitemap.xml') ? $s_mess : $lang['SITEMAP_NOT_CREATED'];
$template->assign_vars(array( $template->assign_vars(array(

View file

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

View file

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

View file

@ -845,10 +845,10 @@ if (!isset($_REQUEST['dosearch'])) {
if ($page == 1) { if ($page == 1) {
$offset = 0; $offset = 0;
} else { } 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"; $select_sql .= " $limit";
@ -863,7 +863,7 @@ if (!isset($_REQUEST['dosearch'])) {
bb_die($lang['SEARCH_NO_RESULTS']); 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 = ''; $pagination = '';

View file

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

View file

@ -59,7 +59,7 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
} elseif (isset($_GET['pane']) && $_GET['pane'] == 'right') { } elseif (isset($_GET['pane']) && $_GET['pane'] == 'right') {
$template->assign_vars(array( $template->assign_vars(array(
'TPL_ADMIN_MAIN' => true, '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, '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_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount'); $total_users = get_db_stat('usercount');
$total_topics = get_db_stat('topiccount'); $total_topics = get_db_stat('topiccount');
$start_date = bb_date($bb_cfg['board_startdate']); $start_date = bb_date(config('tp.board_startdate'));
$boarddays = (TIMENOW - $bb_cfg['board_startdate']) / 86400; $boarddays = (TIMENOW - config('tp.board_startdate')) / 86400;
$posts_per_day = sprintf('%.2f', $total_posts / $boarddays); $posts_per_day = sprintf('%.2f', $total_posts / $boarddays);
$topics_per_day = sprintf('%.2f', $total_topics / $boarddays); $topics_per_day = sprintf('%.2f', $total_topics / $boarddays);
@ -76,10 +76,10 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
$avatar_dir_size = 0; $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)) { while ($file = readdir($avatar_dir)) {
if ($file != '.' && $file != '..') { 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); 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), 'STARTED' => bb_date($onlinerow_reg[$i]['session_start'], 'H:i', false),
'LASTUPDATE' => bb_date($onlinerow_reg[$i]['user_session_time'], 'H:i', false), 'LASTUPDATE' => bb_date($onlinerow_reg[$i]['user_session_time'], 'H:i', false),
'IP_ADDRESS' => $reg_ip, '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), 'STARTED' => bb_date($onlinerow_guest[$i]['session_start'], 'H:i', false),
'LASTUPDATE' => bb_date($onlinerow_guest[$i]['session_time'], 'H:i', false), 'LASTUPDATE' => bb_date($onlinerow_guest[$i]['session_time'], 'H:i', false),
'IP_ADDRESS' => $guest_ip, '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_minutes = [30, 15, 5, 1];
$peers_in_last_sec_limit = 300; $peers_in_last_sec_limit = 300;
$announce_interval = (int)$bb_cfg['announce_interval']; $announce_interval = (int)config('tp.announce_interval');
$stat = array(); $stat = array();
define('TMP_TRACKER_TABLE', 'tmp_tracker'); 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 // Exit if board is disabled via ON/OFF trigger or by admin
if ($ajax->action != 'manage_admin') { if ($ajax->action != 'manage_admin') {
if ($bb_cfg['board_disable']) { if (config('tp.board_disable')) {
$ajax->ajax_die($lang['BOARD_DISABLE']); $ajax->ajax_die($lang['BOARD_DISABLE']);
} elseif (file_exists(BB_DISABLED)) { } elseif (file_exists(BB_DISABLED)) {
$ajax->ajax_die($lang['BOARD_DISABLE_CRON']); $ajax->ajax_die($lang['BOARD_DISABLE_CRON']);

View file

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

View file

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

View file

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

View file

@ -11,9 +11,7 @@ define('IN_TRACKER', true);
define('BB_ROOT', './../'); define('BB_ROOT', './../');
require dirname(__DIR__) . '/common.php'; require dirname(__DIR__) . '/common.php';
global $bb_cfg; if (!config('tracker.scrape')) {
if (!$bb_cfg['tracker']['scrape']) {
msg_die('Please disable 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'; require_once __DIR__ . '/vendor/autoload.php';
// Legacy config /**
use Dotenv\Dotenv; * Container
use Dotenv\Exception\InvalidPathException; */
require_once __DIR__ . '/bootstrap.php';
try { $server_protocol = config('tp.cookie_secure') ? 'https://' : 'http://';
(new Dotenv(__DIR__))->load(); $server_port = in_array((int)config('tp.server_port'), array(80, 443), true) ? '' : ':' . config('tp.server_port');
} catch (InvalidPathException $e) { define('FORUM_PATH', config('tp.script_path'));
throw $e; define('FULL_URL', $server_protocol . config('tp.server_name') . $server_port . config('tp.script_path'));
}
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']);
unset($server_protocol, $server_port); unset($server_protocol, $server_port);
// Debug options // Debug options
define('DBG_USER', (isset($_COOKIE[COOKIE_DBG]))); define('DBG_USER', isset($_COOKIE[COOKIE_DBG]));
// Board / tracker shared constants and functions // Board / tracker shared constants and functions
define('BB_BT_TORRENTS', 'bb_bt_torrents'); 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('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_RELEASER', -1);
define('DL_STATUS_DOWN', 0); define('DL_STATUS_DOWN', 0);
define('DL_STATUS_COMPLETE', 1); define('DL_STATUS_COMPLETE', 1);
@ -98,10 +87,10 @@ define('BOT_UID', -746);
/** /**
* Progressive error reporting * Progressive error reporting
*/ */
if ($bb_cfg['bugsnag']['enabled']) { if (config('tp.bugsnag.enabled')) {
if (env('APP_ENV', 'production') !== 'local') { if (env('APP_ENV', 'production') !== 'local') {
/** @var Bugsnag\Handler $bugsnag */ /** @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); Bugsnag\Handler::register($bugsnag);
} }
} else { } else {
@ -116,7 +105,7 @@ if ($bb_cfg['bugsnag']['enabled']) {
/** /**
* Database * Database
*/ */
$DBS = new TorrentPier\Legacy\Dbs($bb_cfg); $DBS = new TorrentPier\Legacy\Dbs(config('tp'));
function OLD_DB($db_alias = 'db') function OLD_DB($db_alias = 'db')
{ {
@ -127,7 +116,7 @@ function OLD_DB($db_alias = 'db')
/** /**
* Cache * Cache
*/ */
$CACHES = new TorrentPier\Legacy\Caches($bb_cfg); $CACHES = new TorrentPier\Legacy\Caches(config('tp'));
function OLD_CACHE($cache_name) function OLD_CACHE($cache_name)
{ {
@ -138,42 +127,37 @@ function OLD_CACHE($cache_name)
/** /**
* Datastore * Datastore
*/ */
switch ($bb_cfg['datastore_type']) { switch (config('tp.datastore_type')) {
case 'memcache': 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; break;
case 'sqlite': case 'sqlite':
$default_cfg = array( $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, 'pconnect' => true,
'con_required' => 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; break;
case 'redis': 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; break;
case 'apc': case 'apc':
$datastore = new TorrentPier\Legacy\Datastore\Apc($bb_cfg['cache']['prefix']); $datastore = new TorrentPier\Legacy\Datastore\Apc(config('tp.cache.prefix'));
break; break;
case 'xcache': case 'xcache':
$datastore = new TorrentPier\Legacy\Datastore\Xcache($bb_cfg['cache']['prefix']); $datastore = new TorrentPier\Legacy\Datastore\Xcache(config('tp.cache.prefix'));
break; break;
case 'filecache': case 'filecache':
default: 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() function sql_dbg_enabled()
{ {
return (SQL_DEBUG && DBG_USER && !empty($_COOKIE['sql_log'])); 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 * @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 // Send file to browser
function send_file_to_browser($attachment, $upload_dir) 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']; $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'); 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) { if (file_exists(config('tp.atom.path') . '/f/' . $id . '.atom') && filemtime(config('tp.atom.path') . '/f/' . $id . '.atom') > $timecheck) {
redirectToUrl($bb_cfg['atom']['url'] . '/f/' . $id . '.atom'); redirectToUrl(config('tp.atom.url') . '/f/' . $id . '.atom');
} else { } else {
require_once INC_DIR . '/functions_atom.php'; require_once INC_DIR . '/functions_atom.php';
if (update_forum_feed($id, $forum_data)) { if (update_forum_feed($id, $forum_data)) {
redirectToUrl($bb_cfg['atom']['url'] . '/f/' . $id . '.atom'); redirectToUrl(config('tp.atom.url') . '/f/' . $id . '.atom');
} else { } else {
bb_simple_die($lang['ATOM_NO_FORUM']); 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)) { if (!$username = get_username($id)) {
bb_simple_die($lang['ATOM_ERROR'] . ' #3'); 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) { 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($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 { } else {
require_once INC_DIR . '/functions_atom.php'; require_once INC_DIR . '/functions_atom.php';
if (update_user_feed($id, $username)) { 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 { } else {
bb_simple_die($lang['ATOM_NO_USER']); 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) 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'] : ''; $from = (!empty($row['user_from'])) ? $row['user_from'] : '';
$joined = bb_date($row['user_regdate']); $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); $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) { 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>'; $email = '<a class="editable" href="' . $email_uri . '">' . $row['user_email'] . '</a>';
} else { } else {
$email = ''; $email = '';
@ -51,7 +51,7 @@ set_die_append_msg();
$group_id = isset($_REQUEST[POST_GROUPS_URL]) ? (int)$_REQUEST[POST_GROUPS_URL] : null; $group_id = isset($_REQUEST[POST_GROUPS_URL]) ? (int)$_REQUEST[POST_GROUPS_URL] : null;
$start = isset($_REQUEST['start']) ? abs((int)$_REQUEST['start']) : 0; $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; $view_mode = isset($_REQUEST['view']) ? (string)$_REQUEST['view'] : null;
$rel_limit = 50; $rel_limit = 50;
@ -195,18 +195,18 @@ if (!$group_id) {
add_user_into_group($group_id, $userdata['user_id'], 1, TIMENOW); 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 */ /** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\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_to([$moderator['user_email'] => $moderator['username']]);
$emailer->set_subject($lang['EMAILER_SUBJECT']['GROUP_REQUEST']); $emailer->set_subject($lang['EMAILER_SUBJECT']['GROUP_REQUEST']);
$emailer->set_template('group_request', $moderator['user_lang']); $emailer->set_template('group_request', $moderator['user_lang']);
$emailer->assign_vars(array( $emailer->assign_vars(array(
'USER' => $userdata['username'], 'USER' => $userdata['username'],
'SITENAME' => $bb_cfg['sitename'], 'SITENAME' => config('tp.sitename'),
'GROUP_MODERATOR' => $moderator['username'], 'GROUP_MODERATOR' => $moderator['username'],
'U_GROUP' => make_url(GROUP_URL . $group_id), 'U_GROUP' => make_url(GROUP_URL . $group_id),
)); ));
@ -237,17 +237,17 @@ if (!$group_id) {
add_user_into_group($group_id, $row['user_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 */ /** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\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_to([$row['user_email'] => $row['username']]);
$emailer->set_subject($lang['EMAILER_SUBJECT']['GROUP_ADDED']); $emailer->set_subject($lang['EMAILER_SUBJECT']['GROUP_ADDED']);
$emailer->set_template('group_added', $row['user_lang']); $emailer->set_template('group_added', $row['user_lang']);
$emailer->assign_vars(array( $emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'], 'SITENAME' => config('tp.sitename'),
'GROUP_NAME' => $group_info['group_name'], 'GROUP_NAME' => $group_info['group_name'],
'U_GROUP' => make_url(GROUP_URL . $group_id), 'U_GROUP' => make_url(GROUP_URL . $group_id),
)); ));
@ -287,7 +287,7 @@ if (!$group_id) {
} }
} }
// Email users when they are approved // 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 $sql_select = "SELECT username, user_email, user_lang
FROM " . BB_USERS . " FROM " . BB_USERS . "
WHERE user_id IN($sql_in)"; WHERE user_id IN($sql_in)";
@ -300,13 +300,13 @@ if (!$group_id) {
/** @var TorrentPier\Legacy\Emailer() $emailer */ /** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\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_to([$row['user_email'] => $row['username']]);
$emailer->set_subject($lang['EMAILER_SUBJECT']['GROUP_APPROVED']); $emailer->set_subject($lang['EMAILER_SUBJECT']['GROUP_APPROVED']);
$emailer->set_template('group_approved', $row['user_lang']); $emailer->set_template('group_approved', $row['user_lang']);
$emailer->assign_vars(array( $emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'], 'SITENAME' => config('tp.sitename'),
'GROUP_NAME' => $group_info['group_name'], 'GROUP_NAME' => $group_info['group_name'],
'U_GROUP' => make_url(GROUP_URL . $group_id), 'U_GROUP' => make_url(GROUP_URL . $group_id),
)); ));
@ -375,7 +375,7 @@ if (!$group_id) {
$username = $group_moderator['username']; $username = $group_moderator['username'];
$user_id = $group_moderator['user_id']; $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 = ''; $group_type = '';
if ($group_info['group_type'] == GROUP_OPEN) { if ($group_info['group_type'] == GROUP_OPEN) {
@ -524,7 +524,7 @@ if (!$group_id) {
foreach ($group_members as $i => $member) { foreach ($group_members as $i => $member) {
$user_id = $member['user_id']; $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) { if ($group_info['group_type'] != GROUP_HIDDEN || $is_group_member || $is_moderator) {
$row_class = !($i % 2) ? 'row1' : 'row2'; $row_class = !($i % 2) ? 'row1' : 'row2';
@ -578,7 +578,7 @@ if (!$group_id) {
foreach ($modgroup_pending_list as $i => $member) { foreach ($modgroup_pending_list as $i => $member) {
$user_id = $member['user_id']; $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'; $row_class = !($i % 2) ? 'row1' : 'row2';

View file

@ -36,10 +36,10 @@ if ($group_id) {
if ($is_moderator) { if ($is_moderator) {
// Avatar // Avatar
if ($submit) { 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(); $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; $avatar_ext_id = (int)$upload->file_ext_id;
} else { } else {
bb_die(implode($upload->errors)); bb_die(implode($upload->errors));
@ -78,7 +78,7 @@ if ($is_moderator) {
'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_GROUP_CONFIG_ACTION' => "group_edit.php?" . POST_GROUPS_URL . "=$group_id", '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']), 'AVATAR_IMG' => get_avatar(GROUP_AVATAR_MASK . $group_id, $group_info['avatar_ext_id']),
)); ));

View file

@ -25,10 +25,10 @@ $datastore->enqueue(array(
'moderators', 'moderators',
'cat_forums', 'cat_forums',
)); ));
if ($bb_cfg['show_latest_news']) { if (config('tp.show_latest_news')) {
$datastore->enqueue('latest_news'); $datastore->enqueue('latest_news');
} }
if ($bb_cfg['show_network_news']) { if (config('tp.show_network_news')) {
$datastore->enqueue('network_news'); $datastore->enqueue('network_news');
} }
@ -44,7 +44,7 @@ $req_page = 'index_page';
$req_page .= ($viewcat) ? "_c{$viewcat}" : ''; $req_page .= ($viewcat) ? "_c{$viewcat}" : '';
define('REQUESTED_PAGE', $req_page); 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_opt = isset($user->opt_js['h_cat']) ? (string)$user->opt_js['h_cat'] : 0;
$hide_cat_user = array_flip(explode('-', $hide_cat_opt)); $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_ID' => $f['last_topic_id'],
'LAST_TOPIC_TIP' => $f['last_topic_title'], 'LAST_TOPIC_TIP' => $f['last_topic_title'],
'LAST_TOPIC_TITLE' => wbr(str_short($f['last_topic_title'], $last_topic_max_len)), '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'])), '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_TOPICS' => sprintf($lang['POSTED_TOPICS_TOTAL'], $stats['topiccount']),
'TOTAL_POSTS' => sprintf($lang['POSTED_ARTICLES_TOTAL'], $stats['postcount']), 'TOTAL_POSTS' => sprintf($lang['POSTED_ARTICLES_TOTAL'], $stats['postcount']),
'TOTAL_USERS' => sprintf($lang['REGISTERED_USERS_TOTAL'], $stats['usercount']), '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'], $lang['USERS_TOTAL_GENDER'],
$stats['male'], $stats['male'],
$stats['female'], $stats['female'],
@ -273,22 +273,22 @@ $template->assign_vars(array(
'NEWEST_USER' => sprintf($lang['NEWEST_USER'], profile_url($stats['newestuser'])), 'NEWEST_USER' => sprintf($lang['NEWEST_USER'], profile_url($stats['newestuser'])),
// Tracker stats // Tracker stats
'TORRENTS_STAT' => $bb_cfg['tor_stats'] ? sprintf( 'TORRENTS_STAT' => config('tp.tor_stats') ? sprintf(
$lang['TORRENTS_STAT'], $lang['TORRENTS_STAT'],
$stats['torrentcount'], $stats['torrentcount'],
humn_size($stats['size']) humn_size($stats['size'])
) : '', ) : '',
'PEERS_STAT' => $bb_cfg['tor_stats'] ? sprintf( 'PEERS_STAT' => config('tp.tor_stats') ? sprintf(
$lang['PEERS_STAT'], $lang['PEERS_STAT'],
$stats['peers'], $stats['peers'],
$stats['seeders'], $stats['seeders'],
$stats['leechers'] $stats['leechers']
) : '', ) : '',
'SPEED_STAT' => $bb_cfg['tor_stats'] ? sprintf( 'SPEED_STAT' => config('tp.tor_stats') ? sprintf(
$lang['SPEED_STAT'], $lang['SPEED_STAT'],
humn_size($stats['speed']) . '/s' 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_IMG' => $images['forum'],
'FORUM_NEW_IMG' => $images['forum_new'], 'FORUM_NEW_IMG' => $images['forum_new'],
'FORUM_LOCKED_IMG' => $images['forum_locked'], 'FORUM_LOCKED_IMG' => $images['forum_locked'],
@ -306,12 +306,12 @@ $template->assign_vars(array(
)); ));
// Set tpl vars for bt_userdata // 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']); show_bt_userdata($userdata['user_id']);
} }
// Latest news // Latest news
if ($bb_cfg['show_latest_news']) { if (config('tp.show_latest_news')) {
if (!$latest_news = $datastore->get('latest_news')) { if (!$latest_news = $datastore->get('latest_news')) {
$datastore->update('latest_news'); $datastore->update('latest_news');
$latest_news = $datastore->get('latest_news'); $latest_news = $datastore->get('latest_news');
@ -324,7 +324,7 @@ if ($bb_cfg['show_latest_news']) {
foreach ($latest_news as $news) { foreach ($latest_news as $news) {
$template->assign_block_vars('news', array( $template->assign_block_vars('news', array(
'NEWS_TOPIC_ID' => $news['topic_id'], '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_TIME' => bb_date($news['topic_time'], 'd-M', false),
'NEWS_IS_NEW' => is_unread($news['topic_time'], $news['topic_id'], $news['forum_id']), '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 // Network news
if ($bb_cfg['show_network_news']) { if (config('tp.show_network_news')) {
if (!$network_news = $datastore->get('network_news')) { if (!$network_news = $datastore->get('network_news')) {
$datastore->update('network_news'); $datastore->update('network_news');
$network_news = $datastore->get('network_news'); $network_news = $datastore->get('network_news');
@ -345,14 +345,14 @@ if ($bb_cfg['show_network_news']) {
foreach ($network_news as $net) { foreach ($network_news as $net) {
$template->assign_block_vars('net', array( $template->assign_block_vars('net', array(
'NEWS_TOPIC_ID' => $net['topic_id'], '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_TIME' => bb_date($net['topic_time'], 'd-M', false),
'NEWS_IS_NEW' => is_unread($net['topic_time'], $net['topic_id'], $net['forum_id']), '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_list = $today_list = array();
$week_all = $today_all = false; $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_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_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 { } 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'])) { if (!empty($stats['birthday_today_list'])) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -122,11 +122,11 @@ class TorrentFileList
*/ */
private function build_file_item($name, $length) private function build_file_item($name, $length)
{ {
global $bb_cfg, $images, $lang; global $images, $lang;
$magnet_name = $magnet_ext = ''; $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_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>'; $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__)); die(basename(__FILE__));
} }
global $bb_cfg, $lang, $user; global $lang, $user;
$mode = (string)$this->request['mode']; $mode = (string)$this->request['mode'];
$user_id = (int)$this->request['user_id']; $user_id = (int)$this->request['user_id'];
@ -28,7 +28,7 @@ switch ($mode) {
case 'delete': case 'delete':
delete_avatar($user_id, $u_data['avatar_ext_id']); delete_avatar($user_id, $u_data['avatar_ext_id']);
$new_ext_id = 0; $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; break;
default: default:
$this->ajax_die('Invalid mode'); $this->ajax_die('Invalid mode');

View file

@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__)); die(basename(__FILE__));
} }
global $userdata, $bb_cfg, $lang; global $userdata, $lang;
if (!isset($this->request['attach_id'])) { if (!isset($this->request['attach_id'])) {
$this->ajax_die($lang['EMPTY_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']; $attach_id = (int)$this->request['attach_id'];
$mode = (string)$this->request['mode']; $mode = (string)$this->request['mode'];
if ($bb_cfg['tor_comment']) { if (config('tp.tor_comment')) {
$comment = (string)$this->request['comment']; $comment = (string)$this->request['comment'];
} }
@ -85,12 +85,12 @@ switch ($mode) {
change_tor_status($attach_id, $new_status); 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) { if ($tor['poster_id'] > 0) {
$subject = sprintf($lang['TOR_MOD_TITLE'], $tor['topic_title']); $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']) { if ($comment && $comment != $lang['COMMENT']) {
$message .= "\n\n[b]" . $lang['COMMENT'] . '[/b]: ' . $comment; $message .= "\n\n[b]" . $lang['COMMENT'] . '[/b]: ' . $comment;
@ -103,7 +103,7 @@ switch ($mode) {
break; break;
case 'status_reply': case 'status_reply':
if (!$bb_cfg['tor_comment']) { if (!config('tp.tor_comment')) {
$this->ajax_die($lang['MODULE_OFF']); $this->ajax_die($lang['MODULE_OFF']);
} }

View file

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

View file

@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__)); 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)) { if (!$group_id = (int)$this->request['group_id'] or !$group_info = get_group_data($group_id)) {
$this->ajax_die($lang['NO_GROUP_ID_SPECIFIED']); $this->ajax_die($lang['NO_GROUP_ID_SPECIFIED']);

View file

@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__)); die(basename(__FILE__));
} }
global $bb_cfg, $lang; global $lang;
if (!$user_id = (int)$this->request['user_id'] or !$profiledata = get_userdata($user_id)) { if (!$user_id = (int)$this->request['user_id'] or !$profiledata = get_userdata($user_id)) {
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']); $this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
@ -51,7 +51,7 @@ switch ($field) {
break; break;
case 'user_gender': case 'user_gender':
if (!$bb_cfg['gender']) { if (!config('tp.gender')) {
$this->ajax_die($lang['MODULE_OFF']); $this->ajax_die($lang['MODULE_OFF']);
} }
if (!isset($lang['GENDER_SELECT'][$value])) { if (!isset($lang['GENDER_SELECT'][$value])) {
@ -62,7 +62,7 @@ switch ($field) {
break; break;
case 'user_birthday': case 'user_birthday':
if (!$bb_cfg['birthday_enabled']) { if (!config('tp.birthday_enabled')) {
$this->ajax_die($lang['MODULE_OFF']); $this->ajax_die($lang['MODULE_OFF']);
} }
$birthday_date = date_parse($value); $birthday_date = date_parse($value);
@ -70,10 +70,10 @@ switch ($field) {
if (!empty($birthday_date['year'])) { if (!empty($birthday_date['year'])) {
if (strtotime($value) >= TIMENOW) { if (strtotime($value) >= TIMENOW) {
$this->ajax_die($lang['WRONG_BIRTHDAY_FORMAT']); $this->ajax_die($lang['WRONG_BIRTHDAY_FORMAT']);
} elseif (bb_date(TIMENOW, 'Y', 'false') - $birthday_date['year'] > $bb_cfg['birthday_max_age']) { } elseif (bb_date(TIMENOW, 'Y', 'false') - $birthday_date['year'] > config('tp.birthday_max_age')) {
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_HIGH'], $bb_cfg['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'] < $bb_cfg['birthday_min_age']) { } elseif (bb_date(TIMENOW, 'Y', 'false') - $birthday_date['year'] < config('tp.birthday_min_age')) {
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_LOW'], $bb_cfg['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_regdate':
case 'user_lastvisit': case 'user_lastvisit':
$tz = TIMENOW + (3600 * $bb_cfg['board_timezone']); $tz = TIMENOW + (3600 * config('tp.board_timezone'));
if (($value = strtotime($value, $tz)) < $bb_cfg['board_startdate'] or $value > TIMENOW) { if (($value = strtotime($value, $tz)) < config('tp.board_startdate') || $value > TIMENOW) {
$this->ajax_die($lang['INVALID_DATE'] . $this->request['value']); $this->ajax_die($lang['INVALID_DATE'] . $this->request['value']);
} }
$this->response['new_value'] = bb_date($value, 'Y-m-d H:i', false); $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__)); die(basename(__FILE__));
} }
global $bb_cfg, $lang, $userdata, $datastore; global $lang, $userdata, $datastore;
$mode = (string)$this->request['mode']; $mode = (string)$this->request['mode'];
$html = ''; $html = '';
@ -27,9 +27,9 @@ switch ($mode) {
foreach ($stats['birthday_week_list'] as $week) { foreach ($stats['birthday_week_list'] as $week) {
$html[] = profile_url($week) . ' <span class="small">(' . birthday_age($week['user_birthday']) . ')</span>'; $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 { } else {
$html = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']); $html = sprintf($lang['NOBIRTHDAY_WEEK'], config('tp.birthday_check_day'));
} }
break; break;
@ -86,10 +86,10 @@ switch ($mode) {
if ($tz > 13) { if ($tz > 13) {
$tz = 13; $tz = 13;
} }
if ($tz != $bb_cfg['board_timezone']) { if ($tz != config('tp.board_timezone')) {
// Set current user timezone // Set current user timezone
OLD_DB()->query("UPDATE " . BB_USERS . " SET user_timezone = $tz WHERE user_id = " . $userdata['user_id']); 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']); cache_rm_user_sessions($userdata['user_id']);
} }
break; break;
@ -110,7 +110,7 @@ switch ($mode) {
<th>' . $lang['UPLOADED'] . '</th> <th>' . $lang['UPLOADED'] . '</th>
<th>' . $lang['RELEASED'] . '</th> <th>' . $lang['RELEASED'] . '</th>
<th>' . $lang['BONUS'] . '</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> $html .= '</tr>
<tr class="row1"> <tr class="row1">
<td>' . $lang['TOTAL_TRAF'] . '</td> <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_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_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>'; <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> $html .= '</tr>
<tr class="row5"> <tr class="row5">
<td colspan="1">' . $lang['MAX_SPEED'] . '</td> <td colspan="1">' . $lang['MAX_SPEED'] . '</td>
<td colspan="2">' . $lang['DL_DL_SPEED'] . ': ' . $speed_down . '</span></td> <td colspan="2">' . $lang['DL_DL_SPEED'] . ': ' . $speed_down . '</span></td>
<td colspan="2">' . $lang['DL_UL_SPEED'] . ': ' . $speed_up . '</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>'; $html .= '</tr>';
$this->response['user_ratio'] = ' $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> <td>' . $user_ratio . '</td>
'; ';
break; break;

View file

@ -11,14 +11,14 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__)); die(basename(__FILE__));
} }
global $userdata, $lang, $bb_cfg; global $userdata, $lang;
$mode = (string)$this->request['mode']; $mode = (string)$this->request['mode'];
switch ($mode) { switch ($mode) {
case 'clear_cache': 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)) { if (!in_array('db_sqlite', $cache_val)) {
OLD_CACHE($cache_name)->rm(); OLD_CACHE($cache_name)->rm();
} }
@ -59,20 +59,20 @@ switch ($mode) {
case 'indexer': 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")) { if (!is_file(config('tp.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); 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) { 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(config('tp.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);
$this->response['indexer_html'] = '<span class="seed bold">' . $lang['INDEXER'] . '</span>'; $this->response['indexer_html'] = '<span class="seed bold">' . $lang['INDEXER'] . '</span>';

View file

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

View file

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

View file

@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__)); die(basename(__FILE__));
} }
global $lang, $bb_cfg, $userdata; global $lang, $userdata;
if (!isset($this->request['type'])) { if (!isset($this->request['type'])) {
$this->ajax_die('empty type'); $this->ajax_die('empty type');
@ -129,10 +129,10 @@ switch ($this->request['type']) {
if (mb_strlen($text) > 2) { if (mb_strlen($text) > 2) {
if ($text != $post['post_text']) { if ($text != $post['post_text']) {
if ($bb_cfg['max_smilies']) { if (config('tp.max_smilies')) {
$count_smilies = substr_count(bbcode2html($text), '<img class="smile" src="' . $bb_cfg['smilies_path']); $count_smilies = substr_count(bbcode2html($text), '<img class="smile" src="' . config('tp.smilies_path'));
if ($count_smilies > $bb_cfg['max_smilies']) { if ($count_smilies > config('tp.max_smilies')) {
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['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"); 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"; $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 ($row = OLD_DB()->fetch_row($sql) and $row['last_post_time']) {
if ($userdata['user_level'] == USER) { 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']); $this->ajax_die($lang['FLOOD_ERROR']);
} }
} }
@ -260,10 +260,10 @@ switch ($this->request['type']) {
} }
} }
if ($bb_cfg['max_smilies']) { if (config('tp.max_smilies')) {
$count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="' . $bb_cfg['smilies_path']); $count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="' . config('tp.smilies_path'));
if ($count_smilies > $bb_cfg['max_smilies']) { if ($count_smilies > config('tp.max_smilies')) {
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['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, 'post_text' => $message,
)); ));
if ($bb_cfg['topic_notify_enabled']) { if (config('tp.topic_notify_enabled')) {
$notify = !empty($this->request['notify']); $notify = !empty($this->request['notify']);
user_notification('reply', $post, $post['topic_title'], $post['forum_id'], $topic_id, $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__)); die(basename(__FILE__));
} }
global $bb_cfg, $lang; global $lang;
$mode = (string)$this->request['mode']; $mode = (string)$this->request['mode'];
$map = new TorrentPier\Legacy\Sitemap(); $map = new TorrentPier\Legacy\Sitemap();
@ -21,7 +21,7 @@ switch ($mode) {
case 'create': case 'create':
$map->createSitemap(); $map->createSitemap();
if (file_exists(SITEMAP_DIR . '/sitemap.xml')) { 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 { } else {
$html .= $lang['SITEMAP_NOT_CREATED']; $html .= $lang['SITEMAP_NOT_CREATED'];
} }

View file

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

View file

@ -26,11 +26,11 @@ if (defined('ATTACH_INSTALL')) {
*/ */
function attach_mod_get_lang($language_file) 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)) { 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'; $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() function get_config()
{ {
global $bb_cfg;
$attach_config = array(); $attach_config = array();
$sql = 'SELECT * FROM ' . BB_ATTACH_CONFIG; $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 // 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; return $attach_config;
} }

View file

@ -11,7 +11,7 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__)); 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; $change_peers_bgr_over = true;
$bgr_class_1 = 'row1'; $bgr_class_1 = 'row1';
@ -39,7 +39,7 @@ $template->assign_vars(array(
)); ));
// Define show peers mode (count only || user names with complete % || full details) // 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'] ?? ''; $get_sp_mode = $_GET['spmode'] ?? '';
$s_mode = 'count'; $s_mode = 'count';
@ -50,7 +50,7 @@ if ($cfg_sp_mode == SHOW_PEERS_NAMES) {
$s_mode = 'full'; $s_mode = 'full';
} }
if ($bb_cfg['bt_allow_spmode_change']) { if (config('tp.bt_allow_spmode_change')) {
if ($get_sp_mode == 'names') { if ($get_sp_mode == 'names') {
$s_mode = 'names'; $s_mode = 'names';
} elseif ($get_sp_mode == 'full') { } 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_file_time = bb_date($attachments['_' . $post_id][$i]['filetime']);
$tor_reged = (bool)$tracker_status; $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); $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'])); $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; $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) { if (!$tor_reged) {
$template->assign_block_vars('postrow.attach.tor_not_reged', array( $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']); $tor_magnet = create_magnet($tor_info['info_hash'], $passkey['auth_key'], $userdata['session_logged_in']);
// ratio limits // ratio limits
$min_ratio_dl = $bb_cfg['bt_min_ratio_allow_dl_tor']; $min_ratio_dl = config('tp.bt_min_ratio_allow_dl_tor');
$min_ratio_warn = $bb_cfg['bt_min_ratio_warning']; $min_ratio_warn = config('tp.bt_min_ratio_warning');
$dl_allowed = true; $dl_allowed = true;
$user_ratio = 0; $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)) { 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( $template->assign_vars(array(
'SHOW_RATIO_WARN' => true, '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, 'TOR_SILVER_GOLD' => $tor_type,
// torrent status mod // 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_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_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_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 //end torrent status mod
'S_UPLOAD_IMAGE' => $upload_image, '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( $template->assign_vars(array(
'SHOW_DL_LIST' => true, 'SHOW_DL_LIST' => true,
'SHOW_DL_LIST_TOR_INFO' => 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( $template->assign_vars(array(
'PEERS_FULL_LINK' => true, 'PEERS_FULL_LINK' => true,
'SPMODE_FULL_HREF' => "viewtopic.php?" . POST_TOPIC_URL . "=$bt_topic_id&amp;spmode=full#seeders", '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( $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_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 && (!isset($bb_cfg['tor_no_tor_act'][$tor_info['tor_status']]) || IS_AM)), '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_COUNT' => $s_mode == 'count',
'S_MODE_NAMES' => ($s_mode == 'names'), 'S_MODE_NAMES' => $s_mode == 'names',
'S_MODE_FULL' => ($s_mode == 'full'), 'S_MODE_FULL' => $s_mode == 'full',
'PEER_EXIST' => ($seeders || $leechers || defined('SEEDER_EXIST') || defined('LEECHER_EXIST')), 'PEER_EXIST' => $seeders || $leechers || defined('SEEDER_EXIST') || defined('LEECHER_EXIST'),
'SEED_EXIST' => ($seeders || defined('SEEDER_EXIST')), 'SEED_EXIST' => $seeders || defined('SEEDER_EXIST'),
'LEECH_EXIST' => ($leechers || defined('LEECHER_EXIST')), 'LEECH_EXIST' => $leechers || defined('LEECHER_EXIST'),
'TOR_HELP_LINKS' => $bb_cfg['tor_help_links'], 'TOR_HELP_LINKS' => config('tp.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)), '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 // Either in a window or inline
function generate_smilies($mode) function generate_smilies($mode)
{ {
global $bb_cfg, $template, $lang, $user, $datastore; global $template, $lang, $user, $datastore;
$inline_columns = 4; $inline_columns = 4;
$inline_rows = 7; $inline_rows = 7;
@ -144,7 +144,7 @@ function generate_smilies($mode)
$template->assign_block_vars('smilies_row.smilies_col', array( $template->assign_block_vars('smilies_row.smilies_col', array(
'SMILEY_CODE' => $data['code'], 'SMILEY_CODE' => $data['code'],
'SMILEY_IMG' => $bb_cfg['smilies_path'] . '/' . $smile_url, 'SMILEY_IMG' => config('tp.smilies_path') . '/' . $smile_url,
'SMILEY_DESC' => $data['emoticon'], 'SMILEY_DESC' => $data['emoticon'],
)); ));
@ -325,11 +325,9 @@ function strip_bbcode($message, $stripquotes = true, $fast_and_dirty = false, $s
function extract_search_words($text) function extract_search_words($text)
{ {
global $bb_cfg; $max_words_count = config('tp.max_search_words_per_post');
$min_word_len = max(2, config('tp.search_min_word_len') - 1);
$max_words_count = $bb_cfg['max_search_words_per_post']; $max_word_len = config('tp.search_max_word_len');
$min_word_len = max(2, $bb_cfg['search_min_word_len'] - 1);
$max_word_len = $bb_cfg['search_max_word_len'];
$text = ' ' . str_compact(strip_tags(mb_strtolower($text))) . ' '; $text = ' ' . str_compact(strip_tags(mb_strtolower($text))) . ' ';
$text = str_replace(array('&#91;', '&#93;'), array('[', ']'), $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) function add_search_words($post_id, $post_message, $topic_title = '', $only_return_words = false)
{ {
global $bb_cfg;
$text = $topic_title . ' ' . $post_message; $text = $topic_title . ' ' . $post_message;
$words = ($text) ? extract_search_words($text) : array(); $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); return implode("\n", $words);
} }
@ -421,22 +417,19 @@ function get_words_rate($text)
function hide_passkey($str) function hide_passkey($str)
{ {
global $bb_cfg; return preg_replace("#\?" . config('tp.passkey_key') . "=[a-zA-Z0-9]{" . BT_AUTH_KEY_LENGTH . "}#", "?" . config('tp.passkey_key') . "=passkey", $str);
return preg_replace("#\?{$bb_cfg['passkey_key']}=[a-zA-Z0-9]{" . BT_AUTH_KEY_LENGTH . "}#", "?{$bb_cfg['passkey_key']}=passkey", $str);
} }
function get_parsed_post($postrow, $mode = 'full', $return_chars = 600) function get_parsed_post($postrow, $mode = 'full', $return_chars = 600)
{ {
global $bb_cfg; if (config('tp.use_posts_cache') && !empty($postrow['post_html'])) {
if ($bb_cfg['use_posts_cache'] && !empty($postrow['post_html'])) {
return $postrow['post_html']; return $postrow['post_html'];
} }
$message = bbcode2html($postrow['post_text']); $message = bbcode2html($postrow['post_text']);
// Posts cache // Posts cache
if ($bb_cfg['use_posts_cache']) { if (config('tp.use_posts_cache')) {
OLD_DB()->shutdown['post_html'][] = array( OLD_DB()->shutdown['post_html'][] = array(
'post_id' => (int)$postrow['post_id'], 'post_id' => (int)$postrow['post_id'],
'post_html' => (string)$message, 'post_html' => (string)$message,

View file

@ -19,7 +19,7 @@ sync('user_posts', 'all');
sync_all_forums(); sync_all_forums();
// Чистка bb_poll_users // Чистка 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; $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); $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']; $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)); 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)"); 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; 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')) { if (method_exists(OLD_CACHE($cache_name), 'gc')) {
$changes = 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"; $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 // Delete staled dl-status records
$keeping_dlstat = array( $keeping_dlstat = array(
DL_STATUS_WILL => (int)$bb_cfg['dl_will_days_keep'], DL_STATUS_WILL => (int)config('tp.dl_will_days_keep'),
DL_STATUS_DOWN => (int)$bb_cfg['dl_down_days_keep'], DL_STATUS_DOWN => (int)config('tp.dl_down_days_keep'),
DL_STATUS_COMPLETE => (int)$bb_cfg['dl_complete_days_keep'], DL_STATUS_COMPLETE => (int)config('tp.dl_complete_days_keep'),
DL_STATUS_CANCEL => (int)$bb_cfg['dl_cancel_days_keep'], DL_STATUS_CANCEL => (int)config('tp.dl_cancel_days_keep'),
); );
$delete_dlstat_sql = array(); $delete_dlstat_sql = array();
@ -51,7 +51,7 @@ OLD_DB()->query("
"); ");
// Tor-Stats cleanup // 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)"); 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__)); die(basename(__FILE__));
} }
$log_days_keep = (int)$bb_cfg['log_days_keep']; $log_days_keep = (int)config('tp.log_days_keep');
OLD_DB()->query(" OLD_DB()->query("
DELETE FROM " . BB_LOG . " DELETE FROM " . BB_LOG . "

View file

@ -13,7 +13,7 @@ if (!defined('BB_ROOT')) {
require_once INC_DIR . '/functions_admin.php'; 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"; $sql = "SELECT forum_id, prune_days FROM " . BB_FORUMS . " WHERE prune_days != 0";
foreach (OLD_DB()->fetch_rowset($sql) as $row) { 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(); $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 . " $sql = OLD_DB()->fetch_rowset("SELECT user_id FROM " . BB_USERS . "
WHERE user_level = 0 WHERE user_level = 0
AND user_lastvisit = 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 . " $sql = OLD_DB()->fetch_rowset("SELECT user_id FROM " . BB_USERS . "
WHERE user_level = 0 WHERE user_level = 0
AND user_posts = 0 AND user_posts = 0

View file

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

View file

@ -11,10 +11,10 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__)); die(basename(__FILE__));
} }
$user_session_expire_time = TIMENOW - (int)$bb_cfg['user_session_duration']; $user_session_expire_time = TIMENOW - (int)config('tp.user_session_duration');
$admin_session_expire_time = TIMENOW - (int)$bb_cfg['admin_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; $admin_session_gc_time = $admin_session_expire_time;
// ############################ Tables LOCKED ################################ // ############################ 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); OLD_DB()->expect_slow_query(600);
// Update dlstat (part 1) // Update dlstat (part 1)
if ($bb_cfg['tracker']['update_dlstat']) { if (config('tracker.update_dlstat')) {
// ############################ Tables LOCKED ################################ // ############################ Tables LOCKED ################################
OLD_DB()->lock(array( OLD_DB()->lock(array(
BB_BT_TRACKER, BB_BT_TRACKER,
@ -64,16 +64,16 @@ OLD_DB()->query("
"); ");
// Clean peers table // Clean peers table
if ($bb_cfg['tracker']['autoclean']) { if (config('tracker.autoclean')) {
$announce_interval = max((int)$bb_cfg['announce_interval'], 60); $announce_interval = max((int)config('tp.announce_interval'), 60);
$expire_factor = max((float)$bb_cfg['tracker']['expire_factor'], 1); $expire_factor = max((float)config('tracker.expire_factor'), 1);
$peer_expire_time = TIMENOW - floor($announce_interval * $expire_factor); $peer_expire_time = TIMENOW - floor($announce_interval * $expire_factor);
OLD_DB()->query("DELETE FROM " . BB_BT_TRACKER . " WHERE update_time < $peer_expire_time"); OLD_DB()->query("DELETE FROM " . BB_BT_TRACKER . " WHERE update_time < $peer_expire_time");
} }
// Update dlstat (part 2) // Update dlstat (part 2)
if ($bb_cfg['tracker']['update_dlstat']) { if (config('tracker.update_dlstat')) {
// Set "only 1 seeder" bonus // Set "only 1 seeder" bonus
OLD_DB()->query(" OLD_DB()->query("
UPDATE UPDATE

View file

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

View file

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

View file

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

View file

@ -13,7 +13,7 @@ if (!defined('BB_ROOT')) {
OLD_DB()->expect_slow_query(600); 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(" OLD_DB()->query("
CREATE TEMPORARY TABLE tmp_bonus ( CREATE TEMPORARY TABLE tmp_bonus (
user_id INT UNSIGNED NOT NULL DEFAULT '0', 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 ) 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 OLD_DB()->query("INSERT INTO tmp_bonus
SELECT bt.user_id, count(bt.seeder) AS release_count 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 GROUP BY user_id
"); ");
$seed_bonus = unserialize($bb_cfg['seed_bonus_points']); $seed_bonus = unserialize(config('tp.seed_bonus_points'));
$seed_release = unserialize($bb_cfg['seed_bonus_release']); $seed_release = unserialize(config('tp.seed_bonus_release'));
foreach ($seed_bonus as $i => $points) { foreach ($seed_bonus as $i => $points) {
if (!$points || !$seed_release[$i]) { 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); $user_points = ((float)$points / 4);
$release = (int)$seed_release[$i]; $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(" OLD_DB()->query("
UPDATE " . BB_USERS . " u, " . BB_BT_USERS . " bu, tmp_bonus b UPDATE " . BB_USERS . " u, " . BB_BT_USERS . " bu, tmp_bonus b

View file

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

View file

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

View file

@ -11,16 +11,14 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__)); die(basename(__FILE__));
} }
global $bb_cfg; $smilies = [];
$smilies = array();
$rowset = OLD_DB()->fetch_rowset("SELECT * FROM " . BB_SMILIES); $rowset = OLD_DB()->fetch_rowset("SELECT * FROM " . BB_SMILIES);
sort($rowset); sort($rowset);
foreach ($rowset as $smile) { foreach ($rowset as $smile) {
$smilies['orig'][] = '#(?<=^|\W)' . preg_quote($smile['code'], '#') . '(?=$|\W)#'; $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; $smilies['smile'][] = $smile;
} }

View file

@ -11,9 +11,7 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__)); die(basename(__FILE__));
} }
global $bb_cfg; $data = [];
$data = array();
// usercount // usercount
$row = OLD_DB()->fetch_row("SELECT COUNT(*) AS usercount FROM " . BB_USERS . " WHERE user_id NOT IN(" . EXCLUDED_USERS . ")"); $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']); $data['topiccount'] = number_format($row['topiccount']);
// Tracker stats // Tracker stats
if ($bb_cfg['tor_stats']) { if (config('tp.tor_stats')) {
// torrents stat // torrents stat
$row = OLD_DB()->fetch_row("SELECT COUNT(topic_id) AS torrentcount, SUM(size) AS size FROM " . BB_BT_TORRENTS); $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']); $data['torrentcount'] = number_format($row['torrentcount']);
@ -44,7 +42,7 @@ if ($bb_cfg['tor_stats']) {
} }
// gender stat // 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 . ")"); $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 . ")"); $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 . ")"); $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 // 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 $sql = OLD_DB()->fetch_rowset("SELECT user_id, username, user_rank , user_birthday
FROM " . BB_USERS . " FROM " . BB_USERS . "
WHERE user_id NOT IN(" . EXCLUDED_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_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(); $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) function get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div)
{ {
global $bb_cfg; $ext = config('tp.file_id_ext.' . $ext_id) ?? '';
$ext = $bb_cfg['file_id_ext'][$ext_id] ?? '';
return ($base_path ? "$base_path/" : '') . floor($id / $first_div) . '/' . ($id % $sec_div) . '/' . $id . ($ext ? ".$ext" : ''); 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) function get_avatar_path($id, $ext_id, $base_path = null, $first_div = 10000, $sec_div = 100)
{ {
global $bb_cfg; $base_path = $base_path ?? config('tp.avatars.upload_path');
$base_path = $base_path ?? $bb_cfg['avatars']['upload_path'];
return get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div); 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) function get_attach_path($id, $ext_id = '', $base_path = null, $first_div = 10000, $sec_div = 100)
{ {
global $bb_cfg; $base_path = $base_path ?? config('tp.attach.upload_path');
$base_path = $base_path ?? $bb_cfg['attach']['upload_path'];
return get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div); 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 = '') function bt_show_ip($ip, $port = '')
{ {
global $bb_cfg;
if (IS_AM) { if (IS_AM) {
$ip = decode_ip($ip); $ip = decode_ip($ip);
$ip .= ($port) ? ":$port" : ''; $ip .= ($port) ? ":$port" : '';
return $ip; 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) function bt_show_port($port)
{ {
global $bb_cfg;
if (IS_AM) { if (IS_AM) {
return $port; 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) 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}")) { if ($from_db or !$cfg = OLD_CACHE('bb_config')->get("config_{$table}")) {
$cfg = array(); $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']; $cfg[$row['config_name']] = $row['config_value'];
} }
if ($update_cache) { if ($update_cache) {
@ -1075,14 +1068,14 @@ function get_forum_select($mode = 'guest', $name = POST_FORUM_URL, $selected = n
function setup_style() function setup_style()
{ {
global $bb_cfg, $template, $userdata; global $template, $userdata;
// AdminCP works only with default template // AdminCP works only with default template
$tpl_dir_name = defined('IN_ADMIN') ? 'default' : basename($bb_cfg['tpl_name']); $tpl_dir_name = defined('IN_ADMIN') ? 'default' : basename(config('tp.tpl_name'));
$stylesheet = defined('IN_ADMIN') ? 'main.css' : basename($bb_cfg['stylesheet']); $stylesheet = defined('IN_ADMIN') ? 'main.css' : basename(config('tp.stylesheet'));
if (!IS_GUEST && !empty($userdata['tpl_name'])) { 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) { if ($userdata['tpl_name'] == $folder) {
$tpl_dir_name = basename($userdata['tpl_name']); $tpl_dir_name = basename($userdata['tpl_name']);
} }
@ -1096,7 +1089,7 @@ function setup_style()
'BB_ROOT' => BB_ROOT, 'BB_ROOT' => BB_ROOT,
'SPACER' => make_url('styles/images/spacer.gif'), 'SPACER' => make_url('styles/images/spacer.gif'),
'STYLESHEET' => make_url($css_dir . $stylesheet), '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), 'TPL_DIR' => make_url($css_dir),
'SITE_URL' => make_url('/'), 'SITE_URL' => make_url('/'),
)); ));
@ -1109,19 +1102,19 @@ function setup_style()
// Create date / time with format and friendly date // Create date / time with format and friendly date
function bb_date($gmepoch, $format = false, $friendly_date = true) function bb_date($gmepoch, $format = false, $friendly_date = true)
{ {
global $bb_cfg, $lang, $userdata; global $lang, $userdata;
$gmepoch = (int)$gmepoch; $gmepoch = (int)$gmepoch;
if (!$format) { if (!$format) {
$format = $bb_cfg['default_dateformat']; $format = config('tp.default_dateformat');
} }
if (empty($lang)) { 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'])) { if (empty($userdata['session_logged_in'])) {
$tz = $bb_cfg['board_timezone']; $tz = config('tp.board_timezone');
} else { } else {
$tz = $userdata['user_timezone']; $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) function birthday_age($date)
{ {
global $bb_cfg;
if (!$date) { if (!$date) {
return; return;
} }
$tz = TIMENOW + (3600 * $bb_cfg['board_timezone']); $tz = TIMENOW + (3600 * config('tp.board_timezone'));
return delta_time(strtotime($date, $tz)); return delta_time(strtotime($date, $tz));
} }
@ -1290,9 +1282,7 @@ function bb_preg_quote($str, $delimiter)
// //
function obtain_word_list(&$orig_word, &$replacement_word) function obtain_word_list(&$orig_word, &$replacement_word)
{ {
global $bb_cfg; if (!config('tp.use_word_censor')) {
if (!$bb_cfg['use_word_censor']) {
return; return;
} }
@ -1315,7 +1305,7 @@ function obtain_word_list(&$orig_word, &$replacement_word)
function bb_die($msg_text) function bb_die($msg_text)
{ {
global $ajax, $bb_cfg, $lang, $template, $theme, $userdata; global $ajax, $lang, $template, $theme, $userdata;
if (defined('IN_AJAX')) { if (defined('IN_AJAX')) {
$ajax->ajax_die($msg_text); $ajax->ajax_die($msg_text);
@ -1330,7 +1320,7 @@ function bb_die($msg_text)
// If empty lang // If empty lang
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 // If empty session
@ -1341,7 +1331,7 @@ function bb_die($msg_text)
// If the header hasn't been output then do it // If the header hasn't been output then do it
if (!defined('PAGE_HEADER_SENT')) { if (!defined('PAGE_HEADER_SENT')) {
if (empty($template)) { 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)) { if (empty($theme)) {
$theme = setup_style(); $theme = setup_style();
@ -1369,8 +1359,6 @@ function bb_die($msg_text)
function bb_simple_die($txt) function bb_simple_die($txt)
{ {
global $bb_cfg;
if (!empty($_COOKIE['explain'])) { if (!empty($_COOKIE['explain'])) {
bb_die("bb_simple_die:<br /><br />$txt"); bb_die("bb_simple_die:<br /><br />$txt");
} }
@ -1386,7 +1374,7 @@ function bb_realpath($path)
function redirectToLogin($url = '') 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) function meta_refresh($url, $time = 5)
@ -1398,8 +1386,6 @@ function meta_refresh($url, $time = 5)
function redirectToUrl($url) function redirectToUrl($url)
{ {
global $bb_cfg;
if (headers_sent($filename, $linenum)) { if (headers_sent($filename, $linenum)) {
trigger_error("Headers already sent in $filename($linenum)", E_USER_ERROR); trigger_error("Headers already sent in $filename($linenum)", E_USER_ERROR);
} }
@ -1409,11 +1395,11 @@ function redirectToUrl($url)
} }
$url = trim($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_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim(config('tp.server_name')));
$server_port = ($bb_cfg['server_port'] <> 80) ? ':' . trim($bb_cfg['server_port']) : ''; $server_port = (config('tp.server_port') <> 80) ? ':' . trim(config('tp.server_port')) : '';
$script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($bb_cfg['script_path'])); $script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim(config('tp.script_path')));
if ($script_name) { if ($script_name) {
$script_name = "/$script_name"; $script_name = "/$script_name";
@ -1609,9 +1595,9 @@ function cat_exists($cat_id)
function get_topic_icon($topic, $is_unread = null) 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']); $is_unread = $is_unread ?? is_unread($topic['topic_last_post_time'], $topic['topic_id'], $topic['forum_id']);
if ($topic['topic_status'] == TOPIC_MOVED) { if ($topic['topic_status'] == TOPIC_MOVED) {
@ -1699,8 +1685,7 @@ function get_poll_data_items_js($topic_id)
function poll_is_active($t_data) function poll_is_active($t_data)
{ {
global $bb_cfg; return ($t_data['topic_vote'] == 1 && $t_data['topic_time'] > TIMENOW - config('tp.poll_max_days') * 86400);
return ($t_data['topic_vote'] == 1 && $t_data['topic_time'] > TIMENOW - $bb_cfg['poll_max_days'] * 86400);
} }
function print_confirmation($tpl_vars) 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) function clean_text_match($text, $ltrim_star = true, $die_if_empty = false)
{ {
global $bb_cfg, $lang; global $lang;
$text = str_compact($text); $text = str_compact($text);
$ltrim_chars = ($ltrim_star) ? ' *-!' : ' '; $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)) . ' '; $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('#(?<=\S)\-#u', ' ', $text); // "1-2-3" -> "1 2 3"
$text = preg_replace('#[^0-9a-zA-Zа-яА-ЯёЁ\-_*|]#u', ' ', $text); // допустимые символы (кроме " которые отдельно) $text = preg_replace('#[^0-9a-zA-Zа-яА-ЯёЁ\-_*|]#u', ' ', $text); // допустимые символы (кроме " которые отдельно)
$text = str_replace('-', ' -', $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()) 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 = []; $where_ids = [];
if ($forum_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); $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(); $sphinx = init_sphinx();
$where = $title_match ? 'topics' : 'posts'; $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) { if ($forum_ids) {
$sphinx->setFilter('forum_id', $forum_ids, false); $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()) { if ($warning = $sphinx->getLastWarning()) {
log_sphinx_error('wrn', $warning, $title_match_sql); 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) . ")" : ''; $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) { if ($title_match) {
$where_id = 'topic_id'; $where_id = 'topic_id';
@ -1915,10 +1900,10 @@ function pad_with_space($str)
function create_magnet($infohash, $auth_key, $logged_in) 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"; $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($bb_cfg['bt_announce_url'] . $passkey_url) . '"><img src="' . $images['icon_magnet'] . '" width="12" height="12" border="0" /></a>'; 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) 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) function profile_url($data)
{ {
global $bb_cfg, $lang, $datastore; global $lang, $datastore;
if (!$ranks = $datastore->get('ranks')) { if (!$ranks = $datastore->get('ranks')) {
$datastore->update('ranks'); $datastore->update('ranks');
@ -1991,7 +1976,7 @@ function profile_url($data)
$style = 'colorUser'; $style = 'colorUser';
} }
if (!$bb_cfg['color_nick']) { if (!config('tp.color_nick')) {
$style = ''; $style = '';
} }
@ -2009,22 +1994,16 @@ function profile_url($data)
function get_avatar($user_id, $ext_id, $allow_avatar = true, $size = true, $height = '', $width = '') 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 . '"' : ''; $height = !$height ? 'height="' . $height . '"' : '';
$width = !$width ? 'width="' . $width . '"' : ''; $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']) { if ($user_id == BOT_UID && config('tp.avatars.bot_avatar')) {
$user_avatar = '<img src="' . make_url($bb_cfg['avatars']['display_path'] . $bb_cfg['avatars']['bot_avatar']) . '" alt="' . $user_id . '" ' . $height . ' ' . $width . ' />'; $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) { } elseif ($allow_avatar && $ext_id) {
if (file_exists(get_avatar_path($user_id, $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) function gender_image($gender)
{ {
global $bb_cfg, $lang, $images; global $lang, $images;
if (!$bb_cfg['gender']) { if (!config('tp.gender')) {
$user_gender = ''; $user_gender = '';
return $user_gender; return $user_gender;
} }
@ -2057,9 +2036,9 @@ function gender_image($gender)
function is_gold($type) 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 = ''; $is_gold = '';
return $is_gold; return $is_gold;
} }
@ -2124,11 +2103,11 @@ function hash_search($hash)
*/ */
function bb_captcha($mode, $callback = '') function bb_captcha($mode, $callback = '')
{ {
global $bb_cfg, $lang; global $lang;
$secret = $bb_cfg['captcha']['secret_key']; $secret = config('tp.captcha.secret_key');
$public = $bb_cfg['captcha']['public_key']; $public = config('tp.captcha.public_key');
$cp_theme = $bb_cfg['captcha']['theme']; $cp_theme = config('tp.captcha.theme');
if (!$public && !$secret) { if (!$public && !$secret) {
bb_die($lang['CAPTCHA_SETTINGS']); 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) function user_delete($user_id, $delete_posts = false)
{ {
global $bb_cfg, $log_action; global $log_action;
if (!$user_csv = get_id_csv($user_id)) { if (!$user_csv = get_id_csv($user_id)) {
return false; return false;
@ -728,7 +728,7 @@ function user_delete($user_id, $delete_posts = false)
// Delete user feed // Delete user feed
foreach (explode(',', $user_csv) as $user_id) { 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); @unlink($file_path);
} }
} }

View file

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

View file

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

View file

@ -16,7 +16,7 @@ if (!defined('BB_ROOT')) {
// //
function prepare_post(&$mode, &$post_data, &$error_msg, &$username, &$subject, &$message) function prepare_post(&$mode, &$post_data, &$error_msg, &$username, &$subject, &$message)
{ {
global $bb_cfg, $user, $userdata, $lang; global $user, $userdata, $lang;
// Check username // Check username
if (!empty($username)) { if (!empty($username)) {
@ -47,10 +47,10 @@ function prepare_post(&$mode, &$post_data, &$error_msg, &$username, &$subject, &
} }
// Check smilies limit // Check smilies limit
if ($bb_cfg['max_smilies']) { if (config('tp.max_smilies')) {
$count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="' . $bb_cfg['smilies_path']); $count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="' . config('tp.smilies_path'));
if ($count_smilies > $bb_cfg['max_smilies']) { if ($count_smilies > config('tp.max_smilies')) {
$to_many_smilies = sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['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; $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) 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; $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 ($row = OLD_DB()->fetch_row($sql) && $row['last_post_time']) {
if ($userdata['user_level'] == USER) { 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']); 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']) { if (config('tp.show_latest_news')) {
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id'])); $news_forums = array_flip(explode(',', config('tp.latest_news_forum_id')));
if (isset($news_forums[$forum_id]) && $bb_cfg['show_latest_news'] && $mode == 'newtopic') { if (isset($news_forums[$forum_id]) && config('tp.show_latest_news') && $mode == 'newtopic') {
$datastore->enqueue('latest_news'); $datastore->enqueue('latest_news');
$datastore->update('latest_news'); $datastore->update('latest_news');
} }
} }
if ($bb_cfg['show_network_news']) { if (config('tp.show_network_news')) {
$net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id'])); $net_forums = array_flip(explode(',', config('tp.network_news_forum_id')));
if (isset($net_forums[$forum_id]) && $bb_cfg['show_network_news'] && $mode == 'newtopic') { if (isset($net_forums[$forum_id]) && config('tp.show_network_news') && $mode == 'newtopic') {
$datastore->enqueue('network_news'); $datastore->enqueue('network_news');
$datastore->update('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) 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; return;
} }
@ -329,14 +329,14 @@ function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topi
/** @var TorrentPier\Legacy\Emailer() $emailer */ /** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\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_to([$row['user_email'] => $row['username']]);
$emailer->set_subject(sprintf($lang['EMAILER_SUBJECT']['TOPIC_NOTIFY'], $topic_title)); $emailer->set_subject(sprintf($lang['EMAILER_SUBJECT']['TOPIC_NOTIFY'], $topic_title));
$emailer->set_template('topic_notify', $row['user_lang']); $emailer->set_template('topic_notify', $row['user_lang']);
$emailer->assign_vars(array( $emailer->assign_vars(array(
'TOPIC_TITLE' => html_entity_decode($topic_title), 'TOPIC_TITLE' => html_entity_decode($topic_title),
'SITENAME' => $bb_cfg['sitename'], 'SITENAME' => config('tp.sitename'),
'USERNAME' => $row['username'], 'USERNAME' => $row['username'],
'U_TOPIC' => $u_topic, 'U_TOPIC' => $u_topic,
'U_STOP_WATCHING_TOPIC' => $unwatch_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) function topic_review($topic_id)
{ {
global $bb_cfg, $template; global $template;
// Fetch posts data // Fetch posts data
$review_posts = OLD_DB()->fetch_rowset(" $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) LEFT JOIN " . BB_POSTS_HTML . " h ON(h.post_id = p.post_id)
WHERE p.topic_id = " . (int)$topic_id . " WHERE p.topic_id = " . (int)$topic_id . "
ORDER BY p.post_time DESC ORDER BY p.post_time DESC
LIMIT " . $bb_cfg['posts_per_page'] . " LIMIT " . config('tp.posts_per_page') . "
"); ");
// Topic posts block // Topic posts block
@ -467,7 +467,7 @@ function topic_review($topic_id)
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2', 'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
'POSTER' => profile_url($post), 'POSTER' => profile_url($post),
'POSTER_NAME_JS' => addslashes($post['username']), '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), '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') function templates_select($default_style, $select_name = 'tpl_name')
{ {
global $bb_cfg;
$templates_select = '<select name="' . $select_name . '">'; $templates_select = '<select name="' . $select_name . '">';
$x = 0; $x = 0;
foreach ($bb_cfg['templates'] as $folder => $name) { foreach (config('tp.templates') as $folder => $name) {
$selected = ''; $selected = '';
if ($folder == $default_style) { if ($folder == $default_style) {
$selected = ' selected="selected"'; $selected = ' selected="selected"';
@ -70,5 +68,6 @@ function templates_select($default_style, $select_name = 'tpl_name')
$x++; $x++;
} }
$templates_select .= '</select>'; $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 = '') function tracker_unregister($attach_id, $mode = '')
{ {
global $lang, $bb_cfg; global $lang;
$attach_id = (int)$attach_id; $attach_id = (int)$attach_id;
$post_id = $topic_id = $forum_id = $info_hash = null; $post_id = $topic_id = $forum_id = $info_hash = null;
@ -99,7 +99,7 @@ function tracker_unregister($attach_id, $mode = '')
} }
// Unset DL-Type for topic // 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"; $sql = "UPDATE " . BB_TOPICS . " SET topic_dl_type = " . TOPIC_DL_TYPE_NORMAL . " WHERE topic_id = $topic_id";
if (!$result = OLD_DB()->sql_query($sql)) { if (!$result = OLD_DB()->sql_query($sql)) {
@ -115,7 +115,7 @@ function tracker_unregister($attach_id, $mode = '')
} }
// Ocelot // 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")) { 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']; $info_hash = $row['info_hash'];
} }
@ -196,7 +196,7 @@ function change_tor_status($attach_id, $new_tor_status)
// Set gold/silver type for torrent // Set gold/silver type for torrent
function change_tor_type($attach_id, $tor_status_gold) 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)) { if (!$torrent = get_torrent_info($attach_id)) {
bb_die($lang['TOR_NOT_FOUND']); 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"); OLD_DB()->query("UPDATE " . BB_BT_TORRENTS . " SET tor_type = $tor_status_gold WHERE topic_id = $topic_id");
// Ocelot // 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")) { 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']; $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) 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; $attach_id = (int)$attach_id;
$reg_mode = $mode; $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'); 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; $tor['info']['private'] = (int)1;
$fp = fopen($filename, 'wb+'); $fp = fopen($filename, 'wb+');
fwrite($fp, \Rych\Bencode\Bencode::encode($tor)); fwrite($fp, \Rych\Bencode\Bencode::encode($tor));
fclose($fp); fclose($fp);
} }
if ($bb_cfg['bt_check_announce_url']) { if (config('tp.bt_check_announce_url')) {
include INC_DIR . '/torrent_announce_urls.php'; include INC_DIR . '/torrent_announce_urls.php';
$ann = (@$tor['announce']) ? $tor['announce'] : ''; $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)) { if (!$ann || !in_array($ann, $announce_urls)) {
$msg = sprintf($lang['INVALID_ANN_URL'], htmlspecialchars($ann), $announce_urls['main_url']); $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); $info_hash_md5 = md5($info_hash);
// Ocelot // 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)); 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 // 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"; $sql = 'UPDATE ' . BB_TOPICS . ' SET topic_dl_type = ' . TOPIC_DL_TYPE_DL . " WHERE topic_id = $topic_id";
if (!$result = OLD_DB()->sql_query($sql)) { 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"); 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) 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; return;
} }
@ -380,8 +380,8 @@ function send_torrent_with_passkey($filename)
$user_id = $userdata['user_id']; $user_id = $userdata['user_id'];
$attach_id = $attachment['attach_id']; $attach_id = $attachment['attach_id'];
if (!$passkey_key = $bb_cfg['passkey_key']) { if (!$passkey_key = config('tp.passkey_key')) {
bb_die('Could not add passkey (wrong config $bb_cfg[\'passkey_key\'])'); bb_die('Could not add passkey (wrong config $cfg[\'passkey_key\'])');
} }
// Get $post_id & $poster_id // Get $post_id & $poster_id
@ -416,13 +416,13 @@ function send_torrent_with_passkey($filename)
if (!$passkey_val) { if (!$passkey_val) {
if (!$passkey_val = generate_passkey($user_id)) { if (!$passkey_val = generate_passkey($user_id)) {
bb_simple_die('Could not generate passkey'); 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)); ocelot_update_tracker('add_user', array('id' => $user_id, 'passkey' => $passkey_val));
} }
} }
// Ratio limits // 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 ($min_ratio && $user_id != $poster_id && ($user_ratio = get_bt_ratio($bt_userdata)) !== null) {
if ($user_ratio < $min_ratio && $post_id) { if ($user_ratio < $min_ratio && $post_id) {
@ -441,43 +441,46 @@ function send_torrent_with_passkey($filename)
} }
// Announce URL // Announce URL
$ann_url = $bb_cfg['bt_announce_url']; $ann_url = config('tp.bt_announce_url');
$file_contents = file_get_contents($filename); $file_contents = file_get_contents($filename);
if (!$tor = \Rych\Bencode\Bencode::decode($file_contents)) { if (!$tor = \Rych\Bencode\Bencode::decode($file_contents)) {
bb_die('This is not a bencoded file'); 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 // 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; $tor['announce'] = $announce;
} }
// Delete all additional urls // 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']); unset($tor['announce-list']);
} elseif (isset($tor['announce-list'])) { } elseif (isset($tor['announce-list'])) {
$tor['announce-list'] = array_merge($tor['announce-list'], array(array($announce))); $tor['announce-list'] = array_merge($tor['announce-list'], array(array($announce)));
} }
// Add retracker // 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 (bf($userdata['user_opt'], 'user_opt', 'user_retracker') || IS_GUEST) {
if (!isset($tor['announce-list'])) { if (!isset($tor['announce-list'])) {
$tor['announce-list'] = array( $tor['announce-list'] = [
array($announce), [$announce],
array($bb_cfg['tracker']['retracker_host']) [config('tracker.retracker_host')]
); ];
} else { } 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 // Add publisher & topic url
$publisher_name = $bb_cfg['server_name']; $publisher_name = config('tp.server_name');
$publisher_url = make_url(TOPIC_URL . $topic_id); $publisher_url = make_url(TOPIC_URL . $topic_id);
$tor['publisher'] = (string)$publisher_name; $tor['publisher'] = (string)$publisher_name;
@ -491,7 +494,7 @@ function send_torrent_with_passkey($filename)
// Send torrent // Send torrent
$output = \Rych\Bencode\Bencode::encode($tor); $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'])) { if (!empty($_COOKIE['explain'])) {
$out = "attach path: $filename<br /><br />"; $out = "attach path: $filename<br /><br />";
@ -508,7 +511,7 @@ function send_torrent_with_passkey($filename)
function generate_passkey($user_id, $force_generate = false) function generate_passkey($user_id, $force_generate = false)
{ {
global $bb_cfg, $lang, $sql; global $lang, $sql;
$user_id = (int)$user_id; $user_id = (int)$user_id;
@ -545,7 +548,7 @@ function generate_passkey($user_id, $force_generate = false)
if (OLD_DB()->affected_rows() == 1) { if (OLD_DB()->affected_rows() == 1) {
// Ocelot // Ocelot
if ($bb_cfg['ocelot']['enabled']) { if (config('tp.ocelot.enabled')) {
ocelot_update_tracker('change_passkey', array('oldpasskey' => $old_passkey, 'newpasskey' => $passkey_val)); ocelot_update_tracker('change_passkey', array('oldpasskey' => $old_passkey, 'newpasskey' => $passkey_val));
} }
return $passkey_val; return $passkey_val;
@ -599,9 +602,7 @@ function torrent_error_exit($message)
function ocelot_update_tracker($action, $updates) function ocelot_update_tracker($action, $updates)
{ {
global $bb_cfg; $get = config('tp.ocelot.secret') . "/update?action=$action";
$get = $bb_cfg['ocelot']['secret'] . "/update?action=$action";
foreach ($updates as $key => $value) { foreach ($updates as $key => $value) {
$get .= "&$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) 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"; $header = "GET /$get HTTP/1.1\r\nConnection: Close\r\n\r\n";
$attempts = $success = $response = 0; $attempts = $success = $response = 0;
$start_time = microtime(true); $start_time = microtime(true);
@ -624,7 +623,7 @@ function ocelot_send_request($get, $max_attempts = 1, &$err = false)
while (!$success && $attempts++ < $max_attempts) { while (!$success && $attempts++ < $max_attempts) {
// Send request // 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 ($file) {
if (fwrite($file, $header) === false) { if (fwrite($file, $header) === false) {
$err = "Failed to fwrite()"; $err = "Failed to fwrite()";

View file

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

View file

@ -116,7 +116,7 @@ if (!$online['userlist']) {
$total_online = $logged_online + $guests_online; $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( bb_update_config(array(
'record_online_users' => $total_online, 'record_online_users' => $total_online,
'record_online_date' => TIMENOW, 'record_online_date' => TIMENOW,

View file

@ -11,7 +11,7 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__)); die(basename(__FILE__));
} }
global $bb_cfg, $userdata, $template, $DBS, $lang; global $userdata, $template, $DBS, $lang;
if (!empty($template)) { if (!empty($template)) {
$template->assign_vars(array( $template->assign_vars(array(
@ -27,15 +27,15 @@ if (!empty($template)) {
$show_dbg_info = (DBG_USER && IS_ADMIN && !(isset($_GET['pane']) && $_GET['pane'] == 'left')); $show_dbg_info = (DBG_USER && IS_ADMIN && !(isset($_GET['pane']) && $_GET['pane'] == 'left'));
if (!$bb_cfg['gzip_compress']) { if (!config('tp.gzip_compress')) {
flush(); flush();
} }
if ($show_dbg_info) { if ($show_dbg_info) {
$gen_time = utime() - TIMESTART; $gen_time = utime() - TIMESTART;
$gen_time_txt = sprintf('%.3f', $gen_time); $gen_time_txt = sprintf('%.3f', $gen_time);
$gzip_text = (UA_GZIP_SUPPORTED) ? 'GZIP ' : '<s>GZIP</s> '; $gzip_text = UA_GZIP_SUPPORTED ? 'GZIP ' : '<s>GZIP</s> ';
$gzip_text .= ($bb_cfg['gzip_compress']) ? $lang['ON'] : $lang['OFF']; $gzip_text .= config('tp.gzip_compress') ? $lang['ON'] : $lang['OFF'];
$stat = '[&nbsp; ' . $lang['EXECUTION_TIME'] . " $gen_time_txt " . $lang['SEC']; $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; $gzip_text";
$stat .= ' &nbsp;|&nbsp; ' . $lang['MEMORY']; $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_peak'), 2) . ' / ';
$stat .= humn_size(sys('mem'), 2); $stat .= humn_size(sys('mem'), 2);
@ -87,7 +87,7 @@ echo '
if (defined('REQUESTED_PAGE') && !defined('DISABLE_CACHING_OUTPUT')) { if (defined('REQUESTED_PAGE') && !defined('DISABLE_CACHING_OUTPUT')) {
if (IS_GUEST === true) { 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 // 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']); $logged_in = (int)!empty($userdata['session_logged_in']);
@ -50,7 +50,7 @@ if (defined('SHOW_ONLINE') && SHOW_ONLINE) {
'TOTAL_USERS_ONLINE' => ${$online_list}['stat'], 'TOTAL_USERS_ONLINE' => ${$online_list}['stat'],
'LOGGED_IN_USER_LIST' => ${$online_list}['userlist'], 'LOGGED_IN_USER_LIST' => ${$online_list}['userlist'],
'USERS_ONLINE_COUNTS' => ${$online_list}['cnt'], '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']), 'USE_TABLESORTER' => !empty($page_cfg['use_tablesorter']),
'SITENAME' => $bb_cfg['sitename'], 'SITENAME' => config('tp.sitename'),
'U_INDEX' => BB_ROOT . "index.php", '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_GUEST' => IS_GUEST,
'IS_USER' => IS_USER, 'IS_USER' => IS_USER,
@ -134,9 +134,9 @@ $template->assign_vars(array(
'FORUM_PATH' => FORUM_PATH, 'FORUM_PATH' => FORUM_PATH,
'FULL_URL' => FULL_URL, 'FULL_URL' => FULL_URL,
'CURRENT_TIME' => sprintf($lang['CURRENT_TIME'], bb_date(TIMENOW, $bb_cfg['last_visit_date_format'], false)), '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)$bb_cfg['board_timezone'])])), 'S_TIMEZONE' => preg_replace('/\(.*?\)/', '', sprintf($lang['ALL_TIMES'], $lang['TZ'][str_replace(',', '.', (float)config('tp.board_timezone'))])),
'BOARD_TIMEZONE' => $bb_cfg['board_timezone'], 'BOARD_TIMEZONE' => config('tp.board_timezone'),
'PM_INFO' => $pm_info, 'PM_INFO' => $pm_info,
'PRIVMSG_IMG' => $icon_pm, 'PRIVMSG_IMG' => $icon_pm,
@ -147,7 +147,7 @@ $template->assign_vars(array(
'THIS_USER' => profile_url($userdata), 'THIS_USER' => profile_url($userdata),
'THIS_AVATAR' => get_avatar($userdata['user_id'], $userdata['avatar_ext_id'], !bf($userdata['user_opt'], 'user_opt', 'dis_avatar')), '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'), 'SHOW_LOGIN_LINK' => !defined('IN_LOGIN'),
'AUTOLOGIN_DISABLED' => !$bb_cfg['allow_autologin'], 'AUTOLOGIN_DISABLED' => !config('tp.allow_autologin'),
'S_LOGIN_ACTION' => LOGIN_URL, 'S_LOGIN_ACTION' => LOGIN_URL,
'U_CUR_DOWNLOADS' => PROFILE_URL . $userdata['user_id'], 'U_CUR_DOWNLOADS' => PROFILE_URL . $userdata['user_id'],
@ -163,11 +163,11 @@ $template->assign_vars(array(
'U_REGISTER' => "profile.php?mode=register", 'U_REGISTER' => "profile.php?mode=register",
'U_SEARCH' => "search.php", 'U_SEARCH' => "search.php",
'U_SEND_PASSWORD' => "profile.php?mode=sendpassword", '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", 'U_TRACKER' => "tracker.php",
'SHOW_SIDEBAR1' => !empty(config('page.show_sidebar1.' . BB_SCRIPT)) || $bb_cfg['show_sidebar1_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)) || $bb_cfg['show_sidebar2_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_AGREEMENT' => LANG_DIR . 'html/user_agreement.html',
'HTML_COPYRIGHT' => LANG_DIR . 'html/copyright_holders.html', 'HTML_COPYRIGHT' => LANG_DIR . 'html/copyright_holders.html',
@ -181,11 +181,11 @@ $template->assign_vars(array(
'DOWNLOAD_URL' => BB_ROOT . DOWNLOAD_URL, 'DOWNLOAD_URL' => BB_ROOT . DOWNLOAD_URL,
'FORUM_URL' => BB_ROOT . FORUM_URL, 'FORUM_URL' => BB_ROOT . FORUM_URL,
'GROUP_URL' => BB_ROOT . GROUP_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', 'NEWEST_URL' => '&amp;view=newest#newest',
'PM_URL' => $bb_cfg['pm_url'], 'PM_URL' => config('tp.pm_url'),
'POST_URL' => BB_ROOT . POST_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, 'PROFILE_URL' => BB_ROOT . PROFILE_URL,
'TOPIC_URL' => BB_ROOT . TOPIC_URL, 'TOPIC_URL' => BB_ROOT . TOPIC_URL,
@ -206,7 +206,45 @@ $template->assign_vars(array(
'SELECTED' => HTML_SELECTED, 'SELECTED' => HTML_SELECTED,
'U_SEARCH_SELF_BY_LAST' => "search.php?uid={$userdata['user_id']}&amp;o=5", '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'])) { if (!empty(config('page.show_torhelp.' . BB_SCRIPT)) && !empty($userdata['torhelp'])) {
@ -250,6 +288,6 @@ $template->pparse('page_header');
define('PAGE_HEADER_SENT', true); define('PAGE_HEADER_SENT', true);
if (!$bb_cfg['gzip_compress']) { if (!config('tp.gzip_compress')) {
flush(); flush();
} }

View file

@ -39,14 +39,12 @@ function cache_get_userdata($id)
function cache_set_userdata($userdata, $force = false) function cache_set_userdata($userdata, $force = false)
{ {
global $bb_cfg;
if (!$userdata || (ignore_cached_userdata() && !$force)) { if (!$userdata || (ignore_cached_userdata() && !$force)) {
return false; return false;
} }
$id = ($userdata['user_id'] == GUEST_UID) ? $userdata['session_ip'] : $userdata['session_id']; $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) 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)); $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)); $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 && ($bb_cfg['bt_show_dl_list'] || ($bb_cfg['allow_dl_list_names_mode'] && @$_GET['dl'] === 'names'))); $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 && $bb_cfg['bt_show_dl_list_buttons']); $show_dl_buttons = ($dl_topic && config('tp.bt_show_dl_list_buttons'));
// link to clear DL-List // link to clear DL-List
$template->assign_vars(array('S_DL_DELETE' => false)); $template->assign_vars(array('S_DL_DELETE' => false));
@ -106,10 +106,10 @@ if ($show_dl_list) {
if ($show_dl_buttons) { if ($show_dl_buttons) {
$template->assign_vars(array( $template->assign_vars(array(
'DL_BUTTONS' => true, 'DL_BUTTONS' => true,
'DL_BUT_WILL' => $bb_cfg['bt_show_dl_but_will'], 'DL_BUT_WILL' => config('tp.bt_show_dl_but_will'),
'DL_BUT_DOWN' => $bb_cfg['bt_show_dl_but_down'], 'DL_BUT_DOWN' => config('tp.bt_show_dl_but_down'),
'DL_BUT_COMPL' => $bb_cfg['bt_show_dl_but_compl'], 'DL_BUT_COMPL' => config('tp.bt_show_dl_but_compl'),
'DL_BUT_CANCEL' => $bb_cfg['bt_show_dl_but_cancel'], 'DL_BUT_CANCEL' => config('tp.bt_show_dl_but_cancel'),
)); ));
$dl_hidden_fields = ' $dl_hidden_fields = '

View file

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

View file

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

View file

@ -16,7 +16,7 @@ array_deep($_POST, 'trim');
set_die_append_msg(); set_die_append_msg();
if (IS_ADMIN) { if (IS_ADMIN) {
$bb_cfg['reg_email_activation'] = false; config(['tp.reg_email_activation' => false]);
$new_user = (int)request_var('admin', ''); $new_user = (int)request_var('admin', '');
if ($new_user) { if ($new_user) {
@ -54,16 +54,16 @@ switch ($mode) {
if (!IS_ADMIN) { if (!IS_ADMIN) {
// Ограничение по ip // Ограничение по 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")) { 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']); 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,*/ 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))) { 17, 18, 19, 20, 21, 22, 23))) {
bb_die($lang['REGISTERED_IN_TIME']); bb_die($lang['REGISTERED_IN_TIME']);
@ -86,8 +86,8 @@ switch ($mode) {
'username' => '', 'username' => '',
'user_password' => '', 'user_password' => '',
'user_email' => '', 'user_email' => '',
'user_timezone' => $bb_cfg['board_timezone'], 'user_timezone' => config('tp.board_timezone'),
'user_lang' => $bb_cfg['default_lang'], 'user_lang' => config('tp.default_lang'),
'user_opt' => 0, 'user_opt' => 0,
'avatar_ext_id' => 0, 'avatar_ext_id' => 0,
); );
@ -104,7 +104,7 @@ switch ($mode) {
// field => can_edit // field => can_edit
$profile_fields = array( $profile_fields = array(
'user_active' => IS_ADMIN, 'user_active' => IS_ADMIN,
'username' => (IS_ADMIN || $bb_cfg['allow_namechange']), 'username' => (IS_ADMIN || config('tp.allow_namechange')),
'user_password' => true, 'user_password' => true,
'user_email' => true, // должен быть после user_password 'user_email' => true, // должен быть после user_password
'user_lang' => true, 'user_lang' => true,
@ -152,7 +152,7 @@ switch ($mode) {
} }
// Captcha // Captcha
$need_captcha = ($mode == 'register' && !IS_ADMIN && !$bb_cfg['captcha']['disabled']); $need_captcha = ($mode == 'register' && !IS_ADMIN && !config('tp.captcha.disabled'));
if ($submit) { if ($submit) {
if ($need_captcha && !bb_captcha('check')) { if ($need_captcha && !bb_captcha('check')) {
@ -255,7 +255,7 @@ foreach ($profile_fields as $field => $can_edit) {
if (!$errors and $err = validate_email($email)) { if (!$errors and $err = validate_email($email)) {
$errors[] = $err; $errors[] = $err;
} }
if ($bb_cfg['reg_email_activation']) { if (config('tp.reg_email_activation')) {
$pr_data['user_active'] = 0; $pr_data['user_active'] = 0;
$db_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 (!empty($birthday_date['year'])) {
if (strtotime($user_birthday) >= TIMENOW) { if (strtotime($user_birthday) >= TIMENOW) {
$errors[] = $lang['WRONG_BIRTHDAY_FORMAT']; $errors[] = $lang['WRONG_BIRTHDAY_FORMAT'];
} elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] > $bb_cfg['birthday_max_age']) { } elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] > config('tp.birthday_max_age')) {
$errors[] = sprintf($lang['BIRTHDAY_TO_HIGH'], $bb_cfg['birthday_max_age']); $errors[] = sprintf($lang['BIRTHDAY_TO_HIGH'], config('tp.birthday_max_age'));
} elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] < $bb_cfg['birthday_min_age']) { } elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] < config('tp.birthday_min_age')) {
$errors[] = sprintf($lang['BIRTHDAY_TO_LOW'], $bb_cfg['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']); delete_avatar($pr_data['user_id'], $pr_data['avatar_ext_id']);
$pr_data['avatar_ext_id'] = 0; $pr_data['avatar_ext_id'] = 0;
$db_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(); $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; $pr_data['avatar_ext_id'] = $upload->file_ext_id;
$db_data['avatar_ext_id'] = (int)$upload->file_ext_id; $db_data['avatar_ext_id'] = (int)$upload->file_ext_id;
} else { } 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; break;
/** /**
@ -437,7 +437,7 @@ foreach ($profile_fields as $field => $can_edit) {
if ($submit && $sig != $pr_data['user_sig']) { if ($submit && $sig != $pr_data['user_sig']) {
$sig = prepare_message($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']; $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)) { } 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']; $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 = isset($_POST['tpl_name']) ? (string)$_POST['tpl_name'] : $pr_data['tpl_name'];
$templates = htmlCHR($templates); $templates = htmlCHR($templates);
if ($submit && $templates != $pr_data['tpl_name']) { if ($submit && $templates != $pr_data['tpl_name']) {
$pr_data['tpl_name'] = $bb_cfg['tpl_name']; $pr_data['tpl_name'] = config('tp.tpl_name');
$db_data['tpl_name'] = (string)$bb_cfg['tpl_name']; $db_data['tpl_name'] = (string)config('tp.tpl_name');
foreach ($bb_cfg['templates'] as $folder => $name) { foreach (config('tp.templates') as $folder => $name) {
if ($templates == $folder) { if ($templates == $folder) {
$pr_data['tpl_name'] = $templates; $pr_data['tpl_name'] = $templates;
$db_data['tpl_name'] = (string)$templates; $db_data['tpl_name'] = (string)$templates;
@ -538,7 +538,7 @@ if ($submit && !$errors) {
* Создание нового профиля * Создание нового профиля
*/ */
if ($mode == 'register') { if ($mode == 'register') {
if ($bb_cfg['reg_email_activation']) { if (config('tp.reg_email_activation')) {
$user_actkey = make_rand_str(12); $user_actkey = make_rand_str(12);
$db_data['user_active'] = 0; $db_data['user_active'] = 0;
$db_data['user_actkey'] = $user_actkey; $db_data['user_actkey'] = $user_actkey;
@ -553,7 +553,7 @@ if ($submit && !$errors) {
} }
if (!isset($db_data['tpl_name'])) { 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); $sql_args = OLD_DB()->build_array('INSERT', $db_data);
@ -565,27 +565,27 @@ if ($submit && !$errors) {
set_pr_die_append_msg($new_user_id); set_pr_die_append_msg($new_user_id);
$message = $lang['ACCOUNT_ADDED']; $message = $lang['ACCOUNT_ADDED'];
} else { } else {
if ($bb_cfg['reg_email_activation']) { if (config('tp.reg_email_activation')) {
$message = $lang['ACCOUNT_INACTIVE']; $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'; $email_template = 'user_welcome_inactive';
} else { } else {
$message = $lang['ACCOUNT_ADDED']; $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'; $email_template = 'user_welcome';
} }
/** @var TorrentPier\Legacy\Emailer() $emailer */ /** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\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_to([$email => $username]);
$emailer->set_subject($email_subject); $emailer->set_subject($email_subject);
$emailer->set_template($email_template, $user_lang); $emailer->set_template($email_template, $user_lang);
$emailer->assign_vars(array( $emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'], 'SITENAME' => config('tp.sitename'),
'WELCOME_MSG' => sprintf($lang['WELCOME_SUBJECT'], $bb_cfg['sitename']), 'WELCOME_MSG' => sprintf($lang['WELCOME_SUBJECT'], config('tp.sitename')),
'USERNAME' => html_entity_decode($username), 'USERNAME' => html_entity_decode($username),
'PASSWORD' => $new_pass, 'PASSWORD' => $new_pass,
'U_ACTIVATE' => make_url('profile.php?mode=activate&' . POST_USERS_URL . '=' . $new_user_id . '&act_key=' . $db_data['user_actkey']) '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 */ /** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\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_to([$email => $username]);
$emailer->set_subject($subject); $emailer->set_subject($subject);
$emailer->set_subject($lang['EMAILER_SUBJECT']['USER_ACTIVATE']); $emailer->set_subject($lang['EMAILER_SUBJECT']['USER_ACTIVATE']);
$emailer->set_template('user_activate', $pr_data['user_lang']); $emailer->set_template('user_activate', $pr_data['user_lang']);
$emailer->assign_vars(array( $emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'], 'SITENAME' => config('tp.sitename'),
'USERNAME' => html_entity_decode($username), 'USERNAME' => html_entity_decode($username),
'U_ACTIVATE' => make_url("profile.php?mode=activate&u={$pr_data['user_id']}&act_key=$user_actkey"), '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'), 'TIMEZONE_SELECT' => tz_select($pr_data['user_timezone'], 'user_timezone'),
'USER_TIMEZONE' => $pr_data['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_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')), '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'), 'SIG_DISALLOWED' => bf($pr_data['user_opt'], 'user_opt', 'dis_sig'),
'PR_USER_ID' => $pr_data['user_id'], 'PR_USER_ID' => $pr_data['user_id'],

View file

@ -17,7 +17,7 @@ if (!config('email.enabled')) {
bb_die($lang['EMAILER_DISABLED']); 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 (isset($_POST['submit'])) {
if ($need_captcha && !bb_captcha('check')) { if ($need_captcha && !bb_captcha('check')) {
@ -50,13 +50,13 @@ if (isset($_POST['submit'])) {
/** @var TorrentPier\Legacy\Emailer() $emailer */ /** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\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_to([$row['user_email'] => $username]);
$emailer->set_subject($lang['EMAILER_SUBJECT']['USER_ACTIVATE_PASSWD']); $emailer->set_subject($lang['EMAILER_SUBJECT']['USER_ACTIVATE_PASSWD']);
$emailer->set_template('user_activate_passwd', $row['user_lang']); $emailer->set_template('user_activate_passwd', $row['user_lang']);
$emailer->assign_vars(array( $emailer->assign_vars(array(
'SITENAME' => $bb_cfg['sitename'], 'SITENAME' => config('tp.sitename'),
'USERNAME' => $username, 'USERNAME' => $username,
'PASSWORD' => $user_password, 'PASSWORD' => $user_password,
'U_ACTIVATE' => make_url('profile.php?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey) '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 * @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']); bb_die($lang['DISABLED']);
} }
@ -17,7 +17,7 @@ $tracking_topics = get_tracks('topic');
$user_id = $userdata['user_id']; $user_id = $userdata['user_id'];
$start = isset($_GET['start']) ? abs((int)$_GET['start']) : 0; $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'])) { if (isset($_POST['topic_id_list'])) {
$topic_ids = implode(",", $_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'], 'LAST_POST_ID' => $watch[$i]['topic_last_post_id'],
'IS_UNREAD' => $is_unread, 'IS_UNREAD' => $is_unread,
'TOPIC_ICON' => get_topic_icon($watch[$i], $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) { 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>'; $email = '<a class="editable" href="' . $email_uri . '">' . $profiledata['user_email'] . '</a>';
} else { } else {
$email = ''; $email = '';
@ -61,7 +61,7 @@ if (bf($profiledata['user_opt'], 'user_opt', 'user_viewemail') || $profiledata['
$profile_user_id = ($profiledata['user_id'] == $userdata['user_id']); $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 (bf($profiledata['user_opt'], 'user_opt', 'dis_sig')) {
if ($profile_user_id) { if ($profile_user_id) {
@ -97,9 +97,9 @@ $template->assign_vars(array(
'SKYPE' => $profiledata['user_skype'], 'SKYPE' => $profiledata['user_skype'],
'TWITTER' => $profiledata['user_twitter'], 'TWITTER' => $profiledata['user_twitter'],
'USER_POINTS' => $profiledata['user_points'], 'USER_POINTS' => $profiledata['user_points'],
'GENDER' => ($bb_cfg['gender']) ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '', 'GENDER' => config('tp.gender') ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '',
'BIRTHDAY' => ($bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00') ? $profiledata['user_birthday'] : '', 'BIRTHDAY' => (config('tp.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']) : '', '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_VIEWING_PROFILE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),
'L_MY_PROFILE' => sprintf($lang['VIEWING_MY_PROFILE'], 'profile.php?mode=editprofile'), 'L_MY_PROFILE' => sprintf($lang['VIEWING_MY_PROFILE'], 'profile.php?mode=editprofile'),

View file

@ -1,4 +1,4 @@
<div id="infobox-body"> <div id="infobox-body">
<h2 class="bold">Advertising on our site</h2> <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--> </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>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>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> <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['FORUM_CFG_TITLE'] = 'Forum settings';
$lang['TRACKER_SETTINGS'] = 'Tracker 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_TRACKER'] = 'Disable tracker';
$lang['OFF_REASON'] = 'Disable reason'; $lang['OFF_REASON'] = 'Disable reason';

View file

@ -1,4 +1,4 @@
<div id="infobox-body"> <div id="infobox-body">
<h2 class="bold">Advertising on our site</h2> <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--> </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>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>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> <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['FORUM_CFG_TITLE'] = 'Forum settings';
$lang['TRACKER_SETTINGS'] = 'Tracker 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_TRACKER'] = 'Disable tracker';
$lang['OFF_REASON'] = 'Disable reason'; $lang['OFF_REASON'] = 'Disable reason';

View file

@ -63,7 +63,7 @@ $login_password = $_POST['login_password'] ?? '';
$need_captcha = false; $need_captcha = false;
if (!$mod_admin_login) { if (!$mod_admin_login) {
$need_captcha = OLD_CACHE('bb_login_err')->get('l_err_' . USER_IP); $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; $need_captcha = false;
} }
} }
@ -80,13 +80,13 @@ if (isset($_POST['login'])) {
} }
// Captcha // 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']; $login_errors[] = $lang['CAPTCHA_WRONG'];
} }
if (!$login_errors) { if (!$login_errors) {
if ($user->login($_POST, $mod_admin_login)) { 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); OLD_CACHE('bb_login_err')->set('l_err_' . USER_IP, 0, 3600);
@ -100,7 +100,7 @@ if (isset($_POST['login'])) {
if (!$mod_admin_login) { if (!$mod_admin_login) {
$login_err = OLD_CACHE('bb_login_err')->get('l_err_' . USER_IP); $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; $need_captcha = true;
} }
OLD_CACHE('bb_login_err')->set('l_err_' . USER_IP, ($login_err + 1), 3600); 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), 'ERROR_MESSAGE' => implode('<br />', $login_errors),
'ADMIN_LOGIN' => $mod_admin_login, 'ADMIN_LOGIN' => $mod_admin_login,
'REDIRECT_URL' => htmlCHR($redirect_url), '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'], 'PAGE_TITLE' => $lang['LOGIN'],
'S_LOGIN_ACTION' => LOGIN_URL, 'S_LOGIN_ACTION' => LOGIN_URL,
)); ));

View file

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

View file

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

View file

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

View file

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

View file

@ -24,7 +24,7 @@ $page_cfg['load_tpl_vars'] = array(
// //
// Is PM disabled? // Is PM disabled?
// //
if ($bb_cfg['privmsg_disable']) { if (config('tp.privmsg_disable')) {
bb_die('PM_DISABLED'); bb_die('PM_DISABLED');
} }
@ -32,14 +32,14 @@ if ($bb_cfg['privmsg_disable']) {
// Parameters // Parameters
// //
$submit = (bool)request_var('post', false); $submit = (bool)request_var('post', false);
$submit_search = (isset($_POST['usersubmit'])) ? true : 0; $submit_search = isset($_POST['usersubmit']) ? true : 0;
$submit_msgdays = (isset($_POST['submit_msgdays'])) ? true : 0; $submit_msgdays = isset($_POST['submit_msgdays']) ? true : 0;
$cancel = (isset($_POST['cancel'])) ? true : 0; $cancel = isset($_POST['cancel']) ? true : 0;
$preview = (isset($_POST['preview'])) ? true : 0; $preview = isset($_POST['preview']) ? true : 0;
$confirmed = (isset($_POST['confirm'])) ? true : 0; $confirmed = isset($_POST['confirm']) ? true : 0;
$delete = (isset($_POST['delete'])) ? true : 0; $delete = isset($_POST['delete']) ? true : 0;
$delete_all = (isset($_POST['deleteall'])) ? true : 0; $delete_all = isset($_POST['deleteall']) ? true : 0;
$save = (isset($_POST['save'])) ? true : 0; $save = isset($_POST['save']) ? true : 0;
$mode = isset($_REQUEST['mode']) ? (string)$_REQUEST['mode'] : ''; $mode = isset($_REQUEST['mode']) ? (string)$_REQUEST['mode'] : '';
$refresh = $preview || $submit_search; $refresh = $preview || $submit_search;
@ -59,7 +59,7 @@ $user->session_start(array('req_login' => true));
$template->assign_vars(array( $template->assign_vars(array(
'IN_PM' => true, '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 ($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 . " $sql = "SELECT privmsgs_id FROM " . BB_PRIVMSGS . "
WHERE privmsgs_type = " . PRIVMSGS_SENT_MAIL . " WHERE privmsgs_type = " . PRIVMSGS_SENT_MAIL . "
AND privmsgs_date = " . $sent_info['oldest_post_time'] . " AND privmsgs_date = " . $sent_info['oldest_post_time'] . "
@ -609,7 +609,7 @@ if ($mode == 'read') {
} }
if ($saved_info = OLD_DB()->sql_fetchrow($result)) { 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 . " $sql = "SELECT privmsgs_id FROM " . BB_PRIVMSGS . "
WHERE ( ( privmsgs_to_userid = " . $userdata['user_id'] . " WHERE ( ( privmsgs_to_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " ) AND privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " )
@ -754,7 +754,7 @@ if ($mode == 'read') {
$last_post_time = $db_row['last_post_time']; $last_post_time = $db_row['last_post_time'];
$current_time = TIMENOW; $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']); bb_die($lang['FLOOD_ERROR']);
} }
} }
@ -832,7 +832,7 @@ if ($mode == 'read') {
} }
if ($inbox_info = OLD_DB()->sql_fetchrow($result)) { 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 . " $sql = "SELECT privmsgs_id FROM " . BB_PRIVMSGS . "
WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . " WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
OR privmsgs_type = " . PRIVMSGS_READ_MAIL . " OR privmsgs_type = " . PRIVMSGS_READ_MAIL . "
@ -900,11 +900,11 @@ if ($mode == 'read') {
cache_rm_user_sessions($to_userdata['user_id']); 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 */ /** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\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_to([$to_userdata['user_email'] => $to_userdata['username']]);
$emailer->set_subject($lang['EMAILER_SUBJECT']['PRIVMSG_NOTIFY']); $emailer->set_subject($lang['EMAILER_SUBJECT']['PRIVMSG_NOTIFY']);
@ -913,7 +913,7 @@ if ($mode == 'read') {
'USERNAME' => html_entity_decode($to_username), 'USERNAME' => html_entity_decode($to_username),
'NAME_FROM' => $userdata['username'], 'NAME_FROM' => $userdata['username'],
'MSG_SUBJECT' => html_entity_decode($privmsg_subject), '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"), 'U_INBOX' => make_url(PM_URL . "?folder=inbox&mode=read&p=$privmsg_sent_id"),
)); ));
@ -1262,7 +1262,7 @@ if ($mode == 'read') {
$msg_days = 0; $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_all_tot = $sql_tot;
$sql_tot .= $limit_msg_time_total; $sql_tot .= $limit_msg_time_total;
@ -1318,11 +1318,11 @@ if ($mode == 'read') {
// Output data for inbox status // Output data for inbox status
// //
$box_limit_img_length = $box_limit_percent = $l_box_size_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) { if ($max_pm) {
$box_limit_percent = min(round(($pm_all_total / $max_pm) * 100), 100); $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); $box_limit_remain = max(($max_pm - $pm_all_total), 0);
$template->assign_var('PM_BOX_SIZE_INFO'); $template->assign_var('PM_BOX_SIZE_INFO');
@ -1427,7 +1427,7 @@ if ($mode == 'read') {
)); ));
} while ($row = OLD_DB()->sql_fetchrow($result)); } 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 { } else {
$template->assign_block_vars("switch_no_messages", array()); $template->assign_block_vars("switch_no_messages", array());
} }

View file

@ -19,7 +19,7 @@ $page_cfg['load_tpl_vars'] = array(
'topic_icons', '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(); set_die_append_msg();
@ -294,7 +294,7 @@ if (empty($_GET) && empty($_POST)) {
'MY_TOPICS_ID' => 'my_topics', 'MY_TOPICS_ID' => 'my_topics',
'MY_TOPICS_CHBOX' => build_checkbox($my_topics_key, $lang['SEARCH_MY_TOPICS'], $my_topics_val, true, null, '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), '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_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'), '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']))); $new_topics = (!IS_GUEST && ($new_topics_val || isset($_GET['newposts'])));
$my_topics = ($poster_id_val && $my_topics_val); $my_topics = ($poster_id_val && $my_topics_val);
$my_posts = ($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) // "Display as" mode (posts or topics)
$post_mode = (!$dl_search && ($display_as_val == $as_posts || isset($_GET['search_author']))); $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) { if ($post_mode) {
$order = $order_opt[$order_val]['sql']; $order = $order_opt[$order_val]['sql'];
$sort = $sort_opt[$sort_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; $display_as_val = $as_posts;
// Run initial search for post_ids // Run initial search for post_ids
@ -601,7 +601,7 @@ if ($post_mode) {
'POSTER_ID' => $post['poster_id'], 'POSTER_ID' => $post['poster_id'],
'POSTER' => profile_url($post), 'POSTER' => profile_url($post),
'POST_ID' => $post['post_id'], '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), 'IS_UNREAD' => is_unread($post['post_time'], $topic_id, $forum_id),
'MESSAGE' => $message, 'MESSAGE' => $message,
'POSTED_AFTER' => '', 'POSTED_AFTER' => '',
@ -620,7 +620,7 @@ if ($post_mode) {
else { else {
$order = $order_opt[$order_val]['sql']; $order = $order_opt[$order_val]['sql'];
$sort = $sort_opt[$sort_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; $display_as_val = $as_topics;
// Run initial search for topic_ids // Run initial search for topic_ids
@ -741,7 +741,7 @@ else {
// Build SQL for displaying topics // Build SQL for displaying topics
$SQL = OLD_DB()->get_empty_sql_array(); $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'][] = " $SQL['SELECT'][] = "
t.*, t.topic_poster AS first_user_id, u1.user_rank AS first_user_rank, 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']), 'TOPIC_TITLE' => wbr($topic['topic_title']),
'IS_UNREAD' => $is_unread, 'IS_UNREAD' => $is_unread,
'TOPIC_ICON' => get_topic_icon($topic, $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'], 'REPLIES' => $topic['topic_replies'],
'ATTACH' => $topic['topic_attachment'], 'ATTACH' => $topic['topic_attachment'],
'STATUS' => $topic['topic_status'], 'STATUS' => $topic['topic_status'],
@ -895,16 +895,13 @@ function fetch_search_ids($sql, $search_type = SEARCH_TYPE_POST)
function prevent_huge_searches($SQL) function prevent_huge_searches($SQL)
{ {
global $bb_cfg; if (config('tp.limit_max_search_results')) {
if ($bb_cfg['limit_max_search_results']) {
$SQL['select_options'][] = 'SQL_CALC_FOUND_ROWS'; $SQL['select_options'][] = 'SQL_CALC_FOUND_ROWS';
$SQL['ORDER BY'] = array(); $SQL['ORDER BY'] = array();
$SQL['LIMIT'] = array('0'); $SQL['LIMIT'] = array('0');
if (OLD_DB()->query($SQL) and $row = OLD_DB()->fetch_row("SELECT FOUND_ROWS() AS rows_count")) { 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']) { if ($row['rows_count'] > config('tp.limit_max_search_results')) {
# bb_log(str_compact(OLD_DB()->build_sql($SQL)) ." [{$row['rows_count']} rows]". LOG_LF, 'sql_huge_search');
bb_die('Too_many_search_results'); bb_die('Too_many_search_results');
} }
} }

View file

@ -44,12 +44,12 @@
<td>&nbsp; {L_YES}</td> <td>&nbsp; {L_YES}</td>
</tr> </tr>
<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> <td>&nbsp; <b>{PASSKEY_KEY}</b></td>
</tr> </tr>
<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><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>
<tr> <tr>
<th colspan="2">{L_LIMIT_ACTIVE_TOR_HEAD}</th> <th colspan="2">{L_LIMIT_ACTIVE_TOR_HEAD}</th>
@ -91,7 +91,7 @@
<th colspan="2">{L_ANNOUNCE_INTERVAL_HEAD}</th> <th colspan="2">{L_ANNOUNCE_INTERVAL_HEAD}</th>
</tr> </tr>
<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> <td><span class="med">&nbsp; <b>{ANNOUNCE_INTERVAL}</b></span> <span class="med">seconds</span></td>
</tr> </tr>
<tr> <tr>
@ -114,7 +114,7 @@
</td> </td>
</tr> </tr>
<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> <td>&nbsp; <!-- IF IGNORE_REPORTED_IP -->{L_YES}<!-- ELSE -->{L_NO}<!-- ENDIF --></td>
</tr> </tr>
<tr> <tr>

View file

@ -117,7 +117,7 @@
<td><b>{L_UPDATE}:</b></td> <td><b>{L_UPDATE}:</b></td>
<td> <td>
<a href="#" id="update_user_level" onclick="ajax.manage_admin('update_user_level'); return false;">{L_USER_LEVELS}</a> <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> <a href="#" id="indexer" onclick="ajax.manage_admin('indexer'); return false;">{L_INDEXER}</a>
<!-- ENDIF --> <!-- ENDIF -->
</td> </td>
@ -151,11 +151,11 @@
</tr> </tr>
<tr> <tr>
<td class="row1" nowrap="nowrap" width="25%">{L_TP_VERSION}:</td> <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>
<tr> <tr>
<td class="row1" nowrap="nowrap" width="25%">{L_TP_RELEASE_DATE}:</td> <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> </tr>
</table> </table>
<br/> <br/>

View file

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

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