diff --git a/admin/admin_attach_cp.php b/admin/admin_attach_cp.php
index 783a7cdc2..9943ac12f 100644
--- a/admin/admin_attach_cp.php
+++ b/admin/admin_attach_cp.php
@@ -68,44 +68,44 @@ $order_by = '';
if ($view === 'username') {
switch ($mode) {
case 'username':
- $order_by = 'ORDER BY u.username ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
+ $order_by = 'ORDER BY u.username ' . $sort_order . ' LIMIT ' . $start . ', ' . config('tp.topics_per_page');
break;
case 'attachments':
- $order_by = 'ORDER BY total_attachments ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
+ $order_by = 'ORDER BY total_attachments ' . $sort_order . ' LIMIT ' . $start . ', ' . config('tp.topics_per_page');
break;
case 'filesize':
- $order_by = 'ORDER BY total_size ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
+ $order_by = 'ORDER BY total_size ' . $sort_order . ' LIMIT ' . $start . ', ' . config('tp.topics_per_page');
break;
default:
$mode = 'attachments';
$sort_order = 'DESC';
- $order_by = 'ORDER BY total_attachments ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
+ $order_by = 'ORDER BY total_attachments ' . $sort_order . ' LIMIT ' . $start . ', ' . config('tp.topics_per_page');
break;
}
} elseif ($view === 'attachments') {
switch ($mode) {
case 'filename':
- $order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
+ $order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . config('tp.topics_per_page');
break;
case 'comment':
- $order_by = 'ORDER BY a.comment ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
+ $order_by = 'ORDER BY a.comment ' . $sort_order . ' LIMIT ' . $start . ', ' . config('tp.topics_per_page');
break;
case 'extension':
- $order_by = 'ORDER BY a.extension ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
+ $order_by = 'ORDER BY a.extension ' . $sort_order . ' LIMIT ' . $start . ', ' . config('tp.topics_per_page');
break;
case 'filesize':
- $order_by = 'ORDER BY a.filesize ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
+ $order_by = 'ORDER BY a.filesize ' . $sort_order . ' LIMIT ' . $start . ', ' . config('tp.topics_per_page');
break;
case 'downloads':
- $order_by = 'ORDER BY a.download_count ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
+ $order_by = 'ORDER BY a.download_count ' . $sort_order . ' LIMIT ' . $start . ', ' . config('tp.topics_per_page');
break;
case 'post_time':
- $order_by = 'ORDER BY a.filetime ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
+ $order_by = 'ORDER BY a.filetime ' . $sort_order . ' LIMIT ' . $start . ', ' . config('tp.topics_per_page');
break;
default:
$mode = 'a.real_filename';
$sort_order = 'ASC';
- $order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . $bb_cfg['topics_per_page'];
+ $order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . config('tp.topics_per_page');
break;
}
}
@@ -472,8 +472,8 @@ if ($view === 'attachments') {
}
// Generate Pagination
-if ($do_pagination && $total_rows > $bb_cfg['topics_per_page']) {
- generate_pagination('admin_attach_cp.php?view=' . $view . '&mode=' . $mode . '&order=' . $sort_order . '&uid=' . $uid, $total_rows, $bb_cfg['topics_per_page'], $start);
+if ($do_pagination && $total_rows > config('tp.topics_per_page')) {
+ generate_pagination('admin_attach_cp.php?view=' . $view . '&mode=' . $mode . '&order=' . $sort_order . '&uid=' . $uid, $total_rows, config('tp.topics_per_page'), $start);
}
print_page('admin_attach_cp.tpl', 'admin');
diff --git a/admin/admin_bt_tracker_cfg.php b/admin/admin_bt_tracker_cfg.php
index 0e762d3fa..a963abf28 100644
--- a/admin/admin_bt_tracker_cfg.php
+++ b/admin/admin_bt_tracker_cfg.php
@@ -65,9 +65,9 @@ set_tpl_vars($default_cfg_num, config('tracker'));
set_tpl_vars_lang($default_cfg_num);
$template->assign_vars(array(
- 'IGNORE_REPORTED_IP' => $bb_cfg['ignore_reported_ip'],
- 'ANNOUNCE_INTERVAL' => $bb_cfg['announce_interval'],
- 'PASSKEY_KEY' => $bb_cfg['passkey_key'],
+ 'IGNORE_REPORTED_IP' => config('tp.ignore_reported_ip'),
+ 'ANNOUNCE_INTERVAL' => config('tp.announce_interval'),
+ 'PASSKEY_KEY' => config('tp.passkey_key'),
'GOLD_SILVER_ENABLED' => config('tracker.gold_silver_enabled'),
'DISABLE_SUBMIT' => true,
diff --git a/admin/admin_log.php b/admin/admin_log.php
index 495d0aa2c..c88c16c20 100644
--- a/admin/admin_log.php
+++ b/admin/admin_log.php
@@ -151,7 +151,7 @@ if ($var =& $_REQUEST[$daysback_key] && $var != $def_days) {
$url = url_arg($url, $daysback_key, $daysback_val);
}
if ($var =& $_REQUEST[$datetime_key] && $var != $def_datetime) {
- $tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
+ $tz = TIMENOW + (3600 * config('tp.board_timezone'));
if (($tmp_timestamp = strtotime($var, $tz)) > 0) {
$datetime_val = $tmp_timestamp;
$url = url_arg($url, $datetime_key, date($dt_format, $datetime_val));
diff --git a/admin/admin_mass_email.php b/admin/admin_mass_email.php
index b0217389a..8c90f6b9e 100644
--- a/admin/admin_mass_email.php
+++ b/admin/admin_mass_email.php
@@ -64,7 +64,7 @@ if (isset($_POST['submit'])) {
/** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\Emailer();
- $emailer->set_from([$bb_cfg['board_email'] => $bb_cfg['sitename']]);
+ $emailer->set_from([config('tp.board_email') => config('tp.sitename')]);
$emailer->set_to([$row['user_email'] => $row['username']]);
$emailer->set_subject($subject);
diff --git a/admin/admin_sitemap.php b/admin/admin_sitemap.php
index a22db201e..1d0f9a153 100644
--- a/admin/admin_sitemap.php
+++ b/admin/admin_sitemap.php
@@ -39,7 +39,7 @@ if (!$result = OLD_DB()->sql_query($sql)) {
}
}
-$s_mess = $lang['SITEMAP_CREATED'] . ': ' . bb_date($new['sitemap_time'], $bb_cfg['post_date_format']) . ' ' . $lang['SITEMAP_AVAILABLE'] . ': ' . make_url('sitemap/sitemap.xml') . ' ';
+$s_mess = $lang['SITEMAP_CREATED'] . ': ' . bb_date($new['sitemap_time'], config('tp.post_date_format')) . ' ' . $lang['SITEMAP_AVAILABLE'] . ': ' . make_url('sitemap/sitemap.xml') . ' ';
$message = file_exists(SITEMAP_DIR . '/sitemap.xml') ? $s_mess : $lang['SITEMAP_NOT_CREATED'];
$template->assign_vars(array(
diff --git a/admin/admin_smilies.php b/admin/admin_smilies.php
index 689d8f2dc..3fcc07668 100644
--- a/admin/admin_smilies.php
+++ b/admin/admin_smilies.php
@@ -27,11 +27,11 @@ $s_hidden_fields = '';
$smiley_paks = [];
// Read a listing of uploaded smilies for use in the add or edit smliey code
-$dir = opendir(BB_ROOT . $bb_cfg['smilies_path']);
+$dir = opendir(BB_ROOT . config('tp.smilies_path'));
while ($file = @readdir($dir)) {
- if (!is_dir(bb_realpath(BB_ROOT . $bb_cfg['smilies_path'] . '/' . $file))) {
- $img_size = getimagesize(BB_ROOT . $bb_cfg['smilies_path'] . '/' . $file);
+ if (!is_dir(bb_realpath(BB_ROOT . config('tp.smilies_path') . '/' . $file))) {
+ $img_size = getimagesize(BB_ROOT . config('tp.smilies_path') . '/' . $file);
if ($img_size[0] && $img_size[1]) {
$smiley_images[] = $file;
@@ -71,7 +71,7 @@ if (isset($_GET['import_pack']) || isset($_POST['import_pack'])) {
}
}
- $fcontents = file(BB_ROOT . $bb_cfg['smilies_path'] . '/' . $smile_pak);
+ $fcontents = file(BB_ROOT . config('tp.smilies_path') . '/' . $smile_pak);
if (empty($fcontents)) {
bb_die('Could not read smiley pak file');
@@ -167,11 +167,11 @@ if (isset($_GET['import_pack']) || isset($_POST['import_pack'])) {
$template->assign_vars(array(
'TPL_SMILE_EDIT' => true,
- 'SMILEY_IMG' => BB_ROOT . $bb_cfg['smilies_path'] . '/' . $smiley_images[0],
+ 'SMILEY_IMG' => BB_ROOT . config('tp.smilies_path') . '/' . $smiley_images[0],
'S_SMILEY_ACTION' => 'admin_smilies.php',
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_FILENAME_OPTIONS' => $filename_list,
- 'S_SMILEY_BASEDIR' => BB_ROOT . $bb_cfg['smilies_path']
+ 'S_SMILEY_BASEDIR' => BB_ROOT . config('tp.smilies_path')
));
} elseif ($mode != '') {
switch ($mode) {
@@ -217,11 +217,11 @@ if (isset($_GET['import_pack']) || isset($_POST['import_pack'])) {
'TPL_SMILE_EDIT' => true,
'SMILEY_CODE' => $smile_data['code'],
'SMILEY_EMOTICON' => $smile_data['emoticon'],
- 'SMILEY_IMG' => BB_ROOT . $bb_cfg['smilies_path'] . '/' . $smiley_edit_img,
+ 'SMILEY_IMG' => BB_ROOT . config('tp.smilies_path') . '/' . $smiley_edit_img,
'S_SMILEY_ACTION' => 'admin_smilies.php',
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_FILENAME_OPTIONS' => $filename_list,
- 'S_SMILEY_BASEDIR' => BB_ROOT . $bb_cfg['smilies_path'],
+ 'S_SMILEY_BASEDIR' => BB_ROOT . config('tp.smilies_path'),
));
break;
@@ -310,7 +310,7 @@ if (isset($_GET['import_pack']) || isset($_POST['import_pack'])) {
$template->assign_block_vars('smiles', array(
'ROW_CLASS' => $row_class,
- 'SMILEY_IMG' => BB_ROOT . $bb_cfg['smilies_path'] . '/' . $smilies[$i]['smile_url'],
+ 'SMILEY_IMG' => BB_ROOT . config('tp.smilies_path') . '/' . $smilies[$i]['smile_url'],
'CODE' => $smilies[$i]['code'],
'EMOT' => $smilies[$i]['emoticon'],
diff --git a/admin/admin_terms.php b/admin/admin_terms.php
index cd8e0d3b3..adbdbdc6b 100644
--- a/admin/admin_terms.php
+++ b/admin/admin_terms.php
@@ -14,15 +14,15 @@ if (!empty($setmodules)) {
require __DIR__ . '/pagestart.php';
require INC_DIR . '/bbcode.php';
-if (isset($_POST['post']) && $bb_cfg['terms'] != $_POST['message']) {
+if (isset($_POST['post']) && config('tp.terms') != $_POST['message']) {
bb_update_config(array('terms' => $_POST['message']));
bb_die($lang['CONFIG_UPDATED']);
}
$template->assign_vars(array(
'S_ACTION' => 'admin_terms.php',
- 'EXT_LINK_NW' => $bb_cfg['ext_link_new_win'],
- 'MESSAGE' => $bb_cfg['terms'] ?: '',
+ 'EXT_LINK_NW' => config('tp.ext_link_new_win'),
+ 'MESSAGE' => config('tp.terms') ?: '',
'PREVIEW_HTML' => isset($_REQUEST['preview']) ? bbcode2html($_POST['message']) : '',
));
diff --git a/admin/admin_user_search.php b/admin/admin_user_search.php
index 5dec3c823..8bf9c633c 100644
--- a/admin/admin_user_search.php
+++ b/admin/admin_user_search.php
@@ -845,10 +845,10 @@ if (!isset($_REQUEST['dosearch'])) {
if ($page == 1) {
$offset = 0;
} else {
- $offset = (($page - 1) * $bb_cfg['topics_per_page']);
+ $offset = (($page - 1) * config('tp.topics_per_page'));
}
- $limit = "LIMIT $offset, " . $bb_cfg['topics_per_page'];
+ $limit = "LIMIT $offset, " . config('tp.topics_per_page');
$select_sql .= " $limit";
@@ -863,7 +863,7 @@ if (!isset($_REQUEST['dosearch'])) {
bb_die($lang['SEARCH_NO_RESULTS']);
}
}
- $num_pages = ceil($total_pages['total'] / $bb_cfg['topics_per_page']);
+ $num_pages = ceil($total_pages['total'] / config('tp.topics_per_page'));
$pagination = '';
diff --git a/admin/admin_words.php b/admin/admin_words.php
index 965a423f5..3207dd7ed 100644
--- a/admin/admin_words.php
+++ b/admin/admin_words.php
@@ -14,8 +14,8 @@ if (!empty($setmodules)) {
require __DIR__ . '/pagestart.php';
-if (!$bb_cfg['use_word_censor']) {
- bb_die('Word censor disabled ($bb_cfg[\'use_word_censor\'] in config.php)');
+if (!config('tp.use_word_censor')) {
+ bb_die('Word censor disabled ($cfg[\'use_word_censor\'] in config/tp.php)');
}
$mode = request_var('mode', '');
diff --git a/admin/index.php b/admin/index.php
index bc88f0ad5..ed1b87673 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -59,7 +59,7 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
} elseif (isset($_GET['pane']) && $_GET['pane'] == 'right') {
$template->assign_vars(array(
'TPL_ADMIN_MAIN' => true,
- 'ADMIN_LOCK' => $bb_cfg['board_disable'] ? true : false,
+ 'ADMIN_LOCK' => config('tp.board_disable') ? true : false,
'ADMIN_LOCK_CRON' => file_exists(BB_DISABLED) ? true : false,
));
@@ -67,8 +67,8 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$total_topics = get_db_stat('topiccount');
- $start_date = bb_date($bb_cfg['board_startdate']);
- $boarddays = (TIMENOW - $bb_cfg['board_startdate']) / 86400;
+ $start_date = bb_date(config('tp.board_startdate'));
+ $boarddays = (TIMENOW - config('tp.board_startdate')) / 86400;
$posts_per_day = sprintf('%.2f', $total_posts / $boarddays);
$topics_per_day = sprintf('%.2f', $total_topics / $boarddays);
@@ -76,10 +76,10 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
$avatar_dir_size = 0;
- if ($avatar_dir = opendir($bb_cfg['avatars']['upload_path'])) {
+ if ($avatar_dir = opendir(config('tp.avatars.upload_path'))) {
while ($file = readdir($avatar_dir)) {
if ($file != '.' && $file != '..') {
- $avatar_dir_size += @filesize(BB_ROOT . $bb_cfg['avatar_path'] . '/' . $file);
+ $avatar_dir_size += @filesize(BB_ROOT . config('tp.avatar_path') . '/' . $file);
}
}
closedir($avatar_dir);
@@ -169,7 +169,7 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
'STARTED' => bb_date($onlinerow_reg[$i]['session_start'], 'H:i', false),
'LASTUPDATE' => bb_date($onlinerow_reg[$i]['user_session_time'], 'H:i', false),
'IP_ADDRESS' => $reg_ip,
- 'U_WHOIS_IP' => $bb_cfg['whois_info'] . $reg_ip,
+ 'U_WHOIS_IP' => config('tp.whois_info') . $reg_ip,
));
}
}
@@ -192,7 +192,7 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
'STARTED' => bb_date($onlinerow_guest[$i]['session_start'], 'H:i', false),
'LASTUPDATE' => bb_date($onlinerow_guest[$i]['session_time'], 'H:i', false),
'IP_ADDRESS' => $guest_ip,
- 'U_WHOIS_IP' => $bb_cfg['whois_info'] . $guest_ip,
+ 'U_WHOIS_IP' => config('tp.whois_info') . $guest_ip,
));
}
}
diff --git a/admin/stats/tracker.php b/admin/stats/tracker.php
index fd61981ce..eb7778d7c 100644
--- a/admin/stats/tracker.php
+++ b/admin/stats/tracker.php
@@ -20,7 +20,7 @@ if (!IS_ADMIN) {
$peers_in_last_minutes = [30, 15, 5, 1];
$peers_in_last_sec_limit = 300;
-$announce_interval = (int)$bb_cfg['announce_interval'];
+$announce_interval = (int)config('tp.announce_interval');
$stat = array();
define('TMP_TRACKER_TABLE', 'tmp_tracker');
diff --git a/ajax.php b/ajax.php
index 130535bc1..b491c79b3 100644
--- a/ajax.php
+++ b/ajax.php
@@ -21,7 +21,7 @@ $user->session_start();
// Exit if board is disabled via ON/OFF trigger or by admin
if ($ajax->action != 'manage_admin') {
- if ($bb_cfg['board_disable']) {
+ if (config('tp.board_disable')) {
$ajax->ajax_die($lang['BOARD_DISABLE']);
} elseif (file_exists(BB_DISABLED)) {
$ajax->ajax_die($lang['BOARD_DISABLE_CRON']);
diff --git a/bootstrap.php b/bootstrap.php
index c6a11d60b..2deff7cb9 100644
--- a/bootstrap.php
+++ b/bootstrap.php
@@ -7,6 +7,8 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
+use Dotenv\Dotenv;
+use Dotenv\Exception\InvalidPathException;
use Illuminate\Cache\CacheManager;
use Illuminate\Config\Repository;
use Illuminate\Container\Container;
@@ -16,6 +18,12 @@ use Illuminate\Events\Dispatcher;
use Illuminate\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
+try {
+ (new Dotenv(__DIR__))->load();
+} catch (InvalidPathException $e) {
+ throw $e;
+}
+
/**
* Service Container
* @var Container $container
@@ -30,18 +38,17 @@ $container->instance('events', new Dispatcher);
/**
* Database
- * @var array $bb_cfg
*/
-$container->singleton('db', function ($container) use ($bb_cfg) {
+$container->singleton('db', function ($container) {
/** @var Manager $capsule */
$capsule = new Manager;
$capsule->addConnection([
'driver' => 'mysql',
- 'host' => $bb_cfg['database']['host'],
- 'database' => $bb_cfg['database']['database'],
- 'username' => $bb_cfg['database']['username'],
- 'password' => $bb_cfg['database']['password'],
+ 'host' => env('DB_HOST', 'localhost'),
+ 'database' => env('DB_DATABASE', 'torrentpier'),
+ 'username' => env('DB_USERNAME', 'root'),
+ 'password' => env('DB_PASSWORD', 'pass'),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
@@ -82,9 +89,7 @@ $container->singleton('config', function () {
/** @var Repository $config */
$config = new Repository;
- $files = [
- 'tp' => __DIR__ . '/library/config.php',
- ];
+ $files = [];
$configPath = __DIR__ . '/config';
@@ -97,12 +102,12 @@ $container->singleton('config', function () {
foreach ($files as $key => $path) {
if ($key === 'tp') {
- if (!$cfg = OLD_CACHE('bb_config')->get('config_bb_config')) {
- $cfg = [];
- foreach (DB::table('bb_config')->get()->toArray() as $row) {
- $cfg[$row['config_name']] = $row['config_value'];
- }
+ // if (!$cfg = OLD_CACHE('bb_config')->get('config_bb_config')) {
+ $cfg = [];
+ foreach (DB::table('bb_config')->get()->toArray() as $row) {
+ $cfg[$row['config_name']] = $row['config_value'];
}
+ // }
/** @noinspection PhpIncludeInspection */
$config->set($key, array_merge(require $path, $cfg));
} else {
diff --git a/bt/announce.php b/bt/announce.php
index f9defa524..01d781744 100644
--- a/bt/announce.php
+++ b/bt/announce.php
@@ -11,8 +11,6 @@ define('IN_TRACKER', true);
define('BB_ROOT', './../');
require dirname(__DIR__) . '/common.php';
-global $bb_cfg;
-
if (empty($_SERVER['HTTP_USER_AGENT'])) {
header('Location: http://127.0.0.1', true, 301);
die;
@@ -26,8 +24,8 @@ if (isset($_GET['event']) && $_GET['event'] === 'completed') {
dummy_exit(random_int(600, 1200));
}
-$announce_interval = $bb_cfg['announce_interval'];
-$passkey_key = $bb_cfg['passkey_key'];
+$announce_interval = config('tp.announce_interval');
+$passkey_key = config('tp.passkey_key');
$max_left_val = 536870912000; // 500 GB
$max_up_down_val = 5497558138880; // 5 TB
$max_up_add_val = 85899345920; // 80 GB
@@ -103,13 +101,13 @@ if (!verify_id($passkey, BT_AUTH_KEY_LENGTH)) {
// IP
$ip = $_SERVER['REMOTE_ADDR'];
-if (!$bb_cfg['ignore_reported_ip'] && isset($_GET['ip']) && $ip !== $_GET['ip']) {
- if (!$bb_cfg['verify_reported_ip']) {
+if (!config('tp.ignore_reported_ip') && isset($_GET['ip']) && $ip !== $_GET['ip']) {
+ if (!config('tp.verify_reported_ip')) {
$ip = $_GET['ip'];
} elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && preg_match_all('#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#', $_SERVER['HTTP_X_FORWARDED_FOR'], $matches)) {
foreach ($matches[0] as $x_ip) {
if ($x_ip === $_GET['ip']) {
- if (!$bb_cfg['allow_internal_ip'] && preg_match("#^(10|172\.16|192\.168)\.#", $x_ip)) {
+ if (!config('tp.allow_internal_ip') && preg_match("#^(10|172\.16|192\.168)\.#", $x_ip)) {
break;
}
$ip = $x_ip;
@@ -238,7 +236,7 @@ if ($lp_info) {
$rating_msg = '';
if (!$seeder) {
- foreach ($bb_cfg['rating'] as $ratio => $limit) {
+ foreach (config('tp.rating') as $ratio => $limit) {
if ($user_ratio < $ratio) {
config(['tracker.limit_active_tor' => 1]);
config(['tracker.limit_leech_count' => $limit]);
@@ -249,7 +247,7 @@ if ($lp_info) {
}
// Limit active torrents
- if (!isset($bb_cfg['unlimited_users'][$user_id]) && config('tracker.limit_active_tor') && ((config('tracker.limit_seed_count') && $seeder) || (config('tracker.limit_leech_count') && !$seeder))) {
+ if (null === config('tp.unlimited_users.' . $user_id) && config('tracker.limit_active_tor') && ((config('tracker.limit_seed_count') && $seeder) || (config('tracker.limit_leech_count') && !$seeder))) {
$sql = "SELECT COUNT(DISTINCT topic_id) AS active_torrents
FROM " . BB_BT_TRACKER . "
WHERE user_id = $user_id
@@ -388,7 +386,7 @@ $lp_info = array(
'tor_type' => (int)$tor_type,
);
-$lp_info_cached = OLD_CACHE('tr_cache')->set('peer_' . $peer_hash, $lp_info, round($bb_cfg['announce_interval'] * (0.85 * config('tracker.expire_factor'))));
+$lp_info_cached = OLD_CACHE('tr_cache')->set('peer_' . $peer_hash, $lp_info, round(config('tp.announce_interval') * (0.85 * config('tracker.expire_factor'))));
if (DBG_LOG && !$lp_info_cached) {
dbg_log(' ', '$lp_info-caching-FAIL');
@@ -454,7 +452,7 @@ if (!$output) {
'incomplete' => (int)$leechers,
);
- $peers_list_cached = OLD_CACHE('tr_cache')->set('peers_list_' . $topic_id, $output, round($bb_cfg['announce_interval'] * 0.7));
+ $peers_list_cached = OLD_CACHE('tr_cache')->set('peers_list_' . $topic_id, $output, round(config('tp.announce_interval') * 0.7));
if (DBG_LOG && !$peers_list_cached) {
dbg_log(' ', '$output-caching-FAIL');
diff --git a/bt/includes/init_tr.php b/bt/includes/init_tr.php
index 76519bbc4..5b8ed6fff 100644
--- a/bt/includes/init_tr.php
+++ b/bt/includes/init_tr.php
@@ -11,8 +11,6 @@ if (!defined('IN_TRACKER')) {
die(basename(__FILE__));
}
-global $bb_cfg;
-
// Exit if tracker is disabled
if (config('tracker.off')) {
msg_die(config('tracker.off_reason'));
diff --git a/bt/scrape.php b/bt/scrape.php
index 1b3a99cbc..dd66aadc9 100644
--- a/bt/scrape.php
+++ b/bt/scrape.php
@@ -11,8 +11,6 @@ define('IN_TRACKER', true);
define('BB_ROOT', './../');
require dirname(__DIR__) . '/common.php';
-global $bb_cfg;
-
if (!config('tracker.scrape')) {
msg_die('Please disable SCRAPE!');
}
diff --git a/common.php b/common.php
index 7a9e0ae2f..281b83ab2 100644
--- a/common.php
+++ b/common.php
@@ -50,30 +50,19 @@ if (!file_exists(__DIR__ . '/vendor/autoload.php')) {
}
require_once __DIR__ . '/vendor/autoload.php';
-// Legacy config
-use Dotenv\Dotenv;
-use Dotenv\Exception\InvalidPathException;
-
-try {
- (new Dotenv(__DIR__))->load();
-} catch (InvalidPathException $e) {
- throw $e;
-}
-require_once __DIR__ . '/library/config.php';
-
/**
* Container
*/
require_once __DIR__ . '/bootstrap.php';
-$server_protocol = $bb_cfg['cookie_secure'] ? 'https://' : 'http://';
-$server_port = in_array((int)$bb_cfg['server_port'], array(80, 443), true) ? '' : ':' . $bb_cfg['server_port'];
-define('FORUM_PATH', $bb_cfg['script_path']);
-define('FULL_URL', $server_protocol . $bb_cfg['server_name'] . $server_port . $bb_cfg['script_path']);
+$server_protocol = config('tp.cookie_secure') ? 'https://' : 'http://';
+$server_port = in_array((int)config('tp.server_port'), array(80, 443), true) ? '' : ':' . config('tp.server_port');
+define('FORUM_PATH', config('tp.script_path'));
+define('FULL_URL', $server_protocol . config('tp.server_name') . $server_port . config('tp.script_path'));
unset($server_protocol, $server_port);
// Debug options
-define('DBG_USER', (isset($_COOKIE[COOKIE_DBG])));
+define('DBG_USER', isset($_COOKIE[COOKIE_DBG]));
// Board / tracker shared constants and functions
define('BB_BT_TORRENTS', 'bb_bt_torrents');
@@ -98,10 +87,10 @@ define('BOT_UID', -746);
/**
* Progressive error reporting
*/
-if ($bb_cfg['bugsnag']['enabled']) {
+if (config('tp.bugsnag.enabled')) {
if (env('APP_ENV', 'production') !== 'local') {
/** @var Bugsnag\Handler $bugsnag */
- $bugsnag = Bugsnag\Client::make($bb_cfg['bugsnag']['api_key']);
+ $bugsnag = Bugsnag\Client::make(config('tp.bugsnag.api_key'));
Bugsnag\Handler::register($bugsnag);
}
} else {
@@ -116,7 +105,7 @@ if ($bb_cfg['bugsnag']['enabled']) {
/**
* Database
*/
-$DBS = new TorrentPier\Legacy\Dbs($bb_cfg);
+$DBS = new TorrentPier\Legacy\Dbs(config('tp'));
function OLD_DB($db_alias = 'db')
{
@@ -127,7 +116,7 @@ function OLD_DB($db_alias = 'db')
/**
* Cache
*/
-$CACHES = new TorrentPier\Legacy\Caches($bb_cfg);
+$CACHES = new TorrentPier\Legacy\Caches(config('tp'));
function OLD_CACHE($cache_name)
{
@@ -138,35 +127,35 @@ function OLD_CACHE($cache_name)
/**
* Datastore
*/
-switch ($bb_cfg['datastore_type']) {
+switch (config('tp.datastore_type')) {
case 'memcache':
- $datastore = new TorrentPier\Legacy\Datastore\Memcache($bb_cfg['cache']['memcache'], $bb_cfg['cache']['prefix']);
+ $datastore = new TorrentPier\Legacy\Datastore\Memcache(config('tp.cache.memcache'), config('tp.cache.prefix'));
break;
case 'sqlite':
$default_cfg = array(
- 'db_file_path' => $bb_cfg['cache']['db_dir'] . 'datastore.sqlite.db',
+ 'db_file_path' => config('tp.cache.db_dir') . 'datastore.sqlite.db',
'pconnect' => true,
'con_required' => true,
);
- $datastore = new TorrentPier\Legacy\Datastore\Sqlite($default_cfg, $bb_cfg['cache']['prefix']);
+ $datastore = new TorrentPier\Legacy\Datastore\Sqlite($default_cfg, config('tp.cache.prefix'));
break;
case 'redis':
- $datastore = new TorrentPier\Legacy\Datastore\Redis($bb_cfg['cache']['redis'], $bb_cfg['cache']['prefix']);
+ $datastore = new TorrentPier\Legacy\Datastore\Redis(config('tp.cache.redis'), config('tp.cache.prefix'));
break;
case 'apc':
- $datastore = new TorrentPier\Legacy\Datastore\Apc($bb_cfg['cache']['prefix']);
+ $datastore = new TorrentPier\Legacy\Datastore\Apc(config('tp.cache.prefix'));
break;
case 'xcache':
- $datastore = new TorrentPier\Legacy\Datastore\Xcache($bb_cfg['cache']['prefix']);
+ $datastore = new TorrentPier\Legacy\Datastore\Xcache(config('tp.cache.prefix'));
break;
case 'filecache':
default:
- $datastore = new TorrentPier\Legacy\Datastore\File($bb_cfg['cache']['db_dir'] . 'datastore/', $bb_cfg['cache']['prefix']);
+ $datastore = new TorrentPier\Legacy\Datastore\File(config('tp.cache.db_dir') . 'datastore/', config('tp.cache.prefix'));
}
function sql_dbg_enabled()
diff --git a/dl.php b/dl.php
index eb2c6cdaa..37102372c 100644
--- a/dl.php
+++ b/dl.php
@@ -24,7 +24,7 @@ $thumbnail = request_var('thumb', 0);
// Send file to browser
function send_file_to_browser($attachment, $upload_dir)
{
- global $bb_cfg, $lang, $userdata;
+ global $lang, $userdata;
$filename = ($upload_dir == '') ? $attachment['physical_filename'] : $upload_dir . '/' . $attachment['physical_filename'];
diff --git a/feed.php b/feed.php
index 5440fae56..c23b4323d 100644
--- a/feed.php
+++ b/feed.php
@@ -33,12 +33,12 @@ if ($mode == 'get_feed_url' && ($type == 'f' || $type == 'u') && $id >= 0) {
bb_simple_die($lang['ATOM_ERROR'] . ' #1');
}
}
- if (file_exists($bb_cfg['atom']['path'] . '/f/' . $id . '.atom') && filemtime($bb_cfg['atom']['path'] . '/f/' . $id . '.atom') > $timecheck) {
- redirectToUrl($bb_cfg['atom']['url'] . '/f/' . $id . '.atom');
+ if (file_exists(config('tp.atom.path') . '/f/' . $id . '.atom') && filemtime(config('tp.atom.path') . '/f/' . $id . '.atom') > $timecheck) {
+ redirectToUrl(config('tp.atom.url') . '/f/' . $id . '.atom');
} else {
require_once INC_DIR . '/functions_atom.php';
if (update_forum_feed($id, $forum_data)) {
- redirectToUrl($bb_cfg['atom']['url'] . '/f/' . $id . '.atom');
+ redirectToUrl(config('tp.atom.url') . '/f/' . $id . '.atom');
} else {
bb_simple_die($lang['ATOM_NO_FORUM']);
}
@@ -52,12 +52,12 @@ if ($mode == 'get_feed_url' && ($type == 'f' || $type == 'u') && $id >= 0) {
if (!$username = get_username($id)) {
bb_simple_die($lang['ATOM_ERROR'] . ' #3');
}
- if (file_exists($bb_cfg['atom']['path'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom') && filemtime($bb_cfg['atom']['path'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom') > $timecheck) {
- redirectToUrl($bb_cfg['atom']['url'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
+ if (file_exists(config('tp.atom.path') . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom') && filemtime(config('tp.atom.path') . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom') > $timecheck) {
+ redirectToUrl(config('tp.atom.url') . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
} else {
require_once INC_DIR . '/functions_atom.php';
if (update_user_feed($id, $username)) {
- redirectToUrl($bb_cfg['atom']['url'] . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
+ redirectToUrl(config('tp.atom.url') . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
} else {
bb_simple_die($lang['ATOM_NO_USER']);
}
diff --git a/group.php b/group.php
index 284ebb25d..7f7a4dadf 100644
--- a/group.php
+++ b/group.php
@@ -20,7 +20,7 @@ $select_sort_mode = $select_sort_order = '';
function generate_user_info(&$row, $date_format, $group_mod, &$from, &$posts, &$joined, &$pm, &$email, &$www, &$user_time, &$avatar)
{
- global $lang, $images, $bb_cfg;
+ global $lang, $images;
$from = (!empty($row['user_from'])) ? $row['user_from'] : '';
$joined = bb_date($row['user_regdate']);
@@ -30,7 +30,7 @@ function generate_user_info(&$row, $date_format, $group_mod, &$from, &$posts, &$
$avatar = get_avatar($row['user_id'], $row['avatar_ext_id'], !bf($row['user_opt'], 'user_opt', 'dis_avatar'), '', 50, 50);
if (bf($row['user_opt'], 'user_opt', 'user_viewemail') || $group_mod) {
- $email_uri = ($bb_cfg['board_email_form']) ? ("profile.php?mode=email&" . POST_USERS_URL . "=" . $row['user_id']) : 'mailto:' . $row['user_email'];
+ $email_uri = config('tp.board_email_form') ? ("profile.php?mode=email&" . POST_USERS_URL . "=" . $row['user_id']) : 'mailto:' . $row['user_email'];
$email = '' . $row['user_email'] . ' ';
} else {
$email = '';
@@ -51,7 +51,7 @@ set_die_append_msg();
$group_id = isset($_REQUEST[POST_GROUPS_URL]) ? (int)$_REQUEST[POST_GROUPS_URL] : null;
$start = isset($_REQUEST['start']) ? abs((int)$_REQUEST['start']) : 0;
-$per_page = $bb_cfg['group_members_per_page'];
+$per_page = config('tp.group_members_per_page');
$view_mode = isset($_REQUEST['view']) ? (string)$_REQUEST['view'] : null;
$rel_limit = 50;
@@ -195,18 +195,18 @@ if (!$group_id) {
add_user_into_group($group_id, $userdata['user_id'], 1, TIMENOW);
- if ($bb_cfg['group_send_email']) {
+ if (config('tp.group_send_email')) {
/** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\Emailer();
- $emailer->set_from([$bb_cfg['board_email'] => $bb_cfg['sitename']]);
+ $emailer->set_from([config('tp.board_email') => config('tp.sitename')]);
$emailer->set_to([$moderator['user_email'] => $moderator['username']]);
$emailer->set_subject($lang['EMAILER_SUBJECT']['GROUP_REQUEST']);
$emailer->set_template('group_request', $moderator['user_lang']);
$emailer->assign_vars(array(
'USER' => $userdata['username'],
- 'SITENAME' => $bb_cfg['sitename'],
+ 'SITENAME' => config('tp.sitename'),
'GROUP_MODERATOR' => $moderator['username'],
'U_GROUP' => make_url(GROUP_URL . $group_id),
));
@@ -237,17 +237,17 @@ if (!$group_id) {
add_user_into_group($group_id, $row['user_id']);
- if ($bb_cfg['group_send_email']) {
+ if (config('tp.group_send_email')) {
/** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\Emailer();
- $emailer->set_from([$bb_cfg['board_email'] => $bb_cfg['sitename']]);
+ $emailer->set_from([config('tp.board_email') => config('tp.sitename')]);
$emailer->set_to([$row['user_email'] => $row['username']]);
$emailer->set_subject($lang['EMAILER_SUBJECT']['GROUP_ADDED']);
$emailer->set_template('group_added', $row['user_lang']);
$emailer->assign_vars(array(
- 'SITENAME' => $bb_cfg['sitename'],
+ 'SITENAME' => config('tp.sitename'),
'GROUP_NAME' => $group_info['group_name'],
'U_GROUP' => make_url(GROUP_URL . $group_id),
));
@@ -287,7 +287,7 @@ if (!$group_id) {
}
}
// Email users when they are approved
- if (!empty($_POST['approve']) && $bb_cfg['group_send_email']) {
+ if (!empty($_POST['approve']) && config('tp.group_send_email')) {
$sql_select = "SELECT username, user_email, user_lang
FROM " . BB_USERS . "
WHERE user_id IN($sql_in)";
@@ -300,13 +300,13 @@ if (!$group_id) {
/** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\Emailer();
- $emailer->set_from([$bb_cfg['board_email'] => $bb_cfg['sitename']]);
+ $emailer->set_from([config('tp.board_email') => config('tp.sitename')]);
$emailer->set_to([$row['user_email'] => $row['username']]);
$emailer->set_subject($lang['EMAILER_SUBJECT']['GROUP_APPROVED']);
$emailer->set_template('group_approved', $row['user_lang']);
$emailer->assign_vars(array(
- 'SITENAME' => $bb_cfg['sitename'],
+ 'SITENAME' => config('tp.sitename'),
'GROUP_NAME' => $group_info['group_name'],
'U_GROUP' => make_url(GROUP_URL . $group_id),
));
@@ -375,7 +375,7 @@ if (!$group_id) {
$username = $group_moderator['username'];
$user_id = $group_moderator['user_id'];
- generate_user_info($group_moderator, $bb_cfg['default_dateformat'], $is_moderator, $from, $posts, $joined, $pm, $email, $www, $user_time, $avatar);
+ generate_user_info($group_moderator, config('tp.default_dateformat'), $is_moderator, $from, $posts, $joined, $pm, $email, $www, $user_time, $avatar);
$group_type = '';
if ($group_info['group_type'] == GROUP_OPEN) {
@@ -524,7 +524,7 @@ if (!$group_id) {
foreach ($group_members as $i => $member) {
$user_id = $member['user_id'];
- generate_user_info($member, $bb_cfg['default_dateformat'], $is_moderator, $from, $posts, $joined, $pm, $email, $www, $user_time, $avatar);
+ generate_user_info($member, config('tp.default_dateformat'), $is_moderator, $from, $posts, $joined, $pm, $email, $www, $user_time, $avatar);
if ($group_info['group_type'] != GROUP_HIDDEN || $is_group_member || $is_moderator) {
$row_class = !($i % 2) ? 'row1' : 'row2';
@@ -578,7 +578,7 @@ if (!$group_id) {
foreach ($modgroup_pending_list as $i => $member) {
$user_id = $member['user_id'];
- generate_user_info($member, $bb_cfg['default_dateformat'], $is_moderator, $from, $posts, $joined, $pm, $email, $www, $user_time, $avatar);
+ generate_user_info($member, config('tp.default_dateformat'), $is_moderator, $from, $posts, $joined, $pm, $email, $www, $user_time, $avatar);
$row_class = !($i % 2) ? 'row1' : 'row2';
diff --git a/group_edit.php b/group_edit.php
index 55bb89a85..632a470f3 100644
--- a/group_edit.php
+++ b/group_edit.php
@@ -36,10 +36,10 @@ if ($group_id) {
if ($is_moderator) {
// Avatar
if ($submit) {
- if (!empty($_FILES['avatar']['name']) && $bb_cfg['group_avatars']['up_allowed']) {
+ if (!empty($_FILES['avatar']['name']) && config('tp.group_avatars.up_allowed')) {
$upload = new TorrentPier\Legacy\Common\Upload();
- if ($upload->init($bb_cfg['group_avatars'], $_FILES['avatar']) and $upload->store('avatar', array("user_id" => GROUP_AVATAR_MASK . $group_id, "avatar_ext_id" => $group_info['avatar_ext_id']))) {
+ if ($upload->init(config('tp.group_avatars'), $_FILES['avatar']) and $upload->store('avatar', array("user_id" => GROUP_AVATAR_MASK . $group_id, "avatar_ext_id" => $group_info['avatar_ext_id']))) {
$avatar_ext_id = (int)$upload->file_ext_id;
} else {
bb_die(implode($upload->errors));
@@ -78,7 +78,7 @@ if ($is_moderator) {
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_GROUP_CONFIG_ACTION' => "group_edit.php?" . POST_GROUPS_URL . "=$group_id",
- 'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], $bb_cfg['group_avatars']['max_width'], $bb_cfg['group_avatars']['max_height'], (round($bb_cfg['group_avatars']['max_size'] / 1024))),
+ 'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], config('tp.group_avatars.max_width'), config('tp.group_avatars.max_height'), round(config('tp.group_avatars.max_size') / 1024)),
'AVATAR_IMG' => get_avatar(GROUP_AVATAR_MASK . $group_id, $group_info['avatar_ext_id']),
));
diff --git a/index.php b/index.php
index 73bc5f8d6..35f022245 100644
--- a/index.php
+++ b/index.php
@@ -25,10 +25,10 @@ $datastore->enqueue(array(
'moderators',
'cat_forums',
));
-if ($bb_cfg['show_latest_news']) {
+if (config('tp.show_latest_news')) {
$datastore->enqueue('latest_news');
}
-if ($bb_cfg['show_network_news']) {
+if (config('tp.show_network_news')) {
$datastore->enqueue('network_news');
}
@@ -44,7 +44,7 @@ $req_page = 'index_page';
$req_page .= ($viewcat) ? "_c{$viewcat}" : '';
define('REQUESTED_PAGE', $req_page);
-caching_output(IS_GUEST, 'send', REQUESTED_PAGE . '_guest_' . $bb_cfg['default_lang']);
+caching_output(IS_GUEST, 'send', REQUESTED_PAGE . '_guest_' . config('tp.default_lang'));
$hide_cat_opt = isset($user->opt_js['h_cat']) ? (string)$user->opt_js['h_cat'] : 0;
$hide_cat_user = array_flip(explode('-', $hide_cat_opt));
@@ -248,7 +248,7 @@ foreach ($cat_forums as $cid => $c) {
'LAST_TOPIC_ID' => $f['last_topic_id'],
'LAST_TOPIC_TIP' => $f['last_topic_title'],
'LAST_TOPIC_TITLE' => wbr(str_short($f['last_topic_title'], $last_topic_max_len)),
- 'LAST_POST_TIME' => bb_date($f['last_post_time'], $bb_cfg['last_post_date_format']),
+ 'LAST_POST_TIME' => bb_date($f['last_post_time'], config('tp.last_post_date_format')),
'LAST_POST_USER' => profile_url(array('username' => str_short($f['last_post_username'], 15), 'user_id' => $f['last_post_user_id'], 'user_rank' => $f['last_post_user_rank'])),
));
}
@@ -264,7 +264,7 @@ $template->assign_vars(array(
'TOTAL_TOPICS' => sprintf($lang['POSTED_TOPICS_TOTAL'], $stats['topiccount']),
'TOTAL_POSTS' => sprintf($lang['POSTED_ARTICLES_TOTAL'], $stats['postcount']),
'TOTAL_USERS' => sprintf($lang['REGISTERED_USERS_TOTAL'], $stats['usercount']),
- 'TOTAL_GENDER' => $bb_cfg['gender'] ? sprintf(
+ 'TOTAL_GENDER' => config('tp.gender') ? sprintf(
$lang['USERS_TOTAL_GENDER'],
$stats['male'],
$stats['female'],
@@ -273,22 +273,22 @@ $template->assign_vars(array(
'NEWEST_USER' => sprintf($lang['NEWEST_USER'], profile_url($stats['newestuser'])),
// Tracker stats
- 'TORRENTS_STAT' => $bb_cfg['tor_stats'] ? sprintf(
+ 'TORRENTS_STAT' => config('tp.tor_stats') ? sprintf(
$lang['TORRENTS_STAT'],
$stats['torrentcount'],
humn_size($stats['size'])
) : '',
- 'PEERS_STAT' => $bb_cfg['tor_stats'] ? sprintf(
+ 'PEERS_STAT' => config('tp.tor_stats') ? sprintf(
$lang['PEERS_STAT'],
$stats['peers'],
$stats['seeders'],
$stats['leechers']
) : '',
- 'SPEED_STAT' => $bb_cfg['tor_stats'] ? sprintf(
+ 'SPEED_STAT' => config('tp.tor_stats') ? sprintf(
$lang['SPEED_STAT'],
humn_size($stats['speed']) . '/s'
) : '',
- 'SHOW_MOD_INDEX' => $bb_cfg['show_mod_index'],
+ 'SHOW_MOD_INDEX' => config('tp.show_mod_index'),
'FORUM_IMG' => $images['forum'],
'FORUM_NEW_IMG' => $images['forum_new'],
'FORUM_LOCKED_IMG' => $images['forum_locked'],
@@ -306,12 +306,12 @@ $template->assign_vars(array(
));
// Set tpl vars for bt_userdata
-if ($bb_cfg['bt_show_dl_stat_on_index'] && !IS_GUEST) {
+if (config('tp.bt_show_dl_stat_on_index') && !IS_GUEST) {
show_bt_userdata($userdata['user_id']);
}
// Latest news
-if ($bb_cfg['show_latest_news']) {
+if (config('tp.show_latest_news')) {
if (!$latest_news = $datastore->get('latest_news')) {
$datastore->update('latest_news');
$latest_news = $datastore->get('latest_news');
@@ -324,7 +324,7 @@ if ($bb_cfg['show_latest_news']) {
foreach ($latest_news as $news) {
$template->assign_block_vars('news', array(
'NEWS_TOPIC_ID' => $news['topic_id'],
- 'NEWS_TITLE' => str_short($news['topic_title'], $bb_cfg['max_news_title']),
+ 'NEWS_TITLE' => str_short($news['topic_title'], config('tp.max_news_title')),
'NEWS_TIME' => bb_date($news['topic_time'], 'd-M', false),
'NEWS_IS_NEW' => is_unread($news['topic_time'], $news['topic_id'], $news['forum_id']),
));
@@ -332,7 +332,7 @@ if ($bb_cfg['show_latest_news']) {
}
// Network news
-if ($bb_cfg['show_network_news']) {
+if (config('tp.show_network_news')) {
if (!$network_news = $datastore->get('network_news')) {
$datastore->update('network_news');
$network_news = $datastore->get('network_news');
@@ -345,14 +345,14 @@ if ($bb_cfg['show_network_news']) {
foreach ($network_news as $net) {
$template->assign_block_vars('net', array(
'NEWS_TOPIC_ID' => $net['topic_id'],
- 'NEWS_TITLE' => str_short($net['topic_title'], $bb_cfg['max_net_title']),
+ 'NEWS_TITLE' => str_short($net['topic_title'], config('tp.max_net_title')),
'NEWS_TIME' => bb_date($net['topic_time'], 'd-M', false),
'NEWS_IS_NEW' => is_unread($net['topic_time'], $net['topic_id'], $net['forum_id']),
));
}
}
-if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
+if (config('tp.birthday_check_day') && config('tp.birthday_enabled')) {
$week_list = $today_list = array();
$week_all = $today_all = false;
@@ -366,9 +366,9 @@ if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
$week_list[] = profile_url($week) . ' (' . birthday_age($week['user_birthday'] - 1) . ') ';
}
$week_all = ($week_all) ? ' ... ' : '';
- $week_list = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], implode(', ', $week_list)) . $week_all;
+ $week_list = sprintf($lang['BIRTHDAY_WEEK'], config('tp.birthday_check_day'), implode(', ', $week_list)) . $week_all;
} else {
- $week_list = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']);
+ $week_list = sprintf($lang['NOBIRTHDAY_WEEK'], config('tp.birthday_check_day'));
}
if (!empty($stats['birthday_today_list'])) {
diff --git a/library/TorrentPier/TorrentPier/Legacy/BBCode.php b/library/TorrentPier/TorrentPier/Legacy/BBCode.php
index 489956350..afb31ad46 100644
--- a/library/TorrentPier/TorrentPier/Legacy/BBCode.php
+++ b/library/TorrentPier/TorrentPier/Legacy/BBCode.php
@@ -133,8 +133,6 @@ class BBCode
*/
public function bbcode2html($text)
{
- global $bb_cfg;
-
$text = " $text ";
$text = static::clean_up($text);
$text = $this->spam_filter($text);
@@ -169,7 +167,7 @@ class BBCode
$text = $this->new_line2html($text);
$text = trim($text);
- if ($bb_cfg['tidy_post']) {
+ if (config('tp.tidy_post')) {
$text = $this->tidy($text);
}
@@ -199,7 +197,6 @@ class BBCode
*/
private function spam_filter($text)
{
- global $bb_cfg;
static $spam_words = null;
static $spam_replace = ' СПАМ';
@@ -208,11 +205,11 @@ class BBCode
}
// set $spam_words and $spam_replace
- if (!$bb_cfg['spam_filter_file_path']) {
+ if (!config('tp.spam_filter_file_path')) {
return $text;
}
if (null === $spam_words) {
- $spam_words = file_get_contents($bb_cfg['spam_filter_file_path']);
+ $spam_words = file_get_contents(config('tp.spam_filter_file_path'));
$spam_words = strtolower($spam_words);
$spam_words = explode("\n", $spam_words);
}
@@ -272,8 +269,6 @@ class BBCode
*/
public function url_callback($m)
{
- global $bb_cfg;
-
$url = trim($m[1]);
$url_name = isset($m[2]) ? trim($m[2]) : $url;
@@ -281,7 +276,7 @@ class BBCode
$url = 'http://' . $url;
}
- if (in_array(parse_url($url, PHP_URL_HOST), $bb_cfg['nofollow']['allowed_url']) || $bb_cfg['nofollow']['disabled']) {
+ if (in_array(parse_url($url, PHP_URL_HOST), config('tp.nofollow.allowed_url')) || config('tp.nofollow.disabled')) {
$link = "$url_name ";
} else {
$link = "$url_name ";
@@ -346,13 +341,11 @@ class BBCode
*/
public function make_url_clickable_callback($m)
{
- global $bb_cfg;
-
$max_len = 70;
$href = $m[1];
$name = (mb_strlen($href, 'UTF-8') > $max_len) ? mb_substr($href, 0, $max_len - 19) . '...' . mb_substr($href, -16) : $href;
- if (in_array(parse_url($href, PHP_URL_HOST), $bb_cfg['nofollow']['allowed_url']) || $bb_cfg['nofollow']['disabled']) {
+ if (in_array(parse_url($href, PHP_URL_HOST), config('tp.nofollow.allowed_url')) || config('tp.nofollow.disabled')) {
$link = "$name ";
} else {
$link = "$name ";
diff --git a/library/TorrentPier/TorrentPier/Legacy/Common/Upload.php b/library/TorrentPier/TorrentPier/Legacy/Common/Upload.php
index 58b15f956..5d94b4e05 100644
--- a/library/TorrentPier/TorrentPier/Legacy/Common/Upload.php
+++ b/library/TorrentPier/TorrentPier/Legacy/Common/Upload.php
@@ -30,11 +30,11 @@ class Upload
'error' => UPLOAD_ERR_NO_FILE,
];
public $orig_name = '';
- public $file_path = ''; // Stored file path
+ public $file_path = '';
public $file_ext = '';
public $file_ext_id = '';
public $file_size = '';
- public $ext_ids = []; // array_flip($bb_cfg['file_id_ext'])
+ public $ext_ids = [];
public $errors = [];
public $img_types = [
1 => 'gif',
@@ -53,7 +53,7 @@ class Upload
*/
public function init(array $cfg = [], array $post_params = [], $uploaded_only = true)
{
- global $bb_cfg, $lang;
+ global $lang;
$this->cfg = array_merge($this->cfg, $cfg);
$this->file = $post_params;
@@ -85,7 +85,7 @@ class Upload
return false;
}
// get ext
- $this->ext_ids = array_flip($bb_cfg['file_id_ext']);
+ $this->ext_ids = array_flip(config('tp.file_id_ext'));
$file_name_ary = explode('.', $this->file['name']);
$this->file_ext = strtolower(end($file_name_ary));
diff --git a/library/TorrentPier/TorrentPier/Legacy/Common/User.php b/library/TorrentPier/TorrentPier/Legacy/Common/User.php
index da65582b3..90820a349 100644
--- a/library/TorrentPier/TorrentPier/Legacy/Common/User.php
+++ b/library/TorrentPier/TorrentPier/Legacy/Common/User.php
@@ -101,8 +101,6 @@ class User
*/
public function session_start(array $cfg = [])
{
- global $bb_cfg;
-
$update_sessions_table = false;
$this->cfg = array_merge($this->cfg, $cfg);
@@ -120,7 +118,7 @@ class User
if ($session_id) {
$SQL['WHERE'][] = "s.session_id = '$session_id'";
- if ($bb_cfg['torhelp_enabled']) {
+ if (config('tp.torhelp_enabled')) {
$SQL['SELECT'][] = "th.topic_id_csv AS torhelp";
$SQL['LEFT JOIN'][] = BB_BT_TORHELP . " th ON(u.user_id = th.user_id)";
}
@@ -136,7 +134,7 @@ class User
if (!$this->data = cache_get_userdata($userdata_cache_id)) {
$this->data = OLD_DB()->fetch_row($SQL);
- if ($this->data && (TIMENOW - $this->data['session_time']) > $bb_cfg['session_update_intrv']) {
+ if ($this->data && (TIMENOW - $this->data['session_time']) > config('tp.session_update_intrv')) {
$this->data['session_time'] = TIMENOW;
$update_sessions_table = true;
}
@@ -177,7 +175,7 @@ class User
// using the cookie user_id if available to pull basic user prefs.
if (!$this->data) {
$login = false;
- $user_id = ($bb_cfg['allow_autologin'] && $this->sessiondata['uk'] && $this->sessiondata['uid']) ? $this->sessiondata['uid'] : GUEST_UID;
+ $user_id = (config('tp.allow_autologin') && $this->sessiondata['uk'] && $this->sessiondata['uid']) ? $this->sessiondata['uid'] : GUEST_UID;
if ($userdata = get_userdata((int)$user_id, false, true)) {
if ($userdata['user_id'] != GUEST_UID && $userdata['user_active']) {
@@ -198,7 +196,7 @@ class User
define('IS_MOD', !IS_GUEST && (int)$this->data['user_level'] === MOD);
define('IS_GROUP_MEMBER', !IS_GUEST && (int)$this->data['user_level'] === GROUP_MEMBER);
define('IS_USER', !IS_GUEST && (int)$this->data['user_level'] === USER);
- define('IS_SUPER_ADMIN', IS_ADMIN && isset($bb_cfg['super_admins'][$this->data['user_id']]));
+ define('IS_SUPER_ADMIN', IS_ADMIN && null !== config('tp.super_admins.' . $this->data['user_id']));
define('IS_AM', IS_ADMIN || IS_MOD);
$this->set_shortcuts();
@@ -223,8 +221,6 @@ class User
*/
public function session_create($userdata, $auto_created = false)
{
- global $bb_cfg;
-
$this->data = $userdata;
$session_id = $this->sessiondata['sid'];
@@ -274,8 +270,8 @@ class User
if (!$session_time = $this->data['user_session_time']) {
$last_visit = TIMENOW;
define('FIRST_LOGON', true);
- } elseif ($session_time < (TIMENOW - $bb_cfg['last_visit_update_intrv'])) {
- $last_visit = max($session_time, (TIMENOW - 86400 * $bb_cfg['max_last_visit_days']));
+ } elseif ($session_time < (TIMENOW - config('tp.last_visit_update_intrv'))) {
+ $last_visit = max($session_time, TIMENOW - 86400 * config('tp.max_last_visit_days'));
}
if ($last_visit != $this->data['user_lastvisit']) {
@@ -294,7 +290,7 @@ class User
$this->data['user_lastvisit'] = $last_visit;
}
- if (!empty($_POST['autologin']) && $bb_cfg['allow_autologin']) {
+ if (!empty($_POST['autologin']) && config('tp.allow_autologin')) {
if (!$auto_created) {
$this->verify_autologin_id($this->data, true, true);
}
@@ -455,8 +451,6 @@ class User
*/
public function set_session_cookies($user_id)
{
- global $bb_cfg;
-
if ($user_id == GUEST_UID) {
$delete_cookies = [
COOKIE_DATA,
@@ -479,7 +473,7 @@ class User
if ($c_sdata_curr !== $c_sdata_resv) {
bb_setcookie(COOKIE_DATA, $c_sdata_curr, COOKIE_PERSIST, true);
}
- if (isset($bb_cfg['dbg_users'][$this->data['user_id']]) && !isset($_COOKIE[COOKIE_DBG])) {
+ if (null !== config('tp.dbg_users.' . $this->data['user_id']) && !isset($_COOKIE[COOKIE_DBG])) {
bb_setcookie(COOKIE_DBG, 1, COOKIE_SESSION);
}
}
@@ -496,8 +490,6 @@ class User
*/
public function verify_autologin_id($userdata, $expire_check = false, $create_new = true)
{
- global $bb_cfg;
-
$autologin_id = $userdata['autologin_id'];
if ($expire_check) {
@@ -505,8 +497,8 @@ class User
return $this->create_autologin_id($userdata);
}
- if ($autologin_id && $userdata['user_session_time'] && $bb_cfg['max_autologin_time']) {
- if (TIMENOW - $userdata['user_session_time'] > $bb_cfg['max_autologin_time'] * 86400) {
+ if ($autologin_id && $userdata['user_session_time'] && config('tp.max_autologin_time')) {
+ if (TIMENOW - $userdata['user_session_time'] > config('tp.max_autologin_time') * 86400) {
return $this->create_autologin_id($userdata, $create_new);
}
}
@@ -557,28 +549,28 @@ class User
*/
public function init_userprefs()
{
- global $bb_cfg, $theme, $source_lang, $DeltaTime;
+ global $theme, $source_lang, $DeltaTime;
if (defined('LANG_DIR')) {
return;
} // prevent multiple calling
- define('DEFAULT_LANG_DIR', LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'] . '/');
+ define('DEFAULT_LANG_DIR', LANG_ROOT_DIR . '/' . config('tp.default_lang') . '/');
define('SOURCE_LANG_DIR', LANG_ROOT_DIR . '/source/');
if ($this->data['user_id'] != GUEST_UID) {
- if ($this->data['user_lang'] && $this->data['user_lang'] != $bb_cfg['default_lang']) {
- $bb_cfg['default_lang'] = basename($this->data['user_lang']);
- define('LANG_DIR', LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'] . '/');
+ if ($this->data['user_lang'] && $this->data['user_lang'] != config('tp.default_lang')) {
+ config(['tp.default_lang' => basename($this->data['user_lang'])]);
+ define('LANG_DIR', LANG_ROOT_DIR . '/' . config('tp.default_lang') . '/');
}
if (isset($this->data['user_timezone'])) {
- $bb_cfg['board_timezone'] = $this->data['user_timezone'];
+ config(['tp.board_timezone' => $this->data['user_timezone']]);
}
}
- $this->data['user_lang'] = $bb_cfg['default_lang'];
- $this->data['user_timezone'] = $bb_cfg['board_timezone'];
+ $this->data['user_lang'] = config('tp.default_lang');
+ $this->data['user_timezone'] = config('tp.board_timezone');
if (!defined('LANG_DIR')) {
define('LANG_DIR', DEFAULT_LANG_DIR);
diff --git a/library/TorrentPier/TorrentPier/Legacy/Emailer.php b/library/TorrentPier/TorrentPier/Legacy/Emailer.php
index 60534af2a..0d3725a1a 100644
--- a/library/TorrentPier/TorrentPier/Legacy/Emailer.php
+++ b/library/TorrentPier/TorrentPier/Legacy/Emailer.php
@@ -62,9 +62,7 @@ class Emailer
public function __construct()
{
- global $bb_cfg;
-
- $this->reply = $bb_cfg['board_email'];
+ $this->reply = config('tp.board_email');
}
/**
@@ -125,17 +123,15 @@ class Emailer
*/
public function set_template($template_file, $template_lang = '')
{
- global $bb_cfg;
-
if (!$template_lang) {
- $template_lang = $bb_cfg['default_lang'];
+ $template_lang = config('tp.default_lang');
}
if (empty($this->tpl_msg[$template_lang . $template_file])) {
$tpl_file = LANG_ROOT_DIR . '/' . $template_lang . '/email/' . $template_file . '.html';
if (!file_exists($tpl_file)) {
- $tpl_file = LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'] . '/email/' . $template_file . '.html';
+ $tpl_file = LANG_ROOT_DIR . '/' . config('tp.default_lang') . '/email/' . $template_file . '.html';
/** @noinspection NotOptimalIfConditionsInspection */
if (!file_exists($tpl_file)) {
@@ -162,7 +158,7 @@ class Emailer
*/
public function send($email_format = self::FORMAT_TEXT)
{
- global $bb_cfg, $lang, $userdata;
+ global $lang;
if (!config('email.enabled')) {
return false;
@@ -215,7 +211,7 @@ class Emailer
/** @var Swift_Message $message */
$message = (new Swift_Message())
->setSubject($this->subject)
- ->setReturnPath($bb_cfg['bounce_email'])
+ ->setReturnPath(config('tp.bounce_email'))
->setFrom($this->from)
->setTo($this->to)
->setReplyTo($this->reply)
@@ -250,12 +246,10 @@ class Emailer
*/
public function set_default_vars()
{
- global $bb_cfg;
-
$this->vars = [
- 'BOARD_EMAIL' => $bb_cfg['board_email'],
- 'SITENAME' => $bb_cfg['board_email_sitename'],
- 'EMAIL_SIG' => !empty($bb_cfg['board_email_sig']) ? "-- \n{$bb_cfg['board_email_sig']}" : '',
+ 'BOARD_EMAIL' => config('tp.board_email'),
+ 'SITENAME' => config('tp.board_email_sitename'),
+ 'EMAIL_SIG' => !empty(config('tp.board_email_sig')) ? "-- \n" . config('tp.board_email_sig') : '',
];
}
}
diff --git a/library/TorrentPier/TorrentPier/Legacy/LogAction.php b/library/TorrentPier/TorrentPier/Legacy/LogAction.php
index 81266df05..edb59112f 100644
--- a/library/TorrentPier/TorrentPier/Legacy/LogAction.php
+++ b/library/TorrentPier/TorrentPier/Legacy/LogAction.php
@@ -31,7 +31,7 @@ class LogAction
public function init()
{
- global $lang, $bb_cfg;
+ global $lang;
foreach ($lang['LOG_ACTION']['LOG_TYPE'] as $log_type => $log_desc) {
$this->log_type_select[strip_tags($log_desc)] = $this->log_type[$log_type];
diff --git a/library/TorrentPier/TorrentPier/Legacy/Poll.php b/library/TorrentPier/TorrentPier/Legacy/Poll.php
index b343f8730..f47ba107c 100644
--- a/library/TorrentPier/TorrentPier/Legacy/Poll.php
+++ b/library/TorrentPier/TorrentPier/Legacy/Poll.php
@@ -21,8 +21,7 @@ class Poll
public function __construct()
{
- global $bb_cfg;
- $this->max_votes = $bb_cfg['max_poll_options'];
+ $this->max_votes = config('tp.max_poll_options');
}
/**
diff --git a/library/TorrentPier/TorrentPier/Legacy/Sitemap.php b/library/TorrentPier/TorrentPier/Legacy/Sitemap.php
index 36f9cb84b..137343ec5 100644
--- a/library/TorrentPier/TorrentPier/Legacy/Sitemap.php
+++ b/library/TorrentPier/TorrentPier/Legacy/Sitemap.php
@@ -86,13 +86,11 @@ class Sitemap
*/
private function getStaticUrls()
{
- global $bb_cfg;
-
$staticUrls = [];
- if (isset($bb_cfg['static_sitemap'])) {
+ if (!empty(config('tp.static_sitemap'))) {
/** @var array $urls разбиваем строку по переносам */
- $urls = explode("\n", $bb_cfg['static_sitemap']);
+ $urls = explode("\n", config('tp.static_sitemap'));
foreach ($urls as $url) {
/** @var string $url проверяем что адрес валиден и с указанными протоколом */
if (filter_var(trim($url), FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED)) {
diff --git a/library/TorrentPier/TorrentPier/Legacy/Template.php b/library/TorrentPier/TorrentPier/Legacy/Template.php
index f14ecedc5..86622a862 100644
--- a/library/TorrentPier/TorrentPier/Legacy/Template.php
+++ b/library/TorrentPier/TorrentPier/Legacy/Template.php
@@ -99,7 +99,7 @@ class Template
*/
public function __construct($root = '.')
{
- global $bb_cfg, $lang;
+ global $lang;
// setting pointer "vars"
$this->vars = &$this->_tpldata['.'][0];
@@ -108,7 +108,7 @@ class Template
$this->root = $root;
$this->tpl = basename($root);
$this->lang =& $lang;
- $this->use_cache = $bb_cfg['xs_use_cache'];
+ $this->use_cache = config('tp.xs_use_cache');
}
/**
@@ -223,7 +223,7 @@ class Template
{
$this->cur_tpl = $filename;
- global $lang, $source_lang, $bb_cfg, $user;
+ global $lang, $source_lang, $user;
$L =& $lang;
$V =& $this->vars;
@@ -979,11 +979,9 @@ class Template
public function xs_startup()
{
- global $bb_cfg;
-
// adding language variable (eg: "english" or "german")
// can be used to make truly multi-lingual templates
- $this->vars['LANG'] = $this->vars['LANG'] ?? $bb_cfg['default_lang'];
+ $this->vars['LANG'] = $this->vars['LANG'] ?? config('tp.default_lang');
// adding current template
$tpl = $this->root . '/';
if (substr($tpl, 0, 2) === './') {
diff --git a/library/TorrentPier/TorrentPier/Legacy/TorrentFileList.php b/library/TorrentPier/TorrentPier/Legacy/TorrentFileList.php
index 75dc914dd..b6774b59e 100644
--- a/library/TorrentPier/TorrentPier/Legacy/TorrentFileList.php
+++ b/library/TorrentPier/TorrentPier/Legacy/TorrentFileList.php
@@ -122,11 +122,11 @@ class TorrentFileList
*/
private function build_file_item($name, $length)
{
- global $bb_cfg, $images, $lang;
+ global $images, $lang;
$magnet_name = $magnet_ext = '';
- if ($bb_cfg['magnet_links_enabled']) {
+ if (config('tp.magnet_links_enabled')) {
$magnet_name = ' ';
$magnet_ext = ' ';
}
diff --git a/library/ajax/avatar.php b/library/ajax/avatar.php
index f9bc86499..e53aa3a9c 100644
--- a/library/ajax/avatar.php
+++ b/library/ajax/avatar.php
@@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
-global $bb_cfg, $lang, $user;
+global $lang, $user;
$mode = (string)$this->request['mode'];
$user_id = (int)$this->request['user_id'];
@@ -28,7 +28,7 @@ switch ($mode) {
case 'delete':
delete_avatar($user_id, $u_data['avatar_ext_id']);
$new_ext_id = 0;
- $response = ' ';
+ $response = ' ';
break;
default:
$this->ajax_die('Invalid mode');
diff --git a/library/ajax/change_tor_status.php b/library/ajax/change_tor_status.php
index c02c92f69..09fa5983b 100644
--- a/library/ajax/change_tor_status.php
+++ b/library/ajax/change_tor_status.php
@@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
-global $userdata, $bb_cfg, $lang;
+global $userdata, $lang;
if (!isset($this->request['attach_id'])) {
$this->ajax_die($lang['EMPTY_ATTACH_ID']);
@@ -20,7 +20,7 @@ if (!isset($this->request['attach_id'])) {
$attach_id = (int)$this->request['attach_id'];
$mode = (string)$this->request['mode'];
-if ($bb_cfg['tor_comment']) {
+if (config('tp.tor_comment')) {
$comment = (string)$this->request['comment'];
}
@@ -85,12 +85,12 @@ switch ($mode) {
change_tor_status($attach_id, $new_status);
- $this->response['status'] = $bb_cfg['tor_icons'][$new_status] . ' ' . $lang['TOR_STATUS_NAME'][$new_status] . ' · ' . profile_url($userdata) . ' · ' . delta_time(TIMENOW) . $lang['TOR_BACK'] . ' ';
+ $this->response['status'] = config('tp.tor_icons.' . $new_status) . ' ' . $lang['TOR_STATUS_NAME'][$new_status] . ' · ' . profile_url($userdata) . ' · ' . delta_time(TIMENOW) . $lang['TOR_BACK'] . ' ';
- if ($bb_cfg['tor_comment'] && (($comment && $comment != $lang['COMMENT']) || in_array($new_status, $bb_cfg['tor_reply']))) {
+ if (config('tp.tor_comment') && (($comment && $comment != $lang['COMMENT']) || in_array($new_status, config('tp.tor_reply')))) {
if ($tor['poster_id'] > 0) {
$subject = sprintf($lang['TOR_MOD_TITLE'], $tor['topic_title']);
- $message = sprintf($lang['TOR_MOD_MSG'], get_username($tor['poster_id']), make_url(TOPIC_URL . $tor['topic_id']), $bb_cfg['tor_icons'][$new_status] . ' ' . $lang['TOR_STATUS_NAME'][$new_status]);
+ $message = sprintf($lang['TOR_MOD_MSG'], get_username($tor['poster_id']), make_url(TOPIC_URL . $tor['topic_id']), config('tp.tor_icons.' . $new_status) . ' ' . $lang['TOR_STATUS_NAME'][$new_status]);
if ($comment && $comment != $lang['COMMENT']) {
$message .= "\n\n[b]" . $lang['COMMENT'] . '[/b]: ' . $comment;
@@ -103,7 +103,7 @@ switch ($mode) {
break;
case 'status_reply':
- if (!$bb_cfg['tor_comment']) {
+ if (!config('tp.tor_comment')) {
$this->ajax_die($lang['MODULE_OFF']);
}
diff --git a/library/ajax/change_torrent.php b/library/ajax/change_torrent.php
index f366313da..c4d768fba 100644
--- a/library/ajax/change_torrent.php
+++ b/library/ajax/change_torrent.php
@@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
-global $userdata, $bb_cfg, $lang;
+global $userdata, $lang;
if (!isset($this->request['attach_id'])) {
$this->ajax_die($lang['EMPTY_ATTACH_ID']);
diff --git a/library/ajax/edit_group_profile.php b/library/ajax/edit_group_profile.php
index 0d2684377..0e4951bcc 100644
--- a/library/ajax/edit_group_profile.php
+++ b/library/ajax/edit_group_profile.php
@@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
-global $bb_cfg, $userdata, $lang;
+global $userdata, $lang;
if (!$group_id = (int)$this->request['group_id'] or !$group_info = get_group_data($group_id)) {
$this->ajax_die($lang['NO_GROUP_ID_SPECIFIED']);
diff --git a/library/ajax/edit_user_profile.php b/library/ajax/edit_user_profile.php
index 7d9396035..01362d530 100644
--- a/library/ajax/edit_user_profile.php
+++ b/library/ajax/edit_user_profile.php
@@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
-global $bb_cfg, $lang;
+global $lang;
if (!$user_id = (int)$this->request['user_id'] or !$profiledata = get_userdata($user_id)) {
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
@@ -51,7 +51,7 @@ switch ($field) {
break;
case 'user_gender':
- if (!$bb_cfg['gender']) {
+ if (!config('tp.gender')) {
$this->ajax_die($lang['MODULE_OFF']);
}
if (!isset($lang['GENDER_SELECT'][$value])) {
@@ -62,7 +62,7 @@ switch ($field) {
break;
case 'user_birthday':
- if (!$bb_cfg['birthday_enabled']) {
+ if (!config('tp.birthday_enabled')) {
$this->ajax_die($lang['MODULE_OFF']);
}
$birthday_date = date_parse($value);
@@ -70,10 +70,10 @@ switch ($field) {
if (!empty($birthday_date['year'])) {
if (strtotime($value) >= TIMENOW) {
$this->ajax_die($lang['WRONG_BIRTHDAY_FORMAT']);
- } elseif (bb_date(TIMENOW, 'Y', 'false') - $birthday_date['year'] > $bb_cfg['birthday_max_age']) {
- $this->ajax_die(sprintf($lang['BIRTHDAY_TO_HIGH'], $bb_cfg['birthday_max_age']));
- } elseif (bb_date(TIMENOW, 'Y', 'false') - $birthday_date['year'] < $bb_cfg['birthday_min_age']) {
- $this->ajax_die(sprintf($lang['BIRTHDAY_TO_LOW'], $bb_cfg['birthday_min_age']));
+ } elseif (bb_date(TIMENOW, 'Y', 'false') - $birthday_date['year'] > config('tp.birthday_max_age')) {
+ $this->ajax_die(sprintf($lang['BIRTHDAY_TO_HIGH'], config('tp.birthday_max_age')));
+ } elseif (bb_date(TIMENOW, 'Y', 'false') - $birthday_date['year'] < config('tp.birthday_min_age')) {
+ $this->ajax_die(sprintf($lang['BIRTHDAY_TO_LOW'], config('tp.birthday_min_age')));
}
}
@@ -110,8 +110,8 @@ switch ($field) {
case 'user_regdate':
case 'user_lastvisit':
- $tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
- if (($value = strtotime($value, $tz)) < $bb_cfg['board_startdate'] or $value > TIMENOW) {
+ $tz = TIMENOW + (3600 * config('tp.board_timezone'));
+ if (($value = strtotime($value, $tz)) < config('tp.board_startdate') || $value > TIMENOW) {
$this->ajax_die($lang['INVALID_DATE'] . $this->request['value']);
}
$this->response['new_value'] = bb_date($value, 'Y-m-d H:i', false);
diff --git a/library/ajax/index_data.php b/library/ajax/index_data.php
index 7f61aba55..6c8a817ed 100644
--- a/library/ajax/index_data.php
+++ b/library/ajax/index_data.php
@@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
-global $bb_cfg, $lang, $userdata, $datastore;
+global $lang, $userdata, $datastore;
$mode = (string)$this->request['mode'];
$html = '';
@@ -27,9 +27,9 @@ switch ($mode) {
foreach ($stats['birthday_week_list'] as $week) {
$html[] = profile_url($week) . ' (' . birthday_age($week['user_birthday']) . ') ';
}
- $html = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], implode(', ', $html));
+ $html = sprintf($lang['BIRTHDAY_WEEK'], config('tp.birthday_check_day'), implode(', ', $html));
} else {
- $html = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']);
+ $html = sprintf($lang['NOBIRTHDAY_WEEK'], config('tp.birthday_check_day'));
}
break;
@@ -86,10 +86,10 @@ switch ($mode) {
if ($tz > 13) {
$tz = 13;
}
- if ($tz != $bb_cfg['board_timezone']) {
+ if ($tz != config('tp.board_timezone')) {
// Set current user timezone
OLD_DB()->query("UPDATE " . BB_USERS . " SET user_timezone = $tz WHERE user_id = " . $userdata['user_id']);
- $bb_cfg['board_timezone'] = $tz;
+ config(['tp.board_timezone' => $tz]);
cache_rm_user_sessions($userdata['user_id']);
}
break;
@@ -110,7 +110,7 @@ switch ($mode) {
' . $lang['UPLOADED'] . '
' . $lang['RELEASED'] . '
' . $lang['BONUS'] . ' ';
- $html .= ($bb_cfg['seed_bonus_enabled']) ? '' . $lang['SEED_BONUS'] . ' ' : '';
+ $html .= config('tp.seed_bonus_enabled') ? '' . $lang['SEED_BONUS'] . ' ' : '';
$html .= '
' . $lang['TOTAL_TRAF'] . '
@@ -118,17 +118,17 @@ switch ($mode) {
' . humn_size($btu['u_up_total']) . '
' . humn_size($btu['u_up_release']) . '
' . humn_size($btu['u_up_bonus']) . ' ';
- $html .= ($bb_cfg['seed_bonus_enabled']) ? '' . $profiledata['user_points'] . ' ' : '';
+ $html .= config('tp.seed_bonus_enabled') ? '' . $profiledata['user_points'] . ' ' : '';
$html .= '
' . $lang['MAX_SPEED'] . '
' . $lang['DL_DL_SPEED'] . ': ' . $speed_down . '
' . $lang['DL_UL_SPEED'] . ': ' . $speed_up . ' ';
- $html .= ($bb_cfg['seed_bonus_enabled']) ? ' ' : '';
+ $html .= config('tp.seed_bonus_enabled') ? ' ' : '';
$html .= ' ';
$this->response['user_ratio'] = '
- ' . $lang['USER_RATIO'] . ' :
+ ' . $lang['USER_RATIO'] . ' :
' . $user_ratio . '
';
break;
diff --git a/library/ajax/manage_admin.php b/library/ajax/manage_admin.php
index ad0057bd1..a61f05cf9 100644
--- a/library/ajax/manage_admin.php
+++ b/library/ajax/manage_admin.php
@@ -11,14 +11,14 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
-global $userdata, $lang, $bb_cfg;
+global $userdata, $lang;
$mode = (string)$this->request['mode'];
switch ($mode) {
case 'clear_cache':
- foreach ($bb_cfg['cache']['engines'] as $cache_name => $cache_val) {
+ foreach (config('tp.cache.engines') as $cache_name => $cache_val) {
if (!in_array('db_sqlite', $cache_val)) {
OLD_CACHE($cache_name)->rm();
}
@@ -59,20 +59,20 @@ switch ($mode) {
case 'indexer':
- exec("indexer --config {$bb_cfg['sphinx_config_path']} --all --rotate", $result);
+ exec('indexer --config ' . config('tp.sphinx_config_path') . ' --all --rotate', $result);
- if (!is_file($bb_cfg['sphinx_config_path'] . ".log")) {
- file_put_contents($bb_cfg['sphinx_config_path'] . ".log", "####Logger from dimka3210.####" . date("H:i:s", TIMENOW) . "##############################\r\n\r\n\r\n\r\n", FILE_APPEND);
+ if (!is_file(config('tp.sphinx_config_path') . '.log')) {
+ file_put_contents(config('tp.sphinx_config_path') . '.log', date('H:i:s', TIMENOW) . "##############################\r\n\r\n\r\n\r\n", FILE_APPEND);
}
- file_put_contents($bb_cfg['sphinx_config_path'] . ".log", "##############################" . date("H:i:s", TIMENOW) . "##############################\r\n", FILE_APPEND);
+ file_put_contents(config('tp.sphinx_config_path') . '.log', '##############################' . date('H:i:s', TIMENOW) . "##############################\r\n", FILE_APPEND);
foreach ($result as $row) {
- file_put_contents($bb_cfg['sphinx_config_path'] . ".log", $row . "\r\n", FILE_APPEND);
+ file_put_contents(config('tp.sphinx_config_path') . '.log', $row . "\r\n", FILE_APPEND);
}
- file_put_contents($bb_cfg['sphinx_config_path'] . ".log", "\r\n", FILE_APPEND);
- file_put_contents($bb_cfg['sphinx_config_path'] . ".log", "\r\n", FILE_APPEND);
+ file_put_contents(config('tp.sphinx_config_path') . '.log', "\r\n", FILE_APPEND);
+ file_put_contents(config('tp.sphinx_config_path') . '.log', "\r\n", FILE_APPEND);
$this->response['indexer_html'] = '' . $lang['INDEXER'] . ' ';
diff --git a/library/ajax/manage_user.php b/library/ajax/manage_user.php
index a80b13307..d24c8320a 100644
--- a/library/ajax/manage_user.php
+++ b/library/ajax/manage_user.php
@@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
-global $userdata, $lang, $bb_cfg;
+global $userdata, $lang;
$mode = (string)$this->request['mode'];
$user_id = $this->request['user_id'];
diff --git a/library/ajax/mod_action.php b/library/ajax/mod_action.php
index fd0cf67b8..62df9d55f 100644
--- a/library/ajax/mod_action.php
+++ b/library/ajax/mod_action.php
@@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
-global $userdata, $bb_cfg, $lang, $datastore;
+global $userdata, $lang, $datastore;
$mode = (string)$this->request['mode'];
@@ -30,7 +30,7 @@ switch ($mode) {
foreach ($topic_ids as $attach_id) {
change_tor_status($attach_id, $status);
}
- $this->response['status'] = $bb_cfg['tor_icons'][$status];
+ $this->response['status'] = config('tp.tor_icons.' . $status);
$this->response['topics'] = explode(',', $topics);
break;
@@ -56,14 +56,14 @@ switch ($mode) {
OLD_DB()->query("UPDATE " . BB_TOPICS . " SET topic_title = '$topic_title_sql' WHERE topic_id = $topic_id");
// Обновление кеша новостей на главной
- $news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
- if (isset($news_forums[$t_data['forum_id']]) && $bb_cfg['show_latest_news']) {
+ $news_forums = array_flip(explode(',', config('tp.latest_news_forum_id')));
+ if (isset($news_forums[$t_data['forum_id']]) && config('tp.show_latest_news')) {
$datastore->enqueue('latest_news');
$datastore->update('latest_news');
}
- $net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
- if (isset($net_forums[$t_data['forum_id']]) && $bb_cfg['show_network_news']) {
+ $net_forums = array_flip(explode(',', config('tp.network_news_forum_id')));
+ if (isset($net_forums[$t_data['forum_id']]) && config('tp.show_network_news')) {
$datastore->enqueue('network_news');
$datastore->update('network_news');
}
@@ -114,8 +114,8 @@ switch ($mode) {
} else {
$user_reg_ip = decode_ip($profiledata['user_reg_ip']);
$user_last_ip = decode_ip($profiledata['user_last_ip']);
- $reg_ip = '' . $user_reg_ip . ' ';
- $last_ip = '' . $user_last_ip . ' ';
+ $reg_ip = '' . $user_reg_ip . ' ';
+ $last_ip = '' . $user_last_ip . ' ';
}
$this->response['ip_list_html'] = '
diff --git a/library/ajax/posts.php b/library/ajax/posts.php
index d0049eb7b..4e49627d2 100644
--- a/library/ajax/posts.php
+++ b/library/ajax/posts.php
@@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
-global $lang, $bb_cfg, $userdata;
+global $lang, $userdata;
if (!isset($this->request['type'])) {
$this->ajax_die('empty type');
@@ -129,10 +129,10 @@ switch ($this->request['type']) {
if (mb_strlen($text) > 2) {
if ($text != $post['post_text']) {
- if ($bb_cfg['max_smilies']) {
- $count_smilies = substr_count(bbcode2html($text), ' request['type']) {
$sql = "SELECT MAX(p.post_time) AS last_post_time FROM " . BB_POSTS . " p WHERE $where_sql";
if ($row = OLD_DB()->fetch_row($sql) and $row['last_post_time']) {
if ($userdata['user_level'] == USER) {
- if (TIMENOW - $row['last_post_time'] < $bb_cfg['flood_interval']) {
+ if (TIMENOW - $row['last_post_time'] < config('tp.flood_interval')) {
$this->ajax_die($lang['FLOOD_ERROR']);
}
}
@@ -260,10 +260,10 @@ switch ($this->request['type']) {
}
}
- if ($bb_cfg['max_smilies']) {
- $count_smilies = substr_count(bbcode2html($message), ' ' . make_url('sitemap/sitemap.xml') . '';
+ $html .= $lang['SITEMAP_CREATED'] . ': ' . bb_date(TIMENOW, config('tp.post_date_format')) . ' ' . $lang['SITEMAP_AVAILABLE'] . ': ' . make_url('sitemap/sitemap.xml') . ' ';
} else {
$html .= $lang['SITEMAP_NOT_CREATED'];
}
diff --git a/library/ajax/user_register.php b/library/ajax/user_register.php
index d2210267a..41a1c96b0 100644
--- a/library/ajax/user_register.php
+++ b/library/ajax/user_register.php
@@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
die(basename(__FILE__));
}
-global $bb_cfg, $lang, $userdata;
+global $lang, $userdata;
$mode = (string)$this->request['mode'];
diff --git a/library/attach_mod/attachment_mod.php b/library/attach_mod/attachment_mod.php
index c0682b39f..1f6128044 100644
--- a/library/attach_mod/attachment_mod.php
+++ b/library/attach_mod/attachment_mod.php
@@ -26,11 +26,11 @@ if (defined('ATTACH_INSTALL')) {
*/
function attach_mod_get_lang($language_file)
{
- global $attach_config, $bb_cfg;
+ global $attach_config;
- $file = LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'] . '/' . $language_file . '.php';
+ $file = LANG_ROOT_DIR . '/' . config('tp.default_lang') . '/' . $language_file . '.php';
if (file_exists($file)) {
- return $bb_cfg['default_lang'];
+ return config('tp.default_lang');
}
$file = LANG_ROOT_DIR . '/' . $attach_config['board_lang'] . '/' . $language_file . '.php';
@@ -46,8 +46,6 @@ function attach_mod_get_lang($language_file)
*/
function get_config()
{
- global $bb_cfg;
-
$attach_config = array();
$sql = 'SELECT * FROM ' . BB_ATTACH_CONFIG;
@@ -61,7 +59,7 @@ function get_config()
}
// We assign the original default board language here, because it gets overwritten later with the users default language
- $attach_config['board_lang'] = trim($bb_cfg['default_lang']);
+ $attach_config['board_lang'] = trim(config('tp.default_lang'));
return $attach_config;
}
diff --git a/library/attach_mod/displaying_torrent.php b/library/attach_mod/displaying_torrent.php
index a2a917ffb..2bd93a3d3 100644
--- a/library/attach_mod/displaying_torrent.php
+++ b/library/attach_mod/displaying_torrent.php
@@ -11,7 +11,7 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
-global $bb_cfg, $t_data, $poster_id, $is_auth, $dl_link_css, $dl_status_css, $lang, $images;
+global $t_data, $poster_id, $is_auth, $dl_link_css, $dl_status_css, $lang, $images;
$change_peers_bgr_over = true;
$bgr_class_1 = 'row1';
@@ -39,7 +39,7 @@ $template->assign_vars(array(
));
// Define show peers mode (count only || user names with complete % || full details)
-$cfg_sp_mode = $bb_cfg['bt_show_peers_mode'];
+$cfg_sp_mode = config('tp.bt_show_peers_mode');
$get_sp_mode = $_GET['spmode'] ?? '';
$s_mode = 'count';
@@ -50,7 +50,7 @@ if ($cfg_sp_mode == SHOW_PEERS_NAMES) {
$s_mode = 'full';
}
-if ($bb_cfg['bt_allow_spmode_change']) {
+if (config('tp.bt_allow_spmode_change')) {
if ($get_sp_mode == 'names') {
$s_mode = 'names';
} elseif ($get_sp_mode == 'full') {
@@ -67,7 +67,7 @@ $tor_file_size = humn_size($attachments['_' . $post_id][$i]['filesize']);
$tor_file_time = bb_date($attachments['_' . $post_id][$i]['filetime']);
$tor_reged = (bool)$tracker_status;
-$show_peers = (bool)$bb_cfg['bt_show_peers'];
+$show_peers = (bool)config('tp.bt_show_peers');
$locked = ($t_data['forum_status'] == FORUM_LOCKED || $t_data['topic_status'] == TOPIC_LOCKED);
$tor_auth = ($bt_user_id != GUEST_UID && (($bt_user_id == $poster_id && !$locked) || $is_auth['auth_mod']));
@@ -87,7 +87,7 @@ if ($tor_auth_reg || $tor_auth_del) {
$tracker_link = ($tor_reged) ? $unreg_tor_url : $reg_tor_url;
}
-$display_name = '[' . $bb_cfg['server_name'] . '].t' . $bt_topic_id . '.torrent';
+$display_name = '[' . config('tp.server_name') . '].t' . $bt_topic_id . '.torrent';
if (!$tor_reged) {
$template->assign_block_vars('postrow.attach.tor_not_reged', array(
@@ -146,8 +146,8 @@ if ($tor_reged && $tor_info) {
$tor_magnet = create_magnet($tor_info['info_hash'], $passkey['auth_key'], $userdata['session_logged_in']);
// ratio limits
- $min_ratio_dl = $bb_cfg['bt_min_ratio_allow_dl_tor'];
- $min_ratio_warn = $bb_cfg['bt_min_ratio_warning'];
+ $min_ratio_dl = config('tp.bt_min_ratio_allow_dl_tor');
+ $min_ratio_warn = config('tp.bt_min_ratio_warning');
$dl_allowed = true;
$user_ratio = 0;
@@ -177,7 +177,7 @@ if ($tor_reged && $tor_info) {
if ((isset($user_ratio) && isset($min_ratio_warn) && $user_ratio < $min_ratio_warn && TR_RATING_LIMITS) || ($bt_userdata['u_down_total'] < MIN_DL_FOR_RATIO)) {
$template->assign_vars(array(
'SHOW_RATIO_WARN' => true,
- 'RATIO_WARN_MSG' => sprintf($lang['BT_RATIO_WARNING_MSG'], $min_ratio_dl, $bb_cfg['ratio_url_help']),
+ 'RATIO_WARN_MSG' => sprintf($lang['BT_RATIO_WARNING_MSG'], $min_ratio_dl, config('tp.ratio_url_help')),
));
}
}
@@ -196,12 +196,12 @@ if ($tor_reged && $tor_info) {
'TOR_SILVER_GOLD' => $tor_type,
// torrent status mod
- 'TOR_FROZEN' => (!IS_AM) ? (isset($bb_cfg['tor_frozen'][$tor_info['tor_status']]) && !(isset($bb_cfg['tor_frozen_author_download'][$tor_info['tor_status']]) && $userdata['user_id'] == $tor_info['poster_id'])) ? true : '' : '',
+ 'TOR_FROZEN' => (!IS_AM) ? (null !== config('tp.tor_frozen.' . $tor_info['tor_status'])) && !(null !== config('tp.tor_frozen_author_download.' . $tor_info['tor_status']) && $userdata['user_id'] == $tor_info['poster_id']) ? true : '' : '',
'TOR_STATUS_TEXT' => $lang['TOR_STATUS_NAME'][$tor_info['tor_status']],
- 'TOR_STATUS_ICON' => $bb_cfg['tor_icons'][$tor_info['tor_status']],
+ 'TOR_STATUS_ICON' => config('tp.tor_icons.' . $tor_info['tor_status']),
'TOR_STATUS_BY' => ($tor_info['checked_user_id'] && $is_auth['auth_mod']) ? (' · ' . profile_url($tor_info) . ' · ' . delta_time($tor_info['checked_time']) . $lang['TOR_BACK'] . ' ') : '',
'TOR_STATUS_SELECT' => build_select('sel_status', array_flip($lang['TOR_STATUS_NAME']), TOR_APPROVED),
- 'TOR_STATUS_REPLY' => $bb_cfg['tor_comment'] && !IS_GUEST && in_array($tor_info['tor_status'], $bb_cfg['tor_reply']) && $userdata['user_id'] == $tor_info['poster_id'] && $t_data['topic_status'] != TOPIC_LOCKED,
+ 'TOR_STATUS_REPLY' => config('tp.tor_comment') && !IS_GUEST && in_array($tor_info['tor_status'], config('tp.tor_reply')) && $userdata['user_id'] == $tor_info['poster_id'] && $t_data['topic_status'] != TOPIC_LOCKED,
//end torrent status mod
'S_UPLOAD_IMAGE' => $upload_image,
@@ -223,7 +223,7 @@ if ($tor_reged && $tor_info) {
}
}
- if ($bb_cfg['show_tor_info_in_dl_list']) {
+ if (config('tp.show_tor_info_in_dl_list')) {
$template->assign_vars(array(
'SHOW_DL_LIST' => true,
'SHOW_DL_LIST_TOR_INFO' => true,
@@ -511,7 +511,7 @@ if ($tor_reged && $tor_info) {
}
}
-if ($bb_cfg['bt_allow_spmode_change'] && $s_mode != 'full') {
+if (config('tp.bt_allow_spmode_change') && $s_mode != 'full') {
$template->assign_vars(array(
'PEERS_FULL_LINK' => true,
'SPMODE_FULL_HREF' => "viewtopic.php?" . POST_TOPIC_URL . "=$bt_topic_id&spmode=full#seeders",
@@ -519,14 +519,14 @@ if ($bb_cfg['bt_allow_spmode_change'] && $s_mode != 'full') {
}
$template->assign_vars(array(
- 'SHOW_DL_LIST_LINK' => (($bb_cfg['bt_show_dl_list'] || $bb_cfg['allow_dl_list_names_mode']) && $t_data['topic_dl_type'] == TOPIC_DL_TYPE_DL),
- 'SHOW_TOR_ACT' => ($tor_reged && $show_peers && (!isset($bb_cfg['tor_no_tor_act'][$tor_info['tor_status']]) || IS_AM)),
- 'S_MODE_COUNT' => ($s_mode == 'count'),
- 'S_MODE_NAMES' => ($s_mode == 'names'),
- 'S_MODE_FULL' => ($s_mode == 'full'),
- 'PEER_EXIST' => ($seeders || $leechers || defined('SEEDER_EXIST') || defined('LEECHER_EXIST')),
- 'SEED_EXIST' => ($seeders || defined('SEEDER_EXIST')),
- 'LEECH_EXIST' => ($leechers || defined('LEECHER_EXIST')),
- 'TOR_HELP_LINKS' => $bb_cfg['tor_help_links'],
- 'CALL_SEED' => ($bb_cfg['callseed'] && $tor_reged && !isset($bb_cfg['tor_no_tor_act'][$tor_info['tor_status']]) && $seed_count < 3 && $tor_info['call_seed_time'] < (TIMENOW - 86400)),
+ 'SHOW_DL_LIST_LINK' => (config('tp.bt_show_dl_list') || config('tp.allow_dl_list_names_mode')) && $t_data['topic_dl_type'] == TOPIC_DL_TYPE_DL,
+ 'SHOW_TOR_ACT' => $tor_reged && $show_peers && (null === config('tp.tor_no_tor_act.' . $tor_info['tor_status']) || IS_AM),
+ 'S_MODE_COUNT' => $s_mode == 'count',
+ 'S_MODE_NAMES' => $s_mode == 'names',
+ 'S_MODE_FULL' => $s_mode == 'full',
+ 'PEER_EXIST' => $seeders || $leechers || defined('SEEDER_EXIST') || defined('LEECHER_EXIST'),
+ 'SEED_EXIST' => $seeders || defined('SEEDER_EXIST'),
+ 'LEECH_EXIST' => $leechers || defined('LEECHER_EXIST'),
+ 'TOR_HELP_LINKS' => config('tp.tor_help_links'),
+ 'CALL_SEED' => config('tp.callseed') && $tor_reged && null === config('tp.tor_no_tor_act.' . $tor_info['tor_status']) && $seed_count < 3 && $tor_info['call_seed_time'] < (TIMENOW - 86400),
));
diff --git a/library/config.php b/library/config.php
deleted file mode 100644
index 28a1944db..000000000
--- a/library/config.php
+++ /dev/null
@@ -1,469 +0,0 @@
- (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'] = ' _________________ ';
-$bb_cfg['user_signature_end'] = '
'; // Это позволит использовать html теги, которые требуют закрытия. Например или
-
-// 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'
-];
-
-// 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 => '* ',
- TOR_CLOSED => 'x ',
- TOR_APPROVED => '√ ',
- TOR_NEED_EDIT => '? ',
- TOR_NO_DESC => '! ',
- TOR_DUP => 'D ',
- TOR_CLOSED_CPHOLD => '© ',
- TOR_CONSUMED => '∑ ',
- TOR_DOUBTFUL => '# ',
- TOR_CHECKING => '% ',
- TOR_TMP => 'T ',
- TOR_PREMOD => '∏ ',
- TOR_REPLENISH => 'R ',
-];
-
-// Запрет на скачивание
-$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;
diff --git a/library/includes/bbcode.php b/library/includes/bbcode.php
index 2803e634a..51c18e8b5 100644
--- a/library/includes/bbcode.php
+++ b/library/includes/bbcode.php
@@ -106,7 +106,7 @@ function prepare_message($message)
// Either in a window or inline
function generate_smilies($mode)
{
- global $bb_cfg, $template, $lang, $user, $datastore;
+ global $template, $lang, $user, $datastore;
$inline_columns = 4;
$inline_rows = 7;
@@ -144,7 +144,7 @@ function generate_smilies($mode)
$template->assign_block_vars('smilies_row.smilies_col', array(
'SMILEY_CODE' => $data['code'],
- 'SMILEY_IMG' => $bb_cfg['smilies_path'] . '/' . $smile_url,
+ 'SMILEY_IMG' => config('tp.smilies_path') . '/' . $smile_url,
'SMILEY_DESC' => $data['emoticon'],
));
@@ -325,11 +325,9 @@ function strip_bbcode($message, $stripquotes = true, $fast_and_dirty = false, $s
function extract_search_words($text)
{
- global $bb_cfg;
-
- $max_words_count = $bb_cfg['max_search_words_per_post'];
- $min_word_len = max(2, $bb_cfg['search_min_word_len'] - 1);
- $max_word_len = $bb_cfg['search_max_word_len'];
+ $max_words_count = config('tp.max_search_words_per_post');
+ $min_word_len = max(2, config('tp.search_min_word_len') - 1);
+ $max_word_len = config('tp.search_max_word_len');
$text = ' ' . str_compact(strip_tags(mb_strtolower($text))) . ' ';
$text = str_replace(array('[', ']'), array('[', ']'), $text);
@@ -372,12 +370,10 @@ function extract_search_words($text)
function add_search_words($post_id, $post_message, $topic_title = '', $only_return_words = false)
{
- global $bb_cfg;
-
$text = $topic_title . ' ' . $post_message;
$words = ($text) ? extract_search_words($text) : array();
- if ($only_return_words || $bb_cfg['search_engine_type'] == 'sphinx') {
+ if ($only_return_words || config('tp.search_engine_type') == 'sphinx') {
return implode("\n", $words);
}
@@ -421,22 +417,19 @@ function get_words_rate($text)
function hide_passkey($str)
{
- global $bb_cfg;
- return preg_replace("#\?{$bb_cfg['passkey_key']}=[a-zA-Z0-9]{" . BT_AUTH_KEY_LENGTH . "}#", "?{$bb_cfg['passkey_key']}=passkey", $str);
+ return preg_replace("#\?" . config('tp.passkey_key') . "=[a-zA-Z0-9]{" . BT_AUTH_KEY_LENGTH . "}#", "?" . config('tp.passkey_key') . "=passkey", $str);
}
function get_parsed_post($postrow, $mode = 'full', $return_chars = 600)
{
- global $bb_cfg;
-
- if ($bb_cfg['use_posts_cache'] && !empty($postrow['post_html'])) {
+ if (config('tp.use_posts_cache') && !empty($postrow['post_html'])) {
return $postrow['post_html'];
}
$message = bbcode2html($postrow['post_text']);
// Posts cache
- if ($bb_cfg['use_posts_cache']) {
+ if (config('tp.use_posts_cache')) {
OLD_DB()->shutdown['post_html'][] = array(
'post_id' => (int)$postrow['post_id'],
'post_html' => (string)$message,
diff --git a/library/includes/cron/jobs/board_maintenance.php b/library/includes/cron/jobs/board_maintenance.php
index c2b6eb239..f22e22b6f 100644
--- a/library/includes/cron/jobs/board_maintenance.php
+++ b/library/includes/cron/jobs/board_maintenance.php
@@ -19,7 +19,7 @@ sync('user_posts', 'all');
sync_all_forums();
// Чистка bb_poll_users
-if ($poll_max_days = (int)$bb_cfg['poll_max_days']) {
+if ($poll_max_days = (int)config('tp.poll_max_days')) {
$per_cycle = 20000;
$row = OLD_DB()->fetch_row("SELECT MIN(topic_id) AS start_id, MAX(topic_id) AS finish_id FROM " . BB_POLL_USERS);
$start_id = (int)$row['start_id'];
@@ -47,6 +47,6 @@ if ($poll_max_days = (int)$bb_cfg['poll_max_days']) {
OLD_DB()->query("UPDATE " . BB_USERS . " SET user_newpasswd = '' WHERE user_lastvisit < " . (TIMENOW - 7 * 86400));
// Чистка кеша постов
-if ($posts_days = (int)$bb_cfg['posts_cache_days_keep']) {
+if ($posts_days = (int)config('tp.posts_cache_days_keep')) {
OLD_DB()->query("DELETE FROM " . BB_POSTS_HTML . " WHERE post_html_time < DATE_SUB(NOW(), INTERVAL $posts_days DAY)");
}
diff --git a/library/includes/cron/jobs/cache_gc.php b/library/includes/cron/jobs/cache_gc.php
index fb9700970..3f9bce293 100644
--- a/library/includes/cron/jobs/cache_gc.php
+++ b/library/includes/cron/jobs/cache_gc.php
@@ -13,7 +13,7 @@ if (!defined('BB_ROOT')) {
global $cron_runtime_log;
-foreach ($bb_cfg['cache']['engines'] as $cache_name => $cache_val) {
+foreach (config('tp.cache.engines') as $cache_name => $cache_val) {
if (method_exists(OLD_CACHE($cache_name), 'gc')) {
$changes = OLD_CACHE($cache_name)->gc();
$cron_runtime_log = date('Y-m-d H:i:s') . " -- " . str_pad("$cache_name ", 25, '-', STR_PAD_RIGHT) . " del: $changes\n";
diff --git a/library/includes/cron/jobs/clean_dlstat.php b/library/includes/cron/jobs/clean_dlstat.php
index 6a7a05f30..146ca83d1 100644
--- a/library/includes/cron/jobs/clean_dlstat.php
+++ b/library/includes/cron/jobs/clean_dlstat.php
@@ -13,10 +13,10 @@ if (!defined('BB_ROOT')) {
// Delete staled dl-status records
$keeping_dlstat = array(
- DL_STATUS_WILL => (int)$bb_cfg['dl_will_days_keep'],
- DL_STATUS_DOWN => (int)$bb_cfg['dl_down_days_keep'],
- DL_STATUS_COMPLETE => (int)$bb_cfg['dl_complete_days_keep'],
- DL_STATUS_CANCEL => (int)$bb_cfg['dl_cancel_days_keep'],
+ DL_STATUS_WILL => (int)config('tp.dl_will_days_keep'),
+ DL_STATUS_DOWN => (int)config('tp.dl_down_days_keep'),
+ DL_STATUS_COMPLETE => (int)config('tp.dl_complete_days_keep'),
+ DL_STATUS_CANCEL => (int)config('tp.dl_cancel_days_keep'),
);
$delete_dlstat_sql = array();
@@ -51,7 +51,7 @@ OLD_DB()->query("
");
// Tor-Stats cleanup
-if ($torstat_days_keep = (int)$bb_cfg['torstat_days_keep']) {
+if ($torstat_days_keep = (int)config('tp.torstat_days_keep')) {
OLD_DB()->query("DELETE QUICK FROM " . BB_BT_TORSTAT . " WHERE last_modified_torstat < DATE_SUB(NOW(), INTERVAL $torstat_days_keep DAY)");
}
diff --git a/library/includes/cron/jobs/clean_log.php b/library/includes/cron/jobs/clean_log.php
index d6a8ca5bc..9da507cc5 100644
--- a/library/includes/cron/jobs/clean_log.php
+++ b/library/includes/cron/jobs/clean_log.php
@@ -11,7 +11,7 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
-$log_days_keep = (int)$bb_cfg['log_days_keep'];
+$log_days_keep = (int)config('tp.log_days_keep');
OLD_DB()->query("
DELETE FROM " . BB_LOG . "
diff --git a/library/includes/cron/jobs/prune_forums.php b/library/includes/cron/jobs/prune_forums.php
index b9a58374f..02026f3a1 100644
--- a/library/includes/cron/jobs/prune_forums.php
+++ b/library/includes/cron/jobs/prune_forums.php
@@ -13,7 +13,7 @@ if (!defined('BB_ROOT')) {
require_once INC_DIR . '/functions_admin.php';
-if ($bb_cfg['prune_enable']) {
+if (config('tp.prune_enable')) {
$sql = "SELECT forum_id, prune_days FROM " . BB_FORUMS . " WHERE prune_days != 0";
foreach (OLD_DB()->fetch_rowset($sql) as $row) {
diff --git a/library/includes/cron/jobs/prune_inactive_users.php b/library/includes/cron/jobs/prune_inactive_users.php
index d99d3eb17..4dea49e62 100644
--- a/library/includes/cron/jobs/prune_inactive_users.php
+++ b/library/includes/cron/jobs/prune_inactive_users.php
@@ -20,7 +20,7 @@ while (true) {
$prune_users = $not_activated_users = $not_active_users = array();
- if ($not_activated_days = (int)$bb_cfg['user_not_activated_days_keep']) {
+ if ($not_activated_days = (int)config('tp.user_not_activated_days_keep')) {
$sql = OLD_DB()->fetch_rowset("SELECT user_id FROM " . BB_USERS . "
WHERE user_level = 0
AND user_lastvisit = 0
@@ -34,7 +34,7 @@ while (true) {
}
}
- if ($not_active_days = (int)$bb_cfg['user_not_active_days_keep']) {
+ if ($not_active_days = (int)config('tp.user_not_active_days_keep')) {
$sql = OLD_DB()->fetch_rowset("SELECT user_id FROM " . BB_USERS . "
WHERE user_level = 0
AND user_posts = 0
diff --git a/library/includes/cron/jobs/prune_topic_moved.php b/library/includes/cron/jobs/prune_topic_moved.php
index 6613cb507..9b0064396 100644
--- a/library/includes/cron/jobs/prune_topic_moved.php
+++ b/library/includes/cron/jobs/prune_topic_moved.php
@@ -11,8 +11,8 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
-if ($bb_cfg['topic_moved_days_keep']) {
- $prune_time = TIMENOW - 86400 * $bb_cfg['topic_moved_days_keep'];
+if (config('tp.topic_moved_days_keep')) {
+ $prune_time = TIMENOW - 86400 * config('tp.topic_moved_days_keep');
OLD_DB()->query("
DELETE FROM " . BB_TOPICS . "
diff --git a/library/includes/cron/jobs/sessions_cleanup.php b/library/includes/cron/jobs/sessions_cleanup.php
index 70d432c10..96cf8caea 100644
--- a/library/includes/cron/jobs/sessions_cleanup.php
+++ b/library/includes/cron/jobs/sessions_cleanup.php
@@ -11,10 +11,10 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
-$user_session_expire_time = TIMENOW - (int)$bb_cfg['user_session_duration'];
-$admin_session_expire_time = TIMENOW - (int)$bb_cfg['admin_session_duration'];
+$user_session_expire_time = TIMENOW - (int)config('tp.user_session_duration');
+$admin_session_expire_time = TIMENOW - (int)config('tp.admin_session_duration');
-$user_session_gc_time = $user_session_expire_time - (int)$bb_cfg['user_session_gc_ttl'];
+$user_session_gc_time = $user_session_expire_time - (int)config('tp.user_session_gc_ttl');
$admin_session_gc_time = $admin_session_expire_time;
// ############################ Tables LOCKED ################################
diff --git a/library/includes/cron/jobs/tr_cleanup_and_dlstat.php b/library/includes/cron/jobs/tr_cleanup_and_dlstat.php
index bca4dcb1b..fa892b879 100644
--- a/library/includes/cron/jobs/tr_cleanup_and_dlstat.php
+++ b/library/includes/cron/jobs/tr_cleanup_and_dlstat.php
@@ -65,7 +65,7 @@ OLD_DB()->query("
// Clean peers table
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)config('tracker.expire_factor'), 1);
$peer_expire_time = TIMENOW - floor($announce_interval * $expire_factor);
diff --git a/library/includes/cron/jobs/tr_complete_count.php b/library/includes/cron/jobs/tr_complete_count.php
index 1e61b738e..4398604a9 100644
--- a/library/includes/cron/jobs/tr_complete_count.php
+++ b/library/includes/cron/jobs/tr_complete_count.php
@@ -11,9 +11,7 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
-global $bb_cfg;
-
-if ($bb_cfg['ocelot']['enabled']) {
+if (config('tp.ocelot.enabled')) {
// Update TORRENT "completed" counters
OLD_DB()->query("
UPDATE
diff --git a/library/includes/cron/jobs/tr_maintenance.php b/library/includes/cron/jobs/tr_maintenance.php
index 05222a74f..d999c76a4 100644
--- a/library/includes/cron/jobs/tr_maintenance.php
+++ b/library/includes/cron/jobs/tr_maintenance.php
@@ -11,12 +11,12 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
-if (empty($bb_cfg['seeder_last_seen_days_keep']) || empty($bb_cfg['seeder_never_seen_days_keep'])) {
+if (empty(config('tp.seeder_last_seen_days_keep')) || empty(config('tp.seeder_never_seen_days_keep'))) {
return;
}
-$last_seen_time = TIMENOW - 86400 * $bb_cfg['seeder_last_seen_days_keep'];
-$never_seen_time = TIMENOW - 86400 * $bb_cfg['seeder_never_seen_days_keep'];
+$last_seen_time = TIMENOW - 86400 * config('tp.seeder_last_seen_days_keep');
+$never_seen_time = TIMENOW - 86400 * config('tp.seeder_never_seen_days_keep');
$limit_sql = 3000;
$topics_sql = $attach_sql = array();
diff --git a/library/includes/cron/jobs/tr_make_snapshot.php b/library/includes/cron/jobs/tr_make_snapshot.php
index 9b9d9a859..4692dd2a3 100644
--- a/library/includes/cron/jobs/tr_make_snapshot.php
+++ b/library/includes/cron/jobs/tr_make_snapshot.php
@@ -11,14 +11,12 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
-global $bb_cfg;
-
OLD_DB()->expect_slow_query(600);
//
// Make tracker snapshot
//
-if (!$bb_cfg['ocelot']['enabled']) {
+if (!config('tp.ocelot.enabled')) {
define('NEW_BB_BT_TRACKER_SNAP', 'new_tracker_snap');
define('OLD_BB_BT_TRACKER_SNAP', 'old_tracker_snap');
@@ -37,7 +35,7 @@ while (true) {
$val = array();
- if (!$bb_cfg['ocelot']['enabled']) {
+ if (!config('tp.ocelot.enabled')) {
$sql = "
SELECT
topic_id, SUM(seeder) AS seeders, (COUNT(*) - SUM(seeder)) AS leechers,
@@ -61,7 +59,7 @@ while (true) {
}
if ($val) {
- if (!$bb_cfg['ocelot']['enabled']) {
+ if (!config('tp.ocelot.enabled')) {
OLD_DB()->query("
REPLACE INTO " . NEW_BB_BT_TRACKER_SNAP . "
(topic_id, seeders, leechers, speed_up, speed_down)
@@ -84,7 +82,7 @@ while (true) {
$start_id += $per_cycle;
}
-if (!$bb_cfg['ocelot']['enabled']) {
+if (!config('tp.ocelot.enabled')) {
OLD_DB()->query("
RENAME TABLE
" . BB_BT_TRACKER_SNAP . " TO " . OLD_BB_BT_TRACKER_SNAP . ",
@@ -104,7 +102,7 @@ OLD_DB()->query("DROP TABLE IF EXISTS " . NEW_BB_BT_DLSTATUS_SNAP . ", " . OLD_B
OLD_DB()->query("CREATE TABLE " . NEW_BB_BT_DLSTATUS_SNAP . " LIKE " . BB_BT_DLSTATUS_SNAP);
-if ($bb_cfg['bt_show_dl_list'] && $bb_cfg['bt_dl_list_only_count']) {
+if (config('tp.bt_show_dl_list') && config('tp.bt_dl_list_only_count')) {
OLD_DB()->query("
INSERT INTO " . NEW_BB_BT_DLSTATUS_SNAP . "
(topic_id, dl_status, users_count)
@@ -127,7 +125,7 @@ OLD_DB()->query("DROP TABLE IF EXISTS " . NEW_BB_BT_DLSTATUS_SNAP . ", " . OLD_B
//
// TORHELP
//
-if ($bb_cfg['torhelp_enabled']) {
+if (config('tp.torhelp_enabled')) {
$tor_min_seeders = 0; // "<="
$tor_min_leechers = 2; // ">="
$tor_min_completed = 10; // ">="
@@ -170,7 +168,7 @@ if ($bb_cfg['torhelp_enabled']) {
WHERE
trsn.seeders <= $tor_min_seeders
AND trsn.leechers >= $tor_min_leechers
- AND tor.forum_id != " . (int)$bb_cfg['trash_forum_id'] . "
+ AND tor.forum_id != " . (int)config('tp.trash_forum_id') . "
AND tor.complete_count >= $tor_min_completed
AND tor.seeder_last_seen <= (UNIX_TIMESTAMP() - $tor_seed_last_seen_days*86400)
AND dl.user_id IN($online_users_csv)
diff --git a/library/includes/cron/jobs/tr_seed_bonus.php b/library/includes/cron/jobs/tr_seed_bonus.php
index e1a0bac1e..39d8545fa 100644
--- a/library/includes/cron/jobs/tr_seed_bonus.php
+++ b/library/includes/cron/jobs/tr_seed_bonus.php
@@ -13,7 +13,7 @@ if (!defined('BB_ROOT')) {
OLD_DB()->expect_slow_query(600);
-if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['seed_bonus_release']) {
+if (config('tp.seed_bonus_enabled') && config('tp.seed_bonus_points') && config('tp.seed_bonus_release')) {
OLD_DB()->query("
CREATE TEMPORARY TABLE tmp_bonus (
user_id INT UNSIGNED NOT NULL DEFAULT '0',
@@ -21,7 +21,7 @@ if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['se
) ENGINE = MEMORY
");
- $tor_size = ($bb_cfg['seed_bonus_tor_size'] * 1073741824);
+ $tor_size = (config('tp.seed_bonus_tor_size') * 1073741824);
OLD_DB()->query("INSERT INTO tmp_bonus
SELECT bt.user_id, count(bt.seeder) AS release_count
@@ -32,8 +32,8 @@ if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['se
GROUP BY user_id
");
- $seed_bonus = unserialize($bb_cfg['seed_bonus_points']);
- $seed_release = unserialize($bb_cfg['seed_bonus_release']);
+ $seed_bonus = unserialize(config('tp.seed_bonus_points'));
+ $seed_release = unserialize(config('tp.seed_bonus_release'));
foreach ($seed_bonus as $i => $points) {
if (!$points || !$seed_release[$i]) {
@@ -42,7 +42,7 @@ if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['seed_bonus_points'] && $bb_cfg['se
$user_points = ((float)$points / 4);
$release = (int)$seed_release[$i];
- $user_regdate = (TIMENOW - $bb_cfg['seed_bonus_user_regdate'] * 86400);
+ $user_regdate = (TIMENOW - config('tp.seed_bonus_user_regdate') * 86400);
OLD_DB()->query("
UPDATE " . BB_USERS . " u, " . BB_BT_USERS . " bu, tmp_bonus b
diff --git a/library/includes/cron/jobs/update_forums_atom.php b/library/includes/cron/jobs/update_forums_atom.php
index b23e3f94e..4254d36dd 100644
--- a/library/includes/cron/jobs/update_forums_atom.php
+++ b/library/includes/cron/jobs/update_forums_atom.php
@@ -11,15 +11,13 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
-global $bb_cfg;
-
require_once INC_DIR . '/functions_atom.php';
$timecheck = TIMENOW - 600;
$forums_data = OLD_DB()->fetch_rowset("SELECT forum_id, allow_reg_tracker, forum_name FROM " . BB_FORUMS);
-if (file_exists($bb_cfg['atom']['path'] . '/f/0.atom')) {
- if (filemtime($bb_cfg['atom']['path'] . '/f/0.atom') <= $timecheck) {
+if (file_exists(config('tp.atom.path') . '/f/0.atom')) {
+ if (filemtime(config('tp.atom.path') . '/f/0.atom') <= $timecheck) {
update_forum_feed(0, $forums_data);
}
} else {
@@ -27,8 +25,8 @@ if (file_exists($bb_cfg['atom']['path'] . '/f/0.atom')) {
}
foreach ($forums_data as $forum_data) {
- if (file_exists($bb_cfg['atom']['path'] . '/f/' . $forum_data['forum_id'] . '.atom')) {
- if (filemtime($bb_cfg['atom']['path'] . '/f/' . $forum_data['forum_id'] . '.atom') <= $timecheck) {
+ if (file_exists(config('tp.atom.path') . '/f/' . $forum_data['forum_id'] . '.atom')) {
+ if (filemtime(config('tp.atom.path') . '/f/' . $forum_data['forum_id'] . '.atom') <= $timecheck) {
update_forum_feed($forum_data['forum_id'], $forum_data);
}
} else {
diff --git a/library/includes/datastore/build_cat_forums.php b/library/includes/datastore/build_cat_forums.php
index 48718b3d6..1ab463d0c 100644
--- a/library/includes/datastore/build_cat_forums.php
+++ b/library/includes/datastore/build_cat_forums.php
@@ -11,7 +11,7 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
-global $bf, $bb_cfg;
+global $bf;
//
// cat_forums
@@ -128,8 +128,8 @@ $this->store('viewtopic_forum_select', $data);
//
// latest_news
//
-if ($bb_cfg['show_latest_news'] and $news_forum_ids = $bb_cfg['latest_news_forum_id']) {
- $news_count = max($bb_cfg['latest_news_count'], 1);
+if (config('tp.show_latest_news') && $news_forum_ids = config('tp.latest_news_forum_id')) {
+ $news_count = max(config('tp.latest_news_count'), 1);
$data = OLD_DB()->fetch_rowset("
SELECT topic_id, topic_time, topic_title, forum_id
@@ -146,8 +146,8 @@ if ($bb_cfg['show_latest_news'] and $news_forum_ids = $bb_cfg['latest_news_forum
//
// Network_news
//
-if ($bb_cfg['show_network_news'] and $net_forum_ids = $bb_cfg['network_news_forum_id']) {
- $net_count = max($bb_cfg['network_news_count'], 1);
+if (config('tp.show_network_news') && $net_forum_ids = config('tp.network_news_forum_id')) {
+ $net_count = max(config('tp.network_news_count'), 1);
$data = OLD_DB()->fetch_rowset("
SELECT topic_id, topic_time, topic_title, forum_id
diff --git a/library/includes/datastore/build_smilies.php b/library/includes/datastore/build_smilies.php
index ee38365e0..0178ae988 100644
--- a/library/includes/datastore/build_smilies.php
+++ b/library/includes/datastore/build_smilies.php
@@ -11,16 +11,14 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
-global $bb_cfg;
-
-$smilies = array();
+$smilies = [];
$rowset = OLD_DB()->fetch_rowset("SELECT * FROM " . BB_SMILIES);
sort($rowset);
foreach ($rowset as $smile) {
$smilies['orig'][] = '#(?<=^|\W)' . preg_quote($smile['code'], '#') . '(?=$|\W)#';
- $smilies['repl'][] = ' ';
+ $smilies['repl'][] = ' ';
$smilies['smile'][] = $smile;
}
diff --git a/library/includes/datastore/build_stats.php b/library/includes/datastore/build_stats.php
index 2c583024a..d9fdc2c74 100644
--- a/library/includes/datastore/build_stats.php
+++ b/library/includes/datastore/build_stats.php
@@ -11,9 +11,7 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
-global $bb_cfg;
-
-$data = array();
+$data = [];
// usercount
$row = OLD_DB()->fetch_row("SELECT COUNT(*) AS usercount FROM " . BB_USERS . " WHERE user_id NOT IN(" . EXCLUDED_USERS . ")");
@@ -29,7 +27,7 @@ $data['postcount'] = number_format($row['postcount']);
$data['topiccount'] = number_format($row['topiccount']);
// Tracker stats
-if ($bb_cfg['tor_stats']) {
+if (config('tp.tor_stats')) {
// torrents stat
$row = OLD_DB()->fetch_row("SELECT COUNT(topic_id) AS torrentcount, SUM(size) AS size FROM " . BB_BT_TORRENTS);
$data['torrentcount'] = number_format($row['torrentcount']);
@@ -44,7 +42,7 @@ if ($bb_cfg['tor_stats']) {
}
// gender stat
-if ($bb_cfg['gender']) {
+if (config('tp.gender')) {
$male = OLD_DB()->fetch_row("SELECT COUNT(user_id) AS male FROM " . BB_USERS . " WHERE user_gender = " . MALE . " AND user_id NOT IN(" . EXCLUDED_USERS . ")");
$female = OLD_DB()->fetch_row("SELECT COUNT(user_id) AS female FROM " . BB_USERS . " WHERE user_gender = " . FEMALE . " AND user_id NOT IN(" . EXCLUDED_USERS . ")");
$unselect = OLD_DB()->fetch_row("SELECT COUNT(user_id) AS unselect FROM " . BB_USERS . " WHERE user_gender = 0 AND user_id NOT IN(" . EXCLUDED_USERS . ")");
@@ -55,7 +53,7 @@ if ($bb_cfg['gender']) {
}
// birthday stat
-if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
+if (config('tp.birthday_check_day') && config('tp.birthday_enabled')) {
$sql = OLD_DB()->fetch_rowset("SELECT user_id, username, user_rank , user_birthday
FROM " . BB_USERS . "
WHERE user_id NOT IN(" . EXCLUDED_USERS . ")
@@ -65,7 +63,7 @@ if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
");
$date_today = bb_date(TIMENOW, 'md', false);
- $date_forward = bb_date(TIMENOW + ($bb_cfg['birthday_check_day'] * 86400), 'md', false);
+ $date_forward = bb_date(TIMENOW + (config('tp.birthday_check_day') * 86400), 'md', false);
$birthday_today_list = $birthday_week_list = array();
diff --git a/library/includes/functions.php b/library/includes/functions.php
index f64517871..d77e24fc1 100644
--- a/library/includes/functions.php
+++ b/library/includes/functions.php
@@ -13,22 +13,19 @@ if (!defined('BB_ROOT')) {
function get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div)
{
- global $bb_cfg;
- $ext = $bb_cfg['file_id_ext'][$ext_id] ?? '';
+ $ext = config('tp.file_id_ext.' . $ext_id) ?? '';
return ($base_path ? "$base_path/" : '') . floor($id / $first_div) . '/' . ($id % $sec_div) . '/' . $id . ($ext ? ".$ext" : '');
}
function get_avatar_path($id, $ext_id, $base_path = null, $first_div = 10000, $sec_div = 100)
{
- global $bb_cfg;
- $base_path = $base_path ?? $bb_cfg['avatars']['upload_path'];
+ $base_path = $base_path ?? config('tp.avatars.upload_path');
return get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div);
}
function get_attach_path($id, $ext_id = '', $base_path = null, $first_div = 10000, $sec_div = 100)
{
- global $bb_cfg;
- $base_path = $base_path ?? $bb_cfg['attach']['upload_path'];
+ $base_path = $base_path ?? config('tp.attach.upload_path');
return get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div);
}
@@ -581,26 +578,22 @@ function humn_size($size, $rounder = null, $min = null, $space = ' ')
function bt_show_ip($ip, $port = '')
{
- global $bb_cfg;
-
if (IS_AM) {
$ip = decode_ip($ip);
$ip .= ($port) ? ":$port" : '';
return $ip;
}
- return ($bb_cfg['bt_show_ip_only_moder']) ? false : decode_ip_xx($ip);
+ return config('tp.bt_show_ip_only_moder') ? false : decode_ip_xx($ip);
}
function bt_show_port($port)
{
- global $bb_cfg;
-
if (IS_AM) {
return $port;
}
- return ($bb_cfg['bt_show_port_only_moder']) ? false : $port;
+ return config('tp.bt_show_port_only_moder') ? false : $port;
}
function decode_ip_xx($ip)
@@ -855,7 +848,7 @@ function bb_get_config($table, $from_db = false, $update_cache = true)
{
if ($from_db or !$cfg = OLD_CACHE('bb_config')->get("config_{$table}")) {
$cfg = array();
- foreach (OLD_DB()->fetch_rowset("SELECT * FROM $table") as $row) {
+ foreach (DB::table($table)->get()->toArray() as $row) {
$cfg[$row['config_name']] = $row['config_value'];
}
if ($update_cache) {
@@ -1075,14 +1068,14 @@ function get_forum_select($mode = 'guest', $name = POST_FORUM_URL, $selected = n
function setup_style()
{
- global $bb_cfg, $template, $userdata;
+ global $template, $userdata;
// AdminCP works only with default template
- $tpl_dir_name = defined('IN_ADMIN') ? 'default' : basename($bb_cfg['tpl_name']);
- $stylesheet = defined('IN_ADMIN') ? 'main.css' : basename($bb_cfg['stylesheet']);
+ $tpl_dir_name = defined('IN_ADMIN') ? 'default' : basename(config('tp.tpl_name'));
+ $stylesheet = defined('IN_ADMIN') ? 'main.css' : basename(config('tp.stylesheet'));
if (!IS_GUEST && !empty($userdata['tpl_name'])) {
- foreach ($bb_cfg['templates'] as $folder => $name) {
+ foreach (config('tp.templates') as $folder => $name) {
if ($userdata['tpl_name'] == $folder) {
$tpl_dir_name = basename($userdata['tpl_name']);
}
@@ -1096,7 +1089,7 @@ function setup_style()
'BB_ROOT' => BB_ROOT,
'SPACER' => make_url('styles/images/spacer.gif'),
'STYLESHEET' => make_url($css_dir . $stylesheet),
- 'EXT_LINK_NEW_WIN' => $bb_cfg['ext_link_new_win'],
+ 'EXT_LINK_NEW_WIN' => config('tp.ext_link_new_win'),
'TPL_DIR' => make_url($css_dir),
'SITE_URL' => make_url('/'),
));
@@ -1109,19 +1102,19 @@ function setup_style()
// Create date / time with format and friendly date
function bb_date($gmepoch, $format = false, $friendly_date = true)
{
- global $bb_cfg, $lang, $userdata;
+ global $lang, $userdata;
$gmepoch = (int)$gmepoch;
if (!$format) {
- $format = $bb_cfg['default_dateformat'];
+ $format = config('tp.default_dateformat');
}
if (empty($lang)) {
- require_once($bb_cfg['default_lang_dir'] . 'main.php');
+ require_once(config('tp.default_lang_dir') . 'main.php');
}
if (empty($userdata['session_logged_in'])) {
- $tz = $bb_cfg['board_timezone'];
+ $tz = config('tp.board_timezone');
} else {
$tz = $userdata['user_timezone'];
}
@@ -1156,17 +1149,16 @@ function bb_date($gmepoch, $format = false, $friendly_date = true)
}
}
- return ($bb_cfg['translate_dates']) ? strtr(strtoupper($date), $lang['DATETIME']) : $date;
+ return config('tp.translate_dates') ? strtr(strtoupper($date), $lang['DATETIME']) : $date;
}
function birthday_age($date)
{
- global $bb_cfg;
if (!$date) {
return;
}
- $tz = TIMENOW + (3600 * $bb_cfg['board_timezone']);
+ $tz = TIMENOW + (3600 * config('tp.board_timezone'));
return delta_time(strtotime($date, $tz));
}
@@ -1290,9 +1282,7 @@ function bb_preg_quote($str, $delimiter)
//
function obtain_word_list(&$orig_word, &$replacement_word)
{
- global $bb_cfg;
-
- if (!$bb_cfg['use_word_censor']) {
+ if (!config('tp.use_word_censor')) {
return;
}
@@ -1315,7 +1305,7 @@ function obtain_word_list(&$orig_word, &$replacement_word)
function bb_die($msg_text)
{
- global $ajax, $bb_cfg, $lang, $template, $theme, $userdata;
+ global $ajax, $lang, $template, $theme, $userdata;
if (defined('IN_AJAX')) {
$ajax->ajax_die($msg_text);
@@ -1330,7 +1320,7 @@ function bb_die($msg_text)
// If empty lang
if (empty($lang)) {
- require($bb_cfg['default_lang_dir'] . 'main.php');
+ require(config('tp.default_lang_dir') . 'main.php');
}
// If empty session
@@ -1341,7 +1331,7 @@ function bb_die($msg_text)
// If the header hasn't been output then do it
if (!defined('PAGE_HEADER_SENT')) {
if (empty($template)) {
- $template = new TorrentPier\Legacy\Template(BB_ROOT . "templates/{$bb_cfg['tpl_name']}");
+ $template = new TorrentPier\Legacy\Template(BB_ROOT . 'templates/' . config('tp.tpl_name'));
}
if (empty($theme)) {
$theme = setup_style();
@@ -1369,8 +1359,6 @@ function bb_die($msg_text)
function bb_simple_die($txt)
{
- global $bb_cfg;
-
if (!empty($_COOKIE['explain'])) {
bb_die("bb_simple_die: $txt");
}
@@ -1386,7 +1374,7 @@ function bb_realpath($path)
function redirectToLogin($url = '')
{
- redirectToUrl(LOGIN_URL . '?redirect=' . (($url) ?: ($_SERVER['REQUEST_URI'] ?? '/')));
+ redirectToUrl(LOGIN_URL . '?redirect=' . ($url ?: ($_SERVER['REQUEST_URI'] ?? '/')));
}
function meta_refresh($url, $time = 5)
@@ -1398,8 +1386,6 @@ function meta_refresh($url, $time = 5)
function redirectToUrl($url)
{
- global $bb_cfg;
-
if (headers_sent($filename, $linenum)) {
trigger_error("Headers already sent in $filename($linenum)", E_USER_ERROR);
}
@@ -1409,11 +1395,11 @@ function redirectToUrl($url)
}
$url = trim($url);
- $server_protocol = ($bb_cfg['cookie_secure']) ? 'https://' : 'http://';
+ $server_protocol = config('tp.cookie_secure') ? 'https://' : 'http://';
- $server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($bb_cfg['server_name']));
- $server_port = ($bb_cfg['server_port'] <> 80) ? ':' . trim($bb_cfg['server_port']) : '';
- $script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($bb_cfg['script_path']));
+ $server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim(config('tp.server_name')));
+ $server_port = (config('tp.server_port') <> 80) ? ':' . trim(config('tp.server_port')) : '';
+ $script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim(config('tp.script_path')));
if ($script_name) {
$script_name = "/$script_name";
@@ -1609,9 +1595,9 @@ function cat_exists($cat_id)
function get_topic_icon($topic, $is_unread = null)
{
- global $bb_cfg, $images;
+ global $images;
- $t_hot = ($topic['topic_replies'] >= $bb_cfg['hot_threshold']);
+ $t_hot = ($topic['topic_replies'] >= config('tp.hot_threshold'));
$is_unread = $is_unread ?? is_unread($topic['topic_last_post_time'], $topic['topic_id'], $topic['forum_id']);
if ($topic['topic_status'] == TOPIC_MOVED) {
@@ -1699,8 +1685,7 @@ function get_poll_data_items_js($topic_id)
function poll_is_active($t_data)
{
- global $bb_cfg;
- return ($t_data['topic_vote'] == 1 && $t_data['topic_time'] > TIMENOW - $bb_cfg['poll_max_days'] * 86400);
+ return ($t_data['topic_vote'] == 1 && $t_data['topic_time'] > TIMENOW - config('tp.poll_max_days') * 86400);
}
function print_confirmation($tpl_vars)
@@ -1778,7 +1763,7 @@ function clean_title($str, $replace_underscore = false)
function clean_text_match($text, $ltrim_star = true, $die_if_empty = false)
{
- global $bb_cfg, $lang;
+ global $lang;
$text = str_compact($text);
$ltrim_chars = ($ltrim_star) ? ' *-!' : ' ';
@@ -1786,7 +1771,7 @@ function clean_text_match($text, $ltrim_star = true, $die_if_empty = false)
$text = ' ' . str_compact(ltrim($text, $ltrim_chars)) . ' ';
- if ($bb_cfg['search_engine_type'] == 'sphinx') {
+ if (config('tp.search_engine_type') == 'sphinx') {
$text = preg_replace('#(?<=\S)\-#u', ' ', $text); // "1-2-3" -> "1 2 3"
$text = preg_replace('#[^0-9a-zA-Zа-яА-ЯёЁ\-_*|]#u', ' ', $text); // допустимые символы (кроме " которые отдельно)
$text = str_replace('-', ' -', $text); // - только в начале слова
@@ -1837,7 +1822,7 @@ function log_sphinx_error($err_type, $err_msg, $query = '')
function get_title_match_topics($title_match_sql, array $forum_ids = array())
{
- global $bb_cfg, $sphinx, $userdata, $title_match, $lang;
+ global $sphinx, $userdata, $title_match, $lang;
$where_ids = [];
if ($forum_ids) {
@@ -1845,12 +1830,12 @@ function get_title_match_topics($title_match_sql, array $forum_ids = array())
}
$title_match_sql = encode_text_match($title_match_sql);
- if ($bb_cfg['search_engine_type'] == 'sphinx') {
+ if (config('tp.search_engine_type') == 'sphinx') {
$sphinx = init_sphinx();
$where = $title_match ? 'topics' : 'posts';
- $sphinx->setServer($bb_cfg['sphinx_topic_titles_host'], $bb_cfg['sphinx_topic_titles_port']);
+ $sphinx->setServer(config('tp.sphinx_topic_titles_host'), config('tp.sphinx_topic_titles_port'));
if ($forum_ids) {
$sphinx->setFilter('forum_id', $forum_ids, false);
}
@@ -1870,9 +1855,9 @@ function get_title_match_topics($title_match_sql, array $forum_ids = array())
if ($warning = $sphinx->getLastWarning()) {
log_sphinx_error('wrn', $warning, $title_match_sql);
}
- } elseif ($bb_cfg['search_engine_type'] == 'mysql') {
+ } elseif (config('tp.search_engine_type') == 'mysql') {
$where_forum = ($forum_ids) ? "AND forum_id IN(" . implode(',', $forum_ids) . ")" : '';
- $search_bool_mode = ($bb_cfg['allow_search_in_bool_mode']) ? ' IN BOOLEAN MODE' : '';
+ $search_bool_mode = config('tp.allow_search_in_bool_mode') ? ' IN BOOLEAN MODE' : '';
if ($title_match) {
$where_id = 'topic_id';
@@ -1915,10 +1900,10 @@ function pad_with_space($str)
function create_magnet($infohash, $auth_key, $logged_in)
{
- global $bb_cfg, $_GET, $images;
+ global $_GET, $images;
- $passkey_url = ((!$logged_in || isset($_GET['no_passkey'])) && $bb_cfg['bt_tor_browse_only_reg']) ? '' : "?{$bb_cfg['passkey_key']}=$auth_key";
- return ' ';
+ $passkey_url = ((!$logged_in || isset($_GET['no_passkey'])) && config('tp.bt_tor_browse_only_reg')) ? '' : '?' . config('tp.passkey_key') . "=$auth_key";
+ return ' ';
}
function set_die_append_msg($forum_id = null, $topic_id = null, $group_id = null)
@@ -1971,7 +1956,7 @@ function send_pm($user_id, $subject, $message, $poster_id = BOT_UID)
function profile_url($data)
{
- global $bb_cfg, $lang, $datastore;
+ global $lang, $datastore;
if (!$ranks = $datastore->get('ranks')) {
$datastore->update('ranks');
@@ -1991,7 +1976,7 @@ function profile_url($data)
$style = 'colorUser';
}
- if (!$bb_cfg['color_nick']) {
+ if (!config('tp.color_nick')) {
$style = '';
}
@@ -2009,22 +1994,16 @@ function profile_url($data)
function get_avatar($user_id, $ext_id, $allow_avatar = true, $size = true, $height = '', $width = '')
{
- global $bb_cfg;
-
- if ($size) {
- // TODO размеры: s, m, l + кеширование
- }
-
$height = !$height ? 'height="' . $height . '"' : '';
$width = !$width ? 'width="' . $width . '"' : '';
- $user_avatar = ' ';
+ $user_avatar = ' ';
- if ($user_id == BOT_UID && $bb_cfg['avatars']['bot_avatar']) {
- $user_avatar = ' ';
+ if ($user_id == BOT_UID && config('tp.avatars.bot_avatar')) {
+ $user_avatar = ' ';
} elseif ($allow_avatar && $ext_id) {
if (file_exists(get_avatar_path($user_id, $ext_id))) {
- $user_avatar = ' ';
+ $user_avatar = ' ';
}
}
@@ -2033,9 +2012,9 @@ function get_avatar($user_id, $ext_id, $allow_avatar = true, $size = true, $heig
function gender_image($gender)
{
- global $bb_cfg, $lang, $images;
+ global $lang, $images;
- if (!$bb_cfg['gender']) {
+ if (!config('tp.gender')) {
$user_gender = '';
return $user_gender;
}
@@ -2057,7 +2036,7 @@ function gender_image($gender)
function is_gold($type)
{
- global $lang, $bb_cfg;
+ global $lang;
if (!config('tracker.gold_silver_enabled')) {
$is_gold = '';
@@ -2124,11 +2103,11 @@ function hash_search($hash)
*/
function bb_captcha($mode, $callback = '')
{
- global $bb_cfg, $lang;
+ global $lang;
- $secret = $bb_cfg['captcha']['secret_key'];
- $public = $bb_cfg['captcha']['public_key'];
- $cp_theme = $bb_cfg['captcha']['theme'];
+ $secret = config('tp.captcha.secret_key');
+ $public = config('tp.captcha.public_key');
+ $cp_theme = config('tp.captcha.theme');
if (!$public && !$secret) {
bb_die($lang['CAPTCHA_SETTINGS']);
diff --git a/library/includes/functions_admin.php b/library/includes/functions_admin.php
index fe6653637..4494ba320 100644
--- a/library/includes/functions_admin.php
+++ b/library/includes/functions_admin.php
@@ -646,7 +646,7 @@ function post_delete($mode_or_post_id, $user_id = null, $exclude_first = true)
function user_delete($user_id, $delete_posts = false)
{
- global $bb_cfg, $log_action;
+ global $log_action;
if (!$user_csv = get_id_csv($user_id)) {
return false;
@@ -728,7 +728,7 @@ function user_delete($user_id, $delete_posts = false)
// Delete user feed
foreach (explode(',', $user_csv) as $user_id) {
- $file_path = $bb_cfg['atom']['path'] . '/u/' . floor($user_id / 5000) . '/' . ($user_id % 100) . '/' . $user_id . '.atom';
+ $file_path = config('tp.atom.path') . '/u/' . floor($user_id / 5000) . '/' . ($user_id % 100) . '/' . $user_id . '.atom';
@unlink($file_path);
}
}
diff --git a/library/includes/functions_admin_cron.php b/library/includes/functions_admin_cron.php
index 39bf1eb78..a5c6c787b 100644
--- a/library/includes/functions_admin_cron.php
+++ b/library/includes/functions_admin_cron.php
@@ -9,7 +9,7 @@
function run_jobs($jobs)
{
- global $bb_cfg, $datastore;
+ global $datastore;
define('IN_CRON', true);
diff --git a/library/includes/functions_atom.php b/library/includes/functions_atom.php
index 7a17b185d..b8829415c 100644
--- a/library/includes/functions_atom.php
+++ b/library/includes/functions_atom.php
@@ -16,8 +16,7 @@ if (!defined('BB_ROOT')) {
function update_forum_feed($forum_id, $forum_data)
{
- global $bb_cfg;
- $file_path = $bb_cfg['atom']['path'] . '/f/' . $forum_id . '.atom';
+ $file_path = config('tp.atom.path') . '/f/' . $forum_id . '.atom';
$select_tor_sql = $join_tor_sql = '';
if ($forum_id == 0) {
$forum_data['forum_name'] = 'Общая по всем разделам';
@@ -69,7 +68,7 @@ function update_forum_feed($forum_id, $forum_data)
}
}
if (isset($topic['tor_status'])) {
- if (isset($bb_cfg['tor_frozen'][$topic['tor_status']])) {
+ if (null !== config('tp.tor_frozen.' . $topic['tor_status'])) {
continue;
}
}
@@ -88,8 +87,7 @@ function update_forum_feed($forum_id, $forum_data)
function update_user_feed($user_id, $username)
{
- global $bb_cfg;
- $file_path = $bb_cfg['atom']['path'] . '/u/' . floor($user_id / 5000) . '/' . ($user_id % 100) . '/' . $user_id . '.atom';
+ $file_path = config('tp.atom.path') . '/u/' . floor($user_id / 5000) . '/' . ($user_id % 100) . '/' . $user_id . '.atom';
$sql = "
SELECT
t.topic_id, t.topic_title, t.topic_status,
@@ -115,7 +113,7 @@ function update_user_feed($user_id, $username)
}
}
if (isset($topic['tor_status'])) {
- if (isset($bb_cfg['tor_frozen'][$topic['tor_status']])) {
+ if (null !== config('tp.tor_frozen.' . $topic['tor_status'])) {
continue;
}
}
@@ -134,7 +132,6 @@ function update_user_feed($user_id, $username)
function create_atom($file_path, $mode, $id, $title, $topics)
{
- global $bb_cfg;
$dir = dirname($file_path);
if (!file_exists($dir)) {
if (!bb_mkdir($dir)) {
@@ -152,11 +149,11 @@ function create_atom($file_path, $mode, $id, $title, $topics)
}
$atom = "";
$atom .= "\n";
- $atom .= "\n";
+ $atom .= "\n";
$atom .= "$title \n";
$atom .= "" . $date . "T$time+00:00 \n";
$atom .= "tag:rto.feed,2000:/$mode/$id \n";
- $atom .= " \n";
+ $atom .= " \n";
foreach ($topics as $topic) {
$topic_id = $topic['topic_id'];
$tor_size = '';
diff --git a/library/includes/functions_post.php b/library/includes/functions_post.php
index e3e4dcb48..2803092d8 100644
--- a/library/includes/functions_post.php
+++ b/library/includes/functions_post.php
@@ -16,7 +16,7 @@ if (!defined('BB_ROOT')) {
//
function prepare_post(&$mode, &$post_data, &$error_msg, &$username, &$subject, &$message)
{
- global $bb_cfg, $user, $userdata, $lang;
+ global $user, $userdata, $lang;
// Check username
if (!empty($username)) {
@@ -47,10 +47,10 @@ function prepare_post(&$mode, &$post_data, &$error_msg, &$username, &$subject, &
}
// Check smilies limit
- if ($bb_cfg['max_smilies']) {
- $count_smilies = substr_count(bbcode2html($message), ' !($i % 2) ? 'row1' : 'row2',
'POSTER' => profile_url($post),
'POSTER_NAME_JS' => addslashes($post['username']),
- 'POST_DATE' => bb_date($post['post_time'], $bb_cfg['post_date_format']),
+ 'POST_DATE' => bb_date($post['post_time'], config('tp.post_date_format')),
'MESSAGE' => get_parsed_post($post),
));
}
diff --git a/library/includes/functions_selects.php b/library/includes/functions_selects.php
index 0b3e2a9f7..bfc193389 100644
--- a/library/includes/functions_selects.php
+++ b/library/includes/functions_selects.php
@@ -57,11 +57,9 @@ function tz_select($default, $select_name = 'timezone')
//
function templates_select($default_style, $select_name = 'tpl_name')
{
- global $bb_cfg;
-
$templates_select = '';
$x = 0;
- foreach ($bb_cfg['templates'] as $folder => $name) {
+ foreach (config('tp.templates') as $folder => $name) {
$selected = '';
if ($folder == $default_style) {
$selected = ' selected="selected"';
@@ -70,5 +68,6 @@ function templates_select($default_style, $select_name = 'tpl_name')
$x++;
}
$templates_select .= ' ';
- return ($x > 1) ? $templates_select : reset($bb_cfg['templates']);
+ $templates = config('tp.templates');
+ return ($x > 1) ? $templates_select : reset($templates);
}
diff --git a/library/includes/functions_torrent.php b/library/includes/functions_torrent.php
index b1575a452..a9f389ebe 100644
--- a/library/includes/functions_torrent.php
+++ b/library/includes/functions_torrent.php
@@ -65,7 +65,7 @@ function torrent_auth_check($forum_id, $poster_id)
function tracker_unregister($attach_id, $mode = '')
{
- global $lang, $bb_cfg;
+ global $lang;
$attach_id = (int)$attach_id;
$post_id = $topic_id = $forum_id = $info_hash = null;
@@ -99,7 +99,7 @@ function tracker_unregister($attach_id, $mode = '')
}
// Unset DL-Type for topic
- if ($bb_cfg['bt_unset_dltype_on_tor_unreg'] && $topic_id) {
+ if (config('tp.bt_unset_dltype_on_tor_unreg') && $topic_id) {
$sql = "UPDATE " . BB_TOPICS . " SET topic_dl_type = " . TOPIC_DL_TYPE_NORMAL . " WHERE topic_id = $topic_id";
if (!$result = OLD_DB()->sql_query($sql)) {
@@ -115,7 +115,7 @@ function tracker_unregister($attach_id, $mode = '')
}
// Ocelot
- if ($bb_cfg['ocelot']['enabled']) {
+ if (config('tp.ocelot.enabled')) {
if ($row = OLD_DB()->fetch_row("SELECT info_hash FROM " . BB_BT_TORRENTS . " WHERE attach_id = $attach_id LIMIT 1")) {
$info_hash = $row['info_hash'];
}
@@ -196,7 +196,7 @@ function change_tor_status($attach_id, $new_tor_status)
// Set gold/silver type for torrent
function change_tor_type($attach_id, $tor_status_gold)
{
- global $topic_id, $lang, $bb_cfg;
+ global $topic_id, $lang;
if (!$torrent = get_torrent_info($attach_id)) {
bb_die($lang['TOR_NOT_FOUND']);
@@ -213,7 +213,7 @@ function change_tor_type($attach_id, $tor_status_gold)
OLD_DB()->query("UPDATE " . BB_BT_TORRENTS . " SET tor_type = $tor_status_gold WHERE topic_id = $topic_id");
// Ocelot
- if ($bb_cfg['ocelot']['enabled']) {
+ if (config('tp.ocelot.enabled')) {
if ($row = OLD_DB()->fetch_row("SELECT info_hash FROM " . BB_BT_TORRENTS . " WHERE topic_id = $topic_id LIMIT 1")) {
$info_hash = $row['info_hash'];
}
@@ -223,7 +223,7 @@ function change_tor_type($attach_id, $tor_status_gold)
function tracker_register($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVED, $reg_time = TIMENOW)
{
- global $bb_cfg, $lang, $reg_mode;
+ global $lang, $reg_mode;
$attach_id = (int)$attach_id;
$reg_mode = $mode;
@@ -269,18 +269,18 @@ function tracker_register($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVED
return torrent_error_exit('This is not a bencoded file');
}
- if ($bb_cfg['bt_disable_dht']) {
+ if (config('tp.bt_disable_dht')) {
$tor['info']['private'] = (int)1;
$fp = fopen($filename, 'wb+');
fwrite($fp, \Rych\Bencode\Bencode::encode($tor));
fclose($fp);
}
- if ($bb_cfg['bt_check_announce_url']) {
+ if (config('tp.bt_check_announce_url')) {
include INC_DIR . '/torrent_announce_urls.php';
$ann = (@$tor['announce']) ? $tor['announce'] : '';
- $announce_urls['main_url'] = $bb_cfg['bt_announce_url'];
+ $announce_urls['main_url'] = config('tp.bt_announce_url');
if (!$ann || !in_array($ann, $announce_urls)) {
$msg = sprintf($lang['INVALID_ANN_URL'], htmlspecialchars($ann), $announce_urls['main_url']);
@@ -299,7 +299,7 @@ function tracker_register($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVED
$info_hash_md5 = md5($info_hash);
// Ocelot
- if ($bb_cfg['ocelot']['enabled']) {
+ if (config('tp.ocelot.enabled')) {
ocelot_update_tracker('add_torrent', array('info_hash' => rawurlencode($info_hash), 'id' => $topic_id, 'freetorrent' => 0));
}
@@ -347,7 +347,7 @@ function tracker_register($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVED
}
// set DL-Type for topic
- if ($bb_cfg['bt_set_dltype_on_tor_reg']) {
+ if (config('tp.bt_set_dltype_on_tor_reg')) {
$sql = 'UPDATE ' . BB_TOPICS . ' SET topic_dl_type = ' . TOPIC_DL_TYPE_DL . " WHERE topic_id = $topic_id";
if (!$result = OLD_DB()->sql_query($sql)) {
@@ -370,9 +370,9 @@ function tracker_register($attach_id, $mode = '', $tor_status = TOR_NOT_APPROVED
function send_torrent_with_passkey($filename)
{
- global $attachment, $auth_pages, $userdata, $bb_cfg, $lang;
+ global $attachment, $auth_pages, $userdata, $lang;
- if (!$bb_cfg['bt_add_auth_key'] || $attachment['extension'] !== TORRENT_EXT || !$size = @filesize($filename)) {
+ if (!config('tp.bt_add_auth_key') || $attachment['extension'] !== TORRENT_EXT || !$size = @filesize($filename)) {
return;
}
@@ -380,8 +380,8 @@ function send_torrent_with_passkey($filename)
$user_id = $userdata['user_id'];
$attach_id = $attachment['attach_id'];
- if (!$passkey_key = $bb_cfg['passkey_key']) {
- bb_die('Could not add passkey (wrong config $bb_cfg[\'passkey_key\'])');
+ if (!$passkey_key = config('tp.passkey_key')) {
+ bb_die('Could not add passkey (wrong config $cfg[\'passkey_key\'])');
}
// Get $post_id & $poster_id
@@ -416,13 +416,13 @@ function send_torrent_with_passkey($filename)
if (!$passkey_val) {
if (!$passkey_val = generate_passkey($user_id)) {
bb_simple_die('Could not generate passkey');
- } elseif ($bb_cfg['ocelot']['enabled']) {
+ } elseif (config('tp.ocelot.enabled')) {
ocelot_update_tracker('add_user', array('id' => $user_id, 'passkey' => $passkey_val));
}
}
// Ratio limits
- $min_ratio = $bb_cfg['bt_min_ratio_allow_dl_tor'];
+ $min_ratio = config('tp.bt_min_ratio_allow_dl_tor');
if ($min_ratio && $user_id != $poster_id && ($user_ratio = get_bt_ratio($bt_userdata)) !== null) {
if ($user_ratio < $min_ratio && $post_id) {
@@ -441,22 +441,22 @@ function send_torrent_with_passkey($filename)
}
// Announce URL
- $ann_url = $bb_cfg['bt_announce_url'];
+ $ann_url = config('tp.bt_announce_url');
$file_contents = file_get_contents($filename);
if (!$tor = \Rych\Bencode\Bencode::decode($file_contents)) {
bb_die('This is not a bencoded file');
}
- $announce = $bb_cfg['ocelot']['enabled'] ? (string)($bb_cfg['ocelot']['url'] . $passkey_val . "/announce") : (string)($ann_url . "?$passkey_key=$passkey_val");
+ $announce = config('tp.ocelot.enabled') ? (string)(config('tp.ocelot.url') . $passkey_val . "/announce") : (string)($ann_url . "?$passkey_key=$passkey_val");
// Replace original announce url with tracker default
- if ($bb_cfg['bt_replace_ann_url'] || !isset($tor['announce'])) {
+ if (config('tp.bt_replace_ann_url') || !isset($tor['announce'])) {
$tor['announce'] = $announce;
}
// Delete all additional urls
- if ($bb_cfg['bt_del_addit_ann_urls'] || $bb_cfg['bt_disable_dht']) {
+ if (config('tp.bt_del_addit_ann_urls') || config('tp.bt_disable_dht')) {
unset($tor['announce-list']);
} elseif (isset($tor['announce-list'])) {
$tor['announce-list'] = array_merge($tor['announce-list'], array(array($announce)));
@@ -480,7 +480,7 @@ function send_torrent_with_passkey($filename)
}
// Add publisher & topic url
- $publisher_name = $bb_cfg['server_name'];
+ $publisher_name = config('tp.server_name');
$publisher_url = make_url(TOPIC_URL . $topic_id);
$tor['publisher'] = (string)$publisher_name;
@@ -494,7 +494,7 @@ function send_torrent_with_passkey($filename)
// Send torrent
$output = \Rych\Bencode\Bencode::encode($tor);
- $dl_fname = '[' . $bb_cfg['server_name'] . '].t' . $topic_id . '.torrent';
+ $dl_fname = '[' . config('tp.server_name') . '].t' . $topic_id . '.torrent';
if (!empty($_COOKIE['explain'])) {
$out = "attach path: $filename ";
@@ -511,7 +511,7 @@ function send_torrent_with_passkey($filename)
function generate_passkey($user_id, $force_generate = false)
{
- global $bb_cfg, $lang, $sql;
+ global $lang, $sql;
$user_id = (int)$user_id;
@@ -548,7 +548,7 @@ function generate_passkey($user_id, $force_generate = false)
if (OLD_DB()->affected_rows() == 1) {
// Ocelot
- if ($bb_cfg['ocelot']['enabled']) {
+ if (config('tp.ocelot.enabled')) {
ocelot_update_tracker('change_passkey', array('oldpasskey' => $old_passkey, 'newpasskey' => $passkey_val));
}
return $passkey_val;
@@ -602,9 +602,7 @@ function torrent_error_exit($message)
function ocelot_update_tracker($action, $updates)
{
- global $bb_cfg;
-
- $get = $bb_cfg['ocelot']['secret'] . "/update?action=$action";
+ $get = config('tp.ocelot.secret') . "/update?action=$action";
foreach ($updates as $key => $value) {
$get .= "&$key=$value";
@@ -618,8 +616,6 @@ function ocelot_update_tracker($action, $updates)
function ocelot_send_request($get, $max_attempts = 1, &$err = false)
{
- global $bb_cfg;
-
$header = "GET /$get HTTP/1.1\r\nConnection: Close\r\n\r\n";
$attempts = $success = $response = 0;
$start_time = microtime(true);
@@ -627,7 +623,7 @@ function ocelot_send_request($get, $max_attempts = 1, &$err = false)
while (!$success && $attempts++ < $max_attempts) {
// Send request
- $file = fsockopen($bb_cfg['ocelot']['host'], $bb_cfg['ocelot']['port'], $error_num, $error_string);
+ $file = fsockopen(config('tp.ocelot.host'), config('tp.ocelot.port'), $error_num, $error_string);
if ($file) {
if (fwrite($file, $header) === false) {
$err = "Failed to fwrite()";
diff --git a/library/includes/init_bb.php b/library/includes/init_bb.php
index a19cf65f7..f3316f9d1 100644
--- a/library/includes/init_bb.php
+++ b/library/includes/init_bb.php
@@ -47,9 +47,7 @@ function send_page($contents)
*/
function compress_output($contents)
{
- global $bb_cfg;
-
- if ($bb_cfg['gzip_compress'] && GZIP_OUTPUT_ALLOWED && !defined('NO_GZIP')) {
+ if (config('tp.gzip_compress') && GZIP_OUTPUT_ALLOWED && !defined('NO_GZIP')) {
if (UA_GZIP_SUPPORTED && strlen($contents) > 2000) {
header('Content-Encoding: gzip');
$contents = gzencode($contents, 1);
@@ -67,7 +65,7 @@ if (!defined('IN_AJAX')) {
}
// Cookie params
-$c = $bb_cfg['cookie_prefix'];
+$c = config('tp.cookie_prefix');
define('COOKIE_DATA', $c . 'data');
define('COOKIE_FORUM', $c . 'f');
define('COOKIE_MARK', $c . 'mark_read');
@@ -90,8 +88,7 @@ define('COOKIE_MAX_TRACKS', 90);
*/
function bb_setcookie($name, $val, $lifetime = COOKIE_PERSIST, $httponly = false)
{
- global $bb_cfg;
- return setcookie($name, $val, $lifetime, $bb_cfg['script_path'], $bb_cfg['cookie_domain'], $bb_cfg['cookie_secure'], $httponly);
+ return setcookie($name, $val, $lifetime, config('tp.script_path'), config('tp.cookie_domain'), config('tp.cookie_secure'), $httponly);
}
/**
@@ -285,11 +282,11 @@ define('CAT_URL', 'index.php?c=');
define('DOWNLOAD_URL', 'dl.php?id=');
define('FORUM_URL', 'viewforum.php?f=');
define('GROUP_URL', 'group.php?g=');
-define('LOGIN_URL', $bb_cfg['login_url']);
+define('LOGIN_URL', config('tp.login_url'));
define('MODCP_URL', 'modcp.php?f=');
-define('PM_URL', $bb_cfg['pm_url']);
+define('PM_URL', config('tp.pm_url'));
define('POST_URL', 'viewtopic.php?p=');
-define('POSTING_URL', $bb_cfg['posting_url']);
+define('POSTING_URL', config('tp.posting_url'));
define('PROFILE_URL', 'profile.php?mode=viewprofile&u=');
define('BONUS_URL', 'profile.php?mode=bonus');
define('TOPIC_URL', 'viewtopic.php?t=');
@@ -396,8 +393,6 @@ if (DBG_USER) {
require INC_DIR . '/functions_dev.php';
}
-$bb_cfg = array_merge(bb_get_config(BB_CONFIG), $bb_cfg);
-
$log_action = new TorrentPier\Legacy\LogAction();
$html = new TorrentPier\Legacy\Common\Html();
$user = new TorrentPier\Legacy\Common\User();
@@ -407,8 +402,8 @@ $userdata =& $user->data;
/**
* Cron
*/
-if ((empty($_POST) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !file_exists(CRON_RUNNING) && ($bb_cfg['cron_enabled'] || defined('START_CRON'))) || defined('FORCE_CRON')) {
- if (TIMENOW - $bb_cfg['cron_last_check'] > $bb_cfg['cron_check_interval']) {
+if ((empty($_POST) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !file_exists(CRON_RUNNING) && (config('tp.cron_enabled') || defined('START_CRON'))) || defined('FORCE_CRON')) {
+ if (TIMENOW - config('tp.cron_last_check') > config('tp.cron_check_interval')) {
/** Update cron_last_check */
bb_update_config(['cron_last_check' => TIMENOW + 10]);
@@ -448,9 +443,9 @@ if ((empty($_POST) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !file_exist
/**
* Exit if board is disabled via trigger
*/
-if (($bb_cfg['board_disable'] || file_exists(BB_DISABLED)) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !defined('IN_LOGIN')) {
+if ((config('tp.board_disable') || file_exists(BB_DISABLED)) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !defined('IN_LOGIN')) {
header('HTTP/1.0 503 Service Unavailable');
- if ($bb_cfg['board_disable']) {
+ if (config('tp.board_disable')) {
// admin lock
send_no_cache_headers();
bb_die('BOARD_DISABLE');
diff --git a/library/includes/online_userlist.php b/library/includes/online_userlist.php
index 226abd58a..4c5a39de6 100644
--- a/library/includes/online_userlist.php
+++ b/library/includes/online_userlist.php
@@ -116,7 +116,7 @@ if (!$online['userlist']) {
$total_online = $logged_online + $guests_online;
-if ($total_online > $bb_cfg['record_online_users']) {
+if ($total_online > config('tp.record_online_users')) {
bb_update_config(array(
'record_online_users' => $total_online,
'record_online_date' => TIMENOW,
diff --git a/library/includes/page_footer.php b/library/includes/page_footer.php
index 0358704fe..523c83d93 100644
--- a/library/includes/page_footer.php
+++ b/library/includes/page_footer.php
@@ -11,7 +11,7 @@ if (!defined('BB_ROOT')) {
die(basename(__FILE__));
}
-global $bb_cfg, $userdata, $template, $DBS, $lang;
+global $userdata, $template, $DBS, $lang;
if (!empty($template)) {
$template->assign_vars(array(
@@ -27,15 +27,15 @@ if (!empty($template)) {
$show_dbg_info = (DBG_USER && IS_ADMIN && !(isset($_GET['pane']) && $_GET['pane'] == 'left'));
-if (!$bb_cfg['gzip_compress']) {
+if (!config('tp.gzip_compress')) {
flush();
}
if ($show_dbg_info) {
$gen_time = utime() - TIMESTART;
$gen_time_txt = sprintf('%.3f', $gen_time);
- $gzip_text = (UA_GZIP_SUPPORTED) ? 'GZIP ' : 'GZIP ';
- $gzip_text .= ($bb_cfg['gzip_compress']) ? $lang['ON'] : $lang['OFF'];
+ $gzip_text = UA_GZIP_SUPPORTED ? 'GZIP ' : 'GZIP ';
+ $gzip_text .= config('tp.gzip_compress') ? $lang['ON'] : $lang['OFF'];
$stat = '[ ' . $lang['EXECUTION_TIME'] . " $gen_time_txt " . $lang['SEC'];
@@ -49,7 +49,7 @@ if ($show_dbg_info) {
$stat .= " | $gzip_text";
$stat .= ' | ' . $lang['MEMORY'];
- $stat .= humn_size($bb_cfg['mem_on_start'], 2) . ' / ';
+ $stat .= humn_size(config('tp.mem_on_start'), 2) . ' / ';
$stat .= humn_size(sys('mem_peak'), 2) . ' / ';
$stat .= humn_size(sys('mem'), 2);
@@ -87,7 +87,7 @@ echo '
if (defined('REQUESTED_PAGE') && !defined('DISABLE_CACHING_OUTPUT')) {
if (IS_GUEST === true) {
- caching_output(true, 'store', REQUESTED_PAGE . '_guest_' . $bb_cfg['default_lang']);
+ caching_output(true, 'store', REQUESTED_PAGE . '_guest_' . config('tp.default_lang'));
}
}
diff --git a/library/includes/page_header.php b/library/includes/page_header.php
index 40ecc867e..50ac8169d 100644
--- a/library/includes/page_header.php
+++ b/library/includes/page_header.php
@@ -16,7 +16,7 @@ if (defined('PAGE_HEADER_SENT')) {
// Parse and show the overall page header
-global $page_cfg, $userdata, $user, $ads, $bb_cfg, $template, $lang, $images;
+global $page_cfg, $userdata, $user, $ads, $template, $lang, $images;
$logged_in = (int)!empty($userdata['session_logged_in']);
@@ -50,7 +50,7 @@ if (defined('SHOW_ONLINE') && SHOW_ONLINE) {
'TOTAL_USERS_ONLINE' => ${$online_list}['stat'],
'LOGGED_IN_USER_LIST' => ${$online_list}['userlist'],
'USERS_ONLINE_COUNTS' => ${$online_list}['cnt'],
- 'RECORD_USERS' => sprintf($lang['RECORD_ONLINE_USERS'], $bb_cfg['record_online_users'], bb_date($bb_cfg['record_online_date'])),
+ 'RECORD_USERS' => sprintf($lang['RECORD_ONLINE_USERS'], config('tp.record_online_users'), bb_date(config('tp.record_online_date'))),
));
}
@@ -121,9 +121,9 @@ $template->assign_vars(array(
'USE_TABLESORTER' => !empty($page_cfg['use_tablesorter']),
- 'SITENAME' => $bb_cfg['sitename'],
+ 'SITENAME' => config('tp.sitename'),
'U_INDEX' => BB_ROOT . "index.php",
- 'T_INDEX' => sprintf($lang['FORUM_INDEX'], $bb_cfg['sitename']),
+ 'T_INDEX' => sprintf($lang['FORUM_INDEX'], config('tp.sitename')),
'IS_GUEST' => IS_GUEST,
'IS_USER' => IS_USER,
@@ -134,9 +134,9 @@ $template->assign_vars(array(
'FORUM_PATH' => FORUM_PATH,
'FULL_URL' => FULL_URL,
- 'CURRENT_TIME' => sprintf($lang['CURRENT_TIME'], bb_date(TIMENOW, $bb_cfg['last_visit_date_format'], false)),
- 'S_TIMEZONE' => preg_replace('/\(.*?\)/', '', sprintf($lang['ALL_TIMES'], $lang['TZ'][str_replace(',', '.', (float)$bb_cfg['board_timezone'])])),
- 'BOARD_TIMEZONE' => $bb_cfg['board_timezone'],
+ 'CURRENT_TIME' => sprintf($lang['CURRENT_TIME'], bb_date(TIMENOW, config('tp.last_visit_date_format'), false)),
+ 'S_TIMEZONE' => preg_replace('/\(.*?\)/', '', sprintf($lang['ALL_TIMES'], $lang['TZ'][str_replace(',', '.', (float)config('tp.board_timezone'))])),
+ 'BOARD_TIMEZONE' => config('tp.board_timezone'),
'PM_INFO' => $pm_info,
'PRIVMSG_IMG' => $icon_pm,
@@ -147,7 +147,7 @@ $template->assign_vars(array(
'THIS_USER' => profile_url($userdata),
'THIS_AVATAR' => get_avatar($userdata['user_id'], $userdata['avatar_ext_id'], !bf($userdata['user_opt'], 'user_opt', 'dis_avatar')),
'SHOW_LOGIN_LINK' => !defined('IN_LOGIN'),
- 'AUTOLOGIN_DISABLED' => !$bb_cfg['allow_autologin'],
+ 'AUTOLOGIN_DISABLED' => !config('tp.allow_autologin'),
'S_LOGIN_ACTION' => LOGIN_URL,
'U_CUR_DOWNLOADS' => PROFILE_URL . $userdata['user_id'],
@@ -163,11 +163,11 @@ $template->assign_vars(array(
'U_REGISTER' => "profile.php?mode=register",
'U_SEARCH' => "search.php",
'U_SEND_PASSWORD' => "profile.php?mode=sendpassword",
- 'U_TERMS' => $bb_cfg['terms_and_conditions_url'],
+ 'U_TERMS' => config('tp.terms_and_conditions_url'),
'U_TRACKER' => "tracker.php",
- 'SHOW_SIDEBAR1' => !empty(config('page.show_sidebar1.' . BB_SCRIPT)) || $bb_cfg['show_sidebar1_on_every_page'],
- 'SHOW_SIDEBAR2' => !empty(config('page.show_sidebar2.' . BB_SCRIPT)) || $bb_cfg['show_sidebar2_on_every_page'],
+ 'SHOW_SIDEBAR1' => !empty(config('page.show_sidebar1.' . BB_SCRIPT)) || config('tp.show_sidebar1_on_every_page'),
+ 'SHOW_SIDEBAR2' => !empty(config('page.show_sidebar2.' . BB_SCRIPT)) || config('tp.show_sidebar2_on_every_page'),
'HTML_AGREEMENT' => LANG_DIR . 'html/user_agreement.html',
'HTML_COPYRIGHT' => LANG_DIR . 'html/copyright_holders.html',
@@ -181,11 +181,11 @@ $template->assign_vars(array(
'DOWNLOAD_URL' => BB_ROOT . DOWNLOAD_URL,
'FORUM_URL' => BB_ROOT . FORUM_URL,
'GROUP_URL' => BB_ROOT . GROUP_URL,
- 'LOGIN_URL' => $bb_cfg['login_url'],
+ 'LOGIN_URL' => config('tp.login_url'),
'NEWEST_URL' => '&view=newest#newest',
- 'PM_URL' => $bb_cfg['pm_url'],
+ 'PM_URL' => config('tp.pm_url'),
'POST_URL' => BB_ROOT . POST_URL,
- 'POSTING_URL' => $bb_cfg['posting_url'],
+ 'POSTING_URL' => config('tp.posting_url'),
'PROFILE_URL' => BB_ROOT . PROFILE_URL,
'TOPIC_URL' => BB_ROOT . TOPIC_URL,
@@ -205,10 +205,46 @@ $template->assign_vars(array(
'READONLY' => HTML_READONLY,
'SELECTED' => HTML_SELECTED,
- 'GS_ENABLED' => config('tracker.gold_silver_enabled'),
-
'U_SEARCH_SELF_BY_LAST' => "search.php?uid={$userdata['user_id']}&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'])) {
@@ -252,6 +288,6 @@ $template->pparse('page_header');
define('PAGE_HEADER_SENT', true);
-if (!$bb_cfg['gzip_compress']) {
+if (!config('tp.gzip_compress')) {
flush();
}
diff --git a/library/includes/sessions.php b/library/includes/sessions.php
index ae50a7cb4..bf625b997 100644
--- a/library/includes/sessions.php
+++ b/library/includes/sessions.php
@@ -39,14 +39,12 @@ function cache_get_userdata($id)
function cache_set_userdata($userdata, $force = false)
{
- global $bb_cfg;
-
if (!$userdata || (ignore_cached_userdata() && !$force)) {
return false;
}
$id = ($userdata['user_id'] == GUEST_UID) ? $userdata['session_ip'] : $userdata['session_id'];
- return OLD_CACHE('session_cache')->set($id, $userdata, $bb_cfg['session_update_intrv']);
+ return OLD_CACHE('session_cache')->set($id, $userdata, config('tp.session_update_intrv'));
}
function cache_rm_userdata($userdata)
diff --git a/library/includes/torrent_show_dl_list.php b/library/includes/torrent_show_dl_list.php
index 0855110a3..57d2192d1 100644
--- a/library/includes/torrent_show_dl_list.php
+++ b/library/includes/torrent_show_dl_list.php
@@ -21,11 +21,11 @@ $dl_users_div_style_overflow = "padding: 6px; height: $dl_users_overflow_div_hei
$template->assign_vars(array('DL_BUTTONS' => false));
-$count_mode = ($bb_cfg['bt_dl_list_only_count'] && !(@$_GET['dl'] === 'names'));
+$count_mode = (config('tp.bt_dl_list_only_count') && !(@$_GET['dl'] === 'names'));
-$dl_topic = ($t_data['topic_dl_type'] == TOPIC_DL_TYPE_DL && !($bb_cfg['bt_dl_list_only_1st_page'] && $start));
-$show_dl_list = ($dl_topic && ($bb_cfg['bt_show_dl_list'] || ($bb_cfg['allow_dl_list_names_mode'] && @$_GET['dl'] === 'names')));
-$show_dl_buttons = ($dl_topic && $bb_cfg['bt_show_dl_list_buttons']);
+$dl_topic = ($t_data['topic_dl_type'] == TOPIC_DL_TYPE_DL && !(config('tp.bt_dl_list_only_1st_page') && $start));
+$show_dl_list = ($dl_topic && (config('tp.bt_show_dl_list') || (config('tp.allow_dl_list_names_mode') && @$_GET['dl'] === 'names')));
+$show_dl_buttons = ($dl_topic && config('tp.bt_show_dl_list_buttons'));
// link to clear DL-List
$template->assign_vars(array('S_DL_DELETE' => false));
@@ -106,10 +106,10 @@ if ($show_dl_list) {
if ($show_dl_buttons) {
$template->assign_vars(array(
'DL_BUTTONS' => true,
- 'DL_BUT_WILL' => $bb_cfg['bt_show_dl_but_will'],
- 'DL_BUT_DOWN' => $bb_cfg['bt_show_dl_but_down'],
- 'DL_BUT_COMPL' => $bb_cfg['bt_show_dl_but_compl'],
- 'DL_BUT_CANCEL' => $bb_cfg['bt_show_dl_but_cancel'],
+ 'DL_BUT_WILL' => config('tp.bt_show_dl_but_will'),
+ 'DL_BUT_DOWN' => config('tp.bt_show_dl_but_down'),
+ 'DL_BUT_COMPL' => config('tp.bt_show_dl_but_compl'),
+ 'DL_BUT_CANCEL' => config('tp.bt_show_dl_but_cancel'),
));
$dl_hidden_fields = '
diff --git a/library/includes/ucp/bonus.php b/library/includes/ucp/bonus.php
index 6c99c8db3..3634fee40 100644
--- a/library/includes/ucp/bonus.php
+++ b/library/includes/ucp/bonus.php
@@ -14,9 +14,9 @@ if (!defined('BB_ROOT')) {
$user_id = $userdata['user_id'];
$user_points = $userdata['user_points'];
-if ($bb_cfg['seed_bonus_enabled'] && $bb_cfg['bonus_upload'] && $bb_cfg['bonus_upload_price']) {
- $upload_row = unserialize($bb_cfg['bonus_upload']);
- $price_row = unserialize($bb_cfg['bonus_upload_price']);
+if (config('tp.seed_bonus_enabled') && config('tp.bonus_upload') && config('tp.bonus_upload_price')) {
+ $upload_row = unserialize(config('tp.bonus_upload'));
+ $price_row = unserialize(config('tp.bonus_upload_price'));
} else {
bb_die($lang['EXCHANGE_NOT']);
}
diff --git a/library/includes/ucp/email.php b/library/includes/ucp/email.php
index a9b562500..e999b0c86 100644
--- a/library/includes/ucp/email.php
+++ b/library/includes/ucp/email.php
@@ -12,8 +12,8 @@ if (!defined('BB_ROOT')) {
}
// Is send through board enabled? No, return to index
-if (!$bb_cfg['board_email_form']) {
- redirectToUrl("index.php");
+if (!config('tp.board_email_form')) {
+ redirectToUrl('index.php');
}
set_die_append_msg();
@@ -62,7 +62,7 @@ if ($row = OLD_DB()->fetch_row($sql)) {
$emailer->set_template('profile_send_email', $user_lang);
$emailer->assign_vars(array(
- 'SITENAME' => $bb_cfg['sitename'],
+ 'SITENAME' => config('tp.sitename'),
'FROM_USERNAME' => $userdata['username'],
'TO_USERNAME' => $username,
'MESSAGE' => $message,
diff --git a/library/includes/ucp/register.php b/library/includes/ucp/register.php
index 2d724f1c4..b3f856351 100644
--- a/library/includes/ucp/register.php
+++ b/library/includes/ucp/register.php
@@ -16,7 +16,7 @@ array_deep($_POST, 'trim');
set_die_append_msg();
if (IS_ADMIN) {
- $bb_cfg['reg_email_activation'] = false;
+ config(['tp.reg_email_activation' => false]);
$new_user = (int)request_var('admin', '');
if ($new_user) {
@@ -54,16 +54,16 @@ switch ($mode) {
if (!IS_ADMIN) {
// Ограничение по ip
- if ($bb_cfg['unique_ip']) {
+ if (config('tp.unique_ip')) {
if ($users = OLD_DB()->fetch_row("SELECT user_id, username FROM " . BB_USERS . " WHERE user_reg_ip = '" . USER_IP . "' LIMIT 1")) {
- bb_die(sprintf($lang['ALREADY_REG_IP'], '' . $users['username'] . ' ', $bb_cfg['tech_admin_email']));
+ bb_die(sprintf($lang['ALREADY_REG_IP'], '' . $users['username'] . ' ', config('tp.tech_admin_email')));
}
}
// Отключение регистрации
- if ($bb_cfg['new_user_reg_disabled'] || ($bb_cfg['reg_email_activation'] && !config('email.enabled'))) {
+ if (config('tp.new_user_reg_disabled') || (config('tp.reg_email_activation') && !config('email.enabled'))) {
bb_die($lang['NEW_USER_REG_DISABLED']);
} // Ограничение по времени
- elseif ($bb_cfg['new_user_reg_restricted']) {
+ elseif (config('tp.new_user_reg_restricted')) {
if (in_array(date('G'), array(0, /*1,2,3,4,5,6,7,8,11,12,13,14,15,16,*/
17, 18, 19, 20, 21, 22, 23))) {
bb_die($lang['REGISTERED_IN_TIME']);
@@ -86,8 +86,8 @@ switch ($mode) {
'username' => '',
'user_password' => '',
'user_email' => '',
- 'user_timezone' => $bb_cfg['board_timezone'],
- 'user_lang' => $bb_cfg['default_lang'],
+ 'user_timezone' => config('tp.board_timezone'),
+ 'user_lang' => config('tp.default_lang'),
'user_opt' => 0,
'avatar_ext_id' => 0,
);
@@ -104,7 +104,7 @@ switch ($mode) {
// field => can_edit
$profile_fields = array(
'user_active' => IS_ADMIN,
- 'username' => (IS_ADMIN || $bb_cfg['allow_namechange']),
+ 'username' => (IS_ADMIN || config('tp.allow_namechange')),
'user_password' => true,
'user_email' => true, // должен быть после user_password
'user_lang' => true,
@@ -152,7 +152,7 @@ switch ($mode) {
}
// Captcha
-$need_captcha = ($mode == 'register' && !IS_ADMIN && !$bb_cfg['captcha']['disabled']);
+$need_captcha = ($mode == 'register' && !IS_ADMIN && !config('tp.captcha.disabled'));
if ($submit) {
if ($need_captcha && !bb_captcha('check')) {
@@ -255,7 +255,7 @@ foreach ($profile_fields as $field => $can_edit) {
if (!$errors and $err = validate_email($email)) {
$errors[] = $err;
}
- if ($bb_cfg['reg_email_activation']) {
+ if (config('tp.reg_email_activation')) {
$pr_data['user_active'] = 0;
$db_data['user_active'] = 0;
}
@@ -313,10 +313,10 @@ foreach ($profile_fields as $field => $can_edit) {
if (!empty($birthday_date['year'])) {
if (strtotime($user_birthday) >= TIMENOW) {
$errors[] = $lang['WRONG_BIRTHDAY_FORMAT'];
- } elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] > $bb_cfg['birthday_max_age']) {
- $errors[] = sprintf($lang['BIRTHDAY_TO_HIGH'], $bb_cfg['birthday_max_age']);
- } elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] < $bb_cfg['birthday_min_age']) {
- $errors[] = sprintf($lang['BIRTHDAY_TO_LOW'], $bb_cfg['birthday_min_age']);
+ } elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] > config('tp.birthday_max_age')) {
+ $errors[] = sprintf($lang['BIRTHDAY_TO_HIGH'], config('tp.birthday_max_age'));
+ } elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] < config('tp.birthday_min_age')) {
+ $errors[] = sprintf($lang['BIRTHDAY_TO_LOW'], config('tp.birthday_min_age'));
}
}
@@ -367,10 +367,10 @@ foreach ($profile_fields as $field => $can_edit) {
delete_avatar($pr_data['user_id'], $pr_data['avatar_ext_id']);
$pr_data['avatar_ext_id'] = 0;
$db_data['avatar_ext_id'] = 0;
- } elseif (!empty($_FILES['avatar']['name']) && $bb_cfg['avatars']['up_allowed']) {
+ } elseif (!empty($_FILES['avatar']['name']) && config('tp.avatars.up_allowed')) {
$upload = new TorrentPier\Legacy\Common\Upload();
- if ($upload->init($bb_cfg['avatars'], $_FILES['avatar']) and $upload->store('avatar', $pr_data)) {
+ if ($upload->init(config('tp.avatars'), $_FILES['avatar']) and $upload->store('avatar', $pr_data)) {
$pr_data['avatar_ext_id'] = $upload->file_ext_id;
$db_data['avatar_ext_id'] = (int)$upload->file_ext_id;
} else {
@@ -378,7 +378,7 @@ foreach ($profile_fields as $field => $can_edit) {
}
}
}
- $tp_data['AVATARS_MAX_SIZE'] = humn_size($bb_cfg['avatars']['max_size']);
+ $tp_data['AVATARS_MAX_SIZE'] = humn_size(config('tp.avatars.max_size'));
break;
/**
@@ -437,7 +437,7 @@ foreach ($profile_fields as $field => $can_edit) {
if ($submit && $sig != $pr_data['user_sig']) {
$sig = prepare_message($sig);
- if (mb_strlen($sig, 'UTF-8') > $bb_cfg['max_sig_chars']) {
+ if (mb_strlen($sig, 'UTF-8') > config('tp.max_sig_chars')) {
$errors[] = $lang['SIGNATURE_TOO_LONG'];
} elseif (preg_match('#<(a|b|i|u|table|tr|td|img) #i', $sig) || preg_match('#(href|src|target|title)=#i', $sig)) {
$errors[] = $lang['SIGNATURE_ERROR_HTML'];
@@ -512,9 +512,9 @@ foreach ($profile_fields as $field => $can_edit) {
$templates = isset($_POST['tpl_name']) ? (string)$_POST['tpl_name'] : $pr_data['tpl_name'];
$templates = htmlCHR($templates);
if ($submit && $templates != $pr_data['tpl_name']) {
- $pr_data['tpl_name'] = $bb_cfg['tpl_name'];
- $db_data['tpl_name'] = (string)$bb_cfg['tpl_name'];
- foreach ($bb_cfg['templates'] as $folder => $name) {
+ $pr_data['tpl_name'] = config('tp.tpl_name');
+ $db_data['tpl_name'] = (string)config('tp.tpl_name');
+ foreach (config('tp.templates') as $folder => $name) {
if ($templates == $folder) {
$pr_data['tpl_name'] = $templates;
$db_data['tpl_name'] = (string)$templates;
@@ -538,7 +538,7 @@ if ($submit && !$errors) {
* Создание нового профиля
*/
if ($mode == 'register') {
- if ($bb_cfg['reg_email_activation']) {
+ if (config('tp.reg_email_activation')) {
$user_actkey = make_rand_str(12);
$db_data['user_active'] = 0;
$db_data['user_actkey'] = $user_actkey;
@@ -553,7 +553,7 @@ if ($submit && !$errors) {
}
if (!isset($db_data['tpl_name'])) {
- $db_data['tpl_name'] = (string)$bb_cfg['tpl_name'];
+ $db_data['tpl_name'] = (string)config('tp.tpl_name');
}
$sql_args = OLD_DB()->build_array('INSERT', $db_data);
@@ -565,27 +565,27 @@ if ($submit && !$errors) {
set_pr_die_append_msg($new_user_id);
$message = $lang['ACCOUNT_ADDED'];
} else {
- if ($bb_cfg['reg_email_activation']) {
+ if (config('tp.reg_email_activation')) {
$message = $lang['ACCOUNT_INACTIVE'];
- $email_subject = sprintf($lang['EMAILER_SUBJECT']['USER_WELCOME_INACTIVE'], $bb_cfg['sitename']);
+ $email_subject = sprintf($lang['EMAILER_SUBJECT']['USER_WELCOME_INACTIVE'], config('tp.sitename'));
$email_template = 'user_welcome_inactive';
} else {
$message = $lang['ACCOUNT_ADDED'];
- $email_subject = sprintf($lang['EMAILER_SUBJECT']['USER_WELCOME'], $bb_cfg['sitename']);
+ $email_subject = sprintf($lang['EMAILER_SUBJECT']['USER_WELCOME'], config('tp.sitename'));
$email_template = 'user_welcome';
}
/** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\Emailer();
- $emailer->set_from([$bb_cfg['board_email'] => $bb_cfg['sitename']]);
+ $emailer->set_from([config('tp.board_email') => config('tp.sitename')]);
$emailer->set_to([$email => $username]);
$emailer->set_subject($email_subject);
$emailer->set_template($email_template, $user_lang);
$emailer->assign_vars(array(
- 'SITENAME' => $bb_cfg['sitename'],
- 'WELCOME_MSG' => sprintf($lang['WELCOME_SUBJECT'], $bb_cfg['sitename']),
+ 'SITENAME' => config('tp.sitename'),
+ 'WELCOME_MSG' => sprintf($lang['WELCOME_SUBJECT'], config('tp.sitename')),
'USERNAME' => html_entity_decode($username),
'PASSWORD' => $new_pass,
'U_ACTIVATE' => make_url('profile.php?mode=activate&' . POST_USERS_URL . '=' . $new_user_id . '&act_key=' . $db_data['user_actkey'])
@@ -611,14 +611,14 @@ if ($submit && !$errors) {
/** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\Emailer();
- $emailer->set_from([$bb_cfg['board_email'] => $bb_cfg['sitename']]);
+ $emailer->set_from([config('tp.board_email') => config('tp.sitename')]);
$emailer->set_to([$email => $username]);
$emailer->set_subject($subject);
$emailer->set_subject($lang['EMAILER_SUBJECT']['USER_ACTIVATE']);
$emailer->set_template('user_activate', $pr_data['user_lang']);
$emailer->assign_vars(array(
- 'SITENAME' => $bb_cfg['sitename'],
+ 'SITENAME' => config('tp.sitename'),
'USERNAME' => html_entity_decode($username),
'U_ACTIVATE' => make_url("profile.php?mode=activate&u={$pr_data['user_id']}&act_key=$user_actkey"),
));
@@ -674,12 +674,12 @@ $template->assign_vars(array(
'TIMEZONE_SELECT' => tz_select($pr_data['user_timezone'], 'user_timezone'),
'USER_TIMEZONE' => $pr_data['user_timezone'],
- 'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], $bb_cfg['avatars']['max_width'], $bb_cfg['avatars']['max_height'], (round($bb_cfg['avatars']['max_size'] / 1024))),
+ 'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], config('tp.avatars.max_width'), config('tp.avatars.max_height'), (round(config('tp.avatars.max_size') / 1024))),
'AVATAR_DISALLOWED' => bf($pr_data['user_opt'], 'user_opt', 'dis_avatar'),
- 'AVATAR_DIS_EXPLAIN' => sprintf($lang['AVATAR_DISABLE'], $bb_cfg['terms_and_conditions_url']),
+ 'AVATAR_DIS_EXPLAIN' => sprintf($lang['AVATAR_DISABLE'], config('tp.terms_and_conditions_url')),
'AVATAR_IMG' => get_avatar($pr_data['user_id'], $pr_data['avatar_ext_id'], !bf($pr_data['user_opt'], 'user_opt', 'dis_avatar')),
- 'SIGNATURE_EXPLAIN' => sprintf($lang['SIGNATURE_EXPLAIN'], $bb_cfg['max_sig_chars']),
+ 'SIGNATURE_EXPLAIN' => sprintf($lang['SIGNATURE_EXPLAIN'], config('tp.max_sig_chars')),
'SIG_DISALLOWED' => bf($pr_data['user_opt'], 'user_opt', 'dis_sig'),
'PR_USER_ID' => $pr_data['user_id'],
diff --git a/library/includes/ucp/sendpasswd.php b/library/includes/ucp/sendpasswd.php
index 90442df64..645a243fa 100644
--- a/library/includes/ucp/sendpasswd.php
+++ b/library/includes/ucp/sendpasswd.php
@@ -17,7 +17,7 @@ if (!config('email.enabled')) {
bb_die($lang['EMAILER_DISABLED']);
}
-$need_captcha = ($_GET['mode'] == 'sendpassword' && !IS_ADMIN && !$bb_cfg['captcha']['disabled']);
+$need_captcha = ($_GET['mode'] == 'sendpassword' && !IS_ADMIN && !config('tp.captcha.disabled'));
if (isset($_POST['submit'])) {
if ($need_captcha && !bb_captcha('check')) {
@@ -50,13 +50,13 @@ if (isset($_POST['submit'])) {
/** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\Emailer();
- $emailer->set_from([$bb_cfg['board_email'] => $bb_cfg['sitename']]);
+ $emailer->set_from([config('tp.board_email') => config('tp.sitename')]);
$emailer->set_to([$row['user_email'] => $username]);
$emailer->set_subject($lang['EMAILER_SUBJECT']['USER_ACTIVATE_PASSWD']);
$emailer->set_template('user_activate_passwd', $row['user_lang']);
$emailer->assign_vars(array(
- 'SITENAME' => $bb_cfg['sitename'],
+ 'SITENAME' => config('tp.sitename'),
'USERNAME' => $username,
'PASSWORD' => $user_password,
'U_ACTIVATE' => make_url('profile.php?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
diff --git a/library/includes/ucp/topic_watch.php b/library/includes/ucp/topic_watch.php
index edbdd6436..62762c5b8 100644
--- a/library/includes/ucp/topic_watch.php
+++ b/library/includes/ucp/topic_watch.php
@@ -7,7 +7,7 @@
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
*/
-if (empty($bb_cfg['topic_notify_enabled'])) {
+if (empty(config('tp.topic_notify_enabled'))) {
bb_die($lang['DISABLED']);
}
@@ -17,7 +17,7 @@ $tracking_topics = get_tracks('topic');
$user_id = $userdata['user_id'];
$start = isset($_GET['start']) ? abs((int)$_GET['start']) : 0;
-$per_page = $bb_cfg['topics_per_page'];
+$per_page = config('tp.topics_per_page');
if (isset($_POST['topic_id_list'])) {
$topic_ids = implode(",", $_POST['topic_id_list']);
@@ -76,7 +76,7 @@ if ($watch_count > 0) {
'LAST_POST_ID' => $watch[$i]['topic_last_post_id'],
'IS_UNREAD' => $is_unread,
'TOPIC_ICON' => get_topic_icon($watch[$i], $is_unread),
- 'PAGINATION' => ($watch[$i]['topic_status'] == TOPIC_MOVED) ? '' : build_topic_pagination(TOPIC_URL . $watch[$i]['topic_id'], $watch[$i]['topic_replies'], $bb_cfg['posts_per_page']),
+ 'PAGINATION' => ($watch[$i]['topic_status'] == TOPIC_MOVED) ? '' : build_topic_pagination(TOPIC_URL . $watch[$i]['topic_id'], $watch[$i]['topic_replies'], config('tp.posts_per_page')),
));
}
diff --git a/library/includes/ucp/viewprofile.php b/library/includes/ucp/viewprofile.php
index 388af17d4..4718c068f 100644
--- a/library/includes/ucp/viewprofile.php
+++ b/library/includes/ucp/viewprofile.php
@@ -49,7 +49,7 @@ if (IS_ADMIN) {
}
if (bf($profiledata['user_opt'], 'user_opt', 'user_viewemail') || $profiledata['user_id'] == $userdata['user_id'] || IS_AM) {
- $email_uri = ($bb_cfg['board_email_form']) ? 'profile.php?mode=email&' . POST_USERS_URL . '=' . $profiledata['user_id'] : 'mailto:' . $profiledata['user_email'];
+ $email_uri = config('tp.board_email_form') ? 'profile.php?mode=email&' . POST_USERS_URL . '=' . $profiledata['user_id'] : 'mailto:' . $profiledata['user_email'];
$email = '' . $profiledata['user_email'] . ' ';
} else {
$email = '';
@@ -61,7 +61,7 @@ if (bf($profiledata['user_opt'], 'user_opt', 'user_viewemail') || $profiledata['
$profile_user_id = ($profiledata['user_id'] == $userdata['user_id']);
-$signature = ($bb_cfg['allow_sig'] && $profiledata['user_sig']) ? $profiledata['user_sig'] : '';
+$signature = (config('tp.allow_sig') && $profiledata['user_sig']) ? $profiledata['user_sig'] : '';
if (bf($profiledata['user_opt'], 'user_opt', 'dis_sig')) {
if ($profile_user_id) {
@@ -97,9 +97,9 @@ $template->assign_vars(array(
'SKYPE' => $profiledata['user_skype'],
'TWITTER' => $profiledata['user_twitter'],
'USER_POINTS' => $profiledata['user_points'],
- 'GENDER' => ($bb_cfg['gender']) ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '',
- 'BIRTHDAY' => ($bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00') ? $profiledata['user_birthday'] : '',
- 'AGE' => ($bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00') ? birthday_age($profiledata['user_birthday']) : '',
+ 'GENDER' => config('tp.gender') ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '',
+ 'BIRTHDAY' => (config('tp.birthday_enabled') && $profiledata['user_birthday'] != '0000-00-00') ? $profiledata['user_birthday'] : '',
+ 'AGE' => (config('tp.birthday_enabled') && $profiledata['user_birthday'] != '0000-00-00') ? birthday_age($profiledata['user_birthday']) : '',
'L_VIEWING_PROFILE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),
'L_MY_PROFILE' => sprintf($lang['VIEWING_MY_PROFILE'], 'profile.php?mode=editprofile'),
diff --git a/library/language/en/html/advert.html b/library/language/en/html/advert.html
index 6a85d2fe2..64c85175d 100644
--- a/library/language/en/html/advert.html
+++ b/library/language/en/html/advert.html
@@ -1,4 +1,4 @@
Advertising on our site
-
For advertising please contact: = $bb_cfg['adv_email']; ?>
+
For advertising please contact: = config('tp.adv_email'); ?>
diff --git a/library/language/en/html/copyright_holders.html b/library/language/en/html/copyright_holders.html
index 4a37337dc..430812d9c 100644
--- a/library/language/en/html/copyright_holders.html
+++ b/library/language/en/html/copyright_holders.html
@@ -22,11 +22,11 @@ which indicated to us the following information:
After that in 48 hours, we will remove interesting you links from the site.
-Our email: = $bb_cfg['abuse_email']; ?>
+Our email: = config('tp.abuse_email'); ?>
WARNING!
-a) We reserve the right to publish on the site of any information sent to us by mail = $bb_cfg['abuse_email']; ?>
+a) We reserve the right to publish on the site of any information sent to us by mail = config('tp.abuse_email'); ?>
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.
diff --git a/library/language/en/main.php b/library/language/en/main.php
index bf33a9a7c..8dc92960a 100644
--- a/library/language/en/main.php
+++ b/library/language/en/main.php
@@ -2276,7 +2276,7 @@ $lang['TRACKER_CFG_TITLE'] = 'Tracker';
$lang['FORUM_CFG_TITLE'] = 'Forum settings';
$lang['TRACKER_SETTINGS'] = 'Tracker settings';
-$lang['CHANGES_DISABLED'] = 'Changes disabled (see $bb_cfg[\'tracker\'] in config.php)';
+$lang['CHANGES_DISABLED'] = 'Changes disabled (see config/tracker.php )';
$lang['OFF_TRACKER'] = 'Disable tracker';
$lang['OFF_REASON'] = 'Disable reason';
diff --git a/library/language/source/html/advert.html b/library/language/source/html/advert.html
index 6a85d2fe2..64c85175d 100644
--- a/library/language/source/html/advert.html
+++ b/library/language/source/html/advert.html
@@ -1,4 +1,4 @@
Advertising on our site
-
For advertising please contact: = $bb_cfg['adv_email']; ?>
+
For advertising please contact: = config('tp.adv_email'); ?>
diff --git a/library/language/source/html/copyright_holders.html b/library/language/source/html/copyright_holders.html
index 4a37337dc..430812d9c 100644
--- a/library/language/source/html/copyright_holders.html
+++ b/library/language/source/html/copyright_holders.html
@@ -22,11 +22,11 @@ which indicated to us the following information:
After that in 48 hours, we will remove interesting you links from the site.
-Our email: = $bb_cfg['abuse_email']; ?>
+Our email: = config('tp.abuse_email'); ?>
WARNING!
-a) We reserve the right to publish on the site of any information sent to us by mail = $bb_cfg['abuse_email']; ?>
+a) We reserve the right to publish on the site of any information sent to us by mail = config('tp.abuse_email'); ?>
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.
diff --git a/library/language/source/main.php b/library/language/source/main.php
index df76e2f76..a75d7400b 100644
--- a/library/language/source/main.php
+++ b/library/language/source/main.php
@@ -2260,7 +2260,7 @@ $lang['TRACKER_CFG_TITLE'] = 'Tracker';
$lang['FORUM_CFG_TITLE'] = 'Forum settings';
$lang['TRACKER_SETTINGS'] = 'Tracker settings';
-$lang['CHANGES_DISABLED'] = 'Changes disabled (see $bb_cfg[\'tracker\'] in config.php)';
+$lang['CHANGES_DISABLED'] = 'Changes disabled (see config/tracker.php )';
$lang['OFF_TRACKER'] = 'Disable tracker';
$lang['OFF_REASON'] = 'Disable reason';
diff --git a/login.php b/login.php
index 7093071f2..a7fbe24df 100644
--- a/login.php
+++ b/login.php
@@ -63,7 +63,7 @@ $login_password = $_POST['login_password'] ?? '';
$need_captcha = false;
if (!$mod_admin_login) {
$need_captcha = OLD_CACHE('bb_login_err')->get('l_err_' . USER_IP);
- if ($need_captcha < $bb_cfg['invalid_logins']) {
+ if ($need_captcha < config('tp.invalid_logins')) {
$need_captcha = false;
}
}
@@ -80,13 +80,13 @@ if (isset($_POST['login'])) {
}
// Captcha
- if ($need_captcha && !bb_captcha('check') && !$bb_cfg['captcha']['disabled']) {
+ if ($need_captcha && !bb_captcha('check') && !config('tp.captcha.disabled')) {
$login_errors[] = $lang['CAPTCHA_WRONG'];
}
if (!$login_errors) {
if ($user->login($_POST, $mod_admin_login)) {
- $redirect_url = (defined('FIRST_LOGON')) ? $bb_cfg['first_logon_redirect_url'] : $redirect_url;
+ $redirect_url = defined('FIRST_LOGON') ? config('tp.first_logon_redirect_url') : $redirect_url;
// Обнуление при введении правильно комбинации логин/пароль
OLD_CACHE('bb_login_err')->set('l_err_' . USER_IP, 0, 3600);
@@ -100,7 +100,7 @@ if (isset($_POST['login'])) {
if (!$mod_admin_login) {
$login_err = OLD_CACHE('bb_login_err')->get('l_err_' . USER_IP);
- if ($login_err > $bb_cfg['invalid_logins']) {
+ if ($login_err > config('tp.invalid_logins')) {
$need_captcha = true;
}
OLD_CACHE('bb_login_err')->set('l_err_' . USER_IP, ($login_err + 1), 3600);
@@ -118,7 +118,7 @@ if (IS_GUEST || $mod_admin_login) {
'ERROR_MESSAGE' => implode(' ', $login_errors),
'ADMIN_LOGIN' => $mod_admin_login,
'REDIRECT_URL' => htmlCHR($redirect_url),
- 'CAPTCHA_HTML' => ($need_captcha && !$bb_cfg['captcha']['disabled']) ? bb_captcha('get') : '',
+ 'CAPTCHA_HTML' => ($need_captcha && !config('tp.captcha.disabled')) ? bb_captcha('get') : '',
'PAGE_TITLE' => $lang['LOGIN'],
'S_LOGIN_ACTION' => LOGIN_URL,
));
diff --git a/memberlist.php b/memberlist.php
index 414499bc2..9d2dca343 100644
--- a/memberlist.php
+++ b/memberlist.php
@@ -75,28 +75,28 @@ $template->assign_vars(array(
switch ($mode) {
case 'joined':
- $order_by = "user_id $sort_order LIMIT $start, " . $bb_cfg['topics_per_page'];
+ $order_by = "user_id $sort_order LIMIT $start, " . config('tp.topics_per_page');
break;
case 'username':
- $order_by = "username $sort_order LIMIT $start, " . $bb_cfg['topics_per_page'];
+ $order_by = "username $sort_order LIMIT $start, " . config('tp.topics_per_page');
break;
case 'location':
- $order_by = "user_from $sort_order LIMIT $start, " . $bb_cfg['topics_per_page'];
+ $order_by = "user_from $sort_order LIMIT $start, " . config('tp.topics_per_page');
break;
case 'posts':
- $order_by = "user_posts $sort_order LIMIT $start, " . $bb_cfg['topics_per_page'];
+ $order_by = "user_posts $sort_order LIMIT $start, " . config('tp.topics_per_page');
break;
case 'email':
- $order_by = "user_email $sort_order LIMIT $start, " . $bb_cfg['topics_per_page'];
+ $order_by = "user_email $sort_order LIMIT $start, " . config('tp.topics_per_page');
break;
case 'website':
- $order_by = "user_website $sort_order LIMIT $start, " . $bb_cfg['topics_per_page'];
+ $order_by = "user_website $sort_order LIMIT $start, " . config('tp.topics_per_page');
break;
case 'topten':
$order_by = "user_posts $sort_order LIMIT 10";
break;
default:
- $order_by = "user_regdate $sort_order LIMIT $start, " . $bb_cfg['topics_per_page'];
+ $order_by = "user_regdate $sort_order LIMIT $start, " . config('tp.topics_per_page');
$mode = 'joined';
break;
}
@@ -157,12 +157,12 @@ if ($result = OLD_DB()->fetch_rowset($sql)) {
foreach ($result as $i => $row) {
$user_id = $row['user_id'];
$from = $row['user_from'];
- $joined = bb_date($row['user_regdate'], $bb_cfg['date_format']);
+ $joined = bb_date($row['user_regdate'], config('tp.date_format'));
$posts = $row['user_posts'];
$pm = '' . $lang['SEND_PM_TXTB'] . ' ';
if (bf($row['user_opt'], 'user_opt', 'user_viewemail') || IS_ADMIN) {
- $email_uri = $bb_cfg['board_email_form'] ? ("profile.php?mode=email&" . POST_USERS_URL . "=$user_id") : 'mailto:' . $row['user_email'];
+ $email_uri = config('tp.board_email_form') ? ('profile.php?mode=email&' . POST_USERS_URL . "=$user_id") : 'mailto:' . $row['user_email'];
$email = '' . $row['user_email'] . ' ';
} else {
$email = '';
@@ -199,7 +199,7 @@ $paginationurl = "memberlist.php?mode=$mode&order=$sort_order&letter=$by
if ($paginationusername) {
$paginationurl .= "&username=$paginationusername";
}
-if ($mode != 'topten' || $bb_cfg['topics_per_page'] < 10) {
+if ($mode != 'topten' || config('tp.topics_per_page') < 10) {
$sql = "SELECT COUNT(*) AS total FROM " . BB_USERS;
$sql .= ($letter_sql) ? " WHERE $letter_sql" : " WHERE user_id NOT IN(". EXCLUDED_USERS .")";
if (!$result = OLD_DB()->sql_query($sql)) {
@@ -207,7 +207,7 @@ if ($mode != 'topten' || $bb_cfg['topics_per_page'] < 10) {
}
if ($total = OLD_DB()->sql_fetchrow($result)) {
$total_members = $total['total'];
- generate_pagination($paginationurl, $total_members, $bb_cfg['topics_per_page'], $start);
+ generate_pagination($paginationurl, $total_members, config('tp.topics_per_page'), $start);
}
OLD_DB()->sql_freeresult($result);
}
diff --git a/modcp.php b/modcp.php
index 39119a67d..6e3d568ca 100644
--- a/modcp.php
+++ b/modcp.php
@@ -225,14 +225,14 @@ switch ($mode) {
$result = topic_delete($req_topics, $forum_id);
//Обновление кеша новостей на главной
- $news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
- if (isset($news_forums[$forum_id]) && $bb_cfg['show_latest_news'] && $result) {
+ $news_forums = array_flip(explode(',', config('tp.latest_news_forum_id')));
+ if (isset($news_forums[$forum_id]) && config('tp.show_latest_news') && $result) {
$datastore->enqueue('latest_news');
$datastore->update('latest_news');
}
- $net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
- if (isset($net_forums[$forum_id]) && $bb_cfg['show_network_news'] && $result) {
+ $net_forums = array_flip(explode(',', config('tp.network_news_forum_id')));
+ if (isset($net_forums[$forum_id]) && config('tp.show_network_news') && $result) {
$datastore->enqueue('network_news');
$datastore->update('network_news');
}
@@ -256,14 +256,14 @@ switch ($mode) {
$result = topic_move($req_topics, $new_forum_id, $forum_id, isset($_POST['move_leave_shadow']), isset($_POST['insert_bot_msg']));
//Обновление кеша новостей на главной
- $news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
- if ((isset($news_forums[$forum_id]) || isset($news_forums[$new_forum_id])) && $bb_cfg['show_latest_news'] && $result) {
+ $news_forums = array_flip(explode(',', config('tp.latest_news_forum_id')));
+ if ((isset($news_forums[$forum_id]) || isset($news_forums[$new_forum_id])) && config('tp.show_latest_news') && $result) {
$datastore->enqueue('latest_news');
$datastore->update('latest_news');
}
- $net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
- if ((isset($net_forums[$forum_id]) || isset($net_forums[$new_forum_id])) && $bb_cfg['show_network_news'] && $result) {
+ $net_forums = array_flip(explode(',', config('tp.network_news_forum_id')));
+ if ((isset($net_forums[$forum_id]) || isset($net_forums[$new_forum_id])) && config('tp.show_network_news') && $result) {
$datastore->enqueue('network_news');
$datastore->update('network_news');
}
diff --git a/poll.php b/poll.php
index b6fcb7c04..3248e56b3 100644
--- a/poll.php
+++ b/poll.php
@@ -43,8 +43,8 @@ if ($mode != 'poll_vote') {
// проверка на возможность вносить изменения
if ($mode == 'poll_delete') {
- if ($t_data['topic_time'] < TIMENOW - $bb_cfg['poll_max_days'] * 86400) {
- bb_die(sprintf($lang['NEW_POLL_DAYS'], $bb_cfg['poll_max_days']));
+ if ($t_data['topic_time'] < TIMENOW - config('tp.poll_max_days') * 86400) {
+ bb_die(sprintf($lang['NEW_POLL_DAYS'], config('tp.poll_max_days')));
}
if (!IS_ADMIN && ($t_data['topic_vote'] != POLL_FINISHED)) {
bb_die($lang['CANNOT_DELETE_POLL']);
diff --git a/posting.php b/posting.php
index 6edc543fe..437b37164 100644
--- a/posting.php
+++ b/posting.php
@@ -225,7 +225,7 @@ if (!$is_auth[$is_auth_type]) {
}
if ($mode == 'new_rel') {
- if ($tor_status = implode(',', $bb_cfg['tor_cannot_new'])) {
+ if ($tor_status = implode(',', config('tp.tor_cannot_new'))) {
$sql = OLD_DB()->fetch_rowset("SELECT t.topic_title, t.topic_id, tor.tor_status
FROM " . BB_BT_TORRENTS . " tor, " . BB_TOPICS . " t
WHERE poster_id = {$userdata['user_id']}
@@ -236,7 +236,7 @@ if ($mode == 'new_rel') {
$topics = '';
foreach ($sql as $row) {
- $topics .= $bb_cfg['tor_icons'][$row['tor_status']] . '' . $row['topic_title'] . '
';
+ $topics .= config('tp.tor_icons.' . $row['tor_status']) . '' . $row['topic_title'] . '
';
}
if ($topics) {
bb_die($topics . $lang['UNEXECUTED_RELEASE']);
@@ -273,7 +273,7 @@ if (!IS_GUEST && $mode != 'newtopic' && ($submit || $preview || $mode == 'quote'
AND pt.post_id = p.post_id
AND p.post_time > $topic_last_read
ORDER BY p.post_time
- LIMIT " . $bb_cfg['posts_per_page'];
+ LIMIT " . config('tp.posts_per_page');
if ($rowset = OLD_DB()->fetch_rowset($sql)) {
$topic_has_new_posts = true;
@@ -283,7 +283,7 @@ if (!IS_GUEST && $mode != 'newtopic' && ($submit || $preview || $mode == 'quote'
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
'POSTER' => profile_url($row),
'POSTER_NAME_JS' => addslashes($row['username']),
- 'POST_DATE' => bb_date($row['post_time'], $bb_cfg['post_date_format']),
+ 'POST_DATE' => bb_date($row['post_time'], config('tp.post_date_format')),
'MESSAGE' => get_parsed_post($row),
));
}
@@ -365,10 +365,10 @@ if (($delete || $mode == 'delete') && !$confirm) {
set_tracks(COOKIE_TOPIC, $tracking_topics, $topic_id);
}
- if (defined('TORRENT_ATTACH_ID') && $bb_cfg['bt_newtopic_auto_reg'] && !$error_msg) {
+ if (defined('TORRENT_ATTACH_ID') && config('tp.bt_newtopic_auto_reg') && !$error_msg) {
include INC_DIR . '/functions_torrent.php';
if (!OLD_DB()->fetch_row("SELECT attach_id FROM " . BB_BT_TORRENTS . " WHERE attach_id = " . TORRENT_ATTACH_ID)) {
- if ($bb_cfg['premod']) {
+ if (config('tp.premod')) {
// Получение списка id форумов начиная с parent
$forum_parent = $forum_id;
if ($post_info['forum_parent']) {
diff --git a/privmsg.php b/privmsg.php
index 8df644ad9..fc648c108 100644
--- a/privmsg.php
+++ b/privmsg.php
@@ -24,7 +24,7 @@ $page_cfg['load_tpl_vars'] = array(
//
// Is PM disabled?
//
-if ($bb_cfg['privmsg_disable']) {
+if (config('tp.privmsg_disable')) {
bb_die('PM_DISABLED');
}
@@ -32,14 +32,14 @@ if ($bb_cfg['privmsg_disable']) {
// Parameters
//
$submit = (bool)request_var('post', false);
-$submit_search = (isset($_POST['usersubmit'])) ? true : 0;
-$submit_msgdays = (isset($_POST['submit_msgdays'])) ? true : 0;
-$cancel = (isset($_POST['cancel'])) ? true : 0;
-$preview = (isset($_POST['preview'])) ? true : 0;
-$confirmed = (isset($_POST['confirm'])) ? true : 0;
-$delete = (isset($_POST['delete'])) ? true : 0;
-$delete_all = (isset($_POST['deleteall'])) ? true : 0;
-$save = (isset($_POST['save'])) ? true : 0;
+$submit_search = isset($_POST['usersubmit']) ? true : 0;
+$submit_msgdays = isset($_POST['submit_msgdays']) ? true : 0;
+$cancel = isset($_POST['cancel']) ? true : 0;
+$preview = isset($_POST['preview']) ? true : 0;
+$confirmed = isset($_POST['confirm']) ? true : 0;
+$delete = isset($_POST['delete']) ? true : 0;
+$delete_all = isset($_POST['deleteall']) ? true : 0;
+$save = isset($_POST['save']) ? true : 0;
$mode = isset($_REQUEST['mode']) ? (string)$_REQUEST['mode'] : '';
$refresh = $preview || $submit_search;
@@ -59,7 +59,7 @@ $user->session_start(array('req_login' => true));
$template->assign_vars(array(
'IN_PM' => true,
- 'QUICK_REPLY' => $bb_cfg['show_quick_reply'] && $folder == 'inbox' && $mode == 'read',
+ 'QUICK_REPLY' => config('tp.show_quick_reply') && $folder == 'inbox' && $mode == 'read',
));
//
@@ -200,7 +200,7 @@ if ($mode == 'read') {
}
if ($sent_info = OLD_DB()->sql_fetchrow($result)) {
- if ($bb_cfg['max_sentbox_privmsgs'] && $sent_info['sent_items'] >= $bb_cfg['max_sentbox_privmsgs']) {
+ if (config('tp.max_sentbox_privmsgs') && $sent_info['sent_items'] >= config('tp.max_sentbox_privmsgs')) {
$sql = "SELECT privmsgs_id FROM " . BB_PRIVMSGS . "
WHERE privmsgs_type = " . PRIVMSGS_SENT_MAIL . "
AND privmsgs_date = " . $sent_info['oldest_post_time'] . "
@@ -609,7 +609,7 @@ if ($mode == 'read') {
}
if ($saved_info = OLD_DB()->sql_fetchrow($result)) {
- if ($bb_cfg['max_savebox_privmsgs'] && $saved_info['savebox_items'] >= $bb_cfg['max_savebox_privmsgs']) {
+ if (config('tp.max_savebox_privmsgs') && $saved_info['savebox_items'] >= config('tp.max_savebox_privmsgs')) {
$sql = "SELECT privmsgs_id FROM " . BB_PRIVMSGS . "
WHERE ( ( privmsgs_to_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " )
@@ -754,7 +754,7 @@ if ($mode == 'read') {
$last_post_time = $db_row['last_post_time'];
$current_time = TIMENOW;
- if (($current_time - $last_post_time) < $bb_cfg['flood_interval']) {
+ if (($current_time - $last_post_time) < config('tp.flood_interval')) {
bb_die($lang['FLOOD_ERROR']);
}
}
@@ -832,7 +832,7 @@ if ($mode == 'read') {
}
if ($inbox_info = OLD_DB()->sql_fetchrow($result)) {
- if ($bb_cfg['max_inbox_privmsgs'] && $inbox_info['inbox_items'] >= $bb_cfg['max_inbox_privmsgs']) {
+ if (config('tp.max_inbox_privmsgs') && $inbox_info['inbox_items'] >= config('tp.max_inbox_privmsgs')) {
$sql = "SELECT privmsgs_id FROM " . BB_PRIVMSGS . "
WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
OR privmsgs_type = " . PRIVMSGS_READ_MAIL . "
@@ -900,11 +900,11 @@ if ($mode == 'read') {
cache_rm_user_sessions($to_userdata['user_id']);
- if (bf($to_userdata['user_opt'], 'user_opt', 'user_notify_pm') && $to_userdata['user_active'] && $bb_cfg['pm_notify_enabled']) {
+ if (bf($to_userdata['user_opt'], 'user_opt', 'user_notify_pm') && $to_userdata['user_active'] && config('tp.pm_notify_enabled')) {
/** @var TorrentPier\Legacy\Emailer() $emailer */
$emailer = new TorrentPier\Legacy\Emailer();
- $emailer->set_from([$bb_cfg['board_email'] => $bb_cfg['sitename']]);
+ $emailer->set_from([config('tp.board_email') => config('tp.sitename')]);
$emailer->set_to([$to_userdata['user_email'] => $to_userdata['username']]);
$emailer->set_subject($lang['EMAILER_SUBJECT']['PRIVMSG_NOTIFY']);
@@ -913,7 +913,7 @@ if ($mode == 'read') {
'USERNAME' => html_entity_decode($to_username),
'NAME_FROM' => $userdata['username'],
'MSG_SUBJECT' => html_entity_decode($privmsg_subject),
- 'SITENAME' => $bb_cfg['sitename'],
+ 'SITENAME' => config('tp.sitename'),
'U_INBOX' => make_url(PM_URL . "?folder=inbox&mode=read&p=$privmsg_sent_id"),
));
@@ -1262,7 +1262,7 @@ if ($mode == 'read') {
$msg_days = 0;
}
- $sql .= $limit_msg_time . " ORDER BY pm.privmsgs_date DESC LIMIT $start, " . $bb_cfg['topics_per_page'];
+ $sql .= $limit_msg_time . " ORDER BY pm.privmsgs_date DESC LIMIT $start, " . config('tp.topics_per_page');
$sql_all_tot = $sql_tot;
$sql_tot .= $limit_msg_time_total;
@@ -1318,11 +1318,11 @@ if ($mode == 'read') {
// Output data for inbox status
//
$box_limit_img_length = $box_limit_percent = $l_box_size_status = '';
- $max_pm = ($folder != 'outbox') ? $bb_cfg["max_{$folder}_privmsgs"] : null;
+ $max_pm = ($folder != 'outbox') ? config('tp.max_' . $folder . '_privmsgs') : null;
if ($max_pm) {
$box_limit_percent = min(round(($pm_all_total / $max_pm) * 100), 100);
- $box_limit_img_length = min(round(($pm_all_total / $max_pm) * $bb_cfg['privmsg_graphic_length']), $bb_cfg['privmsg_graphic_length']);
+ $box_limit_img_length = min(round(($pm_all_total / $max_pm) * config('tp.privmsg_graphic_length')), config('tp.privmsg_graphic_length'));
$box_limit_remain = max(($max_pm - $pm_all_total), 0);
$template->assign_var('PM_BOX_SIZE_INFO');
@@ -1427,7 +1427,7 @@ if ($mode == 'read') {
));
} while ($row = OLD_DB()->sql_fetchrow($result));
- generate_pagination(PM_URL . "?folder=$folder", $pm_total, $bb_cfg['topics_per_page'], $start);
+ generate_pagination(PM_URL . "?folder=$folder", $pm_total, config('tp.topics_per_page'), $start);
} else {
$template->assign_block_vars("switch_no_messages", array());
}
diff --git a/search.php b/search.php
index a726ade2f..af02db455 100644
--- a/search.php
+++ b/search.php
@@ -19,7 +19,7 @@ $page_cfg['load_tpl_vars'] = array(
'topic_icons',
);
-$user->session_start(array('req_login' => $bb_cfg['disable_search_for_guest']));
+$user->session_start(array('req_login' => config('tp.disable_search_for_guest')));
set_die_append_msg();
@@ -294,7 +294,7 @@ if (empty($_GET) && empty($_POST)) {
'MY_TOPICS_ID' => 'my_topics',
'MY_TOPICS_CHBOX' => build_checkbox($my_topics_key, $lang['SEARCH_MY_TOPICS'], $my_topics_val, true, null, 'my_topics'),
- 'TITLE_ONLY_CHBOX' => build_checkbox($title_only_key, $lang['SEARCH_TITLES_ONLY'], true, $bb_cfg['disable_ft_search_in_posts']),
+ 'TITLE_ONLY_CHBOX' => build_checkbox($title_only_key, $lang['SEARCH_TITLES_ONLY'], true, config('tp.disable_ft_search_in_posts')),
'ALL_WORDS_CHBOX' => build_checkbox($all_words_key, $lang['SEARCH_ALL_WORDS'], true),
'DL_CANCEL_CHBOX' => build_checkbox($dl_cancel_key, $lang['SEARCH_DL_CANCEL'], $dl_cancel_val, IS_GUEST, 'dlCancel'),
'DL_COMPL_CHBOX' => build_checkbox($dl_compl_key, $lang['SEARCH_DL_COMPLETE'], $dl_compl_val, IS_GUEST, 'dlComplete'),
@@ -426,7 +426,7 @@ $prev_days = ($time_val != $search_all);
$new_topics = (!IS_GUEST && ($new_topics_val || isset($_GET['newposts'])));
$my_topics = ($poster_id_val && $my_topics_val);
$my_posts = ($poster_id_val && !$my_topics_val);
-$title_match = ($text_match_sql && ($title_only_val || $bb_cfg['disable_ft_search_in_posts']));
+$title_match = ($text_match_sql && ($title_only_val || config('tp.disable_ft_search_in_posts')));
// "Display as" mode (posts or topics)
$post_mode = (!$dl_search && ($display_as_val == $as_posts || isset($_GET['search_author'])));
@@ -438,7 +438,7 @@ $SQL = OLD_DB()->get_empty_sql_array();
if ($post_mode) {
$order = $order_opt[$order_val]['sql'];
$sort = $sort_opt[$sort_val]['sql'];
- $per_page = $bb_cfg['posts_per_page'];
+ $per_page = config('tp.posts_per_page');
$display_as_val = $as_posts;
// Run initial search for post_ids
@@ -601,7 +601,7 @@ if ($post_mode) {
'POSTER_ID' => $post['poster_id'],
'POSTER' => profile_url($post),
'POST_ID' => $post['post_id'],
- 'POST_DATE' => bb_date($post['post_time'], $bb_cfg['post_date_format']),
+ 'POST_DATE' => bb_date($post['post_time'], config('tp.post_date_format')),
'IS_UNREAD' => is_unread($post['post_time'], $topic_id, $forum_id),
'MESSAGE' => $message,
'POSTED_AFTER' => '',
@@ -620,7 +620,7 @@ if ($post_mode) {
else {
$order = $order_opt[$order_val]['sql'];
$sort = $sort_opt[$sort_val]['sql'];
- $per_page = $bb_cfg['topics_per_page'];
+ $per_page = config('tp.topics_per_page');
$display_as_val = $as_topics;
// Run initial search for topic_ids
@@ -741,7 +741,7 @@ else {
// Build SQL for displaying topics
$SQL = OLD_DB()->get_empty_sql_array();
- $join_dl = ($bb_cfg['show_dl_status_in_search'] && !IS_GUEST);
+ $join_dl = (config('tp.show_dl_status_in_search') && !IS_GUEST);
$SQL['SELECT'][] = "
t.*, t.topic_poster AS first_user_id, u1.user_rank AS first_user_rank,
@@ -798,7 +798,7 @@ else {
'TOPIC_TITLE' => wbr($topic['topic_title']),
'IS_UNREAD' => $is_unread,
'TOPIC_ICON' => get_topic_icon($topic, $is_unread),
- 'PAGINATION' => ($moved) ? '' : build_topic_pagination(TOPIC_URL . $topic_id, $topic['topic_replies'], $bb_cfg['posts_per_page']),
+ 'PAGINATION' => $moved ? '' : build_topic_pagination(TOPIC_URL . $topic_id, $topic['topic_replies'], config('tp.posts_per_page')),
'REPLIES' => $topic['topic_replies'],
'ATTACH' => $topic['topic_attachment'],
'STATUS' => $topic['topic_status'],
@@ -895,16 +895,13 @@ function fetch_search_ids($sql, $search_type = SEARCH_TYPE_POST)
function prevent_huge_searches($SQL)
{
- global $bb_cfg;
-
- if ($bb_cfg['limit_max_search_results']) {
+ if (config('tp.limit_max_search_results')) {
$SQL['select_options'][] = 'SQL_CALC_FOUND_ROWS';
$SQL['ORDER BY'] = array();
$SQL['LIMIT'] = array('0');
if (OLD_DB()->query($SQL) and $row = OLD_DB()->fetch_row("SELECT FOUND_ROWS() AS rows_count")) {
- if ($row['rows_count'] > $bb_cfg['limit_max_search_results']) {
- # bb_log(str_compact(OLD_DB()->build_sql($SQL)) ." [{$row['rows_count']} rows]". LOG_LF, 'sql_huge_search');
+ if ($row['rows_count'] > config('tp.limit_max_search_results')) {
bb_die('Too_many_search_results');
}
}
diff --git a/styles/templates/admin/admin_bt_tracker_cfg.tpl b/styles/templates/admin/admin_bt_tracker_cfg.tpl
index e64cc0758..7c2136d86 100644
--- a/styles/templates/admin/admin_bt_tracker_cfg.tpl
+++ b/styles/templates/admin/admin_bt_tracker_cfg.tpl
@@ -44,12 +44,12 @@
{L_YES}
- {L_AUTH_KEY_NAME} $bb_cfg['passkey_key'] {L_AUTH_KEY_NAME_EXPL}
+ {L_AUTH_KEY_NAME} $cfg['passkey_key'] {L_AUTH_KEY_NAME_EXPL}
{PASSKEY_KEY}
{L_ALLOW_GUEST_DL} {L_ALLOW_GUEST_DL_EXPL}
- {L_NO}{L_YES}
+ {L_NO}{L_YES}
{L_LIMIT_ACTIVE_TOR_HEAD}
@@ -91,7 +91,7 @@
{L_ANNOUNCE_INTERVAL_HEAD}
- {L_ANNOUNCE_INTERVAL} $bb_cfg['announce_interval'] {L_ANNOUNCE_INTERVAL_EXPL}
+ {L_ANNOUNCE_INTERVAL} $cfg['announce_interval'] {L_ANNOUNCE_INTERVAL_EXPL}
{ANNOUNCE_INTERVAL} seconds
@@ -114,7 +114,7 @@
- {L_IGNORE_GIVEN_IP} $bb_cfg['ignore_reported_ip'] {L_IGNOR_GIVEN_IP_EXPL}
+ {L_IGNORE_GIVEN_IP} $cfg['ignore_reported_ip'] {L_IGNOR_GIVEN_IP_EXPL}
{L_YES}{L_NO}
diff --git a/styles/templates/admin/index.tpl b/styles/templates/admin/index.tpl
index 94db04210..8cb33d813 100644
--- a/styles/templates/admin/index.tpl
+++ b/styles/templates/admin/index.tpl
@@ -117,7 +117,7 @@
{L_UPDATE}:
{L_USER_LEVELS}
- ,
+ ,
{L_INDEXER}
@@ -151,11 +151,11 @@
{L_TP_VERSION}:
- {$bb_cfg['tp_release_codename']} ({$bb_cfg['tp_version']})
+ {CFG_TP_CN} ({CFG_TP_VER})
{L_TP_RELEASE_DATE}:
- {$bb_cfg['tp_release_date']}
+ {CFG_TP_RD}
diff --git a/styles/templates/default/group_edit.tpl b/styles/templates/default/group_edit.tpl
index d6b687eb8..5e9bf6040 100644
--- a/styles/templates/default/group_edit.tpl
+++ b/styles/templates/default/group_edit.tpl
@@ -76,11 +76,11 @@ function manage_group(mode, value) {
{AVATAR_EXPLAIN}
-
+
diff --git a/styles/templates/default/index.tpl b/styles/templates/default/index.tpl
index f1d7e1246..d36476e1c 100644
--- a/styles/templates/default/index.tpl
+++ b/styles/templates/default/index.tpl
@@ -174,14 +174,14 @@
{TOTAL_GENDER}
{NEWEST_USER}
-
+
{TORRENTS_STAT}
{PEERS_STAT}
{SPEED_STAT}
-
+
-
+
+
-
+