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'] . '' : '';
$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 '