mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 13:54:02 -07:00
Null coalescing operator can be used
Signed-off-by: Yuriy Pikhtarev <iglix@me.com>
This commit is contained in:
parent
4667c92f60
commit
f0d6d30def
27 changed files with 60 additions and 61 deletions
|
@ -40,7 +40,7 @@ $template->assign_vars(array(
|
|||
|
||||
// Define show peers mode (count only || user names with complete % || full details)
|
||||
$cfg_sp_mode = $bb_cfg['bt_show_peers_mode'];
|
||||
$get_sp_mode = (isset($_GET['spmode'])) ? $_GET['spmode'] : '';
|
||||
$get_sp_mode = $_GET['spmode'] ?? '';
|
||||
|
||||
$s_mode = 'count';
|
||||
|
||||
|
@ -167,7 +167,7 @@ if ($tor_reged && $tor_info) {
|
|||
|
||||
$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 (($user_ratio = get_bt_ratio($bt_userdata)) !== null) {
|
||||
|
|
|
@ -14,21 +14,21 @@ if (!defined('BB_ROOT')) {
|
|||
function get_path_from_id($id, $ext_id, $base_path, $first_div, $sec_div)
|
||||
{
|
||||
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" : '');
|
||||
}
|
||||
|
||||
function get_avatar_path($id, $ext_id, $base_path = null, $first_div = 10000, $sec_div = 100)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
function get_attach_path($id, $ext_id = '', $base_path = null, $first_div = 10000, $sec_div = 100)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -104,8 +104,8 @@ function get_last_read($topic_id = 0, $forum_id = 0)
|
|||
{
|
||||
global $tracking_topics, $tracking_forums, $user;
|
||||
|
||||
$t = isset($tracking_topics[$topic_id]) ? $tracking_topics[$topic_id] : 0;
|
||||
$f = isset($tracking_forums[$forum_id]) ? $tracking_forums[$forum_id] : 0;
|
||||
$t = $tracking_topics[$topic_id] ?? 0;
|
||||
$f = $tracking_forums[$forum_id] ?? 0;
|
||||
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])) {
|
||||
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]))) {
|
||||
|
@ -1386,7 +1386,7 @@ function bb_realpath($path)
|
|||
|
||||
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)
|
||||
|
@ -1455,7 +1455,7 @@ function get_forum_display_sort_option($selected_row = 0, $action = 'list', $lis
|
|||
if ($action == 'list') {
|
||||
for ($i = 0, $iMax = count($listrow['lang_key']); $i < $iMax; $i++) {
|
||||
$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>';
|
||||
}
|
||||
} else {
|
||||
|
@ -1612,7 +1612,7 @@ function get_topic_icon($topic, $is_unread = null)
|
|||
global $bb_cfg, $images;
|
||||
|
||||
$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) {
|
||||
$folder_image = $images['folder'];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue