diff --git a/admin/admin_forums.php b/admin/admin_forums.php index cb7b37ce7..0815c822d 100644 --- a/admin/admin_forums.php +++ b/admin/admin_forums.php @@ -207,7 +207,7 @@ if ($mode) { } $cat_id = $parent['cat_id']; - $forum_parent = ($parent['forum_parent']) ? $parent['forum_parent'] : $parent['forum_id']; + $forum_parent = ($parent['forum_parent']) ?: $parent['forum_id']; $forum_order = $parent['forum_order'] + 5; } else { $max_order = get_max_forum_order($cat_id); @@ -273,7 +273,7 @@ if ($mode) { } $cat_id = $parent['cat_id']; - $forum_parent = ($parent['forum_parent']) ? $parent['forum_parent'] : $parent['forum_id']; + $forum_parent = ($parent['forum_parent']) ?: $parent['forum_id']; $forum_order = $parent['forum_order'] + 5; if ($forum_id == $forum_parent) { @@ -750,7 +750,7 @@ if (!$mode || $show_main_page) { 'FORUM_DESC' => htmlCHR($forum_rows[$j]['forum_desc']), 'NUM_TOPICS' => $forum_rows[$j]['forum_topics'], 'NUM_POSTS' => $forum_rows[$j]['forum_posts'], - 'PRUNE_DAYS' => ($forum_rows[$j]['prune_days']) ? $forum_rows[$j]['prune_days'] : '-', + 'PRUNE_DAYS' => ($forum_rows[$j]['prune_days']) ?: '-', 'ORDER' => $forum_rows[$j]['forum_order'], 'FORUM_ID' => $forum_rows[$j]['forum_id'], diff --git a/admin/admin_terms.php b/admin/admin_terms.php index ce6a85be1..24d45d582 100644 --- a/admin/admin_terms.php +++ b/admin/admin_terms.php @@ -38,7 +38,7 @@ if (isset($_POST['post']) && $bb_cfg['terms'] != $_POST['message']) { $template->assign_vars(array( 'S_ACTION' => 'admin_terms.php', 'EXT_LINK_NW' => $bb_cfg['ext_link_new_win'], - 'MESSAGE' => ($bb_cfg['terms']) ? $bb_cfg['terms'] : '', + 'MESSAGE' => ($bb_cfg['terms']) ?: '', 'PREVIEW_HTML' => (isset($_REQUEST['preview'])) ? bbcode2html($_POST['message']) : '', )); diff --git a/common.php b/common.php index 768392690..9282203f3 100644 --- a/common.php +++ b/common.php @@ -451,7 +451,7 @@ function log_request($file = '', $prepend_str = false, $add_post = true) { global $user; - $file = ($file) ? $file : 'req/' . date('m-d'); + $file = ($file) ?: 'req/' . date('m-d'); $str = array(); $str[] = date('m-d H:i:s'); if ($prepend_str !== false) { diff --git a/dl_list.php b/dl_list.php index 8378029e5..48706c0d5 100644 --- a/dl_list.php +++ b/dl_list.php @@ -57,10 +57,10 @@ $full_url = isset($_POST['full_url']) ? str_replace('&', '&', htmlspecialcha if (isset($_POST['redirect_type']) && $_POST['redirect_type'] == 'search') { $redirect_type = "search.php"; - $redirect = ($full_url) ? $full_url : "$dl_key=1"; + $redirect = ($full_url) ?: "$dl_key=1"; } else { $redirect_type = (!$topic_id) ? "viewforum.php" : "viewtopic.php"; - $redirect = ($full_url) ? $full_url : ((!$topic_id) ? POST_FORUM_URL . "=$forum_id" : POST_TOPIC_URL . "=$topic_id"); + $redirect = ($full_url) ?: ((!$topic_id) ? POST_FORUM_URL . "=$forum_id" : POST_TOPIC_URL . "=$topic_id"); } // Start session management diff --git a/group.php b/group.php index 493c98684..1858a4976 100644 --- a/group.php +++ b/group.php @@ -42,7 +42,7 @@ function generate_user_info(&$row, $date_format, $group_mod, &$from, &$posts, &$ $from = (!empty($row['user_from'])) ? $row['user_from'] : ''; $joined = bb_date($row['user_regdate']); $user_time = (!empty($row['user_time'])) ? bb_date($row['user_time']) : $lang['NONE']; - $posts = ($row['user_posts']) ? $row['user_posts'] : 0; + $posts = ($row['user_posts']) ?: 0; $pm = ($bb_cfg['text_buttons']) ? '' . $lang['SEND_PM_TXTB'] . '' : '' . $lang['SEND_PRIVATE_MESSAGE'] . ''; $avatar = get_avatar($row['user_id'], $row['avatar_ext_id'], !bf($row['user_opt'], 'user_opt', 'dis_avatar'), '', 50, 50); diff --git a/library/attach_mod/displaying_torrent.php b/library/attach_mod/displaying_torrent.php index 2acd53104..7b9784f85 100644 --- a/library/attach_mod/displaying_torrent.php +++ b/library/attach_mod/displaying_torrent.php @@ -94,7 +94,7 @@ $tor_auth_del = ($tor_auth && $tor_reged); $tracker_link = ($tor_reged) ? $lang['BT_REG_YES'] : $lang['BT_REG_NO']; $download_link = DOWNLOAD_URL . $attach_id; -$description = ($comment) ? $comment : preg_replace("#.torrent$#i", '', $display_name); +$description = ($comment) ?: preg_replace("#.torrent$#i", '', $display_name); if ($tor_auth_reg || $tor_auth_del) { $reg_tor_url = '' . $lang['BT_REG_ON_TRACKER'] . ''; @@ -155,7 +155,7 @@ if ($tor_auth) { } if ($tor_reged && $tor_info) { - $tor_size = ($tor_info['size']) ? $tor_info['size'] : 0; + $tor_size = ($tor_info['size']) ?: 0; $tor_id = $tor_info['topic_id']; $tor_type = $tor_info['tor_type']; @@ -498,14 +498,14 @@ if ($tor_reged && $tor_info) { $seeders[strlen($seeders) - 9] = ' '; $template->assign_vars(array( 'SEED_LIST' => $seeders, - 'SEED_COUNT' => ($seed_count) ? $seed_count : 0, + 'SEED_COUNT' => ($seed_count) ?: 0, )); } if ($s_mode != 'full' && $leechers) { $leechers[strlen($leechers) - 9] = ' '; $template->assign_vars(array( 'LEECH_LIST' => $leechers, - 'LEECH_COUNT' => ($leech_count) ? $leech_count : 0, + 'LEECH_COUNT' => ($leech_count) ?: 0, )); } } diff --git a/library/attach_mod/posting_attachments.php b/library/attach_mod/posting_attachments.php index c65e52161..3046d5aa9 100644 --- a/library/attach_mod/posting_attachments.php +++ b/library/attach_mod/posting_attachments.php @@ -778,7 +778,7 @@ class attach_parent $row = DB()->sql_fetchrow($result); DB()->sql_freeresult($result); - $allowed_filesize = $row['max_filesize'] ? $row['max_filesize'] : $attach_config['max_filesize']; + $allowed_filesize = $row['max_filesize'] ?: $attach_config['max_filesize']; $cat_id = (int) $row['cat_id']; $auth_cache = trim($row['forum_permissions']); diff --git a/library/includes/cron/cron_run.php b/library/includes/cron/cron_run.php index a9c2a9a15..ff3e718e6 100644 --- a/library/includes/cron/cron_run.php +++ b/library/includes/cron/cron_run.php @@ -102,7 +102,7 @@ foreach ($cron_jobs as $job) { bb_log($msg . LOG_LF, CRON_LOG_DIR . '/' . CRON_LOG_FILE); if ($cron_runtime_log) { - $runtime_log_file = ($job['log_file']) ? $job['log_file'] : $job['cron_script']; + $runtime_log_file = ($job['log_file']) ?: $job['cron_script']; bb_log($cron_runtime_log . LOG_LF, CRON_LOG_DIR . '/' . basename($runtime_log_file)); } } diff --git a/library/includes/functions.php b/library/includes/functions.php index 1ac9bcd16..5a64dcd79 100644 --- a/library/includes/functions.php +++ b/library/includes/functions.php @@ -72,7 +72,7 @@ function get_tracks($type) trigger_error(__FUNCTION__ . ": invalid type '$type'", E_USER_ERROR); } $tracks = !empty($_COOKIE[$c_name]) ? @unserialize($_COOKIE[$c_name]) : false; - return ($tracks) ? $tracks : array(); + return ($tracks) ?: array(); } function set_tracks($cookie_name, &$tracking_ary, $tracks = null, $val = TIMENOW) @@ -1158,7 +1158,7 @@ function show_bt_userdata($user_id) 'USER_RATIO' => get_bt_ratio($btu), 'MIN_DL_FOR_RATIO' => humn_size(MIN_DL_FOR_RATIO), 'MIN_DL_BYTES' => MIN_DL_FOR_RATIO, - 'AUTH_KEY' => ($btu['auth_key']) ? $btu['auth_key'] : $lang['NONE'], + 'AUTH_KEY' => ($btu['auth_key']) ?: $lang['NONE'], 'TD_DL' => humn_size($btu['down_today']), 'TD_UL' => humn_size($btu['up_today']), @@ -1723,7 +1723,7 @@ function bb_realpath($path) function login_redirect($url = '') { - redirect(LOGIN_URL . '?redirect=' . (($url) ? $url : (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/'))); + redirect(LOGIN_URL . '?redirect=' . (($url) ?: (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/'))); } function meta_refresh($url, $time = 5) diff --git a/library/includes/page_footer_dev.php b/library/includes/page_footer_dev.php index 5dba30efb..cdcf94831 100644 --- a/library/includes/page_footer_dev.php +++ b/library/includes/page_footer_dev.php @@ -124,9 +124,9 @@ function fixSqlLog() { echo ''; if ($sql_log) { - echo '
' . ($sql_log ? $sql_log : '') . '

'; + echo '
' . ($sql_log ?: '') . '

'; } ?> \ No newline at end of file + diff --git a/library/includes/ucp/topic_watch.php b/library/includes/ucp/topic_watch.php index 0bf9e5fd7..73e5f6411 100644 --- a/library/includes/ucp/topic_watch.php +++ b/library/includes/ucp/topic_watch.php @@ -53,7 +53,7 @@ if (!($result = DB()->sql_query($sql))) { bb_die('Could not obtain watch topic information #2'); } $row = DB()->sql_fetchrow($result); -$watch_count = ($row['watch_count']) ? $row['watch_count'] : 0; +$watch_count = ($row['watch_count']) ?: 0; DB()->sql_freeresult($result); if ($watch_count > 0) { diff --git a/library/includes/ucp/viewtorrent.php b/library/includes/ucp/viewtorrent.php index eee55e876..36644d7a5 100644 --- a/library/includes/ucp/viewtorrent.php +++ b/library/includes/ucp/viewtorrent.php @@ -74,8 +74,8 @@ if ($releasing) { 'U_VIEW_FORUM' => FORUM_URL . $row['forum_id'], 'U_VIEW_TOPIC' => TOPIC_URL . $row['topic_id'], 'TOR_TYPE' => is_gold($row['tor_type']), - 'TOPIC_SEEDERS' => ($row['seeders']) ? $row['seeders'] : 0, - 'TOPIC_LEECHERS' => ($row['leechers']) ? $row['leechers'] : 0, + 'TOPIC_SEEDERS' => ($row['seeders']) ?: 0, + 'TOPIC_LEECHERS' => ($row['leechers']) ?: 0, 'SPEED_UP' => ($row['speed_up']) ? humn_size($row['speed_up'], 0, 'KB') . '/s' : '-', )); @@ -94,8 +94,8 @@ if ($seeding) { 'U_VIEW_FORUM' => FORUM_URL . $row['forum_id'], 'U_VIEW_TOPIC' => TOPIC_URL . $row['topic_id'], 'TOR_TYPE' => is_gold($row['tor_type']), - 'TOPIC_SEEDERS' => ($row['seeders']) ? $row['seeders'] : 0, - 'TOPIC_LEECHERS' => ($row['leechers']) ? $row['leechers'] : 0, + 'TOPIC_SEEDERS' => ($row['seeders']) ?: 0, + 'TOPIC_LEECHERS' => ($row['leechers']) ?: 0, 'SPEED_UP' => ($row['speed_up']) ? humn_size($row['speed_up'], 0, 'KB') . '/s' : '-', )); @@ -117,8 +117,8 @@ if ($leeching) { 'U_VIEW_TOPIC' => TOPIC_URL . $row['topic_id'], 'COMPL_PERC' => $compl_perc, 'TOR_TYPE' => is_gold($row['tor_type']), - 'TOPIC_SEEDERS' => ($row['seeders']) ? $row['seeders'] : 0, - 'TOPIC_LEECHERS' => ($row['leechers']) ? $row['leechers'] : 0, + 'TOPIC_SEEDERS' => ($row['seeders']) ?: 0, + 'TOPIC_LEECHERS' => ($row['leechers']) ?: 0, 'SPEED_DOWN' => ($row['speed_down']) ? humn_size($row['speed_down'], 0, 'KB') . '/s' : '-', )); diff --git a/posting.php b/posting.php index 2be572f87..f49263339 100644 --- a/posting.php +++ b/posting.php @@ -643,7 +643,7 @@ $template->assign_vars(array( 'MESSAGE' => $message, 'POSTER_RGROUPS' => isset($poster_rgroups) && !empty($poster_rgroups) ? $poster_rgroups : '', - 'ATTACH_RG_SIG' => ($switch_rg_sig) ? $switch_rg_sig : false, + 'ATTACH_RG_SIG' => ($switch_rg_sig) ?: false, 'U_VIEWTOPIC' => ($mode == 'reply') ? "viewtopic.php?" . POST_TOPIC_URL . "=$topic_id&postorder=desc" : '', diff --git a/privmsg.php b/privmsg.php index ccb51c220..e0115af93 100644 --- a/privmsg.php +++ b/privmsg.php @@ -1389,7 +1389,7 @@ if ($mode == 'read') { 'INBOX_LIMIT_IMG_WIDTH' => max(4, $box_limit_img_length), 'INBOX_LIMIT_PERCENT' => $box_limit_percent, - 'BOX_SIZE_STATUS' => ($l_box_size_status) ? $l_box_size_status : '', + 'BOX_SIZE_STATUS' => ($l_box_size_status) ?: '', 'L_FROM_OR_TO' => ($folder == 'inbox' || $folder == 'savebox') ? $lang['FROM'] : $lang['TO'], diff --git a/tracker.php b/tracker.php index febd9694d..f62266a71 100644 --- a/tracker.php +++ b/tracker.php @@ -417,7 +417,7 @@ if (!$set_default) { } } elseif ($search_id && $previous_settings[$poster_id_key]) { $poster_id_val = intval($previous_settings[$poster_id_key]); - $poster_name_val = ($previous_settings[$poster_name_key]) ? $previous_settings[$poster_name_key] : ''; + $poster_name_val = ($previous_settings[$poster_name_key]) ?: ''; } if ($req_poster_id) { @@ -764,10 +764,10 @@ if ($allowed_forums) { 'TOR_SIZE' => humn_size($size), 'UL_SPEED' => $ul_sp, 'DL_SPEED' => $dl_sp, - 'SEEDS' => ($seeds) ? $seeds : 0, + 'SEEDS' => ($seeds) ?: 0, 'SEEDS_TITLE' => ($seeds) ? $lang['SEEDERS'] : ($lang['SEED_NOT_SEEN'] . ":\n " . (($s_last) ? bb_date($s_last, $date_format) : $lang['NEVER'])), - 'LEECHS' => ($leechs) ? $leechs : 0, - 'COMPLETED' => ($compl) ? $compl : 0, + 'LEECHS' => ($leechs) ?: 0, + 'COMPLETED' => ($compl) ?: 0, 'REPLIES' => $tor['topic_replies'], 'VIEWS' => $tor['topic_views'], 'ADDED_RAW' => $tor['reg_time'], diff --git a/viewtopic.php b/viewtopic.php index 34f161b70..4c53ab47e 100644 --- a/viewtopic.php +++ b/viewtopic.php @@ -606,7 +606,7 @@ for ($i = 0; $i < $total_posts; $i++) { $mc_comment = $postrow[$i]['mc_comment']; $mc_user_id = profile_url(array('username' => $postrow[$i]['mc_username'], 'user_id' => $postrow[$i]['mc_user_id'], 'user_rank' => $postrow[$i]['mc_user_rank'])); - $rg_id = ($postrow[$i]['poster_rg_id']) ? $postrow[$i]['poster_rg_id'] : 0; + $rg_id = ($postrow[$i]['poster_rg_id']) ?: 0; $rg_avatar = get_avatar(GROUP_AVATAR_MASK . $rg_id, $postrow[$i]['rg_avatar_id']); $rg_name = ($postrow[$i]['group_name']) ? htmlCHR($postrow[$i]['group_name']) : ''; $rg_signature = ($postrow[$i]['group_signature']) ? bbcode2html(htmlCHR($postrow[$i]['group_signature'])) : '';