mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 14:23:57 -07:00
refactor: replace $bb_cfg with config() in various files
- Updated multiple files to utilize the new Config class for configuration access. - Replaced instances of $bb_cfg with config()->get() for improved maintainability and consistency. - Ensured backward compatibility while transitioning to the new configuration system. Files modified: - privmsg.php - search.php - terms.php - tracker.php - viewtopic.php - bt/announce.php - bt/scrape.php - bt/includes/init_tr.php - library/ajax/*.php - src/Config.php
This commit is contained in:
parent
30823dd8de
commit
ed9454a78e
25 changed files with 171 additions and 179 deletions
|
@ -11,8 +11,6 @@ define('IN_TRACKER', true);
|
|||
define('BB_ROOT', './../');
|
||||
require dirname(__DIR__) . '/common.php';
|
||||
|
||||
global $bb_cfg;
|
||||
|
||||
// Check User-Agent for existence
|
||||
$userAgent = (string)$_SERVER['HTTP_USER_AGENT'];
|
||||
if (empty($userAgent)) {
|
||||
|
@ -20,8 +18,8 @@ if (empty($userAgent)) {
|
|||
die;
|
||||
}
|
||||
|
||||
$announce_interval = $bb_cfg['announce_interval'];
|
||||
$passkey_key = $bb_cfg['passkey_key'];
|
||||
$announce_interval = config()->get('announce_interval');
|
||||
$passkey_key = config()->get('passkey_key');
|
||||
|
||||
// Recover info_hash
|
||||
if (isset($_GET['?info_hash']) && !isset($_GET['info_hash'])) {
|
||||
|
@ -67,10 +65,10 @@ if (strlen($peer_id) !== 20) {
|
|||
}
|
||||
|
||||
// Check for client ban
|
||||
if ($bb_cfg['client_ban']['enabled']) {
|
||||
if (config()->get('client_ban.enabled')) {
|
||||
$targetClient = [];
|
||||
|
||||
foreach ($bb_cfg['client_ban']['clients'] as $clientId => $banReason) {
|
||||
foreach (config()->get('client_ban.clients') as $clientId => $banReason) {
|
||||
if (str_starts_with($peer_id, $clientId)) {
|
||||
$targetClient = [
|
||||
'peer_id' => $clientId,
|
||||
|
@ -80,7 +78,7 @@ if ($bb_cfg['client_ban']['enabled']) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($bb_cfg['client_ban']['only_allow_mode']) {
|
||||
if (config()->get('client_ban.only_allow_mode')) {
|
||||
if (empty($targetClient['peer_id'])) {
|
||||
msg_die('Your BitTorrent client has been banned!');
|
||||
}
|
||||
|
@ -131,7 +129,7 @@ if (
|
|||
|| !is_numeric($port)
|
||||
|| ($port < 1024 && !$stopped)
|
||||
|| $port > 0xFFFF
|
||||
|| (!empty($bb_cfg['disallowed_ports']) && in_array($port, $bb_cfg['disallowed_ports']))
|
||||
|| (!empty(config()->get('disallowed_ports')) && in_array($port, config()->get('disallowed_ports')))
|
||||
) {
|
||||
msg_die('Invalid port: ' . $port);
|
||||
}
|
||||
|
@ -170,13 +168,13 @@ if (preg_match('/(Mozilla|Browser|Chrome|Safari|AppleWebKit|Opera|Links|Lynx|Bot
|
|||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
// 'ip' query handling
|
||||
if (!$bb_cfg['ignore_reported_ip'] && isset($_GET['ip']) && $ip !== $_GET['ip']) {
|
||||
if (!$bb_cfg['verify_reported_ip'] && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
if (!config()->get('ignore_reported_ip') && isset($_GET['ip']) && $ip !== $_GET['ip']) {
|
||||
if (!config()->get('verify_reported_ip') && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
$x_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
|
||||
if ($x_ip === $_GET['ip']) {
|
||||
$filteredIp = filter_var($x_ip, FILTER_VALIDATE_IP);
|
||||
if ($filteredIp !== false && ($bb_cfg['allow_internal_ip'] || !filter_var($filteredIp, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE))) {
|
||||
if ($filteredIp !== false && (config()->get('allow_internal_ip') || !filter_var($filteredIp, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE))) {
|
||||
$ip = $filteredIp;
|
||||
}
|
||||
}
|
||||
|
@ -272,7 +270,7 @@ if ($lp_info) {
|
|||
define('IS_MOD', !IS_GUEST && (int)$row['user_level'] === MOD);
|
||||
define('IS_GROUP_MEMBER', !IS_GUEST && (int)$row['user_level'] === GROUP_MEMBER);
|
||||
define('IS_USER', !IS_GUEST && (int)$row['user_level'] === USER);
|
||||
define('IS_SUPER_ADMIN', IS_ADMIN && isset($bb_cfg['super_admins'][$user_id]));
|
||||
define('IS_SUPER_ADMIN', IS_ADMIN && isset(config()->get('super_admins')[$user_id]));
|
||||
define('IS_AM', IS_ADMIN || IS_MOD);
|
||||
$topic_id = $row['topic_id'];
|
||||
$releaser = (int)($user_id == $row['poster_id']);
|
||||
|
@ -280,13 +278,13 @@ if ($lp_info) {
|
|||
$tor_status = $row['tor_status'];
|
||||
|
||||
// Check tor status
|
||||
if (!IS_AM && isset($bb_cfg['tor_frozen'][$tor_status]) && !(isset($bb_cfg['tor_frozen_author_download'][$tor_status]) && $releaser)) {
|
||||
if (!IS_AM && isset(config()->get('tor_frozen')[$tor_status]) && !(isset(config()->get('tor_frozen_author_download')[$tor_status]) && $releaser)) {
|
||||
msg_die('Torrent frozen and cannot be downloaded');
|
||||
}
|
||||
|
||||
// Check hybrid status
|
||||
if (!empty($row['info_hash']) && !empty($row['info_hash_v2'])) {
|
||||
$stat_protocol = match ((int)$bb_cfg['tracker']['hybrid_stat_protocol']) {
|
||||
$stat_protocol = match ((int)config()->get('tracker.hybrid_stat_protocol')) {
|
||||
2 => substr($row['info_hash_v2'], 0, 20),
|
||||
default => $row['info_hash'] // 1
|
||||
};
|
||||
|
@ -296,7 +294,7 @@ if ($lp_info) {
|
|||
}
|
||||
|
||||
// Ratio limits
|
||||
if ((RATIO_ENABLED || $bb_cfg['tracker']['limit_concurrent_ips']) && !$stopped) {
|
||||
if ((RATIO_ENABLED || config()->get('tracker.limit_concurrent_ips')) && !$stopped) {
|
||||
$user_ratio = get_bt_ratio($row);
|
||||
if ($user_ratio === null) {
|
||||
$user_ratio = 1;
|
||||
|
@ -304,10 +302,10 @@ if ($lp_info) {
|
|||
$rating_msg = '';
|
||||
|
||||
if (!$seeder) {
|
||||
foreach ($bb_cfg['rating'] as $ratio => $limit) {
|
||||
foreach (config()->get('rating') as $ratio => $limit) {
|
||||
if ($user_ratio < $ratio) {
|
||||
$bb_cfg['tracker']['limit_active_tor'] = 1;
|
||||
$bb_cfg['tracker']['limit_leech_count'] = $limit;
|
||||
config()->set('tracker.limit_active_tor', 1);
|
||||
config()->set('tracker.limit_leech_count', $limit);
|
||||
$rating_msg = " (ratio < $ratio)";
|
||||
break;
|
||||
}
|
||||
|
@ -315,29 +313,29 @@ if ($lp_info) {
|
|||
}
|
||||
|
||||
// Limit active torrents
|
||||
if (!isset($bb_cfg['unlimited_users'][$user_id]) && $bb_cfg['tracker']['limit_active_tor'] && (($bb_cfg['tracker']['limit_seed_count'] && $seeder) || ($bb_cfg['tracker']['limit_leech_count'] && !$seeder))) {
|
||||
if (!isset(config()->get('unlimited_users')[$user_id]) && config()->get('tracker.limit_active_tor') && ((config()->get('tracker.limit_seed_count') && $seeder) || (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
|
||||
AND seeder = $seeder
|
||||
AND topic_id != $topic_id";
|
||||
|
||||
if (!$seeder && $bb_cfg['tracker']['leech_expire_factor'] && $user_ratio < 0.5) {
|
||||
$sql .= " AND update_time > " . (TIMENOW - 60 * $bb_cfg['tracker']['leech_expire_factor']);
|
||||
if (!$seeder && config()->get('tracker.leech_expire_factor') && $user_ratio < 0.5) {
|
||||
$sql .= " AND update_time > " . (TIMENOW - 60 * config()->get('tracker.leech_expire_factor'));
|
||||
}
|
||||
$sql .= " GROUP BY user_id";
|
||||
|
||||
if ($row = DB()->fetch_row($sql)) {
|
||||
if ($seeder && $bb_cfg['tracker']['limit_seed_count'] && $row['active_torrents'] >= $bb_cfg['tracker']['limit_seed_count']) {
|
||||
msg_die('Only ' . $bb_cfg['tracker']['limit_seed_count'] . ' torrent(s) allowed for seeding');
|
||||
} elseif (!$seeder && $bb_cfg['tracker']['limit_leech_count'] && $row['active_torrents'] >= $bb_cfg['tracker']['limit_leech_count']) {
|
||||
msg_die('Only ' . $bb_cfg['tracker']['limit_leech_count'] . ' torrent(s) allowed for leeching' . $rating_msg);
|
||||
if ($seeder && config()->get('tracker.limit_seed_count') && $row['active_torrents'] >= config()->get('tracker.limit_seed_count')) {
|
||||
msg_die('Only ' . config()->get('tracker.limit_seed_count') . ' torrent(s) allowed for seeding');
|
||||
} elseif (!$seeder && config()->get('tracker.limit_leech_count') && $row['active_torrents'] >= config()->get('tracker.limit_leech_count')) {
|
||||
msg_die('Only ' . config()->get('tracker.limit_leech_count') . ' torrent(s) allowed for leeching' . $rating_msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Limit concurrent IPs
|
||||
if ($bb_cfg['tracker']['limit_concurrent_ips'] && (($bb_cfg['tracker']['limit_seed_ips'] && $seeder) || ($bb_cfg['tracker']['limit_leech_ips'] && !$seeder))) {
|
||||
if (config()->get('tracker.limit_concurrent_ips') && ((config()->get('tracker.limit_seed_ips') && $seeder) || (config()->get('tracker.limit_leech_ips') && !$seeder))) {
|
||||
$sql = "SELECT COUNT(DISTINCT ip) AS ips
|
||||
FROM " . BB_BT_TRACKER . "
|
||||
WHERE topic_id = $topic_id
|
||||
|
@ -345,16 +343,16 @@ if ($lp_info) {
|
|||
AND seeder = $seeder
|
||||
AND $ip_version != '$ip_sql'";
|
||||
|
||||
if (!$seeder && $bb_cfg['tracker']['leech_expire_factor']) {
|
||||
$sql .= " AND update_time > " . (TIMENOW - 60 * $bb_cfg['tracker']['leech_expire_factor']);
|
||||
if (!$seeder && config()->get('tracker.leech_expire_factor')) {
|
||||
$sql .= " AND update_time > " . (TIMENOW - 60 * config()->get('tracker.leech_expire_factor'));
|
||||
}
|
||||
$sql .= " GROUP BY topic_id";
|
||||
|
||||
if ($row = DB()->fetch_row($sql)) {
|
||||
if ($seeder && $bb_cfg['tracker']['limit_seed_ips'] && $row['ips'] >= $bb_cfg['tracker']['limit_seed_ips']) {
|
||||
msg_die('You can seed only from ' . $bb_cfg['tracker']['limit_seed_ips'] . " IP's");
|
||||
} elseif (!$seeder && $bb_cfg['tracker']['limit_leech_ips'] && $row['ips'] >= $bb_cfg['tracker']['limit_leech_ips']) {
|
||||
msg_die('You can leech only from ' . $bb_cfg['tracker']['limit_leech_ips'] . " IP's");
|
||||
if ($seeder && config()->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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -378,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 ($bb_cfg['tracker']['gold_silver_enabled'] && $down_add) {
|
||||
if (config()->get('tracker.gold_silver_enabled') && $down_add) {
|
||||
if ($tor_type == TOR_TYPE_GOLD) {
|
||||
$down_add = 0;
|
||||
} // Silver releases
|
||||
|
@ -388,7 +386,7 @@ if ($bb_cfg['tracker']['gold_silver_enabled'] && $down_add) {
|
|||
}
|
||||
|
||||
// Freeleech
|
||||
if ($bb_cfg['tracker']['freeleech'] && $down_add) {
|
||||
if (config()->get('tracker.freeleech') && $down_add) {
|
||||
$down_add = 0;
|
||||
}
|
||||
|
||||
|
@ -466,8 +464,8 @@ $output = CACHE('tr_cache')->get(PEERS_LIST_PREFIX . $topic_id);
|
|||
|
||||
if (!$output) {
|
||||
// Retrieve peers
|
||||
$numwant = (int)$bb_cfg['tracker']['numwant'];
|
||||
$compact_mode = ($bb_cfg['tracker']['compact_mode'] || !empty($compact));
|
||||
$numwant = (int)config()->get('tracker.numwant');
|
||||
$compact_mode = (config()->get('tracker.compact_mode') || !empty($compact));
|
||||
|
||||
$rowset = DB()->fetch_rowset("
|
||||
SELECT ip, ipv6, port
|
||||
|
@ -512,7 +510,7 @@ if (!$output) {
|
|||
|
||||
$seeders = $leechers = $client_completed = 0;
|
||||
|
||||
if ($bb_cfg['tracker']['scrape']) {
|
||||
if (config()->get('tracker.scrape')) {
|
||||
$row = DB()->fetch_row("
|
||||
SELECT seeders, leechers, completed
|
||||
FROM " . BB_BT_TRACKER_SNAP . "
|
||||
|
|
|
@ -11,11 +11,9 @@ if (!defined('IN_TRACKER')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg;
|
||||
|
||||
// Exit if tracker is disabled
|
||||
if ($bb_cfg['tracker']['bt_off']) {
|
||||
msg_die($bb_cfg['tracker']['bt_off_reason']);
|
||||
if (config()->get('tracker.bt_off')) {
|
||||
msg_die(config()->get('tracker.bt_off_reason'));
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -11,9 +11,7 @@ define('IN_TRACKER', true);
|
|||
define('BB_ROOT', './../');
|
||||
require dirname(__DIR__) . '/common.php';
|
||||
|
||||
global $bb_cfg;
|
||||
|
||||
if (!$bb_cfg['tracker']['scrape']) {
|
||||
if (!config()->get('tracker.scrape')) {
|
||||
msg_die('Please disable SCRAPE!');
|
||||
}
|
||||
|
||||
|
@ -60,8 +58,8 @@ foreach ($info_hash_array[1] as $hash) {
|
|||
$info_hash_count = count($info_hashes);
|
||||
|
||||
if (!empty($info_hash_count)) {
|
||||
if ($info_hash_count > $bb_cfg['max_scrapes']) {
|
||||
$info_hashes = array_slice($info_hashes, 0, $bb_cfg['max_scrapes']);
|
||||
if ($info_hash_count > config()->get('max_scrapes')) {
|
||||
$info_hashes = array_slice($info_hashes, 0, config()->get('max_scrapes'));
|
||||
}
|
||||
|
||||
$info_hashes_sql = implode('\', \'', $info_hashes);
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg, $lang, $user;
|
||||
global $lang, $user;
|
||||
|
||||
if (!$mode = (string)$this->request['mode']) {
|
||||
$this->ajax_die('invalid mode (empty)');
|
||||
|
|
|
@ -11,9 +11,9 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg, $userdata, $lang;
|
||||
global $userdata, $lang;
|
||||
|
||||
if (!$bb_cfg['callseed']) {
|
||||
if (!config()->get('callseed')) {
|
||||
$this->ajax_die($lang['MODULE_OFF']);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ if ($t_data['seeders'] >= 3) {
|
|||
} elseif ($t_data['call_seed_time'] >= (TIMENOW - 86400)) {
|
||||
$time_left = delta_time($t_data['call_seed_time'] + 86400, TIMENOW, 'days');
|
||||
$this->ajax_die(sprintf($lang['CALLSEED_MSG_SPAM'], $time_left));
|
||||
} elseif (isset($bb_cfg['tor_no_tor_act'][$t_data['tor_status']])) {
|
||||
} elseif (isset(config()->get('tor_no_tor_act')[$t_data['tor_status']])) {
|
||||
$this->ajax_die($lang['NOT_AVAILABLE']);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $userdata, $bb_cfg, $lang, $log_action;
|
||||
global $userdata, $lang, $log_action;
|
||||
|
||||
if (!$attach_id = (int)$this->request['attach_id']) {
|
||||
$this->ajax_die($lang['EMPTY_ATTACH_ID']);
|
||||
|
@ -22,7 +22,7 @@ if (!$mode = (string)$this->request['mode']) {
|
|||
}
|
||||
|
||||
$comment = false;
|
||||
if ($bb_cfg['tor_comment']) {
|
||||
if (config()->get('tor_comment')) {
|
||||
$comment = (string)$this->request['comment'];
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ switch ($mode) {
|
|||
\TorrentPier\Legacy\Torrent::change_tor_status($attach_id, $new_status);
|
||||
|
||||
// Log action
|
||||
$log_msg = sprintf($lang['TOR_STATUS_LOG_ACTION'], $bb_cfg['tor_icons'][$new_status] . ' <b> ' . $lang['TOR_STATUS_NAME'][$new_status] . '</b>', $bb_cfg['tor_icons'][$tor['tor_status']] . ' <b> ' . $lang['TOR_STATUS_NAME'][$tor['tor_status']] . '</b>');
|
||||
$log_msg = sprintf($lang['TOR_STATUS_LOG_ACTION'], config()->get('tor_icons')[$new_status] . ' <b> ' . $lang['TOR_STATUS_NAME'][$new_status] . '</b>', config()->get('tor_icons')[$tor['tor_status']] . ' <b> ' . $lang['TOR_STATUS_NAME'][$tor['tor_status']] . '</b>');
|
||||
if ($comment && $comment != $lang['COMMENT']) {
|
||||
$log_msg .= "<br/>{$lang['COMMENT']}: <b>$comment</b>.";
|
||||
}
|
||||
|
@ -99,12 +99,12 @@ switch ($mode) {
|
|||
'log_msg' => $log_msg . '<br/>-------------',
|
||||
]);
|
||||
|
||||
$this->response['status'] = $bb_cfg['tor_icons'][$new_status] . ' <b> ' . $lang['TOR_STATUS_NAME'][$new_status] . '</b> · ' . profile_url($userdata) . ' · <i>' . delta_time(TIMENOW) . $lang['TOR_BACK'] . '</i>';
|
||||
$this->response['status'] = config()->get('tor_icons')[$new_status] . ' <b> ' . $lang['TOR_STATUS_NAME'][$new_status] . '</b> · ' . profile_url($userdata) . ' · <i>' . delta_time(TIMENOW) . $lang['TOR_BACK'] . '</i>';
|
||||
|
||||
if ($bb_cfg['tor_comment'] && (($comment && $comment != $lang['COMMENT']) || in_array($new_status, $bb_cfg['tor_reply']))) {
|
||||
if (config()->get('tor_comment') && (($comment && $comment != $lang['COMMENT']) || in_array($new_status, config()->get('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()->get('tor_icons')[$new_status] . ' ' . $lang['TOR_STATUS_NAME'][$new_status]);
|
||||
|
||||
if ($comment && $comment != $lang['COMMENT']) {
|
||||
$message .= "\n\n[b]" . $lang['COMMENT'] . '[/b]: ' . $comment;
|
||||
|
@ -117,7 +117,7 @@ switch ($mode) {
|
|||
break;
|
||||
|
||||
case 'status_reply':
|
||||
if (!$bb_cfg['tor_comment']) {
|
||||
if (!config()->get('tor_comment')) {
|
||||
$this->ajax_die($lang['MODULE_OFF']);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $userdata, $bb_cfg, $lang, $log_action;
|
||||
global $userdata, $lang, $log_action;
|
||||
|
||||
if (!isset($this->request['attach_id'])) {
|
||||
$this->ajax_die($lang['EMPTY_ATTACH_ID']);
|
||||
|
|
|
@ -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 = \TorrentPier\Legacy\Group::get_group_data($group_id)) {
|
||||
$this->ajax_die($lang['NO_GROUP_ID_SPECIFIED']);
|
||||
|
|
|
@ -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']);
|
||||
|
@ -55,7 +55,7 @@ switch ($field) {
|
|||
break;
|
||||
|
||||
case 'user_gender':
|
||||
if (!$bb_cfg['gender']) {
|
||||
if (!config()->get('gender')) {
|
||||
$this->ajax_die($lang['MODULE_OFF']);
|
||||
}
|
||||
if (!isset($lang['GENDER_SELECT'][$value])) {
|
||||
|
@ -65,7 +65,7 @@ switch ($field) {
|
|||
break;
|
||||
|
||||
case 'user_birthday':
|
||||
if (!$bb_cfg['birthday_enabled']) {
|
||||
if (!config()->get('birthday_enabled')) {
|
||||
$this->ajax_die($lang['MODULE_OFF']);
|
||||
}
|
||||
$birthday_date = date_parse($value);
|
||||
|
@ -73,10 +73,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()->get('birthday_max_age')) {
|
||||
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_HIGH'], config()->get('birthday_max_age')));
|
||||
} elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] < config()->get('birthday_min_age')) {
|
||||
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_LOW'], config()->get('birthday_min_age')));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,13 +11,13 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg, $lang;
|
||||
global $lang;
|
||||
|
||||
if (!$bb_cfg['torr_server']['enabled']) {
|
||||
if (!config()->get('torr_server.enabled')) {
|
||||
$this->ajax_die($lang['MODULE_OFF']);
|
||||
}
|
||||
|
||||
if ($bb_cfg['torr_server']['disable_for_guest'] && IS_GUEST) {
|
||||
if (config()->get('torr_server.disable_for_guest') && IS_GUEST) {
|
||||
$this->ajax_die($lang['NEED_TO_LOGIN_FIRST']);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg, $lang, $userdata, $datastore;
|
||||
global $lang, $userdata, $datastore;
|
||||
|
||||
if (!$mode = (string)$this->request['mode']) {
|
||||
$this->ajax_die('invalid mode (empty)');
|
||||
|
@ -31,9 +31,9 @@ switch ($mode) {
|
|||
foreach ($stats['birthday_week_list'] as $week) {
|
||||
$users[] = profile_url($week) . ' <span class="small">(' . birthday_age(date('Y-m-d', strtotime('-1 year', strtotime($week['user_birthday'])))) . ')</span>';
|
||||
}
|
||||
$html = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], implode(', ', $users));
|
||||
$html = sprintf($lang['BIRTHDAY_WEEK'], config()->get('birthday_check_day'), implode(', ', $users));
|
||||
} else {
|
||||
$html = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']);
|
||||
$html = sprintf($lang['NOBIRTHDAY_WEEK'], config()->get('birthday_check_day'));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -84,7 +84,7 @@ switch ($mode) {
|
|||
break;
|
||||
|
||||
case 'null_ratio':
|
||||
if (!$bb_cfg['ratio_null_enabled'] || !RATIO_ENABLED) {
|
||||
if (!config()->get('ratio_null_enabled') || !RATIO_ENABLED) {
|
||||
$this->ajax_die($lang['MODULE_OFF']);
|
||||
}
|
||||
if (empty($this->request['confirmed'])) {
|
||||
|
@ -106,8 +106,8 @@ switch ($mode) {
|
|||
if ($ratio_nulled && !IS_ADMIN) {
|
||||
$this->ajax_die($lang['BT_NULL_RATIO_AGAIN']);
|
||||
}
|
||||
if (($user_ratio >= $bb_cfg['ratio_to_null']) && !IS_ADMIN) {
|
||||
$this->ajax_die(sprintf($lang['BT_NULL_RATIO_NOT_NEEDED'], $bb_cfg['ratio_to_null']));
|
||||
if (($user_ratio >= config()->get('ratio_to_null')) && !IS_ADMIN) {
|
||||
$this->ajax_die(sprintf($lang['BT_NULL_RATIO_NOT_NEEDED'], config()->get('ratio_to_null')));
|
||||
}
|
||||
|
||||
$ratio_nulled_sql = !IS_ADMIN ? ', ratio_nulled = 1' : '';
|
||||
|
@ -172,7 +172,7 @@ switch ($mode) {
|
|||
<th>' . $lang['UPLOADED'] . '</th>
|
||||
<th>' . $lang['RELEASED'] . '</th>
|
||||
<th>' . $lang['BONUS'] . '</th>';
|
||||
$html .= $bb_cfg['seed_bonus_enabled'] ? '<th>' . $lang['SEED_BONUS'] . '</th>' : '';
|
||||
$html .= config()->get('seed_bonus_enabled') ? '<th>' . $lang['SEED_BONUS'] . '</th>' : '';
|
||||
$html .= '</tr>
|
||||
<tr class="row1">
|
||||
<td>' . $lang['TOTAL_TRAF'] . '</td>
|
||||
|
@ -180,17 +180,17 @@ switch ($mode) {
|
|||
<td id="u_up_total"><span class="editable bold seedmed">' . humn_size($btu['u_up_total']) . '</span></td>
|
||||
<td id="u_up_release"><span class="editable bold seedmed">' . humn_size($btu['u_up_release']) . '</span></td>
|
||||
<td id="u_up_bonus"><span class="editable bold seedmed">' . humn_size($btu['u_up_bonus']) . '</span></td>';
|
||||
$html .= $bb_cfg['seed_bonus_enabled'] ? '<td id="user_points"><span class="editable bold points">' . $profiledata['user_points'] . '</b></td>' : '';
|
||||
$html .= config()->get('seed_bonus_enabled') ? '<td id="user_points"><span class="editable bold points">' . $profiledata['user_points'] . '</b></td>' : '';
|
||||
$html .= '</tr>
|
||||
<tr class="row5">
|
||||
<td colspan="1">' . $lang['MAX_SPEED'] . '</td>
|
||||
<td colspan="2">' . $lang['DL_DL_SPEED'] . ': ' . $speed_down . '</span></td>
|
||||
<td colspan="2">' . $lang['DL_UL_SPEED'] . ': ' . $speed_up . '</span></td>';
|
||||
$html .= $bb_cfg['seed_bonus_enabled'] ? '<td colspan="1"></td>' : '';
|
||||
$html .= config()->get('seed_bonus_enabled') ? '<td colspan="1"></td>' : '';
|
||||
$html .= '</tr>';
|
||||
|
||||
$this->response['user_ratio'] = '
|
||||
<th><a href="' . $bb_cfg['ratio_url_help'] . '" class="bold">' . $lang['USER_RATIO'] . '</a>:</th>
|
||||
<th><a href="' . config()->get('ratio_url_help') . '" class="bold">' . $lang['USER_RATIO'] . '</a>:</th>
|
||||
<td>' . $user_ratio . '</td>
|
||||
';
|
||||
break;
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $userdata, $lang, $bb_cfg;
|
||||
global $userdata, $lang;
|
||||
|
||||
if (!$mode = (string)$this->request['mode']) {
|
||||
$this->ajax_die('invalid mode (empty)');
|
||||
|
@ -19,7 +19,7 @@ if (!$mode = (string)$this->request['mode']) {
|
|||
|
||||
switch ($mode) {
|
||||
case 'clear_cache':
|
||||
foreach ($bb_cfg['cache']['engines'] as $cache_name => $cache_val) {
|
||||
foreach (config()->get('cache.engines') as $cache_name => $cache_val) {
|
||||
CACHE($cache_name)->rm();
|
||||
}
|
||||
|
||||
|
@ -48,20 +48,20 @@ switch ($mode) {
|
|||
$this->response['template_cache_html'] = '<span class="seed bold">' . $lang['ALL_TEMPLATE_CLEARED'] . '</span>';
|
||||
break;
|
||||
case 'indexer':
|
||||
exec("indexer --config {$bb_cfg['sphinx_config_path']} --all --rotate", $result);
|
||||
exec("indexer --config " . config()->get('sphinx_config_path') . " --all --rotate", $result);
|
||||
|
||||
if (!is_file($bb_cfg['sphinx_config_path'] . ".log")) {
|
||||
file_put_contents($bb_cfg['sphinx_config_path'] . ".log", "##############################" . date("H:i:s", TIMENOW) . "##############################\r\n\r\n\r\n\r\n", FILE_APPEND);
|
||||
if (!is_file(config()->get('sphinx_config_path') . ".log")) {
|
||||
file_put_contents(config()->get('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()->get('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()->get('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()->get('sphinx_config_path') . ".log", "\r\n", FILE_APPEND);
|
||||
file_put_contents(config()->get('sphinx_config_path') . ".log", "\r\n", FILE_APPEND);
|
||||
|
||||
$this->response['indexer_html'] = '<span class="seed bold">' . $lang['INDEXER'] . '</span>';
|
||||
break;
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $userdata, $lang, $bb_cfg;
|
||||
global $userdata, $lang;
|
||||
|
||||
if (!$mode = (string)$this->request['mode']) {
|
||||
$this->ajax_die('invalid mode (empty)');
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $userdata, $bb_cfg, $lang, $datastore, $log_action;
|
||||
global $userdata, $lang, $datastore, $log_action;
|
||||
|
||||
if (!$mode = (string)$this->request['mode']) {
|
||||
$this->ajax_die('invalid mode (empty)');
|
||||
|
@ -44,7 +44,7 @@ switch ($mode) {
|
|||
\TorrentPier\Legacy\Torrent::change_tor_status($attach_id, $status);
|
||||
|
||||
// Log action
|
||||
$log_msg = sprintf($lang['TOR_STATUS_LOG_ACTION'], $bb_cfg['tor_icons'][$status] . ' <b> ' . $lang['TOR_STATUS_NAME'][$status] . '</b>', $bb_cfg['tor_icons'][$tor['tor_status']] . ' <b> ' . $lang['TOR_STATUS_NAME'][$tor['tor_status']] . '</b>');
|
||||
$log_msg = sprintf($lang['TOR_STATUS_LOG_ACTION'], config()->get('tor_icons')[$status] . ' <b> ' . $lang['TOR_STATUS_NAME'][$status] . '</b>', config()->get('tor_icons')[$tor['tor_status']] . ' <b> ' . $lang['TOR_STATUS_NAME'][$tor['tor_status']] . '</b>');
|
||||
$log_action->mod('mod_topic_change_tor_status', [
|
||||
'forum_id' => $tor['forum_id'],
|
||||
'topic_id' => $tor['topic_id'],
|
||||
|
@ -52,7 +52,7 @@ switch ($mode) {
|
|||
'log_msg' => $log_msg . '<br/>-------------',
|
||||
]);
|
||||
}
|
||||
$this->response['status'] = $bb_cfg['tor_icons'][$status];
|
||||
$this->response['status'] = config()->get('tor_icons')[$status];
|
||||
$this->response['topics'] = explode(',', $topics);
|
||||
break;
|
||||
|
||||
|
@ -78,16 +78,16 @@ switch ($mode) {
|
|||
DB()->query("UPDATE " . BB_TOPICS . " SET topic_title = '$topic_title_sql' WHERE topic_id = $topic_id LIMIT 1");
|
||||
|
||||
// Update the news cache on the index page
|
||||
$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()->get('latest_news_forum_id')));
|
||||
if (isset($news_forums[$t_data['forum_id']]) && config()->get('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()->get('network_news_forum_id')));
|
||||
if (isset($net_forums[$t_data['forum_id']]) && config()->get('show_network_news')) {
|
||||
$datastore->enqueue([
|
||||
'network_news'
|
||||
]);
|
||||
|
@ -151,8 +151,8 @@ switch ($mode) {
|
|||
} else {
|
||||
$user_reg_ip = \TorrentPier\Helpers\IPHelper::long2ip_extended($profiledata['user_reg_ip']);
|
||||
$user_last_ip = \TorrentPier\Helpers\IPHelper::long2ip_extended($profiledata['user_last_ip']);
|
||||
$reg_ip = '<a href="' . $bb_cfg['whois_info'] . $user_reg_ip . '" class="gen" target="_blank">' . $user_reg_ip . '</a>';
|
||||
$last_ip = '<a href="' . $bb_cfg['whois_info'] . $user_last_ip . '" class="gen" target="_blank">' . $user_last_ip . '</a>';
|
||||
$reg_ip = '<a href="' . config()->get('whois_info') . $user_reg_ip . '" class="gen" target="_blank">' . $user_reg_ip . '</a>';
|
||||
$last_ip = '<a href="' . config()->get('whois_info') . $user_last_ip . '" class="gen" target="_blank">' . $user_last_ip . '</a>';
|
||||
}
|
||||
|
||||
$this->response['ip_list_html'] = '
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $lang, $bb_cfg, $userdata, $wordCensor;
|
||||
global $lang, $userdata, $wordCensor;
|
||||
|
||||
if (!isset($this->request['type'])) {
|
||||
$this->ajax_die('empty type');
|
||||
|
@ -76,7 +76,7 @@ switch ($this->request['type']) {
|
|||
$message = "[quote=\"" . $quote_username . "\"][qpost=" . $post['post_id'] . "]" . $post['post_text'] . "[/quote]\r";
|
||||
|
||||
// hide user passkey
|
||||
$message = preg_replace('#(?<=[\?&;]' . $bb_cfg['passkey_key'] . '=)[a-zA-Z0-9]#', 'passkey', $message);
|
||||
$message = preg_replace('#(?<=[\?&;]' . config()->get('passkey_key') . '=)[a-zA-Z0-9]#', 'passkey', $message);
|
||||
// hide sid
|
||||
$message = preg_replace('#(?<=[\?&;]sid=)[a-zA-Z0-9]#', 'sid', $message);
|
||||
|
||||
|
@ -120,10 +120,10 @@ switch ($this->request['type']) {
|
|||
|
||||
if (mb_strlen($text) > 2) {
|
||||
if ($text != $post['post_text']) {
|
||||
if ($bb_cfg['max_smilies']) {
|
||||
$count_smilies = substr_count(bbcode2html($text), '<img class="smile" src="' . $bb_cfg['smilies_path']);
|
||||
if ($count_smilies > $bb_cfg['max_smilies']) {
|
||||
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies']));
|
||||
if (config()->get('max_smilies')) {
|
||||
$count_smilies = substr_count(bbcode2html($text), '<img class="smile" src="' . config()->get('smilies_path'));
|
||||
if ($count_smilies > config()->get('max_smilies')) {
|
||||
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], config()->get('max_smilies')));
|
||||
}
|
||||
}
|
||||
DB()->query("UPDATE " . BB_POSTS_TEXT . " SET post_text = '" . DB()->escape($text) . "' WHERE post_id = $post_id LIMIT 1");
|
||||
|
@ -225,7 +225,7 @@ switch ($this->request['type']) {
|
|||
$sql = "SELECT MAX(p.post_time) AS last_post_time FROM " . BB_POSTS . " p WHERE $where_sql";
|
||||
if ($row = 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()->get('flood_interval')) {
|
||||
$this->ajax_die($lang['FLOOD_ERROR']);
|
||||
}
|
||||
}
|
||||
|
@ -251,10 +251,10 @@ switch ($this->request['type']) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($bb_cfg['max_smilies']) {
|
||||
$count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="' . $bb_cfg['smilies_path']);
|
||||
if ($count_smilies > $bb_cfg['max_smilies']) {
|
||||
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies']));
|
||||
if (config()->get('max_smilies')) {
|
||||
$count_smilies = substr_count(bbcode2html($message), '<img class="smile" src="' . config()->get('smilies_path'));
|
||||
if ($count_smilies > config()->get('max_smilies')) {
|
||||
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], config()->get('max_smilies')));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ switch ($this->request['type']) {
|
|||
'post_text' => $message
|
||||
]);
|
||||
|
||||
if ($bb_cfg['topic_notify_enabled']) {
|
||||
if (config()->get('topic_notify_enabled')) {
|
||||
$notify = !empty($this->request['notify']);
|
||||
\TorrentPier\Legacy\Post::user_notification('reply', $post, $post['topic_title'], $post['forum_id'], $topic_id, $notify);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg, $lang;
|
||||
global $lang;
|
||||
|
||||
if (!$mode = (string)$this->request['mode']) {
|
||||
$this->ajax_die('invalid mode (empty)');
|
||||
|
@ -24,7 +24,7 @@ switch ($mode) {
|
|||
case 'create':
|
||||
$map->createSitemap();
|
||||
if (is_file(SITEMAP_DIR . '/sitemap.xml')) {
|
||||
$html .= $lang['SITEMAP_CREATED'] . ': <b>' . bb_date(TIMENOW, $bb_cfg['post_date_format']) . '</b> ' . $lang['SITEMAP_AVAILABLE'] . ': <a href="' . make_url('sitemap/sitemap.xml') . '" target="_blank">' . make_url('sitemap/sitemap.xml') . '</a>';
|
||||
$html .= $lang['SITEMAP_CREATED'] . ': <b>' . bb_date(TIMENOW, config()->get('post_date_format')) . '</b> ' . $lang['SITEMAP_AVAILABLE'] . ': <a href="' . make_url('sitemap/sitemap.xml') . '" target="_blank">' . make_url('sitemap/sitemap.xml') . '</a>';
|
||||
} else {
|
||||
$html .= $lang['SITEMAP_NOT_CREATED'];
|
||||
}
|
||||
|
|
|
@ -11,9 +11,9 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg, $lang, $userdata;
|
||||
global $lang, $userdata;
|
||||
|
||||
if (!$bb_cfg['tor_thank']) {
|
||||
if (!config()->get('tor_thank')) {
|
||||
$this->ajax_die($lang['MODULE_OFF']);
|
||||
}
|
||||
|
||||
|
@ -49,12 +49,12 @@ switch ($mode) {
|
|||
|
||||
// Limit voters per topic
|
||||
$thanks_count = DB()->fetch_row('SELECT COUNT(*) as thx FROM ' . BB_THX . " WHERE topic_id = $topic_id")['thx'];
|
||||
if ($thanks_count > (int)$bb_cfg['tor_thank_limit_per_topic']) {
|
||||
if ($thanks_count > (int)config()->get('tor_thank_limit_per_topic')) {
|
||||
DB()->query('DELETE FROM ' . BB_THX . " WHERE topic_id = $topic_id ORDER BY time ASC LIMIT 1");
|
||||
}
|
||||
break;
|
||||
case 'get':
|
||||
if (IS_GUEST && !$bb_cfg['tor_thanks_list_guests']) {
|
||||
if (IS_GUEST && !config()->get('tor_thanks_list_guests')) {
|
||||
$this->ajax_die($lang['NEED_TO_LOGIN_FIRST']);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $bb_cfg, $lang, $userdata;
|
||||
global $lang, $userdata;
|
||||
|
||||
if (!$mode = (string)$this->request['mode']) {
|
||||
$this->ajax_die('invalid mode (empty)');
|
||||
|
|
|
@ -11,11 +11,11 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $user, $lang, $bb_cfg;
|
||||
global $user, $lang;
|
||||
|
||||
$post_id = isset($this->request['post_id']) ? (int)$this->request['post_id'] : null;
|
||||
$topic_id = isset($this->request['topic_id']) ? (int)$this->request['topic_id'] : null;
|
||||
$return_text = $bb_cfg['show_post_bbcode_button']['enabled'] && isset($this->request['return_text']) && (bool)$this->request['return_text'];
|
||||
$return_text = config()->get('show_post_bbcode_button.enabled') && isset($this->request['return_text']) && (bool)$this->request['return_text'];
|
||||
|
||||
if (is_null($post_id)) {
|
||||
$post_id = DB()->fetch_row("SELECT topic_first_post_id FROM " . BB_TOPICS . " WHERE topic_id = $topic_id", 'topic_first_post_id');
|
||||
|
|
32
privmsg.php
32
privmsg.php
|
@ -24,7 +24,7 @@ $page_cfg['load_tpl_vars'] = [
|
|||
//
|
||||
// Is PM disabled?
|
||||
//
|
||||
if ($bb_cfg['privmsg_disable']) {
|
||||
if (config()->get('privmsg_disable')) {
|
||||
bb_die('PM_DISABLED');
|
||||
}
|
||||
|
||||
|
@ -59,13 +59,13 @@ $user->session_start(['req_login' => true]);
|
|||
|
||||
$template->assign_vars([
|
||||
'IN_PM' => true,
|
||||
'QUICK_REPLY' => $bb_cfg['show_quick_reply'] && $folder == 'inbox' && $mode == 'read',
|
||||
'QUICK_REPLY' => config()->get('show_quick_reply') && $folder == 'inbox' && $mode == 'read',
|
||||
]);
|
||||
|
||||
//
|
||||
// Set mode for quick reply
|
||||
//
|
||||
if (empty($mode) && $bb_cfg['show_quick_reply'] && $folder == 'inbox' && $preview) {
|
||||
if (empty($mode) && config()->get('show_quick_reply') && $folder == 'inbox' && $preview) {
|
||||
$mode = 'reply';
|
||||
}
|
||||
|
||||
|
@ -206,7 +206,7 @@ if ($mode == 'read') {
|
|||
}
|
||||
|
||||
if ($sent_info = DB()->sql_fetchrow($result)) {
|
||||
if ($bb_cfg['max_sentbox_privmsgs'] && $sent_info['sent_items'] >= $bb_cfg['max_sentbox_privmsgs']) {
|
||||
if (config()->get('max_sentbox_privmsgs') && $sent_info['sent_items'] >= 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'] . "
|
||||
|
@ -604,7 +604,7 @@ if ($mode == 'read') {
|
|||
}
|
||||
|
||||
if ($saved_info = DB()->sql_fetchrow($result)) {
|
||||
if ($bb_cfg['max_savebox_privmsgs'] && $saved_info['savebox_items'] >= $bb_cfg['max_savebox_privmsgs']) {
|
||||
if (config()->get('max_savebox_privmsgs') && $saved_info['savebox_items'] >= 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 . " )
|
||||
|
@ -749,7 +749,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()->get('flood_interval')) {
|
||||
bb_die($lang['FLOOD_ERROR']);
|
||||
}
|
||||
}
|
||||
|
@ -802,11 +802,11 @@ if ($mode == 'read') {
|
|||
}
|
||||
|
||||
// Check smilies limit
|
||||
if ($bb_cfg['max_smilies_pm']) {
|
||||
$count_smilies = substr_count(bbcode2html($privmsg_message), '<img class="smile" src="' . $bb_cfg['smilies_path']);
|
||||
if ($count_smilies > $bb_cfg['max_smilies_pm']) {
|
||||
if (config()->get('max_smilies_pm')) {
|
||||
$count_smilies = substr_count(bbcode2html($privmsg_message), '<img class="smile" src="' . config()->get('smilies_path'));
|
||||
if ($count_smilies > config()->get('max_smilies_pm')) {
|
||||
$error = true;
|
||||
$error_msg .= ((!empty($error_msg)) ? '<br />' : '') . sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies_pm']);
|
||||
$error_msg .= ((!empty($error_msg)) ? '<br />' : '') . sprintf($lang['MAX_SMILIES_PER_POST'], config()->get('max_smilies_pm'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -834,7 +834,7 @@ if ($mode == 'read') {
|
|||
}
|
||||
|
||||
if ($inbox_info = DB()->sql_fetchrow($result)) {
|
||||
if ($bb_cfg['max_inbox_privmsgs'] && $inbox_info['inbox_items'] >= $bb_cfg['max_inbox_privmsgs']) {
|
||||
if (config()->get('max_inbox_privmsgs') && $inbox_info['inbox_items'] >= config()->get('max_inbox_privmsgs')) {
|
||||
$sql = "SELECT privmsgs_id FROM " . BB_PRIVMSGS . "
|
||||
WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
|
||||
OR privmsgs_type = " . PRIVMSGS_READ_MAIL . "
|
||||
|
@ -902,7 +902,7 @@ if ($mode == 'read') {
|
|||
|
||||
\TorrentPier\Sessions::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()->get('pm_notify_enabled')) {
|
||||
// Sending email
|
||||
$emailer = new TorrentPier\Emailer();
|
||||
|
||||
|
@ -1252,7 +1252,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()->get('topics_per_page');
|
||||
$sql_all_tot = $sql_tot;
|
||||
$sql_tot .= $limit_msg_time_total;
|
||||
|
||||
|
@ -1308,11 +1308,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()->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) * $bb_cfg['privmsg_graphic_length']), $bb_cfg['privmsg_graphic_length']);
|
||||
$box_limit_img_length = min(round(($pm_all_total / $max_pm) * config()->get('privmsg_graphic_length')), config()->get('privmsg_graphic_length'));
|
||||
$box_limit_remain = max(($max_pm - $pm_all_total), 0);
|
||||
|
||||
$template->assign_var('PM_BOX_SIZE_INFO');
|
||||
|
@ -1410,7 +1410,7 @@ if ($mode == 'read') {
|
|||
]);
|
||||
} while ($row = 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()->get('topics_per_page'), $start);
|
||||
} else {
|
||||
$template->assign_block_vars('switch_no_messages', []);
|
||||
}
|
||||
|
|
22
search.php
22
search.php
|
@ -20,7 +20,7 @@ $page_cfg['load_tpl_vars'] = [
|
|||
];
|
||||
|
||||
// Start session management
|
||||
$user->session_start(array('req_login' => $bb_cfg['disable_search_for_guest']));
|
||||
$user->session_start(array('req_login' => config()->get('disable_search_for_guest')));
|
||||
|
||||
set_die_append_msg();
|
||||
|
||||
|
@ -289,7 +289,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()->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'),
|
||||
|
@ -421,7 +421,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()->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'])));
|
||||
|
@ -433,7 +433,7 @@ $SQL = 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()->get('posts_per_page');
|
||||
$display_as_val = $as_posts;
|
||||
|
||||
// Run initial search for post_ids
|
||||
|
@ -593,7 +593,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()->get('post_date_format')),
|
||||
'IS_UNREAD' => is_unread($post['post_time'], $topic_id, $forum_id),
|
||||
'MESSAGE' => $message,
|
||||
'POSTED_AFTER' => '',
|
||||
|
@ -612,7 +612,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()->get('topics_per_page');
|
||||
$display_as_val = $as_topics;
|
||||
|
||||
// Run initial search for topic_ids
|
||||
|
@ -733,7 +733,7 @@ else {
|
|||
|
||||
// Build SQL for displaying topics
|
||||
$SQL = DB()->get_empty_sql_array();
|
||||
$join_dl = ($bb_cfg['show_dl_status_in_search'] && !IS_GUEST);
|
||||
$join_dl = (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,
|
||||
|
@ -790,7 +790,7 @@ else {
|
|||
'TOPIC_TITLE' => $wordCensor->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'], $bb_cfg['posts_per_page']),
|
||||
'PAGINATION' => $moved ? '' : build_topic_pagination(TOPIC_URL . $topic_id, $topic['topic_replies'], config()->get('posts_per_page')),
|
||||
'REPLIES' => $moved ? '' : $topic['topic_replies'],
|
||||
'ATTACH' => $topic['topic_attachment'],
|
||||
'STATUS' => $topic['topic_status'],
|
||||
|
@ -888,15 +888,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()->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'] > $bb_cfg['limit_max_search_results']) {
|
||||
if ($row['rows_count'] > 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');
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace TorrentPier;
|
|||
|
||||
/**
|
||||
* Configuration management class
|
||||
*
|
||||
*
|
||||
* Encapsulates the global $bb_cfg array and provides methods to access configuration values
|
||||
*/
|
||||
class Config
|
||||
|
@ -179,4 +179,4 @@ class Config
|
|||
{
|
||||
throw new \Exception("Cannot unserialize a singleton.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,13 +15,13 @@ require INC_DIR . '/bbcode.php';
|
|||
// Start session management
|
||||
$user->session_start();
|
||||
|
||||
if (!$bb_cfg['terms'] && !IS_ADMIN) {
|
||||
if (!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($bb_cfg['terms']),
|
||||
'TERMS_HTML' => bbcode2html(config()->get('terms')),
|
||||
]);
|
||||
|
||||
print_page('terms.tpl');
|
||||
|
|
16
tracker.php
16
tracker.php
|
@ -19,7 +19,7 @@ $page_cfg['load_tpl_vars'] = [
|
|||
];
|
||||
|
||||
// Session start
|
||||
$user->session_start(array('req_login' => $bb_cfg['bt_tor_browse_only_reg']));
|
||||
$user->session_start(array('req_login' => config()->get('bt_tor_browse_only_reg')));
|
||||
|
||||
set_die_append_msg();
|
||||
|
||||
|
@ -30,7 +30,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 = $bb_cfg['topics_per_page'];
|
||||
$per_page = config()->get('topics_per_page');
|
||||
$tracker_url = basename(__FILE__);
|
||||
|
||||
$time_format = 'H:i';
|
||||
|
@ -299,8 +299,8 @@ if (isset($_GET[$user_releases_key])) {
|
|||
}
|
||||
|
||||
// Random release
|
||||
if ($bb_cfg['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($bb_cfg['tor_frozen'])) . ") ORDER BY RAND() LIMIT 1")) {
|
||||
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")) {
|
||||
redirect(TOPIC_URL . $random_release['topic_id']);
|
||||
} else {
|
||||
bb_die($lang['NO_MATCH']);
|
||||
|
@ -749,8 +749,8 @@ if ($allowed_forums) {
|
|||
'MAGNET' => $tor_magnet,
|
||||
'TOR_TYPE' => is_gold($tor['tor_type']),
|
||||
|
||||
'TOR_FROZEN' => !IS_AM ? isset($bb_cfg['tor_frozen'][$tor['tor_status']]) : '',
|
||||
'TOR_STATUS_ICON' => $bb_cfg['tor_icons'][$tor['tor_status']],
|
||||
'TOR_FROZEN' => !IS_AM ? isset(config()->get('tor_frozen')[$tor['tor_status']]) : '',
|
||||
'TOR_STATUS_ICON' => config()->get('tor_icons')[$tor['tor_status']],
|
||||
'TOR_STATUS_TEXT' => $lang['TOR_STATUS_NAME'][$tor['tor_status']],
|
||||
|
||||
'TOR_SIZE_RAW' => $size,
|
||||
|
@ -819,9 +819,9 @@ $search_all_opt = '<option value="' . $search_all . '" value="fs-' . $search_all
|
|||
$cat_forum_select = "\n" . '<select id="fs-main" style="width: 100%;" name="' . $forum_key . '[]" multiple size="' . $forum_select_size . "\">\n" . $search_all_opt . $opt . "</select>\n";
|
||||
|
||||
// Status select
|
||||
if ($bb_cfg['tracker']['search_by_tor_status']) {
|
||||
if (config()->get('tracker.search_by_tor_status')) {
|
||||
$statuses = '<table border="0" cellpadding="0" cellspacing="0">';
|
||||
foreach (array_chunk($bb_cfg['tor_icons'], 2, true) as $statuses_part) {
|
||||
foreach (array_chunk(config()->get('tor_icons'), 2, true) as $statuses_part) {
|
||||
$statuses .= '<tr>';
|
||||
foreach ($statuses_part as $status_id => $status_styles) {
|
||||
$checked_status = in_array($status_id, $status) ? 'checked' : '';
|
||||
|
|
|
@ -34,16 +34,16 @@ $user->session_start();
|
|||
set_die_append_msg();
|
||||
|
||||
// Posts per page
|
||||
$posts_per_page = $bb_cfg['posts_per_page'];
|
||||
$posts_per_page = config()->get('posts_per_page');
|
||||
$select_ppp = '';
|
||||
|
||||
if ($userdata['session_admin']) {
|
||||
if ($req_ppp = abs((int)(@$_REQUEST['ppp'])) and in_array($req_ppp, $bb_cfg['allowed_posts_per_page'])) {
|
||||
if ($req_ppp = abs((int)(@$_REQUEST['ppp'])) and in_array($req_ppp, config()->get('allowed_posts_per_page'))) {
|
||||
$posts_per_page = $req_ppp;
|
||||
}
|
||||
|
||||
$select_ppp = [];
|
||||
foreach ($bb_cfg['allowed_posts_per_page'] as $ppp) {
|
||||
foreach (config()->get('allowed_posts_per_page') as $ppp) {
|
||||
$select_ppp[$ppp] = $ppp;
|
||||
}
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ if ($post_id && !empty($t_data['prev_posts'])) {
|
|||
// Is user watching this thread?
|
||||
$can_watch_topic = $is_watching_topic = false;
|
||||
|
||||
if ($bb_cfg['topic_notify_enabled']) {
|
||||
if (config()->get('topic_notify_enabled')) {
|
||||
if (!IS_GUEST) {
|
||||
$can_watch_topic = true;
|
||||
|
||||
|
@ -426,7 +426,7 @@ $pg_url .= $post_days ? "&postdays=$post_days" : '';
|
|||
$pg_url .= ($post_order != 'asc') ? "&postorder=$post_order" : '';
|
||||
$pg_url .= isset($_REQUEST['single']) ? "&single=1" : '';
|
||||
$pg_url .= $moderation ? "&mod=1" : '';
|
||||
$pg_url .= ($posts_per_page != $bb_cfg['posts_per_page']) ? "&ppp=$posts_per_page" : '';
|
||||
$pg_url .= ($posts_per_page != config()->get('posts_per_page')) ? "&ppp=$posts_per_page" : '';
|
||||
|
||||
generate_pagination($pg_url, $total_replies, $posts_per_page, $start);
|
||||
|
||||
|
@ -448,7 +448,7 @@ $sel_post_order_ary = [
|
|||
];
|
||||
|
||||
$topic_has_poll = $t_data['topic_vote'];
|
||||
$poll_time_expired = ($t_data['topic_time'] < TIMENOW - $bb_cfg['poll_max_days'] * 86400);
|
||||
$poll_time_expired = ($t_data['topic_time'] < TIMENOW - config()->get('poll_max_days') * 86400);
|
||||
$can_manage_poll = ($t_data['topic_poster'] == $userdata['user_id'] || $is_auth['auth_mod']);
|
||||
$can_add_poll = ($can_manage_poll && !$topic_has_poll && !$poll_time_expired && !$start);
|
||||
|
||||
|
@ -470,19 +470,19 @@ $template->assign_vars([
|
|||
'TOPIC_TITLE' => $topic_title,
|
||||
'PORNO_FORUM' => $t_data['allow_porno_topic'],
|
||||
'REPLY_IMG' => $reply_img,
|
||||
'SHOW_BOT_NICK' => $bb_cfg['show_bot_nick'],
|
||||
'SHOW_BOT_NICK' => config()->get('show_bot_nick'),
|
||||
'T_POST_REPLY' => $reply_alt,
|
||||
|
||||
'HIDE_FROM' => $user->opt_js['h_from'],
|
||||
'HIDE_AVATAR' => $user->opt_js['h_av'],
|
||||
'HIDE_RANK_IMG' => ($user->opt_js['h_rnk_i'] && $bb_cfg['show_rank_image']),
|
||||
'HIDE_RANK_IMG' => ($user->opt_js['h_rnk_i'] && config()->get('show_rank_image')),
|
||||
'HIDE_POST_IMG' => $user->opt_js['h_post_i'],
|
||||
'HIDE_SMILE' => $user->opt_js['h_smile'],
|
||||
'HIDE_SIGNATURE' => $user->opt_js['h_sig'],
|
||||
'SPOILER_OPENED' => $user->opt_js['sp_op'],
|
||||
'SHOW_IMG_AFTER_LOAD' => $user->opt_js['i_aft_l'],
|
||||
|
||||
'HIDE_RANK_IMG_DIS' => !$bb_cfg['show_rank_image'],
|
||||
'HIDE_RANK_IMG_DIS' => !config()->get('show_rank_image'),
|
||||
|
||||
'PINNED_FIRST_POST' => $t_data['topic_show_first_post'],
|
||||
'PIN_HREF' => $t_data['topic_show_first_post'] ? "modcp.php?" . POST_TOPIC_URL . "=$topic_id&mode=post_unpin" : "modcp.php?" . POST_TOPIC_URL . "=$topic_id&mode=post_pin",
|
||||
|
@ -559,7 +559,7 @@ for ($i = 0; $i < $total_posts; $i++) {
|
|||
$poster_bot = ($poster_id == BOT_UID);
|
||||
$poster = $poster_guest ? $lang['GUEST'] : $postrow[$i]['username'];
|
||||
|
||||
$post_date = bb_date($postrow[$i]['post_time'], $bb_cfg['post_date_format']);
|
||||
$post_date = bb_date($postrow[$i]['post_time'], config()->get('post_date_format'));
|
||||
$max_post_time = max($max_post_time, $postrow[$i]['post_time']);
|
||||
$poster_posts = !$poster_guest ? $postrow[$i]['user_posts'] : '';
|
||||
$poster_from = ($postrow[$i]['user_from'] && !$poster_guest) ? $postrow[$i]['user_from'] : '';
|
||||
|
@ -584,8 +584,8 @@ for ($i = 0; $i < $total_posts; $i++) {
|
|||
$poster_rank = $rank_image = '';
|
||||
$user_rank = $postrow[$i]['user_rank'];
|
||||
if (!$user->opt_js['h_rnk_i'] and isset($ranks[$user_rank])) {
|
||||
$rank_image = ($bb_cfg['show_rank_image'] && $ranks[$user_rank]['rank_image']) ? '<img src="' . $ranks[$user_rank]['rank_image'] . '" alt="" title="" border="0" />' : '';
|
||||
$poster_rank = $bb_cfg['show_rank_text'] ? $ranks[$user_rank]['rank_title'] : '';
|
||||
$rank_image = (config()->get('show_rank_image') && $ranks[$user_rank]['rank_image']) ? '<img src="' . $ranks[$user_rank]['rank_image'] . '" alt="" title="" border="0" />' : '';
|
||||
$poster_rank = config()->get('show_rank_text') ? $ranks[$user_rank]['rank_title'] : '';
|
||||
}
|
||||
|
||||
// Handle anon users posting with usernames
|
||||
|
@ -611,7 +611,7 @@ for ($i = 0; $i < $total_posts; $i++) {
|
|||
// Parse message and sig
|
||||
$message = get_parsed_post($postrow[$i]);
|
||||
|
||||
$user_sig = ($bb_cfg['allow_sig'] && !$user->opt_js['h_sig'] && $postrow[$i]['user_sig']) ? $postrow[$i]['user_sig'] : '';
|
||||
$user_sig = (config()->get('allow_sig') && !$user->opt_js['h_sig'] && $postrow[$i]['user_sig']) ? $postrow[$i]['user_sig'] : '';
|
||||
|
||||
if (bf($postrow[$i]['user_opt'], 'user_opt', 'dis_sig')) {
|
||||
$user_sig = $lang['SIGNATURE_DISABLE'];
|
||||
|
@ -642,7 +642,7 @@ for ($i = 0; $i < $total_posts; $i++) {
|
|||
|
||||
// Replace newlines (we use this rather than nl2br because till recently it wasn't XHTML compliant)
|
||||
if ($user_sig) {
|
||||
$user_sig = $bb_cfg['user_signature_start'] . $user_sig . $bb_cfg['user_signature_end'];
|
||||
$user_sig = config()->get('user_signature_start') . $user_sig . config()->get('user_signature_end');
|
||||
}
|
||||
|
||||
// Editing information
|
||||
|
@ -686,11 +686,11 @@ for ($i = 0; $i < $total_posts; $i++) {
|
|||
'POSTER_NAME_JS' => addslashes($poster),
|
||||
'POSTER_RANK' => $poster_rank,
|
||||
'RANK_IMAGE' => $rank_image,
|
||||
'POSTER_JOINED' => $bb_cfg['show_poster_joined'] ? $poster_longevity : '',
|
||||
'POSTER_JOINED' => config()->get('show_poster_joined') ? $poster_longevity : '',
|
||||
|
||||
'POSTER_JOINED_DATE' => $poster_joined,
|
||||
'POSTER_POSTS' => ($bb_cfg['show_poster_posts'] && $poster_posts) ? '<a href="search.php?search_author=1&uid=' . $poster_id . '" target="_blank">' . $poster_posts . '</a>' : '',
|
||||
'POSTER_FROM' => $bb_cfg['show_poster_from'] ? render_flag($poster_from, false) : '',
|
||||
'POSTER_POSTS' => (config()->get('show_poster_posts') && $poster_posts) ? '<a href="search.php?search_author=1&uid=' . $poster_id . '" target="_blank">' . $poster_posts . '</a>' : '',
|
||||
'POSTER_FROM' => config()->get('show_poster_from') ? render_flag($poster_from, false) : '',
|
||||
'POSTER_BOT' => $poster_bot,
|
||||
'POSTER_GUEST' => $poster_guest,
|
||||
'POSTER_ID' => $poster_id,
|
||||
|
@ -764,13 +764,13 @@ if (defined('SPLIT_FORM_START')) {
|
|||
}
|
||||
|
||||
// Quick Reply
|
||||
if ($bb_cfg['show_quick_reply']) {
|
||||
if (config()->get('show_quick_reply')) {
|
||||
if ($is_auth['auth_reply'] && !$locked) {
|
||||
$template->assign_vars([
|
||||
'QUICK_REPLY' => true,
|
||||
'QR_POST_ACTION' => POSTING_URL,
|
||||
'QR_TOPIC_ID' => $topic_id,
|
||||
'CAPTCHA_HTML' => (IS_GUEST && !$bb_cfg['captcha']['disabled']) ? bb_captcha('get') : ''
|
||||
'CAPTCHA_HTML' => (IS_GUEST && !config()->get('captcha.disabled')) ? bb_captcha('get') : ''
|
||||
]);
|
||||
|
||||
if (!IS_GUEST) {
|
||||
|
@ -788,7 +788,7 @@ foreach ($is_auth as $name => $is) {
|
|||
$template->assign_vars(['PG_ROW_CLASS' => $pg_row_class ?? 'row1']);
|
||||
|
||||
if (IS_ADMIN) {
|
||||
$template->assign_vars(['U_LOGS' => "admin/admin_log.php?" . POST_TOPIC_URL . "=$topic_id&db={$bb_cfg['log_days_keep']}"]);
|
||||
$template->assign_vars(['U_LOGS' => "admin/admin_log.php?" . POST_TOPIC_URL . "=$topic_id&db=" . config()->get('log_days_keep')]);
|
||||
}
|
||||
|
||||
print_page('viewtopic.tpl');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue