diff --git a/UPGRADE_GUIDE.md b/UPGRADE_GUIDE.md
index ed045381f..aae12f127 100644
--- a/UPGRADE_GUIDE.md
+++ b/UPGRADE_GUIDE.md
@@ -595,8 +595,8 @@ $announceUrl = $bb_cfg['bt_announce_url'];
$dbHost = $bb_cfg['database']['host'];
// ✅ New way (recommended)
-$announceUrl = config()->get('bt_announce_url');
-$dbHost = config()->get('database.host');
+$announceUrl = tp_config()->get('bt_announce_url');
+$dbHost = tp_config()->get('database.host');
```
### Key Configuration Changes
@@ -604,57 +604,57 @@ $dbHost = config()->get('database.host');
#### Basic Usage
```php
// Get configuration values using dot notation
-$siteName = config()->get('sitename');
-$dbHost = config()->get('database.host');
-$cacheTimeout = config()->get('cache.timeout');
+$siteName = tp_config()->get('sitename');
+$dbHost = tp_config()->get('database.host');
+$cacheTimeout = tp_config()->get('cache.timeout');
// Get with default value if key doesn't exist
-$maxUsers = config()->get('max_users_online', 100);
-$debugMode = config()->get('debug.enabled', false);
+$maxUsers = tp_config()->get('max_users_online', 100);
+$debugMode = tp_config()->get('debug.enabled', false);
```
#### Setting Values
```php
// Set configuration values
-config()->set('sitename', 'My Awesome Tracker');
-config()->set('database.port', 3306);
-config()->set('cache.enabled', true);
+tp_config()->set('sitename', 'My Awesome Tracker');
+tp_config()->set('database.port', 3306);
+tp_config()->set('cache.enabled', true);
```
#### Working with Sections
```php
// Get entire configuration section
-$dbConfig = config()->getSection('database');
-$trackerConfig = config()->getSection('tracker');
+$dbConfig = tp_config()->getSection('database');
+$trackerConfig = tp_config()->getSection('tracker');
// Check if configuration exists
-if (config()->has('bt_announce_url')) {
- $announceUrl = config()->get('bt_announce_url');
+if (tp_config()->has('bt_announce_url')) {
+ $announceUrl = tp_config()->get('bt_announce_url');
}
```
### Common Configuration Mappings
-| Old Syntax | New Syntax |
-|------------|------------|
-| `$bb_cfg['sitename']` | `config()->get('sitename')` |
-| `$bb_cfg['database']['host']` | `config()->get('database.host')` |
-| `$bb_cfg['tracker']['enabled']` | `config()->get('tracker.enabled')` |
-| `$bb_cfg['cache']['timeout']` | `config()->get('cache.timeout')` |
-| `$bb_cfg['torr_server']['url']` | `config()->get('torr_server.url')` |
+| Old Syntax | New Syntax |
+|------------|---------------------------------------|
+| `$bb_cfg['sitename']` | `tp_config()->get('sitename')` |
+| `$bb_cfg['database']['host']` | `tp_config()->get('database.host')` |
+| `$bb_cfg['tracker']['enabled']` | `tp_config()->get('tracker.enabled')` |
+| `$bb_cfg['cache']['timeout']` | `tp_config()->get('cache.timeout')` |
+| `$bb_cfg['torr_server']['url']` | `tp_config()->get('torr_server.url')` |
### Magic Methods Support
```php
// Magic getter
-$siteName = config()->sitename;
-$dbHost = config()->{'database.host'};
+$siteName = tp_config()->sitename;
+$dbHost = tp_config()->{'database.host'};
// Magic setter
-config()->sitename = 'New Site Name';
-config()->{'database.port'} = 3306;
+tp_config()->sitename = 'New Site Name';
+tp_config()->{'database.port'} = 3306;
// Magic isset
-if (isset(config()->bt_announce_url)) {
+if (isset(tp_config()->bt_announce_url)) {
// Configuration exists
}
```
@@ -804,7 +804,7 @@ _e('WELCOME_MESSAGE'); // Same as: echo __('WELCOME_MESSAGE')
_e('USER_ONLINE', 'Online'); // With default value
// ✅ Common usage patterns
-$title = __('PAGE_TITLE', config()->get('sitename'));
+$title = __('PAGE_TITLE', tp_config()->get('sitename'));
$error = __('ERROR.INVALID_INPUT', 'Invalid input');
```
@@ -1113,8 +1113,8 @@ $environment = [
- **New Implementation**: Uses Nette Database v3.2 with improved API requiring code updates
### Deprecated Functions
-- `get_config()` → Use `config()->get()`
-- `set_config()` → Use `config()->set()`
+- `get_config()` → Use `tp_config()->get()`
+- `set_config()` → Use `tp_config()->set()`
- Direct `$bb_cfg` access → Use `config()` methods
### Deprecated Patterns
@@ -1139,11 +1139,11 @@ $environment = [
### Configuration Management
```php
// ✅ Always provide defaults
-$timeout = config()->get('api.timeout', 30);
+$timeout = tp_config()->get('api.timeout', 30);
// ✅ Use type hints
function getMaxUploadSize(): int {
- return (int) config()->get('upload.max_size', 10485760);
+ return (int) tp_config()->get('upload.max_size', 10485760);
}
// ✅ Cache frequently used values
@@ -1151,7 +1151,7 @@ class TrackerService {
private string $announceUrl;
public function __construct() {
- $this->announceUrl = config()->get('bt_announce_url');
+ $this->announceUrl = tp_config()->get('bt_announce_url');
}
}
```
@@ -1221,7 +1221,7 @@ function setupCustomCensoring(): void {
```php
// ✅ Graceful error handling
try {
- $dbConfig = config()->getSection('database');
+ $dbConfig = tp_config()->getSection('database');
// Database operations
} catch (Exception $e) {
error_log("Database configuration error: " . $e->getMessage());
@@ -1232,7 +1232,7 @@ try {
### Performance Optimization
```php
// ✅ Minimize configuration calls in loops
-$cacheEnabled = config()->get('cache.enabled', false);
+$cacheEnabled = tp_config()->get('cache.enabled', false);
for ($i = 0; $i < 1000; $i++) {
if ($cacheEnabled) {
// Use cached value
@@ -1244,12 +1244,12 @@ for ($i = 0; $i < 1000; $i++) {
```php
// ✅ Validate configuration values
$maxFileSize = min(
- config()->get('upload.max_size', 1048576),
+ tp_config()->get('upload.max_size', 1048576),
1048576 * 100 // Hard limit: 100MB
);
// ✅ Sanitize user-configurable values
-$siteName = htmlspecialchars(config()->get('sitename', 'TorrentPier'));
+$siteName = htmlspecialchars(tp_config()->get('sitename', 'TorrentPier'));
```
### Testing and Quality Assurance
diff --git a/admin/admin_attach_cp.php b/admin/admin_attach_cp.php
index a7f1ab498..bca922a77 100644
--- a/admin/admin_attach_cp.php
+++ b/admin/admin_attach_cp.php
@@ -69,44 +69,44 @@ $order_by = '';
if ($view === 'username') {
switch ($mode) {
case 'username':
- $order_by = 'ORDER BY u.username ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
+ $order_by = 'ORDER BY u.username ' . $sort_order . ' LIMIT ' . $start . ', ' . tp_config()->get('topics_per_page');
break;
case 'attachments':
- $order_by = 'ORDER BY total_attachments ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
+ $order_by = 'ORDER BY total_attachments ' . $sort_order . ' LIMIT ' . $start . ', ' . tp_config()->get('topics_per_page');
break;
case 'filesize':
- $order_by = 'ORDER BY total_size ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
+ $order_by = 'ORDER BY total_size ' . $sort_order . ' LIMIT ' . $start . ', ' . tp_config()->get('topics_per_page');
break;
default:
$mode = 'attachments';
$sort_order = 'DESC';
- $order_by = 'ORDER BY total_attachments ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
+ $order_by = 'ORDER BY total_attachments ' . $sort_order . ' LIMIT ' . $start . ', ' . tp_config()->get('topics_per_page');
break;
}
} elseif ($view === 'attachments') {
switch ($mode) {
case 'real_filename':
- $order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
+ $order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . tp_config()->get('topics_per_page');
break;
case 'comment':
- $order_by = 'ORDER BY a.comment ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
+ $order_by = 'ORDER BY a.comment ' . $sort_order . ' LIMIT ' . $start . ', ' . tp_config()->get('topics_per_page');
break;
case 'extension':
- $order_by = 'ORDER BY a.extension ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
+ $order_by = 'ORDER BY a.extension ' . $sort_order . ' LIMIT ' . $start . ', ' . tp_config()->get('topics_per_page');
break;
case 'filesize':
- $order_by = 'ORDER BY a.filesize ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
+ $order_by = 'ORDER BY a.filesize ' . $sort_order . ' LIMIT ' . $start . ', ' . tp_config()->get('topics_per_page');
break;
case 'downloads':
- $order_by = 'ORDER BY a.download_count ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
+ $order_by = 'ORDER BY a.download_count ' . $sort_order . ' LIMIT ' . $start . ', ' . tp_config()->get('topics_per_page');
break;
case 'post_time':
- $order_by = 'ORDER BY a.filetime ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
+ $order_by = 'ORDER BY a.filetime ' . $sort_order . ' LIMIT ' . $start . ', ' . tp_config()->get('topics_per_page');
break;
default:
$mode = 'a.real_filename';
$sort_order = 'ASC';
- $order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . config()->get('topics_per_page');
+ $order_by = 'ORDER BY a.real_filename ' . $sort_order . ' LIMIT ' . $start . ', ' . tp_config()->get('topics_per_page');
break;
}
}
@@ -470,8 +470,8 @@ if ($view === 'attachments') {
}
// Generate Pagination
-if ($do_pagination && $total_rows > config()->get('topics_per_page')) {
- generate_pagination('admin_attach_cp.php?view=' . $view . '&mode=' . $mode . '&order=' . $sort_order . '&uid=' . $uid, $total_rows, config()->get('topics_per_page'), $start);
+if ($do_pagination && $total_rows > tp_config()->get('topics_per_page')) {
+ generate_pagination('admin_attach_cp.php?view=' . $view . '&mode=' . $mode . '&order=' . $sort_order . '&uid=' . $uid, $total_rows, tp_config()->get('topics_per_page'), $start);
}
print_page('admin_attach_cp.tpl', 'admin');
diff --git a/admin/admin_sitemap.php b/admin/admin_sitemap.php
index 66e2f800b..6c9828c74 100644
--- a/admin/admin_sitemap.php
+++ b/admin/admin_sitemap.php
@@ -39,7 +39,7 @@ if (!$result = DB()->sql_query($sql)) {
}
}
-$s_mess = $lang['SITEMAP_CREATED'] . ': ' . bb_date($new['sitemap_time'], config()->get('post_date_format')) . ' ' . $lang['SITEMAP_AVAILABLE'] . ': ' . make_url('sitemap/sitemap.xml') . '';
+$s_mess = $lang['SITEMAP_CREATED'] . ': ' . bb_date($new['sitemap_time'], tp_config()->get('post_date_format')) . ' ' . $lang['SITEMAP_AVAILABLE'] . ': ' . make_url('sitemap/sitemap.xml') . '';
$message = is_file(SITEMAP_DIR . '/sitemap.xml') ? $s_mess : $lang['SITEMAP_NOT_CREATED'];
$template->assign_vars([
diff --git a/admin/admin_smilies.php b/admin/admin_smilies.php
index 9e84c3ea0..ef484c126 100644
--- a/admin/admin_smilies.php
+++ b/admin/admin_smilies.php
@@ -26,7 +26,7 @@ if ($mode == 'delete' && isset($_POST['cancel'])) {
$mode = '';
}
-$pathToSmilesDir = BB_ROOT . config()->get('smilies_path');
+$pathToSmilesDir = BB_ROOT . tp_config()->get('smilies_path');
$delimeter = '=+:';
$s_hidden_fields = '';
$smiley_paks = $smiley_images = [];
diff --git a/admin/admin_terms.php b/admin/admin_terms.php
index 45acd875c..52216ad88 100644
--- a/admin/admin_terms.php
+++ b/admin/admin_terms.php
@@ -17,15 +17,15 @@ require INC_DIR . '/bbcode.php';
$preview = isset($_POST['preview']);
-if (isset($_POST['post']) && (config()->get('terms') !== $_POST['message'])) {
+if (isset($_POST['post']) && (tp_config()->get('terms') !== $_POST['message'])) {
bb_update_config(['terms' => $_POST['message']]);
bb_die($lang['TERMS_UPDATED_SUCCESSFULLY'] . '
' . sprintf($lang['CLICK_RETURN_TERMS_CONFIG'], '', '') . '
' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '', ''));
}
$template->assign_vars([
'S_ACTION' => 'admin_terms.php',
- 'EXT_LINK_NW' => config()->get('ext_link_new_win'),
- 'MESSAGE' => $preview ? $_POST['message'] : config()->get('terms'),
+ 'EXT_LINK_NW' => tp_config()->get('ext_link_new_win'),
+ 'MESSAGE' => $preview ? $_POST['message'] : tp_config()->get('terms'),
'PREVIEW_HTML' => $preview ? bbcode2html($_POST['message']) : '',
]);
diff --git a/admin/admin_user_search.php b/admin/admin_user_search.php
index d383e5a29..f2efcbc2e 100644
--- a/admin/admin_user_search.php
+++ b/admin/admin_user_search.php
@@ -841,10 +841,10 @@ if (!isset($_REQUEST['dosearch'])) {
if ($page == 1) {
$offset = 0;
} else {
- $offset = (($page - 1) * config()->get('topics_per_page'));
+ $offset = (($page - 1) * tp_config()->get('topics_per_page'));
}
- $limit = "LIMIT $offset, " . config()->get('topics_per_page');
+ $limit = "LIMIT $offset, " . tp_config()->get('topics_per_page');
$select_sql .= " $limit";
@@ -859,7 +859,7 @@ if (!isset($_REQUEST['dosearch'])) {
bb_die($lang['SEARCH_NO_RESULTS']);
}
}
- $num_pages = ceil($total_pages['total'] / config()->get('topics_per_page'));
+ $num_pages = ceil($total_pages['total'] / tp_config()->get('topics_per_page'));
$pagination = '';
diff --git a/admin/index.php b/admin/index.php
index 3d3ddba58..5c891cd12 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -78,7 +78,7 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
} elseif (isset($_GET['pane']) && $_GET['pane'] == 'right') {
$template->assign_vars([
'TPL_ADMIN_MAIN' => true,
- 'ADMIN_LOCK' => (bool)config()->get('board_disable'),
+ 'ADMIN_LOCK' => (bool)tp_config()->get('board_disable'),
'ADMIN_LOCK_CRON' => is_file(BB_DISABLED),
]);
@@ -98,8 +98,8 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
$total_posts = $stats['postcount'];
$total_topics = $stats['topiccount'];
$total_users = $stats['usercount'];
- $start_date = bb_date(config()->get('board_startdate'));
- $boarddays = (TIMENOW - config()->get('board_startdate')) / 86400;
+ $start_date = bb_date(tp_config()->get('board_startdate'));
+ $boarddays = (TIMENOW - tp_config()->get('board_startdate')) / 86400;
$posts_per_day = sprintf('%.2f', $total_posts / $boarddays);
$topics_per_day = sprintf('%.2f', $total_topics / $boarddays);
@@ -107,10 +107,10 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
$avatar_dir_size = 0;
- if ($avatar_dir = opendir(config()->get('avatars.upload_path'))) {
+ if ($avatar_dir = opendir(tp_config()->get('avatars.upload_path'))) {
while ($file = readdir($avatar_dir)) {
if ($file != '.' && $file != '..') {
- $avatar_dir_size += @filesize(config()->get('avatars.upload_path') . $file);
+ $avatar_dir_size += @filesize(tp_config()->get('avatars.upload_path') . $file);
}
}
closedir($avatar_dir);
@@ -187,7 +187,7 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
'STARTED' => bb_date($onlinerow_reg[$i]['session_start'], 'd-M-Y H:i', false),
'LASTUPDATE' => bb_date($onlinerow_reg[$i]['user_session_time'], 'd-M-Y H:i', false),
'IP_ADDRESS' => $reg_ip,
- 'U_WHOIS_IP' => config()->get('whois_info') . $reg_ip,
+ 'U_WHOIS_IP' => tp_config()->get('whois_info') . $reg_ip,
]);
}
}
@@ -206,7 +206,7 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
'STARTED' => bb_date($onlinerow_guest[$i]['session_start'], 'd-M-Y H:i', false),
'LASTUPDATE' => bb_date($onlinerow_guest[$i]['session_time'], 'd-M-Y H:i', false),
'IP_ADDRESS' => $guest_ip,
- 'U_WHOIS_IP' => config()->get('whois_info') . $guest_ip,
+ 'U_WHOIS_IP' => tp_config()->get('whois_info') . $guest_ip,
]);
}
}
diff --git a/admin/stats/tracker.php b/admin/stats/tracker.php
index 677373d78..621e3be10 100644
--- a/admin/stats/tracker.php
+++ b/admin/stats/tracker.php
@@ -21,7 +21,7 @@ if (!IS_ADMIN) {
$peers_in_last_minutes = [30, 15, 5, 1];
$peers_in_last_sec_limit = 300;
-$announce_interval = (int)config()->get('announce_interval');
+$announce_interval = (int)tp_config()->get('announce_interval');
$stat = [];
define('TMP_TRACKER_TABLE', 'tmp_tracker');
diff --git a/bt/announce.php b/bt/announce.php
index 346aed741..f6db656be 100644
--- a/bt/announce.php
+++ b/bt/announce.php
@@ -313,7 +313,7 @@ if ($lp_info) {
}
// Limit active torrents
- if (!isset(tp_config()->get('unlimited_users')[$user_id]) && tp_config()->get('tracker.limit_active_tor') && ((config()->get('tracker.limit_seed_count') && $seeder) || (config()->get('tracker.limit_leech_count') && !$seeder))) {
+ if (!isset(tp_config()->get('unlimited_users')[$user_id]) && tp_config()->get('tracker.limit_active_tor') && ((tp_config()->get('tracker.limit_seed_count') && $seeder) || (tp_config()->get('tracker.limit_leech_count') && !$seeder))) {
$sql = "SELECT COUNT(DISTINCT topic_id) AS active_torrents
FROM " . BB_BT_TRACKER . "
WHERE user_id = $user_id
@@ -321,7 +321,7 @@ if ($lp_info) {
AND topic_id != $topic_id";
if (!$seeder && tp_config()->get('tracker.leech_expire_factor') && $user_ratio < 0.5) {
- $sql .= " AND update_time > " . (TIMENOW - 60 * config()->get('tracker.leech_expire_factor'));
+ $sql .= " AND update_time > " . (TIMENOW - 60 * tp_config()->get('tracker.leech_expire_factor'));
}
$sql .= " GROUP BY user_id";
@@ -335,7 +335,7 @@ if ($lp_info) {
}
// Limit concurrent IPs
- if (config()->get('tracker.limit_concurrent_ips') && ((config()->get('tracker.limit_seed_ips') && $seeder) || (config()->get('tracker.limit_leech_ips') && !$seeder))) {
+ if (tp_config()->get('tracker.limit_concurrent_ips') && ((tp_config()->get('tracker.limit_seed_ips') && $seeder) || (tp_config()->get('tracker.limit_leech_ips') && !$seeder))) {
$sql = "SELECT COUNT(DISTINCT ip) AS ips
FROM " . BB_BT_TRACKER . "
WHERE topic_id = $topic_id
@@ -343,16 +343,16 @@ if ($lp_info) {
AND seeder = $seeder
AND $ip_version != '$ip_sql'";
- if (!$seeder && config()->get('tracker.leech_expire_factor')) {
- $sql .= " AND update_time > " . (TIMENOW - 60 * config()->get('tracker.leech_expire_factor'));
+ if (!$seeder && tp_config()->get('tracker.leech_expire_factor')) {
+ $sql .= " AND update_time > " . (TIMENOW - 60 * tp_config()->get('tracker.leech_expire_factor'));
}
$sql .= " GROUP BY topic_id";
if ($row = DB()->fetch_row($sql)) {
- if ($seeder && config()->get('tracker.limit_seed_ips') && $row['ips'] >= config()->get('tracker.limit_seed_ips')) {
- msg_die('You can seed only from ' . config()->get('tracker.limit_seed_ips') . " IP's");
- } elseif (!$seeder && config()->get('tracker.limit_leech_ips') && $row['ips'] >= config()->get('tracker.limit_leech_ips')) {
- msg_die('You can leech only from ' . config()->get('tracker.limit_leech_ips') . " IP's");
+ if ($seeder && tp_config()->get('tracker.limit_seed_ips') && $row['ips'] >= tp_config()->get('tracker.limit_seed_ips')) {
+ msg_die('You can seed only from ' . tp_config()->get('tracker.limit_seed_ips') . " IP's");
+ } elseif (!$seeder && tp_config()->get('tracker.limit_leech_ips') && $row['ips'] >= tp_config()->get('tracker.limit_leech_ips')) {
+ msg_die('You can leech only from ' . tp_config()->get('tracker.limit_leech_ips') . " IP's");
}
}
}
@@ -376,7 +376,7 @@ $up_add = ($lp_info && $uploaded > $lp_info['uploaded']) ? $uploaded - $lp_info[
$down_add = ($lp_info && $downloaded > $lp_info['downloaded']) ? $downloaded - $lp_info['downloaded'] : 0;
// Gold/Silver releases
-if (config()->get('tracker.gold_silver_enabled') && $down_add) {
+if (tp_config()->get('tracker.gold_silver_enabled') && $down_add) {
if ($tor_type == TOR_TYPE_GOLD) {
$down_add = 0;
} // Silver releases
@@ -386,7 +386,7 @@ if (config()->get('tracker.gold_silver_enabled') && $down_add) {
}
// Freeleech
-if (config()->get('tracker.freeleech') && $down_add) {
+if (tp_config()->get('tracker.freeleech') && $down_add) {
$down_add = 0;
}
@@ -464,8 +464,8 @@ $output = CACHE('tr_cache')->get(PEERS_LIST_PREFIX . $topic_id);
if (!$output) {
// Retrieve peers
- $numwant = (int)config()->get('tracker.numwant');
- $compact_mode = (config()->get('tracker.compact_mode') || !empty($compact));
+ $numwant = (int)tp_config()->get('tracker.numwant');
+ $compact_mode = (tp_config()->get('tracker.compact_mode') || !empty($compact));
$rowset = DB()->fetch_rowset("
SELECT ip, ipv6, port
@@ -510,7 +510,7 @@ if (!$output) {
$seeders = $leechers = $client_completed = 0;
- if (config()->get('tracker.scrape')) {
+ if (tp_config()->get('tracker.scrape')) {
$row = DB()->fetch_row("
SELECT seeders, leechers, completed
FROM " . BB_BT_TRACKER_SNAP . "
diff --git a/common.php b/common.php
index 0c3c346b3..931b49931 100644
--- a/common.php
+++ b/common.php
@@ -80,7 +80,7 @@ $config = \TorrentPier\Config::init($bb_cfg);
*
* @return \TorrentPier\Config
*/
-function config(): \TorrentPier\Config
+function tp_config(): \TorrentPier\Config
{
return \TorrentPier\Config::getInstance();
}
@@ -153,14 +153,14 @@ if (APP_ENV === 'development') {
/**
* Server variables initialize
*/
-$server_protocol = config()->get('cookie_secure') ? 'https://' : 'http://';
-$server_port = in_array((int)config()->get('server_port'), [80, 443], true) ? '' : ':' . config()->get('server_port');
-define('FORUM_PATH', config()->get('script_path'));
-define('FULL_URL', $server_protocol . config()->get('server_name') . $server_port . config()->get('script_path'));
+$server_protocol = tp_config()->get('cookie_secure') ? 'https://' : 'http://';
+$server_port = in_array((int)tp_config()->get('server_port'), [80, 443], true) ? '' : ':' . tp_config()->get('server_port');
+define('FORUM_PATH', tp_config()->get('script_path'));
+define('FULL_URL', $server_protocol . tp_config()->get('server_name') . $server_port . tp_config()->get('script_path'));
unset($server_protocol, $server_port);
// Initialize the new DB factory with database configuration
-TorrentPier\Database\DatabaseFactory::init(config()->get('db'), config()->get('db_alias', []));
+TorrentPier\Database\DatabaseFactory::init(tp_config()->get('db'), tp_config()->get('db_alias', []));
/**
* Get the Database instance
@@ -174,7 +174,7 @@ function DB(string $db_alias = 'db'): \TorrentPier\Database\Database
}
// Initialize Unified Cache System
-TorrentPier\Cache\UnifiedCacheSystem::getInstance(config()->all());
+TorrentPier\Cache\UnifiedCacheSystem::getInstance(tp_config()->all());
/**
* Get cache manager instance (replaces legacy cache system)
@@ -194,7 +194,7 @@ function CACHE(string $cache_name): \TorrentPier\Cache\CacheManager
*/
function datastore(): \TorrentPier\Cache\DatastoreManager
{
- return TorrentPier\Cache\UnifiedCacheSystem::getInstance()->getDatastore(config()->get('datastore_type', 'file'));
+ return TorrentPier\Cache\UnifiedCacheSystem::getInstance()->getDatastore(tp_config()->get('datastore_type', 'file'));
}
/**
@@ -418,9 +418,9 @@ if (!defined('IN_TRACKER')) {
} else {
define('DUMMY_PEER', pack('Nn', \TorrentPier\Helpers\IPHelper::ip2long($_SERVER['REMOTE_ADDR']), !empty($_GET['port']) ? (int)$_GET['port'] : random_int(1000, 65000)));
- define('PEER_HASH_EXPIRE', round(config()->get('announce_interval') * (0.85 * config()->get('tracker.expire_factor'))));
- define('PEERS_LIST_EXPIRE', round(config()->get('announce_interval') * 0.7));
- define('SCRAPE_LIST_EXPIRE', round(config()->get('scrape_interval') * 0.7));
+ define('PEER_HASH_EXPIRE', round(tp_config()->get('announce_interval') * (0.85 * tp_config()->get('tracker.expire_factor'))));
+ define('PEERS_LIST_EXPIRE', round(tp_config()->get('announce_interval') * 0.7));
+ define('SCRAPE_LIST_EXPIRE', round(tp_config()->get('scrape_interval') * 0.7));
define('PEER_HASH_PREFIX', 'peer_');
define('PEERS_LIST_PREFIX', 'peers_list_');
diff --git a/controllers/dl.php b/controllers/dl.php
index cd76b6f92..72fbaa5b0 100644
--- a/controllers/dl.php
+++ b/controllers/dl.php
@@ -174,7 +174,7 @@ if (!IS_AM && ($attachment['mimetype'] === TORRENT_MIMETYPE)) {
$row = DB()->sql_fetchrow($result);
- if (isset(config()->get('tor_frozen')[$row['tor_status']]) && !(isset(config()->get('tor_frozen_author_download')[$row['tor_status']]) && $userdata['user_id'] === $row['poster_id'])) {
+ if (isset(tp_config()->get('tor_frozen')[$row['tor_status']]) && !(isset(tp_config()->get('tor_frozen_author_download')[$row['tor_status']]) && $userdata['user_id'] === $row['poster_id'])) {
bb_die($lang['TOR_STATUS_FORBIDDEN'] . $lang['TOR_STATUS_NAME'][$row['tor_status']]);
}
@@ -223,7 +223,7 @@ switch ($download_mode) {
header('Location: ' . $url);
exit;
case INLINE_LINK:
- if (IS_GUEST && !config()->get('captcha.disabled') && !bb_captcha('check')) {
+ if (IS_GUEST && !tp_config()->get('captcha.disabled') && !bb_captcha('check')) {
global $template;
$redirect_url = $_POST['redirect_url'] ?? $_SERVER['HTTP_REFERER'] ?? '/';
diff --git a/controllers/feed.php b/controllers/feed.php
index 45ba72271..5a4a9b46c 100644
--- a/controllers/feed.php
+++ b/controllers/feed.php
@@ -37,11 +37,11 @@ if ($mode === 'get_feed_url' && ($type === 'f' || $type === 'u') && $id >= 0) {
bb_simple_die($lang['ATOM_ERROR'] . ' #1');
}
}
- if (is_file(config()->get('atom.path') . '/f/' . $id . '.atom') && filemtime(config()->get('atom.path') . '/f/' . $id . '.atom') > $timecheck) {
- redirect(config()->get('atom.url') . '/f/' . $id . '.atom');
+ if (is_file(tp_config()->get('atom.path') . '/f/' . $id . '.atom') && filemtime(tp_config()->get('atom.path') . '/f/' . $id . '.atom') > $timecheck) {
+ redirect(tp_config()->get('atom.url') . '/f/' . $id . '.atom');
} else {
if (\TorrentPier\Legacy\Atom::update_forum_feed($id, $forum_data)) {
- redirect(config()->get('atom.url') . '/f/' . $id . '.atom');
+ redirect(tp_config()->get('atom.url') . '/f/' . $id . '.atom');
} else {
bb_simple_die($lang['ATOM_NO_FORUM']);
}
@@ -55,11 +55,11 @@ if ($mode === 'get_feed_url' && ($type === 'f' || $type === 'u') && $id >= 0) {
if (!$username = get_username($id)) {
bb_simple_die($lang['ATOM_ERROR'] . ' #3');
}
- if (is_file(config()->get('atom.path') . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom') && filemtime(config()->get('atom.path') . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom') > $timecheck) {
- redirect(config()->get('atom.url') . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
+ if (is_file(tp_config()->get('atom.path') . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom') && filemtime(tp_config()->get('atom.path') . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom') > $timecheck) {
+ redirect(tp_config()->get('atom.url') . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
} else {
if (\TorrentPier\Legacy\Atom::update_user_feed($id, $username)) {
- redirect(config()->get('atom.url') . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
+ redirect(tp_config()->get('atom.url') . '/u/' . floor($id / 5000) . '/' . ($id % 100) . '/' . $id . '.atom');
} else {
bb_simple_die($lang['ATOM_NO_USER']);
}
diff --git a/controllers/filelist.php b/controllers/filelist.php
index 7c00a836c..176882e37 100644
--- a/controllers/filelist.php
+++ b/controllers/filelist.php
@@ -17,7 +17,7 @@ if (!defined('IN_TORRENTPIER')) {
// Start session management
$user->session_start();
-if (config()->get('bt_disable_dht') && IS_GUEST) {
+if (tp_config()->get('bt_disable_dht') && IS_GUEST) {
bb_die($lang['BT_PRIVATE_TRACKER'], 403);
}
@@ -58,7 +58,7 @@ if (!is_file($file_path)) {
}
$file_contents = file_get_contents($file_path);
-if (config()->get('flist_max_files')) {
+if (tp_config()->get('flist_max_files')) {
$filetree_pos = $meta_v2 ? strpos($file_contents, '9:file tree') : false;
$files_pos = $meta_v1 ? strpos($file_contents, '5:files', $filetree_pos) : false;
@@ -68,8 +68,8 @@ if (config()->get('flist_max_files')) {
$file_count = substr_count($file_contents, '6:length', $files_pos);
}
- if ($file_count > config()->get('flist_max_files')) {
- bb_die(sprintf($lang['BT_FLIST_LIMIT'], config()->get('flist_max_files'), $file_count), 410);
+ if ($file_count > tp_config()->get('flist_max_files')) {
+ bb_die(sprintf($lang['BT_FLIST_LIMIT'], tp_config()->get('flist_max_files'), $file_count), 410);
}
}
diff --git a/controllers/group.php b/controllers/group.php
index 9a1e26ec0..5fc3f40e7 100644
--- a/controllers/group.php
+++ b/controllers/group.php
@@ -28,7 +28,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 = config()->get('group_members_per_page');
+$per_page = tp_config()->get('group_members_per_page');
$view_mode = isset($_REQUEST['view']) ? (string)$_REQUEST['view'] : null;
$rel_limit = 50;
@@ -172,7 +172,7 @@ if (!$group_id) {
\TorrentPier\Legacy\Group::add_user_into_group($group_id, $userdata['user_id'], 1, TIMENOW);
- if (config()->get('group_send_email')) {
+ if (tp_config()->get('group_send_email')) {
// Sending email
$emailer = new TorrentPier\Emailer();
@@ -228,7 +228,7 @@ if (!$group_id) {
\TorrentPier\Legacy\Group::add_user_into_group($group_id, $row['user_id']);
- if (config()->get('group_send_email')) {
+ if (tp_config()->get('group_send_email')) {
// Sending email
$emailer = new TorrentPier\Emailer();
@@ -277,7 +277,7 @@ if (!$group_id) {
}
}
// Email users when they are approved
- if (!empty($_POST['approve']) && config()->get('group_send_email')) {
+ if (!empty($_POST['approve']) && tp_config()->get('group_send_email')) {
$sql_select = "SELECT username, user_email, user_lang
FROM " . BB_USERS . "
WHERE user_id IN($sql_in)";
diff --git a/controllers/group_edit.php b/controllers/group_edit.php
index 8f579132d..394a03308 100644
--- a/controllers/group_edit.php
+++ b/controllers/group_edit.php
@@ -38,10 +38,10 @@ if ($group_id) {
if ($is_moderator) {
// Avatar
if ($submit) {
- if (!empty($_FILES['avatar']['name']) && config()->get('group_avatars.up_allowed')) {
+ if (!empty($_FILES['avatar']['name']) && tp_config()->get('group_avatars.up_allowed')) {
$upload = new TorrentPier\Legacy\Common\Upload();
- if ($upload->init(config()->get('group_avatars'), $_FILES['avatar']) and $upload->store('avatar', ['user_id' => GROUP_AVATAR_MASK . $group_id, 'avatar_ext_id' => $group_info['avatar_ext_id']])) {
+ if ($upload->init(tp_config()->get('group_avatars'), $_FILES['avatar']) and $upload->store('avatar', ['user_id' => GROUP_AVATAR_MASK . $group_id, 'avatar_ext_id' => $group_info['avatar_ext_id']])) {
$avatar_ext_id = (int)$upload->file_ext_id;
DB()->query("UPDATE " . BB_GROUPS . " SET avatar_ext_id = $avatar_ext_id WHERE group_id = $group_id LIMIT 1");
} else {
@@ -79,7 +79,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'], config()->get('group_avatars.max_width'), config()->get('group_avatars.max_height'), humn_size(config()->get('group_avatars.max_size'))),
+ 'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], tp_config()->get('group_avatars.max_width'), tp_config()->get('group_avatars.max_height'), humn_size(tp_config()->get('group_avatars.max_size'))),
'AVATAR_IMG' => get_avatar(GROUP_AVATAR_MASK . $group_id, $group_info['avatar_ext_id']),
]);
diff --git a/controllers/index.php b/controllers/index.php
index fefe9728e..cd46233b6 100644
--- a/controllers/index.php
+++ b/controllers/index.php
@@ -34,12 +34,12 @@ $datastore->enqueue([
'cat_forums'
]);
-if (config()->get('show_latest_news')) {
+if (tp_config()->get('show_latest_news')) {
$datastore->enqueue([
'latest_news'
]);
}
-if (config()->get('show_network_news')) {
+if (tp_config()->get('show_network_news')) {
$datastore->enqueue([
'network_news'
]);
@@ -49,7 +49,7 @@ if (config()->get('show_network_news')) {
$user->session_start();
// Set meta description
-$page_cfg['meta_description'] = config()->get('site_desc');
+$page_cfg['meta_description'] = tp_config()->get('site_desc');
// Init main vars
$viewcat = isset($_GET[POST_CAT_URL]) ? (int)$_GET[POST_CAT_URL] : 0;
@@ -60,7 +60,7 @@ $req_page = 'index_page';
$req_page .= $viewcat ? "_c{$viewcat}" : '';
define('REQUESTED_PAGE', $req_page);
-caching_output(IS_GUEST, 'send', REQUESTED_PAGE . '_guest_' . config()->get('default_lang'));
+caching_output(IS_GUEST, 'send', REQUESTED_PAGE . '_guest_' . tp_config()->get('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));
@@ -265,7 +265,7 @@ foreach ($cat_forums as $cid => $c) {
'LAST_TOPIC_ID' => $f['last_topic_id'],
'LAST_TOPIC_TIP' => $f['last_topic_title'],
'LAST_TOPIC_TITLE' => str_short($f['last_topic_title'], $last_topic_max_len),
- 'LAST_POST_TIME' => bb_date($f['last_post_time'], config()->get('last_post_date_format')),
+ 'LAST_POST_TIME' => bb_date($f['last_post_time'], tp_config()->get('last_post_date_format')),
'LAST_POST_USER' => profile_url(['username' => str_short($f['last_post_username'], 15), 'user_id' => $f['last_post_user_id'], 'user_rank' => $f['last_post_user_rank']]),
]);
}
@@ -281,7 +281,7 @@ $template->assign_vars([
'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' => config()->get('gender') ? sprintf(
+ 'TOTAL_GENDER' => tp_config()->get('gender') ? sprintf(
$lang['USERS_TOTAL_GENDER'],
$stats['male'],
$stats['female'],
@@ -290,22 +290,22 @@ $template->assign_vars([
'NEWEST_USER' => sprintf($lang['NEWEST_USER'], profile_url($stats['newestuser'])),
// Tracker stats
- 'TORRENTS_STAT' => config()->get('tor_stats') ? sprintf(
+ 'TORRENTS_STAT' => tp_config()->get('tor_stats') ? sprintf(
$lang['TORRENTS_STAT'],
$stats['torrentcount'],
humn_size($stats['size'])
) : '',
- 'PEERS_STAT' => config()->get('tor_stats') ? sprintf(
+ 'PEERS_STAT' => tp_config()->get('tor_stats') ? sprintf(
$lang['PEERS_STAT'],
$stats['peers'],
$stats['seeders'],
$stats['leechers']
) : '',
- 'SPEED_STAT' => config()->get('tor_stats') ? sprintf(
+ 'SPEED_STAT' => tp_config()->get('tor_stats') ? sprintf(
$lang['SPEED_STAT'],
humn_size($stats['speed']) . '/s'
) : '',
- 'SHOW_MOD_INDEX' => config()->get('show_mod_index'),
+ 'SHOW_MOD_INDEX' => tp_config()->get('show_mod_index'),
'FORUM_IMG' => $images['forum'],
'FORUM_NEW_IMG' => $images['forum_new'],
'FORUM_LOCKED_IMG' => $images['forum_locked'],
@@ -318,19 +318,19 @@ $template->assign_vars([
'U_SEARCH_SELF_BY_MY' => "search.php?uid={$userdata['user_id']}&o=1",
'U_SEARCH_LATEST' => 'search.php?search_id=latest',
'U_SEARCH_UNANSWERED' => 'search.php?search_id=unanswered',
- 'U_ATOM_FEED' => is_file(config()->get('atom.path') . '/f/0.atom') ? make_url(config()->get('atom.url') . '/f/0.atom') : false,
+ 'U_ATOM_FEED' => is_file(tp_config()->get('atom.path') . '/f/0.atom') ? make_url(tp_config()->get('atom.url') . '/f/0.atom') : false,
'SHOW_LAST_TOPIC' => $show_last_topic,
- 'BOARD_START' => config()->get('show_board_start_index') ? ($lang['BOARD_STARTED'] . ': ' . '' . bb_date(config()->get('board_startdate')) . '') : false,
+ 'BOARD_START' => tp_config()->get('show_board_start_index') ? ($lang['BOARD_STARTED'] . ': ' . '' . bb_date(tp_config()->get('board_startdate')) . '') : false,
]);
// Set tpl vars for bt_userdata
-if (config()->get('bt_show_dl_stat_on_index') && !IS_GUEST) {
+if (tp_config()->get('bt_show_dl_stat_on_index') && !IS_GUEST) {
show_bt_userdata($userdata['user_id']);
}
// Latest news
-if (config()->get('show_latest_news')) {
+if (tp_config()->get('show_latest_news')) {
$latest_news = $datastore->get('latest_news');
if ($latest_news === false) {
$datastore->update('latest_news');
@@ -346,7 +346,7 @@ if (config()->get('show_latest_news')) {
$template->assign_block_vars('news', [
'NEWS_TOPIC_ID' => $news['topic_id'],
- 'NEWS_TITLE' => str_short(censor()->censorString($news['topic_title']), config()->get('max_news_title')),
+ 'NEWS_TITLE' => str_short(censor()->censorString($news['topic_title']), tp_config()->get('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']),
]);
@@ -354,7 +354,7 @@ if (config()->get('show_latest_news')) {
}
// Network news
-if (config()->get('show_network_news')) {
+if (tp_config()->get('show_network_news')) {
$network_news = $datastore->get('network_news');
if ($network_news === false) {
$datastore->update('network_news');
@@ -370,14 +370,14 @@ if (config()->get('show_network_news')) {
$template->assign_block_vars('net', [
'NEWS_TOPIC_ID' => $net['topic_id'],
- 'NEWS_TITLE' => str_short(censor()->censorString($net['topic_title']), config()->get('max_net_title')),
+ 'NEWS_TITLE' => str_short(censor()->censorString($net['topic_title']), tp_config()->get('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 (config()->get('birthday_check_day') && config()->get('birthday_enabled')) {
+if (tp_config()->get('birthday_check_day') && tp_config()->get('birthday_enabled')) {
$week_list = $today_list = [];
$week_all = $today_all = false;
@@ -391,9 +391,9 @@ if (config()->get('birthday_check_day') && config()->get('birthday_enabled')) {
$week_list[] = profile_url($week) . ' (' . birthday_age(date('Y-m-d', strtotime('-1 year', strtotime($week['user_birthday'])))) . ')';
}
$week_all = $week_all ? ' ...' : '';
- $week_list = sprintf($lang['BIRTHDAY_WEEK'], config()->get('birthday_check_day'), implode(', ', $week_list)) . $week_all;
+ $week_list = sprintf($lang['BIRTHDAY_WEEK'], tp_config()->get('birthday_check_day'), implode(', ', $week_list)) . $week_all;
} else {
- $week_list = sprintf($lang['NOBIRTHDAY_WEEK'], config()->get('birthday_check_day'));
+ $week_list = sprintf($lang['NOBIRTHDAY_WEEK'], tp_config()->get('birthday_check_day'));
}
if (!empty($stats['birthday_today_list'])) {
diff --git a/controllers/login.php b/controllers/login.php
index 5a8ed50de..1ee720608 100644
--- a/controllers/login.php
+++ b/controllers/login.php
@@ -66,7 +66,7 @@ $login_password = $_POST['login_password'] ?? '';
$need_captcha = false;
if (!$mod_admin_login) {
$need_captcha = CACHE('bb_login_err')->get('l_err_' . USER_IP);
- if ($need_captcha < config()->get('invalid_logins')) {
+ if ($need_captcha < tp_config()->get('invalid_logins')) {
$need_captcha = false;
}
}
@@ -83,13 +83,13 @@ if (isset($_POST['login'])) {
}
// Captcha
- if ($need_captcha && !config()->get('captcha.disabled') && !bb_captcha('check')) {
+ if ($need_captcha && !tp_config()->get('captcha.disabled') && !bb_captcha('check')) {
$login_errors[] = $lang['CAPTCHA_WRONG'];
}
if (!$login_errors) {
if ($user->login($_POST, $mod_admin_login)) {
- $redirect_url = (defined('FIRST_LOGON')) ? config()->get('first_logon_redirect_url') : $redirect_url;
+ $redirect_url = (defined('FIRST_LOGON')) ? tp_config()->get('first_logon_redirect_url') : $redirect_url;
// Reset when entering the correct login/password combination
CACHE('bb_login_err')->rm('l_err_' . USER_IP);
@@ -104,7 +104,7 @@ if (isset($_POST['login'])) {
if (!$mod_admin_login) {
$login_err = CACHE('bb_login_err')->get('l_err_' . USER_IP);
- if ($login_err > config()->get('invalid_logins')) {
+ if ($login_err > tp_config()->get('invalid_logins')) {
$need_captcha = true;
}
CACHE('bb_login_err')->set('l_err_' . USER_IP, ($login_err + 1), 3600);
@@ -121,7 +121,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 && !config()->get('captcha.disabled')) ? bb_captcha('get') : '',
+ 'CAPTCHA_HTML' => ($need_captcha && !tp_config()->get('captcha.disabled')) ? bb_captcha('get') : '',
'PAGE_TITLE' => $lang['LOGIN'],
'S_LOGIN_ACTION' => LOGIN_URL
]);
diff --git a/controllers/memberlist.php b/controllers/memberlist.php
index ae5b2b5ac..9886a46d3 100644
--- a/controllers/memberlist.php
+++ b/controllers/memberlist.php
@@ -57,26 +57,26 @@ $select_sort_role .= '';
switch ($mode) {
case 'username':
- $order_by = "username $sort_order LIMIT $start, " . config()->get('topics_per_page');
+ $order_by = "username $sort_order LIMIT $start, " . tp_config()->get('topics_per_page');
break;
case 'location':
- $order_by = "user_from $sort_order LIMIT $start, " . config()->get('topics_per_page');
+ $order_by = "user_from $sort_order LIMIT $start, " . tp_config()->get('topics_per_page');
break;
case 'posts':
- $order_by = "user_posts $sort_order LIMIT $start, " . config()->get('topics_per_page');
+ $order_by = "user_posts $sort_order LIMIT $start, " . tp_config()->get('topics_per_page');
break;
case 'email':
- $order_by = "user_email $sort_order LIMIT $start, " . config()->get('topics_per_page');
+ $order_by = "user_email $sort_order LIMIT $start, " . tp_config()->get('topics_per_page');
break;
case 'website':
- $order_by = "user_website $sort_order LIMIT $start, " . config()->get('topics_per_page');
+ $order_by = "user_website $sort_order LIMIT $start, " . tp_config()->get('topics_per_page');
break;
case 'topten':
$order_by = "user_posts $sort_order LIMIT 10";
break;
case 'joined':
default:
- $order_by = "user_regdate $sort_order LIMIT $start, " . config()->get('topics_per_page');
+ $order_by = "user_regdate $sort_order LIMIT $start, " . tp_config()->get('topics_per_page');
break;
}
@@ -137,7 +137,7 @@ if ($mode != 'topten') {
}
if ($total = DB()->sql_fetchrow($result)) {
$total_members = $total['total'];
- generate_pagination($paginationurl, $total_members, config()->get('topics_per_page'), $start);
+ generate_pagination($paginationurl, $total_members, tp_config()->get('topics_per_page'), $start);
}
DB()->sql_freeresult($result);
}
diff --git a/controllers/modcp.php b/controllers/modcp.php
index 9650dcdb9..4384447b0 100644
--- a/controllers/modcp.php
+++ b/controllers/modcp.php
@@ -227,16 +227,16 @@ switch ($mode) {
$result = \TorrentPier\Legacy\Admin\Common::topic_delete($req_topics, $forum_id);
//Обновление кеша новостей на главной
- $news_forums = array_flip(explode(',', config()->get('latest_news_forum_id')));
- if (isset($news_forums[$forum_id]) && config()->get('show_latest_news') && $result) {
+ $news_forums = array_flip(explode(',', tp_config()->get('latest_news_forum_id')));
+ if (isset($news_forums[$forum_id]) && tp_config()->get('show_latest_news') && $result) {
$datastore->enqueue([
'latest_news'
]);
$datastore->update('latest_news');
}
- $net_forums = array_flip(explode(',', config()->get('network_news_forum_id')));
- if (isset($net_forums[$forum_id]) && config()->get('show_network_news') && $result) {
+ $net_forums = array_flip(explode(',', tp_config()->get('network_news_forum_id')));
+ if (isset($net_forums[$forum_id]) && tp_config()->get('show_network_news') && $result) {
$datastore->enqueue([
'network_news'
]);
@@ -262,16 +262,16 @@ switch ($mode) {
$result = \TorrentPier\Legacy\Admin\Common::topic_move($req_topics, $new_forum_id, $forum_id, isset($_POST['move_leave_shadow']), isset($_POST['insert_bot_msg']), $_POST['reason_move_bot']);
//Обновление кеша новостей на главной
- $news_forums = array_flip(explode(',', config()->get('latest_news_forum_id')));
- if ((isset($news_forums[$forum_id]) || isset($news_forums[$new_forum_id])) && config()->get('show_latest_news') && $result) {
+ $news_forums = array_flip(explode(',', tp_config()->get('latest_news_forum_id')));
+ if ((isset($news_forums[$forum_id]) || isset($news_forums[$new_forum_id])) && tp_config()->get('show_latest_news') && $result) {
$datastore->enqueue([
'latest_news'
]);
$datastore->update('latest_news');
}
- $net_forums = array_flip(explode(',', config()->get('network_news_forum_id')));
- if ((isset($net_forums[$forum_id]) || isset($net_forums[$new_forum_id])) && config()->get('show_network_news') && $result) {
+ $net_forums = array_flip(explode(',', tp_config()->get('network_news_forum_id')));
+ if ((isset($net_forums[$forum_id]) || isset($net_forums[$new_forum_id])) && tp_config()->get('show_network_news') && $result) {
$datastore->enqueue([
'network_news'
]);
@@ -561,7 +561,7 @@ switch ($mode) {
$poster = $postrow[$i]['username'];
$poster_rank = $postrow[$i]['user_rank'];
- $post_date = bb_date($postrow[$i]['post_time'], config()->get('post_date_format'));
+ $post_date = bb_date($postrow[$i]['post_time'], tp_config()->get('post_date_format'));
$message = $postrow[$i]['post_text'];
diff --git a/controllers/playback_m3u.php b/controllers/playback_m3u.php
index 2a1002e89..e11e21b8b 100644
--- a/controllers/playback_m3u.php
+++ b/controllers/playback_m3u.php
@@ -14,7 +14,7 @@ if (!defined('IN_TORRENTPIER')) {
require __DIR__ . '/../common.php';
}
-if (!config()->get('torr_server.enabled')) {
+if (!tp_config()->get('torr_server.enabled')) {
redirect('index.php');
}
@@ -25,7 +25,7 @@ $validFormats = [
];
// Start session management
-$user->session_start(['req_login' => config()->get('torr_server.disable_for_guest')]);
+$user->session_start(['req_login' => tp_config()->get('torr_server.disable_for_guest')]);
// Disable robots indexing
$page_cfg['allow_robots'] = false;
diff --git a/controllers/poll.php b/controllers/poll.php
index 2a8204c9b..620cee370 100644
--- a/controllers/poll.php
+++ b/controllers/poll.php
@@ -50,8 +50,8 @@ if ($mode != 'poll_vote') {
// Checking the ability to make changes
if ($mode == 'poll_delete') {
- if ($t_data['topic_time'] < TIMENOW - config()->get('poll_max_days') * 86400) {
- bb_die(sprintf(__('NEW_POLL_DAYS'), config()->get('poll_max_days')));
+ if ($t_data['topic_time'] < TIMENOW - tp_config()->get('poll_max_days') * 86400) {
+ bb_die(sprintf(__('NEW_POLL_DAYS'), tp_config()->get('poll_max_days')));
}
if (!IS_ADMIN && ($t_data['topic_vote'] != POLL_FINISHED)) {
bb_die(__('CANNOT_DELETE_POLL'));
diff --git a/controllers/posting.php b/controllers/posting.php
index 8e6413acc..d05dfbb93 100644
--- a/controllers/posting.php
+++ b/controllers/posting.php
@@ -225,7 +225,7 @@ if (!$is_auth[$is_auth_type]) {
}
if ($mode == 'new_rel') {
- if ($tor_status = implode(',', config()->get('tor_cannot_new'))) {
+ if ($tor_status = implode(',', tp_config()->get('tor_cannot_new'))) {
$sql = 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 .= config()->get('tor_icons')[$row['tor_status']] . '' . $row['topic_title'] . '
';
+ $topics .= tp_config()->get('tor_icons')[$row['tor_status']] . '' . $row['topic_title'] . '';
}
if ($topics && !(IS_SUPER_ADMIN && !empty($_REQUEST['edit_tpl']))) {
bb_die($topics . $lang['UNEXECUTED_RELEASE']);
@@ -247,9 +247,9 @@ if ($mode == 'new_rel') {
}
// Disallowed release editing with a certain status
-if (!empty(config()->get('tor_cannot_edit')) && $post_info['allow_reg_tracker'] && $post_data['first_post'] && !IS_AM) {
- if ($tor_status = DB()->fetch_row("SELECT tor_status FROM " . BB_BT_TORRENTS . " WHERE topic_id = $topic_id AND forum_id = $forum_id AND tor_status IN(" . implode(',', config()->get('tor_cannot_edit')) . ") LIMIT 1")) {
- bb_die($lang['NOT_EDIT_TOR_STATUS'] . ': ' . config()->get('tor_icons')[$tor_status['tor_status']] . ' ' . $lang['TOR_STATUS_NAME'][$tor_status['tor_status']] . '.');
+if (!empty(tp_config()->get('tor_cannot_edit')) && $post_info['allow_reg_tracker'] && $post_data['first_post'] && !IS_AM) {
+ if ($tor_status = DB()->fetch_row("SELECT tor_status FROM " . BB_BT_TORRENTS . " WHERE topic_id = $topic_id AND forum_id = $forum_id AND tor_status IN(" . implode(',', tp_config()->get('tor_cannot_edit')) . ") LIMIT 1")) {
+ bb_die($lang['NOT_EDIT_TOR_STATUS'] . ': ' . tp_config()->get('tor_icons')[$tor_status['tor_status']] . ' ' . $lang['TOR_STATUS_NAME'][$tor_status['tor_status']] . '.');
}
}
@@ -285,7 +285,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 " . config()->get('posts_per_page');
+ LIMIT " . tp_config()->get('posts_per_page');
if ($rowset = DB()->fetch_rowset($sql)) {
$topic_has_new_posts = true;
@@ -295,7 +295,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'], config()->get('post_date_format')) . '',
+ 'POST_DATE' => '' . bb_date($row['post_time'], tp_config()->get('post_date_format')) . '',
'MESSAGE' => get_parsed_post($row)
]);
}
@@ -378,9 +378,9 @@ if (($delete || $mode == 'delete') && !$confirm) {
set_tracks(COOKIE_TOPIC, $tracking_topics, $topic_id);
}
- if (defined('TORRENT_ATTACH_ID') && config()->get('bt_newtopic_auto_reg') && !$error_msg) {
+ if (defined('TORRENT_ATTACH_ID') && tp_config()->get('bt_newtopic_auto_reg') && !$error_msg) {
if (!DB()->fetch_row("SELECT attach_id FROM " . BB_BT_TORRENTS . " WHERE attach_id = " . TORRENT_ATTACH_ID)) {
- if (config()->get('premod')) {
+ if (tp_config()->get('premod')) {
// Getting a list of forum ids starting with "parent"
$forum_parent = $forum_id;
if ($post_info['forum_parent']) {
@@ -472,7 +472,7 @@ if ($refresh || $error_msg || ($submit && $topic_has_new_posts)) {
$message = '[quote="' . $quote_username . '"][qpost=' . $post_info['post_id'] . ']' . $message . '[/quote]';
// hide user passkey
- $message = preg_replace('#(?<=[\?&;]' . config()->get('passkey_key') . '=)[a-zA-Z0-9]#', 'passkey', $message);
+ $message = preg_replace('#(?<=[\?&;]' . tp_config()->get('passkey_key') . '=)[a-zA-Z0-9]#', 'passkey', $message);
// hide sid
$message = preg_replace('#(?<=[\?&;]sid=)[a-zA-Z0-9]#', 'sid', $message);
@@ -622,7 +622,7 @@ $template->assign_vars([
'U_VIEW_FORUM' => FORUM_URL . $forum_id,
'USERNAME' => @$username,
- 'CAPTCHA_HTML' => (IS_GUEST && !config()->get('captcha.disabled')) ? bb_captcha('get') : '',
+ 'CAPTCHA_HTML' => (IS_GUEST && !tp_config()->get('captcha.disabled')) ? bb_captcha('get') : '',
'SUBJECT' => $subject,
'MESSAGE' => $message,
diff --git a/controllers/privmsg.php b/controllers/privmsg.php
index ef6defd14..a24346eae 100644
--- a/controllers/privmsg.php
+++ b/controllers/privmsg.php
@@ -28,7 +28,7 @@ $page_cfg['load_tpl_vars'] = [
//
// Is PM disabled?
//
-if (config()->get('privmsg_disable')) {
+if (tp_config()->get('privmsg_disable')) {
bb_die('PM_DISABLED');
}
@@ -63,13 +63,13 @@ $user->session_start(['req_login' => true]);
$template->assign_vars([
'IN_PM' => true,
- 'QUICK_REPLY' => config()->get('show_quick_reply') && $folder == 'inbox' && $mode == 'read',
+ 'QUICK_REPLY' => tp_config()->get('show_quick_reply') && $folder == 'inbox' && $mode == 'read',
]);
//
// Set mode for quick reply
//
-if (empty($mode) && config()->get('show_quick_reply') && $folder == 'inbox' && $preview) {
+if (empty($mode) && tp_config()->get('show_quick_reply') && $folder == 'inbox' && $preview) {
$mode = 'reply';
}
@@ -210,7 +210,7 @@ if ($mode == 'read') {
}
if ($sent_info = DB()->sql_fetchrow($result)) {
- if (config()->get('max_sentbox_privmsgs') && $sent_info['sent_items'] >= config()->get('max_sentbox_privmsgs')) {
+ if (tp_config()->get('max_sentbox_privmsgs') && $sent_info['sent_items'] >= tp_config()->get('max_sentbox_privmsgs')) {
$sql = "SELECT privmsgs_id FROM " . BB_PRIVMSGS . "
WHERE privmsgs_type = " . PRIVMSGS_SENT_MAIL . "
AND privmsgs_date = " . $sent_info['oldest_post_time'] . "
@@ -608,7 +608,7 @@ if ($mode == 'read') {
}
if ($saved_info = DB()->sql_fetchrow($result)) {
- if (config()->get('max_savebox_privmsgs') && $saved_info['savebox_items'] >= config()->get('max_savebox_privmsgs')) {
+ if (tp_config()->get('max_savebox_privmsgs') && $saved_info['savebox_items'] >= tp_config()->get('max_savebox_privmsgs')) {
$sql = "SELECT privmsgs_id FROM " . BB_PRIVMSGS . "
WHERE ( ( privmsgs_to_userid = " . $userdata['user_id'] . "
AND privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " )
@@ -753,7 +753,7 @@ if ($mode == 'read') {
$last_post_time = $db_row['last_post_time'];
$current_time = TIMENOW;
- if (($current_time - $last_post_time) < config()->get('flood_interval')) {
+ if (($current_time - $last_post_time) < tp_config()->get('flood_interval')) {
bb_die($lang['FLOOD_ERROR']);
}
}
@@ -806,11 +806,11 @@ if ($mode == 'read') {
}
// Check smilies limit
- if (config()->get('max_smilies_pm')) {
- $count_smilies = substr_count(bbcode2html($privmsg_message), '
get('pm_notify_enabled')) {
+ if (bf($to_userdata['user_opt'], 'user_opt', 'user_notify_pm') && $to_userdata['user_active'] && tp_config()->get('pm_notify_enabled')) {
// Sending email
$emailer = new TorrentPier\Emailer();
@@ -1256,7 +1256,7 @@ if ($mode == 'read') {
$msg_days = 0;
}
- $sql .= $limit_msg_time . " ORDER BY pm.privmsgs_date DESC LIMIT $start, " . config()->get('topics_per_page');
+ $sql .= $limit_msg_time . " ORDER BY pm.privmsgs_date DESC LIMIT $start, " . tp_config()->get('topics_per_page');
$sql_all_tot = $sql_tot;
$sql_tot .= $limit_msg_time_total;
@@ -1312,11 +1312,11 @@ if ($mode == 'read') {
// Output data for inbox status
//
$box_limit_img_length = $box_limit_percent = $l_box_size_status = '';
- $max_pm = ($folder != 'outbox') ? config()->get("max_{$folder}_privmsgs") : null;
+ $max_pm = ($folder != 'outbox') ? tp_config()->get("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) * config()->get('privmsg_graphic_length')), config()->get('privmsg_graphic_length'));
+ $box_limit_img_length = min(round(($pm_all_total / $max_pm) * tp_config()->get('privmsg_graphic_length')), tp_config()->get('privmsg_graphic_length'));
$box_limit_remain = max(($max_pm - $pm_all_total), 0);
$template->assign_var('PM_BOX_SIZE_INFO');
@@ -1414,7 +1414,7 @@ if ($mode == 'read') {
]);
} while ($row = DB()->sql_fetchrow($result));
- generate_pagination(PM_URL . "?folder=$folder", $pm_total, config()->get('topics_per_page'), $start);
+ generate_pagination(PM_URL . "?folder=$folder", $pm_total, tp_config()->get('topics_per_page'), $start);
} else {
$template->assign_block_vars('switch_no_messages', []);
}
diff --git a/controllers/search.php b/controllers/search.php
index a26cd6e6e..ac367aecb 100644
--- a/controllers/search.php
+++ b/controllers/search.php
@@ -24,7 +24,7 @@ $page_cfg['load_tpl_vars'] = [
];
// Start session management
-$user->session_start(array('req_login' => config()->get('disable_search_for_guest')));
+$user->session_start(array('req_login' => tp_config()->get('disable_search_for_guest')));
set_die_append_msg();
@@ -293,7 +293,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, config()->get('disable_ft_search_in_posts')),
+ 'TITLE_ONLY_CHBOX' => build_checkbox($title_only_key, $lang['SEARCH_TITLES_ONLY'], true, tp_config()->get('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'),
@@ -425,7 +425,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 || config()->get('disable_ft_search_in_posts')));
+$title_match = ($text_match_sql && ($title_only_val || tp_config()->get('disable_ft_search_in_posts')));
// "Display as" mode (posts or topics)
$post_mode = (!$dl_search && ($display_as_val == $as_posts || isset($_GET['search_author'])));
@@ -437,7 +437,7 @@ $SQL = DB()->get_empty_sql_array();
if ($post_mode) {
$order = $order_opt[$order_val]['sql'];
$sort = $sort_opt[$sort_val]['sql'];
- $per_page = config()->get('posts_per_page');
+ $per_page = tp_config()->get('posts_per_page');
$display_as_val = $as_posts;
// Run initial search for post_ids
@@ -598,7 +598,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'], config()->get('post_date_format')),
+ 'POST_DATE' => bb_date($post['post_time'], tp_config()->get('post_date_format')),
'IS_UNREAD' => is_unread($post['post_time'], $topic_id, $forum_id),
'MESSAGE' => $message,
'POSTED_AFTER' => '',
@@ -617,7 +617,7 @@ if ($post_mode) {
else {
$order = $order_opt[$order_val]['sql'];
$sort = $sort_opt[$sort_val]['sql'];
- $per_page = config()->get('topics_per_page');
+ $per_page = tp_config()->get('topics_per_page');
$display_as_val = $as_topics;
// Run initial search for topic_ids
@@ -743,7 +743,7 @@ else {
// Build SQL for displaying topics
$SQL = DB()->get_empty_sql_array();
- $join_dl = (config()->get('show_dl_status_in_search') && !IS_GUEST);
+ $join_dl = (tp_config()->get('show_dl_status_in_search') && !IS_GUEST);
$SQL['SELECT'][] = "
t.*, t.topic_poster AS first_user_id, u1.user_rank AS first_user_rank,
@@ -800,7 +800,7 @@ else {
'TOPIC_TITLE' => censor()->censorString($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'], config()->get('posts_per_page')),
+ 'PAGINATION' => $moved ? '' : build_topic_pagination(TOPIC_URL . $topic_id, $topic['topic_replies'], tp_config()->get('posts_per_page')),
'REPLIES' => $moved ? '' : $topic['topic_replies'],
'ATTACH' => $topic['topic_attachment'],
'STATUS' => $topic['topic_status'],
@@ -898,13 +898,13 @@ function fetch_search_ids($sql, $search_type = SEARCH_TYPE_POST)
function prevent_huge_searches($SQL)
{
- if (config()->get('limit_max_search_results')) {
+ if (tp_config()->get('limit_max_search_results')) {
$SQL['select_options'][] = 'SQL_CALC_FOUND_ROWS';
$SQL['ORDER BY'] = [];
$SQL['LIMIT'] = array('0');
if (DB()->query($SQL) and $row = DB()->fetch_row("SELECT FOUND_ROWS() AS rows_count")) {
- if ($row['rows_count'] > config()->get('limit_max_search_results')) {
+ if ($row['rows_count'] > tp_config()->get('limit_max_search_results')) {
# bb_log(str_compact(DB()->build_sql($SQL)) ." [{$row['rows_count']} rows]". LOG_LF, 'sql_huge_search');
bb_die('Too_many_search_results');
}
diff --git a/controllers/terms.php b/controllers/terms.php
index c4900eb24..c1a37c9b5 100644
--- a/controllers/terms.php
+++ b/controllers/terms.php
@@ -18,13 +18,13 @@ require INC_DIR . '/bbcode.php';
// Start session management
$user->session_start();
-if (!config()->get('terms') && !IS_ADMIN) {
+if (!tp_config()->get('terms') && !IS_ADMIN) {
redirect('index.php');
}
$template->assign_vars([
'TERMS_EDIT' => bbcode2html(sprintf($lang['TERMS_EMPTY_TEXT'], make_url('admin/admin_terms.php'))),
- 'TERMS_HTML' => bbcode2html(config()->get('terms')),
+ 'TERMS_HTML' => bbcode2html(tp_config()->get('terms')),
]);
print_page('terms.tpl');
diff --git a/controllers/tracker.php b/controllers/tracker.php
index f346c4c34..d3ab3eca0 100644
--- a/controllers/tracker.php
+++ b/controllers/tracker.php
@@ -22,7 +22,7 @@ $page_cfg['load_tpl_vars'] = [
];
// Session start
-$user->session_start(array('req_login' => config()->get('bt_tor_browse_only_reg')));
+$user->session_start(array('req_login' => tp_config()->get('bt_tor_browse_only_reg')));
set_die_append_msg();
@@ -33,7 +33,7 @@ $max_forums_selected = 50;
$title_match_max_len = 60;
$poster_name_max_len = 25;
$tor_colspan = 12; // torrents table colspan with all columns
-$per_page = config()->get('topics_per_page');
+$per_page = tp_config()->get('topics_per_page');
$tracker_url = basename(__FILE__);
$time_format = 'H:i';
@@ -302,8 +302,8 @@ if (isset($_GET[$user_releases_key])) {
}
// Random release
-if (config()->get('tracker.random_release_button') && isset($_GET['random_release'])) {
- if ($random_release = DB()->fetch_row("SELECT topic_id FROM " . BB_BT_TORRENTS . " WHERE tor_status NOT IN(" . implode(', ', array_keys(config()->get('tor_frozen'))) . ") ORDER BY RAND() LIMIT 1")) {
+if (tp_config()->get('tracker.random_release_button') && isset($_GET['random_release'])) {
+ if ($random_release = DB()->fetch_row("SELECT topic_id FROM " . BB_BT_TORRENTS . " WHERE tor_status NOT IN(" . implode(', ', array_keys(tp_config()->get('tor_frozen'))) . ") ORDER BY RAND() LIMIT 1")) {
redirect(TOPIC_URL . $random_release['topic_id']);
} else {
bb_die($lang['NO_MATCH']);
@@ -752,8 +752,8 @@ if ($allowed_forums) {
'MAGNET' => $tor_magnet,
'TOR_TYPE' => is_gold($tor['tor_type']),
- 'TOR_FROZEN' => !IS_AM ? isset(config()->get('tor_frozen')[$tor['tor_status']]) : '',
- 'TOR_STATUS_ICON' => config()->get('tor_icons')[$tor['tor_status']],
+ 'TOR_FROZEN' => !IS_AM ? isset(tp_config()->get('tor_frozen')[$tor['tor_status']]) : '',
+ 'TOR_STATUS_ICON' => tp_config()->get('tor_icons')[$tor['tor_status']],
'TOR_STATUS_TEXT' => $lang['TOR_STATUS_NAME'][$tor['tor_status']],
'TOR_SIZE_RAW' => $size,
@@ -822,9 +822,9 @@ $search_all_opt = '