Null coalescing operator can be used

Signed-off-by: Yuriy Pikhtarev <iglix@me.com>
This commit is contained in:
Yuriy Pikhtarev 2018-06-24 15:18:35 +03:00
commit f0d6d30def
No known key found for this signature in database
GPG key ID: 3A9B5A757B48ECC6
27 changed files with 60 additions and 61 deletions

View file

@ -14,7 +14,7 @@ if (!empty($setmodules)) {
} }
require __DIR__ . '/pagestart.php'; require __DIR__ . '/pagestart.php';
$mode = isset($_GET['mode']) ? $_GET['mode'] : ''; $mode = $_GET['mode'] ?? '';
$return_links = array( $return_links = array(
'index' => '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'), 'index' => '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'),
@ -34,7 +34,7 @@ if (!$result = DB()->sql_query($sql)) {
$config_value = $row['config_value']; $config_value = $row['config_value'];
$default_config[$config_name] = $config_value; $default_config[$config_name] = $config_value;
$new[$config_name] = isset($_POST[$config_name]) ? $_POST[$config_name] : $default_config[$config_name]; $new[$config_name] = $_POST[$config_name] ?? $default_config[$config_name];
if (isset($_POST['submit']) && $row['config_value'] != $new[$config_name]) { if (isset($_POST['submit']) && $row['config_value'] != $new[$config_name]) {
if ($config_name == 'seed_bonus_points' || if ($config_name == 'seed_bonus_points' ||

View file

@ -14,11 +14,11 @@ if (!empty($setmodules)) {
return; return;
} }
$mode = isset($_GET['mode']) ? $_GET['mode'] : ''; $mode = $_GET['mode'] ?? '';
$job_id = isset($_GET['id']) ? (int)$_GET['id'] : ''; $job_id = isset($_GET['id']) ? (int)$_GET['id'] : '';
$submit = isset($_POST['submit']); $submit = isset($_POST['submit']);
$jobs = isset($_POST['select']) ? implode(',', $_POST['select']) : ''; $jobs = isset($_POST['select']) ? implode(',', $_POST['select']) : '';
$cron_action = isset($_POST['cron_action']) ? $_POST['cron_action'] : ''; $cron_action = $_POST['cron_action'] ?? '';
if ($mode == 'run' && !$job_id) { if ($mode == 'run' && !$job_id) {
define('BB_ROOT', './../'); define('BB_ROOT', './../');
@ -40,7 +40,7 @@ foreach ($sql as $row) {
$config_value = $row['config_value']; $config_value = $row['config_value'];
$default_config[$config_name] = $config_value; $default_config[$config_name] = $config_value;
$new[$config_name] = isset($_POST[$config_name]) ? $_POST[$config_name] : $default_config[$config_name]; $new[$config_name] = $_POST[$config_name] ?? $default_config[$config_name];
if (isset($_POST['submit']) && $row['config_value'] != $new[$config_name]) { if (isset($_POST['submit']) && $row['config_value'] != $new[$config_name]) {
bb_update_config(array($config_name => $new[$config_name])); bb_update_config(array($config_name => $new[$config_name]));

View file

@ -371,7 +371,7 @@ if ($mode == 'groups') {
$template->assign_vars(array( $template->assign_vars(array(
'TPL_ATTACH_EXTENSION_GROUPS' => true, 'TPL_ATTACH_EXTENSION_GROUPS' => true,
'ADD_GROUP_NAME' => isset($extension_group) ? $extension_group : '', 'ADD_GROUP_NAME' => $extension_group ?? '',
'MAX_FILESIZE' => $max_add_filesize, 'MAX_FILESIZE' => $max_add_filesize,
'S_FILESIZE' => size_select('add_size_select', $size), 'S_FILESIZE' => size_select('add_size_select', $size),
'S_ADD_DOWNLOAD_MODE' => download_select('add_download_mode'), 'S_ADD_DOWNLOAD_MODE' => download_select('add_download_mode'),

View file

@ -559,8 +559,8 @@ if ($mode) {
$move_down_forum_id = false; $move_down_forum_id = false;
$forums = $cat_forums[$cat_id]['f_ord']; $forums = $cat_forums[$cat_id]['f_ord'];
$forum_order = $forum_info['forum_order']; $forum_order = $forum_info['forum_order'];
$prev_forum = isset($forums[$forum_order - 10]) ? $forums[$forum_order - 10] : false; $prev_forum = $forums[$forum_order - 10] ?? false;
$next_forum = isset($forums[$forum_order + 10]) ? $forums[$forum_order + 10] : false; $next_forum = $forums[$forum_order + 10] ?? false;
// move selected forum ($forum_id) UP // move selected forum ($forum_id) UP
if ($move < 0 && $prev_forum) { if ($move < 0 && $prev_forum) {

View file

@ -87,7 +87,7 @@ if (!empty($_POST['edit']) || !empty($_POST['new'])) {
$release_group = isset($_POST['release_group']) ? (int)$_POST['release_group'] : 0; $release_group = isset($_POST['release_group']) ? (int)$_POST['release_group'] : 0;
$group_name = isset($_POST['group_name']) ? trim($_POST['group_name']) : ''; $group_name = isset($_POST['group_name']) ? trim($_POST['group_name']) : '';
$group_desc = isset($_POST['group_description']) ? trim($_POST['group_description']) : ''; $group_desc = isset($_POST['group_description']) ? trim($_POST['group_description']) : '';
$group_moderator = isset($_POST['username']) ? $_POST['username'] : ''; $group_moderator = $_POST['username'] ?? '';
if ($group_name === '') { if ($group_name === '') {
bb_die($lang['NO_GROUP_NAME']); bb_die($lang['NO_GROUP_NAME']);

View file

@ -15,7 +15,7 @@ if (!empty($setmodules)) {
require __DIR__ . '/pagestart.php'; require __DIR__ . '/pagestart.php';
if (isset($_GET['mode']) || isset($_POST['mode'])) { if (isset($_GET['mode']) || isset($_POST['mode'])) {
$mode = isset($_GET['mode']) ? $_GET['mode'] : $_POST['mode']; $mode = $_GET['mode'] ?? $_POST['mode'];
} else { } else {
// //
// These could be entered via a form button // These could be entered via a form button

View file

@ -24,7 +24,7 @@ if (!$result = DB()->sql_query($sql)) {
$config_name = $row['config_name']; $config_name = $row['config_name'];
$config_value = $row['config_value']; $config_value = $row['config_value'];
$default_config[$config_name] = $config_value; $default_config[$config_name] = $config_value;
$new[$config_name] = isset($_POST[$config_name]) ? $_POST[$config_name] : $default_config[$config_name]; $new[$config_name] = $_POST[$config_name] ?? $default_config[$config_name];
if (isset($_POST['submit']) && $row['config_value'] != $new[$config_name]) { if (isset($_POST['submit']) && $row['config_value'] != $new[$config_name]) {
$new_params[$config_name] = $new[$config_name]; $new_params[$config_name] = $new[$config_name];

View file

@ -16,7 +16,7 @@ require __DIR__ . '/pagestart.php';
// Check to see what mode we should operate in // Check to see what mode we should operate in
if (isset($_POST['mode']) || isset($_GET['mode'])) { if (isset($_POST['mode']) || isset($_GET['mode'])) {
$mode = isset($_POST['mode']) ? $_POST['mode'] : $_GET['mode']; $mode = $_POST['mode'] ?? $_GET['mode'];
$mode = htmlspecialchars($mode); $mode = htmlspecialchars($mode);
} else { } else {
$mode = ''; $mode = '';
@ -255,10 +255,10 @@ if (isset($_GET['import_pack']) || isset($_POST['import_pack'])) {
break; break;
case 'savenew': case 'savenew':
$smile_code = isset($_POST['smile_code']) ? $_POST['smile_code'] : $_GET['smile_code']; $smile_code = $_POST['smile_code'] ?? $_GET['smile_code'];
$smile_url = isset($_POST['smile_url']) ? $_POST['smile_url'] : $_GET['smile_url']; $smile_url = $_POST['smile_url'] ?? $_GET['smile_url'];
$smile_url = bb_ltrim(basename($smile_url), "'"); $smile_url = bb_ltrim(basename($smile_url), "'");
$smile_emotion = isset($_POST['smile_emotion']) ? $_POST['smile_emotion'] : $_GET['smile_emotion']; $smile_emotion = $_POST['smile_emotion'] ?? $_GET['smile_emotion'];
$smile_code = trim($smile_code); $smile_code = trim($smile_code);
$smile_url = trim($smile_url); $smile_url = trim($smile_url);
$smile_emotion = trim($smile_emotion); $smile_emotion = trim($smile_emotion);

View file

@ -71,7 +71,7 @@ foreach ($input_vars_num as $var_name) {
$$var_name = isset($_GET[$var_name]) ? (float)$_GET[$var_name] : null; $$var_name = isset($_GET[$var_name]) ? (float)$_GET[$var_name] : null;
} }
// Passkey // Passkey
$passkey = isset($$passkey_key) ? $$passkey_key : null; $passkey = $$passkey_key ?? null;
// Verify request // Verify request
// Required params (info_hash, peer_id, port, uploaded, downloaded, left, passkey) // Required params (info_hash, peer_id, port, uploaded, downloaded, left, passkey)

2
dl.php
View file

@ -185,7 +185,7 @@ if ($download_mode == PHYSICAL_LINK) {
if (IS_GUEST && !bb_captcha('check')) { if (IS_GUEST && !bb_captcha('check')) {
global $template; global $template;
$redirect_url = isset($_POST['redirect_url']) ? $_POST['redirect_url'] : (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/'); $redirect_url = $_POST['redirect_url'] ?? isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/';
$message = '<form action="' . DOWNLOAD_URL . $attachment['attach_id'] . '" method="post">'; $message = '<form action="' . DOWNLOAD_URL . $attachment['attach_id'] . '" method="post">';
$message .= $lang['CAPTCHA'] . ':'; $message .= $lang['CAPTCHA'] . ':';
$message .= '<div class="mrg_10" align="center">' . bb_captcha('get') . '</div>'; $message .= '<div class="mrg_10" align="center">' . bb_captcha('get') . '</div>';

View file

@ -13,9 +13,9 @@ require __DIR__ . '/common.php';
$user->session_start(array('req_login' => true)); $user->session_start(array('req_login' => true));
$mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : ''; $mode = $_REQUEST['mode'] ?? '';
$type = isset($_POST['type']) ? $_POST['type'] : ''; $type = $_POST['type'] ?? '';
$id = isset($_POST['id']) ? $_POST['id'] : 0; $id = $_POST['id'] ?? 0;
$timecheck = TIMENOW - 600; $timecheck = TIMENOW - 600;
if (!$mode) { if (!$mode) {

View file

@ -238,7 +238,7 @@ foreach ($cat_forums as $cid => $c) {
'FORUM_DESC' => $f['forum_desc'], 'FORUM_DESC' => $f['forum_desc'],
'POSTS' => commify($f['forum_posts']), 'POSTS' => commify($f['forum_posts']),
'TOPICS' => commify($f['forum_topics']), 'TOPICS' => commify($f['forum_topics']),
'LAST_SF_ID' => isset($f['last_sf_id']) ? $f['last_sf_id'] : null, 'LAST_SF_ID' => $f['last_sf_id'] ?? null,
'MODERATORS' => isset($moderators[$fid]) ? implode(', ', $moderators[$fid]) : '', 'MODERATORS' => isset($moderators[$fid]) ? implode(', ', $moderators[$fid]) : '',
'FORUM_FOLDER_ALT' => ($new) ? $lang['NEW'] : $lang['OLD'], 'FORUM_FOLDER_ALT' => ($new) ? $lang['NEW'] : $lang['OLD'],
)); ));

View file

@ -40,7 +40,7 @@ $template->assign_vars(array(
// Define show peers mode (count only || user names with complete % || full details) // Define show peers mode (count only || user names with complete % || full details)
$cfg_sp_mode = $bb_cfg['bt_show_peers_mode']; $cfg_sp_mode = $bb_cfg['bt_show_peers_mode'];
$get_sp_mode = (isset($_GET['spmode'])) ? $_GET['spmode'] : ''; $get_sp_mode = $_GET['spmode'] ?? '';
$s_mode = 'count'; $s_mode = 'count';
@ -167,7 +167,7 @@ if ($tor_reged && $tor_info) {
$bt_userdata = DB()->fetch_row($sql); $bt_userdata = DB()->fetch_row($sql);
$user_status = isset($bt_userdata['user_status']) ? $bt_userdata['user_status'] : null; $user_status = $bt_userdata['user_status'] ?? null;
if (($min_ratio_dl || $min_ratio_warn) && $user_status != DL_STATUS_COMPLETE && $bt_user_id != $poster_id && $tor_type != TOR_TYPE_GOLD) { if (($min_ratio_dl || $min_ratio_warn) && $user_status != DL_STATUS_COMPLETE && $bt_user_id != $poster_id && $tor_type != TOR_TYPE_GOLD) {
if (($user_ratio = get_bt_ratio($bt_userdata)) !== null) { if (($user_ratio = get_bt_ratio($bt_userdata)) !== null) {

View file

@ -14,21 +14,21 @@ if (!defined('BB_ROOT')) {
function get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div) function get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div)
{ {
global $bb_cfg; global $bb_cfg;
$ext = isset($bb_cfg['file_id_ext'][$ext_id]) ? $bb_cfg['file_id_ext'][$ext_id] : ''; $ext = $bb_cfg['file_id_ext'][$ext_id] ?? '';
return ($base_path ? "$base_path/" : '') . floor($id / $first_div) . '/' . ($id % $sec_div) . '/' . $id . ($ext ? ".$ext" : ''); return ($base_path ? "$base_path/" : '') . floor($id / $first_div) . '/' . ($id % $sec_div) . '/' . $id . ($ext ? ".$ext" : '');
} }
function get_avatar_path($id, $ext_id, $base_path = null, $first_div = 10000, $sec_div = 100) function get_avatar_path($id, $ext_id, $base_path = null, $first_div = 10000, $sec_div = 100)
{ {
global $bb_cfg; global $bb_cfg;
$base_path = isset($base_path) ? $base_path : $bb_cfg['avatars']['upload_path']; $base_path = $base_path ?? $bb_cfg['avatars']['upload_path'];
return get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div); return get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div);
} }
function get_attach_path($id, $ext_id = '', $base_path = null, $first_div = 10000, $sec_div = 100) function get_attach_path($id, $ext_id = '', $base_path = null, $first_div = 10000, $sec_div = 100)
{ {
global $bb_cfg; global $bb_cfg;
$base_path = isset($base_path) ? $base_path : $bb_cfg['attach']['upload_path']; $base_path = $base_path ?? $bb_cfg['attach']['upload_path'];
return get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div); return get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div);
} }
@ -104,8 +104,8 @@ function get_last_read($topic_id = 0, $forum_id = 0)
{ {
global $tracking_topics, $tracking_forums, $user; global $tracking_topics, $tracking_forums, $user;
$t = isset($tracking_topics[$topic_id]) ? $tracking_topics[$topic_id] : 0; $t = $tracking_topics[$topic_id] ?? 0;
$f = isset($tracking_forums[$forum_id]) ? $tracking_forums[$forum_id] : 0; $f = $tracking_forums[$forum_id] ?? 0;
return max($t, $f, $user->data['user_lastvisit']); return max($t, $f, $user->data['user_lastvisit']);
} }
@ -678,7 +678,7 @@ function request_var($var_name, $default, $multibyte = false, $cookie = false)
if (!isset($_GET[$var_name]) && !isset($_POST[$var_name])) { if (!isset($_GET[$var_name]) && !isset($_POST[$var_name])) {
return (is_array($default)) ? array() : $default; return (is_array($default)) ? array() : $default;
} }
$_REQUEST[$var_name] = isset($_POST[$var_name]) ? $_POST[$var_name] : $_GET[$var_name]; $_REQUEST[$var_name] = $_POST[$var_name] ?? $_GET[$var_name];
} }
if (!isset($_REQUEST[$var_name]) || (is_array($_REQUEST[$var_name]) && !is_array($default)) || (is_array($default) && !is_array($_REQUEST[$var_name]))) { if (!isset($_REQUEST[$var_name]) || (is_array($_REQUEST[$var_name]) && !is_array($default)) || (is_array($default) && !is_array($_REQUEST[$var_name]))) {
@ -1386,7 +1386,7 @@ function bb_realpath($path)
function login_redirect($url = '') function login_redirect($url = '')
{ {
redirect(LOGIN_URL . '?redirect=' . (($url) ?: (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/'))); redirect(LOGIN_URL . '?redirect=' . (($url) ?: ($_SERVER['REQUEST_URI'] ?? '/')));
} }
function meta_refresh($url, $time = 5) function meta_refresh($url, $time = 5)
@ -1455,7 +1455,7 @@ function get_forum_display_sort_option($selected_row = 0, $action = 'list', $lis
if ($action == 'list') { if ($action == 'list') {
for ($i = 0, $iMax = count($listrow['lang_key']); $i < $iMax; $i++) { for ($i = 0, $iMax = count($listrow['lang_key']); $i < $iMax; $i++) {
$selected = ($i == $selected_row) ? ' selected="selected"' : ''; $selected = ($i == $selected_row) ? ' selected="selected"' : '';
$l_value = (isset($lang[$listrow['lang_key'][$i]])) ? $lang[$listrow['lang_key'][$i]] : $listrow['lang_key'][$i]; $l_value = $lang[$listrow['lang_key'][$i]] ?? $listrow['lang_key'][$i];
$res .= '<option value="' . $i . '"' . $selected . '>' . $l_value . '</option>'; $res .= '<option value="' . $i . '"' . $selected . '>' . $l_value . '</option>';
} }
} else { } else {
@ -1612,7 +1612,7 @@ function get_topic_icon($topic, $is_unread = null)
global $bb_cfg, $images; global $bb_cfg, $images;
$t_hot = ($topic['topic_replies'] >= $bb_cfg['hot_threshold']); $t_hot = ($topic['topic_replies'] >= $bb_cfg['hot_threshold']);
$is_unread = null === $is_unread ? is_unread($topic['topic_last_post_time'], $topic['topic_id'], $topic['forum_id']) : $is_unread; $is_unread = $is_unread ?? is_unread($topic['topic_last_post_time'], $topic['topic_id'], $topic['forum_id']);
if ($topic['topic_status'] == TOPIC_MOVED) { if ($topic['topic_status'] == TOPIC_MOVED) {
$folder_image = $images['folder']; $folder_image = $images['folder'];

View file

@ -37,7 +37,7 @@ if (preg_match('/^redirect=([a-z0-9\.#\/\?&=\+\-_]+)/si', $_SERVER['QUERY_STRING
} elseif (!empty($_POST['redirect'])) { } elseif (!empty($_POST['redirect'])) {
$redirect_url = str_replace('&amp;', '&', htmlspecialchars($_POST['redirect'])); $redirect_url = str_replace('&amp;', '&', htmlspecialchars($_POST['redirect']));
} elseif (!empty($_SERVER['HTTP_REFERER']) && ($parts = @parse_url($_SERVER['HTTP_REFERER']))) { } elseif (!empty($_SERVER['HTTP_REFERER']) && ($parts = @parse_url($_SERVER['HTTP_REFERER']))) {
$redirect_url = (isset($parts['path']) ? $parts['path'] : "index.php") . (isset($parts['query']) ? '?' . $parts['query'] : ''); $redirect_url = ($parts['path'] ?? "index.php") . (isset($parts['query']) ? '?' . $parts['query'] : '');
} }
$redirect_url = str_replace('&admin=1', '', $redirect_url); $redirect_url = str_replace('&admin=1', '', $redirect_url);
@ -56,8 +56,8 @@ if (isset($_REQUEST['admin']) && !IS_AM) {
$mod_admin_login = (IS_AM && !$user->data['session_admin']); $mod_admin_login = (IS_AM && !$user->data['session_admin']);
// login username & password // login username & password
$login_username = ($mod_admin_login) ? $userdata['username'] : (isset($_POST['login_username']) ? $_POST['login_username'] : ''); $login_username = ($mod_admin_login) ? $userdata['username'] : ($_POST['login_username'] ?? '');
$login_password = isset($_POST['login_password']) ? $_POST['login_password'] : ''; $login_password = $_POST['login_password'] ?? '';
// Проверка на неверную комбинацию логин/пароль // Проверка на неверную комбинацию логин/пароль
$need_captcha = false; $need_captcha = false;

View file

@ -70,9 +70,9 @@ function validate_mode_condition($request_index, $mod_action = '')
} }
// Obtain initial vars // Obtain initial vars
$forum_id = isset($_REQUEST['f']) ? $_REQUEST['f'] : 0; $forum_id = $_REQUEST['f'] ?? 0;
$topic_id = isset($_REQUEST['t']) ? $_REQUEST['t'] : 0; $topic_id = $_REQUEST['t'] ?? 0;
$post_id = isset($_REQUEST['p']) ? $_REQUEST['p'] : 0; $post_id = $_REQUEST['p'] ?? 0;
$start = isset($_REQUEST['start']) ? abs((int)$_REQUEST['start']) : 0; $start = isset($_REQUEST['start']) ? abs((int)$_REQUEST['start']) : 0;
$confirmed = isset($_POST['confirm']); $confirmed = isset($_POST['confirm']);
@ -166,7 +166,7 @@ if (!$is_auth['auth_mod']) {
// Redirect to login page if not admin session // Redirect to login page if not admin session
if ($is_moderator && !$userdata['session_admin']) { if ($is_moderator && !$userdata['session_admin']) {
$redirect = isset($_POST['redirect']) ? $_POST['redirect'] : $_SERVER['REQUEST_URI']; $redirect = $_POST['redirect'] ?? $_SERVER['REQUEST_URI'];
redirect(LOGIN_URL . "?redirect=$redirect&admin=1"); redirect(LOGIN_URL . "?redirect=$redirect&admin=1");
} }
@ -189,7 +189,7 @@ switch ($mode) {
bb_die($lang['NONE_SELECTED']); bb_die($lang['NONE_SELECTED']);
} }
$req_topics = isset($_POST['topic_id_list']) ? $_POST['topic_id_list'] : $topic_id; $req_topics = $_POST['topic_id_list'] ?? $topic_id;
validate_topics($forum_id, $req_topics, $topic_titles); validate_topics($forum_id, $req_topics, $topic_titles);
if (!$req_topics || !($topic_csv = get_id_csv($req_topics))) { if (!$req_topics || !($topic_csv = get_id_csv($req_topics))) {
@ -370,10 +370,10 @@ switch ($mode) {
//mpd //mpd
$delete_posts = isset($_POST['delete_posts']); $delete_posts = isset($_POST['delete_posts']);
$split = (isset($_POST['split_type_all']) || isset($_POST['split_type_beyond'])); $split = (isset($_POST['split_type_all']) || isset($_POST['split_type_beyond']));
$posts = (isset($_POST['post_id_list'])) ? $_POST['post_id_list'] : array(); $posts = $_POST['post_id_list'] ?? array();
$start = /* (isset($_POST['start'])) ? intval($_POST['start']) : */ $start = /* (isset($_POST['start'])) ? intval($_POST['start']) : */
0; 0;
$topic_first_post_id = (isset($topic_row['topic_first_post_id'])) ? $topic_row['topic_first_post_id'] : ''; $topic_first_post_id = $topic_row['topic_first_post_id'] ?? '';
$post_id_sql = $req_post_id_sql = array(); $post_id_sql = $req_post_id_sql = array();

View file

@ -527,7 +527,7 @@ if ($mode == 'newtopic' || ($mode == 'editpost' && $post_data['first_post'])) {
} }
} }
//bt //bt
$topic_dl_type = (isset($post_info['topic_dl_type'])) ? $post_info['topic_dl_type'] : 0; $topic_dl_type = $post_info['topic_dl_type'] ?? 0;
if ($post_info['allow_reg_tracker'] && $post_data['first_post'] && ($topic_dl_type || $is_auth['auth_mod'])) { if ($post_info['allow_reg_tracker'] && $post_data['first_post'] && ($topic_dl_type || $is_auth['auth_mod'])) {
$sql = " $sql = "

View file

@ -70,7 +70,7 @@ $tracking_forums = get_tracks('forum');
if ($mode =& $_REQUEST['mode']) { if ($mode =& $_REQUEST['mode']) {
// This handles the simple windowed user search functions called from various other scripts // This handles the simple windowed user search functions called from various other scripts
if ($mode == 'searchuser') { if ($mode == 'searchuser') {
$username = isset($_POST['search_username']) ? $_POST['search_username'] : ''; $username = $_POST['search_username'] ?? '';
username_search($username); username_search($username);
exit; exit;
} }

View file

@ -105,9 +105,9 @@ class Torrent
foreach ($default_cfg as $config_name => $config_value) { foreach ($default_cfg as $config_name => $config_value) {
$template->assign_vars(array( $template->assign_vars(array(
'L_' . strtoupper($config_name) => isset($lang[$config_name]) ? $lang[$config_name] : '', 'L_' . strtoupper($config_name) => $lang[$config_name] ?? '',
'L_' . strtoupper($config_name) . '_EXPL' => isset($lang[$config_name . '_expl']) ? $lang[$config_name . '_expl'] : '', 'L_' . strtoupper($config_name) . '_EXPL' => $lang[$config_name . '_expl'] ?? '',
'L_' . strtoupper($config_name) . '_HEAD' => isset($lang[$config_name . '_head']) ? $lang[$config_name . '_head'] : '', 'L_' . strtoupper($config_name) . '_HEAD' => $lang[$config_name . '_head'] ?? '',
)); ));
} }
} }

View file

@ -79,7 +79,7 @@ class Sqlite extends Common
if (is_array($this->prefix . $name)) { if (is_array($this->prefix . $name)) {
return $cached_items; return $cached_items;
} else { } else {
return isset($cached_items[$name]) ? $cached_items[$name] : false; return $cached_items[$name] ?? false;
} }
} }

View file

@ -590,8 +590,7 @@ class User
/** Place user language to the global */ /** Place user language to the global */
global $lang; global $lang;
require(LANG_DIR . 'main.php'); require(LANG_DIR . 'main.php');
setlocale(LC_ALL, isset($bb_cfg['lang'][$this->data['user_lang']]['locale']) ? setlocale(LC_ALL, $bb_cfg['lang'][$this->data['user_lang']]['locale'] ?? 'en_US.UTF-8');
$bb_cfg['lang'][$this->data['user_lang']]['locale'] : 'en_US.UTF-8');
$lang += $source_lang; $lang += $source_lang;
$theme = setup_style(); $theme = setup_style();

View file

@ -258,7 +258,7 @@ class SqlDb
$row = mysqli_fetch_assoc($result); $row = mysqli_fetch_assoc($result);
if ($field_name) { if ($field_name) {
return isset($row[$field_name]) ? $row[$field_name] : false; return $row[$field_name] ?? false;
} }
return $row; return $row;

View file

@ -983,13 +983,13 @@ class Template
// adding language variable (eg: "english" or "german") // adding language variable (eg: "english" or "german")
// can be used to make truly multi-lingual templates // can be used to make truly multi-lingual templates
$this->vars['LANG'] = isset($this->vars['LANG']) ? $this->vars['LANG'] : $bb_cfg['default_lang']; $this->vars['LANG'] = $this->vars['LANG'] ?? $bb_cfg['default_lang'];
// adding current template // adding current template
$tpl = $this->root . '/'; $tpl = $this->root . '/';
if (substr($tpl, 0, 2) === './') { if (substr($tpl, 0, 2) === './') {
$tpl = substr($tpl, 2, strlen($tpl)); $tpl = substr($tpl, 2, strlen($tpl));
} }
$this->vars['TEMPLATE'] = isset($this->vars['TEMPLATE']) ? $this->vars['TEMPLATE'] : $tpl; $this->vars['TEMPLATE'] = $this->vars['TEMPLATE'] ?? $tpl;
$this->vars['TEMPLATE_NAME'] = isset($this->vars['TEMPLATE_NAME']) ? $this->vars['TEMPLATE_NAME'] : $this->tpl; $this->vars['TEMPLATE_NAME'] = $this->vars['TEMPLATE_NAME'] ?? $this->tpl;
} }
} }

View file

@ -10,7 +10,7 @@
global $bb_cfg, $page_cfg, $template, $images, $lang; global $bb_cfg, $page_cfg, $template, $images, $lang;
$width = $height = array(); $width = $height = array();
$template_name = basename(dirname(__FILE__)); $template_name = basename(__DIR__);
$_img = BB_ROOT . 'styles/images/'; $_img = BB_ROOT . 'styles/images/';
$_main = BB_ROOT . 'styles/' . basename(TEMPLATES_DIR) . '/' . $template_name . '/images/'; $_main = BB_ROOT . 'styles/' . basename(TEMPLATES_DIR) . '/' . $template_name . '/images/';

View file

@ -690,8 +690,8 @@ if ($allowed_forums) {
$passkey = DB()->fetch_row("SELECT auth_key FROM " . BB_BT_USERS . " WHERE user_id = " . (int)$user_id . " LIMIT 1"); $passkey = DB()->fetch_row("SELECT auth_key FROM " . BB_BT_USERS . " WHERE user_id = " . (int)$user_id . " LIMIT 1");
// Build torrents table // Build torrents table
foreach (DB()->fetch_rowset($sql) as $tor) { foreach (DB()->fetch_rowset($sql) as $tor) {
$dl = isset($tor['speed_down']) ? $tor['speed_down'] : 0; $dl = $tor['speed_down'] ?? 0;
$ul = isset($tor['speed_up']) ? $tor['speed_up'] : 0; $ul = $tor['speed_up'] ?? 0;
$seeds = $tor['seeders']; $seeds = $tor['seeders'];
$leechs = $tor['leechers']; $leechs = $tor['leechers'];

View file

@ -82,7 +82,7 @@ $mod_redirect_url = '';
$tor_status = -1; // all by default $tor_status = -1; // all by default
if ($is_auth['auth_mod']) { if ($is_auth['auth_mod']) {
$redirect = isset($_POST['redirect']) ? $_POST['redirect'] : $_SERVER['REQUEST_URI']; $redirect = $_POST['redirect'] ?? $_SERVER['REQUEST_URI'];
$redirect = url_arg($redirect, 'mod', 1, '&'); $redirect = url_arg($redirect, 'mod', 1, '&');
$mod_redirect_url = LOGIN_URL . "?redirect=$redirect&admin=1"; $mod_redirect_url = LOGIN_URL . "?redirect=$redirect&admin=1";
@ -456,7 +456,7 @@ foreach ($topic_rowset as $topic) {
'TOR_STATUS_ICON' => isset($topic['tor_status']) ? $bb_cfg['tor_icons'][$topic['tor_status']] : '', 'TOR_STATUS_ICON' => isset($topic['tor_status']) ? $bb_cfg['tor_icons'][$topic['tor_status']] : '',
'TOR_STATUS_TEXT' => isset($topic['tor_status']) ? $lang['TOR_STATUS_NAME'][$topic['tor_status']] : '', 'TOR_STATUS_TEXT' => isset($topic['tor_status']) ? $lang['TOR_STATUS_NAME'][$topic['tor_status']] : '',
'ATTACH' => isset($topic['topic_attachment']) ? $topic['topic_attachment'] : false, 'ATTACH' => $topic['topic_attachment'] ?? false,
'STATUS' => $topic['topic_status'], 'STATUS' => $topic['topic_status'],
'TYPE' => $topic['topic_type'], 'TYPE' => $topic['topic_type'],
'DL' => ($topic['topic_dl_type'] == TOPIC_DL_TYPE_DL && !$forum_data['allow_reg_tracker']), 'DL' => ($topic['topic_dl_type'] == TOPIC_DL_TYPE_DL && !$forum_data['allow_reg_tracker']),

View file

@ -182,7 +182,7 @@ $moderation = (!empty($_REQUEST['mod']) && $is_auth['auth_mod']);
$mod_redirect_url = ''; $mod_redirect_url = '';
if ($is_auth['auth_mod']) { if ($is_auth['auth_mod']) {
$redirect = isset($_POST['redirect']) ? $_POST['redirect'] : @$_SERVER['REQUEST_URI']; $redirect = $_POST['redirect'] ?? @$_SERVER['REQUEST_URI'];
$redirect = url_arg($redirect, 'mod', 1, '&'); $redirect = url_arg($redirect, 'mod', 1, '&');
$mod_redirect_url = LOGIN_URL . "?redirect=$redirect&admin=1"; $mod_redirect_url = LOGIN_URL . "?redirect=$redirect&admin=1";
@ -798,7 +798,7 @@ foreach ($is_auth as $name => $is) {
} }
$template->assign_vars(array( $template->assign_vars(array(
'PG_ROW_CLASS' => isset($pg_row_class) ? $pg_row_class : 'row1', 'PG_ROW_CLASS' => $pg_row_class ?? 'row1',
)); ));
if (IS_ADMIN) { if (IS_ADMIN) {